@@ -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_template')) { |
|
5 | +if (!$modx->hasPermission('new_template')) { |
|
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->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); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate template |
@@ -41,5 +41,5 @@ discard block |
||
41 | 41 | $_SESSION['itemname'] = $name; |
42 | 42 | |
43 | 43 | // finish duplicating - redirect to new template |
44 | -$header="Location: index.php?r=2&a=16&id=$newid"; |
|
44 | +$header = "Location: index.php?r=2&a=16&id=$newid"; |
|
45 | 45 | header($header); |
@@ -1,38 +1,38 @@ 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_document')||!$modx->hasPermission('publish_document')) { |
|
5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | /************webber ********/ |
15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
17 | 17 | |
18 | 18 | /************** webber *************/ |
19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
22 | -$add_path=$sd.$sb.$pg; |
|
19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
22 | +$add_path = $sd.$sb.$pg; |
|
23 | 23 | |
24 | 24 | /***********************************/ |
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | 28 | // check permissions on the document |
29 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
29 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
30 | 30 | $udperms = new udperms(); |
31 | 31 | $udperms->user = $modx->getLoginUserID(); |
32 | 32 | $udperms->document = $id; |
33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
34 | 34 | |
35 | -if(!$udperms->checkPermissions()) { |
|
35 | +if (!$udperms->checkPermissions()) { |
|
36 | 36 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
37 | 37 | } |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
50 | 50 | |
51 | 51 | // invoke OnDocPublished event |
52 | -$modx->invokeEvent("OnDocPublished",array("docid"=>$id)); |
|
52 | +$modx->invokeEvent("OnDocPublished", array("docid"=>$id)); |
|
53 | 53 | |
54 | 54 | // Set the item name for logger |
55 | 55 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -57,6 +57,6 @@ discard block |
||
57 | 57 | // empty cache |
58 | 58 | $modx->clearCache('full'); |
59 | 59 | |
60 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
60 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
61 | 61 | |
62 | 62 | 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->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); |
|
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,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->db->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,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('web_access_permissions')) { |
|
5 | +if (!$modx->hasPermission('web_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->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_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->db->insert(array('name'=>$modx->db->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->db->delete($tbl_webgroup_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->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -75,33 +75,33 @@ 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 user group id specified for rename."); |
84 | 84 | } |
85 | 85 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
86 | 86 | break; |
87 | 87 | case "rename_document_group" : |
88 | 88 | $newgroupname = $_REQUEST['newgroupname']; |
89 | - if(empty($newgroupname)) { |
|
89 | + if (empty($newgroupname)) { |
|
90 | 90 | $modx->webAlertAndQuit("No group name specified."); |
91 | 91 | } |
92 | - $groupid = (int)$_REQUEST['groupid']; |
|
93 | - if(empty($groupid)) { |
|
92 | + $groupid = (int) $_REQUEST['groupid']; |
|
93 | + if (empty($groupid)) { |
|
94 | 94 | $modx->webAlertAndQuit("No document group id specified for rename."); |
95 | 95 | } |
96 | 96 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
97 | 97 | break; |
98 | 98 | case "add_document_group_to_user_group" : |
99 | 99 | $updategroupaccess = true; |
100 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
101 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
100 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
101 | + $docgroup = (int) $_REQUEST['docgroup']; |
|
102 | 102 | $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
103 | 103 | $limit = $modx->db->getValue($rs); |
104 | - if($limit<=0) { |
|
104 | + if ($limit <= 0) { |
|
105 | 105 | $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
106 | 106 | } else { |
107 | 107 | //alert user that coupling already exists? |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | break; |
110 | 110 | case "remove_document_group_from_user_group" : |
111 | 111 | $updategroupaccess = true; |
112 | - $coupling = (int)$_REQUEST['coupling']; |
|
112 | + $coupling = (int) $_REQUEST['coupling']; |
|
113 | 113 | $modx->db->delete($tbl_webgroup_access, "id='{$coupling}'"); |
114 | 114 | break; |
115 | 115 | default : |
@@ -117,7 +117,7 @@ discard block |
||
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 |
@@ -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 | -if(!$modx->hasPermission('delete_web_user')) { |
|
5 | +if (!$modx->hasPermission('delete_web_user')) { |
|
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 | |
@@ -43,5 +43,5 @@ discard block |
||
43 | 43 | "id" => $id |
44 | 44 | )); |
45 | 45 | |
46 | -$header="Location: index.php?a=99"; |
|
46 | +$header = "Location: index.php?a=99"; |
|
47 | 47 | 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_template')) { |
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->db->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->db->escape($_POST['description']); |
12 | 12 | $caption = $modx->db->escape($_POST['caption']); |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | $display = $modx->db->escape($_POST['display']); |
18 | 18 | $params = $modx->db->escape($_POST['params']); |
19 | 19 | $locked = $_POST['locked'] == 'on' ? 1 : 0; |
20 | -$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76; |
|
21 | -$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null; |
|
20 | +$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76; |
|
21 | +$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : null; |
|
22 | 22 | $currentdate = time() + $modx->config['server_offset_time']; |
23 | 23 | |
24 | 24 | //Kyle Jaebker - added category support |
25 | 25 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
26 | - $categoryid = (int)$_POST['categoryid']; |
|
26 | + $categoryid = (int) $_POST['categoryid']; |
|
27 | 27 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
28 | 28 | $categoryid = 0; |
29 | 29 | } else { |
30 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
30 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
31 | 31 | $categoryid = checkCategory($_POST['newcategory']); |
32 | 32 | if (!$categoryid) { |
33 | 33 | $categoryid = newCategory($_POST['newcategory']); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // finished emptying cache - redirect |
100 | 100 | if ($_POST['stay'] != '') { |
101 | 101 | $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300"; |
102 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
102 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
103 | 103 | header($header); |
104 | 104 | } else { |
105 | 105 | $header = "Location: index.php?a=76&r=2"; |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | // finished emptying cache - redirect |
161 | 161 | if ($_POST['stay'] != '') { |
162 | 162 | $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300"; |
163 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId; |
|
163 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId; |
|
164 | 164 | header($header); |
165 | 165 | } else { |
166 | 166 | $modx->unlockElement(2, $id); |
167 | - $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId); |
|
167 | + $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId); |
|
168 | 168 | header($header); |
169 | 169 | } |
170 | 170 |
@@ -1,16 +1,16 @@ 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('delete_eventlog')) { |
|
5 | +if (!$modx->hasPermission('delete_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -if (isset($_GET['cls']) && $_GET['cls']==1) { |
|
9 | +if (isset($_GET['cls']) && $_GET['cls'] == 1) { |
|
10 | 10 | $where = ''; |
11 | 11 | } else { |
12 | - $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
13 | - if($id==0) { |
|
12 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
13 | + if ($id == 0) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
15 | 15 | } |
16 | 16 | $where = "id='{$id}'"; |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | // delete event log |
20 | 20 | $modx->db->delete($modx->getFullTableName('event_log'), $where); |
21 | 21 | |
22 | -$header="Location: index.php?a=114"; |
|
22 | +$header = "Location: index.php?a=114"; |
|
23 | 23 | header($header); |
@@ -1,46 +1,46 @@ 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('settings')) { |
|
5 | +if (!$modx->hasPermission('settings')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | $data = $_POST; |
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) |
|
12 | +if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false) |
|
13 | 13 | { |
14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | - if(is_file($htaccess)) |
|
14 | + $htaccess = $modx->config['base_path'].'.htaccess'; |
|
15 | + $sample_htaccess = $modx->config['base_path'].'ht.access'; |
|
16 | + $dir = '/'.trim($modx->config['base_url'], '/'); |
|
17 | + if (is_file($htaccess)) |
|
18 | 18 | { |
19 | 19 | $_ = file_get_contents($htaccess); |
20 | - if(strpos($_,'RewriteBase')===false) |
|
20 | + if (strpos($_, 'RewriteBase') === false) |
|
21 | 21 | { |
22 | 22 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
23 | 23 | } |
24 | - elseif(is_writable($htaccess)) |
|
24 | + elseif (is_writable($htaccess)) |
|
25 | 25 | { |
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
27 | + if (!@file_put_contents($htaccess, $_)) |
|
28 | 28 | { |
29 | 29 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
33 | - elseif(is_file($sample_htaccess)) |
|
33 | + elseif (is_file($sample_htaccess)) |
|
34 | 34 | { |
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
35 | + if (!@rename($sample_htaccess, $htaccess)) |
|
36 | 36 | { |
37 | 37 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
38 | 38 | } |
39 | - elseif($modx->config['base_url']!=='/') |
|
39 | + elseif ($modx->config['base_url'] !== '/') |
|
40 | 40 | { |
41 | 41 | $_ = file_get_contents($htaccess); |
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
43 | + if (!@file_put_contents($htaccess, $_)) |
|
44 | 44 | { |
45 | 45 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
46 | 46 | } |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
52 | - unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
|
51 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
52 | + unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css'); |
|
53 | 53 | } |
54 | 54 | |
55 | -$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
|
56 | -$data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
|
55 | +$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']); |
|
56 | +$data['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']); |
|
57 | 57 | |
58 | 58 | if (isset($data) && count($data) > 0) { |
59 | - if(isset($data['manager_language'])) { |
|
60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | - if(is_file($lang_path)) { |
|
59 | + if (isset($data['manager_language'])) { |
|
60 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php'; |
|
61 | + if (is_file($lang_path)) { |
|
62 | 62 | include($lang_path); |
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | } |
67 | 67 | $savethese = array(); |
68 | 68 | $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
69 | + $data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | 70 | foreach ($data as $k => $v) { |
71 | 71 | switch ($k) { |
72 | 72 | case 'settings_version':{ |
73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
74 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
73 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
74 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
75 | 75 | $v = $modx->getVersionData('version'); |
76 | 76 | } |
77 | 77 | break; |
@@ -92,21 +92,21 @@ discard block |
||
92 | 92 | case 'rb_base_url': |
93 | 93 | case 'filemanager_path': |
94 | 94 | $v = trim($v); |
95 | - $v = rtrim($v,'/') . '/'; |
|
95 | + $v = rtrim($v, '/').'/'; |
|
96 | 96 | break; |
97 | 97 | case 'manager_language': |
98 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
99 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
98 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
99 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
100 | 100 | $langFileDir = dirname($langFile); |
101 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
101 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
102 | 102 | $v = 'english'; |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | case 'smtppw': |
106 | 106 | if ($v !== '********************' && $v !== '') { |
107 | 107 | $v = trim($v); |
108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | - $v = str_replace('=','%',$v); |
|
108 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | + $v = str_replace('=', '%', $v); |
|
110 | 110 | } elseif ($v === '********************') { |
111 | 111 | $k = ''; |
112 | 112 | } |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $v = str_replace(array(' ,', ', '), ',', $v); |
116 | 116 | if ($v !== ',') { |
117 | 117 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
118 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
119 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
118 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
119 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
120 | 120 | } |
121 | 121 | $k = ''; |
122 | 122 | break; |
123 | 123 | case 'session_timeout': |
124 | 124 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
125 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
125 | + $v = (int) $v < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
126 | 126 | break; |
127 | 127 | default: |
128 | 128 | break; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $modx->config[$k] = $v; |
133 | 133 | |
134 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
134 | + if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // Run a single query to save all the values |
@@ -141,16 +141,16 @@ discard block |
||
141 | 141 | |
142 | 142 | // Reset Template Pages |
143 | 143 | if (isset($data['reset_template'])) { |
144 | - $newtemplate = (int)$data['default_template']; |
|
145 | - $oldtemplate = (int)$data['old_template']; |
|
144 | + $newtemplate = (int) $data['default_template']; |
|
145 | + $oldtemplate = (int) $data['old_template']; |
|
146 | 146 | $tbl = $modx->getFullTableName('site_content'); |
147 | 147 | $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}'"); |
|
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}'"); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | // empty cache |
153 | 153 | $modx->clearCache('full'); |
154 | 154 | } |
155 | -$header="Location: index.php?a=7&r=10"; |
|
155 | +$header = "Location: index.php?a=7&r=10"; |
|
156 | 156 | header($header); |