@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('messages')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if ($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit("Wrong number of messages returned!"); |
19 | 19 | } |
20 | 20 | |
21 | -if ($message['recipient']!=$modx->getLoginUserID()) { |
|
21 | +if ($message['recipient'] != $modx->getLoginUserID()) { |
|
22 | 22 | $modx->webAlertAndQuit("You are not allowed to delete this message!"); |
23 | 23 | } |
24 | 24 | |
25 | 25 | // delete message |
26 | 26 | $modx->getDatabase()->delete($modx->getFullTableName('user_messages'), "id='{$id}'"); |
27 | 27 | |
28 | -$header="Location: index.php?a=10"; |
|
28 | +$header = "Location: index.php?a=10"; |
|
29 | 29 | header($header); |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_module')) { |
|
5 | +if (!$modx->hasPermission('new_module')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
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); |
|
16 | +if ($count >= 1) $count = ' '.($count + 1); |
|
17 | 17 | else $count = ''; |
18 | 18 | |
19 | 19 | // duplicate module |
@@ -58,5 +58,5 @@ discard block |
||
58 | 58 | $_SESSION['itemname'] = $name; |
59 | 59 | |
60 | 60 | // finish duplicating - redirect to new module |
61 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
61 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
62 | 62 | header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_module')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->getDatabase()->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->getDatabase()->escape($_POST['description']); |
12 | 12 | $resourcefile = $modx->getDatabase()->escape($_POST['resourcefile']); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | //Kyle Jaebker - added category support |
27 | 27 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
28 | - $categoryid = (int)$_POST['categoryid']; |
|
28 | + $categoryid = (int) $_POST['categoryid']; |
|
29 | 29 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
30 | 30 | $categoryid = 0; |
31 | 31 | } else { |
32 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
32 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
33 | 33 | $categoryid = checkCategory($_POST['newcategory']); |
34 | 34 | if (!$categoryid) { |
35 | 35 | $categoryid = newCategory($_POST['newcategory']); |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | $name = isset($parsed['name']) ? $parsed['name'] : $name; |
46 | 46 | $properties = isset($parsed['properties']) ? $parsed['properties'] : $properties; |
47 | 47 | $guid = isset($parsed['guid']) ? $parsed['guid'] : $guid; |
48 | - $enable_sharedparams = isset($parsed['shareparams']) ? (int)$parsed['shareparams'] : $enable_sharedparams; |
|
48 | + $enable_sharedparams = isset($parsed['shareparams']) ? (int) $parsed['shareparams'] : $enable_sharedparams; |
|
49 | 49 | |
50 | 50 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
51 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
51 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
52 | 52 | if ($version) { |
53 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
53 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
54 | 54 | } |
55 | 55 | if (isset($parsed['modx_category'])) { |
56 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
56 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
57 | 57 | $categoryid = getCategory($parsed['modx_category']); |
58 | 58 | } |
59 | 59 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // finished emptying cache - redirect |
112 | 112 | if ($_POST['stay'] != '') { |
113 | 113 | $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
115 | 115 | header($header); |
116 | 116 | } else { |
117 | 117 | $header = "Location: index.php?a=106&r=2"; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // finished emptying cache - redirect |
169 | 169 | if ($_POST['stay'] != '') { |
170 | 170 | $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
171 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
172 | 172 | header($header); |
173 | 173 | } else { |
174 | 174 | $modx->unlockElement(6, $id); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('save_password')) { |
|
5 | +if (!$modx->hasPermission('save_password')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -10,11 +10,11 @@ discard block |
||
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 | |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | $tbl_manager_users = $modx->getFullTableName('manager_users'); |
23 | 23 | $uid = $modx->getLoginUserID(); |
24 | 24 | $f['password'] = $modx->getPasswordHash()->HashPassword($pass1); |
25 | - $modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
25 | + $modx->getDatabase()->update($f, $tbl_manager_users, "id='{$uid}'"); |
|
26 | 26 | |
27 | 27 | // invoke OnManagerChangePassword event |
28 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
28 | + $modx->invokeEvent('OnManagerChangePassword', array( |
|
29 | 29 | 'userid' => $uid, |
30 | 30 | 'username' => $_SESSION['mgrShortname'], |
31 | 31 | 'userpassword' => $pass1 |
32 | 32 | )); |
33 | 33 | |
34 | -$header="Location: index.php?a=2"; |
|
34 | +$header = "Location: index.php?a=2"; |
|
35 | 35 | header($header); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('access_permissions')) { |
|
5 | +if (!$modx->hasPermission('access_permissions')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | switch ($operation) { |
23 | 23 | case "add_user_group" : |
24 | 24 | $newgroup = $_REQUEST['newusergroup']; |
25 | - if(empty($newgroup)) { |
|
25 | + if (empty($newgroup)) { |
|
26 | 26 | $modx->webAlertAndQuit("No group name specified."); |
27 | 27 | } else { |
28 | 28 | $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | break; |
37 | 37 | case "add_document_group" : |
38 | 38 | $newgroup = $_REQUEST['newdocgroup']; |
39 | - if(empty($newgroup)) { |
|
39 | + if (empty($newgroup)) { |
|
40 | 40 | $modx->webAlertAndQuit("No group name specified."); |
41 | 41 | } else { |
42 | 42 | $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | break; |
51 | 51 | case "delete_user_group" : |
52 | 52 | $updategroupaccess = true; |
53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | - if(empty($usergroup)) { |
|
53 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
54 | + if (empty($usergroup)) { |
|
55 | 55 | $modx->webAlertAndQuit("No user group id specified for deletion."); |
56 | 56 | } else { |
57 | 57 | $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | } |
63 | 63 | break; |
64 | 64 | case "delete_document_group" : |
65 | - $group = (int)$_REQUEST['documentgroup']; |
|
66 | - if(empty($group)) { |
|
65 | + $group = (int) $_REQUEST['documentgroup']; |
|
66 | + if (empty($group)) { |
|
67 | 67 | $modx->webAlertAndQuit("No document group id specified for deletion."); |
68 | 68 | } else { |
69 | 69 | $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | break; |
76 | 76 | case "rename_user_group" : |
77 | 77 | $newgroupname = $_REQUEST['newgroupname']; |
78 | - if(empty($newgroupname)) { |
|
78 | + if (empty($newgroupname)) { |
|
79 | 79 | $modx->webAlertAndQuit("No group name specified."); |
80 | 80 | } |
81 | - $groupid = (int)$_REQUEST['groupid']; |
|
82 | - if(empty($groupid)) { |
|
81 | + $groupid = (int) $_REQUEST['groupid']; |
|
82 | + if (empty($groupid)) { |
|
83 | 83 | $modx->webAlertAndQuit("No group id specified for rename."); |
84 | 84 | } |
85 | 85 | |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | break; |
88 | 88 | case "rename_document_group" : |
89 | 89 | $newgroupname = $_REQUEST['newgroupname']; |
90 | - if(empty($newgroupname)) { |
|
90 | + if (empty($newgroupname)) { |
|
91 | 91 | $modx->webAlertAndQuit("No group name specified."); |
92 | 92 | } |
93 | - $groupid = (int)$_REQUEST['groupid']; |
|
94 | - if(empty($groupid)) { |
|
93 | + $groupid = (int) $_REQUEST['groupid']; |
|
94 | + if (empty($groupid)) { |
|
95 | 95 | $modx->webAlertAndQuit("No group id specified for rename."); |
96 | 96 | } |
97 | 97 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | break; |
100 | 100 | case "add_document_group_to_user_group" : |
101 | 101 | $updategroupaccess = true; |
102 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
102 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
103 | + $docgroup = (int) $_REQUEST['docgroup']; |
|
104 | 104 | $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
105 | 105 | $limit = $modx->getDatabase()->getValue($rs); |
106 | - if($limit<=0) { |
|
106 | + if ($limit <= 0) { |
|
107 | 107 | $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
108 | 108 | } else { |
109 | 109 | //alert user that coupling already exists? |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | break; |
112 | 112 | case "remove_document_group_from_user_group" : |
113 | 113 | $updategroupaccess = true; |
114 | - $coupling = (int)$_REQUEST['coupling']; |
|
114 | + $coupling = (int) $_REQUEST['coupling']; |
|
115 | 115 | $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
116 | 116 | break; |
117 | 117 | default : |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | // secure manager documents - flag as private |
122 | -if($updategroupaccess==true){ |
|
122 | +if ($updategroupaccess == true) { |
|
123 | 123 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
124 | 124 | secureMgrDocument(); |
125 | 125 |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | case 'new' : |
278 | 278 | |
279 | 279 | // invoke OnBeforeDocFormSave event |
280 | - switch($modx->config['docid_incrmnt_method']) |
|
280 | + switch ($modx->config['docid_incrmnt_method']) |
|
281 | 281 | { |
282 | 282 | case '1': |
283 | 283 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
@@ -488,7 +488,7 @@ 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 | 494 | }elseif ($was_published && !$published) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } |
501 | 501 | |
502 | 502 | // invoke OnBeforeDocFormSave event |
503 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
503 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
504 | 504 | "mode" => "upd", |
505 | 505 | "id" => $id |
506 | 506 | )); |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | . "menuindex={$menuindex}, " |
526 | 526 | . "searchable={$searchable}, " |
527 | 527 | . "cacheable={$cacheable}, " |
528 | - . "editedby=" . $modx->getLoginUserID() . ", " |
|
528 | + . "editedby=".$modx->getLoginUserID().", " |
|
529 | 529 | . "editedon={$currentdate}, " |
530 | 530 | . "publishedon={$publishedon}, " |
531 | 531 | . "publishedby={$publishedby}, " |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | |
540 | 540 | // update template variables |
541 | 541 | $rs = $modx->getDatabase()->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
542 | - $tvIds = array (); |
|
542 | + $tvIds = array(); |
|
543 | 543 | while ($row = $modx->getDatabase()->getRow($rs)) { |
544 | 544 | $tvIds[$row['tmplvarid']] = $row['id']; |
545 | 545 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | 'groups.id, groups.document_group', |
593 | 593 | "{$tbl_document_groups} AS groups |
594 | 594 | LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group", |
595 | - "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
595 | + "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
596 | 596 | ); |
597 | 597 | $old_groups = array(); |
598 | 598 | while ($row = $modx->getDatabase()->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | unset($old_groups[$group]); |
605 | 605 | continue; |
606 | 606 | } elseif ($link_id == 'new') { |
607 | - $insertions[] = '('.(int)$group.','.$id.')'; |
|
607 | + $insertions[] = '('.(int) $group.','.$id.')'; |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | if (!empty($insertions)) { |
@@ -636,17 +636,17 @@ discard block |
||
636 | 636 | |
637 | 637 | |
638 | 638 | // invoke OnDocFormSave event |
639 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
639 | + $modx->invokeEvent("OnDocFormSave", array( |
|
640 | 640 | "mode" => "upd", |
641 | 641 | "id" => $id |
642 | 642 | )); |
643 | 643 | |
644 | 644 | // secure web documents - flag as private |
645 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
645 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
646 | 646 | secureWebDocument($id); |
647 | 647 | |
648 | 648 | // secure manager documents - flag as private |
649 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
649 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
650 | 650 | secureMgrDocument($id); |
651 | 651 | |
652 | 652 | // Set the item name for logger |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | // document |
673 | 673 | $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
674 | 674 | } |
675 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
675 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path; |
|
676 | 676 | } else { |
677 | 677 | $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
678 | 678 | } |
679 | 679 | } |
680 | 680 | if (headers_sent()) { |
681 | - $header = str_replace('Location: ','',$header); |
|
681 | + $header = str_replace('Location: ', '', $header); |
|
682 | 682 | echo "<script>document.location.href='$header';</script>\n"; |
683 | 683 | } else { |
684 | 684 | header($header); |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_chunk')) { |
|
5 | +if (!$modx->hasPermission('new_chunk')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
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); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate htmlsnippet |
@@ -32,5 +32,5 @@ discard block |
||
32 | 32 | $_SESSION['itemname'] = $name; |
33 | 33 | |
34 | 34 | // finish duplicating - redirect to new chunk |
35 | -$header="Location: index.php?r=2&a=78&id=$newid"; |
|
35 | +$header = "Location: index.php?r=2&a=78&id=$newid"; |
|
36 | 36 | header($header); |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('save_role')) { |
|
5 | +if (!$modx->hasPermission('save_role')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | -if($name == '' || !isset ($name)) { |
|
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
11 | +if ($name == '' || !isset ($name)) { |
|
12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}".($mode = 35 ? "&id={$id}" : "")); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | // setup fields |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | |
92 | 92 | $fields = $modx->getDatabase()->escape($fields); |
93 | 93 | |
94 | -switch($_POST['mode']) { |
|
94 | +switch ($_POST['mode']) { |
|
95 | 95 | case '38' : |
96 | 96 | $tbl = $modx->getFullTableName("user_roles"); |
97 | 97 | |
98 | 98 | // disallow duplicate names for role |
99 | 99 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
100 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
100 | + if ($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | 101 | $modx->getManagerApi()->saveFormValues(38); |
102 | 102 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
103 | 103 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // disallow duplicate names for role |
117 | 117 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
118 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
118 | + if ($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | 119 | $modx->getManagerApi()->saveFormValues(35); |
120 | 120 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
121 | 121 | } |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('edit_document')) { |
|
5 | +if (!$modx->hasPermission('edit_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
10 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
9 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
10 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
11 | 11 | |
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) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
18 | 18 | |
19 | 19 | $parents = $modx->getParentIds($newParentID); |
20 | 20 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
40 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
41 | 41 | "id_document" => $documentID, |
42 | 42 | "old_parent" => $oldparent, |
43 | 43 | "new_parent" => $newParentID |
44 | 44 | )); |
45 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
45 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
46 | 46 | $newParent = array_pop($evtOut); |
47 | - if($newParent == $oldparent) { |
|
47 | + if ($newParent == $oldparent) { |
|
48 | 48 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
49 | - }else{ |
|
49 | + } else { |
|
50 | 50 | $newParentID = $newParent; |
51 | 51 | } |
52 | 52 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
68 | 68 | $limit = $modx->getDatabase()->getValue($rs); |
69 | 69 | |
70 | - if(!$limit>0) { |
|
70 | + if (!$limit > 0) { |
|
71 | 71 | $modx->getDatabase()->update(array( |
72 | 72 | 'isfolder' => 0, |
73 | 73 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
77 | 77 | $_SESSION['itemname'] = $pagetitle; |
78 | 78 | |
79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
79 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
80 | 80 | "id_document" => $documentID, |
81 | 81 | "old_parent" => $oldparent, |
82 | 82 | "new_parent" => $newParentID |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | // empty cache & sync site |
86 | 86 | $modx->clearCache('full'); |
87 | 87 | |
88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
88 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | 89 | header($header); |
90 | 90 | } else { |
91 | 91 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |