@@ -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->db->truncate($modx->getFullTableName('active_user_locks')); |
@@ -117,7 +117,7 @@ |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure web documents - flag as private |
120 | -if($updategroupaccess==true){ |
|
120 | +if($updategroupaccess==true) { |
|
121 | 121 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
122 | 122 | secureWebDocument(); |
123 | 123 |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->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->db->insert( |
@@ -25,7 +25,10 @@ |
||
25 | 25 | |
26 | 26 | $id = $row['id']; |
27 | 27 | |
28 | - if(in_array($id,$latestIds)) continue; // Keep latest version of disabled plugins |
|
28 | + if(in_array($id,$latestIds)) { |
|
29 | + continue; |
|
30 | + } |
|
31 | + // Keep latest version of disabled plugins |
|
29 | 32 | |
30 | 33 | // invoke OnBeforePluginFormDelete event |
31 | 34 | $modx->invokeEvent('OnBeforePluginFormDelete', array('id'=> $id)); |
@@ -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 |
@@ -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( |
@@ -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( |
@@ -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 | } |