From 613bcb61673043091b9a9cd76f647a26b419d347 Mon Sep 17 00:00:00 2001 From: Florian Dagner Date: Tue, 30 Jan 2024 12:19:02 +0100 Subject: [PATCH 1/5] MBS-8543: Option added to pass on WLAN data via QR code --- block_qr.php | 18 ++++++++++++++++-- edit_form.php | 40 +++++++++++++++++++++++++++++++++++++++- lang/de/block_qr.php | 9 +++++++++ lang/en/block_qr.php | 10 +++++++++- templates/qr.mustache | 16 ++++++++++++++++ version.php | 4 ++-- 6 files changed, 91 insertions(+), 6 deletions(-) diff --git a/block_qr.php b/block_qr.php index d6cd2c3..e7d0f81 100644 --- a/block_qr.php +++ b/block_qr.php @@ -228,8 +228,19 @@ public function get_content() { $qrcodelink .= $this->config->geolocation_br . '&mlon=' . $this->config->geolocation_lng; $qrcodelink .= '#map=10/' . $this->config->geolocation_br . '/' . $this->config->geolocation_lng; $qrurl = true; - break; } + break; + + case 'wlan': + $qrcodecontent = "WIFI:T:" . $this->config->wlanauthentication; + $qrcodecontent .= ";S:" . $this->config->wlanssid; + $qrcodecontent .= ";P:" . $this->config->wlanpasskey; + $qrcodecontent .= ";H:" . $this->config->wlanssidoptions . ";"; + $description .= get_string('wlan', 'block_qr'); + $wlanauthentication = $this->config->wlanauthentication; + $wlanssid = $this->config->wlanssid; + $wlanpasskey = $this->config->wlanpasskey; + break; } // Short link option only in edit mode. @@ -276,7 +287,10 @@ public function get_content() { 'qrcodelink' => $qrcodelink, 'urlshort' => $urlshort, 'fullview' => $fullview, - 'configshortlink' => $configshortlink + 'configshortlink' => $configshortlink, + 'wlanauthentication' => $wlanauthentication, + 'wlanssid' => $wlanssid, + 'wlanpasskey' => $wlanpasskey, ]; $this->content->text = $OUTPUT->render_from_template('block_qr/qr', $data); return $this->content; diff --git a/edit_form.php b/edit_form.php index b7e5c66..c5ae3b1 100644 --- a/edit_form.php +++ b/edit_form.php @@ -82,7 +82,8 @@ protected function specific_definition($mform) { 'internalcontent' => get_string('internalcontent', 'block_qr'), 'owncontent' => get_string('owncontent', 'block_qr'), 'event' => get_string('event', 'block_qr'), - 'geolocation' => get_string('geolocation', 'block_qr') + 'geolocation' => get_string('geolocation', 'block_qr'), + 'wlan' => get_string('wlan', 'block_qr') ]; $courseid = $this->page->course->id; if ($courseid == SITEID) { @@ -174,6 +175,43 @@ protected function specific_definition($mform) { $mform->hideIf('config_link', 'config_options', 'neq', 'geolocation'); $mform->setType('config_link', PARAM_TEXT); + // WLAN fields. + $mform->addElement('text', 'config_wlanssid', get_string('ssid_label', 'block_qr'), 'size="20"'); + $mform->hideIf('config_wlanssid', 'config_options', 'neq', 'wlan'); + $mform->setType('config_wlanssid', PARAM_NOTAGS); + + $ssidoptions = [ + 'false' => get_string('visible', 'block_qr'), + 'true' => get_string('hidden', 'block_qr'), + ]; + + $mform->addElement( + 'advcheckbox', + 'config_wlanssidoptions', + get_string('config_wlanssidoptions', 'block_qr'), + '', + $ssidoptions + ); + $mform->hideIf('config_wlanssidoptions', 'config_options', 'neq', 'wlan'); + $mform->setType('config_wlanssidoptions', PARAM_TEXT); + $mform->addElement('text', 'config_wlanpasskey', get_string('passkey_label', 'block_qr'), 'size="20"'); + $mform->addHelpButton('config_wlanpasskey', 'wlan_passkey', 'block_qr'); + $mform->hideIf('config_wlanpasskey', 'config_options', 'neq', 'wlan'); + $mform->setType('config_wlanpasskey', PARAM_NOTAGS); + $authenticationoptions = [ + 'nopass' => get_string('none', 'block_qr'), + 'WEP' => get_string('wep', 'block_qr'), + 'WPA/WPA2' => get_string('wpa', 'block_qr'), + ]; + $mform->addElement( + 'select', + 'config_wlanauthentication', + get_string('config_wlanauthentication', 'block_qr'), + $authenticationoptions, + ); + $mform->hideIf('config_wlanauthentication', 'config_options', 'neq', 'wlan'); + $mform->setType('config_wlanauthentication', PARAM_TEXT); + // Section header title. $mform->addElement('header', 'widthheader', get_string('settings', 'block_qr')); // Settings. diff --git a/lang/de/block_qr.php b/lang/de/block_qr.php index f4d7394..b98d09c 100644 --- a/lang/de/block_qr.php +++ b/lang/de/block_qr.php @@ -23,6 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +$string['config_wlanauthentication'] = 'Authentifizierung'; $string['allday'] = 'Ganztägig'; $string['codecontent'] = 'Inhalt'; $string['config_geolocation_br'] = 'Format and zulässige Werte'; @@ -31,6 +32,7 @@ $string['config_geolocation_lng_help'] = 'Der Wert für den Längengrad ist auf ±180 begrenzt. Die Eingabe erfolgt als Dezimalgrad mit einem Dezimalpunkt. Beispiel: 10.49184'; $string['config_link_label'] = 'Link zum Standort'; $string['config_size_label'] = 'Größe des QR-Codes'; +$string['config_wlanssidoptions'] = 'versteckt'; $string['courseurl'] = 'Link zu diesem Kurs'; $string['courseurldesc_help'] = 'Hier kann zum Beispiel der Kursname oder der Einschreibeschlüssel eingetragen werden.'; $string['courseurldesc_label'] = 'Beschreibung'; @@ -54,9 +56,11 @@ $string['medium'] = 'Mittel'; $string['nocontent'] = 'Es wurde noch kein Inhalt konfiguriert. Klicken Sie auf das Zahnrad, um einen Inhalt für diesen QR-Block zu konfigurieren.'; $string['nolink'] = 'Kein Link'; +$string['none'] = 'keine'; $string['osm'] = 'OpenStreetMap'; $string['owncontent'] = 'Text/Link'; $string['owncontent_label'] = 'Text oder Link beginnend mit "https://" einfügen'; +$string['passkey_label'] = 'Passwort'; $string['pluginname'] = 'QR-Code'; $string['privacy:metadata'] = 'Der Latest QR-Code-Block zeigt nur Daten an und speichert selbst keine Daten.'; $string['qr:addinstance'] = 'Einen neuen aktuellen QR-Code-Block hinzufügen'; @@ -65,6 +69,7 @@ $string['shortlinkservice'] = 'URL des Kurzlinkdienstes'; $string['shortlinkservice_description'] = 'Im Bearbeitungsmodus des Blocks kann ein Link zu einem Kurzlinkdienst angezeigt werden. Geben Sie dazu die URL des gewünschten Kurzlinkdienstes ein.
Wenn dieser eine direkte Weitergabe der zu verkürzenden URL unterstützt, können Sie hierfür optional die Variable SHORTLINK verwenden und in den Link einbinden.'; $string['small'] = 'Klein'; +$string['ssid_label'] = 'SSID'; $string['strftimedate'] = 'd.m.y, H:i'; $string['strftimedateallday'] = 'd.m.y'; $string['strftimedatetime'] = 'H:i'; @@ -72,3 +77,7 @@ $string['urlparameterafter'] = 'URL-Parameter danach'; $string['urlparameterbefore'] = 'URL-Parameter davor'; $string['urlshortlabel'] = 'Kurzlink erstellen'; +$string['wlan'] = 'WLAN'; +$string['wep'] = 'WEP'; +$string['wpa'] = 'WPA/WPA2'; +$string['wlan_passkey_help'] = 'Veröffentlichen Sie keine Passwörter privater WLAN-Netzwerke!'; diff --git a/lang/en/block_qr.php b/lang/en/block_qr.php index 01f1458..2602ac2 100644 --- a/lang/en/block_qr.php +++ b/lang/en/block_qr.php @@ -23,6 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +$string['config_wlanauthentication'] = 'Authentication'; $string['allday'] = 'All day'; $string['codecontent'] = 'Content'; $string['config_geolocation_br'] = 'Format and permissible values'; @@ -31,6 +32,7 @@ $string['config_geolocation_lng_help'] = 'The value for the longitude is limited to ±180. The entry is made as a decimal degree with a decimal point. Example: 10.49184'; $string['config_link_label'] = 'Location link'; $string['config_size_label'] = 'Size of the qr code'; +$string['config_wlanssidoptions'] = 'hidden'; $string['courseurl'] = 'Link to this course'; $string['courseurldesc_help'] = 'For example, the course name or the enrolment key can be entered here.'; $string['courseurldesc_label'] = 'Description'; @@ -54,9 +56,11 @@ $string['medium'] = 'Medium'; $string['nocontent'] = 'No content has been configured yet. Click on the gear to configure a content for this QR block.'; $string['nolink'] = 'No Link'; +$string['none'] = 'none'; $string['osm'] = 'OpenStreetMap'; $string['owncontent'] = 'Text/URL'; $string['owncontent_label'] = 'Insert text or link starting with "https://"'; +$string['passkey_label'] = 'Password'; $string['pluginname'] = 'QR Code'; $string['privacy:metadata'] = 'The Latest QR Code block only shows data does not store data itself.'; $string['qr:addinstance'] = 'Add a new latest QR Code block'; @@ -65,6 +69,7 @@ $string['shortlinkservice'] = 'URL of the short link service'; $string['shortlinkservice_description'] = 'In the editing mode of the block, a link to a short link service can be displayed. To do this, enter the URL of the desired short link service.
If this supports direct forwarding of the URL to be shortened, you can optionally use the SHORTLINK variable for this and include it in the link.'; $string['small'] = 'Small'; +$string['ssid_label'] = 'SSID'; $string['strftimedate'] = 'y-m-d, h:i A'; $string['strftimedateallday'] = 'y-m-d'; $string['strftimedatetime'] = 'h:i A'; @@ -72,4 +77,7 @@ $string['urlparameterafter'] = 'URL parameters after'; $string['urlparameterbefore'] = 'URL parameters before'; $string['urlshortlabel'] = 'Create short link'; -$string['view_label'] = 'Visible for course participants'; +$string['wlan'] = 'WiFi'; +$string['wep'] = 'WEP'; +$string['wpa'] = 'WPA/WPA2'; +$string['wlan_passkey_help'] = 'Do not publish passwords for private WiFi networks!'; diff --git a/templates/qr.mustache b/templates/qr.mustache index ab2ea62..717e735 100644 --- a/templates/qr.mustache +++ b/templates/qr.mustache @@ -87,6 +87,22 @@

