@@ -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 |
@@ -13,8 +13,11 @@ |
||
13 | 13 | // count duplicates |
14 | 14 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
15 | 15 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->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( |
@@ -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 | } |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->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( |
@@ -12,12 +12,20 @@ discard block |
||
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if($documentID==$newParentID) { |
|
16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
17 | +} |
|
18 | +if($documentID <= 0) { |
|
19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
20 | +} |
|
21 | +if($newParentID < 0) { |
|
22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
23 | +} |
|
18 | 24 | |
19 | 25 | $parents = $modx->getParentIds($newParentID); |
20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
26 | +if (in_array($documentID, $parents)) { |
|
27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
28 | +} |
|
21 | 29 | |
22 | 30 | $rs = $modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
23 | 31 | $oldparent = $modx->getDatabase()->getValue($rs); |
@@ -42,11 +50,11 @@ discard block |
||
42 | 50 | "old_parent" => $oldparent, |
43 | 51 | "new_parent" => $newParentID |
44 | 52 | )); |
45 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
53 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
46 | 54 | $newParent = array_pop($evtOut); |
47 | 55 | if($newParent == $oldparent) { |
48 | 56 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
49 | - }else{ |
|
57 | + } else { |
|
50 | 58 | $newParentID = $newParent; |
51 | 59 | } |
52 | 60 | } |
@@ -9,39 +9,27 @@ discard block |
||
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
10 | 10 | unset($_POST); |
11 | 11 | |
12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
13 | -{ |
|
12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
14 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
15 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
16 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
17 | - if(is_file($htaccess)) |
|
18 | - { |
|
16 | + if(is_file($htaccess)) { |
|
19 | 17 | $_ = file_get_contents($htaccess); |
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
18 | + if(strpos($_,'RewriteBase')===false) { |
|
22 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
20 | + } elseif(is_writable($htaccess)) { |
|
26 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
22 | + if(!@file_put_contents($htaccess,$_)) { |
|
29 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
30 | 24 | } |
31 | 25 | } |
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
36 | - { |
|
26 | + } elseif(is_file($sample_htaccess)) { |
|
27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
37 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
38 | - } |
|
39 | - elseif($modx->config['base_url']!=='/') |
|
40 | - { |
|
29 | + } elseif($modx->config['base_url']!=='/') { |
|
41 | 30 | $_ = file_get_contents($htaccess); |
42 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
32 | + if(!@file_put_contents($htaccess,$_)) { |
|
45 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
46 | 34 | } |
47 | 35 | } |
@@ -73,7 +61,7 @@ discard block |
||
73 | 61 | $v = htmlspecialchars($v); |
74 | 62 | break; |
75 | 63 | case 'settings_version':{ |
76 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
64 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
77 | 65 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
78 | 66 | $v = $modx->getVersionData('version'); |
79 | 67 | } |
@@ -134,7 +122,9 @@ discard block |
||
134 | 122 | |
135 | 123 | $modx->config[$k] = $v; |
136 | 124 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
125 | + if(!empty($k)) { |
|
126 | + $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
127 | + } |
|
138 | 128 | } |
139 | 129 | |
140 | 130 | // Run a single query to save all the values |
@@ -148,8 +138,11 @@ discard block |
||
148 | 138 | $oldtemplate = (int)$data['old_template']; |
149 | 139 | $tbl = $modx->getFullTableName('site_content'); |
150 | 140 | $reset = $data['reset_template']; |
151 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
141 | + if($reset==1) { |
|
142 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
143 | + } else if($reset==2) { |
|
144 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
145 | + } |
|
153 | 146 | } |
154 | 147 | |
155 | 148 | // empty cache |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "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 Plugin |
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->getFullTableName('site_snippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "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 Snippet |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getFullTableName('site_templates'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->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( |