[TikiWiki-commits] [Git][tikiwiki/tiki][24.x] [FIX] Update input configuration and request handling for rankings

"Espoir Baraka \(@esbarakabigega\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a84264b17e16_38175bd8055751@gitlab-sidekiq-low-urgency-cpu-bound-v2-b96b6f55-wdfjz.mail>

Espoir Baraka pushed to branch 24.x at Tiki Wiki CMS Groupware / Tiki


Commits:
409bfd8f by Espoir Baraka at 2026-08-18T11:24:30+02:00
[FIX] Update input configuration and request handling for rankings
---
* [FIX] Update input configuration and request handling for rankings
---
* [FIX] Update input configuration and request handling for rankings
---
* [FIX] Update input configuration and request handling for rankings
---
* [FIX] Update input configuration and request handling for rankings
---
* [FIX] Update input configuration and request handling for rankings

(cherry picked from commit c42c84e3a29765160717a959c34308526aa9790c)

See merge request tikiwiki/tiki!10910

(cherry picked from commit bfd07ec79412a91d811f90293f2896dd9b24b1ed)

See merge request tikiwiki/tiki!10915

(cherry picked from commit 0a71cf007fa5bbd48709514ffa95d169da349bf1)

See merge request tikiwiki/tiki!10930

(cherry picked from commit 42ae26708f154036238b36412844a8b8bc49d0cd)

See merge request tikiwiki/tiki!10935

(cherry picked from commit 5f28be70fb29c26e98417e28f8da563399d51e7d)

See merge request tikiwiki/tiki!10940

- - - - -


5 changed files:

- tiki-blog_rankings.php
- tiki-cms_rankings.php
- tiki-file_galleries_rankings.php
- tiki-forum_rankings.php
- tiki-wiki_rankings.php


Changes:

=====================================
tiki-blog_rankings.php
=====================================
@@ -11,6 +11,14 @@
 // $Id$
 
 $section = 'blogs';
+$inputConfiguration = [
+    [
+        'staticKeyFilters'                => [
+            'which'                    => 'word',                //post
+            'limit'                    => 'digits',              //post
+        ],
+    ]
+];
 require_once('tiki-setup.php');
 include_once('lib/rankings/ranklib.php');
 $access->check_feature(['feature_blogs', 'feature_blog_rankings']);
@@ -31,17 +39,18 @@ $allrankings = [
     ]
 ];
 $smarty->assign('allrankings', $allrankings);
