@@ -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_web_user')) { |
|
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_web_user')) { |
|
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 | |
@@ -41,5 +41,5 @@ discard block |
||
41 | 41 | "id" => $id |
42 | 42 | )); |
43 | 43 | |
44 | -$header="Location: index.php?a=99"; |
|
44 | +$header = "Location: index.php?a=99"; |
|
45 | 45 | header($header); |
@@ -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_plugin')) { |
|
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_plugin')) { |
|
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 | |
@@ -35,5 +35,5 @@ discard block |
||
35 | 35 | $modx->clearCache('full'); |
36 | 36 | |
37 | 37 | // finished emptying cache - redirect |
38 | -$header="Location: index.php?a=76&r=2"; |
|
38 | +$header = "Location: index.php?a=76&r=2"; |
|
39 | 39 | header($header); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $templatename = $modx->db->escape(trim($_POST['templatename'])); |
12 | 12 | $description = $modx->db->escape($_POST['description']); |
13 | 13 | $locked = $_POST['locked'] == 'on' ? 1 : 0; |
14 | -$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable |
|
14 | +$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable |
|
15 | 15 | $_POST['selectable'] == 'on' ? 1 : 0; |
16 | 16 | $currentdate = time() + $modx->config['server_offset_time']; |
17 | 17 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
22 | 22 | $categoryid = 0; |
23 | 23 | } else { |
24 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
24 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
25 | 25 | $categoryid = checkCategory($_POST['newcategory']); |
26 | 26 | if (!$categoryid) { |
27 | 27 | $categoryid = newCategory($_POST['newcategory']); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // finished emptying cache - redirect |
79 | 79 | if ($_POST['stay'] != '') { |
80 | 80 | $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
81 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
81 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
82 | 82 | header($header); |
83 | 83 | } else { |
84 | 84 | $header = "Location: index.php?a=76&r=2"; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | // finished emptying cache - redirect |
131 | 131 | if ($_POST['stay'] != '') { |
132 | 132 | $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
133 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
133 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
134 | 134 | header($header); |
135 | 135 | } else { |
136 | 136 | $modx->unlockElement(1, $id); |
@@ -1,25 +1,25 @@ 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_document') || !$modx->hasPermission('save_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('new_document') || !$modx->hasPermission('save_document')) { |
|
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 | $children = array(); |
13 | 13 | |
14 | 14 | // check permissions on the document |
15 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
15 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
16 | 16 | $udperms = new udperms(); |
17 | 17 | $udperms->user = $modx->getLoginUserID(); |
18 | 18 | $udperms->document = $id; |
19 | 19 | $udperms->role = $_SESSION['mgrRole']; |
20 | 20 | $udperms->duplicateDoc = true; |
21 | 21 | |
22 | -if(!$udperms->checkPermissions()) { |
|
22 | +if (!$udperms->checkPermissions()) { |
|
23 | 23 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
24 | 24 | } |
25 | 25 | |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $_SESSION['itemname'] = $name; |
32 | 32 | |
33 | 33 | // finish cloning - redirect |
34 | -$header="Location: index.php?r=1&a=3&id=$id"; |
|
34 | +$header = "Location: index.php?r=1&a=3&id=$id"; |
|
35 | 35 | header($header); |
36 | 36 | |
37 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
37 | +function duplicateDocument($docid, $parent = null, $_toplevel = 0){ |
|
38 | 38 | global $modx, $_lang; |
39 | 39 | |
40 | 40 | // invoke OnBeforeDocDuplicate event |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $content = $modx->db->getRow($rs); |
56 | 56 | |
57 | 57 | // Handle incremental ID |
58 | - switch($modx->config['docid_incrmnt_method']) |
|
58 | + switch ($modx->config['docid_incrmnt_method']) |
|
59 | 59 | { |
60 | 60 | case '1': |
61 | 61 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $content['id'] = $modx->db->getValue($rs); |
64 | 64 | break; |
65 | 65 | case '2': |
66 | - $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
66 | + $rs = $modx->db->select('MAX(id)+1', $tblsc); |
|
67 | 67 | $content['id'] = $modx->db->getValue($rs); |
68 | 68 | break; |
69 | 69 | |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
78 | 78 | $pagetitle = $modx->db->escape($pagetitle); |
79 | 79 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
80 | - if($count>=1) $count = ' '.($count+1); |
|
80 | + if ($count >= 1) $count = ' '.($count + 1); |
|
81 | 81 | else $count = ''; |
82 | 82 | |
83 | 83 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
84 | 84 | $content['alias'] = null; |
85 | - } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
85 | + } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
86 | 86 | $content['alias'] = null; |
87 | 87 | } |
88 | 88 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | // Duplicate Document TVs |
138 | -function duplicateTVs($oldid,$newid){ |
|
138 | +function duplicateTVs($oldid, $newid){ |
|
139 | 139 | global $modx; |
140 | 140 | |
141 | 141 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | // Duplicate Document Access Permissions |
150 | -function duplicateAccess($oldid,$newid){ |
|
150 | +function duplicateAccess($oldid, $newid){ |
|
151 | 151 | global $modx; |
152 | 152 | |
153 | 153 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -1,18 +1,18 @@ 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('edit_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('edit_document')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
8 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
7 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
8 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
9 | 9 | |
10 | 10 | // ok, two things to check. |
11 | 11 | // first, document cannot be moved to itself |
12 | 12 | // second, new parent must be a folder. If not, set it to folder. |
13 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
14 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
13 | +if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
14 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
16 | 16 | |
17 | 17 | $parents = $modx->getParentIds($newParentID); |
18 | 18 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | if ($use_udperms == 1) { |
26 | 26 | if ($oldparent != $newParentID) { |
27 | - include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
27 | + include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
28 | 28 | $udperms = new udperms(); |
29 | 29 | $udperms->user = $modx->getLoginUserID(); |
30 | 30 | $udperms->document = $newParentID; |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -function allChildren($currDocID) { |
|
39 | +function allChildren($currDocID){ |
|
40 | 40 | global $modx; |
41 | - $children= array(); |
|
41 | + $children = array(); |
|
42 | 42 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
43 | - while ($child= $modx->db->getRow($rs)) { |
|
44 | - $children[]= $child['id']; |
|
45 | - $nextgen= array(); |
|
46 | - $nextgen= allChildren($child['id']); |
|
47 | - $children= array_merge($children, $nextgen); |
|
43 | + while ($child = $modx->db->getRow($rs)) { |
|
44 | + $children[] = $child['id']; |
|
45 | + $nextgen = array(); |
|
46 | + $nextgen = allChildren($child['id']); |
|
47 | + $children = array_merge($children, $nextgen); |
|
48 | 48 | } |
49 | 49 | return $children; |
50 | 50 | } |
51 | 51 | |
52 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
52 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
53 | 53 | "id_document" => $documentID, |
54 | 54 | "old_parent" => $oldparent, |
55 | 55 | "new_parent" => $newParentID |
56 | 56 | )); |
57 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
57 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
58 | 58 | $newParent = array_pop($evtOut); |
59 | - if($newParent == $oldparent) { |
|
59 | + if ($newParent == $oldparent) { |
|
60 | 60 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
61 | - }else{ |
|
61 | + } else { |
|
62 | 62 | $newParentID = $newParent; |
63 | 63 | } |
64 | 64 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
80 | 80 | $limit = $modx->db->getValue($rs); |
81 | 81 | |
82 | - if(!$limit>0) { |
|
82 | + if (!$limit > 0) { |
|
83 | 83 | $modx->db->update(array( |
84 | 84 | 'isfolder' => 0, |
85 | 85 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
89 | 89 | $_SESSION['itemname'] = $pagetitle; |
90 | 90 | |
91 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
91 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
92 | 92 | "id_document" => $documentID, |
93 | 93 | "old_parent" => $oldparent, |
94 | 94 | "new_parent" => $newParentID |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // empty cache & sync site |
98 | 98 | $modx->clearCache('full'); |
99 | 99 | |
100 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
100 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
101 | 101 | header($header); |
102 | 102 | } else { |
103 | 103 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
@@ -1,36 +1,36 @@ 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('save_document')||!$modx->hasPermission('publish_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('save_document') || !$modx->hasPermission('publish_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 | |
26 | 26 | // check permissions on the document |
27 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
27 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
28 | 28 | $udperms = new udperms(); |
29 | 29 | $udperms->user = $modx->getLoginUserID(); |
30 | 30 | $udperms->document = $id; |
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | 32 | |
33 | -if(!$udperms->checkPermissions()) { |
|
33 | +if (!$udperms->checkPermissions()) { |
|
34 | 34 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
35 | 35 | } |
36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
48 | 48 | |
49 | 49 | // invoke OnDocUnPublished event |
50 | -$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
|
50 | +$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id)); |
|
51 | 51 | |
52 | 52 | // Set the item name for logger |
53 | 53 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -55,6 +55,6 @@ discard block |
||
55 | 55 | // empty cache |
56 | 56 | $modx->clearCache('full'); |
57 | 57 | |
58 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
58 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
59 | 59 | |
60 | 60 | header($header); |
@@ -1,18 +1,18 @@ 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_template')) { |
|
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_template')) { |
|
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 | // count duplicates |
13 | 13 | $name = $modx->db->getValue($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "id='{$id}'")); |
14 | 14 | $count = $modx->db->getRecordCount($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
15 | -if($count>=1) $count = ' '.($count+1); |
|
15 | +if ($count >= 1) $count = ' '.($count + 1); |
|
16 | 16 | else $count = ''; |
17 | 17 | |
18 | 18 | // duplicate template |
@@ -39,5 +39,5 @@ discard block |
||
39 | 39 | $_SESSION['itemname'] = $name; |
40 | 40 | |
41 | 41 | // finish duplicating - redirect to new template |
42 | -$header="Location: index.php?r=2&a=16&id=$newid"; |
|
42 | +$header = "Location: index.php?r=2&a=16&id=$newid"; |
|
43 | 43 | header($header); |
@@ -1,18 +1,18 @@ 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_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('new_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 | |
12 | 12 | // count duplicates |
13 | 13 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
14 | 14 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
15 | -if($count>=1) $count = ' '.($count+1); |
|
15 | +if ($count >= 1) $count = ' '.($count + 1); |
|
16 | 16 | else $count = ''; |
17 | 17 | |
18 | 18 | // duplicate Snippet |
@@ -31,5 +31,5 @@ discard block |
||
31 | 31 | $_SESSION['itemname'] = $name; |
32 | 32 | |
33 | 33 | // finish duplicating - redirect to new snippet |
34 | -$header="Location: index.php?r=2&a=22&id=$newid"; |
|
34 | +$header = "Location: index.php?r=2&a=22&id=$newid"; |
|
35 | 35 | header($header); |
@@ -1,18 +1,18 @@ 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_chunk')) { |
|
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_chunk')) { |
|
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 | // count duplicates |
13 | 13 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'")); |
14 | 14 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
15 | -if($count>=1) $count = ' '.($count+1); |
|
15 | +if ($count >= 1) $count = ' '.($count + 1); |
|
16 | 16 | else $count = ''; |
17 | 17 | |
18 | 18 | // duplicate htmlsnippet |
@@ -30,5 +30,5 @@ discard block |
||
30 | 30 | $_SESSION['itemname'] = $name; |
31 | 31 | |
32 | 32 | // finish duplicating - redirect to new chunk |
33 | -$header="Location: index.php?r=2&a=78&id=$newid"; |
|
33 | +$header = "Location: index.php?r=2&a=78&id=$newid"; |
|
34 | 34 | header($header); |