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/templates.php'); |
||
34 | require_once('../dbo/subscriptions.php'); |
||
35 | /**#@-*/ |
||
36 | |||
37 | init_page(LOAD_INLINE); |
||
38 | |||
39 | if (!EMAIL_NOTIFICATIONS_ENABLED) |
||
40 | { |
||
41 | debug_write_log(DEBUG_NOTICE, 'Email Notifications functionality is disabled.'); |
||
42 | header('HTTP/1.1 307 ../index.php'); |
||
43 | exit; |
||
44 | } |
||
45 | |||
46 | // check that requested subscription exists |
||
47 | |||
48 | $id = ustr2int(try_request('id')); |
||
49 | $subscription = subscription_find($id); |
||
50 | |||
51 | if (!$subscription) |
||
52 | { |
||
53 | debug_write_log(DEBUG_NOTICE, 'Subscription cannot be found.'); |
||
54 | header('HTTP/1.1 307 index.php'); |
||
55 | exit; |
||
56 | } |
||
57 | |||
58 | // changed subscription has been submitted |
||
59 | |||
60 | if (try_request('submitted') == 'modifyform') |
||
61 | { |
||
62 | debug_write_log(DEBUG_NOTICE, 'Data are submitted.'); |
||
63 | |||
64 | $subscription_name = ustrcut($_REQUEST['subscription_name'], MAX_SUBSCRIPTION_NAME); |
||
65 | $carbon_copy = ustrcut($_REQUEST['carbon_copy'], MAX_SUBSCRIPTION_CARBON_COPY); |
||
66 | $subscription_flags = 0; |
||
67 | |||
68 | View Code Duplication | foreach ($notifications as $notification) |
|
0 ignored issues
–
show
|
|||
69 | { |
||
70 | $subscription_flags |= (isset($_REQUEST[$notification[NOTIFY_CONTROL]]) ? $notification[NOTIFY_EVENT] : 0); |
||
71 | } |
||
72 | |||
73 | $error = subscription_validate($subscription_name, $carbon_copy); |
||
74 | |||
75 | if ($error == NO_ERROR) |
||
76 | { |
||
77 | $error = subscription_modify($id, |
||
78 | $subscription_name, |
||
79 | $carbon_copy, |
||
80 | $subscription_flags); |
||
81 | } |
||
82 | |||
83 | View Code Duplication | switch ($error) |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
84 | { |
||
85 | case NO_ERROR: |
||
86 | header('HTTP/1.0 200 OK'); |
||
87 | break; |
||
88 | |||
89 | case ERROR_INCOMPLETE_FORM: |
||
90 | send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID)); |
||
91 | break; |
||
92 | |||
93 | case ERROR_ALREADY_EXISTS: |
||
94 | send_http_error(get_html_resource(RES_ALERT_SUBSCRIPTION_ALREADY_EXISTS_ID)); |
||
95 | break; |
||
96 | |||
97 | case ERROR_INVALID_EMAIL: |
||
98 | send_http_error(get_html_resource(RES_ALERT_INVALID_EMAIL_ID)); |
||
99 | break; |
||
100 | |||
101 | default: |
||
102 | send_http_error(get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID)); |
||
103 | } |
||
104 | |||
105 | exit; |
||
106 | } |
||
107 | else |
||
108 | { |
||
109 | debug_write_log(DEBUG_NOTICE, 'Data are being requested.'); |
||
110 | |||
111 | $error = NO_ERROR; |
||
112 | |||
113 | $subscription_name = $subscription['subscribe_name']; |
||
114 | $carbon_copy = $subscription['carbon_copy']; |
||
115 | $subscription_flags = $subscription['subscribe_flags']; |
||
116 | } |
||
117 | |||
118 | // local JS functions |
||
119 | |||
120 | $resTitle = get_js_resource(RES_ERROR_ID); |
||
121 | $resOK = get_js_resource(RES_OK_ID); |
||
122 | |||
123 | $xml = <<<JQUERY |
||
124 | <script> |
||
125 | |||
126 | function modifySuccess () |
||
127 | { |
||
128 | closeModal(); |
||
129 | reloadTab(); |
||
130 | } |
||
131 | |||
132 | function modifyError (XMLHttpRequest) |
||
133 | { |
||
134 | jqAlert("{$resTitle}", XMLHttpRequest.responseText, "{$resOK}"); |
||
135 | } |
||
136 | |||
137 | </script> |
||
138 | JQUERY; |
||
139 | |||
140 | // generate page |
||
141 | |||
142 | $xml .= '<form name="modifyform" action="modify.php?id=' . $id . '" success="modifySuccess" error="modifyError">' |
||
143 | . '<group>'; |
||
144 | |||
145 | switch ($subscription['subscribe_type']) |
||
146 | { |
||
147 | case SUBSCRIPTION_TYPE_ALL_PROJECTS: |
||
148 | |||
149 | $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
150 | . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>' |
||
151 | . '<combobox>' |
||
152 | . '<listitem value="0">' . get_html_resource(RES_ALL_PROJECTS_ID) . '</listitem>' |
||
153 | . '</combobox>' |
||
154 | . '</control>'; |
||
155 | |||
156 | break; |
||
157 | |||
158 | View Code Duplication | case SUBSCRIPTION_TYPE_ALL_TEMPLATES: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
159 | |||
160 | $project = project_find($subscription['subscribe_param']); |
||
161 | |||
162 | if (!$project) |
||
163 | { |
||
164 | debug_write_log(DEBUG_WARNING, 'Project cannot be found.'); |
||
165 | header('HTTP/1.1 307 view.php?id=' . $id); |
||
166 | exit; |
||
167 | } |
||
168 | |||
169 | $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
170 | . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>' |
||
171 | . '<combobox>' |
||
172 | . '<listitem value="0">' . ustr2html($project['project_name']) . '</listitem>' |
||
173 | . '</combobox>' |
||
174 | . '</control>' |
||
175 | . '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
176 | . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>' |
||
177 | . '<combobox>' |
||
178 | . '<listitem value="0">' . get_html_resource(RES_ALL_TEMPLATES_ID) . '</listitem>' |
||
179 | . '</combobox>' |
||
180 | . '</control>'; |
||
181 | |||
182 | break; |
||
183 | |||
184 | View Code Duplication | case SUBSCRIPTION_TYPE_ONE_TEMPLATE: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
185 | |||
186 | $template = template_find($subscription['subscribe_param']); |
||
187 | |||
188 | if (!$template) |
||
189 | { |
||
190 | debug_write_log(DEBUG_WARNING, 'Template cannot be found.'); |
||
191 | header('HTTP/1.1 307 view.php?id=' . $id); |
||
192 | exit; |
||
193 | } |
||
194 | |||
195 | $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
196 | . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>' |
||
197 | . '<combobox>' |
||
198 | . '<listitem value="0">' . ustr2html($template['project_name']) . '</listitem>' |
||
199 | . '</combobox>' |
||
200 | . '</control>' |
||
201 | . '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
202 | . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>' |
||
203 | . '<combobox>' |
||
204 | . '<listitem value="0">' . ustr2html($template['template_name']) . '</listitem>' |
||
205 | . '</combobox>' |
||
206 | . '</control>'; |
||
207 | |||
208 | break; |
||
209 | |||
210 | default: |
||
211 | |||
212 | debug_write_log(DEBUG_WARNING, 'Unknown subscription type = ' . $subscription['subscribe_type']); |
||
213 | } |
||
214 | |||
215 | $xml .= '<control name="subscription_name" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
216 | . '<label>' . get_html_resource(RES_SUBSCRIPTION_NAME_ID) . '</label>' |
||
217 | . '<editbox maxlen="' . MAX_SUBSCRIPTION_NAME . '">' . ustr2html($subscription_name) . '</editbox>' |
||
218 | . '</control>' |
||
219 | . '<control name="carbon_copy">' |
||
220 | . '<label>' . get_html_resource(RES_CARBON_COPY_ID) . '</label>' |
||
221 | . '<editbox maxlen="' . MAX_SUBSCRIPTION_CARBON_COPY . '">' . ustr2html($carbon_copy) . '</editbox>' |
||
222 | . '</control>' |
||
223 | . '</group>' |
||
224 | . '<group title="' . get_html_resource(RES_EVENTS_ID) . '">'; |
||
225 | |||
226 | View Code Duplication | foreach ($notifications as $notification) |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
227 | { |
||
228 | $xml .= '<control name="' . $notification[NOTIFY_CONTROL] . '">' |
||
229 | . (($subscription_flags & $notification[NOTIFY_EVENT]) != 0 |
||
230 | ? '<checkbox checked="true">' |
||
231 | : '<checkbox>') |
||
232 | . get_html_resource($notification[NOTIFY_RESOURCE]) |
||
233 | . '</checkbox>' |
||
234 | . '</control>'; |
||
235 | } |
||
236 | |||
237 | $xml .= '</group>' |
||
238 | . '<note>' . get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID) . '</note>' |
||
239 | . '</form>'; |
||
240 | |||
241 | echo(xml2html($xml)); |
||
242 | |||
243 | ?> |
||
244 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.