Issues (789)

Security Analysis    not enabled

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.

app/models/BlockModel.php (1 issue)

Severity

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
3
namespace App\Models;
4
5
use Nette\Database\Context;
6
7
/**
8
 * Blocks
9
 *
10
 * class for handling program blocks
11
 *
12
 * @created 2012-09-14
13
 * @author Tomas Litera <[email protected]>
14
 */
15
class BlockModel extends BaseModel
16
{
17
18
	/** @var string */
19
	protected $table = 'kk_blocks';
20
21
	/** @var array */
22
	public $columns = [
23
		'guid',
24
		'name',
25
		'day',
26
		'from',
27
		'to',
28
		'program',
29
		'display_progs',
30
		'description',
31
		'tutor',
32
		'email',
33
		'category',
34
		'material',
35
		'capacity',
36
		//"meeting",
37
	];
38
39
	private static $connection;
40
41
	/**
42
	 * @param Context  $database
43
	 */
44
	public function __construct(Context $database)
45
	{
46
		$this->setDatabase($database);
47
		self::$connection = $this->getDatabase();
48
	}
49
50
	/**
51
	 * @return	ActiveRow
52
	 */
53
	public function all()
54
	{
55
		return $this->getDatabase()
56
			->query('SELECT blocks.guid AS guid,
57
						blocks.id AS id,
58
						blocks.name AS name,
59
						cat.name AS cat_name,
60
						day,
61
						DATE_FORMAT(`from`, "%H:%i") AS `from`,
62
						DATE_FORMAT(`to`, "%H:%i") AS `to`,
63
						description,
64
						tutor,
65
						email,
66
						style
67
				FROM kk_blocks AS blocks
68
				LEFT JOIN kk_categories AS cat ON cat.id = blocks.category
69
				WHERE blocks.meeting = ? AND blocks.deleted = ?
70
				ORDER BY day, `from` ASC',
71
				$this->getMeetingId(), '0')
72
			->fetchAll();
73
	}
74
75
	/**
76
	 * Return blocks that contents programs
77
	 *
78
	 * @param	int		meeting ID
79
	 * @return	array	result and number of affected rows
80
	 */
81
	public function getProgramBlocks($meetingId)
82
	{
83
		$data = $this->getDatabase()
84
			->query('SELECT id,
85
					day,
86
					DATE_FORMAT(`from`, "%H:%i") AS `from`,
87
					DATE_FORMAT(`to`, "%H:%i") AS `to`,
88
					name,
89
					program
90
				FROM kk_blocks
91
				WHERE deleted = ? AND program = ? AND meeting = ?
92
				ORDER BY `day`, `from` ASC',
93
				'0', '1', $meetingId)->fetchAll();
94
95
		return $data;
96
	}
97
98
	/**
99
	 * @param  integer $meetingId
100
	 * @return ActiveRow
101
	 */
102
	public function idsFromCurrentMeeting($meetingId)
103
	{
104
		return $this->getDatabase()
105
			->table($this->getTable())
106
			->select('id')
107
			->where('meeting ? AND program ? AND deleted ?', $meetingId, '1', '0')
108
			->fetchAll();
109
	}
110
111
	/**
112
	 * @param  integer $meetingId
113
	 * @param  string  $dayVal
114
	 * @return ActiveRow
115
	 */
116
	public function getExportBlocks($meetingId, $dayVal)
117
	{
118
		$result = $this->getDatabase()
119
			->query('SELECT blocks.id AS id,
120
						day,
121
						DATE_FORMAT(`from`, "%H:%i") AS `from`,
122
						DATE_FORMAT(`to`, "%H:%i") AS `to`,
123
						blocks.name AS name,
124
						program,
125
						display_progs,
126
						style,
127
						cat.id AS category
128
				FROM kk_blocks AS blocks
129
				LEFT JOIN kk_categories AS cat ON cat.id = blocks.category
130
				/* 18 - pauzy */
131
				WHERE blocks.deleted = ? AND day = ? AND meeting = ? AND category != ?
132
				ORDER BY `from` ASC',
133
				'0', $dayVal, $meetingId, '18')->fetchAll();
134
135
		return $result;
136
	}
137
138
	/**
139
	 * Get tutor e-mail address
140
	 *
141
	 * @param int $blockId id of block item
142
	 * @return Nette\Database\Table\ActiveRow object with e-mail address
143
	 */
144
	public function getTutor($blockId)
145
	{
146
		return $this->getDatabase()
147
			->table($this->getTable())
148
			->select('guid, email, tutor')
149
			->where('id ? AND deleted ?', $blockId, '0')
150
			->limit(1)
151
			->fetch();
152
	}
153
154
	/**
155
	 * @param  int $meetingId
156
	 * @return Database
157
	 */
158
	public function findByMeeting($meetingId)
159
	{
160
		return $this->getDatabase()
161
			->table($this->getTable())
162
			->select('id, day, from, to, name')
163
			->where('meeting ? AND program ? AND deleted ?', $meetingId, '1', '0')
164
			->fetchAll();
165
	}
166
167
	/**
168
	 * @param  string $day
169
	 * @return Row
170
	 */
171
	public function findByDay($day = '')
172
	{
173
		return $this->getDatabase()
174
				->query('SELECT	blocks.id AS id,
175
							day,
176
							DATE_FORMAT(`from`, "%H:%i") AS `from`,
177
							DATE_FORMAT(`to`, "%H:%i") AS `to`,
178
							blocks.name AS name,
179
							program,
180
							style
181
					FROM kk_blocks AS blocks
182
					LEFT JOIN kk_categories AS cat ON cat.id = blocks.category
183
					WHERE blocks.deleted = ? AND day = ? AND blocks.meeting = ?
184
					ORDER BY `from` ASC',
185
					'0', $day, $this->getMeetingId())
186
				->fetchAll();
187
	}
188
189
	/**
190
	 * Return blocks that contents programs
191
	 *
192
	 * @param	int		meeting ID
193
	 * @return	array	result and number of affected rows
194
	 */
195
	public function findProgramBlocksByMeeting(int $meetingId)
196
	{
197
		return $this->getDatabase()
198
			->query('SELECT id,
199
					day,
200
					DATE_FORMAT(`from`, "%H:%i") AS `from`,
201
					DATE_FORMAT(`to`, "%H:%i") AS `to`,
202
					name,
203
					program
204
				FROM kk_blocks
205
				WHERE deleted = ? AND program = ? AND meeting = ?
206
				ORDER BY `day`, `from` ASC',
207
				'0', '1', $meetingId)->fetchAll();
208
	}
209
210
	public function findByProgramId(int $programId)
0 ignored issues
show
The parameter $programId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
211
	{
212
		return $this->getDatabase()
213
			->query()
214
			->fetch();
215
	}
216
217
}
218