@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | $output = $_lang["status_checking_database"]; |
19 | 19 | if (!$conn = mysqli_connect($host, $uid, $pwd)) { |
20 | 20 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>'; |
21 | -} |
|
22 | -else { |
|
21 | +} else { |
|
23 | 22 | $database_name = mysqli_real_escape_string($conn, $_POST['database_name']); |
24 | 23 | $database_name = str_replace("`", "", $database_name); |
25 | 24 | $tableprefix = mysqli_real_escape_string($conn, $_POST['tableprefix']); |
@@ -31,20 +30,16 @@ discard block |
||
31 | 30 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
32 | 31 | $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";"; |
33 | 32 | |
34 | - if (! mysqli_query($conn, $query)){ |
|
33 | + if (! mysqli_query($conn, $query)) { |
|
35 | 34 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>'; |
36 | - } |
|
37 | - else { |
|
35 | + } else { |
|
38 | 36 | $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>'; |
39 | 37 | } |
40 | - } |
|
41 | - elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) { |
|
38 | + } elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) { |
|
42 | 39 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>'; |
43 | - } |
|
44 | - elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) { |
|
40 | + } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) { |
|
45 | 41 | $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'], $row[1]).'</span>'; |
46 | - } |
|
47 | - else { |
|
42 | + } else { |
|
48 | 43 | $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>'; |
49 | 44 | } |
50 | 45 | } |
@@ -4,10 +4,8 @@ discard block |
||
4 | 4 | global $_lang; |
5 | 5 | |
6 | 6 | // session loop-back tester |
7 | - if(!isset($_GET['action']) || $_GET['action']!=='mode') |
|
8 | - { |
|
9 | - if(!isset($_SESSION['test']) || $_SESSION['test']!=1) |
|
10 | - { |
|
7 | + if(!isset($_GET['action']) || $_GET['action']!=='mode') { |
|
8 | + if(!isset($_SESSION['test']) || $_SESSION['test']!=1) { |
|
11 | 9 | echo ' |
12 | 10 | <html> |
13 | 11 | <head> |
@@ -34,8 +32,7 @@ discard block |
||
34 | 32 | |
35 | 33 | function parse($src,$ph,$left='[+',$right='+]') |
36 | 34 | { |
37 | - foreach($ph as $k=>$v) |
|
38 | - { |
|
35 | + foreach($ph as $k=>$v) { |
|
39 | 36 | $k = $left . $k . $right; |
40 | 37 | $src = str_replace($k,$v,$src); |
41 | 38 | } |
@@ -46,8 +43,11 @@ discard block |
||
46 | 43 | { |
47 | 44 | global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date; |
48 | 45 | |
49 | - if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
50 | - else $installmode = get_installmode(); |
|
46 | + if(isset($_SESSION['installmode'])) { |
|
47 | + $installmode = $_SESSION['installmode']; |
|
48 | + } else { |
|
49 | + $installmode = get_installmode(); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | $ph['pagetitle'] = $_lang['modx_install']; |
53 | 53 | $ph['textdir'] = $modx_textdir ? ' id="rtl"':''; |
@@ -65,29 +65,29 @@ discard block |
||
65 | 65 | global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix; |
66 | 66 | |
67 | 67 | $conf_path = "{$base_path}manager/includes/config.inc.php"; |
68 | - if (!is_file($conf_path)) $installmode = 0; |
|
69 | - elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
70 | - else |
|
71 | - { |
|
68 | + if (!is_file($conf_path)) { |
|
69 | + $installmode = 0; |
|
70 | + } elseif(isset($_POST['installmode'])) { |
|
71 | + $installmode = $_POST['installmode']; |
|
72 | + } else { |
|
72 | 73 | include_once("{$base_path}manager/includes/config.inc.php"); |
73 | 74 | |
74 | - if(!isset($dbase) || empty($dbase)) $installmode = 0; |
|
75 | - else |
|
76 | - { |
|
75 | + if(!isset($dbase) || empty($dbase)) { |
|
76 | + $installmode = 0; |
|
77 | + } else { |
|
77 | 78 | $conn = mysqli_connect($database_server, $database_user, $database_password); |
78 | - if($conn) |
|
79 | - { |
|
79 | + if($conn) { |
|
80 | 80 | $_SESSION['database_server'] = $database_server; |
81 | 81 | $_SESSION['database_user'] = $database_user; |
82 | 82 | $_SESSION['database_password'] = $database_password; |
83 | 83 | |
84 | 84 | $dbase = trim($dbase, '`'); |
85 | 85 | $rs = mysqli_select_db($conn, $dbase); |
86 | + } else { |
|
87 | + $rs = false; |
|
86 | 88 | } |
87 | - else $rs = false; |
|
88 | 89 | |
89 | - if($rs) |
|
90 | - { |
|
90 | + if($rs) { |
|
91 | 91 | $_SESSION['dbase'] = $dbase; |
92 | 92 | $_SESSION['table_prefix'] = $table_prefix; |
93 | 93 | $_SESSION['database_collation'] = 'utf8_general_ci'; |
@@ -95,17 +95,21 @@ discard block |
||
95 | 95 | |
96 | 96 | $tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`"; |
97 | 97 | $rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'"); |
98 | - if($rs) |
|
99 | - { |
|
98 | + if($rs) { |
|
100 | 99 | $row = mysqli_fetch_assoc($rs); |
101 | 100 | $settings_version = $row['setting_value']; |
101 | + } else { |
|
102 | + $settings_version = ''; |
|
102 | 103 | } |
103 | - else $settings_version = ''; |
|
104 | 104 | |
105 | - if (empty($settings_version)) $installmode = 0; |
|
106 | - else $installmode = 1; |
|
105 | + if (empty($settings_version)) { |
|
106 | + $installmode = 0; |
|
107 | + } else { |
|
108 | + $installmode = 1; |
|
109 | + } |
|
110 | + } else { |
|
111 | + $installmode = 1; |
|
107 | 112 | } |
108 | - else $installmode = 1; |
|
109 | 113 | } |
110 | 114 | } |
111 | 115 | return $installmode; |
@@ -478,7 +478,8 @@ discard block |
||
478 | 478 | return s; |
479 | 479 | } |
480 | 480 | |
481 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
481 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
482 | +// Web Link specific ?> |
|
482 | 483 | var lastImageCtrl; |
483 | 484 | var lastFileCtrl; |
484 | 485 | |
@@ -694,7 +695,8 @@ discard block |
||
694 | 695 | </td> |
695 | 696 | </tr> |
696 | 697 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
699 | +// Web Link specific ?> |
|
698 | 700 | |
699 | 701 | <tr> |
700 | 702 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1356,7 +1358,9 @@ discard block |
||
1356 | 1358 | if($documentId > 0) { |
1357 | 1359 | // Load up, the permissions from the parent (if new document) or existing document |
1358 | 1360 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1359 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1361 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
1362 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1363 | + } |
|
1360 | 1364 | |
1361 | 1365 | // Load up the current permissions and names |
1362 | 1366 | $vs = array( |
@@ -1418,7 +1422,9 @@ discard block |
||
1418 | 1422 | |
1419 | 1423 | // Create attribute string list |
1420 | 1424 | $inputString = array(); |
1421 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1425 | + foreach($inputAttributes as $k => $v) { |
|
1426 | + $inputString[] = $k . '="' . $v . '"'; |
|
1427 | + } |
|
1422 | 1428 | |
1423 | 1429 | // Make the <input> HTML |
1424 | 1430 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
1535 | 1541 | } |
1536 | 1542 | } |
1537 | 1543 | |
1538 | -function getDefaultTemplate() { |
|
1544 | +function getDefaultTemplate() |
|
1545 | +{ |
|
1539 | 1546 | global $modx; |
1540 | 1547 | |
1541 | 1548 | switch($modx->config['auto_template_logic']) { |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | 'type7' => $_lang["lock_element_type_7"], |
29 | 29 | 'type8' => $_lang["lock_element_type_8"] |
30 | 30 | ); |
31 | -foreach($unlockTranslations as $key => $value) $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
31 | +foreach($unlockTranslations as $key => $value) { |
|
32 | + $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
33 | +} |
|
32 | 34 | |
33 | 35 | // Prepare lang-strings for mgrResAction() |
34 | 36 | $mraTranslations = array( |
@@ -44,7 +46,9 @@ discard block |
||
44 | 46 | 'confirm_delete_plugin' => $_lang["confirm_delete_plugin"], |
45 | 47 | 'confirm_delete_module' => $_lang["confirm_delete_module"], |
46 | 48 | ); |
47 | -foreach($mraTranslations as $key => $value) $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
49 | +foreach($mraTranslations as $key => $value) { |
|
50 | + $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
|
51 | +} |
|
48 | 52 | ?> |
49 | 53 | <script>var trans = <?php echo json_encode($unlockTranslations); ?>;</script> |
50 | 54 | <script>var mraTrans = <?php echo json_encode($mraTranslations); ?>;</script> |
@@ -101,7 +101,8 @@ discard block |
||
101 | 101 | </div> |
102 | 102 | |
103 | 103 | <?php |
104 | -function run() { |
|
104 | +function run() |
|
105 | +{ |
|
105 | 106 | global $modx; |
106 | 107 | |
107 | 108 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -160,7 +161,8 @@ discard block |
||
160 | 161 | return $output; |
161 | 162 | } |
162 | 163 | |
163 | -function importFiles($parent, $filedir, $files, $mode) { |
|
164 | +function importFiles($parent, $filedir, $files, $mode) |
|
165 | +{ |
|
164 | 166 | global $modx; |
165 | 167 | global $_lang, $allowedfiles; |
166 | 168 | global $search_default, $cache_default, $publish_default; |
@@ -302,7 +304,8 @@ discard block |
||
302 | 304 | } |
303 | 305 | } |
304 | 306 | |
305 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
307 | +function getFiles($directory, $listing = array(), $count = 0) |
|
308 | +{ |
|
306 | 309 | global $_lang; |
307 | 310 | global $filesfound; |
308 | 311 | $dummy = $count; |
@@ -326,7 +329,8 @@ discard block |
||
326 | 329 | return ($listing); |
327 | 330 | } |
328 | 331 | |
329 | -function getFileContent($filepath) { |
|
332 | +function getFileContent($filepath) |
|
333 | +{ |
|
330 | 334 | global $_lang; |
331 | 335 | // get the file |
332 | 336 | if(!$buffer = file_get_contents($filepath)) { |
@@ -336,7 +340,8 @@ discard block |
||
336 | 340 | } |
337 | 341 | } |
338 | 342 | |
339 | -function pop_index($array) { |
|
343 | +function pop_index($array) |
|
344 | +{ |
|
340 | 345 | $new_array = array(); |
341 | 346 | foreach($array as $k => $v) { |
342 | 347 | if($v !== 'index.html' && $v !== 'index.htm') { |
@@ -353,7 +358,8 @@ discard block |
||
353 | 358 | return $new_array; |
354 | 359 | } |
355 | 360 | |
356 | -function treatContent($src, $filename, $alias) { |
|
361 | +function treatContent($src, $filename, $alias) |
|
362 | +{ |
|
357 | 363 | global $modx; |
358 | 364 | |
359 | 365 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
@@ -394,7 +400,8 @@ discard block |
||
394 | 400 | ); |
395 | 401 | } |
396 | 402 | |
397 | -function convertLink() { |
|
403 | +function convertLink() |
|
404 | +{ |
|
398 | 405 | global $modx; |
399 | 406 | $tbl_site_content = $modx->getFullTableName('site_content'); |
400 | 407 |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $MODX_SITE_HOSTNAMES = MODX_SITE_HOSTNAMES; // Fix for PHP 5.4 |
3 | - if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) $valid_hostnames = $_SERVER['HTTP_HOST']; |
|
4 | -?> |
|
3 | + if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) { |
|
4 | + $valid_hostnames = $_SERVER['HTTP_HOST']; |
|
5 | + } |
|
6 | + ?> |
|
5 | 7 | <!-- Interface & editor settings --> |
6 | 8 | <div class="tab-page" id="tabPageSecurity"> |
7 | 9 | <h2 class="tab"><?php echo $_lang['settings_security'] ?></h2> |
@@ -153,7 +155,9 @@ discard block |
||
153 | 155 | <th><?php echo $_lang['pwd_hash_algo_title'] ?><br><small>[(pwd_hash_algo)]</small></th> |
154 | 156 | <td> |
155 | 157 | <?php |
156 | -if(empty($pwd_hash_algo)) $phm['sel']['UNCRYPT'] = 1; |
|
158 | +if(empty($pwd_hash_algo)) { |
|
159 | + $phm['sel']['UNCRYPT'] = 1; |
|
160 | +} |
|
157 | 161 | $phm['e']['BLOWFISH_Y'] = $modx->manager->checkHashAlgorithm('BLOWFISH_Y') ? 0:1; |
158 | 162 | $phm['e']['BLOWFISH_A'] = $modx->manager->checkHashAlgorithm('BLOWFISH_A') ? 0:1; |
159 | 163 | $phm['e']['SHA512'] = $modx->manager->checkHashAlgorithm('SHA512') ? 0:1; |
@@ -182,7 +186,9 @@ discard block |
||
182 | 186 | ?> |
183 | 187 | <?php |
184 | 188 | $gdAvailable = extension_loaded('gd'); |
185 | -if(!$gdAvailable) $use_captcha = 0; |
|
189 | +if(!$gdAvailable) { |
|
190 | + $use_captcha = 0; |
|
191 | +} |
|
186 | 192 | ?> |
187 | 193 | <tr> |
188 | 194 | <td nowrap class="warning"><?php echo $_lang['captcha_title'] ?><br><small>[(use_captcha)]</small></td> |
@@ -127,7 +127,9 @@ |
||
127 | 127 | <?php |
128 | 128 | // invoke OnUserSettingsRender event |
129 | 129 | $evtOut = $modx->invokeEvent('OnUserSettingsRender'); |
130 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
130 | + if(is_array($evtOut)) { |
|
131 | + echo implode("",$evtOut); |
|
132 | + } |
|
131 | 133 | ?> |
132 | 134 | </td> |
133 | 135 | </tr> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | <td> |
24 | 24 | <select name="which_browser" size="1" class="inputBox" onchange="documentDirty=true;"> |
25 | 25 | <?php |
26 | - foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
26 | + foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
27 | 27 | $dir = str_replace('\\', '/', $dir); |
28 | 28 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
29 | 29 | $selected = $browser_name == $which_browser ? ' selected="selected"' : ''; |
@@ -235,7 +235,9 @@ discard block |
||
235 | 235 | <?php |
236 | 236 | // invoke OnMiscSettingsRender event |
237 | 237 | $evtOut = $modx->invokeEvent('OnMiscSettingsRender'); |
238 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
238 | + if(is_array($evtOut)) { |
|
239 | + echo implode("",$evtOut); |
|
240 | + } |
|
239 | 241 | ?> |
240 | 242 | </td> |
241 | 243 | </tr> |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | <select name="manager_theme" size="1" class="inputBox" onChange="documentDirty=true; document.forms['settings'].theme_refresher.value = Date.parse(new Date());"> |
50 | 50 | <?php |
51 | 51 | $dir = dir("media/style/"); |
52 | - while ($file = $dir->read()) { |
|
53 | - if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
54 | - if ($file === 'common') { |
|
52 | + while ($file = $dir->read()) { |
|
53 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
54 | + if ($file === 'common') { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | $themename = $file; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>' . "\n"; |
210 | 210 | $option = explode(',', $_lang['settings_group_tv_options']); |
211 | 211 | $output = array(); |
212 | - foreach ($option as $k => $v) { |
|
212 | + foreach ($option as $k => $v) { |
|
213 | 213 | $selected = ($k == $group_tvs) ? 'selected' : ''; |
214 | 214 | $s = array('[+value+]', '[+selected+]', '[+title+]'); |
215 | 215 | $r = array($k, $selected, $v); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>' . "\n"; |
283 | 283 | $option = array('pagetitle', 'longtitle', 'menutitle', 'alias', 'createdon', 'editedon', 'publishedon'); |
284 | 284 | $output = array(); |
285 | - foreach ($option as $v) { |
|
285 | + foreach ($option as $v) { |
|
286 | 286 | $selected = ($v == $resource_tree_node_name) ? 'selected' : ''; |
287 | 287 | $s = array('[+value+]', '[+selected+]'); |
288 | 288 | $r = array($v, $selected); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | <?php |
364 | 364 | $datetime_format_list = array('dd-mm-YYYY', 'mm/dd/YYYY', 'YYYY/mm/dd'); |
365 | 365 | $str = ''; |
366 | - foreach ($datetime_format_list as $value) { |
|
366 | + foreach ($datetime_format_list as $value) { |
|
367 | 367 | $selectedtext = ($datetime_format == $value) ? ' selected' : ''; |
368 | 368 | $str .= '<option value="' . $value . '"' . $selectedtext . '>'; |
369 | 369 | $str .= $value . '</option>' . PHP_EOL; |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | <?php |
446 | 446 | // invoke OnRichTextEditorRegister event |
447 | 447 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister'); |
448 | - if (!is_array($evtOut)) { |
|
448 | + if (!is_array($evtOut)) { |
|
449 | 449 | $evtOut = array(); |
450 | 450 | $use_editor = 0; |
451 | 451 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | <?php |
478 | 478 | // invoke OnRichTextEditorRegister event |
479 | 479 | echo "<option value='none'" . ($which_editor == 'none' ? " selected='selected'" : "") . ">" . $_lang['none'] . "</option>\n"; |
480 | - if (is_array($evtOut)) { |
|
481 | - foreach ($evtOut as $editor) { |
|
480 | + if (is_array($evtOut)) { |
|
481 | + foreach ($evtOut as $editor) { |
|
482 | 482 | echo "<option value='$editor'" . ($which_editor == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
483 | 483 | } |
484 | 484 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | <?php |
535 | 535 | // invoke OnInterfaceSettingsRender event |
536 | 536 | $evtOut = $modx->invokeEvent('OnInterfaceSettingsRender'); |
537 | - if (is_array($evtOut)) { |
|
537 | + if (is_array($evtOut)) { |
|
538 | 538 | echo implode("", $evtOut); |
539 | 539 | } |
540 | 540 | ?> |