@@ -1,26 +1,26 @@ 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('delete_template')) { |
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 | $forced = isset($_GET['force']) ? $_GET['force'] : 0; |
15 | 15 | |
16 | 16 | // check for relations |
17 | 17 | if(!$forced) { |
18 | - $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content') . " AS sc |
|
18 | + $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content') . " AS sc |
|
19 | 19 | INNER JOIN " . $modx->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'"); |
20 | - $count = $modx->getDatabase()->getRecordCount($drs); |
|
21 | - if($count > 0) { |
|
22 | - include_once "header.inc.php"; |
|
23 | - ?> |
|
20 | + $count = $modx->getDatabase()->getRecordCount($drs); |
|
21 | + if($count > 0) { |
|
22 | + include_once "header.inc.php"; |
|
23 | + ?> |
|
24 | 24 | <script> |
25 | 25 | var actions = { |
26 | 26 | delete: function() { |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | <p><?= $_lang['tmplvar_inuse'] ?></p> |
43 | 43 | <ul> |
44 | 44 | <?php |
45 | - while($row = $modx->getDatabase()->getRow($drs)) { |
|
46 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>'; |
|
47 | - } |
|
48 | - ?> |
|
45 | + while($row = $modx->getDatabase()->getRow($drs)) { |
|
46 | + echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>'; |
|
47 | + } |
|
48 | + ?> |
|
49 | 49 | </ul> |
50 | 50 | </div> |
51 | 51 | </div> |
52 | 52 | <?php |
53 | - include_once "footer.inc.php"; |
|
54 | - exit; |
|
55 | - } |
|
53 | + include_once "footer.inc.php"; |
|
54 | + exit; |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Set the item name for logger |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | // invoke OnBeforeTVFormDelete event |
63 | 63 | $modx->invokeEvent("OnBeforeTVFormDelete", array( |
64 | - "id" => $id |
|
64 | + "id" => $id |
|
65 | 65 | )); |
66 | 66 | |
67 | 67 | // delete variable |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | // invoke OnTVFormDelete event |
80 | 80 | $modx->invokeEvent("OnTVFormDelete", array( |
81 | - "id" => $id |
|
81 | + "id" => $id |
|
82 | 82 | )); |
83 | 83 | |
84 | 84 | // empty cache |
@@ -1,24 +1,24 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('delete_template')) { |
|
5 | +if (!$modx->hasPermission('delete_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
10 | -if($id == 0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | $forced = isset($_GET['force']) ? $_GET['force'] : 0; |
15 | 15 | |
16 | 16 | // check for relations |
17 | -if(!$forced) { |
|
18 | - $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content') . " AS sc |
|
19 | - INNER JOIN " . $modx->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'"); |
|
17 | +if (!$forced) { |
|
18 | + $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content')." AS sc |
|
19 | + INNER JOIN " . $modx->getFullTableName('site_tmplvar_contentvalues')." AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'"); |
|
20 | 20 | $count = $modx->getDatabase()->getRecordCount($drs); |
21 | - if($count > 0) { |
|
21 | + if ($count > 0) { |
|
22 | 22 | include_once "header.inc.php"; |
23 | 23 | ?> |
24 | 24 | <script> |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | <p><?= $_lang['tmplvar_inuse'] ?></p> |
43 | 43 | <ul> |
44 | 44 | <?php |
45 | - while($row = $modx->getDatabase()->getRow($drs)) { |
|
46 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>'; |
|
45 | + while ($row = $modx->getDatabase()->getRow($drs)) { |
|
46 | + echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['description'] != '' ? ' - '.$row['description'] : '').'</li>'; |
|
47 | 47 | } |
48 | 48 | ?> |
49 | 49 | </ul> |
@@ -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); |