[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] tiki-view_articles.php : Handles invalid/non-existent article type, topic or category

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68cc4c4a860cc_2cdebfc-195@gitlab-sidekiq-low-urgency-cpu-bound-v2-7fccb69b87-gkrxv.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
e58fbe78 by Alain Cisirika at 2025-09-18T17:59:38+00:00
[FIX] tiki-view_articles.php : Handles invalid/non-existent article type, topic or category
---
* [FIX] tiki-view_articles.php : Handles invalid/non-existent article type, topic or category

See merge request tikiwiki/tiki!8176

- - - - -


1 changed file:

- tiki-view_articles.php


Changes:

=====================================
tiki-view_articles.php
=====================================
@@ -31,6 +31,7 @@ $inputConfiguration = [
 ];
 require_once('tiki-setup.php');
 $artlib = TikiLib::lib('art');
+$categlib = TikiLib::lib('categ');
 
 if ($prefs['article_use_new_list_articles'] == 'y') {
     include "lists/articles.php";
@@ -97,23 +98,35 @@ $max_rating = $_REQUEST['max_rating'] ?? '';
 $find = $_REQUEST["find"] ?? '';
 
 $smarty->assign_by_ref('find', $find);
-if (isset($_REQUEST["type"])) {
+if (! empty($_REQUEST["type"])) {
     $type = $_REQUEST["type"];
+    if (empty($artlib->get_type($type))) {
+        Feedback::errorAndDie(tra("Invalid article type or it has been deleted."), \Laminas\Http\Response::STATUS_CODE_400);
+    }
 } else {
     $type = '';
 }
-if (isset($_REQUEST["topic"])) {
+if (! empty($_REQUEST["topic"])) {
     $topic = $_REQUEST["topic"];
+    if (empty($artlib->get_topic($topic))) {
+         Feedback::errorAndDie(tra("Invalid article topic or it has been deleted."), \Laminas\Http\Response::STATUS_CODE_400);
+    }
 } else {
     $topic = '';
 }
-if (isset($_REQUEST['topicName'])) {
+if (! empty($_REQUEST['topicName'])) {
     $topicName = $_REQUEST['topicName'];
+    if (empty($artlib->get_topic($topicName))) {
+        Feedback::errorAndDie(tra("Invalid article topic name or it has been deleted."), \Laminas\Http\Response::STATUS_CODE_400);
+    }
 } else {
     $topicName = '';
 }
-if (isset($_REQUEST["categId"])) {
+if (! empty($_REQUEST["categId"])) {
     $categId = $_REQUEST["categId"];
+    if (empty($categlib->get_category($_REQUEST["categId"]))) {
+        Feedback::errorAndDie(tra("Invalid category or it has been deleted."), \Laminas\Http\Response::STATUS_CODE_400);
+    }
 } else {
     $categId = '';
 }



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

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