Issues (201)

Security Analysis    no request data  

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

includes/Admin/Model/Comment.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript\Admin\Model;
3
4
use Redaxscript\Model as BaseModel;
5
6
/**
7
 * parent class to provide the admin comment model
8
 *
9
 * @since 4.0.0
10
 *
11
 * @package Redaxscript
12
 * @category Model
13
 * @author Henry Ruhs
14
 */
15
16
class Comment extends BaseModel\Comment
17
{
18
	/**
19
	 * update the comment by id and array
20
	 *
21
	 * @since 4.0.0
22
	 *
23
	 * @param int $commentId identifier of the comment
24
	 * @param array $updateArray array of the update
25
	 *
26
	 * @return bool
27
	 */
28
29
	public function updateByIdAndArray(int $commentId = null, array $updateArray = []) : bool
30
	{
31
		return $this
32
			->query()
33
			->whereIdIs($commentId)
34
			->findOne()
35
			->set($updateArray)
36
			->save();
37
	}
38
39
	/**
40
	 * publish the comment by id
41
	 *
42
	 * @since 4.0.0
43
	 *
44
	 * @param int $commentId identifier of the comment
45
	 *
46
	 * @return bool
47
	 */
48
49
	public function publishById(int $commentId = null) : bool
50
	{
51
		return $this
52
			->query()
53
			->whereIdIs($commentId)
54
			->findOne()
55
			->set('status', 1)
56
			->save();
57
	}
58
59
	/**
60
	 * publish the comment by category
61
	 *
62
	 * @since 4.0.0
63
	 *
64
	 * @param int $categoryId identifier of the category
65
	 *
66
	 * @return bool
67
	 */
68
69
	public function publishByCategory(int $categoryId = null) : bool
70
	{
71
		$articleModel = new Article();
72
		$articleArray = $articleModel->query()->where('category', $categoryId)->findFlatArray();
73
		return (bool)$this
74
			->query()
75
			->whereIn('article', $articleArray)
76
			->findMany()
77
			->set('status', 1)
78
			->save();
79
	}
80
81
	/**
82
	 * publish the comment by article
83
	 *
84
	 * @since 4.0.0
85
	 *
86
	 * @param int $articleId identifier of the comment
87
	 *
88
	 * @return bool
89
	 */
90
91
	public function publishByArticle(int $articleId = null) : bool
92
	{
93
		return (bool)$this
94
			->query()
95
			->where('article', $articleId)
96
			->findMany()
97
			->set('status', 1)
98
			->save();
99
	}
100
101
	/**
102
	 * unpublish the comment by id
103
	 *
104
	 * @since 4.0.0
105
	 *
106
	 * @param int $commentId identifier of the comment
107
	 *
108
	 * @return bool
109
	 */
110
111
	public function unpublishById(int $commentId = null) : bool
112
	{
113
		return $this
114
			->query()
115
			->whereIdIs($commentId)
116
			->findOne()
117
			->set('status', 0)
118
			->save();
119
	}
120
121
	/**
122
	 * unpublish the comment by category
123
	 *
124
	 * @since 4.0.0
125
	 *
126
	 * @param int $categoryId identifier of the category
127
	 *
128
	 * @return bool
129
	 */
130
131
	public function unpublishByCategory(int $categoryId = null) : bool
132
	{
133
		$articleModel = new Article();
134
		$articleArray = $articleModel->query()->where('category', $categoryId)->findFlatArray();
135
		return (bool)$this
136
			->query()
137
			->whereIn('article', $articleArray)
138
			->findMany()
139
			->set('status', 0)
140
			->save();
141
	}
142
143
	/**
144
	 * unpublish the comment by article
145
	 *
146
	 * @since 4.0.0
147
	 *
148
	 * @param int $articleId identifier of the comment
149
	 *
150
	 * @return bool
151
	 */
152
153
	public function unpublishByArticle(int $articleId = null) : bool
154
	{
155
		return (bool)$this
156
			->query()
157
			->where('article', $articleId)
158
			->findMany()
159
			->set('status', 0)
160
			->save();
161
	}
162
163
	/**
164
	 * delete the comment by id
165
	 *
166
	 * @since 4.0.0
167
	 *
168
	 * @param int $commentId identifier of the comment
169
	 *
170
	 * @return bool
171
	 */
172
173
	public function deleteById(int $commentId = null) : bool
174
	{
175
		return $this->query()
176
			->whereIdIs($commentId)
177
			->deleteMany();
178
	}
179
180
	/**
181
	 * delete the comment by category
182
	 *
183
	 * @since 4.0.0
184
	 *
185
	 * @param int $categoryId identifier of the category
186
	 *
187
	 * @return bool
188
	 */
189
190
	public function deleteByCategory(int $categoryId = null) : bool
191
	{
192
		$articleModel = new Article();
193
		$articleArray = $articleModel->query()->where('category', $categoryId)->findFlatArray();
194
		return $this
195
			->query()
196
			->whereIn('article', $articleArray)
197
			->deleteMany();
198
	}
199
200
	/**
201
	 * delete the comment by article
202
	 *
203
	 * @since 4.0.0
204
	 *
205
	 * @param int $articleId identifier of the article
206
	 *
207
	 * @return bool
208
	 */
209
210
	public function deleteByArticle(int $articleId = null) : bool
211
	{
212
		return $this
0 ignored issues
show
Documentation Bug introduced by
The method deleteMany does not exist on object<Redaxscript\Db>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
213
			->query()
214
			->where('article', $articleId)
215
			->deleteMany();
216
	}
217
}
218