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 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
||
3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
||
4 | } |
||
5 | |||
6 | // PROCESSOR FIRST |
||
7 | if($_SESSION['mgrRole'] == 1) { |
||
8 | if(!empty($_REQUEST['b']) && $_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
||
9 | $current = $modx->getManagerApi()->getSystemChecksum($modx->config['check_files_onlogin']); |
||
10 | if(!empty($current)) { |
||
11 | $modx->getManagerApi()->setSystemChecksum($current); |
||
12 | $modx->clearCache('full'); |
||
13 | $modx->config['sys_files_checksum'] = $current; |
||
14 | }; |
||
15 | } |
||
16 | } |
||
17 | |||
18 | // NOW CHECK CONFIG |
||
19 | $warningspresent = 0; |
||
20 | |||
21 | $sysfiles_check = $modx->getManagerApi()->checkSystemChecksum(); |
||
22 | if ($sysfiles_check!=='0'){ |
||
23 | $warningspresent = 1; |
||
24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
||
25 | } |
||
26 | |||
27 | if (is_writable("includes/config.inc.php")){ |
||
28 | // Warn if world writable |
||
29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
||
30 | $warningspresent = 1; |
||
31 | $warnings[] = array($_lang['configcheck_configinc']); |
||
32 | } |
||
33 | } |
||
34 | |||
35 | if (file_exists("../install/")) { |
||
36 | $warningspresent = 1; |
||
37 | $warnings[] = array($_lang['configcheck_installer']); |
||
38 | } |
||
39 | |||
40 | if (!extension_loaded('gd') || !extension_loaded('zip')) { |
||
41 | $warningspresent = 1; |
||
42 | $warnings[] = array($_lang['configcheck_php_gdzip']); |
||
43 | } |
||
44 | |||
45 | if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
||
46 | if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
||
47 | if ($modx->getDatabase()->getValue($modx->getDatabase()->select('COUNT(setting_value)', $modx->getDatabase()->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) { |
||
48 | $warningspresent = 1; |
||
49 | $warnings[] = array($_lang['configcheck_validate_referer']); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 | |||
54 | // check for Template Switcher plugin |
||
55 | if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
||
56 | if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
||
57 | $rs = $modx->getDatabase()->select('name, disabled', $modx->getDatabase()->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'"); |
||
58 | $row = $modx->getDatabase()->getRow($rs); |
||
59 | if($row && $row['disabled'] == 0) { |
||
60 | $warningspresent = 1; |
||
61 | $warnings[] = array($_lang['configcheck_templateswitcher_present']); |
||
62 | $tplName = $row['name']; |
||
63 | $script = <<<JS |
||
64 | <script type="text/javascript"> |
||
65 | function deleteTemplateSwitcher(){ |
||
66 | if(confirm('{$_lang["confirm_delete_plugin"]}')) { |
||
67 | var myAjax = new Ajax('index.php?a=118', { |
||
68 | method: 'post', |
||
69 | data: 'action=updateplugin&key=_delete_&lang=$tplName' |
||
70 | }); |
||
71 | myAjax.addEvent('onComplete', function(resp){ |
||
72 | fieldset = $('templateswitcher_present_warning_wrapper').getParent().getParent(); |
||
73 | var sl = new Fx.Slide(fieldset); |
||
74 | sl.slideOut(); |
||
75 | }); |
||
76 | myAjax.request(); |
||
77 | } |
||
78 | } |
||
79 | function disableTemplateSwitcher(){ |
||
80 | var myAjax = new Ajax('index.php?a=118', { |
||
81 | method: 'post', |
||
82 | data: 'action=updateplugin&lang={$tplName}&key=disabled&value=1' |
||
83 | }); |
||
84 | myAjax.addEvent('onComplete', function(resp){ |
||
85 | fieldset = $('templateswitcher_present_warning_wrapper').getParent().getParent(); |
||
86 | var sl = new Fx.Slide(fieldset); |
||
87 | sl.slideOut(); |
||
88 | }); |
||
89 | myAjax.request(); |
||
90 | } |
||
91 | </script> |
||
92 | |||
93 | JS; |
||
94 | $modx->regClientScript($script); |
||
95 | } |
||
96 | } |
||
97 | } |
||
98 | |||
99 | View Code Duplication | if ($modx->getDatabase()->getValue($modx->getDatabase()->select('published', $modx->getDatabase()->getFullTableName('site_content'), "id='{$modx->config['unauthorized_page']}'")) == 0) { |
|
100 | $warningspresent = 1; |
||
101 | $warnings[] = array($_lang['configcheck_unauthorizedpage_unpublished']); |
||
102 | } |
||
103 | |||
104 | View Code Duplication | if ($modx->getDatabase()->getValue($modx->getDatabase()->select('published', $modx->getDatabase()->getFullTableName('site_content'), "id='{$modx->config['error_page']}'")) == 0) { |
|
105 | $warningspresent = 1; |
||
106 | $warnings[] = array($_lang['configcheck_errorpage_unpublished']); |
||
107 | } |
||
108 | |||
109 | View Code Duplication | if ($modx->getDatabase()->getValue($modx->getDatabase()->select('privateweb', $modx->getDatabase()->getFullTableName('site_content'), "id='{$modx->config['unauthorized_page']}'")) == 1) { |
|
110 | $warningspresent = 1; |
||
111 | $warnings[] = array($_lang['configcheck_unauthorizedpage_unavailable']); |
||
112 | } |
||
113 | |||
114 | View Code Duplication | if ($modx->getDatabase()->getValue($modx->getDatabase()->select('privateweb', $modx->getDatabase()->getFullTableName('site_content'), "id='{$modx->config['error_page']}'")) == 1) { |
|
115 | $warningspresent = 1; |
||
116 | $warnings[] = array($_lang['configcheck_errorpage_unavailable']); |
||
117 | } |
||
118 | |||
119 | if (!function_exists('checkSiteCache')) { |
||
120 | /** |
||
121 | * @return bool |
||
122 | */ |
||
123 | function checkSiteCache() { |
||
124 | $modx = evolutionCMS(); |
||
0 ignored issues
–
show
|
|||
125 | $checked= true; |
||
126 | if (file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php')) { |
||
127 | $checked= @include_once (MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'); |
||
0 ignored issues
–
show
Equals sign not aligned correctly; expected 1 space but found 0 spaces
This check looks for improperly formatted assignments. Every assignment must have exactly one space before and one space after the equals operator. To illustrate: $a = "a";
$ab = "ab";
$abc = "abc";
will have no issues, while $a = "a";
$ab = "ab";
$abc = "abc";
will report issues in lines 1 and 2. ![]() |
|||
128 | } |
||
129 | return $checked; |
||
130 | } |
||
131 | } |
||
132 | |||
133 | View Code Duplication | if (!is_writable(MODX_BASE_PATH . "assets/cache/")) { |
|
134 | $warningspresent = 1; |
||
135 | $warnings[] = array($_lang['configcheck_cache']); |
||
136 | } |
||
137 | |||
138 | if (!checkSiteCache()) { |
||
139 | $warningspresent = 1; |
||
140 | $warnings[]= array($lang['configcheck_sitecache_integrity']); |
||
141 | } |
||
142 | |||
143 | View Code Duplication | if (!is_writable(MODX_BASE_PATH . "assets/images/")) { |
|
144 | $warningspresent = 1; |
||
145 | $warnings[] = array($_lang['configcheck_images']); |
||
146 | } |
||
147 | |||
148 | View Code Duplication | if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) { |
|
149 | $warningspresent = 1; |
||
150 | $warnings[] = array($_lang['configcheck_rb_base_dir']); |
||
151 | } |
||
152 | View Code Duplication | if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) { |
|
153 | $warningspresent = 1; |
||
154 | $warnings[] = array($_lang['configcheck_filemanager_path']); |
||
155 | } |
||
156 | |||
157 | // clear file info cache |
||
158 | clearstatcache(); |
||
159 | |||
160 | if ($warningspresent==1) { |
||
161 | |||
162 | if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
||
163 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
||
164 | |||
165 | for ($i=0;$i<count($warnings);$i++) { |
||
166 | switch ($warnings[$i][0]) { |
||
167 | View Code Duplication | case $_lang['configcheck_configinc']; |
|
0 ignored issues
–
show
case statements should be defined using a colon.
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces.
There is no need for braces, since each case is terminated by the next There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages. switch ($expr) {
case "A": { //wrong
doSomething();
break;
}
case "B"; //wrong
doSomething();
break;
case "C": //right
doSomething();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
168 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
||
169 | if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
||
170 | break; |
||
171 | View Code Duplication | case $_lang['configcheck_installer'] : |
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
172 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
||
173 | if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
||
174 | break; |
||
175 | View Code Duplication | case $_lang['configcheck_cache'] : |
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
176 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
||
177 | if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
||
178 | break; |
||
179 | View Code Duplication | case $_lang['configcheck_images'] : |
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
180 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
||
181 | if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
||
182 | break; |
||
183 | case $_lang['configcheck_sysfiles_mod']: |
||
184 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
||
185 | $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
||
186 | if($modx->hasPermission('settings')) { |
||
187 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
||
188 | } |
||
189 | if(empty($_SESSION["mgrConfigCheck"])) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
||
190 | break; |
||
191 | case $_lang['configcheck_lang_difference'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
192 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
||
193 | break; |
||
194 | case $_lang['configcheck_php_gdzip'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
195 | $warnings[$i][1] = $_lang['configcheck_php_gdzip_msg']; |
||
196 | break; |
||
197 | case $_lang['configcheck_unauthorizedpage_unpublished'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
198 | $warnings[$i][1] = $_lang['configcheck_unauthorizedpage_unpublished_msg']; |
||
199 | break; |
||
200 | case $_lang['configcheck_errorpage_unpublished'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
201 | $warnings[$i][1] = $_lang['configcheck_errorpage_unpublished_msg']; |
||
202 | break; |
||
203 | case $_lang['configcheck_unauthorizedpage_unavailable'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
204 | $warnings[$i][1] = $_lang['configcheck_unauthorizedpage_unavailable_msg']; |
||
205 | break; |
||
206 | case $_lang['configcheck_errorpage_unavailable'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
207 | $warnings[$i][1] = $_lang['configcheck_errorpage_unavailable_msg']; |
||
208 | break; |
||
209 | case $_lang['configcheck_validate_referer'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
210 | $msg = $_lang['configcheck_validate_referer_msg']; |
||
211 | $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
||
212 | $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
||
213 | break; |
||
214 | case $_lang['configcheck_templateswitcher_present'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
215 | $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
||
216 | View Code Duplication | if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
217 | $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
||
218 | } |
||
219 | View Code Duplication | if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
220 | $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
||
221 | } |
||
222 | $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
||
223 | $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
||
224 | break; |
||
225 | case $_lang['configcheck_rb_base_dir'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
226 | $warnings[$i][1] = $_lang['configcheck_rb_base_dir_msg']; |
||
227 | break; |
||
228 | case $_lang['configcheck_filemanager_path'] : |
||
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
229 | $warnings[$i][1] = $_lang['configcheck_filemanager_path_msg']; |
||
230 | break; |
||
231 | default : |
||
0 ignored issues
–
show
There must be no space before the colon in a DEFAULT statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in the default statement. switch ($expr) {
default : //wrong
doSomething();
break;
}
switch ($expr) {
default: //right
doSomething();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
232 | $warnings[$i][1] = $_lang['configcheck_default_msg']; |
||
233 | } |
||
234 | |||
235 | $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |
||
236 | $config_check_results .= " |
||
237 | <fieldset> |
||
238 | <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p> |
||
239 | <p style=\"padding-left:1em\"><em>".$_lang['configcheck_what']."</em><br /> |
||
240 | ".$warnings[$i][1]." ".$admin_warning."</p> |
||
241 | ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')." |
||
242 | </fieldset> |
||
243 | "; |
||
244 | if ($i!=count($warnings)-1) { |
||
245 | $config_check_results .= "<br />"; |
||
246 | } |
||
247 | } |
||
248 | $_SESSION["mgrConfigCheck"]=true; |
||
0 ignored issues
–
show
Equals sign not aligned correctly; expected 1 space but found 0 spaces
This check looks for improperly formatted assignments. Every assignment must have exactly one space before and one space after the equals operator. To illustrate: $a = "a";
$ab = "ab";
$abc = "abc";
will have no issues, while $a = "a";
$ab = "ab";
$abc = "abc";
will report issues in lines 1 and 2. ![]() |
|||
249 | } else { |
||
250 | $config_check_results = $_lang['configcheck_ok']; |
||
251 | } |
||
252 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.