Issues (964)

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.

testdata/mymodule3/include/search.inc.php (1 issue)

Labels
Severity
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * My Module 3 module for xoops
14
 *
15
 * @copyright     2020 XOOPS Project (https://xooops.org)
16
 * @license        GPL 2.0 or later
17
 * @package        mymodule3
18
 * @since          1.0
19
 * @min_xoops      2.5.9
20
 * @author         TDM XOOPS - Email:<[email protected]> - Website:<http://xoops.org>
21
 */
22
23
use XoopsModules\Mymodule3;
24
25
26
/**
27
 * search callback functions 
28
 *
29
 * @param $queryarray 
30
 * @param $andor 
31
 * @param $limit 
32
 * @param $offset 
33
 * @param $userid 
34
 * @return mixed $itemIds
35
 */
36
function mymodule3_search($queryarray, $andor, $limit, $offset, $userid)
37
{
38
	$ret = [];
39
	$helper = \XoopsModules\Mymodule3\Helper::getInstance();
40
41
	// search in table articles
42
	// search keywords
43
	$elementCount = 0;
44
	$articlesHandler = $helper->getHandler('articles');
45
	if (is_array($queryarray)) {
46
		$elementCount = count($queryarray);
47
	}
48
	if ($elementCount > 0) {
49
		$criteriaKeywords = new \CriteriaCompo();
50
		for($i = 0; $i  <  $elementCount; $i++) {
51
			$criteriaKeyword = new \CriteriaCompo();
52
			$criteriaKeyword->add( new \Criteria( 'art_cat', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' );
53
			$criteriaKeyword->add( new \Criteria( 'art_title', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' );
54
			$criteriaKeyword->add( new \Criteria( 'art_descr', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' );
55
			$criteriaKeywords->add( $criteriaKeyword, $andor );
56
			unset($criteriaKeyword);
57
		}
58
	}
59
	// search user(s)
60
	if ($userid && is_array($userid)) {
61
		$userid = array_map('intval', $userid);
62
		$criteriaUser = new \CriteriaCompo();
63
		$criteriaUser->add( new \Criteria( 'art_submitter', '(' . implode(',', $userid) . ')', 'IN' ), 'OR' );
64
	} elseif (is_numeric($userid) && $userid > 0) {
65
		$criteriaUser = new \CriteriaCompo();
66
		$criteriaUser->add( new \Criteria( 'art_submitter', $userid ), 'OR' );
67
	}
68
	$criteriaSearch = new \CriteriaCompo();
69
	if (isset($criteriaKeywords)) {
70
		$criteriaSearch->add( $criteriaKeywords, 'AND' );
71
	}
72
	if (isset($criteriaUser)) {
73
		$criteriaSearch->add( $criteriaUser, 'AND' );
74
	}
75
	$criteriaSearch->setStart( $offset );
76
	$criteriaSearch->setLimit( $limit );
77
	$criteriaSearch->setSort( 'art_created' );
78
	$criteriaSearch->setOrder( 'DESC' );
79
	$articlesAll = $articlesHandler->getAll($criteriaSearch);
0 ignored issues
show
The method getAll() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoUserHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

79
	/** @scrutinizer ignore-call */ 
80
 $articlesAll = $articlesHandler->getAll($criteriaSearch);
Loading history...
80
	foreach(array_keys($articlesAll) as $i) {
81
		$ret[] = [
82
			'image'  => 'assets/icons/16/articles.png',
83
			'link'   => 'articles.php?op=show&amp;art_id=' . $articlesAll[$i]->getVar('art_id'),
84
			'title'  => $articlesAll[$i]->getVar('art_title'),
85
			'time'   => $articlesAll[$i]->getVar('art_created')
86
		];
87
	}
88
	unset($criteriaKeywords);
89
	unset($criteriaKeyword);
90
	unset($criteriaUser);
91
	unset($criteriaSearch);
92
93
	// search in table testfields
94
	// search keywords
95
	$elementCount = 0;
96
	$testfieldsHandler = $helper->getHandler('testfields');
97
	if (is_array($queryarray)) {
98
		$elementCount = count($queryarray);
99
	}
100
	if ($elementCount > 0) {
101
		$criteriaKeywords = new \CriteriaCompo();
102
		for($i = 0; $i  <  $elementCount; $i++) {
103
			$criteriaKeyword = new \CriteriaCompo();
104
			$criteriaKeyword->add( new \Criteria( 'tf_text', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' );
105
			$criteriaKeyword->add( new \Criteria( 'tf_textarea', '%' . $queryarray[$i] . '%', 'LIKE' ), 'OR' );
106
			$criteriaKeywords->add( $criteriaKeyword, $andor );
107
			unset($criteriaKeyword);
108
		}
109
	}
110
	// search user(s)
111
	if ($userid && is_array($userid)) {
112
		$userid = array_map('intval', $userid);
113
		$criteriaUser = new \CriteriaCompo();
114
		$criteriaUser->add( new \Criteria( 'tf_submitter', '(' . implode(',', $userid) . ')', 'IN' ), 'OR' );
115
	} elseif (is_numeric($userid) && $userid > 0) {
116
		$criteriaUser = new \CriteriaCompo();
117
		$criteriaUser->add( new \Criteria( 'tf_submitter', $userid ), 'OR' );
118
	}
119
	$criteriaSearch = new \CriteriaCompo();
120
	if (isset($criteriaKeywords)) {
121
		$criteriaSearch->add( $criteriaKeywords, 'AND' );
122
	}
123
	if (isset($criteriaUser)) {
124
		$criteriaSearch->add( $criteriaUser, 'AND' );
125
	}
126
	$criteriaSearch->setStart( $offset );
127
	$criteriaSearch->setLimit( $limit );
128
	$criteriaSearch->setSort( 'tf_datetime' );
129
	$criteriaSearch->setOrder( 'DESC' );
130
	$testfieldsAll = $testfieldsHandler->getAll($criteriaSearch);
131
	foreach(array_keys($testfieldsAll) as $i) {
132
		$ret[] = [
133
			'image'  => 'assets/icons/16/testfields.png',
134
			'link'   => 'testfields.php?op=show&amp;tf_id=' . $testfieldsAll[$i]->getVar('tf_id'),
135
			'title'  => $testfieldsAll[$i]->getVar('tf_text'),
136
			'time'   => $testfieldsAll[$i]->getVar('tf_datetime')
137
		];
138
	}
139
	unset($criteriaKeywords);
140
	unset($criteriaKeyword);
141
	unset($criteriaUser);
142
	unset($criteriaSearch);
143
144
	return $ret;
145
146
}
147