@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('messages')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if ($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit("Wrong number of messages returned!"); |
19 | 19 | } |
20 | 20 | |
21 | -if ($message['recipient']!=$modx->getLoginUserID()) { |
|
21 | +if ($message['recipient'] != $modx->getLoginUserID()) { |
|
22 | 22 | $modx->webAlertAndQuit("You are not allowed to delete this message!"); |
23 | 23 | } |
24 | 24 | |
25 | 25 | // delete message |
26 | 26 | $modx->getDatabase()->delete($modx->getFullTableName('user_messages'), "id='{$id}'"); |
27 | 27 | |
28 | -$header="Location: index.php?a=10"; |
|
28 | +$header = "Location: index.php?a=10"; |
|
29 | 29 | header($header); |
@@ -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_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 | // count duplicates |
14 | 14 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
@@ -18,40 +18,40 @@ discard block |
||
18 | 18 | |
19 | 19 | // duplicate module |
20 | 20 | $newid = $modx->getDatabase()->insert( |
21 | - array( |
|
22 | - 'name'=>'', |
|
23 | - 'description'=>'', |
|
24 | - 'disabled'=>'', |
|
25 | - 'category'=>'', |
|
26 | - 'wrap'=>'', |
|
27 | - 'icon'=>'', |
|
28 | - 'enable_resource'=>'', |
|
29 | - 'resourcefile'=>'', |
|
30 | - 'createdon'=>'', |
|
31 | - 'editedon'=>'', |
|
32 | - 'guid'=>'', |
|
33 | - 'enable_sharedparams'=>'', |
|
34 | - 'properties'=>'', |
|
35 | - 'modulecode'=>'', |
|
36 | - ), $modx->getFullTableName('site_modules'), // Insert into |
|
37 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from |
|
21 | + array( |
|
22 | + 'name'=>'', |
|
23 | + 'description'=>'', |
|
24 | + 'disabled'=>'', |
|
25 | + 'category'=>'', |
|
26 | + 'wrap'=>'', |
|
27 | + 'icon'=>'', |
|
28 | + 'enable_resource'=>'', |
|
29 | + 'resourcefile'=>'', |
|
30 | + 'createdon'=>'', |
|
31 | + 'editedon'=>'', |
|
32 | + 'guid'=>'', |
|
33 | + 'enable_sharedparams'=>'', |
|
34 | + 'properties'=>'', |
|
35 | + 'modulecode'=>'', |
|
36 | + ), $modx->getFullTableName('site_modules'), // Insert into |
|
37 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from |
|
38 | 38 | |
39 | 39 | // duplicate module dependencies |
40 | 40 | $modx->getDatabase()->insert( |
41 | - array( |
|
42 | - 'module'=>'', |
|
43 | - 'resource'=>'', |
|
44 | - 'type'=>'', |
|
45 | - ), $modx->getFullTableName('site_module_depobj'), // Insert into |
|
46 | - "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from |
|
41 | + array( |
|
42 | + 'module'=>'', |
|
43 | + 'resource'=>'', |
|
44 | + 'type'=>'', |
|
45 | + ), $modx->getFullTableName('site_module_depobj'), // Insert into |
|
46 | + "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from |
|
47 | 47 | |
48 | 48 | // duplicate module user group access |
49 | 49 | $modx->getDatabase()->insert( |
50 | - array( |
|
51 | - 'module'=>'', |
|
52 | - 'usergroup'=>'', |
|
53 | - ), $modx->getFullTableName('site_module_access'), // Insert into |
|
54 | - "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from |
|
50 | + array( |
|
51 | + 'module'=>'', |
|
52 | + 'usergroup'=>'', |
|
53 | + ), $modx->getFullTableName('site_module_access'), // Insert into |
|
54 | + "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from |
|
55 | 55 | |
56 | 56 | // Set the item name for logger |
57 | 57 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "id='{$newid}'")); |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_module')) { |
|
5 | +if (!$modx->hasPermission('new_module')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | // count duplicates |
14 | 14 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
15 | 15 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
16 | -if($count>=1) $count = ' '.($count+1); |
|
16 | +if ($count >= 1) $count = ' '.($count + 1); |
|
17 | 17 | else $count = ''; |
18 | 18 | |
19 | 19 | // duplicate module |
@@ -58,5 +58,5 @@ discard block |
||
58 | 58 | $_SESSION['itemname'] = $name; |
59 | 59 | |
60 | 60 | // finish duplicating - redirect to new module |
61 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
61 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
62 | 62 | header($header); |
@@ -13,8 +13,11 @@ |
||
13 | 13 | // count duplicates |
14 | 14 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
15 | 15 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
16 | -if($count>=1) $count = ' '.($count+1); |
|
17 | -else $count = ''; |
|
16 | +if($count>=1) { |
|
17 | + $count = ' '.($count+1); |
|
18 | +} else { |
|
19 | + $count = ''; |
|
20 | +} |
|
18 | 21 | |
19 | 22 | // duplicate module |
20 | 23 | $newid = $modx->getDatabase()->insert( |
@@ -3,33 +3,33 @@ |
||
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') && ($modx->hasPermission('logs')||$modx->hasPermission('bk_manager')))) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | if (isset($_REQUEST['t'])) { |
10 | 10 | |
11 | - if (empty($_REQUEST['t'])) { |
|
12 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
13 | - } |
|
11 | + if (empty($_REQUEST['t'])) { |
|
12 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
13 | + } |
|
14 | 14 | |
15 | - // Set the item name for logger |
|
16 | - $_SESSION['itemname'] = $_REQUEST['t']; |
|
15 | + // Set the item name for logger |
|
16 | + $_SESSION['itemname'] = $_REQUEST['t']; |
|
17 | 17 | |
18 | - $modx->getDatabase()->optimize($_REQUEST['t']); |
|
18 | + $modx->getDatabase()->optimize($_REQUEST['t']); |
|
19 | 19 | |
20 | 20 | } elseif (isset($_REQUEST['u'])) { |
21 | 21 | |
22 | - if (empty($_REQUEST['u'])) { |
|
23 | - $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
24 | - } |
|
22 | + if (empty($_REQUEST['u'])) { |
|
23 | + $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
24 | + } |
|
25 | 25 | |
26 | - // Set the item name for logger |
|
27 | - $_SESSION['itemname'] = $_REQUEST['u']; |
|
26 | + // Set the item name for logger |
|
27 | + $_SESSION['itemname'] = $_REQUEST['u']; |
|
28 | 28 | |
29 | - $modx->getDatabase()->truncate($_REQUEST['u']); |
|
29 | + $modx->getDatabase()->truncate($_REQUEST['u']); |
|
30 | 30 | |
31 | 31 | } else { |
32 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
32 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $mode = (int)$_REQUEST['mode']; |
@@ -59,123 +59,123 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | switch ($_POST['mode']) { |
62 | - case '107': |
|
63 | - // invoke OnBeforeModFormSave event |
|
64 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
65 | - "mode" => "new", |
|
66 | - "id" => $id |
|
67 | - )); |
|
68 | - |
|
69 | - // disallow duplicate names for new modules |
|
70 | - $rs = $modx->getDatabase()->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}'"); |
|
71 | - $count = $modx->getDatabase()->getValue($rs); |
|
72 | - if ($count > 0) { |
|
73 | - $modx->getManagerApi()->saveFormValues(107); |
|
74 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
75 | - } |
|
76 | - |
|
77 | - // save the new module |
|
78 | - $newid = $modx->getDatabase()->insert(array( |
|
79 | - 'name' => $name, |
|
80 | - 'description' => $description, |
|
81 | - 'disabled' => $disabled, |
|
82 | - 'wrap' => $wrap, |
|
83 | - 'locked' => $locked, |
|
84 | - 'icon' => $icon, |
|
85 | - 'resourcefile' => $resourcefile, |
|
86 | - 'enable_resource' => $enable_resource, |
|
87 | - 'category' => $categoryid, |
|
88 | - 'enable_sharedparams' => $enable_sharedparams, |
|
89 | - 'guid' => $guid, |
|
90 | - 'modulecode' => $modulecode, |
|
91 | - 'properties' => $properties, |
|
92 | - 'createdon' => $currentdate, |
|
93 | - 'editedon' => $currentdate |
|
94 | - ), $modx->getFullTableName('site_modules')); |
|
95 | - |
|
96 | - // save user group access permissions |
|
97 | - saveUserGroupAccessPermissons(); |
|
98 | - |
|
99 | - // invoke OnModFormSave event |
|
100 | - $modx->invokeEvent("OnModFormSave", array( |
|
101 | - "mode" => "new", |
|
102 | - "id" => $newid |
|
103 | - )); |
|
104 | - |
|
105 | - // Set the item name for logger |
|
106 | - $_SESSION['itemname'] = $name; |
|
107 | - |
|
108 | - // empty cache |
|
109 | - $modx->clearCache('full'); |
|
110 | - |
|
111 | - // finished emptying cache - redirect |
|
112 | - if ($_POST['stay'] != '') { |
|
113 | - $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | - header($header); |
|
116 | - } else { |
|
117 | - $header = "Location: index.php?a=106&r=2"; |
|
118 | - header($header); |
|
119 | - } |
|
120 | - break; |
|
121 | - case '108': |
|
122 | - // invoke OnBeforeModFormSave event |
|
123 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
124 | - "mode" => "upd", |
|
125 | - "id" => $id |
|
126 | - )); |
|
127 | - |
|
128 | - // disallow duplicate names for new modules |
|
129 | - $rs = $modx->getDatabase()->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
130 | - if ($modx->getDatabase()->getValue($rs) > 0) { |
|
131 | - $modx->getManagerApi()->saveFormValues(108); |
|
132 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
133 | - } |
|
134 | - |
|
135 | - // save the edited module |
|
136 | - $modx->getDatabase()->update(array( |
|
137 | - 'name' => $name, |
|
138 | - 'description' => $description, |
|
139 | - 'icon' => $icon, |
|
140 | - 'enable_resource' => $enable_resource, |
|
141 | - 'resourcefile' => $resourcefile, |
|
142 | - 'disabled' => $disabled, |
|
143 | - 'wrap' => $wrap, |
|
144 | - 'locked' => $locked, |
|
145 | - 'category' => $categoryid, |
|
146 | - 'enable_sharedparams' => $enable_sharedparams, |
|
147 | - 'guid' => $guid, |
|
148 | - 'modulecode' => $modulecode, |
|
149 | - 'properties' => $properties, |
|
150 | - 'editedon' => $currentdate |
|
151 | - ), $modx->getFullTableName('site_modules'), "id='{$id}'"); |
|
152 | - |
|
153 | - // save user group access permissions |
|
154 | - saveUserGroupAccessPermissons(); |
|
155 | - |
|
156 | - // invoke OnModFormSave event |
|
157 | - $modx->invokeEvent("OnModFormSave", array( |
|
158 | - "mode" => "upd", |
|
159 | - "id" => $id |
|
160 | - )); |
|
161 | - |
|
162 | - // Set the item name for logger |
|
163 | - $_SESSION['itemname'] = $name; |
|
164 | - |
|
165 | - // empty cache |
|
166 | - $modx->clearCache('full'); |
|
167 | - |
|
168 | - // finished emptying cache - redirect |
|
169 | - if ($_POST['stay'] != '') { |
|
170 | - $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
172 | - header($header); |
|
173 | - } else { |
|
174 | - $modx->unlockElement(6, $id); |
|
175 | - $header = "Location: index.php?a=106&r=2"; |
|
176 | - header($header); |
|
177 | - } |
|
178 | - break; |
|
179 | - default: |
|
180 | - $modx->webAlertAndQuit("No operation set in request."); |
|
62 | + case '107': |
|
63 | + // invoke OnBeforeModFormSave event |
|
64 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
65 | + "mode" => "new", |
|
66 | + "id" => $id |
|
67 | + )); |
|
68 | + |
|
69 | + // disallow duplicate names for new modules |
|
70 | + $rs = $modx->getDatabase()->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}'"); |
|
71 | + $count = $modx->getDatabase()->getValue($rs); |
|
72 | + if ($count > 0) { |
|
73 | + $modx->getManagerApi()->saveFormValues(107); |
|
74 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
75 | + } |
|
76 | + |
|
77 | + // save the new module |
|
78 | + $newid = $modx->getDatabase()->insert(array( |
|
79 | + 'name' => $name, |
|
80 | + 'description' => $description, |
|
81 | + 'disabled' => $disabled, |
|
82 | + 'wrap' => $wrap, |
|
83 | + 'locked' => $locked, |
|
84 | + 'icon' => $icon, |
|
85 | + 'resourcefile' => $resourcefile, |
|
86 | + 'enable_resource' => $enable_resource, |
|
87 | + 'category' => $categoryid, |
|
88 | + 'enable_sharedparams' => $enable_sharedparams, |
|
89 | + 'guid' => $guid, |
|
90 | + 'modulecode' => $modulecode, |
|
91 | + 'properties' => $properties, |
|
92 | + 'createdon' => $currentdate, |
|
93 | + 'editedon' => $currentdate |
|
94 | + ), $modx->getFullTableName('site_modules')); |
|
95 | + |
|
96 | + // save user group access permissions |
|
97 | + saveUserGroupAccessPermissons(); |
|
98 | + |
|
99 | + // invoke OnModFormSave event |
|
100 | + $modx->invokeEvent("OnModFormSave", array( |
|
101 | + "mode" => "new", |
|
102 | + "id" => $newid |
|
103 | + )); |
|
104 | + |
|
105 | + // Set the item name for logger |
|
106 | + $_SESSION['itemname'] = $name; |
|
107 | + |
|
108 | + // empty cache |
|
109 | + $modx->clearCache('full'); |
|
110 | + |
|
111 | + // finished emptying cache - redirect |
|
112 | + if ($_POST['stay'] != '') { |
|
113 | + $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
114 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | + header($header); |
|
116 | + } else { |
|
117 | + $header = "Location: index.php?a=106&r=2"; |
|
118 | + header($header); |
|
119 | + } |
|
120 | + break; |
|
121 | + case '108': |
|
122 | + // invoke OnBeforeModFormSave event |
|
123 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
124 | + "mode" => "upd", |
|
125 | + "id" => $id |
|
126 | + )); |
|
127 | + |
|
128 | + // disallow duplicate names for new modules |
|
129 | + $rs = $modx->getDatabase()->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
130 | + if ($modx->getDatabase()->getValue($rs) > 0) { |
|
131 | + $modx->getManagerApi()->saveFormValues(108); |
|
132 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
133 | + } |
|
134 | + |
|
135 | + // save the edited module |
|
136 | + $modx->getDatabase()->update(array( |
|
137 | + 'name' => $name, |
|
138 | + 'description' => $description, |
|
139 | + 'icon' => $icon, |
|
140 | + 'enable_resource' => $enable_resource, |
|
141 | + 'resourcefile' => $resourcefile, |
|
142 | + 'disabled' => $disabled, |
|
143 | + 'wrap' => $wrap, |
|
144 | + 'locked' => $locked, |
|
145 | + 'category' => $categoryid, |
|
146 | + 'enable_sharedparams' => $enable_sharedparams, |
|
147 | + 'guid' => $guid, |
|
148 | + 'modulecode' => $modulecode, |
|
149 | + 'properties' => $properties, |
|
150 | + 'editedon' => $currentdate |
|
151 | + ), $modx->getFullTableName('site_modules'), "id='{$id}'"); |
|
152 | + |
|
153 | + // save user group access permissions |
|
154 | + saveUserGroupAccessPermissons(); |
|
155 | + |
|
156 | + // invoke OnModFormSave event |
|
157 | + $modx->invokeEvent("OnModFormSave", array( |
|
158 | + "mode" => "upd", |
|
159 | + "id" => $id |
|
160 | + )); |
|
161 | + |
|
162 | + // Set the item name for logger |
|
163 | + $_SESSION['itemname'] = $name; |
|
164 | + |
|
165 | + // empty cache |
|
166 | + $modx->clearCache('full'); |
|
167 | + |
|
168 | + // finished emptying cache - redirect |
|
169 | + if ($_POST['stay'] != '') { |
|
170 | + $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
171 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
172 | + header($header); |
|
173 | + } else { |
|
174 | + $modx->unlockElement(6, $id); |
|
175 | + $header = "Location: index.php?a=106&r=2"; |
|
176 | + header($header); |
|
177 | + } |
|
178 | + break; |
|
179 | + default: |
|
180 | + $modx->webAlertAndQuit("No operation set in request."); |
|
181 | 181 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_module')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->getDatabase()->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->getDatabase()->escape($_POST['description']); |
12 | 12 | $resourcefile = $modx->getDatabase()->escape($_POST['resourcefile']); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | //Kyle Jaebker - added category support |
27 | 27 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
28 | - $categoryid = (int)$_POST['categoryid']; |
|
28 | + $categoryid = (int) $_POST['categoryid']; |
|
29 | 29 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
30 | 30 | $categoryid = 0; |
31 | 31 | } else { |
32 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
32 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
33 | 33 | $categoryid = checkCategory($_POST['newcategory']); |
34 | 34 | if (!$categoryid) { |
35 | 35 | $categoryid = newCategory($_POST['newcategory']); |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | $name = isset($parsed['name']) ? $parsed['name'] : $name; |
46 | 46 | $properties = isset($parsed['properties']) ? $parsed['properties'] : $properties; |
47 | 47 | $guid = isset($parsed['guid']) ? $parsed['guid'] : $guid; |
48 | - $enable_sharedparams = isset($parsed['shareparams']) ? (int)$parsed['shareparams'] : $enable_sharedparams; |
|
48 | + $enable_sharedparams = isset($parsed['shareparams']) ? (int) $parsed['shareparams'] : $enable_sharedparams; |
|
49 | 49 | |
50 | 50 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
51 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
51 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
52 | 52 | if ($version) { |
53 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
53 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
54 | 54 | } |
55 | 55 | if (isset($parsed['modx_category'])) { |
56 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
56 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
57 | 57 | $categoryid = getCategory($parsed['modx_category']); |
58 | 58 | } |
59 | 59 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // finished emptying cache - redirect |
112 | 112 | if ($_POST['stay'] != '') { |
113 | 113 | $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
115 | 115 | header($header); |
116 | 116 | } else { |
117 | 117 | $header = "Location: index.php?a=106&r=2"; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // finished emptying cache - redirect |
169 | 169 | if ($_POST['stay'] != '') { |
170 | 170 | $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
171 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
172 | 172 | header($header); |
173 | 173 | } else { |
174 | 174 | $modx->unlockElement(6, $id); |
@@ -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('delete_snippet')) { |
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 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeChunkFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the chunk. |
25 | 25 | $modx->getDatabase()->delete($modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnChunkFormDelete event |
28 | 28 | $modx->invokeEvent("OnChunkFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -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->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->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->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('access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // access group processor. |
@@ -20,113 +20,113 @@ discard block |
||
20 | 20 | $operation = $_REQUEST['operation']; |
21 | 21 | |
22 | 22 | switch ($operation) { |
23 | - case "add_user_group" : |
|
24 | - $newgroup = $_REQUEST['newusergroup']; |
|
25 | - if(empty($newgroup)) { |
|
26 | - $modx->webAlertAndQuit("No group name specified."); |
|
27 | - } else { |
|
28 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
23 | + case "add_user_group" : |
|
24 | + $newgroup = $_REQUEST['newusergroup']; |
|
25 | + if(empty($newgroup)) { |
|
26 | + $modx->webAlertAndQuit("No group name specified."); |
|
27 | + } else { |
|
28 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
29 | 29 | |
30 | - // invoke OnManagerCreateGroup event |
|
31 | - $modx->invokeEvent('OnManagerCreateGroup', array( |
|
32 | - 'groupid' => $id, |
|
33 | - 'groupname' => $newgroup, |
|
34 | - )); |
|
35 | - } |
|
36 | - break; |
|
37 | - case "add_document_group" : |
|
38 | - $newgroup = $_REQUEST['newdocgroup']; |
|
39 | - if(empty($newgroup)) { |
|
40 | - $modx->webAlertAndQuit("No group name specified."); |
|
41 | - } else { |
|
42 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
30 | + // invoke OnManagerCreateGroup event |
|
31 | + $modx->invokeEvent('OnManagerCreateGroup', array( |
|
32 | + 'groupid' => $id, |
|
33 | + 'groupname' => $newgroup, |
|
34 | + )); |
|
35 | + } |
|
36 | + break; |
|
37 | + case "add_document_group" : |
|
38 | + $newgroup = $_REQUEST['newdocgroup']; |
|
39 | + if(empty($newgroup)) { |
|
40 | + $modx->webAlertAndQuit("No group name specified."); |
|
41 | + } else { |
|
42 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
43 | 43 | |
44 | - // invoke OnCreateDocGroup event |
|
45 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | - 'groupid' => $id, |
|
47 | - 'groupname' => $newgroup, |
|
48 | - )); |
|
49 | - } |
|
50 | - break; |
|
51 | - case "delete_user_group" : |
|
52 | - $updategroupaccess = true; |
|
53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | - if(empty($usergroup)) { |
|
55 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | - } else { |
|
57 | - $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
44 | + // invoke OnCreateDocGroup event |
|
45 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | + 'groupid' => $id, |
|
47 | + 'groupname' => $newgroup, |
|
48 | + )); |
|
49 | + } |
|
50 | + break; |
|
51 | + case "delete_user_group" : |
|
52 | + $updategroupaccess = true; |
|
53 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | + if(empty($usergroup)) { |
|
55 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | + } else { |
|
57 | + $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
58 | 58 | |
59 | - $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
59 | + $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
60 | 60 | |
61 | - $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
62 | - } |
|
63 | - break; |
|
64 | - case "delete_document_group" : |
|
65 | - $group = (int)$_REQUEST['documentgroup']; |
|
66 | - if(empty($group)) { |
|
67 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | - } else { |
|
69 | - $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
61 | + $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
62 | + } |
|
63 | + break; |
|
64 | + case "delete_document_group" : |
|
65 | + $group = (int)$_REQUEST['documentgroup']; |
|
66 | + if(empty($group)) { |
|
67 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | + } else { |
|
69 | + $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
70 | 70 | |
71 | - $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
71 | + $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
72 | 72 | |
73 | - $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | - } |
|
75 | - break; |
|
76 | - case "rename_user_group" : |
|
77 | - $newgroupname = $_REQUEST['newgroupname']; |
|
78 | - if(empty($newgroupname)) { |
|
79 | - $modx->webAlertAndQuit("No group name specified."); |
|
80 | - } |
|
81 | - $groupid = (int)$_REQUEST['groupid']; |
|
82 | - if(empty($groupid)) { |
|
83 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
84 | - } |
|
73 | + $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | + } |
|
75 | + break; |
|
76 | + case "rename_user_group" : |
|
77 | + $newgroupname = $_REQUEST['newgroupname']; |
|
78 | + if(empty($newgroupname)) { |
|
79 | + $modx->webAlertAndQuit("No group name specified."); |
|
80 | + } |
|
81 | + $groupid = (int)$_REQUEST['groupid']; |
|
82 | + if(empty($groupid)) { |
|
83 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
84 | + } |
|
85 | 85 | |
86 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
87 | - break; |
|
88 | - case "rename_document_group" : |
|
89 | - $newgroupname = $_REQUEST['newgroupname']; |
|
90 | - if(empty($newgroupname)) { |
|
91 | - $modx->webAlertAndQuit("No group name specified."); |
|
92 | - } |
|
93 | - $groupid = (int)$_REQUEST['groupid']; |
|
94 | - if(empty($groupid)) { |
|
95 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
96 | - } |
|
86 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
87 | + break; |
|
88 | + case "rename_document_group" : |
|
89 | + $newgroupname = $_REQUEST['newgroupname']; |
|
90 | + if(empty($newgroupname)) { |
|
91 | + $modx->webAlertAndQuit("No group name specified."); |
|
92 | + } |
|
93 | + $groupid = (int)$_REQUEST['groupid']; |
|
94 | + if(empty($groupid)) { |
|
95 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
96 | + } |
|
97 | 97 | |
98 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
99 | - break; |
|
100 | - case "add_document_group_to_user_group" : |
|
101 | - $updategroupaccess = true; |
|
102 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
104 | - $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
105 | - $limit = $modx->getDatabase()->getValue($rs); |
|
106 | - if($limit<=0) { |
|
107 | - $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
108 | - } else { |
|
109 | - //alert user that coupling already exists? |
|
110 | - } |
|
111 | - break; |
|
112 | - case "remove_document_group_from_user_group" : |
|
113 | - $updategroupaccess = true; |
|
114 | - $coupling = (int)$_REQUEST['coupling']; |
|
115 | - $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
116 | - break; |
|
117 | - default : |
|
118 | - $modx->webAlertAndQuit("No operation set in request."); |
|
98 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
99 | + break; |
|
100 | + case "add_document_group_to_user_group" : |
|
101 | + $updategroupaccess = true; |
|
102 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | + $docgroup = (int)$_REQUEST['docgroup']; |
|
104 | + $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
105 | + $limit = $modx->getDatabase()->getValue($rs); |
|
106 | + if($limit<=0) { |
|
107 | + $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
108 | + } else { |
|
109 | + //alert user that coupling already exists? |
|
110 | + } |
|
111 | + break; |
|
112 | + case "remove_document_group_from_user_group" : |
|
113 | + $updategroupaccess = true; |
|
114 | + $coupling = (int)$_REQUEST['coupling']; |
|
115 | + $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
116 | + break; |
|
117 | + default : |
|
118 | + $modx->webAlertAndQuit("No operation set in request."); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // secure manager documents - flag as private |
122 | 122 | if($updategroupaccess==true){ |
123 | - include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
124 | - secureMgrDocument(); |
|
123 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
124 | + secureMgrDocument(); |
|
125 | 125 | |
126 | - // Update the private group column |
|
127 | - $modx->getDatabase()->update( |
|
128 | - 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
129 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
126 | + // Update the private group column |
|
127 | + $modx->getDatabase()->update( |
|
128 | + 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
129 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $header = "Location: index.php?a=40"; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('access_permissions')) { |
|
5 | +if (!$modx->hasPermission('access_permissions')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | switch ($operation) { |
23 | 23 | case "add_user_group" : |
24 | 24 | $newgroup = $_REQUEST['newusergroup']; |
25 | - if(empty($newgroup)) { |
|
25 | + if (empty($newgroup)) { |
|
26 | 26 | $modx->webAlertAndQuit("No group name specified."); |
27 | 27 | } else { |
28 | 28 | $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | break; |
37 | 37 | case "add_document_group" : |
38 | 38 | $newgroup = $_REQUEST['newdocgroup']; |
39 | - if(empty($newgroup)) { |
|
39 | + if (empty($newgroup)) { |
|
40 | 40 | $modx->webAlertAndQuit("No group name specified."); |
41 | 41 | } else { |
42 | 42 | $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | break; |
51 | 51 | case "delete_user_group" : |
52 | 52 | $updategroupaccess = true; |
53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | - if(empty($usergroup)) { |
|
53 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
54 | + if (empty($usergroup)) { |
|
55 | 55 | $modx->webAlertAndQuit("No user group id specified for deletion."); |
56 | 56 | } else { |
57 | 57 | $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | } |
63 | 63 | break; |
64 | 64 | case "delete_document_group" : |
65 | - $group = (int)$_REQUEST['documentgroup']; |
|
66 | - if(empty($group)) { |
|
65 | + $group = (int) $_REQUEST['documentgroup']; |
|
66 | + if (empty($group)) { |
|
67 | 67 | $modx->webAlertAndQuit("No document group id specified for deletion."); |
68 | 68 | } else { |
69 | 69 | $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | break; |
76 | 76 | case "rename_user_group" : |
77 | 77 | $newgroupname = $_REQUEST['newgroupname']; |
78 | - if(empty($newgroupname)) { |
|
78 | + if (empty($newgroupname)) { |
|
79 | 79 | $modx->webAlertAndQuit("No group name specified."); |
80 | 80 | } |
81 | - $groupid = (int)$_REQUEST['groupid']; |
|
82 | - if(empty($groupid)) { |
|
81 | + $groupid = (int) $_REQUEST['groupid']; |
|
82 | + if (empty($groupid)) { |
|
83 | 83 | $modx->webAlertAndQuit("No group id specified for rename."); |
84 | 84 | } |
85 | 85 | |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | break; |
88 | 88 | case "rename_document_group" : |
89 | 89 | $newgroupname = $_REQUEST['newgroupname']; |
90 | - if(empty($newgroupname)) { |
|
90 | + if (empty($newgroupname)) { |
|
91 | 91 | $modx->webAlertAndQuit("No group name specified."); |
92 | 92 | } |
93 | - $groupid = (int)$_REQUEST['groupid']; |
|
94 | - if(empty($groupid)) { |
|
93 | + $groupid = (int) $_REQUEST['groupid']; |
|
94 | + if (empty($groupid)) { |
|
95 | 95 | $modx->webAlertAndQuit("No group id specified for rename."); |
96 | 96 | } |
97 | 97 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | break; |
100 | 100 | case "add_document_group_to_user_group" : |
101 | 101 | $updategroupaccess = true; |
102 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
102 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
103 | + $docgroup = (int) $_REQUEST['docgroup']; |
|
104 | 104 | $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
105 | 105 | $limit = $modx->getDatabase()->getValue($rs); |
106 | - if($limit<=0) { |
|
106 | + if ($limit <= 0) { |
|
107 | 107 | $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
108 | 108 | } else { |
109 | 109 | //alert user that coupling already exists? |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | break; |
112 | 112 | case "remove_document_group_from_user_group" : |
113 | 113 | $updategroupaccess = true; |
114 | - $coupling = (int)$_REQUEST['coupling']; |
|
114 | + $coupling = (int) $_REQUEST['coupling']; |
|
115 | 115 | $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
116 | 116 | break; |
117 | 117 | default : |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | // secure manager documents - flag as private |
122 | -if($updategroupaccess==true){ |
|
122 | +if ($updategroupaccess == true) { |
|
123 | 123 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
124 | 124 | secureMgrDocument(); |
125 | 125 |
@@ -3,17 +3,17 @@ 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('delete_user')) { |
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 | // delete the user, but first check if we are deleting our own record |
15 | 15 | if($id==$modx->getLoginUserID()) { |
16 | - $modx->webAlertAndQuit("You can't delete yourself!"); |
|
16 | + $modx->webAlertAndQuit("You can't delete yourself!"); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // Set the item name for logger |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | // invoke OnBeforeUserFormDelete event |
24 | 24 | $modx->invokeEvent("OnBeforeUserFormDelete", |
25 | - array( |
|
26 | - "id" => $id |
|
27 | - )); |
|
25 | + array( |
|
26 | + "id" => $id |
|
27 | + )); |
|
28 | 28 | |
29 | 29 | // delete the user. |
30 | 30 | $modx->getDatabase()->delete($modx->getFullTableName('manager_users'), "id='{$id}'"); |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | // invoke OnManagerDeleteUser event |
41 | 41 | $modx->invokeEvent("OnManagerDeleteUser", |
42 | - array( |
|
43 | - "userid" => $id, |
|
44 | - "username" => $username |
|
45 | - )); |
|
42 | + array( |
|
43 | + "userid" => $id, |
|
44 | + "username" => $username |
|
45 | + )); |
|
46 | 46 | |
47 | 47 | // invoke OnUserFormDelete event |
48 | 48 | $modx->invokeEvent("OnUserFormDelete", |
49 | - array( |
|
50 | - "id" => $id |
|
51 | - )); |
|
49 | + array( |
|
50 | + "id" => $id |
|
51 | + )); |
|
52 | 52 | |
53 | 53 | $header="Location: index.php?a=75"; |
54 | 54 | header($header); |
@@ -279,19 +279,19 @@ |
||
279 | 279 | // invoke OnBeforeDocFormSave event |
280 | 280 | switch($modx->config['docid_incrmnt_method']) |
281 | 281 | { |
282 | - case '1': |
|
283 | - $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
284 | - $where = "T1.id IS NULL"; |
|
285 | - $rs = $modx->getDatabase()->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
286 | - $id = $modx->getDatabase()->getValue($rs); |
|
282 | + case '1': |
|
283 | + $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
284 | + $where = "T1.id IS NULL"; |
|
285 | + $rs = $modx->getDatabase()->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
286 | + $id = $modx->getDatabase()->getValue($rs); |
|
287 | + break; |
|
288 | + case '2': |
|
289 | + $rs = $modx->getDatabase()->select('MAX(id)+1', $tbl_site_content); |
|
290 | + $id = $modx->getDatabase()->getValue($rs); |
|
287 | 291 | break; |
288 | - case '2': |
|
289 | - $rs = $modx->getDatabase()->select('MAX(id)+1', $tbl_site_content); |
|
290 | - $id = $modx->getDatabase()->getValue($rs); |
|
291 | - break; |
|
292 | 292 | |
293 | - default: |
|
294 | - $id = ''; |
|
293 | + default: |
|
294 | + $id = ''; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | $modx->invokeEvent("OnBeforeDocFormSave", array( |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | case 'new' : |
278 | 278 | |
279 | 279 | // invoke OnBeforeDocFormSave event |
280 | - switch($modx->config['docid_incrmnt_method']) |
|
280 | + switch ($modx->config['docid_incrmnt_method']) |
|
281 | 281 | { |
282 | 282 | case '1': |
283 | 283 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | if (!$was_published && $published) { |
489 | 489 | $publishedon = $currentdate; |
490 | 490 | $publishedby = $modx->getLoginUserID(); |
491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
491 | + }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) { |
|
492 | 492 | $publishedon = $pub_date; |
493 | 493 | $publishedby = $modx->getLoginUserID(); |
494 | 494 | }elseif ($was_published && !$published) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } |
501 | 501 | |
502 | 502 | // invoke OnBeforeDocFormSave event |
503 | - $modx->invokeEvent("OnBeforeDocFormSave", array ( |
|
503 | + $modx->invokeEvent("OnBeforeDocFormSave", array( |
|
504 | 504 | "mode" => "upd", |
505 | 505 | "id" => $id |
506 | 506 | )); |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | . "menuindex={$menuindex}, " |
526 | 526 | . "searchable={$searchable}, " |
527 | 527 | . "cacheable={$cacheable}, " |
528 | - . "editedby=" . $modx->getLoginUserID() . ", " |
|
528 | + . "editedby=".$modx->getLoginUserID().", " |
|
529 | 529 | . "editedon={$currentdate}, " |
530 | 530 | . "publishedon={$publishedon}, " |
531 | 531 | . "publishedby={$publishedby}, " |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | |
540 | 540 | // update template variables |
541 | 541 | $rs = $modx->getDatabase()->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'"); |
542 | - $tvIds = array (); |
|
542 | + $tvIds = array(); |
|
543 | 543 | while ($row = $modx->getDatabase()->getRow($rs)) { |
544 | 544 | $tvIds[$row['tmplvarid']] = $row['id']; |
545 | 545 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | 'groups.id, groups.document_group', |
593 | 593 | "{$tbl_document_groups} AS groups |
594 | 594 | LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group", |
595 | - "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
595 | + "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
|
596 | 596 | ); |
597 | 597 | $old_groups = array(); |
598 | 598 | while ($row = $modx->getDatabase()->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | unset($old_groups[$group]); |
605 | 605 | continue; |
606 | 606 | } elseif ($link_id == 'new') { |
607 | - $insertions[] = '('.(int)$group.','.$id.')'; |
|
607 | + $insertions[] = '('.(int) $group.','.$id.')'; |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | if (!empty($insertions)) { |
@@ -636,17 +636,17 @@ discard block |
||
636 | 636 | |
637 | 637 | |
638 | 638 | // invoke OnDocFormSave event |
639 | - $modx->invokeEvent("OnDocFormSave", array ( |
|
639 | + $modx->invokeEvent("OnDocFormSave", array( |
|
640 | 640 | "mode" => "upd", |
641 | 641 | "id" => $id |
642 | 642 | )); |
643 | 643 | |
644 | 644 | // secure web documents - flag as private |
645 | - include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php"; |
|
645 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
646 | 646 | secureWebDocument($id); |
647 | 647 | |
648 | 648 | // secure manager documents - flag as private |
649 | - include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php"; |
|
649 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
650 | 650 | secureMgrDocument($id); |
651 | 651 | |
652 | 652 | // Set the item name for logger |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | // document |
673 | 673 | $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent"; |
674 | 674 | } |
675 | - $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path; |
|
675 | + $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path; |
|
676 | 676 | } else { |
677 | 677 | $header = "Location: index.php?a=3&id=$id&r=1".$add_path; |
678 | 678 | } |
679 | 679 | } |
680 | 680 | if (headers_sent()) { |
681 | - $header = str_replace('Location: ','',$header); |
|
681 | + $header = str_replace('Location: ', '', $header); |
|
682 | 682 | echo "<script>document.location.href='$header';</script>\n"; |
683 | 683 | } else { |
684 | 684 | header($header); |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | //end webber |
136 | 136 | } |
137 | -} |
|
138 | -elseif ($alias) { |
|
137 | +} elseif ($alias) { |
|
139 | 138 | $alias = $modx->stripAlias($alias); |
140 | 139 | } |
141 | 140 | |
@@ -149,8 +148,7 @@ discard block |
||
149 | 148 | |
150 | 149 | if ($pub_date < $currentdate) { |
151 | 150 | $published = 1; |
152 | - } |
|
153 | - elseif ($pub_date > $currentdate) { |
|
151 | + } elseif ($pub_date > $currentdate) { |
|
154 | 152 | $published = 0; |
155 | 153 | } |
156 | 154 | } |
@@ -277,8 +275,7 @@ discard block |
||
277 | 275 | case 'new' : |
278 | 276 | |
279 | 277 | // invoke OnBeforeDocFormSave event |
280 | - switch($modx->config['docid_incrmnt_method']) |
|
281 | - { |
|
278 | + switch($modx->config['docid_incrmnt_method']) { |
|
282 | 279 | case '1': |
283 | 280 | $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
284 | 281 | $where = "T1.id IS NULL"; |
@@ -346,8 +343,9 @@ discard block |
||
346 | 343 | "alias_visible" => $aliasvisible |
347 | 344 | ); |
348 | 345 | |
349 | - if ($id != '') |
|
350 | - $dbInsert["id"] = $id; |
|
346 | + if ($id != '') { |
|
347 | + $dbInsert["id"] = $id; |
|
348 | + } |
|
351 | 349 | |
352 | 350 | $key = $modx->getDatabase()->insert($dbInsert, $tbl_site_content); |
353 | 351 | |
@@ -423,11 +421,13 @@ discard block |
||
423 | 421 | // redirect/stay options |
424 | 422 | if ($_POST['stay'] != '') { |
425 | 423 | // weblink |
426 | - if ($_POST['mode'] == "72") |
|
427 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
424 | + if ($_POST['mode'] == "72") { |
|
425 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent"; |
|
426 | + } |
|
428 | 427 | // document |
429 | - if ($_POST['mode'] == "4") |
|
430 | - $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
428 | + if ($_POST['mode'] == "4") { |
|
429 | + $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent"; |
|
430 | + } |
|
431 | 431 | $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay']; |
432 | 432 | } else { |
433 | 433 | $header = "Location: index.php?a=3&id=$key&r=1"; |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | if (!$was_published && $published) { |
489 | 489 | $publishedon = $currentdate; |
490 | 490 | $publishedby = $modx->getLoginUserID(); |
491 | - }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
491 | + } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) { |
|
492 | 492 | $publishedon = $pub_date; |
493 | 493 | $publishedby = $modx->getLoginUserID(); |
494 | - }elseif ($was_published && !$published) { |
|
494 | + } elseif ($was_published && !$published) { |
|
495 | 495 | $publishedon = 0; |
496 | 496 | $publishedby = 0; |
497 | 497 | } else { |
@@ -547,7 +547,9 @@ discard block |
||
547 | 547 | $tvChanges = array(); |
548 | 548 | foreach ($tmplvars as $field => $value) { |
549 | 549 | if (!is_array($value)) { |
550 | - if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value]; |
|
550 | + if (isset($tvIds[$value])) { |
|
551 | + $tvDeletions[] = $tvIds[$value]; |
|
552 | + } |
|
551 | 553 | } else { |
552 | 554 | $tvId = $value[0]; |
553 | 555 | $tvVal = $value[1]; |
@@ -595,7 +597,9 @@ discard block |
||
595 | 597 | "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'" |
596 | 598 | ); |
597 | 599 | $old_groups = array(); |
598 | - while ($row = $modx->getDatabase()->getRow($rs)) $old_groups[$row['document_group']] = $row['id']; |
|
600 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
601 | + $old_groups[$row['document_group']] = $row['id']; |
|
602 | + } |
|
599 | 603 | |
600 | 604 | // update the permissions in the database |
601 | 605 | $insertions = $deletions = array(); |
@@ -657,9 +661,9 @@ discard block |
||
657 | 661 | $modx->clearCache('full'); |
658 | 662 | } |
659 | 663 | |
660 | - if ($_POST['refresh_preview'] == '1') |
|
661 | - $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
662 | - else { |
|
664 | + if ($_POST['refresh_preview'] == '1') { |
|
665 | + $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev"; |
|
666 | + } else { |
|
663 | 667 | if ($_POST['stay'] != '2' && $id > 0) { |
664 | 668 | $modx->unlockElement(7, $id); |
665 | 669 | } |