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) 2005-2010 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/projects.php'); |
||
33 | require_once('../dbo/states.php'); |
||
34 | require_once('../dbo/fields.php'); |
||
35 | /**#@-*/ |
||
36 | |||
37 | global $field_type_res; |
||
38 | |||
39 | init_page(LOAD_TAB); |
||
40 | |||
41 | if (get_user_level() != USER_LEVEL_ADMIN) |
||
42 | { |
||
43 | debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
||
44 | exit; |
||
45 | } |
||
46 | |||
47 | // check that requested state exists |
||
48 | |||
49 | $id = ustr2int(try_request('id')); |
||
50 | $state = state_find($id); |
||
51 | |||
52 | if (!$state) |
||
0 ignored issues
–
show
|
|||
53 | { |
||
54 | debug_write_log(DEBUG_NOTICE, 'State cannot be found.'); |
||
55 | exit; |
||
56 | } |
||
57 | |||
58 | // local JS functions |
||
59 | |||
60 | $resTitle1 = ustrprocess(get_js_resource(RES_NEW_FIELD_ID), 1, 2); |
||
61 | $resTitle2 = ustrprocess(get_js_resource(RES_NEW_FIELD_ID), 2, 2); |
||
62 | $resOK = get_js_resource(RES_OK_ID); |
||
63 | $resNext = get_js_resource(RES_NEXT_ID); |
||
64 | $resCancel = get_js_resource(RES_CANCEL_ID); |
||
65 | |||
66 | $xml = <<<JQUERY |
||
67 | <script> |
||
68 | |||
69 | function fieldCreateStep1 () |
||
70 | { |
||
71 | jqModal("{$resTitle1}", "fcreate.php?id={$id}", "{$resNext}", "{$resCancel}", "fieldCreateStep2()"); |
||
72 | } |
||
73 | |||
74 | function fieldCreateStep2 () |
||
75 | { |
||
76 | closeModal(); |
||
77 | |||
78 | jqModal("{$resTitle2}", "fcreate.php?id={$id}&" + $("#mainform").serialize(), "{$resOK}", "{$resCancel}", "$('#modaldlg form').submit()"); |
||
79 | } |
||
80 | |||
81 | </script> |
||
82 | JQUERY; |
||
83 | |||
84 | // get list of fields |
||
85 | |||
86 | $sort = $page = NULL; |
||
87 | $list = fields_list($id, $sort, $page); |
||
88 | |||
89 | $from = $to = 0; |
||
90 | |||
91 | // generate buttons |
||
92 | |||
93 | $xml .= ($state['is_locked'] |
||
94 | ? '<button action="fieldCreateStep1()">' |
||
95 | : '<button disabled="true">') |
||
96 | . get_html_resource(RES_CREATE_ID) |
||
97 | . '</button>'; |
||
98 | |||
99 | // generate list of fields |
||
100 | |||
101 | if ($list->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...
|
|||
102 | { |
||
103 | $columns = array |
||
104 | ( |
||
105 | RES_ORDER_ID, |
||
106 | RES_FIELD_NAME_ID, |
||
107 | RES_FIELD_TYPE_ID, |
||
108 | RES_REQUIRED_ID, |
||
109 | RES_GUEST_ACCESS_ID, |
||
110 | ); |
||
111 | |||
112 | $bookmarks = gen_xml_bookmarks($page, $list->rows, $from, $to, 'findex.php?id=' . $id . '&'); |
||
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...
|
|||
113 | |||
114 | $xml .= '<list>' |
||
115 | . '<hrow>'; |
||
116 | |||
117 | View Code Duplication | for ($i = 1; $i <= count($columns); $i++) |
|
118 | { |
||
119 | $smode = ($sort == $i ? ($i + count($columns)) : $i); |
||
120 | |||
121 | $xml .= "<hcell url=\"findex.php?id={$id}&sort={$smode}\">" |
||
122 | . get_html_resource($columns[$i - 1]) |
||
123 | . '</hcell>'; |
||
124 | } |
||
125 | |||
126 | $xml .= '</hrow>'; |
||
127 | |||
128 | $list->seek($from - 1); |
||
129 | |||
130 | for ($i = $from; $i <= $to; $i++) |
||
131 | { |
||
132 | $row = $list->fetch(); |
||
133 | |||
134 | $xml .= "<row url=\"fview.php?id={$row['field_id']}\">" |
||
135 | . '<cell>' . ustr2html($row['field_order']) . '</cell>' |
||
136 | . '<cell>' . ustr2html($row['field_name']) . '</cell>' |
||
137 | . '<cell>' . get_html_resource($field_type_res[$row['field_type']]) . '</cell>' |
||
138 | . '<cell>' . get_html_resource($row['is_required'] ? RES_YES_ID : RES_NO_ID) . '</cell>' |
||
139 | . '<cell>' . get_html_resource($row['guest_access'] ? RES_YES_ID : RES_NO_ID) . '</cell>' |
||
140 | . '</row>'; |
||
141 | } |
||
142 | |||
143 | $xml .= '</list>' |
||
144 | . $bookmarks; |
||
145 | } |
||
146 | |||
147 | echo(xml2html($xml)); |
||
148 | |||
149 | ?> |
||
150 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.