@@ -3,12 +3,12 @@ discard block |
||
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('new_plugin')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,25 +19,25 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Plugin |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'disabled'=>'', |
|
26 | - 'moduleguid'=>'', |
|
27 | - 'plugincode'=>'', |
|
28 | - 'properties'=>'', |
|
29 | - 'category'=>'', |
|
30 | - ), $modx->getDatabase()->getFullTableName('site_plugins'), // Insert into |
|
31 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'disabled'=>'', |
|
26 | + 'moduleguid'=>'', |
|
27 | + 'plugincode'=>'', |
|
28 | + 'properties'=>'', |
|
29 | + 'category'=>'', |
|
30 | + ), $modx->getDatabase()->getFullTableName('site_plugins'), // Insert into |
|
31 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
32 | 32 | |
33 | 33 | // duplicate Plugin Event Listeners |
34 | 34 | $modx->getDatabase()->insert( |
35 | - array( |
|
36 | - 'pluginid'=>'', |
|
37 | - 'evtid'=>'', |
|
38 | - 'priority'=>'', |
|
39 | - ), $modx->getDatabase()->getFullTableName('site_plugin_events'), // Insert into |
|
40 | - "'{$newid}', evtid, priority", $modx->getDatabase()->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
35 | + array( |
|
36 | + 'pluginid'=>'', |
|
37 | + 'evtid'=>'', |
|
38 | + 'priority'=>'', |
|
39 | + ), $modx->getDatabase()->getFullTableName('site_plugin_events'), // Insert into |
|
40 | + "'{$newid}', evtid, priority", $modx->getDatabase()->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
41 | 41 | |
42 | 42 | // Set the item name for logger |
43 | 43 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$newid}'")); |
@@ -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_plugin')) { |
|
5 | +if (!$modx->hasPermission('new_plugin')) { |
|
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->getDatabase()->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_plugins'), "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 Plugin |
@@ -44,5 +44,5 @@ discard block |
||
44 | 44 | $_SESSION['itemname'] = $name; |
45 | 45 | |
46 | 46 | // finish duplicating - redirect to new plugin |
47 | -$header="Location: index.php?r=2&a=102&id=$newid"; |
|
47 | +$header = "Location: index.php?r=2&a=102&id=$newid"; |
|
48 | 48 | header($header); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_plugins'), "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 Plugin |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -1,25 +1,25 @@ 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('delete_document')) { |
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 | /*******ищем родителя чтобы к нему вернуться********/ |
15 | -$content=$modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
17 | 17 | |
18 | 18 | /************ а заодно и путь возврата (сам путь внизу файла) **********/ |
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 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | "children"=>$children |
46 | 46 | )); |
47 | 47 | |
48 | -if (count($children)>0) { |
|
48 | +if (count($children) > 0) { |
|
49 | 49 | $modx->getDatabase()->update( |
50 | 50 | array( |
51 | 51 | 'deleted' => 1, |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | ), $modx->getDatabase()->getFullTableName('site_content'), "id IN (".implode(", ", $children).")"); |
55 | 55 | } |
56 | 56 | |
57 | -if ($site_start==$id) { |
|
57 | +if ($site_start == $id) { |
|
58 | 58 | $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!"); |
59 | 59 | } |
60 | 60 | |
61 | -if ($site_unavailable_page==$id) { |
|
61 | +if ($site_unavailable_page == $id) { |
|
62 | 62 | $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!"); |
63 | 63 | } |
64 | 64 | |
65 | -if ($error_page==$id) { |
|
65 | +if ($error_page == $id) { |
|
66 | 66 | $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!"); |
67 | 67 | } |
68 | 68 | |
69 | -if ($unauthorized_page==$id) { |
|
69 | +if ($unauthorized_page == $id) { |
|
70 | 70 | $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!"); |
71 | 71 | } |
72 | 72 | |
@@ -92,5 +92,5 @@ discard block |
||
92 | 92 | $modx->clearCache('full'); |
93 | 93 | |
94 | 94 | // finished emptying cache - redirect |
95 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
95 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
96 | 96 | header($header); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || 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."); |
|
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_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_manager_users = $modx->getDatabase()->getFullTableName('manager_users'); |
@@ -43,134 +43,134 @@ discard block |
||
43 | 43 | |
44 | 44 | // verify password |
45 | 45 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
46 | - webAlertAndQuit("Password typed is mismatched", 12); |
|
46 | + webAlertAndQuit("Password typed is mismatched", 12); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // verify email |
50 | 50 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
51 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
51 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // verify admin security |
55 | 55 | if($_SESSION['mgrRole'] != 1) { |
56 | - // Check to see if user tried to spoof a "1" (admin) role |
|
57 | - if(!$modx->hasPermission('save_user')) { |
|
58 | - webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
59 | - } |
|
60 | - // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
61 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
62 | - $limit = $modx->getDatabase()->getValue($rs); |
|
63 | - if($limit > 0) { |
|
64 | - webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
65 | - } |
|
56 | + // Check to see if user tried to spoof a "1" (admin) role |
|
57 | + if(!$modx->hasPermission('save_user')) { |
|
58 | + webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
59 | + } |
|
60 | + // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
61 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
62 | + $limit = $modx->getDatabase()->getValue($rs); |
|
63 | + if($limit > 0) { |
|
64 | + webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | 69 | switch($input['mode']) { |
70 | - case '11' : // new user |
|
71 | - // check if this user name already exist |
|
72 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername))); |
|
73 | - $limit = $modx->getDatabase()->getValue($rs); |
|
74 | - if($limit > 0) { |
|
75 | - webAlertAndQuit("User name is already in use!", 12); |
|
76 | - } |
|
77 | - |
|
78 | - // check if the email address already exist |
|
79 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
80 | - $limit = $modx->getDatabase()->getValue($rs); |
|
81 | - if($limit > 0) { |
|
82 | - webAlertAndQuit("Email is already in use!", 12); |
|
83 | - } |
|
84 | - |
|
85 | - // generate a new password for this user |
|
86 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
87 | - if(strlen($specifiedpassword) < 6) { |
|
88 | - webAlertAndQuit("Password is too short!", 12); |
|
89 | - } else { |
|
90 | - $newpassword = $specifiedpassword; |
|
91 | - } |
|
92 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
93 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
94 | - } elseif($passwordgenmethod == 'g') { |
|
95 | - $newpassword = generate_password(8); |
|
96 | - } else { |
|
97 | - webAlertAndQuit("No password generation method specified!", 12); |
|
98 | - } |
|
99 | - |
|
100 | - // invoke OnBeforeUserFormSave event |
|
101 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
102 | - "mode" => "new", |
|
103 | - )); |
|
104 | - |
|
105 | - // create the user account |
|
106 | - $internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users); |
|
107 | - |
|
108 | - $field = array(); |
|
109 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
110 | - $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
111 | - |
|
112 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
113 | - $field = $modx->getDatabase()->escape($field); |
|
114 | - $modx->getDatabase()->insert($field, $tbl_user_attributes); |
|
115 | - |
|
116 | - // Save user settings |
|
70 | + case '11' : // new user |
|
71 | + // check if this user name already exist |
|
72 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername))); |
|
73 | + $limit = $modx->getDatabase()->getValue($rs); |
|
74 | + if($limit > 0) { |
|
75 | + webAlertAndQuit("User name is already in use!", 12); |
|
76 | + } |
|
77 | + |
|
78 | + // check if the email address already exist |
|
79 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
80 | + $limit = $modx->getDatabase()->getValue($rs); |
|
81 | + if($limit > 0) { |
|
82 | + webAlertAndQuit("Email is already in use!", 12); |
|
83 | + } |
|
84 | + |
|
85 | + // generate a new password for this user |
|
86 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
87 | + if(strlen($specifiedpassword) < 6) { |
|
88 | + webAlertAndQuit("Password is too short!", 12); |
|
89 | + } else { |
|
90 | + $newpassword = $specifiedpassword; |
|
91 | + } |
|
92 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
93 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
94 | + } elseif($passwordgenmethod == 'g') { |
|
95 | + $newpassword = generate_password(8); |
|
96 | + } else { |
|
97 | + webAlertAndQuit("No password generation method specified!", 12); |
|
98 | + } |
|
99 | + |
|
100 | + // invoke OnBeforeUserFormSave event |
|
101 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
102 | + "mode" => "new", |
|
103 | + )); |
|
104 | + |
|
105 | + // create the user account |
|
106 | + $internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users); |
|
107 | + |
|
108 | + $field = array(); |
|
109 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
110 | + $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
111 | + |
|
112 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
113 | + $field = $modx->getDatabase()->escape($field); |
|
114 | + $modx->getDatabase()->insert($field, $tbl_user_attributes); |
|
115 | + |
|
116 | + // Save user settings |
|
117 | 117 | saveManagerUserSettings($internalKey); |
118 | 118 | |
119 | - // invoke OnManagerSaveUser event |
|
120 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
121 | - "mode" => "new", |
|
122 | - "userid" => $internalKey, |
|
123 | - "username" => $newusername, |
|
124 | - "userpassword" => $newpassword, |
|
125 | - "useremail" => $email, |
|
126 | - "userfullname" => $fullname, |
|
127 | - "userroleid" => $role |
|
128 | - )); |
|
129 | - |
|
130 | - // invoke OnUserFormSave event |
|
131 | - $modx->invokeEvent("OnUserFormSave", array( |
|
132 | - "mode" => "new", |
|
133 | - "id" => $internalKey |
|
134 | - )); |
|
135 | - |
|
136 | - // Set the item name for logger |
|
137 | - $_SESSION['itemname'] = $newusername; |
|
138 | - |
|
139 | - /*******************************************************************************/ |
|
140 | - // put the user in the user_groups he/ she should be in |
|
141 | - // first, check that up_perms are switched on! |
|
142 | - if($use_udperms == 1) { |
|
143 | - if(!empty($user_groups)) { |
|
144 | - for($i = 0; $i < count($user_groups); $i++) { |
|
145 | - $f = array(); |
|
146 | - $f['user_group'] = (int)$user_groups[$i]; |
|
147 | - $f['member'] = $internalKey; |
|
148 | - $modx->getDatabase()->insert($f, $tbl_member_groups); |
|
149 | - } |
|
150 | - } |
|
151 | - } |
|
152 | - // end of user_groups stuff! |
|
153 | - |
|
154 | - if($passwordnotifymethod == 'e') { |
|
119 | + // invoke OnManagerSaveUser event |
|
120 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
121 | + "mode" => "new", |
|
122 | + "userid" => $internalKey, |
|
123 | + "username" => $newusername, |
|
124 | + "userpassword" => $newpassword, |
|
125 | + "useremail" => $email, |
|
126 | + "userfullname" => $fullname, |
|
127 | + "userroleid" => $role |
|
128 | + )); |
|
129 | + |
|
130 | + // invoke OnUserFormSave event |
|
131 | + $modx->invokeEvent("OnUserFormSave", array( |
|
132 | + "mode" => "new", |
|
133 | + "id" => $internalKey |
|
134 | + )); |
|
135 | + |
|
136 | + // Set the item name for logger |
|
137 | + $_SESSION['itemname'] = $newusername; |
|
138 | + |
|
139 | + /*******************************************************************************/ |
|
140 | + // put the user in the user_groups he/ she should be in |
|
141 | + // first, check that up_perms are switched on! |
|
142 | + if($use_udperms == 1) { |
|
143 | + if(!empty($user_groups)) { |
|
144 | + for($i = 0; $i < count($user_groups); $i++) { |
|
145 | + $f = array(); |
|
146 | + $f['user_group'] = (int)$user_groups[$i]; |
|
147 | + $f['member'] = $internalKey; |
|
148 | + $modx->getDatabase()->insert($f, $tbl_member_groups); |
|
149 | + } |
|
150 | + } |
|
151 | + } |
|
152 | + // end of user_groups stuff! |
|
153 | + |
|
154 | + if($passwordnotifymethod == 'e') { |
|
155 | 155 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
156 | - if($input['stay'] != '') { |
|
157 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
158 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | - header($header); |
|
160 | - } else { |
|
161 | - $header = "Location: index.php?a=75&r=2"; |
|
162 | - header($header); |
|
163 | - } |
|
164 | - } else { |
|
165 | - if($input['stay'] != '') { |
|
166 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
167 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
168 | - } else { |
|
169 | - $stayUrl = "index.php?a=75&r=2"; |
|
170 | - } |
|
171 | - |
|
172 | - include_once "header.inc.php"; |
|
173 | - ?> |
|
156 | + if($input['stay'] != '') { |
|
157 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
158 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | + header($header); |
|
160 | + } else { |
|
161 | + $header = "Location: index.php?a=75&r=2"; |
|
162 | + header($header); |
|
163 | + } |
|
164 | + } else { |
|
165 | + if($input['stay'] != '') { |
|
166 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
167 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
168 | + } else { |
|
169 | + $stayUrl = "index.php?a=75&r=2"; |
|
170 | + } |
|
171 | + |
|
172 | + include_once "header.inc.php"; |
|
173 | + ?> |
|
174 | 174 | |
175 | 175 | <h1><?php echo $_lang['user_title']; ?></h1> |
176 | 176 | |
@@ -192,125 +192,125 @@ discard block |
||
192 | 192 | </div> |
193 | 193 | <?php |
194 | 194 | |
195 | - include_once "footer.inc.php"; |
|
196 | - } |
|
197 | - break; |
|
198 | - case '12' : // edit user |
|
199 | - // generate a new password for this user |
|
200 | - if($genpassword == 1) { |
|
201 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
202 | - if(strlen($specifiedpassword) < 6) { |
|
203 | - webAlertAndQuit("Password is too short!", 12); |
|
204 | - } else { |
|
205 | - $newpassword = $specifiedpassword; |
|
206 | - } |
|
207 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
208 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
209 | - } elseif($passwordgenmethod == 'g') { |
|
210 | - $newpassword = generate_password(8); |
|
211 | - } else { |
|
212 | - webAlertAndQuit("No password generation method specified!", 12); |
|
213 | - } |
|
214 | - } |
|
215 | - if($passwordnotifymethod == 'e') { |
|
195 | + include_once "footer.inc.php"; |
|
196 | + } |
|
197 | + break; |
|
198 | + case '12' : // edit user |
|
199 | + // generate a new password for this user |
|
200 | + if($genpassword == 1) { |
|
201 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
202 | + if(strlen($specifiedpassword) < 6) { |
|
203 | + webAlertAndQuit("Password is too short!", 12); |
|
204 | + } else { |
|
205 | + $newpassword = $specifiedpassword; |
|
206 | + } |
|
207 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
208 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
209 | + } elseif($passwordgenmethod == 'g') { |
|
210 | + $newpassword = generate_password(8); |
|
211 | + } else { |
|
212 | + webAlertAndQuit("No password generation method specified!", 12); |
|
213 | + } |
|
214 | + } |
|
215 | + if($passwordnotifymethod == 'e') { |
|
216 | 216 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
217 | - } |
|
218 | - |
|
219 | - // check if the username already exist |
|
220 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id)); |
|
221 | - $limit = $modx->getDatabase()->getValue($rs); |
|
222 | - if($limit > 0) { |
|
223 | - webAlertAndQuit("User name is already in use!", 12); |
|
224 | - } |
|
225 | - |
|
226 | - // check if the email address already exists |
|
227 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
228 | - $limit = $modx->getDatabase()->getValue($rs); |
|
229 | - if($limit > 0) { |
|
230 | - webAlertAndQuit("Email is already in use!", 12); |
|
231 | - } |
|
232 | - |
|
233 | - // invoke OnBeforeUserFormSave event |
|
234 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
235 | - "mode" => "upd", |
|
236 | - "id" => $id |
|
237 | - )); |
|
238 | - |
|
239 | - // update user name and password |
|
240 | - $field = array(); |
|
241 | - $field['username'] = $modx->getDatabase()->escape($newusername); |
|
242 | - if($genpassword == 1) { |
|
243 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
244 | - } |
|
245 | - $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$id}'"); |
|
246 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
247 | - $field = $modx->getDatabase()->escape($field); |
|
248 | - $modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
249 | - |
|
250 | - // Save user settings |
|
217 | + } |
|
218 | + |
|
219 | + // check if the username already exist |
|
220 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id)); |
|
221 | + $limit = $modx->getDatabase()->getValue($rs); |
|
222 | + if($limit > 0) { |
|
223 | + webAlertAndQuit("User name is already in use!", 12); |
|
224 | + } |
|
225 | + |
|
226 | + // check if the email address already exists |
|
227 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
228 | + $limit = $modx->getDatabase()->getValue($rs); |
|
229 | + if($limit > 0) { |
|
230 | + webAlertAndQuit("Email is already in use!", 12); |
|
231 | + } |
|
232 | + |
|
233 | + // invoke OnBeforeUserFormSave event |
|
234 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
235 | + "mode" => "upd", |
|
236 | + "id" => $id |
|
237 | + )); |
|
238 | + |
|
239 | + // update user name and password |
|
240 | + $field = array(); |
|
241 | + $field['username'] = $modx->getDatabase()->escape($newusername); |
|
242 | + if($genpassword == 1) { |
|
243 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
244 | + } |
|
245 | + $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$id}'"); |
|
246 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
247 | + $field = $modx->getDatabase()->escape($field); |
|
248 | + $modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
249 | + |
|
250 | + // Save user settings |
|
251 | 251 | saveManagerUserSettings($id); |
252 | 252 | |
253 | - // Set the item name for logger |
|
254 | - $_SESSION['itemname'] = $newusername; |
|
255 | - |
|
256 | - // invoke OnManagerSaveUser event |
|
257 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
258 | - "mode" => "upd", |
|
259 | - "userid" => $id, |
|
260 | - "username" => $newusername, |
|
261 | - "userpassword" => $newpassword, |
|
262 | - "useremail" => $email, |
|
263 | - "userfullname" => $fullname, |
|
264 | - "userroleid" => $role, |
|
265 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
266 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
267 | - )); |
|
268 | - |
|
269 | - // invoke OnManagerChangePassword event |
|
270 | - if($genpassword == 1) { |
|
271 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
272 | - "userid" => $id, |
|
273 | - "username" => $newusername, |
|
274 | - "userpassword" => $newpassword |
|
275 | - )); |
|
276 | - } |
|
277 | - |
|
278 | - // invoke OnUserFormSave event |
|
279 | - $modx->invokeEvent("OnUserFormSave", array( |
|
280 | - "mode" => "upd", |
|
281 | - "id" => $id |
|
282 | - )); |
|
283 | - |
|
284 | - /*******************************************************************************/ |
|
285 | - // put the user in the user_groups he/ she should be in |
|
286 | - // first, check that up_perms are switched on! |
|
287 | - if($use_udperms == 1) { |
|
288 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
289 | - $modx->getDatabase()->delete($tbl_member_groups, "member='{$id}'"); |
|
290 | - if(!empty($user_groups)) { |
|
291 | - for($i = 0; $i < count($user_groups); $i++) { |
|
292 | - $field = array(); |
|
293 | - $field['user_group'] = (int)$user_groups[$i]; |
|
294 | - $field['member'] = $id; |
|
295 | - $modx->getDatabase()->insert($field, $tbl_member_groups); |
|
296 | - } |
|
297 | - } |
|
298 | - } |
|
299 | - // end of user_groups stuff! |
|
300 | - /*******************************************************************************/ |
|
301 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
302 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
303 | - } |
|
304 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
305 | - if($input['stay'] != '') { |
|
306 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
307 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
308 | - } else { |
|
309 | - $stayUrl = "index.php?a=75&r=2"; |
|
310 | - } |
|
311 | - |
|
312 | - include_once "header.inc.php"; |
|
313 | - ?> |
|
253 | + // Set the item name for logger |
|
254 | + $_SESSION['itemname'] = $newusername; |
|
255 | + |
|
256 | + // invoke OnManagerSaveUser event |
|
257 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
258 | + "mode" => "upd", |
|
259 | + "userid" => $id, |
|
260 | + "username" => $newusername, |
|
261 | + "userpassword" => $newpassword, |
|
262 | + "useremail" => $email, |
|
263 | + "userfullname" => $fullname, |
|
264 | + "userroleid" => $role, |
|
265 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
266 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
267 | + )); |
|
268 | + |
|
269 | + // invoke OnManagerChangePassword event |
|
270 | + if($genpassword == 1) { |
|
271 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
272 | + "userid" => $id, |
|
273 | + "username" => $newusername, |
|
274 | + "userpassword" => $newpassword |
|
275 | + )); |
|
276 | + } |
|
277 | + |
|
278 | + // invoke OnUserFormSave event |
|
279 | + $modx->invokeEvent("OnUserFormSave", array( |
|
280 | + "mode" => "upd", |
|
281 | + "id" => $id |
|
282 | + )); |
|
283 | + |
|
284 | + /*******************************************************************************/ |
|
285 | + // put the user in the user_groups he/ she should be in |
|
286 | + // first, check that up_perms are switched on! |
|
287 | + if($use_udperms == 1) { |
|
288 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
289 | + $modx->getDatabase()->delete($tbl_member_groups, "member='{$id}'"); |
|
290 | + if(!empty($user_groups)) { |
|
291 | + for($i = 0; $i < count($user_groups); $i++) { |
|
292 | + $field = array(); |
|
293 | + $field['user_group'] = (int)$user_groups[$i]; |
|
294 | + $field['member'] = $id; |
|
295 | + $modx->getDatabase()->insert($field, $tbl_member_groups); |
|
296 | + } |
|
297 | + } |
|
298 | + } |
|
299 | + // end of user_groups stuff! |
|
300 | + /*******************************************************************************/ |
|
301 | + if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
302 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
303 | + } |
|
304 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
305 | + if($input['stay'] != '') { |
|
306 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
307 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
308 | + } else { |
|
309 | + $stayUrl = "index.php?a=75&r=2"; |
|
310 | + } |
|
311 | + |
|
312 | + include_once "header.inc.php"; |
|
313 | + ?> |
|
314 | 314 | |
315 | 315 | <h1><?php echo $_lang['user_title']; ?></h1> |
316 | 316 | |
@@ -330,18 +330,18 @@ discard block |
||
330 | 330 | </div> |
331 | 331 | <?php |
332 | 332 | |
333 | - include_once "footer.inc.php"; |
|
334 | - } else { |
|
335 | - if($input['stay'] != '') { |
|
336 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
337 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
338 | - header($header); |
|
339 | - } else { |
|
340 | - $header = "Location: index.php?a=75&r=2"; |
|
341 | - header($header); |
|
342 | - } |
|
343 | - } |
|
344 | - break; |
|
345 | - default: |
|
346 | - webAlertAndQuit("No operation set in request.", 12); |
|
333 | + include_once "footer.inc.php"; |
|
334 | + } else { |
|
335 | + if($input['stay'] != '') { |
|
336 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
337 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
338 | + header($header); |
|
339 | + } else { |
|
340 | + $header = "Location: index.php?a=75&r=2"; |
|
341 | + header($header); |
|
342 | + } |
|
343 | + } |
|
344 | + break; |
|
345 | + default: |
|
346 | + webAlertAndQuit("No operation set in request.", 12); |
|
347 | 347 | } |
@@ -3,51 +3,51 @@ discard block |
||
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('exec_module')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // check if user has access permission, except admins |
15 | 15 | if($_SESSION['mgrRole']!=1){ |
16 | - $rs = $modx->getDatabase()->select( |
|
17 | - 'sma.usergroup,mg.member', |
|
18 | - $modx->getDatabase()->getFullTableName("site_module_access")." sma |
|
16 | + $rs = $modx->getDatabase()->select( |
|
17 | + 'sma.usergroup,mg.member', |
|
18 | + $modx->getDatabase()->getFullTableName("site_module_access")." sma |
|
19 | 19 | LEFT JOIN ".$modx->getDatabase()->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'", |
20 | - "sma.module = '{$id}'" |
|
21 | - ); |
|
22 | - //initialize permission to -1, if it stays -1 no permissions |
|
23 | - //attached so permission granted |
|
24 | - $permissionAccessInt = -1; |
|
20 | + "sma.module = '{$id}'" |
|
21 | + ); |
|
22 | + //initialize permission to -1, if it stays -1 no permissions |
|
23 | + //attached so permission granted |
|
24 | + $permissionAccessInt = -1; |
|
25 | 25 | |
26 | - while ($row = $modx->getDatabase()->getRow($rs)) { |
|
27 | - if($row["usergroup"] && $row["member"]) { |
|
28 | - //if there are permissions and this member has permission, ofcourse |
|
29 | - //this is granted |
|
30 | - $permissionAccessInt = 1; |
|
31 | - } elseif ($permissionAccessInt==-1) { |
|
32 | - //if there are permissions but this member has no permission and the |
|
33 | - //variable was still in init state we set permission to 0; no permissions |
|
34 | - $permissionAccessInt = 0; |
|
35 | - } |
|
36 | - } |
|
26 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
27 | + if($row["usergroup"] && $row["member"]) { |
|
28 | + //if there are permissions and this member has permission, ofcourse |
|
29 | + //this is granted |
|
30 | + $permissionAccessInt = 1; |
|
31 | + } elseif ($permissionAccessInt==-1) { |
|
32 | + //if there are permissions but this member has no permission and the |
|
33 | + //variable was still in init state we set permission to 0; no permissions |
|
34 | + $permissionAccessInt = 0; |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | - if($permissionAccessInt==0) { |
|
39 | - $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
40 | - } |
|
38 | + if($permissionAccessInt==0) { |
|
39 | + $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // get module data |
44 | 44 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName("site_modules"), "id='{$id}'"); |
45 | 45 | $content = $modx->getDatabase()->getRow($rs); |
46 | 46 | if(!$content) { |
47 | - $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
47 | + $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
48 | 48 | } |
49 | 49 | if($content['disabled']) { |
50 | - $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
50 | + $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Set the item name for logger |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $output = evalModule($content["modulecode"],$parameter); |
64 | 64 | if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
65 | - echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
65 | + echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
66 | 66 | } |
67 | 67 | echo $output; |
68 | 68 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
@@ -1,18 +1,18 @@ 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('exec_module')) { |
|
5 | +if (!$modx->hasPermission('exec_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 | |
14 | 14 | // check if user has access permission, except admins |
15 | -if($_SESSION['mgrRole']!=1){ |
|
15 | +if ($_SESSION['mgrRole'] != 1) { |
|
16 | 16 | $rs = $modx->getDatabase()->select( |
17 | 17 | 'sma.usergroup,mg.member', |
18 | 18 | $modx->getDatabase()->getFullTableName("site_module_access")." sma |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | $permissionAccessInt = -1; |
25 | 25 | |
26 | 26 | while ($row = $modx->getDatabase()->getRow($rs)) { |
27 | - if($row["usergroup"] && $row["member"]) { |
|
27 | + if ($row["usergroup"] && $row["member"]) { |
|
28 | 28 | //if there are permissions and this member has permission, ofcourse |
29 | 29 | //this is granted |
30 | 30 | $permissionAccessInt = 1; |
31 | - } elseif ($permissionAccessInt==-1) { |
|
31 | + } elseif ($permissionAccessInt == -1) { |
|
32 | 32 | //if there are permissions but this member has no permission and the |
33 | 33 | //variable was still in init state we set permission to 0; no permissions |
34 | 34 | $permissionAccessInt = 0; |
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | - if($permissionAccessInt==0) { |
|
38 | + if ($permissionAccessInt == 0) { |
|
39 | 39 | $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
40 | 40 | } |
41 | 41 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | // get module data |
44 | 44 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName("site_modules"), "id='{$id}'"); |
45 | 45 | $content = $modx->getDatabase()->getRow($rs); |
46 | -if(!$content) { |
|
46 | +if (!$content) { |
|
47 | 47 | $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
48 | 48 | } |
49 | -if($content['disabled']) { |
|
49 | +if ($content['disabled']) { |
|
50 | 50 | $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
51 | 51 | } |
52 | 52 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | $_SESSION['itemname'] = $content['name']; |
61 | 61 | |
62 | 62 | |
63 | -$output = evalModule($content["modulecode"],$parameter); |
|
64 | -if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
|
63 | +$output = evalModule($content["modulecode"], $parameter); |
|
64 | +if (strpos(trim($output), '<') === 0 && strpos(trim($output), '<?xml') !== 0) { |
|
65 | 65 | echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
66 | 66 | } |
67 | 67 | echo $output; |
@@ -12,7 +12,7 @@ |
||
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->getDatabase()->select( |
17 | 17 | 'sma.usergroup,mg.member', |
18 | 18 | $modx->getDatabase()->getFullTableName("site_module_access")." sma |
@@ -3,7 +3,7 @@ discard block |
||
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('edit_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,68 +25,68 @@ discard block |
||
25 | 25 | // check user has permission to move document to chosen location |
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | - if ($oldparent != $newParentID) { |
|
29 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | - $udperms->user = $modx->getLoginUserID(); |
|
31 | - $udperms->document = $newParentID; |
|
32 | - $udperms->role = $_SESSION['mgrRole']; |
|
28 | + if ($oldparent != $newParentID) { |
|
29 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | + $udperms->user = $modx->getLoginUserID(); |
|
31 | + $udperms->document = $newParentID; |
|
32 | + $udperms->role = $_SESSION['mgrRole']; |
|
33 | 33 | |
34 | - if (!$udperms->checkPermissions()) { |
|
35 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | - } |
|
37 | - } |
|
34 | + if (!$udperms->checkPermissions()) { |
|
35 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
41 | - "id_document" => $documentID, |
|
42 | - "old_parent" => $oldparent, |
|
43 | - "new_parent" => $newParentID |
|
41 | + "id_document" => $documentID, |
|
42 | + "old_parent" => $oldparent, |
|
43 | + "new_parent" => $newParentID |
|
44 | 44 | )); |
45 | 45 | if (is_array($evtOut) && count($evtOut) > 0){ |
46 | - $newParent = array_pop($evtOut); |
|
47 | - if($newParent == $oldparent) { |
|
48 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | - }else{ |
|
50 | - $newParentID = $newParent; |
|
51 | - } |
|
46 | + $newParent = array_pop($evtOut); |
|
47 | + if($newParent == $oldparent) { |
|
48 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | + }else{ |
|
50 | + $newParentID = $newParent; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $children = allChildren($documentID); |
55 | 55 | if (!array_search($newParentID, $children)) { |
56 | - $modx->getDatabase()->update(array( |
|
57 | - 'isfolder' => 1, |
|
58 | - ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
56 | + $modx->getDatabase()->update(array( |
|
57 | + 'isfolder' => 1, |
|
58 | + ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
59 | 59 | |
60 | - $modx->getDatabase()->update(array( |
|
61 | - 'parent' => $newParentID, |
|
62 | - 'editedby' => $modx->getLoginUserID(), |
|
63 | - 'editedon' => time(), |
|
64 | - ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'"); |
|
60 | + $modx->getDatabase()->update(array( |
|
61 | + 'parent' => $newParentID, |
|
62 | + 'editedby' => $modx->getLoginUserID(), |
|
63 | + 'editedon' => time(), |
|
64 | + ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'"); |
|
65 | 65 | |
66 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | - $limit = $modx->getDatabase()->getValue($rs); |
|
66 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | + $limit = $modx->getDatabase()->getValue($rs); |
|
69 | 69 | |
70 | - if(!$limit>0) { |
|
71 | - $modx->getDatabase()->update(array( |
|
72 | - 'isfolder' => 0, |
|
73 | - ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | - } |
|
75 | - // Set the item name for logger |
|
76 | - $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | - $_SESSION['itemname'] = $pagetitle; |
|
70 | + if(!$limit>0) { |
|
71 | + $modx->getDatabase()->update(array( |
|
72 | + 'isfolder' => 0, |
|
73 | + ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | + } |
|
75 | + // Set the item name for logger |
|
76 | + $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | + $_SESSION['itemname'] = $pagetitle; |
|
78 | 78 | |
79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | - "id_document" => $documentID, |
|
81 | - "old_parent" => $oldparent, |
|
82 | - "new_parent" => $newParentID |
|
83 | - )); |
|
79 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | + "id_document" => $documentID, |
|
81 | + "old_parent" => $oldparent, |
|
82 | + "new_parent" => $newParentID |
|
83 | + )); |
|
84 | 84 | |
85 | - // empty cache & sync site |
|
86 | - $modx->clearCache('full'); |
|
85 | + // empty cache & sync site |
|
86 | + $modx->clearCache('full'); |
|
87 | 87 | |
88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | - header($header); |
|
88 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | + header($header); |
|
90 | 90 | } else { |
91 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
91 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
92 | 92 | } |
@@ -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->getDatabase()->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->getDatabase()->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->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!"); |
@@ -12,12 +12,20 @@ discard block |
||
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) { |
|
16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
17 | +} |
|
18 | +if($documentID <= 0) { |
|
19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
20 | +} |
|
21 | +if($newParentID < 0) { |
|
22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
23 | +} |
|
18 | 24 | |
19 | 25 | $parents = $modx->getParentIds($newParentID); |
20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
26 | +if (in_array($documentID, $parents)) { |
|
27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
28 | +} |
|
21 | 29 | |
22 | 30 | $rs = $modx->getDatabase()->select('parent', $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'"); |
23 | 31 | $oldparent = $modx->getDatabase()->getValue($rs); |
@@ -42,11 +50,11 @@ discard block |
||
42 | 50 | "old_parent" => $oldparent, |
43 | 51 | "new_parent" => $newParentID |
44 | 52 | )); |
45 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
53 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
46 | 54 | $newParent = array_pop($evtOut); |
47 | 55 | if($newParent == $oldparent) { |
48 | 56 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
49 | - }else{ |
|
57 | + } else { |
|
50 | 58 | $newParentID = $newParent; |
51 | 59 | } |
52 | 60 | } |
@@ -1,135 +1,135 @@ |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || 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."); |
|
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_role')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | 11 | if($name == '' || !isset ($name)) { |
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
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 |
16 | 16 | $fields = array( |
17 | - 'name' => $name, |
|
18 | - 'description' => $description, |
|
19 | - 'frames' => $frames, |
|
20 | - 'home' => $home, |
|
21 | - 'view_document' => $view_document, |
|
22 | - 'new_document' => $new_document, |
|
23 | - 'save_document' => $save_document, |
|
24 | - 'publish_document' => $publish_document, |
|
25 | - 'delete_document' => $delete_document, |
|
26 | - 'empty_trash' => $empty_trash, |
|
27 | - 'action_ok' => $action_ok, |
|
28 | - 'logout' => $logout, |
|
29 | - 'help' => $help, |
|
30 | - 'messages' => $messages, |
|
31 | - 'new_user' => $new_user, |
|
32 | - 'edit_user' => $edit_user, |
|
33 | - 'logs' => $logs, |
|
34 | - 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | - 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | - 'edit_template' => $edit_template, |
|
37 | - 'settings' => $settings, |
|
38 | - 'credits' => $credits, |
|
39 | - 'new_template' => $new_template, |
|
40 | - 'save_template' => $save_template, |
|
41 | - 'delete_template' => $delete_template, |
|
42 | - 'edit_snippet' => $edit_snippet, |
|
43 | - 'new_snippet' => $new_snippet, |
|
44 | - 'save_snippet' => $save_snippet, |
|
45 | - 'delete_snippet' => $delete_snippet, |
|
46 | - 'edit_chunk' => $edit_chunk, |
|
47 | - 'new_chunk' => $new_chunk, |
|
48 | - 'save_chunk' => $save_chunk, |
|
49 | - 'delete_chunk' => $delete_chunk, |
|
50 | - 'empty_cache' => $empty_cache, |
|
51 | - 'edit_document' => $edit_document, |
|
52 | - 'change_password' => $change_password, |
|
53 | - 'error_dialog' => $error_dialog, |
|
54 | - 'about' => $about, |
|
55 | - 'file_manager' => $file_manager, |
|
56 | - 'assets_files' => $assets_files, |
|
57 | - 'assets_images' => $assets_images, |
|
58 | - 'save_user' => $save_user, |
|
59 | - 'delete_user' => $delete_user, |
|
60 | - 'save_password' => $save_password, |
|
61 | - 'edit_role' => $edit_role, |
|
62 | - 'save_role' => $save_role, |
|
63 | - 'delete_role' => $delete_role, |
|
64 | - 'new_role' => $new_role, |
|
65 | - 'access_permissions' => $access_permissions, |
|
66 | - 'bk_manager' => $bk_manager, |
|
67 | - 'new_plugin' => $new_plugin, |
|
68 | - 'edit_plugin' => $edit_plugin, |
|
69 | - 'save_plugin' => $save_plugin, |
|
70 | - 'delete_plugin' => $delete_plugin, |
|
71 | - 'new_module' => $new_module, |
|
72 | - 'edit_module' => $edit_module, |
|
73 | - 'save_module' => $save_module, |
|
74 | - 'delete_module' => $delete_module, |
|
75 | - 'exec_module' => $exec_module, |
|
76 | - 'view_eventlog' => $view_eventlog, |
|
77 | - 'delete_eventlog' => $delete_eventlog, |
|
78 | - 'new_web_user' => $new_web_user, |
|
79 | - 'edit_web_user' => $edit_web_user, |
|
80 | - 'save_web_user' => $save_web_user, |
|
81 | - 'delete_web_user' => $delete_web_user, |
|
82 | - 'web_access_permissions' => $web_access_permissions, |
|
83 | - 'view_unpublished' => $view_unpublished, |
|
84 | - 'import_static' => $import_static, |
|
85 | - 'export_static' => $export_static, |
|
86 | - 'remove_locks' => $remove_locks, |
|
87 | - 'display_locks' => $display_locks, |
|
88 | - 'change_resourcetype' => $change_resourcetype, |
|
89 | - 'category_manager' => $category_manager |
|
17 | + 'name' => $name, |
|
18 | + 'description' => $description, |
|
19 | + 'frames' => $frames, |
|
20 | + 'home' => $home, |
|
21 | + 'view_document' => $view_document, |
|
22 | + 'new_document' => $new_document, |
|
23 | + 'save_document' => $save_document, |
|
24 | + 'publish_document' => $publish_document, |
|
25 | + 'delete_document' => $delete_document, |
|
26 | + 'empty_trash' => $empty_trash, |
|
27 | + 'action_ok' => $action_ok, |
|
28 | + 'logout' => $logout, |
|
29 | + 'help' => $help, |
|
30 | + 'messages' => $messages, |
|
31 | + 'new_user' => $new_user, |
|
32 | + 'edit_user' => $edit_user, |
|
33 | + 'logs' => $logs, |
|
34 | + 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | + 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | + 'edit_template' => $edit_template, |
|
37 | + 'settings' => $settings, |
|
38 | + 'credits' => $credits, |
|
39 | + 'new_template' => $new_template, |
|
40 | + 'save_template' => $save_template, |
|
41 | + 'delete_template' => $delete_template, |
|
42 | + 'edit_snippet' => $edit_snippet, |
|
43 | + 'new_snippet' => $new_snippet, |
|
44 | + 'save_snippet' => $save_snippet, |
|
45 | + 'delete_snippet' => $delete_snippet, |
|
46 | + 'edit_chunk' => $edit_chunk, |
|
47 | + 'new_chunk' => $new_chunk, |
|
48 | + 'save_chunk' => $save_chunk, |
|
49 | + 'delete_chunk' => $delete_chunk, |
|
50 | + 'empty_cache' => $empty_cache, |
|
51 | + 'edit_document' => $edit_document, |
|
52 | + 'change_password' => $change_password, |
|
53 | + 'error_dialog' => $error_dialog, |
|
54 | + 'about' => $about, |
|
55 | + 'file_manager' => $file_manager, |
|
56 | + 'assets_files' => $assets_files, |
|
57 | + 'assets_images' => $assets_images, |
|
58 | + 'save_user' => $save_user, |
|
59 | + 'delete_user' => $delete_user, |
|
60 | + 'save_password' => $save_password, |
|
61 | + 'edit_role' => $edit_role, |
|
62 | + 'save_role' => $save_role, |
|
63 | + 'delete_role' => $delete_role, |
|
64 | + 'new_role' => $new_role, |
|
65 | + 'access_permissions' => $access_permissions, |
|
66 | + 'bk_manager' => $bk_manager, |
|
67 | + 'new_plugin' => $new_plugin, |
|
68 | + 'edit_plugin' => $edit_plugin, |
|
69 | + 'save_plugin' => $save_plugin, |
|
70 | + 'delete_plugin' => $delete_plugin, |
|
71 | + 'new_module' => $new_module, |
|
72 | + 'edit_module' => $edit_module, |
|
73 | + 'save_module' => $save_module, |
|
74 | + 'delete_module' => $delete_module, |
|
75 | + 'exec_module' => $exec_module, |
|
76 | + 'view_eventlog' => $view_eventlog, |
|
77 | + 'delete_eventlog' => $delete_eventlog, |
|
78 | + 'new_web_user' => $new_web_user, |
|
79 | + 'edit_web_user' => $edit_web_user, |
|
80 | + 'save_web_user' => $save_web_user, |
|
81 | + 'delete_web_user' => $delete_web_user, |
|
82 | + 'web_access_permissions' => $web_access_permissions, |
|
83 | + 'view_unpublished' => $view_unpublished, |
|
84 | + 'import_static' => $import_static, |
|
85 | + 'export_static' => $export_static, |
|
86 | + 'remove_locks' => $remove_locks, |
|
87 | + 'display_locks' => $display_locks, |
|
88 | + 'change_resourcetype' => $change_resourcetype, |
|
89 | + 'category_manager' => $category_manager |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | $fields = $modx->getDatabase()->escape($fields); |
93 | 93 | |
94 | 94 | switch($_POST['mode']) { |
95 | - case '38' : |
|
96 | - $tbl = $modx->getDatabase()->getFullTableName("user_roles"); |
|
95 | + case '38' : |
|
96 | + $tbl = $modx->getDatabase()->getFullTableName("user_roles"); |
|
97 | 97 | |
98 | - // disallow duplicate names for role |
|
99 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | - $modx->getManagerApi()->saveFormValues(38); |
|
102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | - } |
|
98 | + // disallow duplicate names for role |
|
99 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | + if($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | + $modx->getManagerApi()->saveFormValues(38); |
|
102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | + } |
|
104 | 104 | |
105 | - $modx->getDatabase()->insert($fields, $tbl); |
|
105 | + $modx->getDatabase()->insert($fields, $tbl); |
|
106 | 106 | |
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $_POST['name']; |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $_POST['name']; |
|
109 | 109 | |
110 | - $header = "Location: index.php?a=86&r=2"; |
|
111 | - header($header); |
|
112 | - break; |
|
113 | - case '35' : |
|
114 | - $tbl = $modx->getDatabase()->getFullTableName("user_roles"); |
|
110 | + $header = "Location: index.php?a=86&r=2"; |
|
111 | + header($header); |
|
112 | + break; |
|
113 | + case '35' : |
|
114 | + $tbl = $modx->getDatabase()->getFullTableName("user_roles"); |
|
115 | 115 | |
116 | - // disallow duplicate names for role |
|
117 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | - $modx->getManagerApi()->saveFormValues(35); |
|
120 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | - } |
|
116 | + // disallow duplicate names for role |
|
117 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | + if($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | + $modx->getManagerApi()->saveFormValues(35); |
|
120 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | + } |
|
122 | 122 | |
123 | - $modx->getDatabase()->update($fields, $tbl, "id='{$id}'"); |
|
123 | + $modx->getDatabase()->update($fields, $tbl, "id='{$id}'"); |
|
124 | 124 | |
125 | - // Set the item name for logger |
|
126 | - $_SESSION['itemname'] = $_POST['name']; |
|
125 | + // Set the item name for logger |
|
126 | + $_SESSION['itemname'] = $_POST['name']; |
|
127 | 127 | |
128 | - $header = "Location: index.php?a=86&r=2"; |
|
129 | - header($header); |
|
130 | - break; |
|
131 | - default : |
|
132 | - $modx->webAlertAndQuit("No operation set in request."); |
|
128 | + $header = "Location: index.php?a=86&r=2"; |
|
129 | + header($header); |
|
130 | + break; |
|
131 | + default : |
|
132 | + $modx->webAlertAndQuit("No operation set in request."); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $modx->unlockElement(8, $id); |
@@ -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->getDatabase()->getFullTableName("user_roles"); |
97 | 97 | |
98 | 98 | // disallow duplicate names for role |
99 | 99 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->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->getDatabase()->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 | } |
@@ -3,7 +3,7 @@ discard block |
||
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_password')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = $_POST['id']; |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | $pass2 = $_POST['pass2']; |
12 | 12 | |
13 | 13 | if($pass1!=$pass2){ |
14 | - $modx->webAlertAndQuit("Passwords don't match!"); |
|
14 | + $modx->webAlertAndQuit("Passwords don't match!"); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | if(strlen($pass1)<6){ |
18 | - $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
18 | + $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $pass1 = $modx->getPhpCompat()->htmlspecialchars($pass1, ENT_NOQUOTES); |
22 | - $tbl_manager_users = $modx->getDatabase()->getFullTableName('manager_users'); |
|
23 | - $uid = $modx->getLoginUserID(); |
|
24 | - $f['password'] = $modx->getPasswordHash()->HashPassword($pass1); |
|
25 | - $modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
22 | + $tbl_manager_users = $modx->getDatabase()->getFullTableName('manager_users'); |
|
23 | + $uid = $modx->getLoginUserID(); |
|
24 | + $f['password'] = $modx->getPasswordHash()->HashPassword($pass1); |
|
25 | + $modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
26 | 26 | |
27 | - // invoke OnManagerChangePassword event |
|
28 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
29 | - 'userid' => $uid, |
|
30 | - 'username' => $_SESSION['mgrShortname'], |
|
31 | - 'userpassword' => $pass1 |
|
32 | - )); |
|
27 | + // invoke OnManagerChangePassword event |
|
28 | + $modx->invokeEvent('OnManagerChangePassword', array ( |
|
29 | + 'userid' => $uid, |
|
30 | + 'username' => $_SESSION['mgrShortname'], |
|
31 | + 'userpassword' => $pass1 |
|
32 | + )); |
|
33 | 33 | |
34 | 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('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->getDatabase()->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); |
@@ -3,7 +3,7 @@ discard block |
||
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('settings')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
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 |
@@ -11,41 +11,41 @@ discard block |
||
11 | 11 | |
12 | 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)) |
|
18 | - { |
|
19 | - $_ = file_get_contents($htaccess); |
|
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
22 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
29 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$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 | + { |
|
19 | + $_ = file_get_contents($htaccess); |
|
20 | + if(strpos($_,'RewriteBase')===false) |
|
36 | 21 | { |
37 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | - } |
|
39 | - elseif($modx->config['base_url']!=='/') |
|
40 | - { |
|
41 | - $_ = file_get_contents($htaccess); |
|
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
45 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
22 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | + } |
|
24 | + elseif(is_writable($htaccess)) |
|
25 | + { |
|
26 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | + if(!@file_put_contents($htaccess,$_)) |
|
28 | + { |
|
29 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | + elseif(is_file($sample_htaccess)) |
|
34 | + { |
|
35 | + if(!@rename($sample_htaccess,$htaccess)) |
|
36 | + { |
|
37 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | + } |
|
39 | + elseif($modx->config['base_url']!=='/') |
|
40 | + { |
|
41 | + $_ = file_get_contents($htaccess); |
|
42 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | + if(!@file_put_contents($htaccess,$_)) |
|
44 | + { |
|
45 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -56,19 +56,19 @@ discard block |
||
56 | 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)) { |
|
62 | - include($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 | + include($lang_path); |
|
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
65 | - } |
|
66 | - } |
|
67 | - $savethese = array(); |
|
68 | - $data['sys_files_checksum'] = $modx->getManagerApi()->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 |
|
70 | - foreach ($data as $k => $v) { |
|
71 | - switch ($k) { |
|
65 | + } |
|
66 | + } |
|
67 | + $savethese = array(); |
|
68 | + $data['sys_files_checksum'] = $modx->getManagerApi()->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 |
|
70 | + foreach ($data as $k => $v) { |
|
71 | + switch ($k) { |
|
72 | 72 | case 'settings_version':{ |
73 | 73 | if($modx->getVersionData('version')!=$data['settings_version']){ |
74 | 74 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -76,24 +76,24 @@ discard block |
||
76 | 76 | } |
77 | 77 | break; |
78 | 78 | } |
79 | - case 'error_page': |
|
80 | - case 'unauthorized_page': |
|
81 | - if (trim($v) == '' || !is_numeric($v)) { |
|
82 | - $v = $data['site_start']; |
|
83 | - } |
|
84 | - break; |
|
79 | + case 'error_page': |
|
80 | + case 'unauthorized_page': |
|
81 | + if (trim($v) == '' || !is_numeric($v)) { |
|
82 | + $v = $data['site_start']; |
|
83 | + } |
|
84 | + break; |
|
85 | 85 | |
86 | - case 'lst_custom_contenttype': |
|
87 | - case 'txt_custom_contenttype': |
|
88 | - // Skip these |
|
89 | - $k = ''; |
|
90 | - break; |
|
91 | - case 'rb_base_dir': |
|
92 | - case 'rb_base_url': |
|
93 | - case 'filemanager_path': |
|
94 | - $v = trim($v); |
|
95 | - $v = rtrim($v,'/') . '/'; |
|
96 | - break; |
|
86 | + case 'lst_custom_contenttype': |
|
87 | + case 'txt_custom_contenttype': |
|
88 | + // Skip these |
|
89 | + $k = ''; |
|
90 | + break; |
|
91 | + case 'rb_base_dir': |
|
92 | + case 'rb_base_url': |
|
93 | + case 'filemanager_path': |
|
94 | + $v = trim($v); |
|
95 | + $v = rtrim($v,'/') . '/'; |
|
96 | + break; |
|
97 | 97 | case 'manager_language': |
98 | 98 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
99 | 99 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -101,56 +101,56 @@ discard block |
||
101 | 101 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
102 | 102 | $v = 'english'; |
103 | 103 | } |
104 | - break; |
|
105 | - case 'smtppw': |
|
106 | - if ($v !== '********************' && $v !== '') { |
|
107 | - $v = trim($v); |
|
108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | - $v = str_replace('=','%',$v); |
|
110 | - } elseif ($v === '********************') { |
|
111 | - $k = ''; |
|
112 | - } |
|
113 | - break; |
|
104 | + break; |
|
105 | + case 'smtppw': |
|
106 | + if ($v !== '********************' && $v !== '') { |
|
107 | + $v = trim($v); |
|
108 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | + $v = str_replace('=','%',$v); |
|
110 | + } elseif ($v === '********************') { |
|
111 | + $k = ''; |
|
112 | + } |
|
113 | + break; |
|
114 | 114 | case 'valid_hostnames': |
115 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
116 | - if ($v !== ',') { |
|
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); |
|
120 | - } |
|
121 | - $k = ''; |
|
122 | - break; |
|
123 | - case 'session_timeout': |
|
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 |
|
126 | - break; |
|
127 | - default: |
|
128 | - break; |
|
129 | - } |
|
130 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
115 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
116 | + if ($v !== ',') { |
|
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); |
|
120 | + } |
|
121 | + $k = ''; |
|
122 | + break; |
|
123 | + case 'session_timeout': |
|
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 |
|
126 | + break; |
|
127 | + default: |
|
128 | + break; |
|
129 | + } |
|
130 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
131 | 131 | |
132 | - $modx->config[$k] = $v; |
|
132 | + $modx->config[$k] = $v; |
|
133 | 133 | |
134 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
135 | - } |
|
134 | + if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
135 | + } |
|
136 | 136 | |
137 | - // Run a single query to save all the values |
|
138 | - $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) |
|
137 | + // Run a single query to save all the values |
|
138 | + $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) |
|
139 | 139 | VALUES ".implode(', ', $savethese); |
140 | - $modx->getDatabase()->query($sql); |
|
140 | + $modx->getDatabase()->query($sql); |
|
141 | 141 | |
142 | - // Reset Template Pages |
|
143 | - if (isset($data['reset_template'])) { |
|
144 | - $newtemplate = (int)$data['default_template']; |
|
145 | - $oldtemplate = (int)$data['old_template']; |
|
146 | - $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
|
147 | - $reset = $data['reset_template']; |
|
148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
150 | - } |
|
142 | + // Reset Template Pages |
|
143 | + if (isset($data['reset_template'])) { |
|
144 | + $newtemplate = (int)$data['default_template']; |
|
145 | + $oldtemplate = (int)$data['old_template']; |
|
146 | + $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
|
147 | + $reset = $data['reset_template']; |
|
148 | + if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | + else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
150 | + } |
|
151 | 151 | |
152 | - // empty cache |
|
153 | - $modx->clearCache('full'); |
|
152 | + // empty cache |
|
153 | + $modx->clearCache('full'); |
|
154 | 154 | } |
155 | 155 | $header="Location: index.php?a=7&r=10"; |
156 | 156 | 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->getManagerApi()->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->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
134 | + if (!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->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->getDatabase()->getFullTableName('site_content'); |
147 | 147 | $reset = $data['reset_template']; |
148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
148 | + if ($reset == 1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | + else if ($reset == 2) $modx->getDatabase()->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); |
@@ -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->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
122 | + if(!empty($k)) { |
|
123 | + $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->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 = (int)$data['old_template']; |
146 | 136 | $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
147 | 137 | $reset = $data['reset_template']; |
148 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
149 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
138 | + if($reset==1) { |
|
139 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | + } else if($reset==2) { |
|
141 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
142 | + } |
|
150 | 143 | } |
151 | 144 | |
152 | 145 | // empty cache |
@@ -4,8 +4,8 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!$modx->hasPermission('delete_plugin')) { |
7 | - $e->setError(3); |
|
8 | - $e->dumpError(); |
|
7 | + $e->setError(3); |
|
8 | + $e->dumpError(); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $tbl_site_plugins = $modx->getDatabase()->getFullTableName('site_plugins'); |