[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Ensure customTip and customTipTitle are not empty before assignment
Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <696f127f61b99_2c181c94507fc@gitlab-sidekiq-low-urgency-cpu-bound-v2-bcbfd78cc-6vv6g.mail> |
Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
6d5cb166 by UshindiG at 2026-01-20T05:20:22+00:00
[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
- - - - -
3 changed files:
- lib/wiki/editlib.php
- modules/mod-func-quick_edit.php
- tiki-editpage.php
Changes:
=====================================
lib/wiki/editlib.php
=====================================
@@ -88,6 +88,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/6d5cb166efa81d25006c952c07b1e0d9d970d630
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/6d5cb166efa81d25006c952c07b1e0d9d970d630
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