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/accounts.php'); |
||
33 | /**#@-*/ |
||
34 | |||
35 | global $timezones; |
||
36 | |||
37 | init_page(LOAD_TAB); |
||
38 | |||
39 | // settings form is submitted |
||
40 | |||
41 | if (try_request('submitted') == 'appearanceform') |
||
42 | { |
||
43 | debug_write_log(DEBUG_NOTICE, 'Data are submitted.'); |
||
44 | |||
45 | $locale = ustr2int($_REQUEST['locale']); |
||
46 | $timezone = ustr2int($_REQUEST['timezone'], 0, count($timezones)); |
||
47 | $text_rows = ustr2int($_REQUEST['text_rows'], HTML_TEXTBOX_MIN_HEIGHT, HTML_TEXTBOX_MAX_HEIGHT); |
||
48 | $page_rows = ustr2int($_REQUEST['page_rows'], MIN_PAGE_SIZE, MAX_PAGE_SIZE); |
||
49 | $page_bkms = ustr2int($_REQUEST['page_bkms'], MIN_PAGE_SIZE, MAX_PAGE_SIZE); |
||
50 | $auto_refresh = ustr2int($_REQUEST['auto_refresh'], MIN_AUTO_REFRESH, MAX_AUTO_REFRESH); |
||
51 | $theme_name = ustrcut($_REQUEST['theme_name'], MAX_THEME_NAME); |
||
52 | |||
53 | locale_change($_SESSION[VAR_USERID], $locale); |
||
54 | |||
55 | dal_query('accounts/settings.sql', |
||
56 | $_SESSION[VAR_USERID], |
||
57 | $timezone, |
||
58 | $text_rows, |
||
59 | $page_rows, |
||
60 | $page_bkms, |
||
61 | $auto_refresh, |
||
62 | $theme_name); |
||
63 | |||
64 | exit; |
||
65 | } |
||
66 | else |
||
67 | { |
||
68 | debug_write_log(DEBUG_NOTICE, 'Data are being requested.'); |
||
69 | |||
70 | $rs = dal_query('accounts/fndid.sql', $_SESSION[VAR_USERID]); |
||
71 | |||
72 | $locale = $_SESSION[VAR_LOCALE]; |
||
73 | $timezone = $rs->fetch('timezone'); |
||
74 | $text_rows = $_SESSION[VAR_TEXTROWS]; |
||
75 | $page_rows = $_SESSION[VAR_PAGEROWS]; |
||
76 | $page_bkms = $_SESSION[VAR_PAGEBKMS]; |
||
77 | $auto_refresh = $_SESSION[VAR_AUTO_REFRESH]; |
||
78 | $theme_name = $_SESSION[VAR_THEME_NAME]; |
||
79 | } |
||
80 | |||
81 | // local JS functions |
||
82 | |||
83 | $resTitle = get_js_resource(RES_SETTINGS_ID); |
||
84 | $resError = get_js_resource(RES_ERROR_ID); |
||
85 | $resMessage1 = get_js_resource(RES_ALERT_SUCCESSFULLY_SAVED_ID); |
||
86 | $resMessage2 = get_js_resource(RES_ALERT_UNKNOWN_ERROR_ID); |
||
87 | $resOK = get_js_resource(RES_OK_ID); |
||
88 | |||
89 | $xml = <<<JQUERY |
||
90 | <script> |
||
91 | |||
92 | function appearanceRefresh () |
||
93 | { |
||
94 | window.open("index.php", "_parent"); |
||
95 | } |
||
96 | |||
97 | function appearanceSuccess () |
||
98 | { |
||
99 | jqAlert("{$resTitle}", "{$resMessage1}", "{$resOK}", "appearanceRefresh()"); |
||
100 | } |
||
101 | |||
102 | function appearanceError () |
||
103 | { |
||
104 | jqAlert("{$resError}", "{$resMessage2}", "{$resOK}"); |
||
105 | } |
||
106 | |||
107 | </script> |
||
108 | JQUERY; |
||
109 | |||
110 | // generate contents |
||
111 | |||
112 | $xml .= '<form name="appearanceform" action="appearance.php" success="appearanceSuccess" error="appearanceError">' |
||
113 | . '<group>' |
||
114 | . '<control name="locale">' |
||
115 | . '<label>' . get_html_resource(RES_LANGUAGE_ID) . '</label>' |
||
116 | . '<combobox>'; |
||
117 | |||
118 | $supported_locales = get_supported_locales_sorted(); |
||
119 | |||
120 | View Code Duplication | foreach ($supported_locales as $locale_id => $locale_name) |
|
0 ignored issues
–
show
|
|||
121 | { |
||
122 | $xml .= ($locale == $locale_id |
||
123 | ? '<listitem value="' . $locale_id . '" selected="true">' |
||
124 | : '<listitem value="' . $locale_id . '">') |
||
125 | . ustr2html($locale_name) |
||
126 | . '</listitem>'; |
||
127 | } |
||
128 | |||
129 | $xml .= '</combobox>' |
||
130 | . '</control>' |
||
131 | . '<control name="timezone">' |
||
132 | . '<label>' . get_html_resource(RES_TIMEZONE_ID) . '</label>' |
||
133 | . '<combobox>' |
||
134 | . ($timezone == 0 |
||
135 | ? '<listitem value="0" selected="true">' |
||
136 | : '<listitem value="0">') |
||
137 | . get_html_resource(RES_DEFAULT_ID) |
||
138 | . '</listitem>'; |
||
139 | |||
140 | foreach ($timezones as $timezone_id => $timezone_name) |
||
141 | { |
||
142 | $xml .= ($timezone == $timezone_id |
||
143 | ? '<listitem value="' . $timezone_id . '" selected="true">' |
||
144 | : '<listitem value="' . $timezone_id . '">') |
||
145 | . ustr2html($timezone_name) |
||
146 | . '</listitem>'; |
||
147 | } |
||
148 | |||
149 | $xml .= '</combobox>' |
||
150 | . '</control>' |
||
151 | . '<control name="text_rows" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
152 | . '<label>' . get_html_resource(RES_ROWS_MULTILINED_TEXT_ID) . '</label>' |
||
153 | . '<editbox maxlen="' . ustrlen(HTML_TEXTBOX_MAX_HEIGHT) . '">' . ustr2html($text_rows) . '</editbox>' |
||
154 | . '</control>' |
||
155 | . '<control name="page_rows" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
156 | . '<label>' . get_html_resource(RES_ROWS_PER_PAGE_ID) . '</label>' |
||
157 | . '<editbox maxlen="' . ustrlen(MAX_PAGE_SIZE) . '">' . ustr2html($page_rows) . '</editbox>' |
||
158 | . '</control>' |
||
159 | . '<control name="page_bkms" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
160 | . '<label>' . get_html_resource(RES_BOOKMARKS_PER_PAGE_ID) . '</label>' |
||
161 | . '<editbox maxlen="' . ustrlen(MAX_PAGE_SIZE) . '">' . ustr2html($page_bkms) . '</editbox>' |
||
162 | . '</control>' |
||
163 | . '<control name="auto_refresh" required="' . get_html_resource(RES_REQUIRED3_ID) . '">' |
||
164 | . '<label>' . get_html_resource(RES_AUTO_REFRESH_ID) . '</label>' |
||
165 | . '<editbox maxlen="' . ustrlen(MAX_AUTO_REFRESH) . '">' . ustr2html($auto_refresh) . '</editbox>' |
||
166 | . '</control>' |
||
167 | . '<control name="theme_name">' |
||
168 | . '<label>' . get_html_resource(RES_THEME_ID) . '</label>' |
||
169 | . '<combobox>'; |
||
170 | |||
171 | $themes_available = get_available_themes_sorted(); |
||
172 | |||
173 | foreach ($themes_available as $item) |
||
174 | { |
||
175 | $xml .= ($item == $theme_name |
||
176 | ? '<listitem value="' . $item . '" selected="true">' |
||
177 | : '<listitem value="' . $item . '">') |
||
178 | . ($item == THEME_DEFAULT |
||
179 | ? sprintf('%s (%s)', ustr2html($item), get_html_resource(RES_DEFAULT_ID)) |
||
180 | : ustr2html($item)) |
||
181 | . '</listitem>'; |
||
182 | } |
||
183 | |||
184 | $xml .= '</combobox>' |
||
185 | . '</control>' |
||
186 | . '</group>' |
||
187 | . '<button default="true">' . get_html_resource(RES_SAVE_ID) . '</button>' |
||
188 | . '<note>' . get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID) . '</note>' |
||
189 | . '<note>' . ustrprocess(get_html_resource(RES_ALERT_FIELD_VALUE_OUT_OF_RANGE_ID), get_html_resource(RES_ROWS_MULTILINED_TEXT_ID), HTML_TEXTBOX_MIN_HEIGHT, HTML_TEXTBOX_MAX_HEIGHT) . '</note>' |
||
190 | . '<note>' . ustrprocess(get_html_resource(RES_ALERT_FIELD_VALUE_OUT_OF_RANGE_ID), get_html_resource(RES_ROWS_PER_PAGE_ID), MIN_PAGE_SIZE, MAX_PAGE_SIZE) . '</note>' |
||
191 | . '<note>' . ustrprocess(get_html_resource(RES_ALERT_FIELD_VALUE_OUT_OF_RANGE_ID), get_html_resource(RES_BOOKMARKS_PER_PAGE_ID), MIN_PAGE_SIZE, MAX_PAGE_SIZE) . '</note>' |
||
192 | . '<note>' . ustrprocess(get_html_resource(RES_ALERT_FIELD_VALUE_OUT_OF_RANGE_ID), get_html_resource(RES_AUTO_REFRESH_ID), MIN_AUTO_REFRESH, MAX_AUTO_REFRESH) . '</note>' |
||
193 | . '</form>'; |
||
194 | |||
195 | echo(xml2html($xml)); |
||
196 | |||
197 | ?> |
||
198 |
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.