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) 2010-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 | require_once('../dbo/events.php'); |
||
36 | /**#@-*/ |
||
37 | |||
38 | init_page(LOAD_TAB); |
||
39 | |||
40 | if (!EMAIL_NOTIFICATIONS_ENABLED) |
||
41 | { |
||
42 | debug_write_log(DEBUG_NOTICE, 'Email Notifications functionality is disabled.'); |
||
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 | exit; |
||
55 | } |
||
56 | |||
57 | // local JS functions |
||
58 | |||
59 | $resTitle = ustrprocess(get_js_resource(RES_SUBSCRIPTION_X_ID), ustr2js($subscription['subscribe_name'])); |
||
60 | $resOK = get_js_resource(RES_OK_ID); |
||
61 | $resCancel = get_js_resource(RES_CANCEL_ID); |
||
62 | |||
63 | $xml = <<<JQUERY |
||
64 | <script> |
||
65 | |||
66 | function subscriptionModify () |
||
67 | { |
||
68 | jqModal("{$resTitle}", "modify.php?id={$id}", "{$resOK}", "{$resCancel}", "$('#modifyform').submit()"); |
||
69 | } |
||
70 | |||
71 | function subscriptionToggle () |
||
72 | { |
||
73 | $.post("disable.php?id={$id}", function () { |
||
74 | reloadTab(); |
||
75 | }); |
||
76 | } |
||
77 | |||
78 | </script> |
||
79 | JQUERY; |
||
80 | |||
81 | // generate buttons |
||
82 | |||
83 | $xml .= '<button url="index.php">' . get_html_resource(RES_BACK_ID) . '</button>' |
||
84 | . '<buttonset>' |
||
85 | . '<button action="subscriptionModify()">' . get_html_resource(RES_MODIFY_ID) . '</button>' |
||
86 | . '<button url="delete.php?id=' . $id . '" prompt="' . get_html_resource(RES_CONFIRM_DELETE_SUBSCRIPTIONS_ID) . '">' . get_html_resource(RES_DELETE_ID) . '</button>' |
||
87 | . '<button action="subscriptionToggle()">' . get_html_resource($subscription['is_activated'] ? RES_DISABLE_ID : RES_ENABLE_ID) . '</button>' |
||
88 | . '</buttonset>'; |
||
89 | |||
90 | // generate subscription information |
||
91 | |||
92 | $xml .= '<group>'; |
||
93 | |||
94 | switch ($subscription['subscribe_type']) |
||
95 | { |
||
96 | case SUBSCRIPTION_TYPE_ALL_PROJECTS: |
||
97 | |||
98 | $xml .= '<text label="' . get_html_resource(RES_PROJECT_ID) . '">' . get_html_resource(RES_ALL_PROJECTS_ID) . '</text>'; |
||
99 | |||
100 | break; |
||
101 | |||
102 | View Code Duplication | case SUBSCRIPTION_TYPE_ALL_TEMPLATES: |
|
0 ignored issues
–
show
|
|||
103 | |||
104 | $project = project_find($subscription['subscribe_param']); |
||
105 | |||
106 | if (!$project) |
||
107 | { |
||
108 | debug_write_log(DEBUG_WARNING, 'Project cannot be found.'); |
||
109 | exit; |
||
110 | } |
||
111 | |||
112 | $xml .= '<text label="' . get_html_resource(RES_PROJECT_ID) . '">' . ustr2html($project['project_name']) . '</text>'; |
||
113 | $xml .= '<text label="' . get_html_resource(RES_TEMPLATE_ID) . '">' . get_html_resource(RES_ALL_TEMPLATES_ID) . '</text>'; |
||
114 | |||
115 | break; |
||
116 | |||
117 | 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...
|
|||
118 | |||
119 | $template = template_find($subscription['subscribe_param']); |
||
120 | |||
121 | if (!$template) |
||
122 | { |
||
123 | debug_write_log(DEBUG_WARNING, 'Template cannot be found.'); |
||
124 | exit; |
||
125 | } |
||
126 | |||
127 | $xml .= '<text label="' . get_html_resource(RES_PROJECT_ID) . '">' . ustr2html($template['project_name']) . '</text>'; |
||
128 | $xml .= '<text label="' . get_html_resource(RES_TEMPLATE_ID) . '">' . ustr2html($template['template_name']) . '</text>'; |
||
129 | |||
130 | break; |
||
131 | |||
132 | default: |
||
133 | |||
134 | debug_write_log(DEBUG_WARNING, 'Unknown subscription type = ' . $subscription['subscribe_type']); |
||
135 | } |
||
136 | |||
137 | $xml .= '<text label="' . get_html_resource(RES_SUBSCRIPTION_NAME_ID) . '">' . ustr2html($subscription['subscribe_name']) . '</text>' |
||
138 | . '<text label="' . get_html_resource(RES_CARBON_COPY_ID) . '">' . (is_null($subscription['carbon_copy']) ? get_html_resource(RES_NONE_ID) : ustr2html($subscription['carbon_copy'])) . '</text>' |
||
139 | . '</group>' |
||
140 | . '<group title="' . get_html_resource(RES_EVENTS_ID) . '">'; |
||
141 | |||
142 | foreach ($notifications as $notification) |
||
143 | { |
||
144 | $xml .= '<text label="' . get_html_resource($notification[NOTIFY_RESOURCE]) . '">' |
||
145 | . get_html_resource(($subscription['subscribe_flags'] & $notification[NOTIFY_EVENT]) != 0 ? RES_YES_ID : RES_NO_ID) |
||
146 | . '</text>'; |
||
147 | } |
||
148 | |||
149 | $xml .= '</group>'; |
||
150 | |||
151 | echo(xml2html($xml)); |
||
152 | |||
153 | ?> |
||
154 |
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.