Issues (299)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

open_category.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
/**
4
 * Module: SmartFAQ
5
 * Author: The SmartFactory <www.smartfactory.ca>
6
 * Licence: GNU
7
 */
8
9
use Xmf\Request;
10
use XoopsModules\Smartfaq;
11
use XoopsModules\Smartfaq\Constants;
12
use XoopsModules\Smartfaq\Helper;
13
14
$GLOBALS['xoopsOption']['template_main'] = 'smartfaq_category.tpl';
15
16
require_once __DIR__ . '/header.php';
17
18
/** @var Smartfaq\Helper $helper */
19
$helper = Helper::getInstance();
20
21
global $xoopsConfig, $xoopsModule;
22
23
require_once XOOPS_ROOT_PATH . '/header.php';
24
require_once __DIR__ . '/footer.php';
25
26
$categoryid = Request::getInt('categoryid', 0, 'GET');
27
28
// Creating the category object for the selected category
29
$categoryObj = new Smartfaq\Category($categoryid);
30
31
// If the selected category was not found, exit
32
if ($categoryObj->notLoaded()) {
33
    redirect_header('<script>javascript:history.go(-1)</script>', 1, _MD_SF_NOCATEGORYSELECTED);
34
}
35
36
// Check user permissions to access this category
37
if (!$categoryObj->checkPermission()) {
38
    redirect_header('<script>javascript:history.go(-1)</script>', 1, _NOPERM);
39
}
40
41
// Creating the category handler object
42
/** @var \XoopsModules\Smartfaq\CategoryHandler $categoryHandler */
43
$categoryHandler = Helper::getInstance()->getHandler('Category');
44
45
// At which record shall we start
46
$start = Request::getInt('start', 0, 'GET');
47
48
// Creating the faq handler object
49
/** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */
50
$faqHandler = Helper::getInstance()->getHandler('Faq');
51
52
// creating the FAQ objects that belong to the selected category
53
$faqsObj = $faqHandler->getFaqs($helper->getConfig('indexperpage'), $start, Constants::SF_STATUS_OPENED, $categoryid);
54
55
$totalQnasOnPage = 0;
56
if ($faqsObj) {
57
    $totalQnasOnPage = count($faqsObj);
58
}
59
60
// If there is no Q&As to display, exit
61
/*if ($totalQnasOnPage == 0) {
62
    redirect_header("javascript:history.go(-1)", 2, _AM_SF_NO_TOP_PERMISSIONS);
63
}*/
64
65
// Arrays that will hold the information passed on to smarty variables
66
$category    = [];
67
$qnas        = [];
68
$last_qnaObj = $faqHandler->getLastPublishedByCat([Constants::SF_STATUS_OPENED]);
69
if (isset($last_qnaObj[$categoryid])) {
70
    $categoryObj->setVar('last_faqid', $last_qnaObj[$categoryid]->getVar('faqid'));
71
    $categoryObj->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$categoryid]->getVar('faqid') . "'>" . $last_qnaObj[$categoryid]->question(50) . '</a>');
72
}
73
// Populating the smarty variables with information related to the selected category
74
$category                 = $categoryObj->toArray(null, true);
75
$totalQnas                = $categoryHandler->faqsCount(0, [Constants::SF_STATUS_OPENED]);
0 ignored issues
show
array(XoopsModules\Smart...ants::SF_STATUS_OPENED) of type array<integer,integer> is incompatible with the type string expected by parameter $status of XoopsModules\Smartfaq\CategoryHandler::faqsCount(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

75
$totalQnas                = $categoryHandler->faqsCount(0, /** @scrutinizer ignore-type */ [Constants::SF_STATUS_OPENED]);
Loading history...
76
$category['categoryPath'] = $categoryObj->getCategoryPath(false, true);
77
78
// Creating the sub-categories objects that belong to the selected category
79
$subcatsObj     = &$categoryHandler->getCategories(0, 0, $categoryid);
80
$total_subcats  = count($subcatsObj);
81
$catQnasWithSub = 0;
82
if (0 != $total_subcats) {
83
    $faqHandler = Helper::getInstance()->getHandler('Faq');
84
    // Arrays that will hold the information passed on to smarty variables
85
    foreach ($subcatsObj as $key => $subcat) {
86
        $subcat_id = $subcat->getVar('categoryid');
87
        if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
88
            if (isset($last_qnaObj[$subcat_id])) {
89
                $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
90
                $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . '</a>');
91
            }
92
            $subcat->setVar('faqcount', $totalQnas[$subcat_id]);
93
            $subcats[$subcat_id] = $subcat->toArray(null, true);
94
            $catQnasWithSub      += $subcats[$subcat_id]['total'];
95
        }
96
    }
