diff --git a/lf-who-was-here-2_build_changelog.md b/lf-who-was-here-2_build_changelog.md index 547c516..8ab0fea 100644 --- a/lf-who-was-here-2_build_changelog.md +++ b/lf-who-was-here-2_build_changelog.md @@ -1,6 +1,36 @@ -### 2.1.5 +#### 2.1.6-b1 +* ACP-Template: + * HTML für PullDown Menüs (`

{{ lang('LFWWH_CONFIG_TITLE') }}

-

{{ lang('LFWWH_CONFIG_DESC', LFWWH_EXT_NAME) }}

+

{{ lang('LFWWH_CONFIG_DESC', LFWWH_METADATA.EXT_NAME) }}

-{% if LFWWH_NOTES|length %} -
- {% for note in LFWWH_NOTES %} -

{{ note }}

- {% endfor %} -
-{% endif %} +{{ _self.notes(LFWWH_NOTES) }}
@@ -32,7 +28,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_ADMIN_MODE_EXP') }}
- {{ _self.switch('lfwwh_admin_mode', LFWWH_ADMIN_MODE) }} + {{ _self.switch('lfwwh_admin_mode', LFWWH_ADMIN_MODE, switch_type) }}
@@ -41,7 +37,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_USE_PERMISSIONS_EXP') }}
- {{ _self.switch('lfwwh_use_permissions', LFWWH_USE_PERMISSIONS) }} + {{ _self.switch('lfwwh_use_permissions', LFWWH_USE_PERMISSIONS, switch_type) }}
@@ -50,12 +46,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_PERM_FOR_GUESTS_EXP') }}
- + {{ _self.select('lfwwh_perm_for_guests', LFWWH_PERM_FOR_GUESTS, LFWWH_PERM_FOR_GUESTS_OPTIONS) }}
@@ -64,12 +55,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_PERM_FOR_BOTS_EXP') }}
- + {{ _self.select('lfwwh_perm_for_bots', LFWWH_PERM_FOR_BOTS, LFWWH_PERM_FOR_BOTS_OPTIONS) }}
@@ -78,13 +64,11 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_PERM_BOTS_ONLY_ADMIN_EXP') }}
- {{ _self.switch('lfwwh_perm_bots_only_admin', LFWWH_PERM_BOTS_ONLY_ADMIN) }} + {{ _self.switch('lfwwh_perm_bots_only_admin', LFWWH_PERM_BOTS_ONLY_ADMIN, switch_type) }}
-{{ _self.form_buttons() }} -
{{ lang('LFWWH_SECTION_DISP_1') }}
@@ -93,7 +77,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_REG_USERS_EXP') }}
- {{ _self.switch('lfwwh_disp_reg_users', LFWWH_DISP_REG_USERS) }} + {{ _self.switch('lfwwh_disp_reg_users', LFWWH_DISP_REG_USERS, switch_type) }}
@@ -102,7 +86,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_HIDDEN_EXP') }}
- {{ _self.switch('lfwwh_disp_hidden', LFWWH_DISP_HIDDEN) }} + {{ _self.switch('lfwwh_disp_hidden', LFWWH_DISP_HIDDEN, switch_type) }}
@@ -111,11 +95,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_BOTS_EXP') }}
- + {{ _self.select('lfwwh_disp_bots', LFWWH_DISP_BOTS, LFWWH_DISP_BOTS_OPTIONS) }}
@@ -124,7 +104,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_GUESTS_EXP') }}
- {{ _self.switch('lfwwh_disp_guests', LFWWH_DISP_GUESTS) }} + {{ _self.switch('lfwwh_disp_guests', LFWWH_DISP_GUESTS, switch_type) }}
@@ -133,11 +113,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_TIME_EXP') }}
- + {{ _self.select('lfwwh_disp_time_users', LFWWH_DISP_TIME_USERS, LFWWH_DISP_TIME_USERS_OPTIONS) }}
@@ -146,11 +122,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_TIME_EXP') }}
- + {{ _self.select('lfwwh_disp_time_bots', LFWWH_DISP_TIME_BOTS, LFWWH_DISP_TIME_BOTS_OPTIONS) }}
@@ -159,7 +131,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_TIME_FORMAT_EXP', lang('LFWWH_LAST1'), lang('LFWWH_LAST2'), lang('LFWWH_LAST3')) }}
- + {{ _self.text('lfwwh_disp_time_format', LFWWH_DISP_TIME_FORMAT, 12) }} {{ LFWWH_DISP_TIME_FORMAT_DEMO }}
@@ -169,11 +141,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_DISP_IP_EXP') }}
- + {{ _self.select('lfwwh_disp_ip', LFWWH_DISP_IP, LFWWH_DISP_IP_OPTIONS) }}
@@ -188,10 +156,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_TIME_MODE_EXP') }}
- + {{ _self.select('lfwwh_time_mode', LFWWH_TIME_MODE, LFWWH_TIME_MODE_OPTIONS) }}
@@ -199,15 +164,15 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

- + {{ _self.number('lfwwh_period_of_time_h', LFWWH_PERIOD_OF_TIME_H, 0, 99999) }} {{ lang('HOURS') }}
- + {{ _self.number('lfwwh_period_of_time_m', LFWWH_PERIOD_OF_TIME_M, 0, 99999) }} {{ lang('MINUTES') }}
- + {{ _self.number('lfwwh_period_of_time_s', LFWWH_PERIOD_OF_TIME_S, 0, 99999) }} {{ lang('SECONDS') }}
@@ -217,14 +182,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_SORT_BY_EXP') }}
- + {{ _self.select('lfwwh_sort_by', LFWWH_SORT_BY, LFWWH_SORT_BY_OPTIONS) }}
@@ -233,7 +191,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_RECORD_EXP') }}
- {{ _self.switch('lfwwh_record', LFWWH_RECORD) }} + {{ _self.switch('lfwwh_record', LFWWH_RECORD, switch_type) }}
@@ -252,17 +210,11 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_TEMPLATE_POS_EXP') }}
- + {{ _self.select('lfwwh_template_pos', LFWWH_TEMPLATE_POS, LFWWH_TEMPLATE_POS_OPTIONS) }}
-{{ _self.form_buttons() }} -
{{ lang('LFWWH_SECTION_OTHERS') }}
@@ -271,7 +223,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_API_MODE_EXP') }}
- {{ _self.switch('lfwwh_api_mode', LFWWH_API_MODE) }} + {{ _self.switch('lfwwh_api_mode', LFWWH_API_MODE, switch_type) }}
@@ -280,7 +232,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_CLEAR_UP_EXP') }}
- {{ _self.switch('lfwwh_clear_up', LFWWH_CLEAR_UP) }} + {{ _self.switch('lfwwh_clear_up', LFWWH_CLEAR_UP, switch_type) }}
@@ -289,7 +241,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_TEMPLATE_POS_ALL_EXP') }}
- {{ _self.switch('lfwwh_template_pos_all', LFWWH_TEMPLATE_POS_ALL) }} + {{ _self.switch('lfwwh_template_pos_all', LFWWH_TEMPLATE_POS_ALL, switch_type) }}
@@ -298,7 +250,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_CREATE_HIDDEN_INFO_EXP') }}
- {{ _self.switch('lfwwh_create_hidden_info', LFWWH_CREATE_HIDDEN_INFO) }} + {{ _self.switch('lfwwh_create_hidden_info', LFWWH_CREATE_HIDDEN_INFO, switch_type) }}
@@ -313,7 +265,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_USE_CACHE_EXP') }}
- {{ _self.switch('lfwwh_use_cache', LFWWH_USE_CACHE) }} + {{ _self.switch('lfwwh_use_cache', LFWWH_USE_CACHE, switch_type) }}
@@ -322,7 +274,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_USE_ONLINE_TIME_EXP') }}
- {{ _self.switch('lfwwh_use_online_time', LFWWH_USE_ONLINE_TIME) }} + {{ _self.switch('lfwwh_use_online_time', LFWWH_USE_ONLINE_TIME, switch_type) }}
@@ -331,13 +283,12 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_CACHE_TIME_EXP') }}
- {{ lang('MINUTES') }} + {{ _self.number('lfwwh_cache_time', LFWWH_CACHE_TIME, 1, LFWWH_CACHE_TIME_MAX) }} + {{ lang('MINUTES') }}
-{{ _self.form_buttons() }} -
{{ lang('LFWWH_SECTION_RESET') }}
@@ -355,8 +306,9 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ lang('LFWWH_RECORD_RESET_EXP') }}
- {{ _self.switch('lfwwh_record_reset') }} + {{ _self.switch('lfwwh_record_reset', false, switch_type) }} {{ LFWWH_RECORD_RESET_TIME }} + {{ _self.confirmbox('lfwwh_record_reset', lang('LFWWH_MSG_CONFIRM_RECORD_RESET')) }}
@@ -366,27 +318,20 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{{ S_FORM_TOKEN }}
- +{{ _self.footer(LFWWH_METADATA) }} {% INCLUDE 'overall_footer.html' %} -{% INCLUDEJS '@lukewcs_whowashere/acp_who_was_here.js' %} -{% INCLUDECSS '@lukewcs_whowashere/acp_who_was_here.css' %} -{% INCLUDECSS '@lukewcs_whowashere/acp_toggle.css' %} +{% INCLUDEJS '@lukewcs_whowashere/acp_who_was_here_settings.js' %} +{% INCLUDECSS '@lukewcs_whowashere/acp_who_was_here_settings.css' %} {% macro form_buttons() %}
@@ -397,7 +342,7 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

  - +
{{ _self.icon('fa-chevron-circle-up', false) }} @@ -406,10 +351,59 @@

