[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] File Galleries: Resolve multiple PHP Warning and Fatal error

"Adrien Mbuya Maloba \(@adrienmaloba\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <689f75666bfd6_2c18a73d869155@gitlab-sidekiq-low-urgency-cpu-bound-v2-558bd76c46-d57tm.mail>

Adrien Mbuya Maloba pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
2386d9e7 by Adrien Mbuya Maloba at 2025-08-15T20:50:42+03:00
[BP][FIX] File Galleries: Resolve multiple PHP Warning and Fatal error
---
* [FIX] File Galleries: Resolve multiple PHP Warning and Fatal error

See merge request tikiwiki/tiki!8305

- - - - -


4 changed files:

- lib/core/Maintenance/Maintenance.php
- lib/core/Tiki/Log.php
- lib/mail/maillib.php
- lib/setup/javascript.php


Changes:

=====================================
lib/core/Maintenance/Maintenance.php
=====================================
@@ -40,7 +40,7 @@ class Maintenance
         global $prefs;
 
         if (
-            $prefs['maintenanceRecurrentEnable'] === 'y'
+            ! empty($prefs['maintenanceRecurrentEnable']) && $prefs['maintenanceRecurrentEnable'] === 'y'
             && ! empty($prefs['maintenanceRecurrentStartTime'])
             && preg_match('/^(?:2[0-3]|[01][0-9]):[0-5][0-9]$/', $prefs['maintenanceRecurrentStartTime'])
             && ! empty($prefs['maintenanceRecurrentDuration'])
@@ -60,7 +60,7 @@ class Maintenance
         global $prefs;
 
         if (
-            $prefs['maintenanceOnceOffEnable'] === 'y'
+            ! empty($prefs['maintenanceOnceOffEnable']) && $prefs['maintenanceOnceOffEnable'] === 'y'
             && ! empty($prefs['maintenanceOnceOffStartDate'])
             && preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $prefs['maintenanceOnceOffStartDate'])
             && ! empty($prefs['maintenanceOnceOffStartTime'])
@@ -122,7 +122,7 @@ class Maintenance
         global $prefs;
 
         if (
-            $prefs['maintenanceRecurrentEnable'] === 'y'
+            ! empty($prefs['maintenanceRecurrentEnable']) && $prefs['maintenanceRecurrentEnable'] === 'y'
             && ! empty($prefs['maintenanceRecurrentStartTime'])
             && preg_match('/^(?:2[0-3]|[01][0-9]):[0-5][0-9]$/', $prefs['maintenanceRecurrentStartTime'])
             && ! empty($prefs['maintenanceTimeBeforeDisplayMessage'])
@@ -143,7 +143,7 @@ class Maintenance
         global $prefs;
 
         if (
-            $prefs['maintenanceOnceOffEnable'] === 'y'
+            ! empty($prefs['maintenanceOnceOffEnable']) && $prefs['maintenanceOnceOffEnable'] === 'y'
             && ! empty($prefs['maintenanceOnceOffStartDate'])
             && preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])$/', $prefs['maintenanceOnceOffStartDate'])
             && ! empty($prefs['maintenanceOnceOffStartTime'])


=====================================
lib/core/Tiki/Log.php
=====================================
@@ -79,7 +79,7 @@ class Tiki_Log extends AbstractLogger
         $this->level = $level;
     }
 