97
    $xoopsTpl->assign('subcats', $subcats);
98
}
99
$category['total'] = $catQnasWithSub + $totalQnas[$categoryid];
100
if ($faqsObj) {
101
    $userids = [];
102
    foreach ($faqsObj as $key => $thisfaq) {
103
        $faqids[]                 = $thisfaq->getVar('faqid');
104
        $userids[$thisfaq->uid()] = 1;
105
    }
106
107
    /** @var \XoopsMemberHandler $memberHandler */
108
    $memberHandler = xoops_getHandler('member');
109
    $users         = $memberHandler->getUsers(new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true);
110
    foreach ($faqsObj as $iValue) {
111
        $faq = $iValue->toArray(null, $allcategories);
112
113
        $faq['adminlink'] = Smartfaq\Utility::getAdminLinks($iValue->faqid(), true);
114
115
        $faq['who_when'] = $iValue->getWhoAndWhen(null, $users);
116
117
        $xoopsTpl->append('faqs', $faq);
118
    }
119
}
120
// Language constants
121
$xoopsTpl->assign('whereInSection', htmlspecialchars($xoopsModule->getVar('name'), ENT_QUOTES | ENT_HTML5) . " > <a href='open_index.php'>" . _MD_SF_OPEN_SECTION . '</a>');
122
$xoopsTpl->assign('modulename', $xoopsModule->dirname());
123
124
$xoopsTpl->assign('displaylastfaqs', true);
125
$xoopsTpl->assign('display_categoryname', false);
126
127
$xoopsTpl->assign('lang_reads', _MD_SF_READS);
128
$xoopsTpl->assign('lang_home', _MD_SF_HOME);
129
$xoopsTpl->assign('lang_smartfaqs_info', _MD_SF_OPENED_INFO);
130
$xoopsTpl->assign('lang_smartfaqs', _MD_SF_QUESTIONS);
131
$xoopsTpl->assign('lang_cat_title', _MD_SF_OPENED_QUESTIONS);
132
$xoopsTpl->assign('lang_subcat_title', _MD_SF_CATEGORY_SUMMARY);
133
$xoopsTpl->assign('lang_category_summary', _MD_SF_CATEGORY_SUMMARY);
134
$xoopsTpl->assign('lang_category_summary_info', _MD_SF_CATEGORY_SUMMARY_INFO);
135
$xoopsTpl->assign('lang_category', _MD_SF_CATEGORY);
136
137
// The Navigation Bar
138
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
139
$pagenav = new \XoopsPageNav($totalQnas[$categoryid], $helper->getConfig('indexperpage'), $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid'));
140
if (1 == $helper->getConfig('useimagenavpage')) {
141
    $category['navbar'] = '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>';
142
} else {
143
    $category['navbar'] = '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
144
}
145
146
$xoopsTpl->assign('category', $category);
147
148
// Page Title Hack by marcan
149
$module_name = htmlspecialchars($xoopsModule->getVar('name'), ENT_QUOTES | ENT_HTML5);
150
$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category['name']);
151
// End Page Title Hack by marcan
152
153
require_once XOOPS_ROOT_PATH . '/footer.php';
154