@@ -279,7 +279,8 @@ discard block |
||
279 | 279 | $row['count'] = $this->count; |
280 | 280 | $row['url'] = $modx->makeUrl($row['id']); |
281 | 281 | |
282 | - if (!$row['wasNull']) { // needs writing a document |
|
282 | + if (!$row['wasNull']) { |
|
283 | +// needs writing a document |
|
283 | 284 | $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix); |
284 | 285 | $filename = $dirpath . $docname; |
285 | 286 | if (!is_file($filename)) { |
@@ -307,7 +308,8 @@ discard block |
||
307 | 308 | $this->output[] = $this->parsePlaceholder($_lang['export_site_exporting_document'], $row); |
308 | 309 | } |
309 | 310 | if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'], |
310 | - '.') === false)) { // needs making a folder |
|
311 | + '.') === false)) { |
|
312 | +// needs making a folder |
|
311 | 313 | $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id']; |
312 | 314 | $dir_path = $dirpath . $end_dir; |
313 | 315 | if (strpos($dir_path, MODX_BASE_PATH) === false) { |
@@ -373,7 +373,8 @@ discard block |
||
373 | 373 | * @return bool|mixed|mysqli_result |
374 | 374 | */ |
375 | 375 | public function save($fields, $table, $where = '') |
376 | - { // This is similar to "replace into table". |
|
376 | + { |
|
377 | +// This is similar to "replace into table". |
|
377 | 378 | |
378 | 379 | if ($where === '') { |
379 | 380 | $mode = 'insert'; |
@@ -490,7 +491,7 @@ discard block |
||
490 | 491 | { |
491 | 492 | $out = false; |
492 | 493 | if ($ds instanceof mysqli_result) { |
493 | - switch($mode){ |
|
494 | + switch($mode) { |
|
494 | 495 | case 'assoc': |
495 | 496 | $out = $ds->fetch_assoc(); |
496 | 497 | break; |
@@ -457,7 +457,8 @@ |
||
457 | 457 | if ($this->formElementType) { |
458 | 458 | $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table; |
459 | 459 | } |
460 | - if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists. |
|
460 | + if (strlen($this->pageNav) > 1) { |
|
461 | +//changed to display the pagination if exists. |
|
461 | 462 | /* commented this part because of cookie |
462 | 463 | $table .= '<div id="max-display-records" ><select style="display:inline" onchange="javascript:updatePageSize(this[this.selectedIndex].value);">'; |
463 | 464 | $pageSizes= array (10, 25, 50, 100, 250); |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
22 | 22 | include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
23 | 23 | if (isset($installStartTime)) { |
24 | - if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
|
24 | + if ((time() - $installStartTime) > 5 * 60) { |
|
25 | +// if install flag older than 5 minutes, discard |
|
25 | 26 | unset($installStartTime); |
26 | 27 | @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
27 | 28 | unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
@@ -163,7 +164,8 @@ discard block |
||
163 | 164 | } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
164 | 165 | $target = $theme_path . 'templates/actions/login.tpl'; |
165 | 166 | $login_tpl = file_get_contents($target); |
166 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
167 | + } elseif (is_file($theme_path . 'html/login.html')) { |
|
168 | +// ClipperCMS compatible |
|
167 | 169 | $target = $theme_path . 'html/login.html'; |
168 | 170 | $login_tpl = file_get_contents($target); |
169 | 171 | } else { |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @return string |
18 | 18 | */ |
19 | -function createGUID(){ |
|
19 | +function createGUID() |
|
20 | +{ |
|
20 | 21 | srand((double)microtime()*1000000); |
21 | 22 | $r = rand() ; |
22 | 23 | $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
@@ -27,8 +28,11 @@ discard block |
||
27 | 28 | // count duplicates |
28 | 29 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
29 | 30 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
30 | -if($count>=1) $count = ' '.($count+1); |
|
31 | -else $count = ''; |
|
31 | +if($count>=1) { |
|
32 | + $count = ' '.($count+1); |
|
33 | +} else { |
|
34 | + $count = ''; |
|
35 | +} |
|
32 | 36 | |
33 | 37 | // duplicate module |
34 | 38 | $newid = $modx->db->insert( |
@@ -17,10 +17,14 @@ discard block |
||
17 | 17 | $pth = str_replace("\\","/",$pth); |
18 | 18 | if(isset($_GET["rminstall"])) { |
19 | 19 | if(is_dir($pth)) { |
20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
20 | + if(!rmdirRecursive($pth)) { |
|
21 | + $msg="An error occured while attempting to remove the install folder"; |
|
22 | + } |
|
21 | 23 | } |
22 | 24 | } |
23 | -if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
25 | +if($msg) { |
|
26 | + echo "<script>alert('".addslashes($msg)."');</script>"; |
|
27 | +} |
|
24 | 28 | echo "<script>window.location='../index.php?a=2';</script>"; |
25 | 29 | |
26 | 30 | /** |
@@ -30,13 +34,13 @@ discard block |
||
30 | 34 | * @param bool $followLinks |
31 | 35 | * @return bool |
32 | 36 | */ |
33 | -function rmdirRecursive($path, $followLinks=false) { |
|
37 | +function rmdirRecursive($path, $followLinks=false) |
|
38 | +{ |
|
34 | 39 | $dir = opendir($path) ; |
35 | 40 | while ($entry = readdir($dir)) { |
36 | 41 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
37 | 42 | @unlink( "$path/$entry" ); |
38 | - } |
|
39 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
43 | + } elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
40 | 44 | rmdirRecursive("$path/$entry"); // recursive |
41 | 45 | } |
42 | 46 | } |
@@ -50,17 +50,23 @@ discard block |
||
50 | 50 | include_once($autoloader); |
51 | 51 | } |
52 | 52 | |
53 | -if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
53 | +if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) { |
|
54 | + $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
55 | +} |
|
54 | 56 | |
55 | 57 | $base_path = str_replace('\\','/',dirname(__FILE__)) . '/'; |
56 | -if(is_file($base_path . 'assets/cache/siteManager.php')) |
|
58 | +if(is_file($base_path . 'assets/cache/siteManager.php')) { |
|
57 | 59 | include_once($base_path . 'assets/cache/siteManager.php'); |
58 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
|
60 | +} |
|
61 | +if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
59 | 62 | define('MGR_DIR', 'manager'); |
60 | -if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
|
63 | +} |
|
64 | +if(is_file($base_path . 'assets/cache/siteHostnames.php')) { |
|
61 | 65 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
62 | -if(!defined('MODX_SITE_HOSTNAMES')) |
|
66 | +} |
|
67 | +if(!defined('MODX_SITE_HOSTNAMES')) { |
|
63 | 68 | define('MODX_SITE_HOSTNAMES', ''); |
69 | +} |
|
64 | 70 | |
65 | 71 | // get start time |
66 | 72 | $mstart = memory_get_usage(); |
@@ -129,7 +135,7 @@ discard block |
||
129 | 135 | @ini_set("display_errors","0"); |
130 | 136 | } |
131 | 137 | |
132 | -if(MODX_CLI){ |
|
138 | +if(MODX_CLI) { |
|
133 | 139 | @set_time_limit(0); |
134 | 140 | @ini_set('max_execution_time',0); |
135 | 141 | } |
@@ -104,7 +104,8 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function run() { |
|
107 | +function run() |
|
108 | +{ |
|
108 | 109 | $modx = evolutionCMS(); global $_lang; |
109 | 110 | |
110 | 111 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -171,7 +172,8 @@ discard block |
||
171 | 172 | * @param array $files |
172 | 173 | * @param string $mode |
173 | 174 | */ |
174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
175 | +function importFiles($parent, $filedir, $files, $mode) |
|
176 | +{ |
|
175 | 177 | $modx = evolutionCMS(); |
176 | 178 | global $_lang, $allowedfiles; |
177 | 179 | global $search_default, $cache_default, $publish_default; |
@@ -318,7 +320,8 @@ discard block |
||
318 | 320 | * @param int $count |
319 | 321 | * @return array |
320 | 322 | */ |
321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
323 | +function getFiles($directory, $listing = array(), $count = 0) |
|
324 | +{ |
|
322 | 325 | global $_lang; |
323 | 326 | global $filesfound; |
324 | 327 | $dummy = $count; |
@@ -346,7 +349,8 @@ discard block |
||
346 | 349 | * @param string $filepath |
347 | 350 | * @return bool|string |
348 | 351 | */ |
349 | -function getFileContent($filepath) { |
|
352 | +function getFileContent($filepath) |
|
353 | +{ |
|
350 | 354 | global $_lang; |
351 | 355 | // get the file |
352 | 356 | if(!$buffer = file_get_contents($filepath)) { |
@@ -360,7 +364,8 @@ discard block |
||
360 | 364 | * @param array $array |
361 | 365 | * @return array |
362 | 366 | */ |
363 | -function pop_index($array) { |
|
367 | +function pop_index($array) |
|
368 | +{ |
|
364 | 369 | $new_array = array(); |
365 | 370 | foreach($array as $k => $v) { |
366 | 371 | if($v !== 'index.html' && $v !== 'index.htm') { |
@@ -383,7 +388,8 @@ discard block |
||
383 | 388 | * @param string $alias |
384 | 389 | * @return array |
385 | 390 | */ |
386 | -function treatContent($src, $filename, $alias) { |
|
391 | +function treatContent($src, $filename, $alias) |
|
392 | +{ |
|
387 | 393 | $modx = evolutionCMS(); |
388 | 394 | |
389 | 395 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
@@ -427,7 +433,8 @@ discard block |
||
427 | 433 | /** |
428 | 434 | * @return void |
429 | 435 | */ |
430 | -function convertLink() { |
|
436 | +function convertLink() |
|
437 | +{ |
|
431 | 438 | $modx = evolutionCMS(); |
432 | 439 | $tbl_site_content = $modx->getFullTableName('site_content'); |
433 | 440 |
@@ -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> |
@@ -1353,7 +1355,9 @@ discard block |
||
1353 | 1355 | if($documentId > 0) { |
1354 | 1356 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1357 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1358 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
1359 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1360 | + } |
|
1357 | 1361 | |
1358 | 1362 | // Load up the current permissions and names |
1359 | 1363 | $vs = array( |
@@ -1415,7 +1419,9 @@ discard block |
||
1415 | 1419 | |
1416 | 1420 | // Create attribute string list |
1417 | 1421 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1422 | + foreach($inputAttributes as $k => $v) { |
|
1423 | + $inputString[] = $k . '="' . $v . '"'; |
|
1424 | + } |
|
1419 | 1425 | |
1420 | 1426 | // Make the <input> HTML |
1421 | 1427 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
1535 | 1541 | /** |
1536 | 1542 | * @return string |
1537 | 1543 | */ |
1538 | -function getDefaultTemplate() { |
|
1544 | +function getDefaultTemplate() |
|
1545 | +{ |
|
1539 | 1546 | $modx = evolutionCMS(); |
1540 | 1547 | |
1541 | 1548 | $default_template = ''; |