{{ lang('LFWWH_CONFIG_TITLE') }}

{% endmacro %} +{% macro notes(notes) %} + {% if notes|length %} +
+ {% for note in notes %} +

{{ note }}

+ {% endfor %} +
+ {% endif %} +{% endmacro %} + {% macro icon(classes, decorative = true) -%} - + {%- endmacro %} -{% macro switch(name, checked = false) -%} - +{% macro footer(metadata) %} +

+ {{ metadata.EXT_NAME }} {{ metadata.EXT_VER }} © LukeWCS
+ {{ metadata.LANG_DESC|e('html') }} {{ metadata.LANG_VER|e('html') }} • {{ metadata.LANG_AUTHOR|e('html') }} +

+{% endmacro %} + +{% macro switch(name, checked = false, type = 'toggle') -%} + {% if type == 'toggle' || type == 'checkbox' -%} + + {%- elseif type == 'radio' -%} + + + {%- endif %} +{%- endmacro %} + +{% macro select(name, value, options) -%} + +{%- endmacro %} + +{% macro number(name, value, min, max, step = 1, placeholder = '') -%} + +{%- endmacro %} + +{% macro text(name, value, size = 10, placeholder = '', pattern = '') -%} + +{%- endmacro %} + +{% macro confirmbox(name, message, default = false) -%} + {%- endmacro %} diff --git a/lukewcs/whowashere/adm/style/acp_who_was_here_settings.js b/lukewcs/whowashere/adm/style/acp_who_was_here_settings.js new file mode 100644 index 0000000..5ef58b4 --- /dev/null +++ b/lukewcs/whowashere/adm/style/acp_who_was_here_settings.js @@ -0,0 +1,251 @@ +/** +* +* LF who was here 2 - based on "NV who was here". An extension for the phpBB Forum Software package. +* +* @copyright (c) 2018, LukeWCS, https://www.wcsaga.org/ +* @copyright (c) 2015, Anvar, http://phpbbguru.net +* @copyright (c) 2013, nickvergessen, http://www.flying-bits.org/ +* @license GNU General Public License, version 2 (GPL-2.0) +* +*/ + +(function ($) { // IIFE start + +'use strict'; + +class LukeWCSphpBBConfirmBox { +/* +* phpBB ConfirmBox class for checkboxes and yes/no radio buttons - v1.4.2 +* @copyright (c) 2023, LukeWCS, https://www.wcsaga.org +* @license GNU General Public License, version 2 (GPL-2.0-only) +*/ + constructor(submitSelector, animDuration = 0) { + let _this = this; + this.$submitObject = $(submitSelector); + this.$formObject = this.$submitObject.parents('form'); + this.animDuration = animDuration; + + this.$formObject.find('div[id$="_confirmbox"]').each(function () { + const elementName = this.id.replace('_confirmbox', ''); + + $('input[name="' + elementName + '"]') .on('change' , _this.#Show); + $('input[name^="' + elementName + '_confirm_"]') .on('click' , _this.#Button); + }); + this.$formObject .on('reset' , _this.HideAll); + } + + #Show = (e) => { + const $elementObject = $('input[name="' + e.target.name + '"]'); + const $confirmBoxObject = $('div[id="' + e.target.name + '_confirmbox"]'); + + if ($elementObject.prop('checked') != $confirmBoxObject.attr('data-default')) { + this.#changeBoxState($elementObject, $confirmBoxObject, true); + } + } + + #Button = (e) => { + const elementName = e.target.name.replace(/_confirm_.*/, ''); + const $elementObject = $('input[name="' + elementName + '"]'); + const $confirmBoxObject = $('div[id="' + elementName + '_confirmbox"]'); + + if (e.target.name.endsWith('_confirm_no')) { + if ($elementObject.attr('type') == 'checkbox') { + $elementObject.prop('checked', $confirmBoxObject.attr('data-default')); + } else if ($elementObject.attr('type') == 'radio') { + $elementObject.filter('[value="' + ($confirmBoxObject.attr('data-default') ? '1' : '0') + '"]').prop('checked', true); + } + } + + this.#changeBoxState($elementObject, $confirmBoxObject, null); + } + + HideAll = () => { + const $elementObject = this.$formObject.find('input.confirmbox_active'); + const $confirmBoxObject = this.$formObject.find('div[id$="_confirmbox"]'); + + this.#changeBoxState($elementObject, $confirmBoxObject, false); + } + + #changeBoxState = ($elementObject, $confirmBoxObject, showBox) => { + $elementObject .prop('disabled', !!showBox); + $elementObject .toggleClass('confirmbox_active', !!showBox); + $confirmBoxObject [showBox ? 'show' : 'hide'](this.animDuration); + this.$submitObject .prop('disabled', showBox ?? this.$formObject.find('input.confirmbox_active').length); + } +} + +const constants = Object.freeze({ + PermNothing : 0, + PermStats : 1, + PermUsers : 2, + PermStatsUsers : 3, + + BotsDisabled : 0, + BotsWithUsers : 1, + BotsOwnLine : 2, + + DispDisabled : 0, + DispBehindName : 1, + DispAsTooltip : 2, + + TimeModePeriod : 0, + TimeModeToday : 1, + + SortByNameAZ : 0, + SortByNameZA : 1, + SortByVisitAsc : 2, + SortByVisitDesc : 3, + SortByIdAsc : 4, + SortByIdDesc : 5, + + PosTop : 0, + PosBottom : 1, + PosBeforeBDays : 2, + + OpacityEnabled : '1.0', + OpacityDisabled : '0.35', +}); +let confirmBox; + +function setState() { + const c = constants; + + // LFWWH_SECTION_PERMISSIONS + dimOptionGroup('lfwwh_use_permissions', + $('[name="lfwwh_admin_mode"]').prop('checked') + ); + dimOptionGroup('lfwwh_perm_for_guests', + $('[name="lfwwh_admin_mode"]').prop('checked') + || $('[name="lfwwh_use_permissions"]').prop('checked') + ); + dimOptionGroup('lfwwh_perm_for_bots', + $('[name="lfwwh_admin_mode"]').prop('checked') + || $('[name="lfwwh_use_permissions"]').prop('checked') + ); + dimOptionGroup('lfwwh_perm_bots_only_admin', + $('[name="lfwwh_admin_mode"]').prop('checked') + || $('[name="lfwwh_disp_bots"]').prop('value') == c.BotsDisabled + ); + + // LFWWH_SECTION_DISP_1 + dimOptionGroup('lfwwh_disp_time_bots', + $('[name="lfwwh_disp_bots"]').prop('value') == c.BotsDisabled + ); + dimOptionGroup('lfwwh_disp_time_format', + ( + $('[name="lfwwh_disp_bots"]').prop('value') == c.BotsDisabled + || $('[name="lfwwh_disp_time_bots"]').prop('value') == c.DispDisabled + ) + && $('[name="lfwwh_disp_time_users"]').prop('value') == c.DispDisabled + ); + + // LFWWH_SECTION_DISP_2 + dimOptionGroup('lfwwh_period_of_time_h', + $('[name="lfwwh_time_mode"]').prop('value') != c.TimeModePeriod + ); + dimOptionGroup('lfwwh_record_time_format', + !$('[name="lfwwh_record"]').prop('checked') + ); + dimOptionGroup('lfwwh_template_pos', + $('[name="lfwwh_template_pos_all"]').prop('checked') + ); + + // LFWWH_SECTION_OTHERS + dimOptionGroup('lfwwh_create_hidden_info', + $('[name="lfwwh_disp_time_users"]').prop('value') != c.DispAsTooltip + && $('[name="lfwwh_disp_time_bots"]').prop('value') != c.DispAsTooltip + && $('[name="lfwwh_disp_ip"]').prop('value') != c.DispAsTooltip + ); + + // LFWWH_SECTION_LOAD_SETTINGS + dimOptionGroup('lfwwh_use_online_time', + !$('[name="lfwwh_use_cache"]').prop('checked') + ); + dimOptionGroup('lfwwh_cache_time', + !$('[name="lfwwh_use_cache"]').prop('checked') + || $('[name="lfwwh_use_online_time"]').prop('checked') + ); +}; + +function dimOptionGroup(elememtName, dimCondition) { + const c = constants; + + $('[name="' + elememtName + '"]').parents('dl').css('opacity', dimCondition ? c.OpacityDisabled : c.OpacityEnabled); +} + +function setDefaults() { + const c = constants; + + // LFWWH_SECTION_PERMISSIONS + setSwitch('input[name="lfwwh_admin_mode"]', false); + setSwitch('input[name="lfwwh_use_permissions"]', false); + $( 'select[name="lfwwh_perm_for_guests"]').prop('value', c.PermStats); + $( 'select[name="lfwwh_perm_for_bots"]').prop('value', c.PermNothing); + setSwitch('input[name="lfwwh_perm_bots_only_admin"]', false); + // LFWWH_SECTION_DISP_1 + setSwitch('input[name="lfwwh_disp_reg_users"]', true); + setSwitch('input[name="lfwwh_disp_hidden"]', true); + $( 'select[name="lfwwh_disp_bots"]').prop('value', c.BotsWithUsers); + setSwitch('input[name="lfwwh_disp_guests"]', true); + $( 'select[name="lfwwh_disp_time_users"]').prop('value', c.DispBehindName); + $( 'select[name="lfwwh_disp_time_bots"]').prop('value', c.DispBehindName); + $( 'input[name="lfwwh_disp_time_format"]').prop('value', '$1 G:i'); + $( 'select[name="lfwwh_disp_ip"]').prop('value', c.DispBehindName); + // LFWWH_SECTION_DISP_2 + $( 'select[name="lfwwh_time_mode"]').prop('value', c.TimeModeToday); + $( 'input[name="lfwwh_period_of_time_h"]').prop('value', 24); + $( 'input[name="lfwwh_period_of_time_m"]').prop('value', 0); + $( 'input[name="lfwwh_period_of_time_s"]').prop('value', 0); + $( 'select[name="lfwwh_sort_by"]').prop('value', c.SortByVisitDesc); + setSwitch('input[name="lfwwh_record"]', true); + $( 'input[name="lfwwh_record_time_format"]').prop('value', 'D j. M Y'); + $( 'select[name="lfwwh_template_pos"]').prop('value', c.PosTop); + // LFWWH_SECTION_OTHERS + setSwitch('input[name="lfwwh_api_mode"]', false); + setSwitch('input[name="lfwwh_clear_up"]', true); + setSwitch('input[name="lfwwh_template_pos_all"]', false); + setSwitch('input[name="lfwwh_create_hidden_info"]', true); + // LFWWH_SECTION_LOAD_SETTINGS + setSwitch('input[name="lfwwh_use_cache"]', true); + setSwitch('input[name="lfwwh_use_online_time"]', true); + $( 'input[name="lfwwh_cache_time"]').prop('value', lfwwhACP.tpl.CacheTimeMax); + + setState(); +}; + +function setSwitch(selector, checked) { + const $elementObject = $(selector); + + if ($elementObject.attr('type') == 'checkbox') { + $elementObject.prop('checked', checked); + } else if ($elementObject.attr('type') == 'radio') { + $elementObject.filter('[value="' + (checked ? 1 : 0) + '"]').prop('checked', true); + } +}; + +function customFormReset() { + setTimeout(function() { + setState(); + }); +}; + +$(window).ready(function() { + $('input[name="lfwwh_admin_mode"]' ).on('change' , setState); + $('input[name="lfwwh_use_permissions"]' ).on('change' , setState); + $('select[name="lfwwh_disp_bots"]' ).on('change' , setState); + $('select[name="lfwwh_disp_time_users"]' ).on('change' , setState); + $('select[name="lfwwh_disp_time_bots"]' ).on('change' , setState); + $('select[name="lfwwh_disp_ip"]' ).on('change' , setState); + $('select[name="lfwwh_time_mode"]' ).on('change' , setState); + $('input[name="lfwwh_record"]' ).on('change' , setState); + $('input[name="lfwwh_template_pos_all"]' ).on('change' , setState); + $('input[name="lfwwh_use_cache"]' ).on('change' , setState); + $('input[name="lfwwh_use_online_time"]' ).on('change' , setState); + $('input[name="lfwwh_defaults"]' ).on('click' , setDefaults); + $('#lfwwh_form' ).on('reset' , customFormReset); + + confirmBox = new LukeWCSphpBBConfirmBox('[name="submit"]', 300); + setState(); +}); + +})(jQuery); // IIFE end diff --git a/lukewcs/whowashere/composer.json b/lukewcs/whowashere/composer.json index e532742..6c9d71a 100644 --- a/lukewcs/whowashere/composer.json +++ b/lukewcs/whowashere/composer.json @@ -1,43 +1,43 @@ { - "name": "lukewcs/whowashere", - "type": "phpbb-extension", - "description": "Shows a visitor statistic of the current day or a freely selectable period. It lists both visitors and bots, as well as numbers on visible members, invisible members, bots and guests. In addition, the extension offers a visitor record and is extensively adjustable.", - "homepage": "https://www.phpbb.com/customise/db/extension/lf_who_was_here_2/", - "version": "2.1.5", - "time": "2023-02-12", - "license": "GPL-2.0-only", - "authors": [ - { - "name": "LukeWCS", - "homepage": "https://github.com/LukeWCS", - "role": "Developer (adapting for 3.2+ and improvements)" - }, - { - "name": "Anvar", - "homepage": "http://phpbbguru.net", - "role": "Former developer (converting to 3.1 extension)" - }, - { - "name": "Joas Schilling [nickvergessen]", - "homepage": "http://www.flying-bits.org/", - "role": "Original MOD author" - } - ], - "require": { - "php": ">=7.1.0,<8.3.0@dev", - "composer/installers": "~1.0.0" - }, - "extra": { - "display-name": "LF who was here 2", - "lang-min-ver": "2.1.3", - "soft-require": { - "phpbb/phpbb": ">=3.2.10,<3.4.0@dev" - }, - "version-check": { - "host": "www.phpbb.com", - "directory": "/customise/db/extension/lf_who_was_here_2", - "filename": "version_check", - "ssl": true - } - } + "name": "lukewcs/whowashere", + "type": "phpbb-extension", + "description": "Shows a visitor statistic of the current day or a freely selectable period. It lists both visitors and bots, as well as numbers on visible members, invisible members, bots and guests. In addition, the extension offers a visitor record and is extensively adjustable.", + "homepage": "https://www.phpbb.com/customise/db/extension/lf_who_was_here_2/", + "version": "2.1.6-b1", + "time": "2024-01-06", + "license": "GPL-2.0-only", + "authors": [ + { + "name": "LukeWCS", + "homepage": "https://github.com/LukeWCS", + "role": "Developer (adapting for 3.2+ and improvements)" + }, + { + "name": "Anvar", + "homepage": "http://phpbbguru.net", + "role": "Former developer (converting to 3.1 extension)" + }, + { + "name": "Joas Schilling [nickvergessen]", + "homepage": "http://www.flying-bits.org/", + "role": "Original MOD author" + } + ], + "require": { + "php": ">=7.1.0,<8.4.0@dev", + "composer/installers": "~1.0.0" + }, + "extra": { + "display-name": "LF who was here 2", + "lang-min-ver": "2.1.6", + "soft-require": { + "phpbb/phpbb": ">=3.2.10,<3.4.0@dev" + }, + "version-check": { + "host": "www.phpbb.com", + "directory": "/customise/db/extension/lf_who_was_here_2", + "filename": "version_check", + "ssl": true + } + } } diff --git a/lukewcs/whowashere/config/services.yml b/lukewcs/whowashere/config/services.yml index 945bcf0..39190fb 100644 --- a/lukewcs/whowashere/config/services.yml +++ b/lukewcs/whowashere/config/services.yml @@ -1,10 +1,4 @@ services: - lukewcs.whowashere.listener: - class: lukewcs\whowashere\event\listener - arguments: - - '@lukewcs.whowashere.core' - tags: - - { name: event.listener } lukewcs.whowashere.core: class: lukewcs\whowashere\core\who_was_here arguments: @@ -18,9 +12,22 @@ services: - '%core.table_prefix%' - '%core.php_ext%' - '@language' + lukewcs.whowashere.core.common: + class: lukewcs\whowashere\core\who_was_here_common + arguments: + - '@language' + - '@template' + - '@ext.manager' + lukewcs.whowashere.listener: + class: lukewcs\whowashere\event\listener + arguments: + - '@lukewcs.whowashere.core' + tags: + - { name: event.listener } lukewcs.whowashere.controller.acp: class: lukewcs\whowashere\controller\acp_who_was_here_controller arguments: + - '@lukewcs.whowashere.core.common' - '@language' - '@template' - '@request' diff --git a/lukewcs/whowashere/controller/acp_who_was_here_controller.php b/lukewcs/whowashere/controller/acp_who_was_here_controller.php index 672472d..bd60168 100644 --- a/lukewcs/whowashere/controller/acp_who_was_here_controller.php +++ b/lukewcs/whowashere/controller/acp_who_was_here_controller.php @@ -24,6 +24,7 @@ class acp_who_was_here_controller public $u_action; public function __construct( + $common, \phpbb\language\language $language, \phpbb\template\template $template, \phpbb\request\request $request, @@ -33,6 +34,7 @@ public function __construct( \phpbb\extension\manager $ext_manager ) { + $this->common = $common; $this->language = $language; $this->template = $template; $this->request = $request; @@ -44,22 +46,26 @@ public function __construct( public function module_settings() { - $this->language->add_lang(['acp_who_was_here', 'who_was_here'], 'lukewcs/whowashere'); + $notes = []; + $this->language->add_lang(['acp_who_was_here', 'acp_who_was_here_lang_author', 'who_was_here'], 'lukewcs/whowashere'); + + $this->common->set_this( + $this->u_action + ); + $this->common->set_template_vars('LFWWH'); if ($this->request->is_set_post('submit')) { - if (!check_form_key('lukewcs_whowashere')) - { - trigger_error($this->language->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING); - } + $this->common->check_form_key_error('lukewcs_whowashere'); + $delete_cache = ($this->request->variable('lfwwh_sort_by', 0) != $this->config['lfwwh_sort_by']); - // config section 1 + // LFWWH_SECTION_PERMISSIONS $this->config->set('lfwwh_admin_mode' , $this->request->variable('lfwwh_admin_mode', 0)); $this->config->set('lfwwh_use_permissions' , $this->request->variable('lfwwh_use_permissions', 0)); $this->config->set('lfwwh_perm_for_guests' , $this->request->variable('lfwwh_perm_for_guests', 0)); $this->config->set('lfwwh_perm_for_bots' , $this->request->variable('lfwwh_perm_for_bots', 0)); $this->config->set('lfwwh_perm_bots_only_admin' , $this->request->variable('lfwwh_perm_bots_only_admin', 0)); - // config section 2 + // LFWWH_SECTION_DISP_1 $this->config->set('lfwwh_disp_reg_users' , $this->request->variable('lfwwh_disp_reg_users', 0)); $this->config->set('lfwwh_disp_hidden' , $this->request->variable('lfwwh_disp_hidden', 0)); $this->config->set('lfwwh_disp_bots' , $this->request->variable('lfwwh_disp_bots', 0)); @@ -68,7 +74,7 @@ public function module_settings() $this->config->set('lfwwh_disp_time_bots' , $this->request->variable('lfwwh_disp_time_bots', 0)); $this->config->set('lfwwh_disp_time_format' , $this->request->variable('lfwwh_disp_time_format', '')); $this->config->set('lfwwh_disp_ip' , $this->request->variable('lfwwh_disp_ip', 0)); - // config section 3 + // LFWWH_SECTION_DISP_2 $this->config->set('lfwwh_time_mode' , $this->request->variable('lfwwh_time_mode', 0)); $this->config->set('lfwwh_period_of_time_h' , $this->request->variable('lfwwh_period_of_time_h', 0)); $this->config->set('lfwwh_period_of_time_m' , $this->request->variable('lfwwh_period_of_time_m', 0)); @@ -77,16 +83,16 @@ public function module_settings() $this->config->set('lfwwh_record' , $this->request->variable('lfwwh_record', 0)); $this->config->set('lfwwh_record_time_format' , $this->request->variable('lfwwh_record_time_format', '')); $this->config->set('lfwwh_template_pos' , $this->request->variable('lfwwh_template_pos', 0)); - // config section 4 + // LFWWH_SECTION_OTHERS $this->config->set('lfwwh_api_mode' , $this->request->variable('lfwwh_api_mode', 0)); $this->config->set('lfwwh_clear_up' , $this->request->variable('lfwwh_clear_up', 0)); $this->config->set('lfwwh_template_pos_all' , $this->request->variable('lfwwh_template_pos_all', 0)); $this->config->set('lfwwh_create_hidden_info' , $this->request->variable('lfwwh_create_hidden_info', 0)); - // config section 5 + // LFWWH_SECTION_LOAD_SETTINGS $this->config->set('lfwwh_use_cache' , $this->request->variable('lfwwh_use_cache', 0)); $this->config->set('lfwwh_use_online_time' , $this->request->variable('lfwwh_use_online_time', 0)); $this->config->set('lfwwh_cache_time' , $this->request->variable('lfwwh_cache_time', 0)); - // config section 6 + // LFWWH_SECTION_RESET if ($this->request->variable('lfwwh_record_reset' , 0) > 0) { $this->config->set('lfwwh_record_ips', 1); @@ -94,6 +100,7 @@ public function module_settings() $this->config->set('lfwwh_record_reset_time', time()); } // config end + if ($this->config['lfwwh_use_cache'] && $delete_cache) { $this->cache->destroy("_lf_who_was_here"); @@ -101,18 +108,7 @@ public function module_settings() trigger_error($this->language->lang('LFWWH_MSG_SAVED_SETTINGS') . adm_back_link($this->u_action)); } - add_form_key('lukewcs_whowashere'); - - $md_manager = $this->ext_manager->create_extension_metadata_manager('lukewcs/whowashere'); - $this_meta = $md_manager->get_metadata('all'); - $notes = []; - - $ext_display_name = $this_meta['extra']['display-name']; - $ext_ver = $this_meta['version']; - $ext_lang_min_ver = $this_meta['extra']['lang-min-ver']; - - $ext_lang_ver = $this->get_lang_ver('LFWWH_LANG_EXT_VER'); - $lang_outdated_msg = $this->check_lang_ver($ext_display_name, $ext_lang_ver, $ext_lang_min_ver, 'LFWWH_MSG_LANGUAGEPACK_OUTDATED'); + $lang_outdated_msg = $this->common->lang_ver_check_msg('LFWWH_LANG_VER', 'LFWWH_MSG_LANGUAGEPACK_OUTDATED'); if ($lang_outdated_msg) { $notes[] = $lang_outdated_msg; @@ -125,51 +121,99 @@ public function module_settings() } $this->template->assign_vars([ - // heading - 'LFWWH_EXT_NAME' => $ext_display_name, - 'LFWWH_EXT_VER' => $ext_ver, - 'LFWWH_NOTES' => $notes, - // config section 1 - 'LFWWH_ADMIN_MODE' => $this->config['lfwwh_admin_mode'], - 'LFWWH_USE_PERMISSIONS' => $this->config['lfwwh_use_permissions'], - 'LFWWH_PERM_FOR_GUESTS' => $this->config['lfwwh_perm_for_guests'], - 'LFWWH_PERM_FOR_BOTS' => $this->config['lfwwh_perm_for_bots'], - 'LFWWH_PERM_BOTS_ONLY_ADMIN' => $this->config['lfwwh_perm_bots_only_admin'], - // config section 2 - 'LFWWH_DISP_REG_USERS' => $this->config['lfwwh_disp_reg_users'], - 'LFWWH_DISP_HIDDEN' => $this->config['lfwwh_disp_hidden'], - 'LFWWH_DISP_BOTS' => $this->config['lfwwh_disp_bots'], - 'LFWWH_DISP_GUESTS' => $this->config['lfwwh_disp_guests'], - 'LFWWH_DISP_TIME_USERS' => $this->config['lfwwh_disp_time_users'], - 'LFWWH_DISP_TIME_BOTS' => $this->config['lfwwh_disp_time_bots'], - 'LFWWH_DISP_TIME_FORMAT' => $this->config['lfwwh_disp_time_format'], - 'LFWWH_DISP_TIME_FORMAT_DEMO' => $this->language->lang('LFWWH_DISP_TIME_FORMAT_DEMO', $this->get_formatted_time(time())), - 'LFWWH_DISP_IP' => $this->config['lfwwh_disp_ip'], - // config section 3 - 'LFWWH_TIME_MODE' => $this->config['lfwwh_time_mode'], - 'LFWWH_PERIOD_OF_TIME_H' => $this->config['lfwwh_period_of_time_h'], - 'LFWWH_PERIOD_OF_TIME_M' => $this->config['lfwwh_period_of_time_m'], - 'LFWWH_PERIOD_OF_TIME_S' => $this->config['lfwwh_period_of_time_s'], - 'LFWWH_SORT_BY' => $this->config['lfwwh_sort_by'], - 'LFWWH_RECORD' => $this->config['lfwwh_record'], - 'LFWWH_RECORD_TIME_FORMAT' => $this->config['lfwwh_record_time_format'], - 'LFWWH_RECORD_TIME_FORMAT_DEMO' => $this->language->lang('LFWWH_DISP_TIME_FORMAT_DEMO', $this->get_formatted_record_time(time())), - 'LFWWH_TEMPLATE_POS' => $this->config['lfwwh_template_pos'], - // config section 4 - 'LFWWH_API_MODE' => $this->config['lfwwh_api_mode'], - 'LFWWH_CLEAR_UP' => $this->config['lfwwh_clear_up'], - 'LFWWH_TEMPLATE_POS_ALL' => $this->config['lfwwh_template_pos_all'], - 'LFWWH_CREATE_HIDDEN_INFO' => $this->config['lfwwh_create_hidden_info'], - // config section 5 - 'LFWWH_USE_CACHE' => $this->config['lfwwh_use_cache'], - 'LFWWH_USE_ONLINE_TIME' => $this->config['lfwwh_use_online_time'], - 'LFWWH_CACHE_TIME' => $this->config['lfwwh_cache_time'], - 'LFWWH_CACHE_TIME_MAX' => $load_online_time, - // config section 6 - 'LFWWH_RECORD_RESET_TIME' => ($this->config['lfwwh_record_reset_time'] != 1) ? $this->language->lang('LFWWH_RECORD_RESET_TIME_HINT', $this->user->format_date($this->config['lfwwh_record_reset_time'])) : '', + 'LFWWH_NOTES' => $notes, + // LFWWH_SECTION_PERMISSIONS + 'LFWWH_ADMIN_MODE' => $this->config['lfwwh_admin_mode'], + 'LFWWH_USE_PERMISSIONS' => $this->config['lfwwh_use_permissions'], + 'LFWWH_PERM_FOR_GUESTS' => $this->config['lfwwh_perm_for_guests'], + 'LFWWH_PERM_FOR_GUESTS_OPTIONS' => [ + 'LFWWH_PERM_STATS_USERS' => '3', + 'LFWWH_PERM_USERS' => '2', + 'LFWWH_PERM_STATS' => '1', + 'LFWWH_PERM_NOTHING' => '0', + ], + 'LFWWH_PERM_FOR_BOTS' => $this->config['lfwwh_perm_for_bots'], + 'LFWWH_PERM_FOR_BOTS_OPTIONS' => [ + 'LFWWH_PERM_STATS_USERS' => '3', + 'LFWWH_PERM_USERS' => '2', + 'LFWWH_PERM_STATS' => '1', + 'LFWWH_PERM_NOTHING' => '0', + ], + 'LFWWH_PERM_BOTS_ONLY_ADMIN' => $this->config['lfwwh_perm_bots_only_admin'], + // LFWWH_SECTION_DISP_1 + 'LFWWH_DISP_REG_USERS' => $this->config['lfwwh_disp_reg_users'], + 'LFWWH_DISP_HIDDEN' => $this->config['lfwwh_disp_hidden'], + 'LFWWH_DISP_BOTS' => $this->config['lfwwh_disp_bots'], + 'LFWWH_DISP_BOTS_OPTIONS' => [ + 'LFWWH_DISP_BOTS_OWN_LINE' => '2', + 'LFWWH_DISP_BOTS_WITH_USERS' => '1', + 'LFWWH_DISP_BOTS_DISABLED' => '0', + ], + 'LFWWH_DISP_GUESTS' => $this->config['lfwwh_disp_guests'], + 'LFWWH_DISP_TIME_USERS' => $this->config['lfwwh_disp_time_users'], + 'LFWWH_DISP_TIME_USERS_OPTIONS' => [ + 'LFWWH_DISP_AS_TOOLTIP' => '2', + 'LFWWH_DISP_BEHIND_NAME' => '1', + 'LFWWH_DISP_DISABLED' => '0', + ], + 'LFWWH_DISP_TIME_BOTS' => $this->config['lfwwh_disp_time_bots'], + 'LFWWH_DISP_TIME_BOTS_OPTIONS' => [ + 'LFWWH_DISP_AS_TOOLTIP' => '2', + 'LFWWH_DISP_BEHIND_NAME' => '1', + 'LFWWH_DISP_DISABLED' => '0', + ], + 'LFWWH_DISP_TIME_FORMAT' => $this->config['lfwwh_disp_time_format'], + 'LFWWH_DISP_TIME_FORMAT_DEMO' => $this->language->lang('LFWWH_DISP_TIME_FORMAT_DEMO', $this->get_formatted_time(time())), + 'LFWWH_DISP_IP' => $this->config['lfwwh_disp_ip'], + 'LFWWH_DISP_IP_OPTIONS' => [ + 'LFWWH_DISP_AS_TOOLTIP' => '2', + 'LFWWH_DISP_BEHIND_NAME' => '1', + 'LFWWH_DISP_DISABLED' => '0', + ], + // LFWWH_SECTION_DISP_2 + 'LFWWH_TIME_MODE' => $this->config['lfwwh_time_mode'], + 'LFWWH_TIME_MODE_OPTIONS' => [ + 'LFWWH_TIME_MODE_TODAY' => '1', + 'LFWWH_TIME_MODE_PERIOD' => '0', + ], + 'LFWWH_PERIOD_OF_TIME_H' => $this->config['lfwwh_period_of_time_h'], + 'LFWWH_PERIOD_OF_TIME_M' => $this->config['lfwwh_period_of_time_m'], + 'LFWWH_PERIOD_OF_TIME_S' => $this->config['lfwwh_period_of_time_s'], + 'LFWWH_SORT_BY' => $this->config['lfwwh_sort_by'], + 'LFWWH_SORT_BY_OPTIONS' => [ + 'LFWWH_SORT_BY_NAME_AZ' => '0', + 'LFWWH_SORT_BY_NAME_ZA' => '1', + 'LFWWH_SORT_BY_VISIT_ASC' => '2', + 'LFWWH_SORT_BY_VISIT_DESC' => '3', + 'LFWWH_SORT_BY_ID_ASC' => '4', + 'LFWWH_SORT_BY_ID_DESC' => '5', + ], + 'LFWWH_RECORD' => $this->config['lfwwh_record'], + 'LFWWH_RECORD_TIME_FORMAT' => $this->config['lfwwh_record_time_format'], + 'LFWWH_RECORD_TIME_FORMAT_DEMO' => $this->language->lang('LFWWH_DISP_TIME_FORMAT_DEMO', $this->get_formatted_record_time(time())), + 'LFWWH_TEMPLATE_POS' => $this->config['lfwwh_template_pos'], + 'LFWWH_TEMPLATE_POS_OPTIONS' => [ + 'LFWWH_TEMPLATE_POS_TOP' => '0', + 'LFWWH_TEMPLATE_POS_BEFORE_BDAYS' => '2', + 'LFWWH_TEMPLATE_POS_BOTTOM' => '1', + ], + // LFWWH_SECTION_OTHERS + 'LFWWH_API_MODE' => $this->config['lfwwh_api_mode'], + 'LFWWH_CLEAR_UP' => $this->config['lfwwh_clear_up'], + 'LFWWH_TEMPLATE_POS_ALL' => $this->config['lfwwh_template_pos_all'], + 'LFWWH_CREATE_HIDDEN_INFO' => $this->config['lfwwh_create_hidden_info'], + // LFWWH_SECTION_LOAD_SETTINGS + 'LFWWH_USE_CACHE' => $this->config['lfwwh_use_cache'], + 'LFWWH_USE_ONLINE_TIME' => $this->config['lfwwh_use_online_time'], + 'LFWWH_CACHE_TIME' => $this->config['lfwwh_cache_time'], + 'LFWWH_CACHE_TIME_MAX' => $load_online_time, + // LFWWH_SECTION_RESET + 'LFWWH_RECORD_RESET_TIME' => ($this->config['lfwwh_record_reset_time'] != 1) ? $this->language->lang('LFWWH_RECORD_RESET_TIME_HINT', $this->user->format_date($this->config['lfwwh_record_reset_time'])) : '', // form elements - 'U_ACTION' => $this->u_action, + 'U_ACTION' => $this->u_action, ]); + + add_form_key('lukewcs_whowashere'); } public function set_page_url($u_action) @@ -188,31 +232,4 @@ private function get_formatted_record_time(int $timestamp): string { return $this->user->format_date($timestamp, $this->config['lfwwh_record_time_format']); } - - // Determine the version of the language pack with fallback to 0.0.0 - private function get_lang_ver(string $lang_ext_ver): string - { - return $this->language->is_set($lang_ext_ver) ? preg_replace('/[^0-9.]/', '', $this->language->lang($lang_ext_ver)) : '0.0.0'; - } - - // Check the language pack version for the minimum version and generate notice if outdated - private function check_lang_ver(string $ext_name, string $ext_lang_ver, string $ext_lang_min_ver, string $lang_outdated_var): string - { - $lang_outdated_msg = ''; - - if (phpbb_version_compare($ext_lang_ver, $ext_lang_min_ver, '<')) - { - if ($this->language->is_set($lang_outdated_var)) - { - $lang_outdated_msg = $this->language->lang($lang_outdated_var); - } - else // Fallback if the current language package does not yet have the required variable. - { - $lang_outdated_msg = 'Note: The language pack for the extension %1$s is no longer up-to-date. (installed: %2$s / needed: %3$s)'; - } - $lang_outdated_msg = sprintf($lang_outdated_msg, $ext_name, $ext_lang_ver, $ext_lang_min_ver); - } - - return $lang_outdated_msg; - } } diff --git a/lukewcs/whowashere/core/who_was_here_common.php b/lukewcs/whowashere/core/who_was_here_common.php new file mode 100644 index 0000000..5d3d744 --- /dev/null +++ b/lukewcs/whowashere/core/who_was_here_common.php @@ -0,0 +1,103 @@ +language = $language; + $this->template = $template; + $this->ext_manager = $ext_manager; + + $this->metadata = $this->ext_manager->create_extension_metadata_manager('lukewcs/whowashere')->get_metadata('all'); + } + + public function set_this( + $u_action + ): void + { + $this->u_action = $u_action; + } + + public function set_template_vars($tpl_prefix): void + { + $this->template->assign_vars([ + $tpl_prefix . '_METADATA' => [ + 'EXT_NAME' => $this->metadata['extra']['display-name'], + 'EXT_VER' => $this->language->lang($tpl_prefix . '_VERSION_STRING', $this->metadata['version']), + 'LANG_DESC' => $this->language->lang($tpl_prefix . '_LANG_DESC'), + 'LANG_VER' => $this->language->lang($tpl_prefix . '_VERSION_STRING', $this->language->lang($tpl_prefix . '_LANG_VER')), + 'LANG_AUTHOR' => $this->language->lang($tpl_prefix . '_LANG_AUTHOR'), + 'CLASS' => strtolower($tpl_prefix) . '_footer', + ], + ]); + } + + public function check_form_key_error($key): void + { + if (!check_form_key($key)) + { + trigger_error($this->language->lang('FORM_INVALID') . $this->back_link(), E_USER_WARNING); + } + } + + public function back_link($lang_var = null): string + { + return sprintf('

%2$s', + /* 1 */ $this->u_action, + /* 2 */ $this->language->lang($lang_var ?? 'BACK_TO_PREV') + ); + } + + // Determine the version of the language pack with fallback to 0.0.0 + public function get_lang_ver(string $lang_ext_ver): string + { + preg_match('/^([0-9]+\.[0-9]+\.[0-9]+)/', $this->language->lang($lang_ext_ver), $matches); + return ($matches[1] ?? '0.0.0'); + } + + // Check the language pack version for the minimum version and generate notice if outdated + public function lang_ver_check_msg(string $lang_version_var, string $lang_outdated_var): string + { + $lang_outdated_msg = ''; + $ext_lang_ver = $this->get_lang_ver($lang_version_var); + $ext_lang_min_ver = $this->metadata['extra']['lang-min-ver']; + + if (phpbb_version_compare($ext_lang_ver, $ext_lang_min_ver, '<')) + { + if ($this->language->is_set($lang_outdated_var)) + { + $lang_outdated_msg = $this->language->lang($lang_outdated_var); + } + else // Fallback if the current language package does not yet have the required variable. + { + $lang_outdated_msg = 'Note: The language pack for the extension %1$s is no longer up-to-date. (installed: %2$s / needed: %3$s)'; + } + $lang_outdated_msg = sprintf($lang_outdated_msg, $this->metadata['extra']['display-name'], $ext_lang_ver, $ext_lang_min_ver); + } + + return $lang_outdated_msg; + } +} diff --git a/lukewcs/whowashere/ext.php b/lukewcs/whowashere/ext.php index 62ced9c..9380da2 100644 --- a/lukewcs/whowashere/ext.php +++ b/lukewcs/whowashere/ext.php @@ -17,7 +17,7 @@ class ext extends \phpbb\extension\base public function is_enableable() { $valid_phpbb = phpbb_version_compare(PHPBB_VERSION, '3.2.10', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.4.0-dev', '<'); - $valid_php = phpbb_version_compare(PHP_VERSION, '7.1.0', '>=') && phpbb_version_compare(PHP_VERSION, '8.3.0-dev', '<'); + $valid_php = phpbb_version_compare(PHP_VERSION, '7.1.0', '>=') && phpbb_version_compare(PHP_VERSION, '8.4.0-dev', '<'); return $valid_phpbb && $valid_php; } diff --git a/lukewcs/whowashere/language/de/acp_who_was_here.php b/lukewcs/whowashere/language/de/acp_who_was_here.php index 3d9f11c..51b3819 100644 --- a/lukewcs/whowashere/language/de/acp_who_was_here.php +++ b/lukewcs/whowashere/language/de/acp_who_was_here.php @@ -82,7 +82,7 @@ 'LFWWH_DISP_TIME_BOTS' => 'Zeige die Zeit von Bots', 'LFWWH_DISP_TIME_EXP' => '(Allen Benutzern zeigen oder niemandem, keine spezielle Funktion für Administratoren.)', 'LFWWH_DISP_TIME_FORMAT' => 'Zeit-Format', - 'LFWWH_DISP_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax der PHP-Funktion date(). Spezielle Platzhalter: $1 = „%1$s“, $2 = „%2$s“, $3 = „%3$s“.', + 'LFWWH_DISP_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax des PHP Datum-Format. Spezielle Platzhalter: $1 = „%1$s“, $2 = „%2$s“, $3 = „%3$s“.', 'LFWWH_DISP_TIME_FORMAT_DEMO' => 'Aktuelle Anzeige: %s', 'LFWWH_DISP_IP' => 'Zeige die Benutzer-IP', 'LFWWH_DISP_IP_EXP' => '(Nur für Benutzer mit administrativen Rechten, wie bei „Wer ist online?“.)', @@ -107,7 +107,7 @@ 'LFWWH_RECORD' => 'Besucherrekord', 'LFWWH_RECORD_EXP' => 'Zeige und aktualisiere den Besucherrekord.', 'LFWWH_RECORD_TIME_FORMAT' => 'Datums-Format für den Besucherrekord', - 'LFWWH_RECORD_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax der PHP-Funktion date().', + 'LFWWH_RECORD_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax des PHP Datum-Format.', 'LFWWH_TEMPLATE_POS' => 'Position der Anzeige', 'LFWWH_TEMPLATE_POS_EXP' => 'Legt fest, wo die WWH-Anzeige im Online/Statistik-Bereich positioniert werden soll. „Oben“ ist die Position über diesem Bereich und „Unten“ entsprechend die Position darunter.', 'LFWWH_TEMPLATE_POS_TOP' => 'Oben', @@ -148,6 +148,6 @@ // messages 'LFWWH_MSG_SAVED_SETTINGS' => 'Wer war da: Einstellungen erfolgreich gespeichert.', - 'LFWWH_MSG_CONFIRM_RECORD_RESET' => 'Wer war da: Sobald du die Seite mit den Einstellungen speicherst, wird der Besucherrekord zurückgesetzt.', + 'LFWWH_MSG_CONFIRM_RECORD_RESET' => 'Sobald du die Seite mit den Einstellungen speicherst, wird der Besucherrekord zurückgesetzt.', 'LFWWH_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', ]); diff --git a/lukewcs/whowashere/language/de/acp_who_was_here_lang_author.php b/lukewcs/whowashere/language/de/acp_who_was_here_lang_author.php new file mode 100644 index 0000000..3886e4f --- /dev/null +++ b/lukewcs/whowashere/language/de/acp_who_was_here_lang_author.php @@ -0,0 +1,49 @@ + 'Deutsch (Du)', + 'LFWWH_LANG_VER' => '2.1.6', + 'LFWWH_LANG_AUTHOR' => 'LukeWCS', + + // messages + 'LFWWH_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', +]); diff --git a/lukewcs/whowashere/language/de/info_acp_who_was_here.php b/lukewcs/whowashere/language/de/info_acp_who_was_here.php index 1b31442..8627ec4 100644 --- a/lukewcs/whowashere/language/de/info_acp_who_was_here.php +++ b/lukewcs/whowashere/language/de/info_acp_who_was_here.php @@ -40,6 +40,9 @@ // $lang = array_merge($lang, [ // navigation - 'LFWWH_NAV_TITLE' => 'Wer war da? (2.x)', - 'LFWWH_NAV_CONFIG' => 'Einstellungen', + 'LFWWH_NAV_TITLE' => 'Wer war da? (2.x)', + 'LFWWH_NAV_CONFIG' => 'Einstellungen', + + // misc + 'LFWWH_VERSION_STRING' => 'v%s', ]); diff --git a/lukewcs/whowashere/language/de_x_sie/acp_who_was_here.php b/lukewcs/whowashere/language/de_x_sie/acp_who_was_here.php index 24a82a7..52a4b09 100644 --- a/lukewcs/whowashere/language/de_x_sie/acp_who_was_here.php +++ b/lukewcs/whowashere/language/de_x_sie/acp_who_was_here.php @@ -82,7 +82,7 @@ 'LFWWH_DISP_TIME_BOTS' => 'Zeige die Zeit von Bots', 'LFWWH_DISP_TIME_EXP' => '(Allen Benutzern zeigen oder niemandem, keine spezielle Funktion für Administratoren.)', 'LFWWH_DISP_TIME_FORMAT' => 'Zeit-Format', - 'LFWWH_DISP_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax der PHP-Funktion date(). Spezielle Platzhalter: $1 = „%1$s“, $2 = „%2$s“, $3 = „%3$s“.', + 'LFWWH_DISP_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax des PHP Datum-Format. Spezielle Platzhalter: $1 = „%1$s“, $2 = „%2$s“, $3 = „%3$s“.', 'LFWWH_DISP_TIME_FORMAT_DEMO' => 'Aktuelle Anzeige: %s', 'LFWWH_DISP_IP' => 'Zeige die Benutzer-IP', 'LFWWH_DISP_IP_EXP' => '(Nur für Benutzer mit administrativen Rechten, wie bei „Wer ist online?“.)', @@ -107,7 +107,7 @@ 'LFWWH_RECORD' => 'Besucherrekord', 'LFWWH_RECORD_EXP' => 'Zeige und aktualisiere den Besucherrekord.', 'LFWWH_RECORD_TIME_FORMAT' => 'Datums-Format für den Besucherrekord', - 'LFWWH_RECORD_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax der PHP-Funktion date().', + 'LFWWH_RECORD_TIME_FORMAT_EXP' => 'Das Format entspricht der Syntax des PHP Datum-Format.', 'LFWWH_TEMPLATE_POS' => 'Position der Anzeige', 'LFWWH_TEMPLATE_POS_EXP' => 'Legt fest, wo die WWH-Anzeige im Online/Statistik-Bereich positioniert werden soll. „Oben“ ist die Position über diesem Bereich und „Unten“ entsprechend die Position darunter.', 'LFWWH_TEMPLATE_POS_TOP' => 'Oben', @@ -148,6 +148,6 @@ // messages 'LFWWH_MSG_SAVED_SETTINGS' => 'Wer war da: Einstellungen erfolgreich gespeichert.', - 'LFWWH_MSG_CONFIRM_RECORD_RESET' => 'Wer war da: Sobald Sie die Seite mit den Einstellungen speichern, wird der Besucherrekord zurückgesetzt.', + 'LFWWH_MSG_CONFIRM_RECORD_RESET' => 'Sobald Sie die Seite mit den Einstellungen speichern, wird der Besucherrekord zurückgesetzt.', 'LFWWH_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', ]); diff --git a/lukewcs/whowashere/language/de_x_sie/acp_who_was_here_lang_author.php b/lukewcs/whowashere/language/de_x_sie/acp_who_was_here_lang_author.php new file mode 100644 index 0000000..2083791 --- /dev/null +++ b/lukewcs/whowashere/language/de_x_sie/acp_who_was_here_lang_author.php @@ -0,0 +1,49 @@ + 'Deutsch (Sie)', + 'LFWWH_LANG_VER' => '2.1.6', + 'LFWWH_LANG_AUTHOR' => 'LukeWCS', + + // messages + 'LFWWH_MSG_LANGUAGEPACK_OUTDATED' => 'Hinweis: Das Sprachpaket der Erweiterung %1$s ist nicht mehr aktuell. (vorhanden: %2$s / benötigt: %3$s)', +]); diff --git a/lukewcs/whowashere/language/de_x_sie/info_acp_who_was_here.php b/lukewcs/whowashere/language/de_x_sie/info_acp_who_was_here.php index 1b31442..8627ec4 100644 --- a/lukewcs/whowashere/language/de_x_sie/info_acp_who_was_here.php +++ b/lukewcs/whowashere/language/de_x_sie/info_acp_who_was_here.php @@ -40,6 +40,9 @@ // $lang = array_merge($lang, [ // navigation - 'LFWWH_NAV_TITLE' => 'Wer war da? (2.x)', - 'LFWWH_NAV_CONFIG' => 'Einstellungen', + 'LFWWH_NAV_TITLE' => 'Wer war da? (2.x)', + 'LFWWH_NAV_CONFIG' => 'Einstellungen', + + // misc + 'LFWWH_VERSION_STRING' => 'v%s', ]); diff --git a/lukewcs/whowashere/language/en/acp_who_was_here.php b/lukewcs/whowashere/language/en/acp_who_was_here.php index d610510..2cd595d 100644 --- a/lukewcs/whowashere/language/en/acp_who_was_here.php +++ b/lukewcs/whowashere/language/en/acp_who_was_here.php @@ -82,7 +82,7 @@ 'LFWWH_DISP_TIME_BOTS' => 'Show time of bots', 'LFWWH_DISP_TIME_EXP' => '(All user see it or none, no special function for Admins.)', 'LFWWH_DISP_TIME_FORMAT' => 'Time format', - 'LFWWH_DISP_TIME_FORMAT_EXP' => 'The format corresponds to the syntax of the PHP function date(). Special placeholder: $1 = “%1$s”, $2 = “%2$s”, $3 = “%3$s”.', + 'LFWWH_DISP_TIME_FORMAT_EXP' => 'The format corresponds to the syntax of the PHP date format. Special placeholder: $1 = “%1$s”, $2 = “%2$s”, $3 = “%3$s”.', 'LFWWH_DISP_TIME_FORMAT_DEMO' => 'Current display: %s', 'LFWWH_DISP_IP' => 'Show user IP', 'LFWWH_DISP_IP_EXP' => '(Just for the users with administrative permissions, as with “Who is online”.)', @@ -107,7 +107,7 @@ 'LFWWH_RECORD' => 'Visitor record', 'LFWWH_RECORD_EXP' => 'Show and update the visitor record.', 'LFWWH_RECORD_TIME_FORMAT' => 'Date format for the visitor record', - 'LFWWH_RECORD_TIME_FORMAT_EXP' => 'The format corresponds to the syntax of the PHP function date().', + 'LFWWH_RECORD_TIME_FORMAT_EXP' => 'The format corresponds to the syntax of the PHP date format.', 'LFWWH_TEMPLATE_POS' => 'Position of the display', 'LFWWH_TEMPLATE_POS_EXP' => 'Determines where to place the WWH display in the Online/Statistic section. “Top” is the position above this section and “Bottom” is the position below.', 'LFWWH_TEMPLATE_POS_TOP' => 'Top', @@ -148,6 +148,6 @@ // messages 'LFWWH_MSG_SAVED_SETTINGS' => 'Who was here: Configuration updated successfully.', - 'LFWWH_MSG_CONFIRM_RECORD_RESET' => 'Who was here: As soon as you save the page with the settings, the visitor record will be reset.', + 'LFWWH_MSG_CONFIRM_RECORD_RESET' => 'As soon as you save the page with the settings, the visitor record will be reset.', 'LFWWH_MSG_LANGUAGEPACK_OUTDATED' => 'Note: The language pack for the extension %1$s is no longer up-to-date. (installed: %2$s / needed: %3$s)', ]); diff --git a/lukewcs/whowashere/language/en/acp_who_was_here_lang_author.php b/lukewcs/whowashere/language/en/acp_who_was_here_lang_author.php new file mode 100644 index 0000000..5b53c28 --- /dev/null +++ b/lukewcs/whowashere/language/en/acp_who_was_here_lang_author.php @@ -0,0 +1,49 @@ + 'English', + 'LFWWH_LANG_VER' => '2.1.6', + 'LFWWH_LANG_AUTHOR' => 'LukeWCS', + + // messages + 'LFWWH_MSG_LANGUAGEPACK_OUTDATED' => 'Note: The language pack for the extension %1$s is no longer up-to-date. (installed: %2$s / needed: %3$s)', +]); diff --git a/lukewcs/whowashere/language/en/info_acp_who_was_here.php b/lukewcs/whowashere/language/en/info_acp_who_was_here.php index 3a10857..1d84442 100644 --- a/lukewcs/whowashere/language/en/info_acp_who_was_here.php +++ b/lukewcs/whowashere/language/en/info_acp_who_was_here.php @@ -40,6 +40,9 @@ // $lang = array_merge($lang, [ // navigation - 'LFWWH_NAV_TITLE' => 'Who was here? (2.x)', - 'LFWWH_NAV_CONFIG' => 'Settings', + 'LFWWH_NAV_TITLE' => 'Who was here? (2.x)', + 'LFWWH_NAV_CONFIG' => 'Settings', + + // misc + 'LFWWH_VERSION_STRING' => 'v%s', ]); diff --git a/lukewcs/whowashere/styles/all/template/who_was_here.js b/lukewcs/whowashere/styles/all/template/who_was_here.js index 172397d..5471c4c 100644 --- a/lukewcs/whowashere/styles/all/template/who_was_here.js +++ b/lukewcs/whowashere/styles/all/template/who_was_here.js @@ -9,23 +9,46 @@ * */ -var lfwwhIndex = { +(function ($) { // IIFE start + +'use strict'; + + +// var lfwwhIndex = { + // isShowInfo: { + // 'users' : false, + // 'bots' : false + // }, + // ShowHide: function (e) { + 'use strict'; + + // lfwwhIndex.isShowInfo[e.data.ButtonType] = !lfwwhIndex.isShowInfo[e.data.ButtonType]; + // $('.lfwwh_info_' + e.data.ButtonType.slice(0, 1)).css('display', (lfwwhIndex.isShowInfo[e.data.ButtonType] ? '' : 'none')); + // $('.lfwwh_button_' + e.data.ButtonType).css('opacity', (lfwwhIndex.isShowInfo[e.data.ButtonType] ? '1.0' : '0.5')); + // } +// }; + +let lfwwhIndex = { isShowInfo: { 'users' : false, 'bots' : false }, - ShowHide: function (e) { - 'use strict'; - - lfwwhIndex.isShowInfo[e.data.ButtonType] = !lfwwhIndex.isShowInfo[e.data.ButtonType]; - $('.lfwwh_info_' + e.data.ButtonType.slice(0, 1)).css('display', (lfwwhIndex.isShowInfo[e.data.ButtonType] ? '' : 'none')); - $('.lfwwh_button_' + e.data.ButtonType).css('opacity', (lfwwhIndex.isShowInfo[e.data.ButtonType] ? '1.0' : '0.5')); - } }; +function ShowHide(e) { + // 'use strict'; + + lfwwhIndex.isShowInfo[e.data.ButtonType] = !lfwwhIndex.isShowInfo[e.data.ButtonType]; + // $('.lfwwh_info_' + e.data.ButtonType.slice(0, 1)).css('display', (lfwwhIndex.isShowInfo[e.data.ButtonType] ? '' : 'none')); + $('.lfwwh_info_' + e.data.ButtonType.slice(0, 1)).toggle(lfwwhIndex.isShowInfo[e.data.ButtonType]); + $('.lfwwh_button_' + e.data.ButtonType).css('opacity', (lfwwhIndex.isShowInfo[e.data.ButtonType] ? '1.0' : '0.5')); +} + $(window).ready(function() { - 'use strict'; + // 'use strict'; - $('.lfwwh_button_users' ).on('click', {ButtonType: 'users'} , lfwwhIndex.ShowHide); - $('.lfwwh_button_bots' ).on('click', {ButtonType: 'bots'} , lfwwhIndex.ShowHide); + $('.lfwwh_button_users' ).on('click', {ButtonType: 'users'} , ShowHide); + $('.lfwwh_button_bots' ).on('click', {ButtonType: 'bots'} , ShowHide); }); + +})(jQuery); // IIFE end