-if (! isset($_REQUEST["which"])) {
-    $which = 'blog_ranking_top_blogs';
+$allowedRankings = array_column($allrankings, 'value');
+$defaultWhich = 'blog_ranking_top_blogs';
+if (! isset($_REQUEST["which"]) || ! in_array($_REQUEST["which"], $allowedRankings, true)) {
+    $which = $defaultWhich;
 } else {
     $which = $_REQUEST["which"];
 }
 $smarty->assign('which', $which);
 // Get the page from the request var or default it to HomePage
-if (! isset($_REQUEST["limit"])) {
+$limit = isset($_REQUEST["limit"]) ? (int) $_REQUEST["limit"] : 10;
+if ($limit < 1) {
     $limit = 10;
-} else {
-    $limit = $_REQUEST["limit"];
 }
 $smarty->assign_by_ref('limit', $limit);
 // Rankings:


=====================================
tiki-cms_rankings.php
=====================================
@@ -11,6 +11,14 @@
 // $Id$
 
 $section = 'cms';
+$inputConfiguration = [
+    [
+        'staticKeyFilters'                => [
+            'which'                       => 'word',     //post
+            'limit'                       => 'digits',   //post
+        ],
+    ],
+];
 require_once('tiki-setup.php');
 include_once('lib/rankings/ranklib.php');
 $access->check_feature(['feature_articles', 'feature_cms_rankings']);
@@ -29,8 +37,10 @@ $allrankings = [
 
 $smarty->assign('allrankings', $allrankings);
 
-if (! isset($_REQUEST["which"])) {
-    $which = 'cms_ranking_top_articles';
+$allowedRankings = array_column($allrankings, 'value');
+$defaultWhich = 'cms_ranking_top_articles';
+if (! isset($_REQUEST["which"]) || ! in_array($_REQUEST["which"], $allowedRankings, true)) {
+    $which = $defaultWhich;
 } else {
     $which = $_REQUEST["which"];
 }
@@ -38,10 +48,9 @@ if (! isset($_REQUEST["which"])) {
 $smarty->assign('which', $which);
 
 // Get the page from the request var or default it to HomePage
-if (! isset($_REQUEST["limit"])) {
+$limit = isset($_REQUEST["limit"]) ? (int) $_REQUEST["limit"] : 10;
+if ($limit < 1) {
     $limit = 10;
-} else {
-    $limit = $_REQUEST["limit"];
 }
 
 $smarty->assign_by_ref('limit', $limit);


=====================================
tiki-file_galleries_rankings.php
=====================================
@@ -38,8 +38,10 @@ $allrankings = [
 
 $smarty->assign('allrankings', $allrankings);
 
-if (! isset($_REQUEST["which"])) {
-    $which = 'filegal_ranking_top_files';
+$allowedRankings = array_column($allrankings, 'value');
+$defaultWhich = 'filegal_ranking_top_files';
+if (! isset($_REQUEST["which"]) || ! in_array($_REQUEST["which"], $allowedRankings, true)) {
+    $which = $defaultWhich;
 } else {
     $which = $_REQUEST["which"];
 }
@@ -47,10 +49,9 @@ if (! isset($_REQUEST["which"])) {
 $smarty->assign('which', $which);
 
 // Get the page from the request var or default it to HomePage
-if (! isset($_REQUEST["limit"])) {
+$limit = isset($_REQUEST["limit"]) ? (int) $_REQUEST["limit"] : 10;
+if ($limit < 1) {
     $limit = 10;
-} else {
-    $limit = $_REQUEST["limit"];
 }
 
 $smarty->assign_by_ref('limit', $limit);


=====================================
tiki-forum_rankings.php
=====================================
@@ -48,8 +48,10 @@ $allrankings = [
 
 $smarty->assign('allrankings', $allrankings);
 
-if (! isset($_REQUEST["which"])) {
-    $which = 'forums_ranking_last_topics';
+$allowedRankings = array_column($allrankings, 'value');
+$defaultWhich = 'forums_ranking_last_topics';
+if (! isset($_REQUEST["which"]) || ! in_array($_REQUEST["which"], $allowedRankings, true)) {
+    $which = $defaultWhich;
 } else {
     $which = $_REQUEST["which"];
 }
@@ -57,10 +59,9 @@ if (! isset($_REQUEST["which"])) {
 $smarty->assign('which', $which);
 
 // Get the page from the request var or default it to HomePage
-if (! isset($_REQUEST["limit"])) {
+$limit = isset($_REQUEST["limit"]) ? (int) $_REQUEST["limit"] : 10;
+if ($limit < 1) {
     $limit = 10;
-} else {
-    $limit = $_REQUEST["limit"];
 }
 
 $smarty->assign_by_ref('limit', $limit);


=====================================
tiki-wiki_rankings.php
=====================================
@@ -12,6 +12,15 @@
 
 $section = 'wiki page';
 $section_class = "tiki_wiki_page manage";   // This will be body class instead of $section
+$inputConfiguration = [
+    [
+        'staticKeyFilters'                => [
+            'which'                     => 'word',              //post
+            'limit'                     => 'digits',            //post
+            'categId'                   => 'striptags',         //get
+        ],
+    ],
+];
 require_once('tiki-setup.php');
 
 include_once('lib/rankings/ranklib.php');
@@ -19,10 +28,9 @@ include_once('lib/rankings/ranklib.php');
 $access->check_feature(['feature_wiki', 'feature_wiki_rankings']);
 $access->check_permission('tiki_p_view');
 
-if (! isset($_REQUEST["limit"])) {
+$limit = isset($_REQUEST["limit"]) ? (int) $_REQUEST["limit"] : 10;
+if ($limit < 1) {
     $limit = 10;
-} else {
-    $limit = $_REQUEST["limit"];
 }
 
 $categs = [];
@@ -58,8 +66,10 @@ $allrankings = [
 
 $smarty->assign('allrankings', $allrankings);
 
-if (! isset($_REQUEST["which"])) {
-    $which = 'wiki_ranking_top_pages';
+$allowedRankings = array_column($allrankings, 'value');
+$defaultWhich = 'wiki_ranking_top_pages';
+if (! isset($_REQUEST["which"]) || ! in_array($_REQUEST["which"], $allowedRankings, true)) {
+    $which = $defaultWhich;
 } else {
     $which = $_REQUEST["which"];
 }



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

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