@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_snippet')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('exec_module')) { |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
5 | +if(!$modx->hasPermission('exec_module')) { |
|
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
6 | 8 | |
@@ -10,7 +12,7 @@ discard block |
||
10 | 12 | } |
11 | 13 | |
12 | 14 | // check if user has access permission, except admins |
13 | -if($_SESSION['mgrRole']!=1){ |
|
15 | +if($_SESSION['mgrRole']!=1) { |
|
14 | 16 | $rs = $modx->db->select( |
15 | 17 | 'sma.usergroup,mg.member', |
16 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -62,7 +64,8 @@ discard block |
||
62 | 64 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
63 | 65 | |
64 | 66 | // evalModule |
65 | -function evalModule($moduleCode,$params){ |
|
67 | +function evalModule($moduleCode,$params) |
|
68 | +{ |
|
66 | 69 | global $modx; |
67 | 70 | $modx->event->params = &$params; // store params inside event object |
68 | 71 | if(is_array($params)) { |
@@ -72,11 +75,9 @@ discard block |
||
72 | 75 | $mod = eval($moduleCode); |
73 | 76 | $msg = ob_get_contents(); |
74 | 77 | ob_end_clean(); |
75 | - if (isset($php_errormsg)) |
|
76 | - { |
|
78 | + if (isset($php_errormsg)) { |
|
77 | 79 | $error_info = error_get_last(); |
78 | - switch($error_info['type']) |
|
79 | - { |
|
80 | + switch($error_info['type']) { |
|
80 | 81 | case E_NOTICE : |
81 | 82 | $error_level = 1; |
82 | 83 | case E_USER_NOTICE : |
@@ -89,8 +90,7 @@ discard block |
||
89 | 90 | default: |
90 | 91 | $error_level = 99; |
91 | 92 | } |
92 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
93 | - { |
|
93 | + if($modx->config['error_reporting']==='99' || 2<$error_level) { |
|
94 | 94 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
95 | 95 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
96 | 96 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('web_access_permissions')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -115,7 +117,7 @@ discard block |
||
115 | 117 | } |
116 | 118 | |
117 | 119 | // secure web documents - flag as private |
118 | -if($updategroupaccess==true){ |
|
120 | +if($updategroupaccess==true) { |
|
119 | 121 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
120 | 122 | secureWebDocument(); |
121 | 123 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('new_module')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -10,7 +12,8 @@ discard block |
||
10 | 12 | } |
11 | 13 | |
12 | 14 | // create globally unique identifiers (guid) |
13 | -function createGUID(){ |
|
15 | +function createGUID() |
|
16 | +{ |
|
14 | 17 | srand((double)microtime()*1000000); |
15 | 18 | $r = rand() ; |
16 | 19 | $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
@@ -21,8 +24,11 @@ discard block |
||
21 | 24 | // count duplicates |
22 | 25 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
23 | 26 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
24 | -if($count>=1) $count = ' '.($count+1); |
|
25 | -else $count = ''; |
|
27 | +if($count>=1) { |
|
28 | + $count = ' '.($count+1); |
|
29 | +} else { |
|
30 | + $count = ''; |
|
31 | +} |
|
26 | 32 | |
27 | 33 | // duplicate module |
28 | 34 | $newid = $modx->db->insert( |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_document')) { |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
5 | +if(!$modx->hasPermission('delete_document')) { |
|
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
6 | 8 | |
@@ -42,7 +44,8 @@ discard block |
||
42 | 44 | |
43 | 45 | $children = array(); |
44 | 46 | |
45 | -function getChildren($parent) { |
|
47 | +function getChildren($parent) |
|
48 | +{ |
|
46 | 49 | |
47 | 50 | global $modx; |
48 | 51 | global $children; |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('settings')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -7,39 +9,27 @@ discard block |
||
7 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
8 | 10 | unset($_POST); |
9 | 11 | |
10 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
11 | -{ |
|
12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
12 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
13 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
14 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
15 | - if(is_file($htaccess)) |
|
16 | - { |
|
16 | + if(is_file($htaccess)) { |
|
17 | 17 | $_ = file_get_contents($htaccess); |
18 | - if(strpos($_,'RewriteBase')===false) |
|
19 | - { |
|
18 | + if(strpos($_,'RewriteBase')===false) { |
|
20 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
21 | - } |
|
22 | - elseif(is_writable($htaccess)) |
|
23 | - { |
|
20 | + } elseif(is_writable($htaccess)) { |
|
24 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
25 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | - { |
|
22 | + if(!@file_put_contents($htaccess,$_)) { |
|
27 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
28 | 24 | } |
29 | 25 | } |
30 | - } |
|
31 | - elseif(is_file($sample_htaccess)) |
|
32 | - { |
|
33 | - if(!@rename($sample_htaccess,$htaccess)) |
|
34 | - { |
|
26 | + } elseif(is_file($sample_htaccess)) { |
|
27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
35 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
36 | - } |
|
37 | - elseif($modx->config['base_url']!=='/') |
|
38 | - { |
|
29 | + } elseif($modx->config['base_url']!=='/') { |
|
39 | 30 | $_ = file_get_contents($htaccess); |
40 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
41 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | - { |
|
32 | + if(!@file_put_contents($htaccess,$_)) { |
|
43 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
44 | 34 | } |
45 | 35 | } |
@@ -68,7 +58,7 @@ discard block |
||
68 | 58 | foreach ($data as $k => $v) { |
69 | 59 | switch ($k) { |
70 | 60 | case 'settings_version':{ |
71 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
72 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
73 | 63 | $v = $modx->getVersionData('version'); |
74 | 64 | } |
@@ -129,7 +119,9 @@ discard block |
||
129 | 119 | |
130 | 120 | $modx->config[$k] = $v; |
131 | 121 | |
132 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
122 | + if(!empty($k)) { |
|
123 | + $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
124 | + } |
|
133 | 125 | } |
134 | 126 | |
135 | 127 | // Run a single query to save all the values |
@@ -143,8 +135,11 @@ discard block |
||
143 | 135 | $oldtemplate = intval($data['old_template']); |
144 | 136 | $tbl = $modx->getFullTableName('site_content'); |
145 | 137 | $reset = $data['reset_template']; |
146 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
138 | + if($reset==1) { |
|
139 | + $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | + } else if($reset==2) { |
|
141 | + $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
142 | + } |
|
148 | 143 | } |
149 | 144 | |
150 | 145 | // empty cache |
@@ -17,20 +17,24 @@ |
||
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 | // rmdirRecursive - detects symbollic links on unix |
27 | -function rmdirRecursive($path,$followLinks=false) { |
|
31 | +function rmdirRecursive($path,$followLinks=false) |
|
32 | +{ |
|
28 | 33 | $dir = opendir($path) ; |
29 | - while ($entry = readdir($dir)) { |
|
34 | + while ($entry = readdir($dir)) { |
|
30 | 35 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
31 | 36 | @unlink( "$path/$entry" ); |
32 | - } |
|
33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
37 | + } elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
34 | 38 | rmdirRecursive("$path/$entry"); // recursive |
35 | 39 | } |
36 | 40 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if (!$modx->hasPermission('save_document')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -82,7 +84,7 @@ discard block |
||
82 | 84 | } |
83 | 85 | $alias = $tempAlias; |
84 | 86 | } |
85 | - }else{ |
|
87 | + } else { |
|
86 | 88 | if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND parent=$parent AND alias='$alias'")) != 0) { |
87 | 89 | $cnt = 1; |
88 | 90 | $tempAlias = $alias; |
@@ -132,8 +134,7 @@ discard block |
||
132 | 134 | } |
133 | 135 | //end webber |
134 | 136 | } |
135 | -} |
|
136 | -elseif ($alias) { |
|
137 | +} elseif ($alias) { |
|
137 | 138 | $alias = $modx->stripAlias($alias); |
138 | 139 | } |
139 | 140 | |
@@ -147,8 +148,7 @@ discard block |
||
147 | 148 | |
148 | 149 | if ($pub_date < $currentdate) { |
149 | 150 | $published = 1; |
150 | - } |
|
151 | - elseif ($pub_date > $currentdate) { |
|
151 | + } elseif ($pub_date > $currentdate) { |
|
152 | 152 | $published = 0; |
153 | 153 | } |
154 | 154 | } |
@@ -276,8 +276,7 @@ discard block |
||
276 | 276 | case 'new' : |
277 | 277 | |
278 | 278 | // invoke OnBeforeDocFormSave event |
279 | - switch($modx->config['docid_incrmnt_method']) |
|
280 | - { |
|
279 | + switch($modx->config['docid_incrmnt_method']) { |
|
281 | 280 | case '1': |
282 | 281 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
283 | 282 | $where = "T1.id IS NULL"; |
@@ -308,7 +307,7 @@ discard block |
||
308 | 307 | $publishedon = ($published ? $currentdate : 0); |
309 | 308 | $publishedby = ($published ? $modx->getLoginUserID() : 0); |
310 | 309 | |
311 | - if ((!empty($pub_date))&&($published)){ |
|
310 | + if ((!empty($pub_date))&&($published)) { |
|
312 | 311 | $publishedon=$pub_date; |
313 | 312 | } |
314 | 313 | |
@@ -346,8 +345,9 @@ discard block |
||
346 | 345 | "alias_visible" => $aliasvisible |
347 | 346 | ); |
348 | 347 | |
349 | - if ($id != '') |
|
350 | - $dbInsert["id"] = $id; |
|
348 | + if ($id != '') { |
|
349 | + $dbInsert["id"] = $id; |
|
350 | + } |
|
351 | 351 | |
352 | 352 | $key = $modx->db->insert( $dbInsert, $tbl_site_content); |
353 | 353 | |
@@ -423,11 +423,13 @@ discard block |
||
423 | 423 | // redirect/stay options |
424 | 424 | if ($_POST['stay'] != '') { |
425 | 425 | // weblink |
426 | - if ($_POST['mode'] == "72") |
|
427 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
426 | + if ($_POST['mode'] == "72") { |
|
427 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
428 | + } |
|
428 | 429 | // document |
429 | - if ($_POST['mode'] == "4") |
|
430 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
430 | + if ($_POST['mode'] == "4") { |
|
431 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
432 | + } |
|
431 | 433 | $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay']; |
432 | 434 | } else { |
433 | 435 | $header = "Location: index.php?a=3&id=$key&r=1"; |
@@ -488,10 +490,10 @@ discard block |
||
488 | 490 | if (!$was_published && $published) { |
489 | 491 | $publishedon = $currentdate; |
490 | 492 | $publishedby = $modx->getLoginUserID(); |
491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
493 | + } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | 494 | $publishedon = $pub_date; |
493 | 495 | $publishedby = $modx->getLoginUserID(); |
494 | - }elseif ($was_published && !$published) { |
|
496 | + } elseif ($was_published && !$published) { |
|
495 | 497 | $publishedon = 0; |
496 | 498 | $publishedby = 0; |
497 | 499 | } else { |
@@ -547,7 +549,9 @@ discard block |
||
547 | 549 | $tvChanges = array(); |
548 | 550 | foreach ($tmplvars as $field => $value) { |
549 | 551 | if (!is_array($value)) { |
550 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
552 | + if (isset($tvIds[$value])) { |
|
553 | + $tvDeletions[] = $tvIds[$value]; |
|
554 | + } |
|
551 | 555 | } else { |
552 | 556 | $tvId = $value[0]; |
553 | 557 | $tvVal = $value[1]; |
@@ -595,7 +599,9 @@ discard block |
||
595 | 599 | "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
596 | 600 | ); |
597 | 601 | $old_groups = array(); |
598 | - while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
602 | + while ($row = $modx->db->getRow($rs)) { |
|
603 | + $old_groups[$row['document_group']] = $row['id']; |
|
604 | + } |
|
599 | 605 | |
600 | 606 | // update the permissions in the database |
601 | 607 | $insertions = $deletions = array(); |
@@ -657,17 +663,22 @@ discard block |
||
657 | 663 | $keys = array('alias','parent','published','isfolder','menuindex','alias_visible'); |
658 | 664 | $flag = ''; |
659 | 665 | foreach($keys as $key) { |
660 | - if ($existingDocument[$key]===$_POST[$key]) continue; |
|
666 | + if ($existingDocument[$key]===$_POST[$key]) { |
|
667 | + continue; |
|
668 | + } |
|
661 | 669 | $flag = 'full'; |
662 | 670 | break; |
663 | 671 | } |
664 | - if($flag==='full') $modx->clearCache('full'); |
|
665 | - else $modx->clearCache($id); |
|
672 | + if($flag==='full') { |
|
673 | + $modx->clearCache('full'); |
|
674 | + } else { |
|
675 | + $modx->clearCache($id); |
|
676 | + } |
|
666 | 677 | } |
667 | 678 | |
668 | - if ($_POST['refresh_preview'] == '1') |
|
669 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
670 | - else { |
|
679 | + if ($_POST['refresh_preview'] == '1') { |
|
680 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
681 | + } else { |
|
671 | 682 | if ($_POST['stay'] != '2' && $id > 0) { |
672 | 683 | $modx->unlockElement(7, $id); |
673 | 684 | } |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(IN_MANAGER_MODE!="true") { |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('settings')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |