From 155e62642603d164425deeb98488014a82f39770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gauvain=20Boich=C3=A9?= Date: Sat, 4 Apr 2020 23:28:30 +0200 Subject: [PATCH] Extensions --- ext/phpbbstudio/dice/acp/dice_info.php | 30 + ext/phpbbstudio/dice/acp/dice_module.php | 73 + .../dice/adm/style/css/dice_acp.css | 409 ++++++ .../dice/adm/style/css/dice_locations.css | 63 + ext/phpbbstudio/dice/adm/style/dice_acp.html | 280 ++++ .../dice/adm/style/dice_example.html | 51 + .../dice/adm/style/dice_input.html | 12 + .../dice/adm/style/dice_locations.html | 72 + .../acp_forums_normal_settings_append.html | 26 + ext/phpbbstudio/dice/adm/style/js/dice_acp.js | 31 + ext/phpbbstudio/dice/composer.json | 27 + ext/phpbbstudio/dice/config/routing.yml | 30 + ext/phpbbstudio/dice/config/services.yml | 34 + .../dice/config/services_controllers.yml | 32 + .../dice/config/services_functions.yml | 24 + .../dice/config/services_listeners.yml | 50 + ext/phpbbstudio/dice/config/tables.yml | 2 + .../dice/controller/admin_controller.php | 613 +++++++++ .../dice/controller/admin_interface.php | 33 + .../dice/controller/main_controller.php | 458 +++++++ .../dice/controller/main_interface.php | 58 + .../dice/core/functions_common.php | 609 +++++++++ .../dice/core/functions_finder.php | 73 + ext/phpbbstudio/dice/core/functions_regex.php | 136 ++ ext/phpbbstudio/dice/core/functions_utils.php | 228 ++++ ext/phpbbstudio/dice/docs/.htaccess | 4 + ext/phpbbstudio/dice/docs/CHANGELOG.md | 35 + ext/phpbbstudio/dice/docs/CREDITS.txt | 25 + ext/phpbbstudio/dice/docs/EVENTS.txt | 19 + ext/phpbbstudio/dice/docs/FEATURES.md | 10 + ext/phpbbstudio/dice/docs/README.md | 11 + ext/phpbbstudio/dice/docs/index.html | 15 + ext/phpbbstudio/dice/entity/roll.php | 1213 +++++++++++++++++ .../dice/entity/roll_interface.php | 394 ++++++ ext/phpbbstudio/dice/event/acp_listener.php | 288 ++++ .../dice/event/bbcode_listener.php | 114 ++ .../dice/event/display_listener.php | 624 +++++++++ .../dice/event/posting_listener.php | 203 +++ ext/phpbbstudio/dice/event/setup_listener.php | 151 ++ ext/phpbbstudio/dice/exception/base.php | 167 +++ .../dice/exception/out_of_bounds.php | 27 + .../dice/exception/unexpected_value.php | 27 + ext/phpbbstudio/dice/ext.php | 34 + ext/phpbbstudio/dice/language/en/acp_dice.php | 130 ++ .../dice/language/en/dice_common.php | 210 +++ .../dice/language/en/dice_exceptions.php | 60 + .../dice/language/en/ext_require.php | 26 + .../dice/language/en/info_acp_dice.php | 53 + .../dice/language/en/info_ucp_dice.php | 30 + .../dice/language/en/permissions_dice.php | 38 + ext/phpbbstudio/dice/language/es/acp_dice.php | 130 ++ .../dice/language/es/dice_common.php | 210 +++ .../dice/language/es/dice_exceptions.php | 60 + .../dice/language/es/ext_require.php | 26 + .../dice/language/es/info_acp_dice.php | 53 + .../dice/language/es/info_ucp_dice.php | 30 + .../dice/language/es/permissions_dice.php | 38 + ext/phpbbstudio/dice/license.txt | 280 ++++ .../dice/migrations/install_acp_module.php | 52 + .../dice/migrations/install_config_text.php | 41 + .../dice/migrations/install_configs.php | 72 + .../dice/migrations/install_permissions.php | 58 + .../dice/migrations/install_roles.php | 93 ++ .../dice/migrations/install_roles_2.php | 69 + .../dice/migrations/install_ucp_module.php | 71 + .../dice/migrations/install_user_schema.php | 118 ++ .../migrations/update_skins_directory.php | 72 + ext/phpbbstudio/dice/operator/roll.php | 306 +++++ .../dice/operator/roll_interface.php | 125 ++ .../dice/skins/bajahs_red/d10_1.gif | Bin 0 -> 1457 bytes .../dice/skins/bajahs_red/d10_10.gif | Bin 0 -> 1500 bytes .../dice/skins/bajahs_red/d10_2.gif | Bin 0 -> 1447 bytes .../dice/skins/bajahs_red/d10_3.gif | Bin 0 -> 1407 bytes .../dice/skins/bajahs_red/d10_4.gif | Bin 0 -> 1476 bytes .../dice/skins/bajahs_red/d10_5.gif | Bin 0 -> 1523 bytes .../dice/skins/bajahs_red/d10_6.gif | Bin 0 -> 1427 bytes .../dice/skins/bajahs_red/d10_7.gif | Bin 0 -> 1446 bytes .../dice/skins/bajahs_red/d10_8.gif | Bin 0 -> 1478 bytes .../dice/skins/bajahs_red/d10_9.gif | Bin 0 -> 1447 bytes .../dice/skins/bajahs_red/d12_1.gif | Bin 0 -> 1512 bytes .../dice/skins/bajahs_red/d12_10.gif | Bin 0 -> 1532 bytes .../dice/skins/bajahs_red/d12_11.gif | Bin 0 -> 1554 bytes .../dice/skins/bajahs_red/d12_12.gif | Bin 0 -> 1605 bytes .../dice/skins/bajahs_red/d12_2.gif | Bin 0 -> 1536 bytes .../dice/skins/bajahs_red/d12_3.gif | Bin 0 -> 1595 bytes .../dice/skins/bajahs_red/d12_4.gif | Bin 0 -> 1528 bytes .../dice/skins/bajahs_red/d12_5.gif | Bin 0 -> 1566 bytes .../dice/skins/bajahs_red/d12_6.gif | Bin 0 -> 1572 bytes .../dice/skins/bajahs_red/d12_7.gif | Bin 0 -> 1539 bytes .../dice/skins/bajahs_red/d12_8.gif | Bin 0 -> 1599 bytes .../dice/skins/bajahs_red/d12_9.gif | Bin 0 -> 1545 bytes .../dice/skins/bajahs_red/d20_1.gif | Bin 0 -> 1572 bytes .../dice/skins/bajahs_red/d20_10.gif | Bin 0 -> 1617 bytes .../dice/skins/bajahs_red/d20_11.gif | Bin 0 -> 1620 bytes .../dice/skins/bajahs_red/d20_12.gif | Bin 0 -> 1631 bytes .../dice/skins/bajahs_red/d20_13.gif | Bin 0 -> 1595 bytes .../dice/skins/bajahs_red/d20_14.gif | Bin 0 -> 1570 bytes .../dice/skins/bajahs_red/d20_15.gif | Bin 0 -> 1644 bytes .../dice/skins/bajahs_red/d20_16.gif | Bin 0 -> 1639 bytes .../dice/skins/bajahs_red/d20_17.gif | Bin 0 -> 1618 bytes .../dice/skins/bajahs_red/d20_18.gif | Bin 0 -> 1628 bytes .../dice/skins/bajahs_red/d20_19.gif | Bin 0 -> 1559 bytes .../dice/skins/bajahs_red/d20_2.gif | Bin 0 -> 1643 bytes .../dice/skins/bajahs_red/d20_20.gif | Bin 0 -> 1588 bytes .../dice/skins/bajahs_red/d20_3.gif | Bin 0 -> 1585 bytes .../dice/skins/bajahs_red/d20_4.gif | Bin 0 -> 1610 bytes .../dice/skins/bajahs_red/d20_5.gif | Bin 0 -> 1611 bytes .../dice/skins/bajahs_red/d20_6.gif | Bin 0 -> 1622 bytes .../dice/skins/bajahs_red/d20_7.gif | Bin 0 -> 1651 bytes .../dice/skins/bajahs_red/d20_8.gif | Bin 0 -> 1618 bytes .../dice/skins/bajahs_red/d20_9.gif | Bin 0 -> 1616 bytes .../dice/skins/bajahs_red/d4_1.gif | Bin 0 -> 1079 bytes .../dice/skins/bajahs_red/d4_2.gif | Bin 0 -> 1081 bytes .../dice/skins/bajahs_red/d4_3.gif | Bin 0 -> 1084 bytes .../dice/skins/bajahs_red/d4_4.gif | Bin 0 -> 1062 bytes .../dice/skins/bajahs_red/d6_1.gif | Bin 0 -> 1320 bytes .../dice/skins/bajahs_red/d6_2.gif | Bin 0 -> 1326 bytes .../dice/skins/bajahs_red/d6_3.gif | Bin 0 -> 1228 bytes .../dice/skins/bajahs_red/d6_4.gif | Bin 0 -> 1272 bytes .../dice/skins/bajahs_red/d6_5.gif | Bin 0 -> 1293 bytes .../dice/skins/bajahs_red/d6_6.gif | Bin 0 -> 1310 bytes .../dice/skins/bajahs_red/d8_1.gif | Bin 0 -> 1350 bytes .../dice/skins/bajahs_red/d8_2.gif | Bin 0 -> 1375 bytes .../dice/skins/bajahs_red/d8_3.gif | Bin 0 -> 1350 bytes .../dice/skins/bajahs_red/d8_4.gif | Bin 0 -> 1326 bytes .../dice/skins/bajahs_red/d8_5.gif | Bin 0 -> 1361 bytes .../dice/skins/bajahs_red/d8_6.gif | Bin 0 -> 1361 bytes .../dice/skins/bajahs_red/d8_7.gif | Bin 0 -> 1373 bytes .../dice/skins/bajahs_red/d8_8.gif | Bin 0 -> 1360 bytes .../dice/skins/bajahs_red/index.html | 15 + .../dice/skins/classic_steel/d10_0.gif | Bin 0 -> 3283 bytes .../dice/skins/classic_steel/d10_1.gif | Bin 0 -> 3395 bytes .../dice/skins/classic_steel/d10_10.gif | Bin 0 -> 3942 bytes .../dice/skins/classic_steel/d10_2.gif | Bin 0 -> 3259 bytes .../dice/skins/classic_steel/d10_3.gif | Bin 0 -> 3189 bytes .../dice/skins/classic_steel/d10_4.gif | Bin 0 -> 3160 bytes .../dice/skins/classic_steel/d10_5.gif | Bin 0 -> 3240 bytes .../dice/skins/classic_steel/d10_6.gif | Bin 0 -> 3318 bytes .../dice/skins/classic_steel/d10_7.gif | Bin 0 -> 3146 bytes .../dice/skins/classic_steel/d10_8.gif | Bin 0 -> 3361 bytes .../dice/skins/classic_steel/d10_9.gif | Bin 0 -> 3361 bytes .../dice/skins/classic_steel/d12_1.gif | Bin 0 -> 3924 bytes .../dice/skins/classic_steel/d12_10.gif | Bin 0 -> 4104 bytes .../dice/skins/classic_steel/d12_11.gif | Bin 0 -> 4256 bytes .../dice/skins/classic_steel/d12_12.gif | Bin 0 -> 4268 bytes .../dice/skins/classic_steel/d12_2.gif | Bin 0 -> 4083 bytes .../dice/skins/classic_steel/d12_3.gif | Bin 0 -> 4081 bytes .../dice/skins/classic_steel/d12_4.gif | Bin 0 -> 4056 bytes .../dice/skins/classic_steel/d12_5.gif | Bin 0 -> 4376 bytes .../dice/skins/classic_steel/d12_6.gif | Bin 0 -> 4057 bytes .../dice/skins/classic_steel/d12_7.gif | Bin 0 -> 4340 bytes .../dice/skins/classic_steel/d12_8.gif | Bin 0 -> 4264 bytes .../dice/skins/classic_steel/d12_9.gif | Bin 0 -> 4259 bytes .../dice/skins/classic_steel/d20_1.gif | Bin 0 -> 4634 bytes .../dice/skins/classic_steel/d20_10.gif | Bin 0 -> 4440 bytes .../dice/skins/classic_steel/d20_11.gif | Bin 0 -> 4315 bytes .../dice/skins/classic_steel/d20_12.gif | Bin 0 -> 4330 bytes .../dice/skins/classic_steel/d20_13.gif | Bin 0 -> 4376 bytes .../dice/skins/classic_steel/d20_14.gif | Bin 0 -> 4436 bytes .../dice/skins/classic_steel/d20_15.gif | Bin 0 -> 4413 bytes .../dice/skins/classic_steel/d20_16.gif | Bin 0 -> 4728 bytes .../dice/skins/classic_steel/d20_17.gif | Bin 0 -> 4481 bytes .../dice/skins/classic_steel/d20_18.gif | Bin 0 -> 4580 bytes .../dice/skins/classic_steel/d20_19.gif | Bin 0 -> 4557 bytes .../dice/skins/classic_steel/d20_2.gif | Bin 0 -> 4535 bytes .../dice/skins/classic_steel/d20_20.gif | Bin 0 -> 4687 bytes .../dice/skins/classic_steel/d20_3.gif | Bin 0 -> 4449 bytes .../dice/skins/classic_steel/d20_4.gif | Bin 0 -> 4598 bytes .../dice/skins/classic_steel/d20_5.gif | Bin 0 -> 4765 bytes .../dice/skins/classic_steel/d20_6.gif | Bin 0 -> 4566 bytes .../dice/skins/classic_steel/d20_7.gif | Bin 0 -> 4271 bytes .../dice/skins/classic_steel/d20_8.gif | Bin 0 -> 4481 bytes .../dice/skins/classic_steel/d20_9.gif | Bin 0 -> 4213 bytes .../dice/skins/classic_steel/d4_1.gif | Bin 0 -> 3042 bytes .../dice/skins/classic_steel/d4_2.gif | Bin 0 -> 3181 bytes .../dice/skins/classic_steel/d4_3.gif | Bin 0 -> 3288 bytes .../dice/skins/classic_steel/d4_4.gif | Bin 0 -> 3082 bytes .../dice/skins/classic_steel/d6_1.gif | Bin 0 -> 3288 bytes .../dice/skins/classic_steel/d6_2.gif | Bin 0 -> 3768 bytes .../dice/skins/classic_steel/d6_3.gif | Bin 0 -> 3602 bytes .../dice/skins/classic_steel/d6_4.gif | Bin 0 -> 3312 bytes .../dice/skins/classic_steel/d6_5.gif | Bin 0 -> 3842 bytes .../dice/skins/classic_steel/d6_6.gif | Bin 0 -> 3771 bytes .../dice/skins/classic_steel/d8_1.gif | Bin 0 -> 3400 bytes .../dice/skins/classic_steel/d8_2.gif | Bin 0 -> 3497 bytes .../dice/skins/classic_steel/d8_3.gif | Bin 0 -> 3482 bytes .../dice/skins/classic_steel/d8_4.gif | Bin 0 -> 3427 bytes .../dice/skins/classic_steel/d8_5.gif | Bin 0 -> 3524 bytes .../dice/skins/classic_steel/d8_6.gif | Bin 0 -> 3702 bytes .../dice/skins/classic_steel/d8_7.gif | Bin 0 -> 3506 bytes .../dice/skins/classic_steel/d8_8.gif | Bin 0 -> 3690 bytes .../dice/skins/classic_steel/index.html | 15 + .../dice/skins/flat_bw_svg/d10_1.svg | 1 + .../dice/skins/flat_bw_svg/d10_10.svg | 1 + .../dice/skins/flat_bw_svg/d10_2.svg | 1 + .../dice/skins/flat_bw_svg/d10_3.svg | 1 + .../dice/skins/flat_bw_svg/d10_4.svg | 1 + .../dice/skins/flat_bw_svg/d10_5.svg | 1 + .../dice/skins/flat_bw_svg/d10_6.svg | 1 + .../dice/skins/flat_bw_svg/d10_7.svg | 1 + .../dice/skins/flat_bw_svg/d10_8.svg | 1 + .../dice/skins/flat_bw_svg/d10_9.svg | 1 + .../dice/skins/flat_bw_svg/d12_1.svg | 1 + .../dice/skins/flat_bw_svg/d12_10.svg | 1 + .../dice/skins/flat_bw_svg/d12_11.svg | 1 + .../dice/skins/flat_bw_svg/d12_12.svg | 1 + .../dice/skins/flat_bw_svg/d12_2.svg | 1 + .../dice/skins/flat_bw_svg/d12_3.svg | 1 + .../dice/skins/flat_bw_svg/d12_4.svg | 1 + .../dice/skins/flat_bw_svg/d12_5.svg | 1 + .../dice/skins/flat_bw_svg/d12_6.svg | 1 + .../dice/skins/flat_bw_svg/d12_7.svg | 1 + .../dice/skins/flat_bw_svg/d12_8.svg | 1 + .../dice/skins/flat_bw_svg/d12_9.svg | 1 + .../dice/skins/flat_bw_svg/d20_1.svg | 1 + .../dice/skins/flat_bw_svg/d20_10.svg | 1 + .../dice/skins/flat_bw_svg/d20_11.svg | 1 + .../dice/skins/flat_bw_svg/d20_12.svg | 1 + .../dice/skins/flat_bw_svg/d20_13.svg | 1 + .../dice/skins/flat_bw_svg/d20_14.svg | 1 + .../dice/skins/flat_bw_svg/d20_15.svg | 1 + .../dice/skins/flat_bw_svg/d20_16.svg | 1 + .../dice/skins/flat_bw_svg/d20_17.svg | 1 + .../dice/skins/flat_bw_svg/d20_18.svg | 1 + .../dice/skins/flat_bw_svg/d20_19.svg | 1 + .../dice/skins/flat_bw_svg/d20_2.svg | 1 + .../dice/skins/flat_bw_svg/d20_20.svg | 1 + .../dice/skins/flat_bw_svg/d20_3.svg | 1 + .../dice/skins/flat_bw_svg/d20_4.svg | 1 + .../dice/skins/flat_bw_svg/d20_5.svg | 1 + .../dice/skins/flat_bw_svg/d20_6.svg | 1 + .../dice/skins/flat_bw_svg/d20_7.svg | 1 + .../dice/skins/flat_bw_svg/d20_8.svg | 1 + .../dice/skins/flat_bw_svg/d20_9.svg | 1 + .../dice/skins/flat_bw_svg/d4_1.svg | 1 + .../dice/skins/flat_bw_svg/d4_2.svg | 1 + .../dice/skins/flat_bw_svg/d4_3.svg | 1 + .../dice/skins/flat_bw_svg/d4_4.svg | 1 + .../dice/skins/flat_bw_svg/d6_1.svg | 1 + .../dice/skins/flat_bw_svg/d6_2.svg | 1 + .../dice/skins/flat_bw_svg/d6_3.svg | 1 + .../dice/skins/flat_bw_svg/d6_4.svg | 1 + .../dice/skins/flat_bw_svg/d6_5.svg | 1 + .../dice/skins/flat_bw_svg/d6_6.svg | 1 + .../dice/skins/flat_bw_svg/d8_1.svg | 1 + .../dice/skins/flat_bw_svg/d8_2.svg | 1 + .../dice/skins/flat_bw_svg/d8_3.svg | 1 + .../dice/skins/flat_bw_svg/d8_4.svg | 1 + .../dice/skins/flat_bw_svg/d8_5.svg | 1 + .../dice/skins/flat_bw_svg/d8_6.svg | 1 + .../dice/skins/flat_bw_svg/d8_7.svg | 1 + .../dice/skins/flat_bw_svg/d8_8.svg | 1 + .../dice/skins/flat_bw_svg/index.html | 15 + ext/phpbbstudio/dice/skins/index.html | 15 + .../dice/styles/all/template/dice_edit.html | 23 + .../dice/styles/all/template/dice_page.html | 291 ++++ .../styles/all/template/dice_posting.html | 102 ++ .../dice/styles/all/template/dice_roll.html | 19 + .../template/event/mcp_post_text_after.html | 12 + .../mcp_topic_postrow_attachments_before.html | 12 + .../navbar_header_logged_out_content.html | 8 + .../navbar_header_quick_links_after.html | 7 + .../navbar_header_quick_links_before.html | 7 + .../navbar_header_user_profile_append.html | 7 + .../overall_footer_breadcrumb_append.html | 7 + .../event/overall_footer_teamlink_after.html | 7 + .../event/overall_footer_teamlink_before.html | 7 + .../event/overall_footer_timezone_after.html | 7 + .../event/overall_footer_timezone_before.html | 7 + .../event/overall_header_head_append.html | 11 + .../overall_header_navigation_append.html | 7 + .../overall_header_navigation_prepend.html | 7 + .../event/posting_editor_add_panel_tab.html | 6 + .../posting_layout_include_panel_body.html | 3 + ...osting_topic_review_row_content_after.html | 12 + .../viewtopic_body_postrow_content_after.html | 12 + .../event/viewtopic_topic_title_before.html | 5 + .../dice/styles/all/template/js/dice.js | 285 ++++ .../styles/all/template/js/dice_display.js | 53 + .../dice/styles/all/theme/dice.css | 23 + .../dice/styles/all/theme/dice_display.css | 153 +++ .../dice/styles/all/theme/dice_page.css | 136 ++ .../prosilver/template/ucp_dice_body.html | 36 + ext/phpbbstudio/dice/ucp/main_info.php | 30 + ext/phpbbstudio/dice/ucp/main_module.php | 67 + styles/Milk_v2/theme/colours_nuit.css | 4 +- 286 files changed, 10757 insertions(+), 2 deletions(-) create mode 100644 ext/phpbbstudio/dice/acp/dice_info.php create mode 100644 ext/phpbbstudio/dice/acp/dice_module.php create mode 100644 ext/phpbbstudio/dice/adm/style/css/dice_acp.css create mode 100644 ext/phpbbstudio/dice/adm/style/css/dice_locations.css create mode 100644 ext/phpbbstudio/dice/adm/style/dice_acp.html create mode 100644 ext/phpbbstudio/dice/adm/style/dice_example.html create mode 100644 ext/phpbbstudio/dice/adm/style/dice_input.html create mode 100644 ext/phpbbstudio/dice/adm/style/dice_locations.html create mode 100644 ext/phpbbstudio/dice/adm/style/event/acp_forums_normal_settings_append.html create mode 100644 ext/phpbbstudio/dice/adm/style/js/dice_acp.js create mode 100644 ext/phpbbstudio/dice/composer.json create mode 100644 ext/phpbbstudio/dice/config/routing.yml create mode 100644 ext/phpbbstudio/dice/config/services.yml create mode 100644 ext/phpbbstudio/dice/config/services_controllers.yml create mode 100644 ext/phpbbstudio/dice/config/services_functions.yml create mode 100644 ext/phpbbstudio/dice/config/services_listeners.yml create mode 100644 ext/phpbbstudio/dice/config/tables.yml create mode 100644 ext/phpbbstudio/dice/controller/admin_controller.php create mode 100644 ext/phpbbstudio/dice/controller/admin_interface.php create mode 100644 ext/phpbbstudio/dice/controller/main_controller.php create mode 100644 ext/phpbbstudio/dice/controller/main_interface.php create mode 100644 ext/phpbbstudio/dice/core/functions_common.php create mode 100644 ext/phpbbstudio/dice/core/functions_finder.php create mode 100644 ext/phpbbstudio/dice/core/functions_regex.php create mode 100644 ext/phpbbstudio/dice/core/functions_utils.php create mode 100644 ext/phpbbstudio/dice/docs/.htaccess create mode 100644 ext/phpbbstudio/dice/docs/CHANGELOG.md create mode 100644 ext/phpbbstudio/dice/docs/CREDITS.txt create mode 100644 ext/phpbbstudio/dice/docs/EVENTS.txt create mode 100644 ext/phpbbstudio/dice/docs/FEATURES.md create mode 100644 ext/phpbbstudio/dice/docs/README.md create mode 100644 ext/phpbbstudio/dice/docs/index.html create mode 100644 ext/phpbbstudio/dice/entity/roll.php create mode 100644 ext/phpbbstudio/dice/entity/roll_interface.php create mode 100644 ext/phpbbstudio/dice/event/acp_listener.php create mode 100644 ext/phpbbstudio/dice/event/bbcode_listener.php create mode 100644 ext/phpbbstudio/dice/event/display_listener.php create mode 100644 ext/phpbbstudio/dice/event/posting_listener.php create mode 100644 ext/phpbbstudio/dice/event/setup_listener.php create mode 100644 ext/phpbbstudio/dice/exception/base.php create mode 100644 ext/phpbbstudio/dice/exception/out_of_bounds.php create mode 100644 ext/phpbbstudio/dice/exception/unexpected_value.php create mode 100644 ext/phpbbstudio/dice/ext.php create mode 100644 ext/phpbbstudio/dice/language/en/acp_dice.php create mode 100644 ext/phpbbstudio/dice/language/en/dice_common.php create mode 100644 ext/phpbbstudio/dice/language/en/dice_exceptions.php create mode 100644 ext/phpbbstudio/dice/language/en/ext_require.php create mode 100644 ext/phpbbstudio/dice/language/en/info_acp_dice.php create mode 100644 ext/phpbbstudio/dice/language/en/info_ucp_dice.php create mode 100644 ext/phpbbstudio/dice/language/en/permissions_dice.php create mode 100644 ext/phpbbstudio/dice/language/es/acp_dice.php create mode 100644 ext/phpbbstudio/dice/language/es/dice_common.php create mode 100644 ext/phpbbstudio/dice/language/es/dice_exceptions.php create mode 100644 ext/phpbbstudio/dice/language/es/ext_require.php create mode 100644 ext/phpbbstudio/dice/language/es/info_acp_dice.php create mode 100644 ext/phpbbstudio/dice/language/es/info_ucp_dice.php create mode 100644 ext/phpbbstudio/dice/language/es/permissions_dice.php create mode 100644 ext/phpbbstudio/dice/license.txt create mode 100644 ext/phpbbstudio/dice/migrations/install_acp_module.php create mode 100644 ext/phpbbstudio/dice/migrations/install_config_text.php create mode 100644 ext/phpbbstudio/dice/migrations/install_configs.php create mode 100644 ext/phpbbstudio/dice/migrations/install_permissions.php create mode 100644 ext/phpbbstudio/dice/migrations/install_roles.php create mode 100644 ext/phpbbstudio/dice/migrations/install_roles_2.php create mode 100644 ext/phpbbstudio/dice/migrations/install_ucp_module.php create mode 100644 ext/phpbbstudio/dice/migrations/install_user_schema.php create mode 100644 ext/phpbbstudio/dice/migrations/update_skins_directory.php create mode 100644 ext/phpbbstudio/dice/operator/roll.php create mode 100644 ext/phpbbstudio/dice/operator/roll_interface.php create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_1.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_10.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_2.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_3.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_4.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_5.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_6.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_7.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_8.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d10_9.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_1.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_10.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_11.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_12.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_2.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_3.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_4.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_5.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_6.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_7.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_8.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d12_9.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_1.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_10.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_11.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_12.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_13.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_14.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_15.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_16.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_17.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_18.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_19.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_2.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_20.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_3.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_4.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_5.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_6.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_7.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_8.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d20_9.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d4_1.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d4_2.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d4_3.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d4_4.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d6_1.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d6_2.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d6_3.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d6_4.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d6_5.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d6_6.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_1.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_2.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_3.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_4.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_5.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_6.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_7.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/d8_8.gif create mode 100644 ext/phpbbstudio/dice/skins/bajahs_red/index.html create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_0.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_1.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_10.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_2.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_3.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_4.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_5.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_6.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_7.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_8.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d10_9.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_1.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_10.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_11.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_12.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_2.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_3.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_4.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_5.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_6.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_7.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_8.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d12_9.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_1.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_10.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_11.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_12.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_13.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_14.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_15.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_16.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_17.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_18.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_19.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_2.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_20.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_3.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_4.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_5.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_6.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_7.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_8.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d20_9.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d4_1.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d4_2.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d4_3.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d4_4.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d6_1.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d6_2.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d6_3.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d6_4.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d6_5.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d6_6.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_1.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_2.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_3.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_4.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_5.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_6.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_7.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/d8_8.gif create mode 100644 ext/phpbbstudio/dice/skins/classic_steel/index.html create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_1.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_10.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_2.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_3.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_4.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_5.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_6.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_7.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_8.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d10_9.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_1.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_10.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_11.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_12.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_2.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_3.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_4.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_5.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_6.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_7.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_8.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d12_9.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_1.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_10.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_11.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_12.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_13.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_14.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_15.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_16.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_17.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_18.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_19.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_2.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_20.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_3.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_4.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_5.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_6.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_7.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_8.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d20_9.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d4_1.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d4_2.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d4_3.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d4_4.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d6_1.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d6_2.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d6_3.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d6_4.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d6_5.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d6_6.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_1.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_2.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_3.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_4.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_5.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_6.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_7.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/d8_8.svg create mode 100644 ext/phpbbstudio/dice/skins/flat_bw_svg/index.html create mode 100644 ext/phpbbstudio/dice/skins/index.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/dice_edit.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/dice_page.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/dice_posting.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/dice_roll.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/mcp_post_text_after.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/mcp_topic_postrow_attachments_before.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/navbar_header_logged_out_content.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_after.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_before.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/navbar_header_user_profile_append.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_footer_breadcrumb_append.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_after.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_before.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_after.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_before.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_header_head_append.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_append.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_prepend.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/posting_editor_add_panel_tab.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/posting_layout_include_panel_body.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/posting_topic_review_row_content_after.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/viewtopic_body_postrow_content_after.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/event/viewtopic_topic_title_before.html create mode 100644 ext/phpbbstudio/dice/styles/all/template/js/dice.js create mode 100644 ext/phpbbstudio/dice/styles/all/template/js/dice_display.js create mode 100644 ext/phpbbstudio/dice/styles/all/theme/dice.css create mode 100644 ext/phpbbstudio/dice/styles/all/theme/dice_display.css create mode 100644 ext/phpbbstudio/dice/styles/all/theme/dice_page.css create mode 100644 ext/phpbbstudio/dice/styles/prosilver/template/ucp_dice_body.html create mode 100644 ext/phpbbstudio/dice/ucp/main_info.php create mode 100644 ext/phpbbstudio/dice/ucp/main_module.php diff --git a/ext/phpbbstudio/dice/acp/dice_info.php b/ext/phpbbstudio/dice/acp/dice_info.php new file mode 100644 index 0000000..7945c03 --- /dev/null +++ b/ext/phpbbstudio/dice/acp/dice_info.php @@ -0,0 +1,30 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\acp; + +/** + * phpBB Studio's Dice ACP module info. + */ +class dice_info +{ + public function module() + { + return [ + 'filename' => '\phpbbstudio\dice\acp\dice_module', + 'title' => 'ACP_DICE_CAT', + 'modes' => [ + 'dashboard' => [ + 'title' => 'ACP_DICE_DASH', + 'auth' => 'ext_phpbbstudio/dice && acl_a_dice_admin', + 'cat' => ['ACP_DICE_CAT'], + ], + ], + ]; + } +} diff --git a/ext/phpbbstudio/dice/acp/dice_module.php b/ext/phpbbstudio/dice/acp/dice_module.php new file mode 100644 index 0000000..893e3b3 --- /dev/null +++ b/ext/phpbbstudio/dice/acp/dice_module.php @@ -0,0 +1,73 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\acp; + +/** + * phpBB Studio's Dice ACP module. + */ +class dice_module +{ + public $page_title; + public $tpl_name; + public $u_action; + + /** + * @param $id + * @param $mode + * @throws \Exception + */ + public function main($id, $mode) + { + global $phpbb_container; + + // Get services + $controller = $phpbb_container->get('phpbbstudio.dice.controller.admin'); + $language = $phpbb_container->get('language'); + $request = $phpbb_container->get('request'); + + // Add our lang file + $language->add_lang('acp_dice', 'phpbbstudio/dice'); + + // Request any action + $action = $request->variable('action', '', true); + + switch ($action) + { + case 'example': + // Set template filename + $this->tpl_name = 'dice_example'; + + // Set page title + $this->page_title = 'ACP_DICE_EXAMPLE'; + break; + + case 'locations': + // Set template filename + $this->tpl_name = 'dice_locations'; + + // Set page title + $this->page_title = 'ACP_DICE_LOCATIONS'; + break; + + default: + // Set template filename + $this->tpl_name = 'dice_acp'; + + // Set page title + $this->page_title = 'ACP_DICE_DASH'; + break; + } + + // Make the $u_action variable available in the admin controller + $controller->set_page_url($this->u_action); + + // Send it off to be handled with + $controller->handle($action); + } +} diff --git a/ext/phpbbstudio/dice/adm/style/css/dice_acp.css b/ext/phpbbstudio/dice/adm/style/css/dice_acp.css new file mode 100644 index 0000000..fc3b12c --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/css/dice_acp.css @@ -0,0 +1,409 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +.row, +.row * { + box-sizing: border-box; +} + +.row { + display: flex; + flex-wrap: wrap; + margin-right: -15px; + margin-left: -15px; +} + +.col { + position: relative; + flex: 0 0 25%; + width: 100%; + max-width: 25%; + min-height: 1px; + padding-right: 15px; + padding-left: 15px; +} + +@media all and (max-width: 1224px) { + .col { + flex: 0 0 50%; + max-width: 50%; + } +} + +.card { + font-size: 0.875rem; + word-wrap: break-word; + background: #ffffff; + border: 0; + border-radius: 6px; + box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14); + color: #333333; + position: relative; + display: flex; + flex-direction: column; + width: 100%; + min-width: 0; + margin-top: 30px; + margin-bottom: 30px; +} + +.card-header { + background: transparent; + border-bottom: none; + border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0; + color: #ffffff; + position: relative; + z-index: 3 !important; + margin: 0 15px; + padding: 0; +} + +.card-header-icon { + text-align: right; +} + +.card-body { + position: relative; + padding: 0.9375rem 20px; +} + +.card-footer { + background-color: transparent; + border: 0; + border-top: 1px solid #eeeeee; + border-radius: 0; + display: flex; + justify-content: space-between; + align-items: center; + margin: 14px 15px 10px; + padding: 10px 0 0; +} + +.card-footer-closer { + margin-top: 0; +} + +.card-footer .card-action { + text-align: center; + flex: 0 100%; +} + +.card-icon { + background: #999999; + border-radius: 3px; + float: left; + margin-top: -20px; + margin-right: 15px; + padding: 15px; +} + +.card-icon i { + font-size: 36px; + line-height: 56px; + text-align: center; + width: 56px; + height: 56px; +} + +.card-category { + font-size: 14px; + color: #999999; + margin: 0; + padding-top: 10px; +} + +.card-avatar img { + width: 26px; + height: auto; +} + +h3.card-title { + font-size: 1.5625rem; + font-weight: 300; + line-height: 1.5em; + text-decoration: none; + color: #3c4858; + margin: 0; +} + +h4.card-title { + font-size: 1.125rem; + font-weight: 300; + line-height: 1.4em; + text-decoration: none; + color: #ffffff; + margin: 0; +} + +.stats { + font-size: 12px; + line-height: 22px; + color: #999999; + display: inline-flex; +} + +@media all and (max-width: 800px) { + .stats { + display: inline-block; + } +} + +.card .stats i { + font-size: 16px; + position: relative; + margin-right: 3px; + margin-left: 3px; +} + +.card small { + font-size: 80%; + font-weight: 400; +} + +.card label { + font-size: inherit; +} + +.card a { + color: inherit; +} + +.card a.card-primary { + display: block; +} + +.card a.card-secondary { + color: #999999; +} + +.card a:hover, +.card a:hover .stats, +.card label:hover, +.card label:hover .stats { + text-decoration: none; + color: #333333; +} + +.card .card-header .card-title + .card-category { + color: hsla(0, 0%, 100%, 0.62); +} + +.card .card-header:not(.card-header-icon) { + border-radius: 3px; + margin-top: -20px; + padding: 15px; +} + +.dice-orange { + background: linear-gradient(60deg, #ffa726, #fb8c00); + box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(255, 152, 0, 0.4); +} + +.dice-green { + background: linear-gradient(60deg, #66bb6a, #43a047); + box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(76, 175, 80, 0.4); +} + +.dice-blue { + background: linear-gradient(60deg, #26c6da, #00acc1); + box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(0, 188, 212, 0.4); +} + +.dice-red { + background: linear-gradient(60deg, #ef5350, #e53935); + box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(244, 67, 54, 0.4); +} + +.dice-purple { + background: linear-gradient(60deg, #ab47bc, #8e24aa); + box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(156, 39, 176, 0.4); +} + +.dice-button { + font-size: 0.9rem; + border: 1px solid transparent; + border-radius: 3px; + color: #ffffff; + padding: 2px 6px 3px; +} + +.dice-button i + span { + margin-left: 5px; +} + +a.dice-button-locations { + color: #ffffff; + display: inline-block; + padding: 5px 10px; +} + +.dice-button-green { + background: linear-gradient(60deg, #66bb6a, #43a047); + border-color: #1b9a1b; +} + +.dice-button-red { + background: linear-gradient(60deg, #ef5350, #e53935); + border-color: #d31141; +} + +.dice-setting { + font-size: 0.9rem; +} + +.dice-input i { + background: #efefef; + border: 1px solid #333333; + border-right-color: #969696; + border-radius: 3px 0 0 3px; + padding: 6px; +} + +@media all and (max-width: 707px) { + .dice-input i { + vertical-align: -1px; + } +} + +.dice-input i:before { + vertical-align: -1px; +} + +.dice-side-add input, +.dice-input input { + background: #f9f9f9; + border-radius: 0 3px 3px 0; + padding: 5px; +} + +.dice-side-add input { + border-radius: 3px 0 0 3px; +} + +.dice-side-add button { + border-radius: 0 3px 3px 0; + padding: 4px 10px 6px; +} + +.dice-side-add button i { + vertical-align: -1px; +} + +.dice-check + label, +.dice-yes + label, +.dice-no + label { + margin: 0; + padding: 0; +} + +.dice-check + label { + font-size: 1rem; + line-height: initial; + user-select: none; +} + +.dice-check + label span, +.dice-yes + label span, +.dice-no + label span { + border-top: 1px solid #afaeaa; + border-right: 1px solid #d5d5c8; + border-bottom: 1px solid #d5d5c8; + border-left: 1px solid #afaeaa; + border-radius: 0 3px 3px 0; + display: inline-block; + margin: 0; + padding: 5px 10px; +} + +.dice-check, +.dice-yes, +.dice-no { + display: none; +} + +.dice-check + label i, +.dice-yes + label i, +.dice-no + label i { + vertical-align: 1px; +} + +.dice-yes + label i:before, +.dice-no + label i:before { + content: "\f096"; +} + +.dice-check:checked + label i, +.dice-check:checked + label span, +.dice-yes:checked + label i, +.dice-yes:checked + label span { + background: linear-gradient(60deg, #66bb6a, #43a047); + border-color: #1b9a1b; + color: #ffffff; +} + +.dice-check + label i, +.dice-check + label span, +.dice-no:checked + label i, +.dice-no:checked + label span { + background: linear-gradient(60deg, #ef5350, #e53935); + border-color: #d31141; + color: #ffffff; +} + +.dice-check:checked + label i:before, +.dice-yes:checked + label i:before { content: "\f00c"; } + +.dice-check + label i:before, +.dice-no:checked + label i:before { content: "\f00d"; } + +.dice-check + label span.dice-check-yes { display: none; } +.dice-check + label span.dice-check-no { display: inline-block; } +.dice-check:checked + label span.dice-check-yes { display: inline-block; } +.dice-check:checked + label span.dice-check-no { display: none; } + +span.dice-example { + border-bottom: 1px solid #ff0000; + position: relative; + display: inline-block; + padding: 0 5px; +} + +span.dice-example:before, +span.dice-example:after { + background: #ff0000; + position: absolute; + bottom: 0; + width: 1px; + height: 50%; + content: ""; +} + +span.dice-example:before { left: 0; } +span.dice-example:after { right: 0; } + +@media all and (max-height: 480px) { + .alert_text { + overflow: auto; + max-height: 200px; + } + + .phpbb_alert { + height: 240px; + } +} + +@media all and (min-height: 480px) { + .alert_text { + overflow: auto; + max-height: 340px; + } + + .phpbb_alert { + height: 400px; + } +} + diff --git a/ext/phpbbstudio/dice/adm/style/css/dice_locations.css b/ext/phpbbstudio/dice/adm/style/css/dice_locations.css new file mode 100644 index 0000000..61d5cae --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/css/dice_locations.css @@ -0,0 +1,63 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +.dice-locations { + background-color: #ffffff; + border: 1px solid #e6e9ed; + border-radius: 8px; + padding: 15px; +} + +.dice-locations > p { + margin: 3rem 0 3rem 110px; +} + +.navbar { + background-color: #cadceb; + border-radius: 7px; + overflow: visible; + height: 40px; + padding: 3px 10px; +} + +.navbar > ul { + display: block; + margin: 0; + padding: 2px 0; + list-style-type: none; +} + +.navbar > ul > li { + font-size: 1.1em; + line-height: 2.2em; + float: left; + width: auto; + margin-right: 7px; + padding-top: 1px; + list-style-type: none; +} + +.navbar > ul > li.right-side { + text-align: right; + float: right; + margin-right: 0; + margin-left: 7px; +} + +.has-dropdown { + position: relative; +} + +.dropdown { + z-index: 10; + top: 25px; + left: -15px; +} + +.dropdown .pointer { + border-color: #ffffff transparent; +} diff --git a/ext/phpbbstudio/dice/adm/style/dice_acp.html b/ext/phpbbstudio/dice/adm/style/dice_acp.html new file mode 100644 index 0000000..01e71de --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/dice_acp.html @@ -0,0 +1,280 @@ +{% include 'overall_header.html' %} + +{% INCLUDECSS '@phpbbstudio_dice/css/dice_acp.css' %} +{% INCLUDEJS '@phpbbstudio_dice/js/dice_acp.js' %} + +{% from '@phpbbstudio_dice/dice_input.html' import input as input %} + +
+
+
+
+
+

{{ lang('ACP_DICE_SKINS_INSTALLED') }}

+

{{ SKINS_INSTALLED }}/{{ skins|length }} {{ lang('ACP_DICE_SKINS_SHORT')|lower }}

+
+ +
+
+ +
+
+
+
+

{{ lang('ACP_DICE_SIDES_AVAILABLE') }}

+

{{ sides|length }} {{ lang('ACP_DICE_SIDES_SHORT')|lower }}

+
+ +
+
+ +
+
+
+
+

{{ lang('ACP_DICE_MAX_ROLLS') }}

+

{{ DICE_MAX_ROLLS }} {{ lang('ACP_DICE_ROLLS_SHORT') }}

+
+ +
+
+ +
+
+
+
+

{{ lang('ACP_DICE_ROLLS_DB') }}

+

{{ ROLLS_TOTAL }} {{ lang('ACP_DICE_ROLLS_SHORT') }}

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

{{ lang('ACP_DICE_TOP_USERS_DESC') }}

+

{{ lang('ACP_DICE_TOP_USERS') }}

+
+
+ {% if users|length %} + {% for users_batch in users|batch(4) %} +
+ {% for user in users_batch %} +
+
+
+
+ {% if user.AVATAR %}{{ user.AVATAR }}{% else %}{% endif %} +
+ {{ user.NAME }} +
+ +
+
+ {% endfor %} +
+ {% endfor %} + {% else %} +
{{ lang('ACP_DICE_ROLLS_NONE') }}
+ {% endif %} +
+
+
+ +
+
+
+
+

{{ lang('ACP_DICE_TOP_TOPICS_DESC') }}

+

{{ lang('ACP_DICE_TOP_TOPICS') }}

+
+
+ {% if topics|length %} + {% for topics_batch in topics|batch(4) %} +
+ {% for topic in topics_batch %} +
+
+ + +
+
+ {% endfor %} +
+ {% endfor %} + {% else %} +
{{ lang('ACP_DICE_ROLLS_NONE') }}
+ {% endif %} +
+
+
+
+ +
+
+
+
+

{{ lang('ACP_DICE_SKINS') }}

+

{{ lang('ACP_DICE_SKINS_EXPLAIN') }}

+
+
+ {% if SKINS_DIR_ERROR %} +
+

{{ lang('ERROR') }}

+

{{ lang('DIRECTORY_DOES_NOT_EXIST', SKINS_DIR) }}

+
+ {% else %} + + {% for skin in skins %} + + + + + + + {% else %} + + + + {% endfor %} +
{{ skin.NAME }}{% if skin.S_VALID %}{{ lang('ACP_DICE_VALID') }}{% else %}{{ lang('ACP_DICE_INVALID') }}{% endif %}{% if skin.S_INSTALLED %}{{ lang('ACP_DICE_INSTALLED') }}{% else %}{{ lang('ACP_DICE_INSTALLED_NOT') }}{% endif %} + {% if skin.S_INSTALLED %} + + {% else %} + + {% endif %} +
{{ lang('ACP_DICE_SKINS_NONE') }}
+ {% endif %} +
+ +
+
+ +
+
+
+

{{ lang('ACP_DICE_SIDES') }}

+

{{ lang('ACP_DICE_SIDES_EXPLAIN') }}

+
+
+ + {% for row in sides|batch(2) %} + + {% for side in row %} + + + {% endfor %} + + {% else %} + + + + {% endfor %} +
{{ side.NUMBER }}
{{ lang('ACP_DICE_SIDES_NONE') }}
+ +
+ +
+
+
+ +
+
+

{{ lang('SETTINGS') }}

+

{{ lang('ACP_DICE_SETTINGS_EXPLAIN') }}
{{ lang('ACP_DICE_SETTINGS_EXAMPLE') }}

+
+ +
+
+ {% if S_ERRORS %} +

{{ lang('ERROR') }}

{{ ERROR_MSG }}
+ {% endif %} +
+
+
{{ lang('ACP_DICE_LOCATIONS') ~ lang('COLON') }}
{{ lang('ACP_DICE_LOCATIONS_DESC') }}
+
{{ lang('EDIT') }}
+
+
+ {{ input('dice_skins_dir', false, SKINS_DIR, 'folder-open-o', 'text', 0, 255, 'medium') }} + {{ input('dice_skins_img_width', false, SKINS_IMG_WIDTH, 'arrows-h', 'number', 16, 80) }} + {{ input('dice_skins_img_height', false, SKINS_IMG_HEIGHT, 'arrows-v', 'number', 16, 80) }} +
+
+

{{ lang('ACP_DICE_SIDES_ONLY_DESC') }}
+
+ + +
+
+
+ {{ input('dice_max_rolls', true, DICE_MAX_ROLLS, 'file-text-o', 'number', 0) }} + {{ input('dice_per_notation', true, DICE_PER_NOTATION, 'cubes', 'number', 0) }} + {{ input('dice_qty_per_dice', true, DICE_QTY_PER_DICE, 'cube', 'number', 0) }} + {{ input('dice_qty_dice_per_notation', true, DICE_QTY_DICE_PER_NOTATION, 'cubes', 'number', 0) }} + {{ input('dice_sides_per_dice', true, DICE_SIDES_PER_DICE, 'cube', 'number', 0) }} + {{ input('dice_pc_dice_per_notation', true, DICE_PC_DICE_PER_NOTATION, 'percent', 'number', 0) }} + {{ input('dice_fudge_dice_per_notation', true, DICE_FUDGE_DICE_PER_NOTATION, 'sort', 'number', 0) }} + {{ input('dice_exploding_dice_per_notation', true, DICE_EXPLODING_DICE_PER_NOTATION, 'bomb', 'number', 0) }} + {{ input('dice_penetration_dice_per_notation', true, DICE_PENETRATION_DICE_PER_NOTATION, 'long-arrow-right', 'number', 0) }} + {{ input('dice_compound_dice_per_notation', true, DICE_COMPOUND_DICE_PER_NOTATION, 'exchange', 'number', 0) }} +
+ +
+ {{ S_FORM_TOKEN }} + + +
+
+
+
+ +{% include 'overall_footer.html' %} diff --git a/ext/phpbbstudio/dice/adm/style/dice_example.html b/ext/phpbbstudio/dice/adm/style/dice_example.html new file mode 100644 index 0000000..08b8533 --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/dice_example.html @@ -0,0 +1,51 @@ +{% if not S_IS_AJAX %} +{% include 'overall_header.html' %} + +{% INCLUDECSS '@phpbbstudio_dice/css/dice_acp.css' %} +{% endif %} + +
+

+ {{ lang('ACP_DICE_SETTINGS_EXPLAIN') }}
+ {{ lang('ACP_DICE_EXAMPLE_1') }}. +

+ +

+ {{ lang('ACP_DICE_ROLL_NR', 1) ~ lang('COLON') }} 2d6 + 5d100 + 1d6!!
+ {{ lang('ACP_DICE_PER_NOTATION') ~ lang('COLON') }} {{ lang('ACP_DICE_DICE', 3) }}
+ {{ lang('ACP_DICE_QTY_PER_DICE') ~ lang('COLON') }} 8
+ {{ lang('ACP_DICE_QTY_DICE_PER_NOTATION') ~ lang('COLON') }} 2 & 5 & 1. +

+ +

+ {{ lang('ACP_DICE_ROLL_NR', 2) ~ lang('COLON') }} 3d20 + 1dF + 2dF.1 + 1d100 + 4d%
+ {{ lang('ACP_DICE_SIDES_PER_DICE') ~ lang('COLON') }} 20
+ {{ lang('ACP_DICE_FUDGE_DICE_PER_NOTATION') ~ lang('COLON') }} {{ lang('ACP_DICE_DICE', 2) }}
+ {{ lang('ACP_DICE_PC_DICE_PER_NOTATION') ~ lang('COLON') }} {{ lang('ACP_DICE_DICE', 2) }} +

+ +

+ {{ lang('ACP_DICE_ROLL_NR', 3) ~ lang('COLON')}} 3d6!>4 + 2d6!! + 2d8!!p + 3d10!p>8
+ {{ lang('ACP_DICE_EXPLODING_DICE_PER_NOTATION') ~ lang('COLON') }} {{ lang('ACP_DICE_DICE', 4) }}
+ {{ lang('ACP_DICE_PENETRATION_DICE_PER_NOTATION') ~ lang('COLON') }} {{ lang('ACP_DICE_DICE', 2) }}
+ {{ lang('ACP_DICE_COMPOUND_DICE_PER_NOTATION') ~ lang('COLON') }} {{ lang('ACP_DICE_DICE', 2) }} +

+ +
+
{{ lang('ACP_DICE_SUMMARY') ~ lang('COLON') }}
+
    +
  • {{ lang('ACP_DICE_EXAMPLE_2') ~ lang('COLON') }} 1d6 + 1d6
  • +
  • {{ lang('ACP_DICE_EXAMPLE_3') }} 3d6 + 2d6
  • +
  • {{ lang('ACP_DICE_EXAMPLE_4') }} 2d6
  • +
  • {{ lang('ACP_DICE_EXAMPLE_5') }} 2d12
  • +
+
+ +

{{ lang('ACP_DICE_ENJOY') }}!

+
+ +{% if not S_IS_AJAX %} +{{ lang('RETURN_PAGE', '', '') }} + +{% include 'overall_footer.html' %} +{% endif %} diff --git a/ext/phpbbstudio/dice/adm/style/dice_input.html b/ext/phpbbstudio/dice/adm/style/dice_input.html new file mode 100644 index 0000000..70f163c --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/dice_input.html @@ -0,0 +1,12 @@ +{% macro input(title, unlimited, value, icon, type, min, max, class) %} + {% set attr = type == 'text' ? ' minlength="' ~ min ~ '"' ~ (max ? ' maxlength="' ~ max ~ '"' : '') : ' min="' ~ min ~ '"' ~ (max ? ' max="' ~ max ~ '"' : '') ~ ' step="1"' %} +
+

{{ lang('ACP_' ~ title|upper ~ '_DESC') }}{% if unlimited %}
{{ lang('ACP_DICE_ZERO_UNLIMITED') }}{% endif %}
+ {% spaceless %} +
+ + +
+ {% endspaceless %} +
+{% endmacro %} diff --git a/ext/phpbbstudio/dice/adm/style/dice_locations.html b/ext/phpbbstudio/dice/adm/style/dice_locations.html new file mode 100644 index 0000000..3d13ca5 --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/dice_locations.html @@ -0,0 +1,72 @@ +{% include 'overall_header.html' %} + +{% INCLUDECSS '@phpbbstudio_dice/css/dice_acp.css' %} +{% INCLUDECSS '@phpbbstudio_dice/css/dice_locations.css' %} + +{% macro location(name, status) %} + +{% endmacro %} + +{% from _self import location as location %} + +
{{ lang('BACK_TO_PREV') }}
+ +
+
+ +

{{ lang('ACP_DICE_LOCATIONS_EXPLAIN') }}

+ + +
+ +
+ {{ lang('ACP_SUBMIT_CHANGES') }} +

+ + +

+
+ +
+ {{ lang('BACK_TO_PREV') }} +
+
+ +{% include 'overall_footer.html' %} diff --git a/ext/phpbbstudio/dice/adm/style/event/acp_forums_normal_settings_append.html b/ext/phpbbstudio/dice/adm/style/event/acp_forums_normal_settings_append.html new file mode 100644 index 0000000..e22545c --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/event/acp_forums_normal_settings_append.html @@ -0,0 +1,26 @@ +
+ {{ lang('ACP_DICE_SETTINGS') }} + +
+

{{ lang('ACP_DICE_ENABLE_DESC') }}
+
+ + +
+
+ +
+

{{ lang('ACP_DICE_F_SKIN_DESC') }}
+
+ +
+
+ +
+

{{ lang('ACP_DICE_SKIN_OVERRIDE_DESC') }}
+
+ + +
+
+
diff --git a/ext/phpbbstudio/dice/adm/style/js/dice_acp.js b/ext/phpbbstudio/dice/adm/style/js/dice_acp.js new file mode 100644 index 0000000..46143ee --- /dev/null +++ b/ext/phpbbstudio/dice/adm/style/js/dice_acp.js @@ -0,0 +1,31 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +(function($) { + +'use strict'; + +let $dark = $('#darkenwrapper'); +let $alert = $('#phpbb_alert'); +let keymap = { + ENTER: 13, + ESC: 27 +}; + +phpbb.addAjaxCallback('dice_refresh', function() { + // Do not allow closing alert + $dark.off('click'); + $alert.find('.alert_close').hide(); + + $(document).on('keydown.phpbb.alert', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + window.location.reload(); + } + }); +}); + +})(jQuery); diff --git a/ext/phpbbstudio/dice/composer.json b/ext/phpbbstudio/dice/composer.json new file mode 100644 index 0000000..f177d79 --- /dev/null +++ b/ext/phpbbstudio/dice/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpbbstudio/dice", + "type": "phpbb-extension", + "description": "Let's roll the dice!", + "homepage": "https://www.phpbbstudio.com", + "version": "2.1.2", + "time": "2019-07-10", + "license": "GPL-2.0-only", + "authors": [ + { + "name": "phpBB Studio", + "email": "info@phpbbstudio.com", + "homepage": "https://www.phpbbstudio.com", + "role": "Lead Developer" + } + ], + "require": { + "php": ">=5.5", + "composer/installers": "~1.0" + }, + "extra": { + "display-name": "phpBB Studio - Dice", + "soft-require": { + "phpbb/phpbb": ">=3.2.5,<3.3.0@dev" + } + } +} diff --git a/ext/phpbbstudio/dice/config/routing.yml b/ext/phpbbstudio/dice/config/routing.yml new file mode 100644 index 0000000..addf77b --- /dev/null +++ b/ext/phpbbstudio/dice/config/routing.yml @@ -0,0 +1,30 @@ +phpbbstudio_dice: + path: /dice + defaults: + _controller: phpbbstudio.dice.controller.main:page + +phpbbstudio_dice_add: + path: /dice/add/f{forum_id}/t{topic_id}/p{post_id}/a{poster_id}/{hash} + defaults: + _controller: phpbbstudio.dice.controller.main:add + requirements: + forum_id: \d+ + topic_id: \d+ + post_id: \d+ + poster_id: \d+ + +phpbbstudio_dice_edit: + path: /dice/edit/{roll_id} + defaults: + _controller: phpbbstudio.dice.controller.main:edit + roll_id: 0 + requirements: + roll_id: \d+ + +phpbbstudio_dice_del: + path: /dice/del/{roll_id} + defaults: + _controller: phpbbstudio.dice.controller.main:delete + roll_id: 0 + requirements: + roll_id: \d+ diff --git a/ext/phpbbstudio/dice/config/services.yml b/ext/phpbbstudio/dice/config/services.yml new file mode 100644 index 0000000..daca05d --- /dev/null +++ b/ext/phpbbstudio/dice/config/services.yml @@ -0,0 +1,34 @@ +imports: + - { resource: tables.yml } + - { resource: services_controllers.yml } + - { resource: services_functions.yml } + - { resource: services_listeners.yml } + +services: + phpbbstudio.dice.entity.roll: + class: phpbbstudio\dice\entity\roll + shared: false # Must be false to work + arguments: + - '@config' + - '@dbal.conn' + - '@phpbbstudio.dice.functions.common' + - '@language' + - '@phpbbstudio.dice.functions.regex' + - '@phpbbstudio.dice.functions.utils' + - '%phpbbstudio.dice.tables.rolls%' + + phpbbstudio.dice.operator.roll: + class: phpbbstudio\dice\operator\roll + arguments: + - '@config' + - '@config_text' + - '@service_container' + - '@dbal.conn' + - '@filesystem' + - '@phpbbstudio.dice.functions.common' + - '@controller.helper' + - '@template' + - '@user' + - '%tables.posts%' + - '%phpbbstudio.dice.tables.rolls%' + - '%core.root_path%' diff --git a/ext/phpbbstudio/dice/config/services_controllers.yml b/ext/phpbbstudio/dice/config/services_controllers.yml new file mode 100644 index 0000000..29fb470 --- /dev/null +++ b/ext/phpbbstudio/dice/config/services_controllers.yml @@ -0,0 +1,32 @@ +services: + phpbbstudio.dice.controller.admin: + class: phpbbstudio\dice\controller\admin_controller + arguments: + - '@config' + - '@dbal.conn' + - '@phpbbstudio.dice.functions.common' + - '@language' + - '@log' + - '@request' + - '@template' + - '@user' + - '@user_loader' + - '%tables.forums%' + - '%phpbbstudio.dice.tables.rolls%' + - '%tables.topics%' + - '%core.root_path%' + - '%core.php_ext%' + + phpbbstudio.dice.controller.main: + class: phpbbstudio\dice\controller\main_controller + arguments: + - '@auth' + - '@config' + - '@phpbbstudio.dice.functions.common' + - '@controller.helper' + - '@language' + - '@phpbbstudio.dice.operator.roll' + - '@phpbbstudio.dice.functions.regex' + - '@request' + - '@template' + - '@user' diff --git a/ext/phpbbstudio/dice/config/services_functions.yml b/ext/phpbbstudio/dice/config/services_functions.yml new file mode 100644 index 0000000..3714fe8 --- /dev/null +++ b/ext/phpbbstudio/dice/config/services_functions.yml @@ -0,0 +1,24 @@ +services: + phpbbstudio.dice.functions.common: + class: phpbbstudio\dice\core\functions_common + arguments: + - '@auth' + - '@config' + - '@config_text' + - '@dbal.conn' + - '@filesystem' + - '@phpbbstudio.dice.functions.finder' + - '@language' + - '@path_helper' + - '@user' + - '%tables.forums%' + - '%core.root_path%' + + phpbbstudio.dice.functions.finder: + class: phpbbstudio\dice\core\functions_finder + + phpbbstudio.dice.functions.regex: + class: phpbbstudio\dice\core\functions_regex + + phpbbstudio.dice.functions.utils: + class: phpbbstudio\dice\core\functions_utils diff --git a/ext/phpbbstudio/dice/config/services_listeners.yml b/ext/phpbbstudio/dice/config/services_listeners.yml new file mode 100644 index 0000000..224047c --- /dev/null +++ b/ext/phpbbstudio/dice/config/services_listeners.yml @@ -0,0 +1,50 @@ +services: + phpbbstudio.dice.listener.acp: + class: phpbbstudio\dice\event\acp_listener + arguments: + - '@dbal.conn' + - '@phpbbstudio.dice.functions.common' + - '@request' + - '%phpbbstudio.dice.tables.rolls%' + tags: + - { name: event.listener } + + phpbbstudio.dice.listener.bbcode: + class: phpbbstudio\dice\event\bbcode_listener + arguments: + - '@phpbbstudio.dice.functions.common' + - '@request' + tags: + - { name: event.listener } + + phpbbstudio.dice.listener.display: + class: phpbbstudio\dice\event\display_listener + arguments: + - '@auth' + - '@config' + - '@phpbbstudio.dice.functions.common' + - '@phpbbstudio.dice.operator.roll' + - '@template' + tags: + - { name: event.listener } + + phpbbstudio.dice.listener.posting: + class: phpbbstudio\dice\event\posting_listener + arguments: + - '@phpbbstudio.dice.functions.common' + - '@controller.helper' + - '@phpbbstudio.dice.operator.roll' + - '@request' + - '@template' + tags: + - { name: event.listener } + + phpbbstudio.dice.listener.setup: + class: phpbbstudio\dice\event\setup_listener + arguments: + - '@auth' + - '@phpbbstudio.dice.functions.common' + - '@language' + - '@template' + tags: + - { name: event.listener } diff --git a/ext/phpbbstudio/dice/config/tables.yml b/ext/phpbbstudio/dice/config/tables.yml new file mode 100644 index 0000000..4d9b5af --- /dev/null +++ b/ext/phpbbstudio/dice/config/tables.yml @@ -0,0 +1,2 @@ +parameters: + phpbbstudio.dice.tables.rolls: '%core.table_prefix%dice_rolls' diff --git a/ext/phpbbstudio/dice/controller/admin_controller.php b/ext/phpbbstudio/dice/controller/admin_controller.php new file mode 100644 index 0000000..32ee8b4 --- /dev/null +++ b/ext/phpbbstudio/dice/controller/admin_controller.php @@ -0,0 +1,613 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\controller; + +/** + * phpBB Studio's Dice Admin controller. + */ +class admin_controller implements admin_interface +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbbstudio\dice\core\functions_common */ + protected $functions; + + /** @var \phpbb\language\language */ + protected $lang; + + /** @var \phpbb\log\log */ + protected $log; + + /** @var \phpbb\request\request */ + protected $request; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var string Forums table */ + protected $forums_table; + + /** @var string Dice rolls table*/ + protected $rolls_table; + + /** @var string Topics table */ + protected $topics_table; + + /** @var string phpBB root path */ + protected $root_path; + + /** @var string php File extension */ + protected $php_ext; + + /** @var string Custom form action */ + protected $u_action; + + /** + * Constructor. + * + * @param \phpbb\config\config $config Configuration object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbbstudio\dice\core\functions_common $functions Common dice functions + * @param \phpbb\language\language $lang Language object + * @param \phpbb\log\log $log Log object + * @param \phpbb\request\request $request Request object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object + * @param \phpbb\user_loader $user_loader User loader object + * @param string $forums_table Forums table + * @param string $rolls_table Dice rolls table + * @param string $topics_table Topics table + * @param string $root_path phpBB root path + * @param string $php_ext phpEx + * @return void + * @access public + */ + public function __construct( + \phpbb\config\config $config, + \phpbb\db\driver\driver_interface $db, + \phpbbstudio\dice\core\functions_common $functions, + \phpbb\language\language $lang, + \phpbb\log\log $log, + \phpbb\request\request $request, + \phpbb\template\template $template, + \phpbb\user $user, + \phpbb\user_loader $user_loader, + $forums_table, + $rolls_table, + $topics_table, + $root_path, + $php_ext + ) + { + $this->config = $config; + $this->db = $db; + $this->functions = $functions; + $this->lang = $lang; + $this->log = $log; + $this->request = $request; + $this->template = $template; + $this->user = $user; + $this->user_loader = $user_loader; + $this->forums_table = $forums_table; + $this->rolls_table = $rolls_table; + $this->topics_table = $topics_table; + + $this->root_path = $root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function handle($action) + { + // Requests + $submit = $this->request->is_set_post('submit'); + $value = $this->request->variable('value', ''); + + // Add a form key to the settings + $form_key = 'dice_settings'; + add_form_key($form_key); + + // Set up config settings + $options = [ + 'dice_sides_only', + 'dice_max_rolls', + 'dice_per_notation', + 'dice_qty_per_dice', + 'dice_qty_dice_per_notation', + 'dice_sides_per_dice', + 'dice_pc_dice_per_notation', + 'dice_fudge_dice_per_notation', + 'dice_penetration_dice_per_notation', + 'dice_compound_dice_per_notation', + 'dice_exploding_dice_per_notation', + ]; + + // Assign config settings + $template_vars = []; + foreach ($options as $option) + { + $template_vars[utf8_strtoupper($option)] = $this->config[$option]; + } + + // Get the roll count from the database + $rolls_total = $this->db->get_estimated_row_count($this->rolls_table); + + // Get the orphaned roll count from the database + $sql = 'SELECT COUNT(roll_id) as orphans FROM ' . $this->rolls_table . ' WHERE roll_id = 0 OR post_id = 0 OR topic_id = 0 OR forum_id = 0 OR user_id = 0'; + $result = $this->db->sql_query($sql); + $rolls_orphan = $this->db->sql_fetchfield('orphans'); + $this->db->sql_freeresult($result); + + // Select the top topics with the most rolls + $sql_array = [ + 'SELECT' => 'COUNT(r.roll_id) as total, + t.topic_id, t.topic_title, + f.forum_id, f.forum_name', + 'FROM' => [$this->rolls_table => 'r'], + 'LEFT_JOIN' => [ + [ + 'FROM' => [$this->topics_table => 't'], + 'ON' => 't.topic_id = r.topic_id', + ], + [ + 'FROM' => [$this->forums_table => 'f'], + 'ON' => 'f.forum_id = r.forum_id', + ], + ], + 'GROUP_BY' => 'r.topic_id, t.topic_title, f.forum_id, f.forum_name', + 'ORDER_BY' => 'total DESC', + ]; + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query_limit($sql, 8); + + while ($row = $this->db->sql_fetchrow($result)) + { + $this->template->assign_block_vars('topics', [ + 'FORUM_NAME' => $row['forum_name'], + 'TOPIC_TITLE' => $row['topic_title'], + 'TOTAL' => (int) $row['total'], + + 'U_FORUM' => append_sid($this->root_path . 'viewforum.' . $this->php_ext, ['f' => (int) $row['forum_id']]), + 'U_TOPIC' => append_sid($this->root_path . 'viewtopic.' . $this->php_ext, ['f' => (int) $row['forum_id'], 't' => (int) $row['topic_id']]), + ]); + } + + $this->db->sql_freeresult($result); + + // Select the top users with the most rolls + $users = []; + + $sql = 'SELECT COUNT(roll_id) as total, user_id + FROM ' . $this->rolls_table . ' + WHERE user_id > 0 + GROUP BY user_id + ORDER BY total DESC'; + $result = $this->db->sql_query_limit($sql, 8); + + while ($row = $this->db->sql_fetchrow($result)) + { + $users[(int) $row['user_id']] = (int) $row['total']; + } + + $this->db->sql_freeresult($result); + + // Load the top users in the user_loader + $this->user_loader->load_users(array_keys($users)); + + // Assign the users data to the template + foreach ($users as $user_id => $total) + { + $this->template->assign_block_vars('users', [ + 'AVATAR' => (string) $this->user_loader->get_avatar($user_id), + 'NAME' => (string) $this->user_loader->get_username($user_id, 'full'), + 'TOTAL' => (int) $total, + ]); + } + + // Dice sides + $sides = $this->functions->get_dice_sides(); + + foreach ($sides as $side) + { + $this->template->assign_block_vars('sides', [ + 'NUMBER' => $side, + 'U_DELETE' => $this->u_action . '&action=side_delete&value=' . $side, + ]); + } + + // Dice skins + $skins = $this->functions->get_dice_skins(); + $skins_dir_valid = $this->functions->check_dice_skins_dir(); + + $skins_all_valid = true; + + if ($skins_dir_valid) + { + $skins_available = $this->functions->available_dice_skins(); + + foreach($skins_available as $skin) + { + $valid = (bool) $this->functions->validate_dice_skin($skin, $sides); + $installed = (bool) in_array($skin, $skins); + + $skins_all_valid = ($installed && !$valid) ? false : $skins_all_valid; + + $this->template->assign_block_vars('skins', [ + 'NAME' => (string) $skin, + 'S_INSTALLED' => (bool) $installed, + 'S_VALID' => (bool) $valid, + 'U_ACTION' => $this->u_action . '&action=skin_' . ($installed ? 'uninstall' : 'install') . '&value=' . $skin, + ]); + } + /** + * Any skins installed but not found in the filesystem should be automatically removed. + * + * Skins that are in the installed list and not in the filesystem + */ + $skins_difference = array_diff($skins, $skins_available); + + if (!empty($skins_difference)) + { + $this->skins_update('skin_uninstall', $skins, $skins_difference); + } + } + + // Garbage collection + $errors = []; + + // If the settings were submitted + if ($submit) + { + if (!check_form_key($form_key)) + { + $errors[] = $this->lang->lang('FORM_INVALID'); + } + + // Request the options + $option_sides_only = $this->request->variable('dice_sides_only', (bool) $this->config['dice_sides_only']); + $option_skins_height = (int) $this->request->variable('dice_skins_img_height', (int) $this->config['dice_skins_img_height']); + $option_skins_width = (int) $this->request->variable('dice_skins_img_width', (int) $this->config['dice_skins_img_width']); + + $option_skins_dir = $this->request->variable('dice_skins_dir', (string) $this->config['dice_skins_dir'], true); + + /** + * Let's trim a bunch of characters from the beginning and end of a string + * + * https://www.php.net/manual/en/function.trim.php + * + * " " (ASCII 32 (0x20)), an ordinary space. + * "\t" (ASCII 9 (0x09)), a tab. + * "\n" (ASCII 10 (0x0A)), a new line (line feed). + * "\r" (ASCII 13 (0x0D)), a carriage return. + * "\0" (ASCII 0 (0x00)), the NUL-byte. + * "\x0B" (ASCII 11 (0x0B)), a vertical tab. + * + * Added "/" + */ + $option_skins_dir = trim($option_skins_dir, "/ \t\n\r\0\x0B"); + + /** + * Let's harden all of this a bit more + * + * Especially Dots, Backslashes plus a bunch of other chars aren't allowed. + */ + if (preg_match_all('/[\\\:*<>|"]|\.{2,}|^\./', $option_skins_dir, $matches)) + { + $character_list = implode('
', $matches[0]); + + $errors[] = $this->lang->lang('ACP_DICE_SKINS_PATH_ERROR', $character_list); + } + + // Check if directory exists + if (!$this->functions->check_dice_dir($this->functions->make_dice_dir($option_skins_dir))) + { + $errors[] = $this->lang->lang('DIRECTORY_DOES_NOT_EXIST', $option_skins_dir); + } + + // Check if skin images are within the 16 - 80 pixels + if ($option_skins_height < 16 || $option_skins_height > 80) + { + $errors[] = $this->lang->lang('ACP_DICE_SKINS_IMG_HEIGHT_ERROR'); + } + + if ($option_skins_width < 16 || $option_skins_width > 80) + { + $errors[] = $this->lang->lang('ACP_DICE_SKINS_IMG_WIDTH_ERROR'); + } + + // No errors? Lets start saving + if (empty($errors)) + { + if ($option_skins_dir != $this->config['dice_skins_dir']) + { + $this->config->set('dice_skins_dir', $option_skins_dir); + } + + if ($option_skins_height != $this->config['dice_skins_img_height']) + { + $this->config->set('dice_skins_img_height', $option_skins_height); + } + + if ($option_skins_width != $this->config['dice_skins_img_width']) + { + $this->config->set('dice_skins_img_width', $option_skins_width); + } + + if ($option_sides_only != $this->config['dice_sides_only']) + { + $this->config->set('dice_sides_only', $option_sides_only); + } + + $option_numbers = [ + 'dice_max_rolls', + 'dice_per_notation', + 'dice_qty_per_dice', + 'dice_qty_dice_per_notation', + 'dice_sides_per_dice', + 'dice_pc_dice_per_notation', + 'dice_fudge_dice_per_notation', + 'dice_penetration_dice_per_notation', + 'dice_compound_dice_per_notation', + 'dice_exploding_dice_per_notation', + ]; + + foreach ($option_numbers as $n) + { + $setting = (int) $this->config[$n]; + $value = (int) $this->request->variable($n, $setting); + + if ($value !== $setting) + { + $this->config->set($n, $value); + } + } + + // Log it + $this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_ACP_DICE_SETTINGS'); + + // Success message + trigger_error($this->lang->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); + } + } + + // Process any action + if ($action) + { + switch ($action) + { + case 'example': + $this->template->set_filenames(['example' => '@phpbbstudio_dice/dice_example.html']); + $this->template->assign_var('S_IS_AJAX', $this->request->is_ajax()); + + if ($this->request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('INFORMATION'), + 'MESSAGE_TEXT' => $this->template->assign_display('example'), + ]); + } + break; + + case 'locations': + // Assign the link locations + $this->assign_link_locations(); + + if ($this->request->is_set_post('submit_locations')) + { + // Request the link locations + $links = $this->request_link_locations(); + + // Set the link locations + $this->functions->set_dice_link_locations($links); + + // Log it + $this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_ACP_DICE_LOCATIONS'); + + // Success message + trigger_error($this->lang->lang('ACP_DICE_LOCATIONS_SUCCESS') . '
' . adm_back_link($this->u_action)); + } + break; + + default: + if (confirm_box(true)) + { + switch ($action) + { + case 'orphaned': + $value = $this->delete_orphans(); + break; + + case 'side_add': + case 'side_delete': + $this->sides_update($action, $sides, $value); + break; + + case 'skin_install': + case 'skin_uninstall': + $this->skins_update($action, $skins, $value); + break; + } + + // Log it + $this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_ACP_DICE_' . utf8_strtoupper($action), false, [$value]); + + // Show success message + trigger_error($this->lang->lang('ACP_DICE_' . utf8_strtoupper($action) . '_SUCCESS', $value) . '
' . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, 'ACP_DICE_' . utf8_strtoupper($action), build_hidden_fields([ + 'action' => $action, + 'value' => $value, + ])); + } + break; + } + } + + $this->template->assign_vars(array_merge($template_vars, [ + 'S_ERRORS' => !empty($errors), + 'ERROR_MSG' => implode('
', $errors), + + 'SKINS_DIR' => $this->config['dice_skins_dir'], + 'SKINS_DIR_ERROR' => !$skins_dir_valid, + 'SKINS_IMG_HEIGHT' => $this->config['dice_skins_img_height'], + 'SKINS_IMG_WIDTH' => $this->config['dice_skins_img_width'], + 'SKINS_INSTALLED' => count($skins), + 'SKINS_VALID' => $skins_all_valid, + 'ROLLS_TOTAL' => $rolls_total, + 'ROLLS_ORPHAN' => $rolls_orphan, + + 'U_ACTION' => $this->u_action . '#dice_settings', + 'U_BACK' => $this->u_action, + 'U_EXAMPLE' => $this->u_action . '&action=example', + 'U_LOCATIONS' => $this->u_action . '&action=locations', + 'U_ORPHANED' => $this->u_action . '&action=orphaned', + 'U_SIDE_ADD' => $this->u_action . '&action=side_add', + ])); + } + + /** + * {@inheritdoc} + */ + public function set_page_url($u_action) + { + $this->u_action = $u_action; + } + + /** + * Delete all orphaned dice rolls. + * + * @return int Amount of dice rolls that were deleted + * @access public + */ + protected function delete_orphans() + { + $sql = 'DELETE FROM ' . $this->rolls_table . ' WHERE roll_id = 0 OR post_id = 0 OR topic_id = 0 OR forum_id = 0 OR user_id = 0'; + $this->db->sql_query($sql); + + return (int) $this->db->sql_affectedrows(); + } + + /** + * Update the installed dice sides setting. + * + * @param string $action The action to take (side_add|side_delete) + * @param array $sides Array of currently installed dice sides + * @param int $value The dice side to add or delete + * @return void + * @access protected + */ + protected function sides_update($action, array $sides, $value) + { + switch ($action) + { + case 'side_add': + $sides[] = (int) $value; + break; + + case 'side_delete': + if (($key = array_search($value, $sides)) !== false) + { + unset($sides[$key]); + } + break; + } + + // Clean the array (filter, unique, sort) + $sides = $this->functions->clean_dice_array($sides); + + // Store the new array in the database + $this->functions->set_dice_sides($sides); + } + + /** + * Update the installed dice skin setting. + * + * @param string $action The action to take (skin_install|skin_uninstall) + * @param array $skins Array of currently installed dice skins + * @param mixed $value The value/array to install (add) or uninstall (delete) + * @return void + * @access protected + */ + protected function skins_update($action,array $skins, $value) + { + // Force an array, if it is not already + $value = is_array($value) ? (array) $value : (array) [$value]; + + switch ($action) + { + case 'skin_install': + $skins = array_merge($skins, $value); + break; + + case 'skin_uninstall': + $skins = array_diff($skins, $value); + break; + } + + // Clean the array (filter, unique, sort) + $skins = $this->functions->clean_dice_array($skins); + + // Store the new array in the database + $this->functions->set_dice_skins($skins); + } + + /** + * Assign link locations. + * + * @return void + * @access protected + */ + protected function assign_link_locations() + { + $template_vars = []; + $locations = $this->functions->get_dice_link_locations(); + + foreach ($locations as $location) + { + $template_vars[$location['name']] = (bool) $location['status']; + } + + $this->template->assign_vars($template_vars); + } + + /** + * Request link locations + * + * @return array Array with link locations and their status + * @access protected + */ + protected function request_link_locations() + { + $links = []; + $locations = $this->functions->get_dice_link_locations(); + + foreach ($locations as $location) + { + $links[$location['name']] = $this->request->variable((string) $location['name'], false); + } + + return $links; + } +} diff --git a/ext/phpbbstudio/dice/controller/admin_interface.php b/ext/phpbbstudio/dice/controller/admin_interface.php new file mode 100644 index 0000000..864d440 --- /dev/null +++ b/ext/phpbbstudio/dice/controller/admin_interface.php @@ -0,0 +1,33 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\controller; + +/** + * phpBB Studio's Dice Admin controller interface. + */ +interface admin_interface +{ + /** + * Display and handle any actions from the Dice ACP. + * + * @param string $action Any action to handle + * @return void + * @access public + */ + public function handle($action); + + /** + * Make the custom form action available in the admin controller. + * + * @param string $u_action Custom form action + * @return void + * @access public + */ + public function set_page_url($u_action); +} diff --git a/ext/phpbbstudio/dice/controller/main_controller.php b/ext/phpbbstudio/dice/controller/main_controller.php new file mode 100644 index 0000000..ef4a9e0 --- /dev/null +++ b/ext/phpbbstudio/dice/controller/main_controller.php @@ -0,0 +1,458 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\controller; + +/** + * phpBB Studio's Dice Main controller. + */ +class main_controller implements main_interface +{ + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbbstudio\dice\core\functions_common */ + protected $functions; + + /** @var \phpbb\controller\helper */ + protected $helper; + + /** @var \phpbb\language\language */ + protected $lang; + + /** @var \phpbbstudio\dice\operator\roll */ + protected $operator; + + /** @var \phpbbstudio\dice\core\functions_regex */ + protected $regex; + + /** @var \phpbb\request\request */ + protected $request; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\user */ + protected $user; + + /** + * Constructor. + * + * @param \phpbb\auth\auth $auth Authentication object + * @param \phpbb\config\config $config Configuration object + * @param \phpbbstudio\dice\core\functions_common $functions Common functions object + * @param \phpbb\controller\helper $helper Controller helper object + * @param \phpbb\language\language $lang Language object + * @param \phpbbstudio\dice\operator\roll $operator Roll operator object + * @param \phpbbstudio\dice\core\functions_regex $regex Regex functions + * @param \phpbb\request\request $request Request object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object + * @return void + * @access public + */ + public function __construct( + \phpbb\auth\auth $auth, + \phpbb\config\config $config, + \phpbbstudio\dice\core\functions_common $functions, + \phpbb\controller\helper $helper, + \phpbb\language\language $lang, + \phpbbstudio\dice\operator\roll $operator, + \phpbbstudio\dice\core\functions_regex $regex, + \phpbb\request\request $request, + \phpbb\template\template $template, + \phpbb\user $user + ) + { + $this->auth = $auth; + $this->config = $config; + $this->functions = $functions; + $this->helper = $helper; + $this->lang = $lang; + $this->operator = $operator; + $this->regex = $regex; + $this->request = $request; + $this->template = $template; + $this->user = $user; + } + + /** + * {@inheritdoc} + */ + public function add($forum_id, $topic_id, $post_id, $poster_id, $hash) + { + if (!$this->request->is_ajax()) + { + throw new \phpbb\exception\http_exception(400, 'DICE_NOT_AJAX'); + } + + // Set up JSON response + $json_response = new \phpbb\json_response; + + // Check the link hash for security + if (!check_link_hash($hash, 'dice_add')) + { + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $this->lang->lang('FORM_INVALID'), + ]); + } + + // Check if dice is enabled on this forum + if (!$this->functions->forum_enabled($forum_id)) + { + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $this->lang->lang('DICE_ROLL_FORUM_DISABLED'), + ]); + } + + // Grab the author for this post, if we are not creating a new post + $poster_id = $poster_id ? $poster_id : $this->user->data['user_id']; + + if (!$this->functions->dice_auth_add($forum_id, (int) $poster_id)) + { + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $this->lang->lang('DICE_ROLL_ADD_UNAUTH'), + ]); + } + + // Set up limit + $count = 0; + + if ($this->functions->dice_limit($forum_id)) + { + $entities = $this->operator->get_rolls_for_posting($forum_id, $topic_id, $post_id); + $count = count($entities); + + if ($this->functions->dice_limit_reached($count, $forum_id)) + { + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $this->lang->lang('DICE_ROLLS_TOO_MANY'), + ]); + } + } + + // Set up variables + $user_id = (int) $this->user->data['user_id']; + $notation = $this->request->variable('notation', ''); + $notation = htmlspecialchars_decode($notation, ENT_COMPAT); + + /** + * Get a roll entity from the operator. + * @var \phpbbstudio\dice\entity\roll $entity + */ + $entity = $this->operator->get_entity(); + + // Map out entity functions and data + $map_fields = [ + 'set_forum' => $forum_id, + 'set_topic' => $topic_id, + 'set_post' => $post_id, + 'set_user' => $user_id, + 'set_time' => time(), + 'set_notation' => $notation, + ]; + + // Garbage collection + $errors = []; + + // Call all functions with the respective data + foreach ($map_fields as $entity_function => $entity_data) + { + try + { + $entity->$entity_function($entity_data); + } + catch (\phpbbstudio\dice\exception\base $e) + { + $errors[] = $e->get_message($this->lang); + } + } + + // Unset temporarily variables + unset($map_fields); + + // Try and roll the dice + if (empty($errors)) + { + try + { + $entity->roll(); + } + catch (\phpbbstudio\dice\exception\base $e) + { + $errors[] = $e->get_message($this->lang); + } + } + + if (empty($errors)) + { + try + { + // Insert the roll data to the database + $entity->insert(); + + $count++; + } + catch (\phpbbstudio\dice\exception\out_of_bounds $e) + { + $errors[] = $e->get_message($this->lang); + } + } + + // Send a json response + $json_response->send([ + 'ROLL_SUCCESS' => empty($errors), + 'ROLL_LIMIT' => (bool) $this->functions->dice_limit_reached($count, $forum_id), + 'ROLL_DATA' => $this->operator->get_roll_data_for_edit($entity), + 'MESSAGE_TITLE' => empty($errors) ? $this->lang->lang('SUCCESS') : $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => empty($errors) ? $this->lang->lang('DICE_ROLL_ADD_SUCCESS') : implode('
', $errors), + ]); + } + + /** + * {@inheritdoc} + */ + public function edit($roll_id) + { + if (!$this->request->is_ajax()) + { + throw new \phpbb\exception\http_exception(400, 'DICE_NOT_AJAX'); + } + + // Set up a JSON response + $json_response = new \phpbb\json_response; + + /** + * Get a roll entity from the operator. + * @var \phpbbstudio\dice\entity\roll $entity + */ + $entity = $this->operator->get_entity(); + + try + { + $entity->load($roll_id); + } + catch (\phpbbstudio\dice\exception\out_of_bounds $e) + { + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $e->get_message($this->lang), + ]); + } + + // Grab the author for this post, if we are not creating a new post + $poster_id = $entity->get_post() ? $this->operator->get_author($entity->get_id()) : $this->user->data['user_id']; + + if (!$this->functions->dice_auth_edit($entity->get_forum(), (int) $poster_id)) + { + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $this->lang->lang('DICE_ROLL_EDIT_UNAUTH'), + ]); + } + + if (confirm_box(true)) + { + // Garbage collection + $errors = []; + + // Set up variables + $user_id = (int) $this->user->data['user_id']; + $notation = $this->request->variable('notation', ''); + $notation = htmlspecialchars_decode($notation, ENT_COMPAT); + + try + { + $entity->set_notation($notation)->roll(); + } + catch (\phpbbstudio\dice\exception\base $e) + { + $errors[] = $e->get_message($this->lang); + } + + if (empty($errors)) + { + try + { + // Update the roll data in the database + $entity->set_edit_user($user_id) + ->set_edit_time(time()) + ->increment_edit_count() + ->save(); + } + catch (\phpbbstudio\dice\exception\out_of_bounds $e) + { + $errors[] = $e->get_message($this->lang); + } + } + + // Send a json response + $json_response->send([ + 'ROLL_SUCCESS' => empty($errors), + 'ROLL_DATA' => $this->operator->get_roll_data_for_edit($entity), + 'MESSAGE_TITLE' => empty($errors) ? $this->lang->lang('SUCCESS') : $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => empty($errors) ? $this->lang->lang('DICE_ROLL_EDIT_SUCCESS') : implode('
', $errors), + ]); + } + else + { + $this->template->assign_vars([ + 'ROLL_DATA' => $this->operator->get_roll_data_for_edit($entity), + ]); + + confirm_box(false, 'DICE_ROLL_EDIT', build_hidden_fields([ + 'roll_id' => $roll_id, + ]), '@phpbbstudio_dice/dice_edit.html', $this->helper->get_current_url()); + } + } + + /** + * {@inheritdoc} + */ + public function delete($roll_id) + { + if (!$this->request->is_ajax()) + { + throw new \phpbb\exception\http_exception(400, 'DICE_NOT_AJAX'); + } + + // Set up a JSON response + $json_response = new \phpbb\json_response; + + /** + * Get and load entity + * @var \phpbbstudio\dice\entity\roll $entity + */ + $entity = $this->operator->get_entity()->load($roll_id); + + // Grab the author for this post, if we are not creating a new post + $poster_id = $entity->get_post() ? $this->operator->get_author($entity->get_id()) : $this->user->data['user_id']; + + if (!$this->functions->dice_auth_delete($entity->get_forum(), (int) $poster_id)) + { + $json_response->send([ + 'MESSAGE_TITLE' => $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $this->lang->lang('DICE_ROLL_DELETE_UNAUTH'), + ]); + } + + if (confirm_box(true)) + { + // Delete the roll entity + $success = $this->operator->delete($roll_id); + + $count = 0; + + if ($success) + { + $entities = $this->operator->get_rolls_for_posting($entity->get_forum(), $entity->get_topic(), $entity->get_post()); + $count = count($entities); + } + + $json_response->send([ + 'ROLL_ID' => (int) $roll_id, + 'ROLL_SUCCESS' => (bool) $success, + 'ROLL_LIMIT' => (bool) $this->functions->dice_limit_reached($count, $entity->get_forum()), + 'MESSAGE_TITLE' => $success ? $this->lang->lang('SUCCESS') : $this->lang->lang('ERROR'), + 'MESSAGE_TEXT' => $success ? $this->lang->lang('DICE_ROLL_DELETE_SUCCESS') : $this->lang->lang('DICE_ROLL_NOT_EXIST', 1), + ]); + } + else + { + /** + * The 5th parameter (u_action) has to be set + * for it to work correctly with AJAX and URL rewriting. + */ + confirm_box(false, 'DICE_ROLL_DELETE', build_hidden_fields([ + 'roll_id' => (int) $roll_id, + ]), 'confirm_body.html', $this->helper->get_current_url()); + } + } + + /** + * {@inheritdoc} + */ + public function page() + { + if (!$this->auth->acl_get('u_dice_test')) + { + throw new \phpbb\exception\http_exception(403, 'NOT_AUTHORISED'); + } + + $notation = $this->request->variable('notation', '', true); + $notation = htmlspecialchars_decode($notation, ENT_COMPAT); + $submit = $this->request->is_set_post('submit'); + + /** @var \phpbbstudio\dice\entity\roll $entity */ + $entity = $this->operator->get_entity(); + + if ($notation) + { + try + { + $entity->set_notation($notation)->roll(); + } + catch (\phpbbstudio\dice\exception\unexpected_value $e) + { + $errors[] = $e->get_message($this->lang); + } + } + + if ($submit && $this->request->is_ajax()) + { + $json_response = new \phpbb\json_response; + + $json_response->send([ + 'MESSAGE_TITLE' => 'HI', + 'MESSAGE_TEXT' => $entity->get_output(), + ]); + } + + $skin = $this->request->variable('skin', $this->user->data['dice_u_skin'], true); + $skins = $this->functions->get_dice_skins(true); + $skin_data = $this->functions->get_dice_skin_data(true, $skin); + $skin_options = $this->functions->build_dice_select($skins, $skin, true); + + $this->template->assign_vars([ + 'NOTATION' => $entity->get_notation(), + 'OUTPUT' => $entity->get_output(), + 'DISPLAY' => $entity->get_display($skin_data['name'], $skin_data['dir'], $skin_data['ext']), + 'TOTAL' => $entity->get_total(), + + 'DICE_IMG_HEIGHT' => (int) $this->config['dice_skins_img_height'], + 'DICE_IMG_WIDTH' => (int) $this->config['dice_skins_img_width'], + + 'DICE_ALLOWED_ONLY' => $this->config['dice_sides_only'], + 'DICE_ALLOWED_SIDES' => $this->functions->get_dice_sides(), + + 'LIMIT_DICE_ROLLS' => $this->config['dice_max_rolls'], + 'LIMIT_DICE_QTY' => $this->config['dice_qty_per_dice'], + 'LIMIT_DICE_SIDES' => $this->config['dice_sides_per_dice'], + 'LIMIT_DICE_FUDGE' => $this->config['dice_fudge_dice_per_notation'], + 'LIMIT_DICE_PC' => $this->config['dice_pc_dice_per_notation'], + 'LIMIT_DICE_EXPLODE' => $this->config['dice_exploding_dice_per_notation'], + 'LIMIT_DICE_PEN' => $this->config['dice_penetration_dice_per_notation'], + 'LIMIT_DICE_COMP' => $this->config['dice_compound_dice_per_notation'], + + 'SKIN_OPTIONS' => $skin_options, + + 'S_DICE_SUBMIT' => $submit, + + 'U_DICE_ACTION' => $this->helper->route('phpbbstudio_dice'), + ]); + + return $this->helper->render('@phpbbstudio_dice/dice_page.html', $this->lang->lang('DICE_ROLL')); + } +} diff --git a/ext/phpbbstudio/dice/controller/main_interface.php b/ext/phpbbstudio/dice/controller/main_interface.php new file mode 100644 index 0000000..9f45fe7 --- /dev/null +++ b/ext/phpbbstudio/dice/controller/main_interface.php @@ -0,0 +1,58 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\controller; + +/** + * phpBB Studio's Dice Main controller interface. + */ +interface main_interface +{ + /** + * Create a roll. + * + * @param int $forum_id The forum identifier + * @param int $topic_id The topic identifier + * @param int $post_id The post identifier + * @param int $poster_id The poster identifier + * @param string $hash The generated link hash + * @return \phpbb\json_response + * @throws \phpbb\exception\http_exception + * @access public + */ + public function add($forum_id, $topic_id, $post_id, $poster_id, $hash); + + /** + * Edit a roll. + * + * @param int $roll_id The roll identifier + * @return \phpbb\json_response + * @throws \phpbb\exception\http_exception + * @access public + */ + public function edit($roll_id); + + /** + * Delete a roll. + * + * @param int $roll_id The roll identifier + * @return void \phpbb\json_response + * @throws \phpbb\exception\http_exception + * @access public + */ + public function delete($roll_id); + + /** + * Display a dice testing page. + * + * @return \Symfony\Component\HttpFoundation\Response + * @throws \phpbb\exception\http_exception + * @access public + */ + public function page(); +} diff --git a/ext/phpbbstudio/dice/core/functions_common.php b/ext/phpbbstudio/dice/core/functions_common.php new file mode 100644 index 0000000..8dc1f21 --- /dev/null +++ b/ext/phpbbstudio/dice/core/functions_common.php @@ -0,0 +1,609 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\core; + +/** + * phpBB Studio's Dice Common functions. + */ +class functions_common +{ + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\config\db_text */ + protected $config_text; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\filesystem\filesystem */ + protected $filesystem; + + /** @var \phpbbstudio\dice\core\functions_finder */ + protected $finder; + + /** @var \phpbb\language\language */ + protected $lang; + + /** @var \phpbb\path_helper */ + protected $path_helper; + + /** @var \phpbb\user */ + protected $user; + + /** @var string Forums table */ + protected $forums_table; + + /** @var string phpBB root path */ + protected $root_path; + + /** @var array Array of allowed image extensions */ + protected $image_extensions; + + /** + * Constructor. + * + * @param \phpbb\auth\auth $auth Authentication object + * @param \phpbb\config\config $config Configuration object + * @param \phpbb\config\db_text $config_text Configuration database object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\filesystem\filesystem $filesystem Filesystem object + * @param \phpbbstudio\dice\core\functions_finder $finder Dice finder + * @param \phpbb\language\language $lang Language object + * @param \phpbb\path_helper $path_helper Path helper + * @param \phpbb\user $user User object + * @param string $forums_table Forums table + * @param string $root_path phpBB root path + * @return void + * @access public + */ + public function __construct( + \phpbb\auth\auth $auth, + \phpbb\config\config $config, + \phpbb\config\db_text $config_text, + \phpbb\db\driver\driver_interface $db, + \phpbb\filesystem\filesystem $filesystem, + functions_finder $finder, + \phpbb\language\language $lang, + \phpbb\path_helper $path_helper, + \phpbb\user $user, + $forums_table, + $root_path + ) + { + $this->auth = $auth; + $this->config = $config; + $this->config_text = $config_text; + $this->db = $db; + $this->filesystem = $filesystem; + $this->finder = $finder; + $this->lang = $lang; + $this->path_helper = $path_helper; + $this->user = $user; + $this->forums_table = $forums_table; + $this->root_path = $root_path; + + $this->image_extensions = ['gif', 'jpg', 'jpeg', 'png', 'bmp', 'svg']; + } + + /** + * Check if there is a dice limit for this forum and user combination. + * + * @param int $forum_id The forum identifier + * @return bool Whether or not there is a limit + * @access public + */ + public function dice_limit($forum_id) + { + return ($this->config['dice_max_rolls'] && !$this->auth->acl_get('f_dice_no_limit', (int) $forum_id)); + } + + /** + * Check if the dice limit has been reached for this forum, user and count combination. + * + * @param int $count The roll count + * @param int $forum_id The forum identifier + * @return bool Whether or not the limit has been reached + * @access public + */ + public function dice_limit_reached($count, $forum_id) + { + return (($count >= $this->config['dice_max_rolls']) && $this->dice_limit($forum_id)); + } + + /** + * Compare two user identifiers against each other. Used to determine if this user is the author of a post. + * + * @param int $user_id User identifier + * @return bool Whether or not the identifiers are identical + * @access public + */ + public function dice_author($user_id) + { + return ((int) $this->user->data['user_id'] === (int) $user_id); + } + + /** + * Check if this user can add a dice in this forum. + * + * @param int $forum_id Forum identifier + * @param int $user_id User identifier of the poster + * @return bool Whether or not this user can add a dice in this forum + * @access public + */ + public function dice_auth_add($forum_id, $user_id) + { + return ($this->auth->acl_get('f_mod_dice_add', (int) $forum_id) || ($this->auth->acl_get('f_dice_roll', (int) $forum_id) && $this->dice_author($user_id))); + } + + /** + * Check if this user can delete a dice in this forum. + * + * @param int $forum_id Forum identifier + * @param int $user_id User identifier of the poster + * @return bool Whether or not this user can delete a dice in this forum + * @access public + */ + public function dice_auth_delete($forum_id, $user_id) + { + return ($this->auth->acl_get('f_mod_dice_delete', (int) $forum_id) || ($this->auth->acl_get('f_dice_delete', (int) $forum_id) && $this->dice_author($user_id))); + } + + /** + * Check if this user can edit a dice in this forum. + * + * @param int $forum_id Forum identifier + * @param int $user_id User identifier of the poster + * @return bool Whether or not this user can edit a dice in this forum + * @access public + */ + public function dice_auth_edit($forum_id, $user_id) + { + return ($this->auth->acl_get('f_mod_dice_edit', (int) $forum_id) || ($this->auth->acl_get('f_dice_edit', (int) $forum_id) && $this->dice_author($user_id))); + } + + /** + * Get a forum's dice settings. + * + * @param int $forum_id The forum identifier + * @return mixed The forum's dice settings or false if no forum id was provided + * @access public + */ + public function forum_data($forum_id) + { + if (empty($forum_id)) + { + return false; + } + + $sql = 'SELECT dice_enabled, dice_skin_override, dice_f_skin FROM ' . $this->forums_table . ' WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query_limit($sql, 1); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + /** + * Check if the Dice extension is enabled for a specific forum. + * + * @param int $forum_id The forum identifier + * @return bool Whether or not the extension is enabled for this forum + * @access public + */ + public function forum_enabled($forum_id) + { + if (empty($forum_id)) + { + return false; + } + + $sql = 'SELECT dice_enabled FROM ' . $this->forums_table . ' WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query_limit($sql, 1); + $s_enabled = (bool) $this->db->sql_fetchfield('dice_enabled'); + $this->db->sql_freeresult($result); + + return $s_enabled; + } + + /** + * Check if the skin override is enabled for a specific forum. + * + * @param int $forum_id The forum identifier + * @return bool Whether or not the skin override is enabled for this forum + * @access public + */ + public function forum_skin_override($forum_id) + { + if (empty($forum_id)) + { + return false; + } + + $sql = 'SELECT dice_skin_override FROM ' . $this->forums_table . ' WHERE forum_id = ' . (int) $forum_id; + $result = $this->db->sql_query_limit($sql, 1); + $s_override = (bool) $this->db->sql_fetchfield('dice_skin_override'); + $this->db->sql_freeresult($result); + + return $s_override; + } + + /** + * Strip emojis from a string + * + * @param string $string + * @return string + */ + public function dice_strip_emojis($string) + { + return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "", $string); + } + + /** + * Get the installed dice skins from the database. + * + * @param bool $include_text Whether or not the "text" option should be included + * @return array Array of installed dice skins + * @access public + */ + public function get_dice_skins($include_text = false) + { + $skins = json_decode($this->config_text->get('dice_skins'), true); + + if ($include_text) + { + array_unshift($skins, $this->lang->lang('DICE_TEXT')); + } + + return (array) $skins; + } + + /** + * Set the installed dice skins in the database. + * + * @param array $skins Array of installed dice skins + * @return void + * @access public + */ + public function set_dice_skins(array $skins) + { + // Enforce data type + $skins = (array) $skins; + + $this->config_text->set('dice_skins', json_encode($skins)); + } + + /** + * Get the installed dice sides from the database. + * + * @return array Array of installed dice sides + * @access public + */ + public function get_dice_sides() + { + return (array) json_decode($this->config_text->get('dice_sides'), true); + } + + /** + * Set the installed dice sides in the database. + * + * @param array $sides Array of installed dice sides + * @return void + * @access public + */ + public function set_dice_sides(array $sides) + { + // Enforce data type + $sides = (array) $sides; + + $this->config_text->set('dice_sides', json_encode($sides)); + } + + /** + * Get the correctly formatted dice skins directory. + * + * @return string Correctly formatted dice skins directory + * @access public + */ + public function get_dice_skins_dir() + { + return $this->make_dice_dir($this->config['dice_skins_dir']); + } + + /** + * Correctly format a given directory, prefixed with phpBB's root path and a trailing slash. + * + * @param string $directory The directory to correctly format + * @return string The correctly formatted directory + * @access public + */ + public function make_dice_dir($directory) + { + return (string) $this->root_path . $directory . '/'; + } + + /** + * Check if the dice skins directory exists and is readable. + * + * @return bool Whether or not the dice skins directory exists and is readable + * @access public + */ + public function check_dice_skins_dir() + { + return $this->check_dice_dir($this->get_dice_skins_dir()); + } + + /** + * Check if a directory or file exists. + * + * @param string $directory The directory to check for existance and readability + * @return bool Whether or not the directory exists and is readable + * @access public + */ + public function check_dice_dir($directory) + { + return ($this->filesystem->exists($directory) && $this->filesystem->is_readable($directory)); + } + + /** + * Update the web root path for a give source. + * + * @param string $src The source string to update. + * @return string The updated source string. + * @access public + */ + public function update_dice_img_path($src) + { + return $this->path_helper->update_web_root_path($src); + } + + /** + * Find the available dice skins in the dice skins directory. + * + * @return array Array of available dice skins + * @access public + */ + public function available_dice_skins() + { + return $this->finder->find_dice_skins($this->get_dice_skins_dir()); + } + + /** + * Validate dice skins, check if all images for all installed sides are present. + * + * @param string $skin The dice skin to validate + * @param array $sides Array of installed dice sides + * @return bool Whether or not this dice skin has all images for all installed dice sides + * @access public + */ + public function validate_dice_skin($skin, array $sides) + { + $valid = true; + + $images = $this->finder->find_dice_images($this->get_dice_skins_dir(), $skin, $this->get_image_extensions()); + + foreach ($sides as $side) + { + for ($i = 1; $i <= $side; $i++) + { + $image_name = $this->get_dice_image_notation($side, $i); + + $valid = !in_array($image_name, $images) ? false : $valid; + } + } + + return (bool) $valid; + } + + /** + * Get the dice skin image notation. + * + * @param int $sides The dice sides + * @param int $roll The dice roll outcome + * @param string $ext The dice skin image extension + * @return string The dice skin image notation + * @access public + */ + public function get_dice_image_notation($sides, $roll, $ext = '') + { + return 'd' . (int) $sides . '_' . (int) $roll . ($ext ? '.' . $ext : ''); + } + + /** + * Get the allowed image extensions. + * + * @return array Array of allowed image extensions + * @access public + */ + public function get_image_extensions() + { + return (array) $this->image_extensions; + } + + /** + * Excerpts the images extension within a folder previously checked. + * + * @param string $skin The skin's folder name + * @return string The images extension + * @access public + */ + public function find_image_extension($skin) + { + /** + * Find all the files in the skin directory that start with + * a "d", as dice image file names are: d0_0.ext + */ + $files = glob($this->get_dice_skins_dir() . $skin . '/d*.*'); + + if ($files) + { + $extension = false; + $count = count($files); + + // Loop over the files found + for ($i = 0; $i < $count; $i++) + { + // Get the extension for this file + $extension = pathinfo($files[$i], PATHINFO_EXTENSION); + + // If the extension is an allowed image extension, break out the for loop. + if (in_array($extension, $this->image_extensions)) + { + break; + } + } + + return $extension; + } + + return false; + } + + /** + * Get the dice skin data for display. + * + * @param bool $override Whether or not the user's choice should be overridden + * @param string $forum_skin The dice skin set in the Forum Settings + * @return array Array with the dice skin data + * @access public + */ + public function get_dice_skin_data($override, $forum_skin) + { + // Get all 'installed' dice skins + $skins = $this->get_dice_skins(true); + + // Get the user defined style, if not overridden by the forum settings + $skin = ($this->auth->acl_get('u_dice_skin') || !$override) ? $this->user->data['dice_u_skin'] : $forum_skin; + + // Make sure the user defined style is in the 'installed' dice skins + $skin = in_array($skin, $skins) ? $skin : 'text'; + + // Get the image extension for this dice skin + $ext = $skin !== 'text' ? $this->find_image_extension($skin) : ''; + + return (array) [ + 'name' => $skin, + 'dir' => $this->get_dice_skins_dir(), + 'ext' => $ext, + ]; + } + + /** + * Clean an array, used for the installed dice skins and dice sides. + * + * @param array $array The array to clean + * @return array A cleaned array + * @access public + */ + public function clean_dice_array(array $array) + { + // No empty values + $array = array_filter($array); + + // No duplicate values + $array = array_unique($array); + + // Sort ascending + sort($array); + + return (array) $array; + } + + /** + * Build an options string for a HTML + + + +
+ +
+ + +
+ diff --git a/ext/phpbbstudio/dice/styles/all/template/dice_page.html b/ext/phpbbstudio/dice/styles/all/template/dice_page.html new file mode 100644 index 0000000..9773c24 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/dice_page.html @@ -0,0 +1,291 @@ +{% include 'overall_header.html' %} + +{% INCLUDECSS '@phpbbstudio_dice/dice_display.css' %} +{% INCLUDECSS '@phpbbstudio_dice/dice_page.css' %} + +{% macro boolean(title, icon, status) %} +
+ +
+ + {% if status %}{{ lang('YES') }}{% else %}{{ lang('NO') }}{% endif %} +
+
+{% endmacro %} + +{% from _self import boolean as bool %} + +
+

{{ lang('DICE_ROLL_PAGE_DICE_TESTER') }}

+ +
+
+ + +
+ +
+
+ +
+
+
+
+ +{% if S_DICE_SUBMIT %} +
+

{{ lang('DICE_ROLL_PAGE_RESULT') }}

+
+ {% include '@phpbbstudio_dice/dice_roll.html' %} +
+{% endif %} + +
+ +
+

{{ lang('DICE_ROLL_PAGE_LIMITATIONS') }}

+ +
+
+
+
{{ lang('DICE_ROLL_PAGE_ROLLS_POST') }}
+
{% if LIMIT_DICE_ROLLS %}{{ LIMIT_DICE_ROLLS }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_DICE_QTY') }}
+
{% if LIMIT_DICE_QTY %}{{ LIMIT_DICE_QTY }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_SIDES_DICE') }}
+
{% if LIMIT_DICE_SIDES %}{{ LIMIT_DICE_SIDES }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_ALLOWED_SIDES') }}
+
{% if DICE_ALLOWED_ONLY %}{{ lang('DICE_ROLL_PAGE_ONLY_ALLOWED_SIDES') }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_AVAIL_SIDES') }}
+
{{ DICE_ALLOWED_SIDES|join(lang('COMMA_SEPARATOR')) }}
+
+
+ +
+
+
{{ lang('DICE_ROLL_PAGE_FUDGE_DICE') ~ lang('COLON') }}
+
{% if LIMIT_DICE_FUDGE %}{{ LIMIT_DICE_FUDGE }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_PERCENT_DICE') ~ lang('COLON') }}
+
{% if LIMIT_DICE_PC %}{{ LIMIT_DICE_PC }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_EXPLODING_DICE') ~ lang('COLON') }}
+
{% if LIMIT_DICE_EXPLODE %}{{ LIMIT_DICE_EXPLODE }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_PENETRATING_DICE') ~ lang('COLON') }}
+
{% if LIMIT_DICE_PEN %}{{ LIMIT_DICE_PEN }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+ +
{{ lang('DICE_ROLL_PAGE_COMPOUNDING_DICE') ~ lang('COLON') }}
+
{% if LIMIT_DICE_COMP %}{{ LIMIT_DICE_COMP }}{% else %}{{ lang('DICE_ROLL_PAGE_UNLIMITED') }}{% endif %}
+
+
+
+ +
+ +
+ +
+

{{ lang('DICE_ROLL_PAGE_P_1_TITLE') }}

+ +

+ {{ lang('DICE_ROLL_PAGE_P_1') }} +

+ +
+
{{ lang('DICE_ROLL_PAGE_LIST_1') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_1_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_2') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_2_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_3') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_3_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_4') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_4_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_5') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_5_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_6') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_6_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_7') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_7_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_8') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_8_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_9') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_9_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_10') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_10_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_11') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_11_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_12') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_12_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_13') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_13_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_LIST_14') }}
+
{{ lang('DICE_ROLL_PAGE_LIST_14_2') }}
+
+ +
+

{{ lang('DICE_ROLL_PAGE_P_2_TITLE') }}

+

+ {{ lang('DICE_ROLL_PAGE_P_2') }} +

+
+ +
+ +
+

{{ lang('DICE_ROLL_PAGE_P_3_TITLE') }}

+

+ {{ lang('DICE_ROLL_PAGE_P_3') }} +

+
+
+
{{ lang('DICE_ROLL_PAGE_EXAMPLE_1_TITLE') }}
+

+ {{ lang('DICE_ROLL_PAGE_EXAMPLE_1') }} +

+
+
+
{{ lang('DICE_ROLL_PAGE_EXAMPLE_2_TITLE') }}
+ {{ lang('DICE_ROLL_PAGE_EXAMPLE_2') }} +
+
+
+

{{ lang('DICE_ROLL_PAGE_P_4_TITLE') }}

+

+ {{ lang('DICE_ROLL_PAGE_P_4') ~ lang('COLON') }} +

+
+
+
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_1') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_1_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_2') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_2_2') }}
+
+
+ +
+ +

{{ lang('DICE_ROLL_PAGE_P_5_TITLE') }}

+

+ {{ lang('DICE_ROLL_PAGE_P_5') ~ lang('COLON') }} +

+

+ {{ lang('DICE_ROLL_PAGE_P_6') }} +

+

+ {{ lang('DICE_ROLL_PAGE_P_7') ~ lang('COLON') }} +

+
+ {{ lang('DICE_ROLL_PAGE_EXAMPLE_3') }} +
+

+ {{ lang('DICE_ROLL_PAGE_P_8') }} +

+ +
+ +

{{ lang('DICE_ROLL_PAGE_P_9_TITLE') }}

+

+ {{ lang('DICE_ROLL_PAGE_P_9') }} +

+
+
+

{{ lang('DICE_ROLL_PAGE_EXAMPLE_4_TITLE') }}

+
{{ lang('DICE_ROLL_PAGE_EXAMPLE_4') }}
+
+
+

{{ lang('DICE_ROLL_PAGE_EXAMPLE_5_TITLE') }}

+
{{ lang('DICE_ROLL_PAGE_EXAMPLE_5') }}
+
+
+

+ {{ lang('DICE_ROLL_PAGE_P_10') ~ lang('COLON') }} +

+
+
+
{{ lang('DICE_ROLL_PAGE_EXAMPLE_6') }}
{{ lang('DICE_ROLL_PAGE_EXAMPLE_6_TITLE') }}
+ +
{{ lang('DICE_ROLL_PAGE_EXAMPLE_7') }}
{{ lang('DICE_ROLL_PAGE_EXAMPLE_7_TITLE') }}
+
+
+
+ +
+ +
+

{{ lang('DICE_ROLL_PAGE_P_11_TITLE') }}

+

+ {{ lang('DICE_ROLL_PAGE_P_11') ~ lang('COLON') }} +

+
+
+
{{ lang('DICE_ROLL_PAGE_EXAMPLE_8_TITLE') }}
+ {{ lang('DICE_ROLL_PAGE_EXAMPLE_8') }} {{ lang('DICE_ROLL_PAGE_EXAMPLE_8_BIS') }}
+ +
{{ lang('DICE_ROLL_PAGE_EXAMPLE_9_TITLE') }}
{{ lang('DICE_ROLL_PAGE_EXAMPLE_9') }}
+ +
{{ lang('DICE_ROLL_PAGE_EXAMPLE_10_TITLE') }}
{{ lang('DICE_ROLL_PAGE_EXAMPLE_10') }}
+ +
{{ lang('DICE_ROLL_PAGE_EXAMPLE_11_TITLE') }}
{{ lang('DICE_ROLL_PAGE_EXAMPLE_11') }}
+
+
+
+ +
+ +
+

{{ lang('DICE_ROLL_PAGE_P_12_TITLE') }}

+

+ {{ lang('DICE_ROLL_PAGE_P_12') ~ lang('COLON') }} +

+
+
+
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_3') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_3_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_4') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_4_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_5') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_5_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_6') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_6_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_7') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_7_2') }}
+
+
+

+ {{ lang('DICE_ROLL_PAGE_P_13') ~ lang('COLON') }} +

+
+
+
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_8') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_8_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_9') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_9_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_10') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_10_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_11') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_11_2') }}
+ +
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_12') }}
{{ lang('DICE_ROLL_PAGE_EX_DETAILS_12_2') }}
+
+
+
+
+ +{% include 'overall_footer.html' %} diff --git a/ext/phpbbstudio/dice/styles/all/template/dice_posting.html b/ext/phpbbstudio/dice/styles/all/template/dice_posting.html new file mode 100644 index 0000000..f68cde2 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/dice_posting.html @@ -0,0 +1,102 @@ +{% if S_DICE_ENABLED and (S_ROLL_ADD or S_ROLL_DELETE or S_ROLL_EDIT) %} + + {% if S_DICE_REVIEW %} + {% INCLUDECSS '@phpbbstudio_dice/dice_display.css' %} + {% INCLUDEJS '@phpbbstudio_dice/js/dice_display.js' %} + {% endif %} + + {% INCLUDEJS '@phpbbstudio_dice/js/dice.js' %} + {% INCLUDECSS '@phpbbstudio_dice/dice.css' %} + + +
+
+

{{ lang('DICE_ROLLS_EXPLAIN') }}

+ + {% if S_ROLL_ADD %} +
+ {# The dice roll indicator that indicated if a roll has been added - HIDDEN #} + +
+
+
+
+
+ +
+ +
+ {% endif %} + +
+
+ + + + + + + + + + + {# Dice roll table row template, copied and then deleted by dice.js #} + + + + + + + {% for roll in dice_rolls %} + + + + + + + {% endfor %} + +
{{ lang('DICE_ROLL_ID') }}{{ lang('DICE_ROLL_NOTATION') }}{{ lang('DICE_ROLL_TIME') }}{{ lang('DICE_ROLL_ACTIONS') }}
+ + {% if S_ROLL_EDIT %} + + + {{ lang('DICE_ROLL_EDIT') }} + + {% endif %} + {% if S_ROLL_DELETE %} + + + {{ lang('DICE_ROLL_DELETE') }} + + {% endif %} +
{{ roll.ROLL_ID }}{{ roll.ROLL_NOTATION }}{{ roll.ROLL_TIME }} + + {% if S_ROLL_EDIT %} + + + {{ lang('DICE_ROLL_EDIT') }} + + {% endif %} + {% if S_ROLL_DELETE %} + + + {{ lang('DICE_ROLL_DELETE') }} + + {% endif %} +
+
+
+
+
+ +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/dice_roll.html b/ext/phpbbstudio/dice/styles/all/template/dice_roll.html new file mode 100644 index 0000000..2e9a1b7 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/dice_roll.html @@ -0,0 +1,19 @@ +{# The dice roll template that is used as a replacement in a post for display #} +
+ {{ OUTPUT }} +
+ {{ NOTATION }}{{ lang('COLON') }}  + {% for dice in DISPLAY %} + {% if not loop.first %}{{ dice.OPERATOR }}{% endif %} + [ + {% for roll in dice.ROLLS %} +
+ {% if roll.IMAGE %}{{ roll.ROLL }}{% else %}{{ roll.ROLL }}{% endif %} +
+ {% endfor %} + ] + {{ dice.ADDITIONS }} + {% endfor %} + + = {{ TOTAL }} +
diff --git a/ext/phpbbstudio/dice/styles/all/template/event/mcp_post_text_after.html b/ext/phpbbstudio/dice/styles/all/template/event/mcp_post_text_after.html new file mode 100644 index 0000000..4489899 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/mcp_post_text_after.html @@ -0,0 +1,12 @@ +{% if DICE_ROLLS_OUTLINE|length %} +
+
+ + {{ lang('DICE_ROLLS') }} +
+ + {% for roll in DICE_ROLLS_OUTLINE %} +
{{ roll }}
+ {% endfor %} +
+{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/mcp_topic_postrow_attachments_before.html b/ext/phpbbstudio/dice/styles/all/template/event/mcp_topic_postrow_attachments_before.html new file mode 100644 index 0000000..f887be8 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/mcp_topic_postrow_attachments_before.html @@ -0,0 +1,12 @@ +{% if postrow.DICE_ROLLS_OUTLINE|length %} +
+
+ + {{ lang('DICE_ROLLS') }} +
+ + {% for roll in postrow.DICE_ROLLS_OUTLINE %} +
{{ roll }}
+ {% endfor %} +
+{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_logged_out_content.html b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_logged_out_content.html new file mode 100644 index 0000000..d1ab7a2 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_logged_out_content.html @@ -0,0 +1,8 @@ +{# Use same if statement as logged in #} +{% if S_DICE_NAVBAR_HEADER_USER_PROFILE_APPEND %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_after.html b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_after.html new file mode 100644 index 0000000..6882b7f --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_after.html @@ -0,0 +1,7 @@ +{% if S_DICE_NAVBAR_HEADER_QUICK_LINKS_AFTER %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_before.html b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_before.html new file mode 100644 index 0000000..a460c0f --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_quick_links_before.html @@ -0,0 +1,7 @@ +{% if S_DICE_NAVBAR_HEADER_QUICK_LINKS_BEFORE %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_user_profile_append.html b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_user_profile_append.html new file mode 100644 index 0000000..1d3562a --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/navbar_header_user_profile_append.html @@ -0,0 +1,7 @@ +{% if S_DICE_NAVBAR_HEADER_USER_PROFILE_APPEND %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_breadcrumb_append.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_breadcrumb_append.html new file mode 100644 index 0000000..c12dccd --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_breadcrumb_append.html @@ -0,0 +1,7 @@ +{% if S_DICE_OVERALL_FOOTER_BREADCRUMB_APPEND %} + + + {{ lang('DICE_DICE') }} + + +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_after.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_after.html new file mode 100644 index 0000000..28d6270 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_after.html @@ -0,0 +1,7 @@ +{% if S_DICE_OVERALL_FOOTER_TEAMLINK_AFTER %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_before.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_before.html new file mode 100644 index 0000000..74d75b9 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_teamlink_before.html @@ -0,0 +1,7 @@ +{% if S_DICE_OVERALL_FOOTER_TEAMLINK_BEFORE %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_after.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_after.html new file mode 100644 index 0000000..0994a8f --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_after.html @@ -0,0 +1,7 @@ +{% if S_DICE_OVERALL_FOOTER_TIMEZONE_AFTER %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_before.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_before.html new file mode 100644 index 0000000..f52aed1 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_footer_timezone_before.html @@ -0,0 +1,7 @@ +{% if S_DICE_OVERALL_FOOTER_TIMEZONE_BEFORE %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_header_head_append.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_header_head_append.html new file mode 100644 index 0000000..2d3844c --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_header_head_append.html @@ -0,0 +1,11 @@ +{% if S_DICE_MCP_DISPLAY %} + {% if not definition.INCLUDED_DICEDISPLAYCSS %} + {% INCLUDECSS '@phpbbstudio_dice/dice_display.css' %} + {% DEFINE INCLUDED_DICEDISPLAYCSS = true %} + {% endif %} + + {% if not definition.INCLUDED_DICEDISPLAYJS %} + {% INCLUDEJS '@phpbbstudio_dice/js/dice_display.js' %} + {% DEFINE INCLUDED_DICEDISPLAYJS = true %} + {% endif %} +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_append.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_append.html new file mode 100644 index 0000000..1bb4693 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_append.html @@ -0,0 +1,7 @@ +{% if S_DICE_OVERALL_HEADER_NAVIGATION_APPEND %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_prepend.html b/ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_prepend.html new file mode 100644 index 0000000..d505696 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/overall_header_navigation_prepend.html @@ -0,0 +1,7 @@ +{% if S_DICE_OVERALL_HEADER_NAVIGATION_PREPEND %} +
  • + + {{ lang('DICE_DICE') }} + +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/posting_editor_add_panel_tab.html b/ext/phpbbstudio/dice/styles/all/template/event/posting_editor_add_panel_tab.html new file mode 100644 index 0000000..db46fa1 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/posting_editor_add_panel_tab.html @@ -0,0 +1,6 @@ +{% if S_DICE_ENABLED and (S_ROLL_ADD or S_ROLL_DELETE or S_ROLL_EDIT) %} +{# The Dice Rolls tab below the posting editor #} +
  • + {{ lang('DICE_ROLLS') }} +
  • +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/posting_layout_include_panel_body.html b/ext/phpbbstudio/dice/styles/all/template/event/posting_layout_include_panel_body.html new file mode 100644 index 0000000..a1f0e5a --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/posting_layout_include_panel_body.html @@ -0,0 +1,3 @@ +{% if S_DICE_ENABLED and (S_ROLL_ADD or S_ROLL_DELETE or S_ROLL_EDIT) %} + {% include '@phpbbstudio_dice/dice_posting.html' %} +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/posting_topic_review_row_content_after.html b/ext/phpbbstudio/dice/styles/all/template/event/posting_topic_review_row_content_after.html new file mode 100644 index 0000000..5337db1 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/posting_topic_review_row_content_after.html @@ -0,0 +1,12 @@ +{% if topic_review_row.DICE_ROLLS_OUTLINE|length %} +
    +
    + + {{ lang('DICE_ROLLS') }} +
    + + {% for roll in topic_review_row.DICE_ROLLS_OUTLINE %} +
    {{ roll }}
    + {% endfor %} +
    +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/viewtopic_body_postrow_content_after.html b/ext/phpbbstudio/dice/styles/all/template/event/viewtopic_body_postrow_content_after.html new file mode 100644 index 0000000..890bd9b --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/viewtopic_body_postrow_content_after.html @@ -0,0 +1,12 @@ +{% if postrow.DICE_ROLLS_OUTLINE|length %} +
    +
    + + {{ lang('DICE_ROLLS') }} +
    + + {% for roll in postrow.DICE_ROLLS_OUTLINE %} +
    {{ roll }}
    + {% endfor %} +
    +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/event/viewtopic_topic_title_before.html b/ext/phpbbstudio/dice/styles/all/template/event/viewtopic_topic_title_before.html new file mode 100644 index 0000000..85a6db1 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/event/viewtopic_topic_title_before.html @@ -0,0 +1,5 @@ +{% if S_DICE_DISPLAY %} + {% INCLUDECSS '@phpbbstudio_dice/dice_display.css' %} + + {% INCLUDEJS '@phpbbstudio_dice/js/dice_display.js' %} +{% endif %} diff --git a/ext/phpbbstudio/dice/styles/all/template/js/dice.js b/ext/phpbbstudio/dice/styles/all/template/js/dice.js new file mode 100644 index 0000000..ceb56e2 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/js/dice.js @@ -0,0 +1,285 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +(function($) { // Avoid conflicts with other libraries + + /** + * Set up an empty array that will contain all our functions. + */ + let dice = {}; + + 'use strict'; + + /** + * Set up all our elements + * @var {object} $rollTable The table where all rolls are listed + * @var {object} $rollButton The button to create a roll + * @var {object} $rollInsert The buttons inside the dice rolls table that insert a roll into the textarea + * @var {object} $rollNotation The inputbox where the dice notation is filled in + * @var {object} $rollIndicator The hidden checkbox indicating that new rolls were added + * @var {object} $rollTemplate The row template that is used to add new table rows + */ + let $rollTable = $('#dice_table'); + let $rollButton = $('#dice_roll'); + let $rollInsert = $('[name="dice_insert"]'); + let $rollNotation = $('#dice_notation'); + let $rollIndicator = $('#dice_indicator'); + let $rollTemplate = $('#dice_template'); + + $(function() { + // Get the roll template row + dice.rollTemplate = $rollTemplate[0].outerHTML; + $rollTemplate.remove(); + + // Bind all 'Insert roll into textarea'-buttons + $rollInsert.each(function() { + $(this).on('click', function() { + // Send the roll identifier and notation to the function + dice.insertRollRow($(this).data('roll-id'), $(this).data('roll-notation')); + }); + }); + + // Bind the 'Create a roll'-button + $rollButton.on('click', function(event) { + /** + * @var {string} action The AJAX action + * @var {string} notation The roll notation + */ + let action = $rollButton.data('url'), + notation = $rollNotation.val(); + + /** + * Set up a 'Create a roll'-function + * + * @returns {void} + */ + let rollDice = function() { + // Set a loading indicator + let $loadingIndicator = phpbb.loadingIndicator(); + + // Set up the AJAX request + let request = $.ajax({ + url: action, + type: 'GET', + data: {notation: notation}, + cache: false, + success: dice.getRollResponse, + }); + + // After the request (success or error) remove the loading indicator + request.always(function() { + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + }); + }; + + // Call the 'Create a roll'-function + rollDice(); + + // Prevent any default actions by clicking on the button + event.preventDefault(); + }); + }); + + /** + * Response handler for adding a dice roll. + * + * @param {array} response + * @param {bool} response.ROLL_SUCCESS + * @param {bool} response.ROLL_LIMIT + * @param {array} response.ROLL_DATA + * @param {string} response.MESSAGE_TITLE + * @param {string} response.MESSAGE_TEXT + * @returns {void} + */ + dice.getRollResponse = function (response) { + phpbb.clearLoadingTimeout(); + + // Show the response message + phpbb.alert(response.MESSAGE_TITLE, response.MESSAGE_TEXT); + + if (response.ROLL_SUCCESS) { + // If the request is successful, we auto close the message after 2 seconds + phpbb.closeDarkenWrapper(2000); + + // We reset the notation input field + dice.setRollNotation(''); + + // We set the indicator that a roll was added + dice.setRollIndicator(); + + // We add the roll to the table + dice.setRollRow(response.ROLL_DATA); + + // We toggle the roll button if necessary + dice.toggleRollButton(response.ROLL_LIMIT); + } + }; + + /** + * Set a roll notation. + * + * @param {string} value The roll notation + * @returns {void} + */ + dice.setRollNotation = function(value) { + $rollNotation.val(value); + }; + + /** + * Set the roll indicator as true. + * + * @returns {void} + */ + dice.setRollIndicator = function() { + $rollIndicator.prop('checked', true); + }; + + /** + * Toggle the roll button if necessary. + * + * @param {bool} status The status for the roll button (enabled|disabled) + * @returns {void} + */ + dice.toggleRollButton = function(status) { + // If the status is different than the current, we swap some thing around + if (status !== $rollButton.prop('disabled')) { + let icon = $rollButton.find('i'), + span = $rollButton.find('span'), + text = span.text(); + + // Toggle class + $rollButton.toggleClass('button-secondary'); + + // Toggle icons + icon.toggleClass($rollButton.data('icons')); + + // Toggle text + span.text($rollButton.data('text')); + $rollButton.data('text', text); + } + + // Set the status + $rollButton.prop('disabled', status); + }; + + /** + * Add a roll row to the table. + * + * @param {array} roll The roll data + * @param {int} roll.id The roll identifier + * @param {string} roll.notation The roll notation + * @param {string} roll.time The roll time + * @returns {void} + */ + dice.setRollRow = function(roll) { + // Make sure the table is no longer hidden. + $rollTable.parent('.inner').parent('.panel').removeClass('hidden'); + + // Get the row template + let row = $(dice.rollTemplate); + + // Set the data + row.find('.dice-roll-id').html(roll.id); + row.find('.dice-roll-notation').html(roll.notation); + row.find('.dice-roll-time').html(roll.time); + row.find('.dice-roll-actions button') + .data('roll-id', roll.id) + .data('roll-notation', roll.notation) + .on('click', function() { + // Bind a click event for this button + dice.insertRollRow(roll.id, roll.notation); + }); + row.find('.dice-roll-actions a').attr('href', function(i, url) { + return url + '/' + roll.id; + }).each(function() { + // Register this newly created ajax callback + let $this = $(this), + ajax = $this.attr('data-ajax'), + filter = $this.attr('data-filter'); + + if (ajax !== 'false') { + let fn = (ajax !== 'true') ? ajax : null; + filter = (filter !== undefined) ? phpbb.getFunctionByName(filter) : null; + + phpbb.ajaxify({ + selector: this, + refresh: $this.attr('data-refresh') !== undefined, + filter: filter, + callback: fn + }); + } + }); + + // Append the row + $rollTable.css('display', 'none').append(row).slideDown('slow').removeAttr('style'); + }; + + /** + * Insert a roll into the textarea. + * + * @param {int} id The roll identifier + * @param {string} notation The roll notation + * @returns {void} + */ + dice.insertRollRow = function(id, notation) { + insert_text('[roll=' + id + ']' + notation + '[/roll]'); + }; + + /** + * Add a callback for deleting a roll. + * + * @param {array} response The response array + * @param {bool} response.ROLL_SUCCESS Successful deletion indicator + * @param {bool} response.ROLL_LIMIT Limit max rolls reached + * @param {int} response.ROLL_ID The roll identifier + * @returns {void} + */ + phpbb.addAjaxCallback('dice_delete', function(response) { + if (response.ROLL_SUCCESS) { + // We toggle the roll button if necessary + dice.toggleRollButton(response.ROLL_LIMIT); + + // Remove the row + $(this).parents('tr').slideUp('slow', function() { + $(this).remove(); + }); + + /** + * @var {RegExp} pattern Regular expression to find the dice bbcode in the text + * @var {object} textarea The textarea + */ + let roll_id = response.ROLL_ID, + pattern = new RegExp('\\[roll=' + roll_id + '\\].*?\\[\\/roll\\]', 'gi'), + textarea = document.forms[form_name].elements[text_name]; + + textarea.value = textarea.value.replace(pattern, ''); + } + }); + + /** + * Add a callback for editing a roll. + * + * @param {array} response The response array + * @param {bool} response.ROLL_SUCCESS Successful deletion indicator + * @param {int} response.ROLL_DATA The roll data + * @returns {void} + */ + phpbb.addAjaxCallback('dice_edit', function(response) { + if (response.ROLL_SUCCESS) { + let row = $(this).parents('tr'), + roll = response.ROLL_DATA, + pattern = new RegExp('\\[roll=' + roll.id + '\\].*?\\[\\/roll\\]', 'gi'), + textarea = document.forms[form_name].elements[text_name]; + + row.find('.dice-roll-notation').html(roll.notation); + + textarea.value = textarea.value.replace(pattern, '[roll=' + roll.id +']' + roll.notation + '[/roll]'); + } + }); +})(jQuery); // Avoid conflicts with other libraries diff --git a/ext/phpbbstudio/dice/styles/all/template/js/dice_display.js b/ext/phpbbstudio/dice/styles/all/template/js/dice_display.js new file mode 100644 index 0000000..aa899ec --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/template/js/dice_display.js @@ -0,0 +1,53 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +(function($) { // Avoid conflicts with other libraries + + 'use strict'; + + let h = 38; + let w = 300; + let d = 'dice-tooltip'; + let t = 'dice-tooltip-top'; + let r = 'dice-tooltip-right'; + let b = 'dice-tooltip-bottom'; + let l = 'dice-tooltip-left'; + let f = 'dice-tooltip-flip'; + + $(function() { + $('.dice-tooltip').each(function() { + let parent = $(this).parents('.content, dd').first(), + tt = $(this).offset().top, + pt = parent.offset().top, + th = $(this).height(), + ph = parent.height(), + tb = tt + th, + pb = pt + ph, + ts = $(this).offset().left, + ps = parent.offset().left, + pe = ps + parent.width(); + + if (tt - pt > h) { + $(this).addClass(t); + if (pe - ts < w) { + $(this).addClass(f); + } + } else if (pb - tb > h) { + $(this).addClass(b); + if (pe - ts < w) { + $(this).addClass(f); + } + } else if (pe - ts > w) { + $(this).addClass(r); + } else if (ts - ps > w) { + $(this).addClass(r); + } else { // Not able to place a tooltip + $(this).removeClass(d); + } + }); + }); +})(jQuery); // Avoid conflicts with other libraries diff --git a/ext/phpbbstudio/dice/styles/all/theme/dice.css b/ext/phpbbstudio/dice/styles/all/theme/dice.css new file mode 100644 index 0000000..2108a9e --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/theme/dice.css @@ -0,0 +1,23 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +.dice-roll-actions, +.dice-roll-id { + width: 15%; +} + +.dice-roll-notation, +.dice-roll-time { + width: 30%; +} + +.dice-roll-notation, +.dice-roll-actions, +.dice-roll-time, +.dice-roll-id { + text-align: center; +} diff --git a/ext/phpbbstudio/dice/styles/all/theme/dice_display.css b/ext/phpbbstudio/dice/styles/all/theme/dice_display.css new file mode 100644 index 0000000..c8fef7e --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/theme/dice_display.css @@ -0,0 +1,153 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +.dice-display { + display: inline-block; +} + +.dice-tooltip, +.dice-tooltip * { + box-sizing: border-box; +} + +.dice-roll-highest { color: #1b9a1b; } +.dice-roll-lowest { color: #d31141; } + +.dice-tooltip { + position: relative; + cursor: help; +} + +.dice-tooltip:after, +.dice-tooltip:before { + opacity: 0; + position: absolute; + z-index: 99; + visibility: hidden; + transition: transform 200ms ease, opacity 200ms; +} + +.dice-tooltip:before { + font-size: 10px; + font-weight: bold; + white-space: normal; + text-decoration: none; + background: #000000; + border-radius: 4px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + color: #ffffff; + padding: 5px 10px; + content: attr(data-tooltip); +} + +.dice-tooltip:after { + border: 6px solid transparent; + width: 0; + height: 0; + content: ""; +} + +.dice-tooltip:hover:after, +.dice-tooltip:hover:before { + opacity: 0.85; + visibility: visible; + transform: translateY(0); +} + +.dice-tooltip-top:before, +.dice-tooltip-top:after { transform: translateY(10px); } + +.dice-tooltip-top:hover:after, +.dice-tooltip-top:hover:before { transform: translateY(0); } + +.dice-tooltip-right:before, +.dice-tooltip-right:after { transform: translateX(0); } + +.dice-tooltip-right:hover:after, +.dice-tooltip-right:hover:before { transform: translateX(10px); } + +.dice-tooltip-bottom:before, +.dice-tooltip-bottom:after { transform: translateY(-10px); } + +.dice-tooltip-bottom:hover:after, +.dice-tooltip-bottom:hover:before { transform: translateY(0); } + +.dice-tooltip-left:before, +.dice-tooltip-left:after { transform: translateX(0); } + +.dice-tooltip-left:hover:after, +.dice-tooltip-left:hover:before { transform: translateX(-10px); } + +.dice-tooltip-top:before { + bottom: 100%; + left: 5px; + margin-bottom: 10px; +} + +.dice-tooltip-top:after { + border-top-color: #000000; + border-bottom: none; + bottom: 101%; + left: calc(50% - 6px); + margin-bottom: 4px; +} + +.dice-tooltip-left:before { + top: -15%; + right: 100%; + margin-right: 10px; +} + +.dice-tooltip-left:after { + border-right: none; + border-left-color: #000000; + top: calc(50% - 3px); + right: 100%; + margin-top: -6px; + margin-right: 4px; +} + +.dice-tooltip-right:before { + top: 15%; + left: 100%; + margin-left: 10px; +} + +.dice-tooltip-right:after { + border-right-color: #000000; + border-left: none; + top: calc(50% - 6px); + left: calc(100% + 4px); +} + +.dice-tooltip-bottom:before { + top: 100%; + left: 5px; + margin-top: 10px; +} + +.dice-tooltip-bottom:after { + border-top: none; + border-bottom-color: #000000; + top: 100%; + left: calc(50% - 6px); + margin-top: 4px; +} + +.dice-tooltip-flip:before { + right: 5px; + left: unset; +} + +.dice-box { + background-color: rgba(255, 255, 255, 0.8); + width: 100%; +} + +.dice-box dd { + min-height: 75px; +} diff --git a/ext/phpbbstudio/dice/styles/all/theme/dice_page.css b/ext/phpbbstudio/dice/styles/all/theme/dice_page.css new file mode 100644 index 0000000..fa438c8 --- /dev/null +++ b/ext/phpbbstudio/dice/styles/all/theme/dice_page.css @@ -0,0 +1,136 @@ +/** + * phpBB Studio's Dice extension for the phpBB Forum Software package. + * + * @copyright (c) 2019 phpBB Studio + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +.dice-section { + font-size: 1rem; + color: #5b5b5b; +} + +.dice-title { + font-size: 1.5rem; + border: none; +} + +/* TEST DICE PART */ +.dice-fieldset { + position: relative; + margin-bottom: 0; + padding: 0; +} + +.dice-options { + text-align: center; +} + +.dice-submit { + border-top-left-radius: 0; + border-top-right-radius: 0; + display: inline-block; + padding: 0 0.75rem 0.5rem; +} + +.dice-skin { + font-size: 0.9rem; + border-radius: inherit; + position: absolute; + top: 0.5rem; + left: 0.5rem; + width: calc(150px - 1rem); + padding-top: calc(3px + 0.1rem); + padding-bottom: calc(4px + 0.1rem); + padding-left: 3px; +} + +.dice-skin:focus { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} + +.dice-input { + text-indent: 1rem; + border: 1px solid transparent; + border-radius: inherit; + width: calc(100% - 1rem - 152px); + margin: 0.5rem 1rem 0.5rem 150px; + padding: 0.25rem 0; +} + +.dice-input:focus { + border: 1px inset #a1b0bc; + outline: none; +} + +.dice-result { + font-size: 1rem; + margin-bottom: 1rem; + padding: 1rem; +} + +/* FAQ PART */ +.dice-limit { + font-size: 0.75rem; +} + +.dice-section p { + font-size: 1rem; +} + +.dice-type { + border-bottom: none; + color: #333333; + margin: 0 0 .5rem; + padding: 5px; +} + +.dice-type:before { + font-family: FontAwesome, sans-serif; + color: #12a3eb; + margin-right: 1rem; + content: "\f1b2"; +} + +.dice-list, +dl.dice-list { + font-size: 0.9rem; + font-style: italic; + border-left: 2px solid #12a3eb; + margin-bottom: 1.5rem; + margin-left: calc(1.5rem - 15px); + padding: 0.75rem 1.5rem; +} + +dl.dice-list dt { width: 15%; } +dl.dice-list dd { width: 80%; padding-left: 1rem; } + +.dice-hr { + border-top: 2px solid #12a3eb; + width: 25%; + margin: 1rem auto; +} + +div.dice-example, +span.dice-example { + font-size: 0.9rem; + border-radius: 3px; + color: #333333; +} + +div.dice-example { + margin: 0 0 0.5rem; + padding: 16px; +} + +span.dice-example { + background-color: rgba(0, 0, 0, 0.1); + margin: 0; + padding: 0.05rem 0.4rem; +} + +div.dice-example dl.details dt, +div.dice-example dl.details dd { + font-size: 1rem; +} diff --git a/ext/phpbbstudio/dice/styles/prosilver/template/ucp_dice_body.html b/ext/phpbbstudio/dice/styles/prosilver/template/ucp_dice_body.html new file mode 100644 index 0000000..182453d --- /dev/null +++ b/ext/phpbbstudio/dice/styles/prosilver/template/ucp_dice_body.html @@ -0,0 +1,36 @@ +{% INCLUDE 'ucp_header.html' %} + +
    + +

    {{ lang('SETTINGS') }}

    + +
    +
    +
    +
    +
    +
    {{ lang('UCP_DICE_USER_EXPLAIN') }} +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    + {{ S_HIDDEN_FIELDS }} + {{ S_FORM_TOKEN }} +
    + +
    + +{% INCLUDE 'ucp_footer.html' %} diff --git a/ext/phpbbstudio/dice/ucp/main_info.php b/ext/phpbbstudio/dice/ucp/main_info.php new file mode 100644 index 0000000..44a3cac --- /dev/null +++ b/ext/phpbbstudio/dice/ucp/main_info.php @@ -0,0 +1,30 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\ucp; + +/** + * phpBB Studio's Dice UCP module info. + */ +class main_info +{ + function module() + { + return [ + 'filename' => '\phpbbstudio\dice\ucp\main_module', + 'title' => 'UCP_DICE_TITLE', + 'modes' => [ + 'settings' => [ + 'title' => 'UCP_DICE', + 'auth' => 'ext_phpbbstudio/dice && acl_u_dice_use_ucp', + 'cat' => ['UCP_DICE_TITLE'], + ], + ], + ]; + } +} diff --git a/ext/phpbbstudio/dice/ucp/main_module.php b/ext/phpbbstudio/dice/ucp/main_module.php new file mode 100644 index 0000000..75ba910 --- /dev/null +++ b/ext/phpbbstudio/dice/ucp/main_module.php @@ -0,0 +1,67 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + */ + +namespace phpbbstudio\dice\ucp; + +/** + * phpBB Studio's Dice UCP module. + */ +class main_module +{ + var $tpl_name; + var $page_title; + var $u_action; + + /** + * @param $id + * @param $mode + * @throws \Exception + */ + function main($id, $mode) + { + /** @var \phpbb\request\request $request */ + global $db, $request, $template, $user, $phpbb_container; + + /** @var \phpbbstudio\dice\core\functions_common $functions */ + $functions = $phpbb_container->get('phpbbstudio.dice.functions.common'); + + $this->tpl_name = 'ucp_dice_body'; + $this->page_title = $user->lang('UCP_DICE_TITLE'); + + $form_key = 'ucp_dice_body'; + add_form_key($form_key); + + $data = [ + 'dice_u_skin' => $request->variable('dice_u_skin', $user->data['dice_u_skin']), + ]; + + if ($request->is_set_post('submit')) + { + if (!check_form_key($form_key)) + { + trigger_error($user->lang('FORM_INVALID'), E_USER_WARNING); + } + + $sql = 'UPDATE ' . $phpbb_container->getParameter('tables.users') . ' + SET ' . $db->sql_build_array('UPDATE', $data) . ' + WHERE user_id = ' . (int) $user->data['user_id']; + $db->sql_query($sql); + + meta_refresh(3, $this->u_action); + $message = $user->lang('UCP_DICE_SAVED') . '

    ' . $user->lang('RETURN_UCP', '', ''); + trigger_error($message); + } + + $skins = $functions->get_dice_skins(true); + + $template->assign_vars([ + 'USER_SKIN' => $functions->build_dice_select($skins, $user->data['dice_u_skin'], true), + 'S_UCP_ACTION' => $this->u_action, + ]); + } +} diff --git a/styles/Milk_v2/theme/colours_nuit.css b/styles/Milk_v2/theme/colours_nuit.css index 37607ac..a1e0916 100644 --- a/styles/Milk_v2/theme/colours_nuit.css +++ b/styles/Milk_v2/theme/colours_nuit.css @@ -109,7 +109,7 @@ body.content_block_header_block .forumbg .header a:hover, body.content_block_hea } .navbar a { - color: #bec4c9; + color: #000000; } .navbar_in_header ul.linklist > li > a { @@ -204,7 +204,7 @@ dl.details dt { } dl.details dd { - color: #536482; + color: #EEE8DD; } .sep {