{{/geocoordinates}} +{{#wlanssid}} +

+ + {{#str}} + ssid_label, block_qr + {{/str}}: {{{wlanssid}}}
+ {{#str}} + config_wlanauthentication, block_qr + {{/str}}: {{{wlanauthentication}}}
+ {{#str}} + passkey_label, block_qr + {{/str}}: {{{wlanpasskey}}}
+

+{{/wlanssid}} + + {{#fullview}} {{#configshortlink}}

diff --git a/version.php b/version.php index cbe6892..fe7cf8e 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->release = 'v0.0.1'; -$plugin->version = 2023042500; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2024012900; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2022041200; // Requires this Moodle version. $plugin->component = 'block_qr'; // Full name of the plugin (used for diagnostics). -$plugin->maturity = MATURITY_ALPHA; // This is considered as ready for production sites. +$plugin->maturity = MATURITY_BETA; // This is considered as ready for production sites. From 499a752ff288f80f138797936bf3281df9d382ab Mon Sep 17 00:00:00 2001 From: Florian Dagner Date: Mon, 19 Feb 2024 08:36:28 +0100 Subject: [PATCH 2/5] Variables changed and all strings checked --- block_qr.php | 24 ++++++++++++------------ edit_form.php | 34 +++++++++++++++++----------------- lang/de/block_qr.php | 10 ++++++---- lang/en/block_qr.php | 10 ++++++---- templates/qr.mustache | 12 ++++++------ 5 files changed, 47 insertions(+), 43 deletions(-) diff --git a/block_qr.php b/block_qr.php index e7d0f81..33b7294 100644 --- a/block_qr.php +++ b/block_qr.php @@ -231,15 +231,15 @@ public function get_content() { } break; - case 'wlan': - $qrcodecontent = "WIFI:T:" . $this->config->wlanauthentication; - $qrcodecontent .= ";S:" . $this->config->wlanssid; - $qrcodecontent .= ";P:" . $this->config->wlanpasskey; - $qrcodecontent .= ";H:" . $this->config->wlanssidoptions . ";"; - $description .= get_string('wlan', 'block_qr'); - $wlanauthentication = $this->config->wlanauthentication; - $wlanssid = $this->config->wlanssid; - $wlanpasskey = $this->config->wlanpasskey; + case 'wifi': + $qrcodecontent = "WIFI:T:" . $this->config->wifiauthentication; + $qrcodecontent .= ";S:" . $this->config->wifissid; + $qrcodecontent .= ";P:" . $this->config->wifipasskey; + $qrcodecontent .= ";H:" . $this->config->wifissidoptions . ";"; + $description .= get_string('wifi', 'block_qr'); + $wifiauthentication = $this->config->wifiauthentication; + $wifissid = $this->config->wifissid; + $wifipasskey = $this->config->wifipasskey; break; } @@ -288,9 +288,9 @@ public function get_content() { 'urlshort' => $urlshort, 'fullview' => $fullview, 'configshortlink' => $configshortlink, - 'wlanauthentication' => $wlanauthentication, - 'wlanssid' => $wlanssid, - 'wlanpasskey' => $wlanpasskey, + 'wifiauthentication' => $wifiauthentication, + 'wifissid' => $wifissid, + 'wifipasskey' => $wifipasskey, ]; $this->content->text = $OUTPUT->render_from_template('block_qr/qr', $data); return $this->content; diff --git a/edit_form.php b/edit_form.php index c5ae3b1..39fed96 100644 --- a/edit_form.php +++ b/edit_form.php @@ -83,7 +83,7 @@ protected function specific_definition($mform) { 'owncontent' => get_string('owncontent', 'block_qr'), 'event' => get_string('event', 'block_qr'), 'geolocation' => get_string('geolocation', 'block_qr'), - 'wlan' => get_string('wlan', 'block_qr') + 'wifi' => get_string('wifi', 'block_qr') ]; $courseid = $this->page->course->id; if ($courseid == SITEID) { @@ -175,10 +175,10 @@ protected function specific_definition($mform) { $mform->hideIf('config_link', 'config_options', 'neq', 'geolocation'); $mform->setType('config_link', PARAM_TEXT); - // WLAN fields. - $mform->addElement('text', 'config_wlanssid', get_string('ssid_label', 'block_qr'), 'size="20"'); - $mform->hideIf('config_wlanssid', 'config_options', 'neq', 'wlan'); - $mform->setType('config_wlanssid', PARAM_NOTAGS); + // Wifi fields. + $mform->addElement('text', 'config_wifissid', get_string('ssid_label', 'block_qr'), 'size="20"'); + $mform->hideIf('config_wifissid', 'config_options', 'neq', 'wifi'); + $mform->setType('config_wifissid', PARAM_NOTAGS); $ssidoptions = [ 'false' => get_string('visible', 'block_qr'), @@ -187,17 +187,17 @@ protected function specific_definition($mform) { $mform->addElement( 'advcheckbox', - 'config_wlanssidoptions', - get_string('config_wlanssidoptions', 'block_qr'), + 'config_wifissidoptions', + get_string('config_wifissidoptions', 'block_qr'), '', $ssidoptions ); - $mform->hideIf('config_wlanssidoptions', 'config_options', 'neq', 'wlan'); - $mform->setType('config_wlanssidoptions', PARAM_TEXT); - $mform->addElement('text', 'config_wlanpasskey', get_string('passkey_label', 'block_qr'), 'size="20"'); - $mform->addHelpButton('config_wlanpasskey', 'wlan_passkey', 'block_qr'); - $mform->hideIf('config_wlanpasskey', 'config_options', 'neq', 'wlan'); - $mform->setType('config_wlanpasskey', PARAM_NOTAGS); + $mform->hideIf('config_wifissidoptions', 'config_options', 'neq', 'wifi'); + $mform->setType('config_wifissidoptions', PARAM_TEXT); + $mform->addElement('text', 'config_wifipasskey', get_string('passkey_label', 'block_qr'), 'size="20"'); + $mform->addHelpButton('config_wifipasskey', 'wifi_passkey', 'block_qr'); + $mform->hideIf('config_wifipasskey', 'config_options', 'neq', 'wifi'); + $mform->setType('config_wifipasskey', PARAM_NOTAGS); $authenticationoptions = [ 'nopass' => get_string('none', 'block_qr'), 'WEP' => get_string('wep', 'block_qr'), @@ -205,12 +205,12 @@ protected function specific_definition($mform) { ]; $mform->addElement( 'select', - 'config_wlanauthentication', - get_string('config_wlanauthentication', 'block_qr'), + 'config_wifiauthentication', + get_string('config_wifiauthentication', 'block_qr'), $authenticationoptions, ); - $mform->hideIf('config_wlanauthentication', 'config_options', 'neq', 'wlan'); - $mform->setType('config_wlanauthentication', PARAM_TEXT); + $mform->hideIf('config_wifiauthentication', 'config_options', 'neq', 'wifi'); + $mform->setType('config_wifiauthentication', PARAM_TEXT); // Section header title. $mform->addElement('header', 'widthheader', get_string('settings', 'block_qr')); diff --git a/lang/de/block_qr.php b/lang/de/block_qr.php index b98d09c..18238e1 100644 --- a/lang/de/block_qr.php +++ b/lang/de/block_qr.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['config_wlanauthentication'] = 'Authentifizierung'; +$string['config_wifiauthentication'] = 'Authentifizierung'; $string['allday'] = 'Ganztägig'; $string['codecontent'] = 'Inhalt'; $string['config_geolocation_br'] = 'Format and zulässige Werte'; @@ -32,8 +32,9 @@ $string['config_geolocation_lng_help'] = 'Der Wert für den Längengrad ist auf ±180 begrenzt. Die Eingabe erfolgt als Dezimalgrad mit einem Dezimalpunkt. Beispiel: 10.49184'; $string['config_link_label'] = 'Link zum Standort'; $string['config_size_label'] = 'Größe des QR-Codes'; -$string['config_wlanssidoptions'] = 'versteckt'; +$string['config_wifissidoptions'] = 'versteckt'; $string['courseurl'] = 'Link zu diesem Kurs'; +$string['courseurldesc'] = 'Beschreibung'; $string['courseurldesc_help'] = 'Hier kann zum Beispiel der Kursname oder der Einschreibeschlüssel eingetragen werden.'; $string['courseurldesc_label'] = 'Beschreibung'; $string['currenturl'] = 'Link zur aktuellen Seite'; @@ -77,7 +78,8 @@ $string['urlparameterafter'] = 'URL-Parameter danach'; $string['urlparameterbefore'] = 'URL-Parameter davor'; $string['urlshortlabel'] = 'Kurzlink erstellen'; -$string['wlan'] = 'WLAN'; +$string['wifi'] = 'WLAN'; +$string['wifi_passkey'] = "Umgang mit Passwörtern"; $string['wep'] = 'WEP'; $string['wpa'] = 'WPA/WPA2'; -$string['wlan_passkey_help'] = 'Veröffentlichen Sie keine Passwörter privater WLAN-Netzwerke!'; +$string['wifi_passkey_help'] = 'Veröffentlichen Sie keine Passwörter privater WLAN-Netzwerke!'; diff --git a/lang/en/block_qr.php b/lang/en/block_qr.php index 2602ac2..21ba7b0 100644 --- a/lang/en/block_qr.php +++ b/lang/en/block_qr.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['config_wlanauthentication'] = 'Authentication'; +$string['config_wifiauthentication'] = 'Authentication'; $string['allday'] = 'All day'; $string['codecontent'] = 'Content'; $string['config_geolocation_br'] = 'Format and permissible values'; @@ -32,8 +32,9 @@ $string['config_geolocation_lng_help'] = 'The value for the longitude is limited to ±180. The entry is made as a decimal degree with a decimal point. Example: 10.49184'; $string['config_link_label'] = 'Location link'; $string['config_size_label'] = 'Size of the qr code'; -$string['config_wlanssidoptions'] = 'hidden'; +$string['config_wifissidoptions'] = 'hidden'; $string['courseurl'] = 'Link to this course'; +$string['courseurldesc'] = 'description'; $string['courseurldesc_help'] = 'For example, the course name or the enrolment key can be entered here.'; $string['courseurldesc_label'] = 'Description'; $string['currenturl'] = 'Link to the current page'; @@ -77,7 +78,8 @@ $string['urlparameterafter'] = 'URL parameters after'; $string['urlparameterbefore'] = 'URL parameters before'; $string['urlshortlabel'] = 'Create short link'; -$string['wlan'] = 'WiFi'; +$string['wifi'] = 'WiFi'; +$string['wifi_passkey'] = "handling passwords"; $string['wep'] = 'WEP'; $string['wpa'] = 'WPA/WPA2'; -$string['wlan_passkey_help'] = 'Do not publish passwords for private WiFi networks!'; +$string['wifi_passkey_help'] = 'Do not publish passwords for private WiFi networks!'; diff --git a/templates/qr.mustache b/templates/qr.mustache index 717e735..6902d57 100644 --- a/templates/qr.mustache +++ b/templates/qr.mustache @@ -87,20 +87,20 @@

{{/geocoordinates}} -{{#wlanssid}} +{{#wifissid}}

{{#str}} ssid_label, block_qr - {{/str}}: {{{wlanssid}}}
+ {{/str}}: {{{wifissid}}}
{{#str}} - config_wlanauthentication, block_qr - {{/str}}: {{{wlanauthentication}}}
+ config_wifiauthentication, block_qr + {{/str}}: {{{wifiauthentication}}}
{{#str}} passkey_label, block_qr - {{/str}}: {{{wlanpasskey}}}
+ {{/str}}: {{{wifipasskey}}}

-{{/wlanssid}} +{{/wifissid}} {{#fullview}} From abc244b5c90305abc29a22598631e4b67f076ea9 Mon Sep 17 00:00:00 2001 From: Florian Dagner Date: Mon, 19 Feb 2024 08:41:03 +0100 Subject: [PATCH 3/5] Encrypted WLAN set as standard --- edit_form.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/edit_form.php b/edit_form.php index 39fed96..d6bf675 100644 --- a/edit_form.php +++ b/edit_form.php @@ -199,9 +199,10 @@ protected function specific_definition($mform) { $mform->hideIf('config_wifipasskey', 'config_options', 'neq', 'wifi'); $mform->setType('config_wifipasskey', PARAM_NOTAGS); $authenticationoptions = [ - 'nopass' => get_string('none', 'block_qr'), - 'WEP' => get_string('wep', 'block_qr'), 'WPA/WPA2' => get_string('wpa', 'block_qr'), + 'WEP' => get_string('wep', 'block_qr'), + 'nopass' => get_string('none', 'block_qr'), + ]; $mform->addElement( 'select', From 8bbed2a03cbe89545511c3c75130c50f692f52c1 Mon Sep 17 00:00:00 2001 From: Florian Dagner Date: Mon, 19 Feb 2024 08:50:32 +0100 Subject: [PATCH 4/5] MBS-8543: Syntax and alphabetical sorting checked --- edit_form.php | 2 +- lang/de/block_qr.php | 4 ++-- lang/en/block_qr.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/edit_form.php b/edit_form.php index d6bf675..d94f7e1 100644 --- a/edit_form.php +++ b/edit_form.php @@ -83,7 +83,7 @@ protected function specific_definition($mform) { 'owncontent' => get_string('owncontent', 'block_qr'), 'event' => get_string('event', 'block_qr'), 'geolocation' => get_string('geolocation', 'block_qr'), - 'wifi' => get_string('wifi', 'block_qr') + 'wifi' => get_string('wifi', 'block_qr'), ]; $courseid = $this->page->course->id; if ($courseid == SITEID) { diff --git a/lang/de/block_qr.php b/lang/de/block_qr.php index 18238e1..aadaa0a 100644 --- a/lang/de/block_qr.php +++ b/lang/de/block_qr.php @@ -23,7 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['config_wifiauthentication'] = 'Authentifizierung'; $string['allday'] = 'Ganztägig'; $string['codecontent'] = 'Inhalt'; $string['config_geolocation_br'] = 'Format and zulässige Werte'; @@ -32,6 +31,7 @@ $string['config_geolocation_lng_help'] = 'Der Wert für den Längengrad ist auf ±180 begrenzt. Die Eingabe erfolgt als Dezimalgrad mit einem Dezimalpunkt. Beispiel: 10.49184'; $string['config_link_label'] = 'Link zum Standort'; $string['config_size_label'] = 'Größe des QR-Codes'; +$string['config_wifiauthentication'] = 'Authentifizierung'; $string['config_wifissidoptions'] = 'versteckt'; $string['courseurl'] = 'Link zu diesem Kurs'; $string['courseurldesc'] = 'Beschreibung'; @@ -80,6 +80,6 @@ $string['urlshortlabel'] = 'Kurzlink erstellen'; $string['wifi'] = 'WLAN'; $string['wifi_passkey'] = "Umgang mit Passwörtern"; +$string['wifi_passkey_help'] = 'Veröffentlichen Sie keine Passwörter privater WLAN-Netzwerke!'; $string['wep'] = 'WEP'; $string['wpa'] = 'WPA/WPA2'; -$string['wifi_passkey_help'] = 'Veröffentlichen Sie keine Passwörter privater WLAN-Netzwerke!'; diff --git a/lang/en/block_qr.php b/lang/en/block_qr.php index 21ba7b0..df8fc9b 100644 --- a/lang/en/block_qr.php +++ b/lang/en/block_qr.php @@ -23,7 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['config_wifiauthentication'] = 'Authentication'; $string['allday'] = 'All day'; $string['codecontent'] = 'Content'; $string['config_geolocation_br'] = 'Format and permissible values'; @@ -32,6 +31,7 @@ $string['config_geolocation_lng_help'] = 'The value for the longitude is limited to ±180. The entry is made as a decimal degree with a decimal point. Example: 10.49184'; $string['config_link_label'] = 'Location link'; $string['config_size_label'] = 'Size of the qr code'; +$string['config_wifiauthentication'] = 'Authentication'; $string['config_wifissidoptions'] = 'hidden'; $string['courseurl'] = 'Link to this course'; $string['courseurldesc'] = 'description'; @@ -80,6 +80,6 @@ $string['urlshortlabel'] = 'Create short link'; $string['wifi'] = 'WiFi'; $string['wifi_passkey'] = "handling passwords"; +$string['wifi_passkey_help'] = 'Do not publish passwords for private WiFi networks!'; $string['wep'] = 'WEP'; $string['wpa'] = 'WPA/WPA2'; -$string['wifi_passkey_help'] = 'Do not publish passwords for private WiFi networks!'; From 53c0f3053b3c0df5707962a15b461406f353898d Mon Sep 17 00:00:00 2001 From: Florian Dagner Date: Mon, 11 Mar 2024 09:42:38 +0100 Subject: [PATCH 5/5] Missing declaring of variables added. Check that is not null when the urlencode() function is called. --- block_qr.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block_qr.php b/block_qr.php index 33b7294..2c25ba6 100644 --- a/block_qr.php +++ b/block_qr.php @@ -99,6 +99,9 @@ public function get_content() { $calendarend = null; $fullview = false; $svgsize = null; + $wifiauthentication = null; + $wifissid = null; + $wifipasskey = null; switch ($this->config->options) { case 'currenturl': @@ -257,8 +260,12 @@ public function get_content() { if (empty($configshortlink)) { $urlshort = null; } else { - $encodedqrcodelink = urlencode($qrcodelink); - $urlshort = str_replace('SHORTLINK', $encodedqrcodelink, $configshortlink); + if ($qrcodelink !== null) { + $encodedqrcodelink = urlencode($qrcodelink); + $urlshort = str_replace('SHORTLINK', $encodedqrcodelink, $configshortlink); + } else { + $urlshort = null; + } } // Size of QR code.