@@ -1,24 +1,24 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if (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 | 9 | $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
10 | -if($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->db->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->db->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->db->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->db->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->db->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> |
@@ -29,7 +29,7 @@ discard block |
||
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']); |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | $enable_sharedparams = isset($parsed['shareparams']) ? intval($parsed['shareparams']) : $enable_sharedparams; |
49 | 49 | |
50 | 50 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
51 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
51 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
52 | 52 | if ($version) { |
53 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
53 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
54 | 54 | } |
55 | 55 | if (isset($parsed['modx_category'])) { |
56 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
56 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
57 | 57 | $categoryid = getCategory($parsed['modx_category']); |
58 | 58 | } |
59 | 59 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // finished emptying cache - redirect |
112 | 112 | if ($_POST['stay'] != '') { |
113 | 113 | $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
115 | 115 | header($header); |
116 | 116 | } else { |
117 | 117 | $header = "Location: index.php?a=106&r=2"; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // finished emptying cache - redirect |
169 | 169 | if ($_POST['stay'] != '') { |
170 | 170 | $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
171 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
172 | 172 | header($header); |
173 | 173 | } else { |
174 | 174 | $modx->unlockElement(6, $id); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_snippet')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_snippet')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
@@ -32,5 +32,5 @@ discard block |
||
32 | 32 | $modx->clearCache('full'); |
33 | 33 | |
34 | 34 | // finished emptying cache - redirect |
35 | -$header="Location: index.php?a=76&r=2"; |
|
35 | +$header = "Location: index.php?a=76&r=2"; |
|
36 | 36 | header($header); |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('exec_module')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('exec_module')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | // check if user has access permission, except admins |
13 | -if($_SESSION['mgrRole']!=1){ |
|
13 | +if ($_SESSION['mgrRole'] != 1) { |
|
14 | 14 | $rs = $modx->db->select( |
15 | 15 | 'sma.usergroup,mg.member', |
16 | 16 | $modx->getFullTableName("site_module_access")." sma |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | $permissionAccessInt = -1; |
23 | 23 | |
24 | 24 | while ($row = $modx->db->getRow($rs)) { |
25 | - if($row["usergroup"] && $row["member"]) { |
|
25 | + if ($row["usergroup"] && $row["member"]) { |
|
26 | 26 | //if there are permissions and this member has permission, ofcourse |
27 | 27 | //this is granted |
28 | 28 | $permissionAccessInt = 1; |
29 | - } elseif ($permissionAccessInt==-1) { |
|
29 | + } elseif ($permissionAccessInt == -1) { |
|
30 | 30 | //if there are permissions but this member has no permission and the |
31 | 31 | //variable was still in init state we set permission to 0; no permissions |
32 | 32 | $permissionAccessInt = 0; |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | - if($permissionAccessInt==0) { |
|
36 | + if ($permissionAccessInt == 0) { |
|
37 | 37 | $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
38 | 38 | } |
39 | 39 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | // get module data |
42 | 42 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
43 | 43 | $content = $modx->db->getRow($rs); |
44 | -if(!$content) { |
|
44 | +if (!$content) { |
|
45 | 45 | $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
46 | 46 | } |
47 | -if($content['disabled']) { |
|
47 | +if ($content['disabled']) { |
|
48 | 48 | $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
49 | 49 | } |
50 | 50 | |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | // Set the item name for logger |
58 | 58 | $_SESSION['itemname'] = $content['name']; |
59 | 59 | |
60 | -$output = evalModule($content["modulecode"],$parameter); |
|
60 | +$output = evalModule($content["modulecode"], $parameter); |
|
61 | 61 | echo $output; |
62 | 62 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
63 | 63 | |
64 | 64 | // evalModule |
65 | -function evalModule($moduleCode,$params){ |
|
65 | +function evalModule($moduleCode, $params){ |
|
66 | 66 | global $modx; |
67 | 67 | $modx->event->params = &$params; // store params inside event object |
68 | - if(is_array($params)) { |
|
68 | + if (is_array($params)) { |
|
69 | 69 | extract($params, EXTR_SKIP); |
70 | 70 | } |
71 | 71 | ob_start(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if (isset($php_errormsg)) |
76 | 76 | { |
77 | 77 | $error_info = error_get_last(); |
78 | - switch($error_info['type']) |
|
78 | + switch ($error_info['type']) |
|
79 | 79 | { |
80 | 80 | case E_NOTICE : |
81 | 81 | $error_level = 1; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | default: |
90 | 90 | $error_level = 99; |
91 | 91 | } |
92 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
92 | + if ($modx->config['error_reporting'] === '99' || 2 < $error_level) |
|
93 | 93 | { |
94 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
94 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
95 | 95 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
96 | 96 | } |
97 | 97 | } |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if (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 | 9 | $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
10 | -if($id == 0) { |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->getRecordCount($rs); |
17 | -if($limit > 0) { |
|
17 | +if ($limit > 0) { |
|
18 | 18 | include "header.inc.php"; |
19 | 19 | ?> |
20 | 20 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->db->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
31 | + while ($row = $modx->db->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['introtext'] != '' ? ' - '.$row['introtext'] : '').'</li>'; |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </ul> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | exit; |
41 | 41 | } |
42 | 42 | |
43 | -if($id == $default_template) { |
|
43 | +if ($id == $default_template) { |
|
44 | 44 | $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
45 | 45 | } |
46 | 46 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('web_access_permissions')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('web_access_permissions')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | switch ($operation) { |
21 | 21 | case "add_user_group" : |
22 | 22 | $newgroup = $_REQUEST['newusergroup']; |
23 | - if(empty($newgroup)) { |
|
23 | + if (empty($newgroup)) { |
|
24 | 24 | $modx->webAlertAndQuit("No group name specified."); |
25 | 25 | } else { |
26 | 26 | $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | break; |
35 | 35 | case "add_document_group" : |
36 | 36 | $newgroup = $_REQUEST['newdocgroup']; |
37 | - if(empty($newgroup)) { |
|
37 | + if (empty($newgroup)) { |
|
38 | 38 | $modx->webAlertAndQuit("No group name specified."); |
39 | 39 | } else { |
40 | 40 | $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | case "delete_user_group" : |
50 | 50 | $updategroupaccess = true; |
51 | 51 | $usergroup = intval($_REQUEST['usergroup']); |
52 | - if(empty($usergroup)) { |
|
52 | + if (empty($usergroup)) { |
|
53 | 53 | $modx->webAlertAndQuit("No user group id specified for deletion."); |
54 | 54 | } else { |
55 | 55 | $modx->db->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | break; |
62 | 62 | case "delete_document_group" : |
63 | 63 | $group = intval($_REQUEST['documentgroup']); |
64 | - if(empty($group)) { |
|
64 | + if (empty($group)) { |
|
65 | 65 | $modx->webAlertAndQuit("No document group id specified for deletion."); |
66 | 66 | } else { |
67 | 67 | $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -73,22 +73,22 @@ discard block |
||
73 | 73 | break; |
74 | 74 | case "rename_user_group" : |
75 | 75 | $newgroupname = $_REQUEST['newgroupname']; |
76 | - if(empty($newgroupname)) { |
|
76 | + if (empty($newgroupname)) { |
|
77 | 77 | $modx->webAlertAndQuit("No group name specified."); |
78 | 78 | } |
79 | 79 | $groupid = intval($_REQUEST['groupid']); |
80 | - if(empty($groupid)) { |
|
80 | + if (empty($groupid)) { |
|
81 | 81 | $modx->webAlertAndQuit("No user group id specified for rename."); |
82 | 82 | } |
83 | 83 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
84 | 84 | break; |
85 | 85 | case "rename_document_group" : |
86 | 86 | $newgroupname = $_REQUEST['newgroupname']; |
87 | - if(empty($newgroupname)) { |
|
87 | + if (empty($newgroupname)) { |
|
88 | 88 | $modx->webAlertAndQuit("No group name specified."); |
89 | 89 | } |
90 | 90 | $groupid = intval($_REQUEST['groupid']); |
91 | - if(empty($groupid)) { |
|
91 | + if (empty($groupid)) { |
|
92 | 92 | $modx->webAlertAndQuit("No document group id specified for rename."); |
93 | 93 | } |
94 | 94 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $docgroup = intval($_REQUEST['docgroup']); |
100 | 100 | $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
101 | 101 | $limit = $modx->db->getValue($rs); |
102 | - if($limit<=0) { |
|
102 | + if ($limit <= 0) { |
|
103 | 103 | $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
104 | 104 | } else { |
105 | 105 | //alert user that coupling already exists? |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | // secure web documents - flag as private |
118 | -if($updategroupaccess==true){ |
|
118 | +if ($updategroupaccess == true) { |
|
119 | 119 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
120 | 120 | secureWebDocument(); |
121 | 121 |
@@ -1,27 +1,27 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('new_module')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('new_module')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | // create globally unique identifiers (guid) |
13 | 13 | function createGUID(){ |
14 | - srand((double)microtime()*1000000); |
|
15 | - $r = rand() ; |
|
16 | - $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
|
17 | - $m = md5 ($u); |
|
14 | + srand((double) microtime() * 1000000); |
|
15 | + $r = rand(); |
|
16 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
17 | + $m = md5($u); |
|
18 | 18 | return $m; |
19 | 19 | } |
20 | 20 | |
21 | 21 | // count duplicates |
22 | 22 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
23 | 23 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
24 | -if($count>=1) $count = ' '.($count+1); |
|
24 | +if ($count >= 1) $count = ' '.($count + 1); |
|
25 | 25 | else $count = ''; |
26 | 26 | |
27 | 27 | // duplicate module |
@@ -66,5 +66,5 @@ discard block |
||
66 | 66 | $_SESSION['itemname'] = $name; |
67 | 67 | |
68 | 68 | // finish duplicating - redirect to new module |
69 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
69 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
70 | 70 | header($header); |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if (IN_MANAGER_MODE!="true") { |
|
2 | +if (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_plugin') && !$modx->hasPermission('save_snippet') && !$modx->hasPermission('save_template') && !$modx->hasPermission('save_module')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['catId'])? intval($_GET['catId']) : 0; |
|
10 | -if ($id==0) { |
|
9 | +$id = isset($_GET['catId']) ? intval($_GET['catId']) : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | deleteCategory($id); |
20 | 20 | |
21 | 21 | // finished emptying cache - redirect |
22 | -$header="Location: index.php?a=76"; |
|
22 | +$header = "Location: index.php?a=76"; |
|
23 | 23 | header($header); |
@@ -1,48 +1,48 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_document')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_document')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | /************ webber ********/ |
13 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
14 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
13 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
14 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
15 | 15 | |
16 | 16 | /************** webber *************/ |
17 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
18 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
19 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
20 | -$add_path=$sd.$sb.$pg; |
|
17 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
18 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
19 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
20 | +$add_path = $sd.$sb.$pg; |
|
21 | 21 | |
22 | 22 | /***********************************/ |
23 | 23 | |
24 | 24 | |
25 | 25 | // check permissions on the document |
26 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
26 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
27 | 27 | $udperms = new udperms(); |
28 | 28 | $udperms->user = $modx->getLoginUserID(); |
29 | 29 | $udperms->document = $id; |
30 | 30 | $udperms->role = $_SESSION['mgrRole']; |
31 | 31 | |
32 | -if(!$udperms->checkPermissions()) { |
|
32 | +if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | |
36 | 36 | // get the timestamp on which the document was deleted. |
37 | 37 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
38 | 38 | $deltime = $modx->db->getValue($rs); |
39 | -if(!$deltime) { |
|
39 | +if (!$deltime) { |
|
40 | 40 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
41 | 41 | } |
42 | 42 | |
43 | 43 | $children = array(); |
44 | 44 | |
45 | -function getChildren($parent) { |
|
45 | +function getChildren($parent){ |
|
46 | 46 | |
47 | 47 | global $modx; |
48 | 48 | global $children; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
52 | 52 | // the document has children documents, we'll need to delete those too |
53 | - while ($row=$modx->db->getRow($rs)) { |
|
53 | + while ($row = $modx->db->getRow($rs)) { |
|
54 | 54 | $children[] = $row['id']; |
55 | 55 | getChildren($row['id']); |
56 | 56 | //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | getChildren($id); |
61 | 61 | |
62 | -if(count($children)>0) { |
|
62 | +if (count($children) > 0) { |
|
63 | 63 | $modx->db->update( |
64 | 64 | array( |
65 | 65 | 'deleted' => 0, |
@@ -88,5 +88,5 @@ discard block |
||
88 | 88 | $modx->clearCache('full'); |
89 | 89 | |
90 | 90 | // finished emptying cache - redirect |
91 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
91 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
92 | 92 | header($header); |