@@ -10,16 +10,20 @@ |
||
10 | 10 | @set_time_limit($maxtime); |
11 | 11 | |
12 | 12 | |
13 | -if(is_dir(MODX_BASE_PATH . 'temp')) $export_dir = MODX_BASE_PATH . 'temp/export'; |
|
14 | -elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export'; |
|
13 | +if(is_dir(MODX_BASE_PATH . 'temp')) { |
|
14 | + $export_dir = MODX_BASE_PATH . 'temp/export'; |
|
15 | +} elseif(is_dir(MODX_BASE_PATH . 'assets')) { |
|
16 | + $export_dir = MODX_BASE_PATH . 'assets/export'; |
|
17 | +} |
|
15 | 18 | $modx->getExportSite()->targetDir = $export_dir; |
16 | 19 | |
17 | -if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) |
|
20 | +if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) { |
|
18 | 21 | return $_lang['export_site.static.php6']; |
19 | -elseif($modx->config['rb_base_dir'] === $export_dir . '/') |
|
22 | +} elseif($modx->config['rb_base_dir'] === $export_dir . '/') { |
|
20 | 23 | return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']); |
21 | -elseif(!is_writable($export_dir)) |
|
24 | +} elseif(!is_writable($export_dir)) { |
|
22 | 25 | return $_lang['export_site_target_unwritable']; |
26 | +} |
|
23 | 27 | |
24 | 28 | $modx->getExportSite()->generate_mode = $_POST['generate_mode']; |
25 | 29 |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | //end webber |
136 | 136 | } |
137 | -} |
|
138 | -elseif ($alias) { |
|
137 | +} elseif ($alias) { |
|
139 | 138 | $alias = $modx->stripAlias($alias); |
140 | 139 | } |
141 | 140 | |
@@ -149,8 +148,7 @@ discard block |
||
149 | 148 | |
150 | 149 | if ($pub_date < $currentdate) { |
151 | 150 | $published = 1; |
152 | - } |
|
153 | - elseif ($pub_date > $currentdate) { |
|
151 | + } elseif ($pub_date > $currentdate) { |
|
154 | 152 | $published = 0; |
155 | 153 | } |
156 | 154 | } |
@@ -277,8 +275,7 @@ discard block |
||
277 | 275 | case 'new' : |
278 | 276 | |
279 | 277 | // invoke OnBeforeDocFormSave event |
280 | - switch($modx->config['docid_incrmnt_method']) |
|
281 | - { |
|
278 | + switch($modx->config['docid_incrmnt_method']) { |
|
282 | 279 | case '1': |
283 | 280 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
284 | 281 | $where = "T1.id IS NULL"; |
@@ -346,8 +343,9 @@ discard block |
||
346 | 343 | "alias_visible" => $aliasvisible |
347 | 344 | ); |
348 | 345 | |
349 | - if ($id != '') |
|
350 | - $dbInsert["id"] = $id; |
|
346 | + if ($id != '') { |
|
347 | + $dbInsert["id"] = $id; |
|
348 | + } |
|
351 | 349 | |
352 | 350 | $key = $modx->getDatabase()->insert($dbInsert, $tbl_site_content); |
353 | 351 | |
@@ -423,11 +421,13 @@ discard block |
||
423 | 421 | // redirect/stay options |
424 | 422 | if ($_POST['stay'] != '') { |
425 | 423 | // weblink |
426 | - if ($_POST['mode'] == "72") |
|
427 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
424 | + if ($_POST['mode'] == "72") { |
|
425 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
426 | + } |
|
428 | 427 | // document |
429 | - if ($_POST['mode'] == "4") |
|
430 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
428 | + if ($_POST['mode'] == "4") { |
|
429 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
430 | + } |
|
431 | 431 | $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay']; |
432 | 432 | } else { |
433 | 433 | $header = "Location: index.php?a=3&id=$key&r=1"; |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | if (!$was_published && $published) { |
489 | 489 | $publishedon = $currentdate; |
490 | 490 | $publishedby = $modx->getLoginUserID(); |
491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
491 | + } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | 492 | $publishedon = $pub_date; |
493 | 493 | $publishedby = $modx->getLoginUserID(); |
494 | - }elseif ($was_published && !$published) { |
|
494 | + } elseif ($was_published && !$published) { |
|
495 | 495 | $publishedon = 0; |
496 | 496 | $publishedby = 0; |
497 | 497 | } else { |
@@ -547,7 +547,9 @@ discard block |
||
547 | 547 | $tvChanges = array(); |
548 | 548 | foreach ($tmplvars as $field => $value) { |
549 | 549 | if (!is_array($value)) { |
550 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
550 | + if (isset($tvIds[$value])) { |
|
551 | + $tvDeletions[] = $tvIds[$value]; |
|
552 | + } |
|
551 | 553 | } else { |
552 | 554 | $tvId = $value[0]; |
553 | 555 | $tvVal = $value[1]; |
@@ -595,7 +597,9 @@ discard block |
||
595 | 597 | "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
596 | 598 | ); |
597 | 599 | $old_groups = array(); |
598 | - while ($row = $modx->getDatabase()->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
600 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
601 | + $old_groups[$row['document_group']] = $row['id']; |
|
602 | + } |
|
599 | 603 | |
600 | 604 | // update the permissions in the database |
601 | 605 | $insertions = $deletions = array(); |
@@ -657,9 +661,9 @@ discard block |
||
657 | 661 | $modx->clearCache('full'); |
658 | 662 | } |
659 | 663 | |
660 | - if ($_POST['refresh_preview'] == '1') |
|
661 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
662 | - else { |
|
664 | + if ($_POST['refresh_preview'] == '1') { |
|
665 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
666 | + } else { |
|
663 | 667 | if ($_POST['stay'] != '2' && $id > 0) { |
664 | 668 | $modx->unlockElement(7, $id); |
665 | 669 | } |
@@ -44,17 +44,23 @@ discard block |
||
44 | 44 | * Initialize Document Parsing |
45 | 45 | * ----------------------------- |
46 | 46 | */ |
47 | -if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
47 | +if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) { |
|
48 | + $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
49 | +} |
|
48 | 50 | |
49 | 51 | $base_path = str_replace('\\','/',dirname(__FILE__)) . '/'; |
50 | -if(is_file($base_path . 'assets/cache/siteManager.php')) |
|
52 | +if(is_file($base_path . 'assets/cache/siteManager.php')) { |
|
51 | 53 | include_once($base_path . 'assets/cache/siteManager.php'); |
52 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
|
54 | +} |
|
55 | +if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
53 | 56 | define('MGR_DIR', 'manager'); |
54 | -if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
|
57 | +} |
|
58 | +if(is_file($base_path . 'assets/cache/siteHostnames.php')) { |
|
55 | 59 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
56 | -if(!defined('MODX_SITE_HOSTNAMES')) |
|
60 | +} |
|
61 | +if(!defined('MODX_SITE_HOSTNAMES')) { |
|
57 | 62 | define('MODX_SITE_HOSTNAMES', ''); |
63 | +} |
|
58 | 64 | |
59 | 65 | // get start time |
60 | 66 | $mstart = memory_get_usage(); |
@@ -126,7 +132,7 @@ discard block |
||
126 | 132 | @ini_set("display_errors","0"); |
127 | 133 | } |
128 | 134 | |
129 | -if(MODX_CLI){ |
|
135 | +if(MODX_CLI) { |
|
130 | 136 | @set_time_limit(0); |
131 | 137 | @ini_set('max_execution_time',0); |
132 | 138 | } |
@@ -199,7 +199,8 @@ discard block |
||
199 | 199 | $c = substr($modifiers, 0, 1); |
200 | 200 | $modifiers = substr($modifiers, 1); |
201 | 201 | |
202 | - if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { // :=, :!=, :<=, :>=, :!<=, :!>= |
|
202 | + if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { |
|
203 | +// :=, :!=, :<=, :>=, :!<=, :!>= |
|
203 | 204 | $c = substr($modifiers, strlen($match[1]), 1); |
204 | 205 | $debuginfo = "#i=0 #c=[{$c}] #m=[{$modifiers}]"; |
205 | 206 | if ($c === '(') { |
@@ -215,7 +216,8 @@ discard block |
||
215 | 216 | $result[] = array('cmd' => trim($match[1]), 'opt' => $opt, 'debuginfo' => $debuginfo); |
216 | 217 | $cmd = ''; |
217 | 218 | } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers, |
218 | - $match)) { // :+3, :-3, :*3 ... |
|
219 | + $match)) { |
|
220 | +// :+3, :-3, :*3 ... |
|
219 | 221 | $modifiers = substr($modifiers, strlen($match[0])); |
220 | 222 | $result[] = array('cmd' => 'math', 'opt' => '%s' . $c . $match[0]); |
221 | 223 | $cmd = ''; |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate htmlsnippet |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -13,8 +13,11 @@ |
||
13 | 13 | // count duplicates |
14 | 14 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'")); |
15 | 15 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
16 | -if($count>=1) $count = ' '.($count+1); |
|
17 | -else $count = ''; |
|
16 | +if($count>=1) { |
|
17 | + $count = ' '.($count+1); |
|
18 | +} else { |
|
19 | + $count = ''; |
|
20 | +} |
|
18 | 21 | |
19 | 22 | // duplicate module |
20 | 23 | $newid = $modx->getDatabase()->insert( |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate template |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_tmplvars'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate TV |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -4,7 +4,9 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!isset($_GET['id'])) { |
7 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + if(!$modx->hasPermission('remove_locks')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
8 | 10 | |
9 | 11 | // Remove all locks |
10 | 12 | $modx->getDatabase()->truncate($modx->getDatabase()->getFullTableName('active_user_locks')); |