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-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/projects.php'); |
||
33 | require_once('../dbo/states.php'); |
||
34 | /**#@-*/ |
||
35 | |||
36 | init_page(LOAD_INLINE); |
||
37 | |||
38 | $error = NO_ERROR; |
||
39 | |||
40 | if (get_user_level() != USER_LEVEL_ADMIN) |
||
41 | { |
||
42 | debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
||
43 | header('HTTP/1.1 307 index.php'); |
||
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) |
||
53 | { |
||
54 | debug_write_log(DEBUG_NOTICE, 'State cannot be found.'); |
||
55 | header('HTTP/1.1 307 index.php'); |
||
56 | exit; |
||
57 | } |
||
58 | |||
59 | View Code Duplication | if (!$state['is_locked']) |
|
60 | { |
||
61 | debug_write_log(DEBUG_NOTICE, 'Template must be locked.'); |
||
62 | header('HTTP/1.1 307 sview.php?id=' . $id); |
||
63 | exit; |
||
64 | } |
||
65 | |||
66 | // changed state has been submitted |
||
67 | |||
68 | if (try_request('submitted') == 'modifyform') |
||
69 | { |
||
70 | debug_write_log(DEBUG_NOTICE, 'Data are submitted.'); |
||
71 | |||
72 | $state_name = ustrcut($_REQUEST['state_name'], MAX_STATE_NAME); |
||
73 | $state_abbr = ustrcut($_REQUEST['state_abbr'], MAX_STATE_ABBR); |
||
74 | $next_state_id = ustr2int(try_request('next_state', $state['next_state_id']), 0); |
||
75 | $responsible = ustr2int(try_request('responsible', $state['responsible']), 1, 3); |
||
76 | |||
77 | $error = state_validate($state_name, $state_abbr); |
||
78 | |||
79 | if ($error == NO_ERROR) |
||
80 | { |
||
81 | $error = state_modify($id, |
||
82 | $state['template_id'], |
||
83 | $state['state_name'], |
||
84 | $state_name, |
||
85 | $state_abbr, |
||
86 | ($next_state_id == 0 ? NULL : $next_state_id), |
||
87 | $responsible); |
||
88 | } |
||
89 | |||
90 | switch ($error) |
||
91 | { |
||
92 | case NO_ERROR: |
||
93 | header('HTTP/1.0 200 OK'); |
||
94 | break; |
||
95 | |||
96 | case ERROR_INCOMPLETE_FORM: |
||
97 | send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID)); |
||
98 | break; |
||
99 | |||
100 | case ERROR_ALREADY_EXISTS: |
||
101 | send_http_error(get_html_resource(RES_ALERT_STATE_ALREADY_EXISTS_ID)); |
||
102 | break; |
||
103 | |||
104 | default: |
||
105 | send_http_error(get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID)); |
||
106 | } |
||
107 | |||
108 | exit; |
||
109 | } |
||
110 | else |
||
111 | { |
||
112 | debug_write_log(DEBUG_NOTICE, 'Data are being requested.'); |
||
113 | |||
114 | $state_name = $state['state_name']; |
||
115 | $state_abbr = $state['state_abbr']; |
||
116 | $next_state_id = $state['next_state_id']; |
||
117 | $responsible = $state['responsible']; |
||
118 | } |
||
119 | |||
120 | // local JS functions |
||
121 | |||
122 | $resTitle = get_js_resource(RES_ERROR_ID); |
||
123 | $resOK = get_js_resource(RES_OK_ID); |
||
124 | |||
125 | $xml = <<<JQUERY |
||
126 | <script> |
||
127 | |||
128 | function modifySuccess () |
||
129 | { |
||
130 | closeModal(); |
||
131 | reloadTab(); |
||
132 | } |
||
133 | |||
134 | function modifyError (XMLHttpRequest) |
||
135 | { |
||
136 | jqAlert("{$resTitle}", XMLHttpRequest.responseText, "{$resOK}"); |
||
137 | } |
||
138 | |||
139 | </script> |
||
140 | JQUERY; |
||
141 | |||
142 | // generate page |
||
143 | |||
144 | $xml .= '<form name="modifyform" action="smodify.php?id=' . $id . '" success="modifySuccess" error="modifyError">' |
||
145 | . '<group>' |
||
146 | . '<control name="state_name" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
147 | . '<label>' . get_html_resource(RES_STATE_NAME_ID) . '</label>' |
||
148 | . '<editbox maxlen="' . MAX_STATE_NAME . '">' . ustr2html($state_name) . '</editbox>' |
||
149 | . '</control>' |
||
150 | . '<control name="state_abbr" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
151 | . '<label>' . get_html_resource(RES_STATE_ABBR_ID) . '</label>' |
||
152 | . '<editbox maxlen="' . MAX_STATE_ABBR . '">' . ustr2html($state_abbr) . '</editbox>' |
||
153 | . '</control>'; |
||
154 | |||
155 | if ($state['state_type'] != STATE_TYPE_FINAL) |
||
156 | { |
||
157 | $states = dal_query('states/list.sql', $state['template_id'], 'state_name asc'); |
||
158 | |||
159 | View Code Duplication | if ($states->rows != 0) |
|
0 ignored issues
–
show
|
|||
160 | { |
||
161 | $xml .= '<control name="next_state">' |
||
162 | . '<label>' . get_html_resource(RES_NEXT_STATE_BY_DEFAULT_ID) . '</label>' |
||
163 | . '<combobox>' |
||
164 | . '<listitem value="0">' . get_html_resource(RES_NONE_ID) . '</listitem>'; |
||
165 | |||
166 | while (($row = $states->fetch())) |
||
167 | { |
||
168 | $xml .= ($row['state_id'] == $next_state_id |
||
169 | ? '<listitem value="' . $row['state_id'] . '" selected="true">' |
||
170 | : '<listitem value="' . $row['state_id'] . '">') |
||
171 | . ustr2html($row['state_name']) |
||
172 | . '</listitem>'; |
||
173 | } |
||
174 | |||
175 | $xml .= '</combobox>' |
||
176 | . '</control>'; |
||
177 | } |
||
178 | |||
179 | if (is_state_removable($id)) |
||
180 | { |
||
181 | $xml .= '<control name="responsible">' |
||
182 | . '<label>' . get_html_resource(RES_RESPONSIBLE_ID) . '</label>'; |
||
183 | |||
184 | foreach ($state_responsible_res as $key => $value) |
||
185 | { |
||
186 | $xml .= '<radio value="' . $key . ($responsible == $key ? '" checked="true">' : '">') . get_html_resource($value) . '</radio>'; |
||
187 | } |
||
188 | |||
189 | $xml .= '</control>'; |
||
190 | } |
||
191 | } |
||
192 | |||
193 | $xml .= '</group>' |
||
194 | . '<note>' . get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID) . '</note>' |
||
195 | . '</form>'; |
||
196 | |||
197 | echo(xml2html($xml)); |
||
198 | |||
199 | ?> |
||
200 |
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.