@@ -139,11 +139,14 @@ |
||
| 139 | 139 | * @param string $itemid |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | -function getAction($actionId, $itemid='') { |
|
| 142 | +function getAction($actionId, $itemid='') |
|
| 143 | +{ |
|
| 143 | 144 | global $action_list; |
| 144 | 145 | |
| 145 | 146 | $ret = sprintf($action_list[$actionId], $itemid); |
| 146 | - if (!$ret) $ret = "Idle (unknown)"; |
|
| 147 | + if (!$ret) { |
|
| 148 | + $ret = "Idle (unknown)"; |
|
| 149 | + } |
|
| 147 | 150 | |
| 148 | 151 | return $ret; |
| 149 | 152 | } |
@@ -7,15 +7,17 @@ |
||
| 7 | 7 | |
| 8 | 8 | global $database_type; |
| 9 | 9 | |
| 10 | -if (empty($database_type)) $database_type = 'mysql'; |
|
| 10 | +if (empty($database_type)) { |
|
| 11 | + $database_type = 'mysql'; |
|
| 12 | +} |
|
| 11 | 13 | |
| 12 | 14 | $out = false; |
| 13 | 15 | $class = 'DBAPI'; |
| 14 | -if( ! class_exists($class)){ |
|
| 16 | +if( ! class_exists($class)) { |
|
| 15 | 17 | include_once MODX_MANAGER_PATH . 'includes/extenders/dbapi.' . $database_type . '.class.inc.php'; |
| 16 | 18 | } |
| 17 | 19 | |
| 18 | -if(class_exists($class)){ |
|
| 20 | +if(class_exists($class)) { |
|
| 19 | 21 | $this->db= new $class; |
| 20 | 22 | $out = true; |
| 21 | 23 | } |
@@ -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 | } |