This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | //------------------------------------------------------------------------------ |
||
4 | // |
||
5 | // eTraxis - Records tracking web-based system |
||
6 | // Copyright (C) 2006-2011 Artem Rodygin |
||
7 | // |
||
8 | // This program is free software: you can redistribute it and/or modify |
||
9 | // it under the terms of the GNU General Public License as published by |
||
10 | // the Free Software Foundation, either version 3 of the License, or |
||
11 | // (at your option) any later version. |
||
12 | // |
||
13 | // This program is distributed in the hope that it will be useful, |
||
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
16 | // GNU General Public License for more details. |
||
17 | // |
||
18 | // You should have received a copy of the GNU General Public License |
||
19 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
20 | // |
||
21 | //------------------------------------------------------------------------------ |
||
22 | |||
23 | /** |
||
24 | * @package eTraxis |
||
25 | * @ignore |
||
26 | */ |
||
27 | |||
28 | /**#@+ |
||
29 | * Dependency. |
||
30 | */ |
||
31 | require_once('../engine/engine.php'); |
||
32 | require_once('../dbo/reminders.php'); |
||
33 | /**#@-*/ |
||
34 | |||
35 | init_page(LOAD_INLINE); |
||
36 | |||
37 | if (!EMAIL_NOTIFICATIONS_ENABLED) |
||
38 | { |
||
39 | debug_write_log(DEBUG_NOTICE, 'Email Notifications functionality is disabled.'); |
||
40 | header('HTTP/1.1 307 ../index.php'); |
||
41 | exit; |
||
42 | } |
||
43 | |||
44 | if (!can_reminder_be_created()) |
||
45 | { |
||
46 | debug_write_log(DEBUG_NOTICE, 'Reminders are denied.'); |
||
47 | header('HTTP/1.1 307 ../index.php'); |
||
48 | exit; |
||
49 | } |
||
50 | |||
51 | $error = NO_ERROR; |
||
52 | |||
53 | // project has been selected |
||
54 | |||
55 | if (try_request('submitted') == 'projectform') |
||
56 | { |
||
57 | debug_write_log(DEBUG_NOTICE, 'Project is selected.'); |
||
58 | |||
59 | $project_id = ustr2int(try_request('project')); |
||
60 | |||
61 | $rs = dal_query(DATABASE_DRIVER == DRIVER_ORACLE9 ? 'reminders/oracle/pfndid.sql' : 'reminders/pfndid.sql', |
||
62 | $_SESSION[VAR_USERID], |
||
63 | $project_id); |
||
64 | |||
65 | if ($rs->rows == 0) |
||
0 ignored issues
–
show
|
|||
66 | { |
||
67 | debug_write_log(DEBUG_NOTICE, 'Project cannot be found.'); |
||
68 | header('HTTP/1.1 307 index.php'); |
||
69 | exit; |
||
70 | } |
||
71 | |||
72 | $project_name = $rs->fetch('project_name'); |
||
73 | |||
74 | $form = 'templateform'; |
||
75 | } |
||
76 | |||
77 | // template has been selected |
||
78 | |||
79 | elseif (try_request('submitted') == 'templateform') |
||
80 | { |
||
81 | debug_write_log(DEBUG_NOTICE, 'Template is selected.'); |
||
82 | |||
83 | $name = NULL; |
||
84 | $subject = NULL; |
||
85 | |||
86 | $project_id = ustr2int(try_request('project')); |
||
87 | $template_id = ustr2int(try_request('template')); |
||
88 | $state_id = 0; |
||
89 | $group_id = 0; |
||
90 | |||
91 | $rs = dal_query(DATABASE_DRIVER == DRIVER_ORACLE9 ? 'reminders/oracle/tfndid.sql' : 'reminders/tfndid.sql', |
||
92 | $_SESSION[VAR_USERID], |
||
93 | $project_id, |
||
94 | $template_id); |
||
95 | |||
96 | if ($rs->rows == 0) |
||
0 ignored issues
–
show
The property
$rows is declared protected in CRecordset . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
97 | { |
||
98 | debug_write_log(DEBUG_NOTICE, 'Template cannot be found.'); |
||
99 | header('HTTP/1.1 307 index.php'); |
||
100 | exit; |
||
101 | } |
||
102 | |||
103 | $row = $rs->fetch(); |
||
104 | |||
105 | $project_name = $row['project_name']; |
||
106 | $template_name = $row['template_name']; |
||
107 | |||
108 | $form = 'createform'; |
||
109 | } |
||
110 | |||
111 | // new reminder has been submitted |
||
112 | |||
113 | elseif (try_request('submitted') == 'createform') |
||
114 | { |
||
115 | debug_write_log(DEBUG_NOTICE, 'Data are submitted.'); |
||
116 | |||
117 | $name = ustrcut($_REQUEST['name'], MAX_REMINDER_NAME); |
||
118 | $subject = ustrcut($_REQUEST['subject'], MAX_REMINDER_SUBJECT); |
||
119 | |||
120 | $project_id = ustr2int(try_request('project')); |
||
121 | $template_id = ustr2int(try_request('template')); |
||
122 | $state_id = ustr2int(try_request('state')); |
||
123 | $group_id = ustr2int(try_request('group'), REMINDER_FLAG_RESPONSIBLE); |
||
124 | |||
125 | $rs = dal_query(DATABASE_DRIVER == DRIVER_ORACLE9 ? 'reminders/oracle/tfndid.sql' : 'reminders/tfndid.sql', |
||
126 | $_SESSION[VAR_USERID], |
||
127 | $project_id, |
||
128 | $template_id); |
||
129 | |||
130 | if ($rs->rows == 0) |
||
0 ignored issues
–
show
The property
$rows is declared protected in CRecordset . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
131 | { |
||
132 | debug_write_log(DEBUG_NOTICE, 'Template cannot be found.'); |
||
133 | header('HTTP/1.1 307 index.php'); |
||
134 | exit; |
||
135 | } |
||
136 | |||
137 | $row = $rs->fetch(); |
||
138 | |||
139 | $project_name = $row['project_name']; |
||
140 | $template_name = $row['template_name']; |
||
141 | |||
142 | $error = reminder_validate($name, $subject); |
||
143 | |||
144 | View Code Duplication | if ($error == NO_ERROR) |
|
145 | { |
||
146 | $error = reminder_create($name, |
||
147 | $subject, |
||
148 | $state_id, |
||
149 | ($group_id < 0 ? NULL : $group_id), |
||
150 | ($group_id < 0 ? $group_id : REMINDER_FLAG_GROUP)); |
||
151 | } |
||
152 | |||
153 | switch ($error) |
||
154 | { |
||
155 | case NO_ERROR: |
||
156 | header('HTTP/1.0 200 OK'); |
||
157 | break; |
||
158 | |||
159 | case ERROR_INCOMPLETE_FORM: |
||
160 | send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID)); |
||
161 | break; |
||
162 | |||
163 | case ERROR_ALREADY_EXISTS: |
||
164 | send_http_error(get_html_resource(RES_ALERT_REMINDER_ALREADY_EXISTS_ID)); |
||
165 | break; |
||
166 | |||
167 | default: |
||
168 | send_http_error(get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID)); |
||
169 | } |
||
170 | |||
171 | exit; |
||
172 | } |
||
173 | else |
||
174 | { |
||
175 | debug_write_log(DEBUG_NOTICE, 'Data are being requested.'); |
||
176 | |||
177 | $form = 'projectform'; |
||
178 | } |
||
179 | |||
180 | // local JS functions |
||
181 | |||
182 | $resTitle = get_js_resource(RES_ERROR_ID); |
||
183 | $resOK = get_js_resource(RES_OK_ID); |
||
184 | |||
185 | $xml = <<<JQUERY |
||
186 | <script> |
||
187 | |||
188 | function createSuccess () |
||
189 | { |
||
190 | closeModal(); |
||
191 | reloadTab(); |
||
192 | } |
||
193 | |||
194 | function createError (XMLHttpRequest) |
||
195 | { |
||
196 | jqAlert("{$resTitle}", XMLHttpRequest.responseText, "{$resOK}"); |
||
197 | } |
||
198 | |||
199 | </script> |
||
200 | JQUERY; |
||
201 | |||
202 | // generate header |
||
203 | |||
204 | $xml .= '<form name="' . $form . '" action="create.php" success="createSuccess" error="createError">' |
||
205 | . '<group>'; |
||
206 | |||
207 | // generate project selector |
||
208 | |||
209 | View Code Duplication | if ($form == 'projectform') |
|
210 | { |
||
211 | $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
212 | . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>' |
||
213 | . '<combobox>'; |
||
214 | |||
215 | $rs = dal_query(DATABASE_DRIVER == DRIVER_ORACLE9 ? 'reminders/oracle/plist.sql' : 'reminders/plist.sql', |
||
216 | $_SESSION[VAR_USERID]); |
||
217 | |||
218 | if ($rs->rows == 1) |
||
0 ignored issues
–
show
The property
$rows is declared protected in CRecordset . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
219 | { |
||
220 | debug_write_log(DEBUG_NOTICE, 'One project only is found.'); |
||
221 | } |
||
222 | |||
223 | while (($row = $rs->fetch())) |
||
224 | { |
||
225 | $xml .= '<listitem value="' . $row['project_id'] . '">' |
||
226 | . ustr2html($row['project_name']) |
||
227 | . '</listitem>'; |
||
228 | } |
||
229 | |||
230 | $xml .= '</combobox>' |
||
231 | . '</control>'; |
||
232 | } |
||
233 | elseif (isset($project_id)) |
||
234 | { |
||
235 | $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
236 | . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>' |
||
237 | . '<combobox>' |
||
238 | . '<listitem value="' . $project_id . '">' . ustr2html($project_name) . '</listitem>' |
||
239 | . '</combobox>' |
||
240 | . '</control>'; |
||
241 | } |
||
242 | |||
243 | // generate template selector |
||
244 | |||
245 | View Code Duplication | if ($form == 'templateform') |
|
246 | { |
||
247 | $xml .= '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
248 | . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>' |
||
249 | . '<combobox>'; |
||
250 | |||
251 | $rs = dal_query(DATABASE_DRIVER == DRIVER_ORACLE9 ? 'reminders/oracle/tlist.sql' : 'reminders/tlist.sql', |
||
252 | $_SESSION[VAR_USERID], |
||
253 | $project_id); |
||
254 | |||
255 | if ($rs->rows == 1) |
||
0 ignored issues
–
show
The property
$rows is declared protected in CRecordset . Since you implemented __get() , maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
256 | { |
||
257 | debug_write_log(DEBUG_NOTICE, 'One template only is found.'); |
||
258 | } |
||
259 | |||
260 | while (($row = $rs->fetch())) |
||
261 | { |
||
262 | $xml .= '<listitem value="' . $row['template_id'] . '">' |
||
263 | . ustr2html($row['template_name']) |
||
264 | . '</listitem>'; |
||
265 | } |
||
266 | |||
267 | $xml .= '</combobox>' |
||
268 | . '</control>'; |
||
269 | } |
||
270 | elseif (isset($template_id)) |
||
271 | { |
||
272 | $xml .= '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
273 | . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>' |
||
274 | . '<combobox>' |
||
275 | . '<listitem value="' . $template_id . '">' . ustr2html($template_name) . '</listitem>' |
||
276 | . '</combobox>' |
||
277 | . '</control>'; |
||
278 | } |
||
279 | |||
280 | // generate other reminder attributes |
||
281 | |||
282 | if ($form == 'createform') |
||
283 | { |
||
284 | $xml .= '<control name="state" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
285 | . '<label>' . get_html_resource(RES_STATE_ID) . '</label>' |
||
286 | . '<combobox>'; |
||
287 | |||
288 | $rs = dal_query('states/list.sql', $template_id, 'state_name'); |
||
289 | |||
290 | View Code Duplication | while (($row = $rs->fetch())) |
|
291 | { |
||
292 | $xml .= ($state_id == $row['state_id'] |
||
293 | ? '<listitem value="' . $row['state_id'] . '" selected="true">' |
||
294 | : '<listitem value="' . $row['state_id'] . '">') |
||
295 | . ustr2html($row['state_name']) |
||
296 | . '</listitem>'; |
||
297 | } |
||
298 | |||
299 | $xml .= '</combobox>' |
||
300 | . '</control>' |
||
301 | . '<control name="name" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
302 | . '<label>' . get_html_resource(RES_REMINDER_NAME_ID) . '</label>' |
||
303 | . '<editbox maxlen="' . MAX_REMINDER_NAME . '">' . ustr2html($name) . '</editbox>' |
||
304 | . '</control>' |
||
305 | . '<control name="subject" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
306 | . '<label>' . get_html_resource(RES_REMINDER_SUBJECT_ID) . '</label>' |
||
307 | . '<editbox maxlen="' . MAX_REMINDER_SUBJECT . '">' . ustr2html($subject) . '</editbox>' |
||
308 | . '</control>' |
||
309 | . '<control name="group" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
310 | . '<label>' . get_html_resource(RES_REMINDER_RECIPIENTS_ID) . '</label>' |
||
311 | . '<combobox>' |
||
312 | . '<listitem value="' . REMINDER_FLAG_AUTHOR . ($group_id == REMINDER_FLAG_AUTHOR ? '" selected="true">' : '">') . sprintf('%s (%s)', get_html_resource(RES_AUTHOR_ID), get_html_resource(RES_ROLE_ID)) . '</listitem>' |
||
313 | . '<listitem value="' . REMINDER_FLAG_RESPONSIBLE . ($group_id == REMINDER_FLAG_RESPONSIBLE ? '" selected="true">' : '">') . sprintf('%s (%s)', get_html_resource(RES_RESPONSIBLE_ID), get_html_resource(RES_ROLE_ID)) . '</listitem>'; |
||
314 | |||
315 | $rs = dal_query('groups/list.sql', $project_id, 'is_global, group_name'); |
||
316 | |||
317 | View Code Duplication | while (($row = $rs->fetch())) |
|
318 | { |
||
319 | $xml .= ($group_id == $row['group_id'] |
||
320 | ? '<listitem value="' . $row['group_id'] . '" selected="true">' |
||
321 | : '<listitem value="' . $row['group_id'] . '">') |
||
322 | . sprintf('%s (%s)', ustr2html($row['group_name']), get_html_resource($row['is_global'] ? RES_GLOBAL_ID : RES_LOCAL_ID)) |
||
323 | . '</listitem>'; |
||
324 | } |
||
325 | |||
326 | $xml .= '</combobox>' |
||
327 | . '</control>'; |
||
328 | } |
||
329 | |||
330 | // generate footer |
||
331 | |||
332 | $xml .= '</group>' |
||
333 | . '<note>' . get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID) . '</note>' |
||
334 | . '</form>'; |
||
335 | |||
336 | echo(xml2html($xml)); |
||
337 | |||
338 | ?> |
||
339 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.