@@ -11,13 +11,13 @@ |
||
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | -if($id==1){ |
|
14 | +if($id==1) { |
|
15 | 15 | $modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!"); |
16 | 16 | } |
17 | 17 | |
18 | 18 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_attributes'), "role='{$id}'"); |
19 | 19 | $count=$modx->db->getValue($rs); |
20 | -if($count>0){ |
|
20 | +if($count>0) { |
|
21 | 21 | $modx->webAlertAndQuit("There are users with this role. It can't be deleted."); |
22 | 22 | } |
23 | 23 |
@@ -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 | } |
@@ -70,7 +58,7 @@ discard block |
||
70 | 58 | foreach ($data as $k => $v) { |
71 | 59 | switch ($k) { |
72 | 60 | case 'settings_version':{ |
73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
74 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
75 | 63 | $v = $modx->getVersionData('version'); |
76 | 64 | } |
@@ -131,7 +119,9 @@ discard block |
||
131 | 119 | |
132 | 120 | $modx->config[$k] = $v; |
133 | 121 | |
134 | - 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 | + } |
|
135 | 125 | } |
136 | 126 | |
137 | 127 | // Run a single query to save all the values |
@@ -145,8 +135,11 @@ discard block |
||
145 | 135 | $oldtemplate = intval($data['old_template']); |
146 | 136 | $tbl = $modx->getFullTableName('site_content'); |
147 | 137 | $reset = $data['reset_template']; |
148 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | - 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 | + } |
|
150 | 143 | } |
151 | 144 | |
152 | 145 | // empty cache |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->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->db->insert( |
@@ -44,7 +44,8 @@ |
||
44 | 44 | |
45 | 45 | $children = array(); |
46 | 46 | |
47 | -function getChildren($parent) { |
|
47 | +function getChildren($parent) |
|
48 | +{ |
|
48 | 49 | |
49 | 50 | global $modx; |
50 | 51 | global $children; |
@@ -10,11 +10,11 @@ |
||
10 | 10 | $pass1 = $_POST['pass1']; |
11 | 11 | $pass2 = $_POST['pass2']; |
12 | 12 | |
13 | -if($pass1!=$pass2){ |
|
13 | +if($pass1!=$pass2) { |
|
14 | 14 | $modx->webAlertAndQuit("Passwords don't match!"); |
15 | 15 | } |
16 | 16 | |
17 | -if(strlen($pass1)<6){ |
|
17 | +if(strlen($pass1)<6) { |
|
18 | 18 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
19 | 19 | } |
20 | 20 |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->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->db->insert( |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | // create globally unique identifiers (guid) |
15 | -function createGUID(){ |
|
15 | +function createGUID() |
|
16 | +{ |
|
16 | 17 | srand((double)microtime()*1000000); |
17 | 18 | $r = rand() ; |
18 | 19 | $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
@@ -23,8 +24,11 @@ discard block |
||
23 | 24 | // count duplicates |
24 | 25 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
25 | 26 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
26 | -if($count>=1) $count = ' '.($count+1); |
|
27 | -else $count = ''; |
|
27 | +if($count>=1) { |
|
28 | + $count = ' '.($count+1); |
|
29 | +} else { |
|
30 | + $count = ''; |
|
31 | +} |
|
28 | 32 | |
29 | 33 | // duplicate module |
30 | 34 | $newid = $modx->db->insert( |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | $alias = $tempAlias; |
86 | 86 | } |
87 | - }else{ |
|
87 | + } else { |
|
88 | 88 | if ($modx->db->getValue($modx->db->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND parent=$parent AND alias='$alias'")) != 0) { |
89 | 89 | $cnt = 1; |
90 | 90 | $tempAlias = $alias; |
@@ -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 | } |
@@ -278,8 +276,7 @@ discard block |
||
278 | 276 | case 'new' : |
279 | 277 | |
280 | 278 | // invoke OnBeforeDocFormSave event |
281 | - switch($modx->config['docid_incrmnt_method']) |
|
282 | - { |
|
279 | + switch($modx->config['docid_incrmnt_method']) { |
|
283 | 280 | case '1': |
284 | 281 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
285 | 282 | $where = "T1.id IS NULL"; |
@@ -310,7 +307,7 @@ discard block |
||
310 | 307 | $publishedon = ($published ? $currentdate : 0); |
311 | 308 | $publishedby = ($published ? $modx->getLoginUserID() : 0); |
312 | 309 | |
313 | - if ((!empty($pub_date))&&($published)){ |
|
310 | + if ((!empty($pub_date))&&($published)) { |
|
314 | 311 | $publishedon=$pub_date; |
315 | 312 | } |
316 | 313 | |
@@ -348,8 +345,9 @@ discard block |
||
348 | 345 | "alias_visible" => $aliasvisible |
349 | 346 | ); |
350 | 347 | |
351 | - if ($id != '') |
|
352 | - $dbInsert["id"] = $id; |
|
348 | + if ($id != '') { |
|
349 | + $dbInsert["id"] = $id; |
|
350 | + } |
|
353 | 351 | |
354 | 352 | $key = $modx->db->insert( $dbInsert, $tbl_site_content); |
355 | 353 | |
@@ -425,11 +423,13 @@ discard block |
||
425 | 423 | // redirect/stay options |
426 | 424 | if ($_POST['stay'] != '') { |
427 | 425 | // weblink |
428 | - if ($_POST['mode'] == "72") |
|
429 | - $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 | + } |
|
430 | 429 | // document |
431 | - if ($_POST['mode'] == "4") |
|
432 | - $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 | + } |
|
433 | 433 | $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay']; |
434 | 434 | } else { |
435 | 435 | $header = "Location: index.php?a=3&id=$key&r=1"; |
@@ -490,10 +490,10 @@ discard block |
||
490 | 490 | if (!$was_published && $published) { |
491 | 491 | $publishedon = $currentdate; |
492 | 492 | $publishedby = $modx->getLoginUserID(); |
493 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
493 | + } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
494 | 494 | $publishedon = $pub_date; |
495 | 495 | $publishedby = $modx->getLoginUserID(); |
496 | - }elseif ($was_published && !$published) { |
|
496 | + } elseif ($was_published && !$published) { |
|
497 | 497 | $publishedon = 0; |
498 | 498 | $publishedby = 0; |
499 | 499 | } else { |
@@ -549,7 +549,9 @@ discard block |
||
549 | 549 | $tvChanges = array(); |
550 | 550 | foreach ($tmplvars as $field => $value) { |
551 | 551 | if (!is_array($value)) { |
552 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
552 | + if (isset($tvIds[$value])) { |
|
553 | + $tvDeletions[] = $tvIds[$value]; |
|
554 | + } |
|
553 | 555 | } else { |
554 | 556 | $tvId = $value[0]; |
555 | 557 | $tvVal = $value[1]; |
@@ -597,7 +599,9 @@ discard block |
||
597 | 599 | "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
598 | 600 | ); |
599 | 601 | $old_groups = array(); |
600 | - 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 | + } |
|
601 | 605 | |
602 | 606 | // update the permissions in the database |
603 | 607 | $insertions = $deletions = array(); |
@@ -659,17 +663,22 @@ discard block |
||
659 | 663 | $keys = array('alias','parent','published','isfolder','menuindex','alias_visible'); |
660 | 664 | $flag = ''; |
661 | 665 | foreach($keys as $key) { |
662 | - if ($existingDocument[$key]===$_POST[$key]) continue; |
|
666 | + if ($existingDocument[$key]===$_POST[$key]) { |
|
667 | + continue; |
|
668 | + } |
|
663 | 669 | $flag = 'full'; |
664 | 670 | break; |
665 | 671 | } |
666 | - if($flag==='full') $modx->clearCache('full'); |
|
667 | - else $modx->clearCache($id); |
|
672 | + if($flag==='full') { |
|
673 | + $modx->clearCache('full'); |
|
674 | + } else { |
|
675 | + $modx->clearCache($id); |
|
676 | + } |
|
668 | 677 | } |
669 | 678 | |
670 | - if ($_POST['refresh_preview'] == '1') |
|
671 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
672 | - else { |
|
679 | + if ($_POST['refresh_preview'] == '1') { |
|
680 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
681 | + } else { |
|
673 | 682 | if ($_POST['stay'] != '2' && $id > 0) { |
674 | 683 | $modx->unlockElement(7, $id); |
675 | 684 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | // check if user has access permission, except admins |
15 | -if($_SESSION['mgrRole']!=1){ |
|
15 | +if($_SESSION['mgrRole']!=1) { |
|
16 | 16 | $rs = $modx->db->select( |
17 | 17 | 'sma.usergroup,mg.member', |
18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -64,7 +64,8 @@ discard block |
||
64 | 64 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
65 | 65 | |
66 | 66 | // evalModule |
67 | -function evalModule($moduleCode,$params){ |
|
67 | +function evalModule($moduleCode,$params) |
|
68 | +{ |
|
68 | 69 | global $modx; |
69 | 70 | $modx->event->params = &$params; // store params inside event object |
70 | 71 | if(is_array($params)) { |
@@ -74,11 +75,9 @@ discard block |
||
74 | 75 | $mod = eval($moduleCode); |
75 | 76 | $msg = ob_get_contents(); |
76 | 77 | ob_end_clean(); |
77 | - if (isset($php_errormsg)) |
|
78 | - { |
|
78 | + if (isset($php_errormsg)) { |
|
79 | 79 | $error_info = error_get_last(); |
80 | - switch($error_info['type']) |
|
81 | - { |
|
80 | + switch($error_info['type']) { |
|
82 | 81 | case E_NOTICE : |
83 | 82 | $error_level = 1; |
84 | 83 | case E_USER_NOTICE : |
@@ -91,8 +90,7 @@ discard block |
||
91 | 90 | default: |
92 | 91 | $error_level = 99; |
93 | 92 | } |
94 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
95 | - { |
|
93 | + if($modx->config['error_reporting']==='99' || 2<$error_level) { |
|
96 | 94 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
97 | 95 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
98 | 96 | } |