-    public function log($level, $message, array $context = [])
+    public function log($level, $message, array $context = []): void
     {
         if (self::$levels[$level] < self::$levels[$this->level]) {
             //Do not log


=====================================
lib/mail/maillib.php
=====================================
@@ -49,15 +49,15 @@ function tiki_mail_setup()
     global $tiki_maillib__mailer_default_transport;
     global $prefs;
     $dns = "sendmail://default";
-    if ($prefs['mailer_handler'] === 'amazonSes') {
+    if (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'amazonSes') {
         $key = $prefs['mailer_amazon_ses_key'];
         $secret = $prefs['mailer_amazon_ses_secret'];
         $region = $prefs['mailer_amazon_ses_region'];
         $dns = "ses+api://$key:$secret@default?region=$region";
-    } elseif ($prefs['mailer_handler'] === 'elasticEmail') { // https://github.com/bertoost/ElasticEmail-Mailer
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'elasticEmail') { // https://github.com/bertoost/ElasticEmail-Mailer
         $apiKey = $prefs['mailer_elastic_email_key'];
         $dns = "elasticemail+api://$apiKey@default";
-    } elseif ($prefs['mailer_handler'] === 'mailgun') {
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'mailgun') {
 //        Do not use Api key from mailgun. Instead, go to
 //        Sending -> Domain -> Sending key and create key there.
 //        That is the "API key" for establishing connection.
@@ -65,21 +65,21 @@ function tiki_mail_setup()
         $domain = $prefs['mailer_mailgun_domain'];
         $region = $prefs['mailer_mailgun_region'];
         $dns = "mailgun+api://$key:$domain@default?region=$region";
-    } elseif ($prefs['mailer_handler'] === 'mandrill') {
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'mandrill') {
         $key = $prefs['mailer_mandrill_key'];
         $dns = "mandrill+api://$key@default";
-    } elseif ($prefs['mailer_handler'] === 'postmark') {
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'postmark') {
         $key = $prefs['mailer_postmark_key'];
         $dns = "postmark+api://$key@default";
-    } elseif ($prefs['mailer_handler'] === 'sendGrid') {
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'sendGrid') {
         $key = $prefs['mailer_send_grid_key'];
         $region = $prefs['mailer_send_grid_region'];
         $dns = "sendgrid+api://$key@default?region=$region";
-    } elseif ($prefs['mailer_handler'] === 'sparkPost') { // https://github.com/gam6itko/sparkpost-mailer
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'sparkPost') { // https://github.com/gam6itko/sparkpost-mailer
         $key = $prefs['mailer_spark_post_key'];
         $region = $prefs['mailer_spark_region'];
         $dns = "sparkpost+api://$key@default?region=$region";
-    } elseif ($prefs['mailer_handler'] === 'smtp') {
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'smtp') {
         $host = $prefs['mailer_smtp_server'] ?? 'localhost';
         $port = $prefs['mailer_smtp_port'] ?? 25;
         $username = $prefs['mailer_smtp_user'];
@@ -110,9 +110,9 @@ function tiki_mail_setup()
         if (! empty($queryParameters)) {
             $dns .= "?" . implode("&", $queryParameters);
         }
-    } elseif ($prefs['mailer_handler'] === 'sendmail' && ! empty($prefs['sender_email'])) {
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'sendmail' && ! empty($prefs['sender_email'])) {
         $dns = "sendmail://default?command=" . urlencode('-f' . $prefs['sender_email']);
-    } elseif ($prefs['mailer_handler'] === 'file') {
+    } elseif (! empty($prefs['mailer_handler']) && $prefs['mailer_handler'] === 'file') {
         $mail_debug_path = TIKI_PATH . '/' . TEMP_MAIL_DEBUG ;
         if (! file_exists($mail_debug_path)) {
             // is the parent temp dir group writable?


=====================================
lib/setup/javascript.php
=====================================
@@ -304,7 +304,7 @@ var syntaxHighlighter = {
 EOT;
 }
 
-if (in_array('y', [$prefs['feature_draggable_modals'], $prefs['feature_resizable_modals']])) {
+if (in_array('y', [$prefs['feature_draggable_modals'], ! empty($prefs['feature_resizable_modals']) ? $prefs['feature_resizable_modals'] : 'n'])) {
     $headerlib->add_jsfile(NODE_PUBLIC_DIST_PATH . '/interactjs/dist/interact.min.js');
 }
 
@@ -332,7 +332,7 @@ EOT;
     $headerlib->add_css('.modal-header {cursor: grab}');
 }
 
-if ($prefs['feature_resizable_modals'] === 'y') {
+if (! empty($prefs['feature_resizable_modals']) && $prefs['feature_resizable_modals'] === 'y') {
     $js .= <<< 'EOT'
 $(document).on("tiki.modal.redraw", function(event) {
     let $modalContent = $(event.target);



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2386d9e7014fd29be54488af0255a069edd21d6e

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2386d9e7014fd29be54488af0255a069edd21d6e
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.