[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] prefixalias: Fix prefix alias where the alias has a non-alpha character...

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a3138195dbe6_3819625c7399@gitlab-sidekiq-low-urgency-cpu-bound-v2-7d87cb8569-f9rvn.mail>

Jonny Bradley pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
ad7bc98b by Jonny Bradley at 2026-06-16T11:48:39+00:00
[FIX] prefixalias: Fix prefix alias where the alias has a non-alpha character...
---
* [FIX] prefixalias: Fix prefix alias where the alias has a non-alpha character separating the page name and the item id, as in "product-42-title-in-slug-format"
Missed in !10253 and !10367 recently

See merge request tikiwiki/tiki!10530


(cherry picked from commit 7bc6093cfac219e44463159fbc7b33bfde3e093f)

9955db9d [FIX] prefixalias: Fix prefix alias where the alias has a non-alpha character...

Co-authored-by: Jonny Bradley <[email protected]>
- - - - -


3 changed files:

- lib/core/Sections.php
- lib/smarty_tiki/Modifier/Sefurl.php
- tiki-index.php


Changes:

=====================================
lib/core/Sections.php
=====================================
@@ -243,6 +243,13 @@ class Sections
                     $k = $request[$info['key']];
                     // when using wiki_url_scheme the page request var is the page slug, not the page/object name
                     if ($prefs['wiki_url_scheme'] !== 'urlencode' && $info['objectType'] === 'wiki page') {
+                        global $jitRequest;
+                        if ($prefs["feature_sefurl_tracker_prefixalias"] == 'y') {
+                            $referencedPages = TikiLib::lib('wiki')->get_pages_by_alias($k);
+                            if ($referencedPages) {
+                                $k = $referencedPages[0];
+                            }
+                        }
                         $k = TikiLib::lib('wiki')->get_page_by_slug($k);
                     }
                 }


=====================================
lib/smarty_tiki/Modifier/Sefurl.php
=====================================
@@ -112,6 +112,11 @@ class Sefurl
                 if ($replacementpage) {
                     $href = \TikiLib::tikiUrlOpt($wikilib->sefurl($replacementpage, $with_next, $all_langs));
                     if ($prefs['feature_sefurl'] === 'y') {
+                        if (preg_match('/' . preg_quote($href) . '[\W]/', $replacementpage)) {
+                            // you can use "product-" with a trailing hyphen, for example, as your alias,
+                            // so the url would be: pagenme-id-title-as-slug
+                            $href = $replacementpage;
+                        }
                         $href .= $source;
                     } else {
                         $href .= "&itemId=$source";


=====================================
tiki-index.php
=====================================
@@ -373,6 +373,8 @@ if (empty($info) && ! ($user && $prefs['feature_wiki_userpage'] == 'y' && strcas
                     $_REQUEST['page'] = $newPage;
                     $_GET['itemId'] = $suffix;  // \ParserLib::parse_wiki_argvariable uses $_GET
                     $_GET['page'] = $newPage;
+                    $jitGet = new JitFilter($_GET);
+                    $jitRequest = new JitFilter($_REQUEST);
                     $smarty->assign('canonical_ending', urlencode(trim(substr($page, strlen($newPage)))));
                     $page = $newPage;
                     $info = $tikilib->get_page_info($_REQUEST['page']);



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ad7bc98b59b19aab01379dd7335fe804f171562d
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
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.