[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] Ensure customTip and customTipTitle are not empty before assignment

"UshindiG \(@GedeonTS\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <696fda25b22fd_2c24854342542f@gitlab-sidekiq-low-urgency-cpu-bound-v2-6787bc4f54-trgzh.mail>

UshindiG pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
5cf54a30 by UshindiG at 2026-01-20T21:32:10+02:00
[BP][FIX] Ensure customTip and customTipTitle are not empty before assignment
---
* [FIX] Ensure customTip and customTipTitle are not empty before assignment
---
* [ENH] Refactor customTip handling: centralize assignment logic in EditLib

* [FIX] Ensure customTip and customTipTitle are not empty before assignment

See merge request tikiwiki/tiki!9355

(cherry picked from commit 6d5cb166efa81d25006c952c07b1e0d9d970d630)

See merge request tikiwiki/tiki!9379

- - - - -


3 changed files:

- lib/wiki/editlib.php
- modules/mod-func-quick_edit.php
- tiki-editpage.php


Changes:

=====================================
lib/wiki/editlib.php
=====================================
@@ -87,6 +87,27 @@ class EditLib
         return true;
     }
 
+    /**
+     * Assigns custom tip message to Smarty template variables for display in remarksbox alert
+     *
+     * @param string $customTip The tip content to display in the alert box
+     * @param string $customTipTitle Optional title for the alert box (defaults to 'Tip')
+     * @return void
+     */
+    public function assignCustomTipToSmarty(string $customTip, string $customTipTitle = ''): void
+    {
+        if (trim($customTip) !== '') {
+            $smarty = TikiLib::lib('smarty');
+            $smarty->assign('customTip', $customTip);
+
+            if (trim($customTipTitle) !== '') {
+                $smarty->assign('customTipTitle', $customTipTitle);
+            } else {
+                $smarty->assign('customTipTitle', tr('Tip'));
+            }
+        }
+    }
+
     // translation functions
 
     public function isTranslationMode()


=====================================
modules/mod-func-quick_edit.php
=====================================
@@ -106,17 +106,8 @@ function module_quick_edit($mod_reference, $module_params)
         $addcategId = '';
     }
 
-    if (isset($module_params['customTip'])) {
-        $customTip = $module_params['customTip'];
-    } else {
-        $customTip = '';
-    }
-
-    if (isset($module_params['customTipTitle'])) {
-        $customTipTitle = $module_params['customTipTitle'];
-    } else {
-        $customTipTitle = '';
-    }
+    $editlib = TikiLib::lib('edit');
+    $editlib->assignCustomTipToSmarty($module_params['customTip'] ?? '', $module_params['customTipTitle'] ?? '');
 
     if (isset($module_params['headerwiki'])) {
         $wikiHeaderTpl = $module_params['headerwiki'];
@@ -125,8 +116,6 @@ function module_quick_edit($mod_reference, $module_params)
     }
 
     $smarty->assign('wikiHeaderTpl', $wikiHeaderTpl);
-    $smarty->assign('customTip', $customTip);
-    $smarty->assign('customTipTitle', $customTipTitle);
     $smarty->assign('addcategId', $addcategId);
     $smarty->assign('size', $size);
     $smarty->assign('mod_quickedit_heading', $mod_quickedit_heading);


=====================================
tiki-editpage.php
=====================================
@@ -729,13 +729,8 @@ if ($prefs['feature_wiki_footnotes'] === 'y') {
         }
     }
 }
-if (isset($_REQUEST["customTip"]) && ! isset($_REQUEST['preview']) && ! isset($_REQUEST['save'])) {
-    $smarty->assign('customTip', $_REQUEST['customTip']);
-    if (isset($_REQUEST["customTipTitle"])) {
-        $smarty->assign('customTipTitle', tra($_REQUEST["customTipTitle"]));
-    } else {
-        $smarty->assign('customTipTitle', tra('Tip'));
-    }
+if (! isset($_REQUEST['preview']) && ! isset($_REQUEST['save'])) {
+    $editlib->assignCustomTipToSmarty($_REQUEST["customTip"] ?? '', $_REQUEST["customTipTitle"] ?? '');
 }
 if (isset($_REQUEST["wikiHeaderTpl"]) && ! isset($_REQUEST['preview']) && ! isset($_REQUEST['save'])) {
     $smarty->assign('wikiHeaderTpl', $smarty->fetch("wiki:{$_REQUEST['wikiHeaderTpl']}"));



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5cf54a30233c1b989bd81dc020738d229071fdcf

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5cf54a30233c1b989bd81dc020738d229071fdcf
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.