@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | $header="Location: index.php?r=1&a=3&id=$id"; |
37 | 37 | header($header); |
38 | 38 | |
39 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
39 | +function duplicateDocument($docid, $parent=null, $_toplevel=0) |
|
40 | +{ |
|
40 | 41 | global $modx, $_lang; |
41 | 42 | |
42 | 43 | // invoke OnBeforeDocDuplicate event |
@@ -57,8 +58,7 @@ discard block |
||
57 | 58 | $content = $modx->db->getRow($rs); |
58 | 59 | |
59 | 60 | // Handle incremental ID |
60 | - switch($modx->config['docid_incrmnt_method']) |
|
61 | - { |
|
61 | + switch($modx->config['docid_incrmnt_method']) { |
|
62 | 62 | case '1': |
63 | 63 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
64 | 64 | $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
@@ -79,8 +79,11 @@ discard block |
||
79 | 79 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
80 | 80 | $pagetitle = $modx->db->escape($pagetitle); |
81 | 81 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
82 | - if($count>=1) $count = ' '.($count+1); |
|
83 | - else $count = ''; |
|
82 | + if($count>=1) { |
|
83 | + $count = ' '.($count+1); |
|
84 | + } else { |
|
85 | + $count = ''; |
|
86 | + } |
|
84 | 87 | |
85 | 88 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
86 | 89 | $content['alias'] = null; |
@@ -89,7 +92,9 @@ discard block |
||
89 | 92 | } |
90 | 93 | |
91 | 94 | // change the parent accordingly |
92 | - if ($parent !== null) $content['parent'] = $parent; |
|
95 | + if ($parent !== null) { |
|
96 | + $content['parent'] = $parent; |
|
97 | + } |
|
93 | 98 | |
94 | 99 | // Change the author |
95 | 100 | $content['createdby'] = $userID; |
@@ -129,15 +134,17 @@ discard block |
||
129 | 134 | // Start duplicating all the child documents that aren't deleted. |
130 | 135 | $_toplevel++; |
131 | 136 | $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
132 | - while ($row = $modx->db->getRow($rs)) |
|
133 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
137 | + while ($row = $modx->db->getRow($rs)) { |
|
138 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
139 | + } |
|
134 | 140 | |
135 | 141 | // return the new doc id |
136 | 142 | return $newparent; |
137 | 143 | } |
138 | 144 | |
139 | 145 | // Duplicate Document TVs |
140 | -function duplicateTVs($oldid,$newid){ |
|
146 | +function duplicateTVs($oldid,$newid) |
|
147 | +{ |
|
141 | 148 | global $modx; |
142 | 149 | |
143 | 150 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -149,7 +156,8 @@ discard block |
||
149 | 156 | } |
150 | 157 | |
151 | 158 | // Duplicate Document Access Permissions |
152 | -function duplicateAccess($oldid,$newid){ |
|
159 | +function duplicateAccess($oldid,$newid) |
|
160 | +{ |
|
153 | 161 | global $modx; |
154 | 162 | |
155 | 163 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -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_document') || !$modx->hasPermission('save_document')) { |
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 | $children = array(); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $udperms->duplicateDoc = true; |
23 | 23 | |
24 | 24 | if(!$udperms->checkPermissions()) { |
25 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
25 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | // Run the duplicator |
@@ -37,125 +37,125 @@ discard block |
||
37 | 37 | header($header); |
38 | 38 | |
39 | 39 | function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
40 | - global $modx, $_lang; |
|
41 | - |
|
42 | - // invoke OnBeforeDocDuplicate event |
|
43 | - $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array( |
|
44 | - 'id' => $docid |
|
45 | - )); |
|
46 | - |
|
47 | - // if( !in_array( 'false', array_values( $evtOut ) ) ){} |
|
48 | - // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication |
|
49 | - // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false'); |
|
50 | - |
|
51 | - $userID = $modx->getLoginUserID(); |
|
52 | - |
|
53 | - $tblsc = $modx->getFullTableName('site_content'); |
|
54 | - |
|
55 | - // Grab the original document |
|
56 | - $rs = $modx->db->select('*', $tblsc, "id='{$docid}'"); |
|
57 | - $content = $modx->db->getRow($rs); |
|
58 | - |
|
59 | - // Handle incremental ID |
|
60 | - switch($modx->config['docid_incrmnt_method']) |
|
61 | - { |
|
62 | - case '1': |
|
63 | - $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
|
64 | - $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
65 | - $content['id'] = $modx->db->getValue($rs); |
|
66 | - break; |
|
67 | - case '2': |
|
68 | - $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
69 | - $content['id'] = $modx->db->getValue($rs); |
|
70 | - break; |
|
71 | - |
|
72 | - default: |
|
73 | - unset($content['id']); // remove the current id. |
|
74 | - } |
|
75 | - |
|
76 | - // Once we've grabbed the document object, start doing some modifications |
|
77 | - if ($_toplevel == 0) { |
|
78 | - // count duplicates |
|
79 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
|
80 | - $pagetitle = $modx->db->escape($pagetitle); |
|
81 | - $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
|
82 | - if($count>=1) $count = ' '.($count+1); |
|
83 | - else $count = ''; |
|
84 | - |
|
85 | - $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
86 | - $content['alias'] = null; |
|
87 | - } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
88 | - $content['alias'] = null; |
|
89 | - } |
|
90 | - |
|
91 | - // change the parent accordingly |
|
92 | - if ($parent !== null) $content['parent'] = $parent; |
|
93 | - |
|
94 | - // Change the author |
|
95 | - $content['createdby'] = $userID; |
|
96 | - $content['createdon'] = time(); |
|
97 | - // Remove other modification times |
|
98 | - $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0; |
|
99 | - |
|
100 | - // [FS#922] Should the published status be honored? - sirlancelot |
|
40 | + global $modx, $_lang; |
|
41 | + |
|
42 | + // invoke OnBeforeDocDuplicate event |
|
43 | + $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array( |
|
44 | + 'id' => $docid |
|
45 | + )); |
|
46 | + |
|
47 | + // if( !in_array( 'false', array_values( $evtOut ) ) ){} |
|
48 | + // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication |
|
49 | + // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false'); |
|
50 | + |
|
51 | + $userID = $modx->getLoginUserID(); |
|
52 | + |
|
53 | + $tblsc = $modx->getFullTableName('site_content'); |
|
54 | + |
|
55 | + // Grab the original document |
|
56 | + $rs = $modx->db->select('*', $tblsc, "id='{$docid}'"); |
|
57 | + $content = $modx->db->getRow($rs); |
|
58 | + |
|
59 | + // Handle incremental ID |
|
60 | + switch($modx->config['docid_incrmnt_method']) |
|
61 | + { |
|
62 | + case '1': |
|
63 | + $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
|
64 | + $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
65 | + $content['id'] = $modx->db->getValue($rs); |
|
66 | + break; |
|
67 | + case '2': |
|
68 | + $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
69 | + $content['id'] = $modx->db->getValue($rs); |
|
70 | + break; |
|
71 | + |
|
72 | + default: |
|
73 | + unset($content['id']); // remove the current id. |
|
74 | + } |
|
75 | + |
|
76 | + // Once we've grabbed the document object, start doing some modifications |
|
77 | + if ($_toplevel == 0) { |
|
78 | + // count duplicates |
|
79 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
|
80 | + $pagetitle = $modx->db->escape($pagetitle); |
|
81 | + $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
|
82 | + if($count>=1) $count = ' '.($count+1); |
|
83 | + else $count = ''; |
|
84 | + |
|
85 | + $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
86 | + $content['alias'] = null; |
|
87 | + } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
88 | + $content['alias'] = null; |
|
89 | + } |
|
90 | + |
|
91 | + // change the parent accordingly |
|
92 | + if ($parent !== null) $content['parent'] = $parent; |
|
93 | + |
|
94 | + // Change the author |
|
95 | + $content['createdby'] = $userID; |
|
96 | + $content['createdon'] = time(); |
|
97 | + // Remove other modification times |
|
98 | + $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0; |
|
99 | + |
|
100 | + // [FS#922] Should the published status be honored? - sirlancelot |
|
101 | 101 | // if ($modx->hasPermission('publish_document')) { |
102 | 102 | // if ($modx->config['publish_default']) |
103 | 103 | // $content['pub_date'] = $content['pub_date']; // should this be changed to 1? |
104 | 104 | // else $content['pub_date'] = 0; |
105 | 105 | // } else { |
106 | - // User can't publish documents |
|
106 | + // User can't publish documents |
|
107 | 107 | // $content['published'] = $content['pub_date'] = 0; |
108 | 108 | // } |
109 | 109 | |
110 | 110 | // Set the published status to unpublished by default (see above ... commit #3388) |
111 | 111 | $content['published'] = $content['pub_date'] = 0; |
112 | 112 | |
113 | - // Escape the proper strings |
|
114 | - $content = $modx->db->escape($content); |
|
113 | + // Escape the proper strings |
|
114 | + $content = $modx->db->escape($content); |
|
115 | 115 | |
116 | - // Duplicate the Document |
|
117 | - $newparent = $modx->db->insert($content, $tblsc); |
|
116 | + // Duplicate the Document |
|
117 | + $newparent = $modx->db->insert($content, $tblsc); |
|
118 | 118 | |
119 | - // duplicate document's TVs |
|
120 | - duplicateTVs($docid, $newparent); |
|
121 | - duplicateAccess($docid, $newparent); |
|
119 | + // duplicate document's TVs |
|
120 | + duplicateTVs($docid, $newparent); |
|
121 | + duplicateAccess($docid, $newparent); |
|
122 | 122 | |
123 | - // invoke OnDocDuplicate event |
|
124 | - $evtOut = $modx->invokeEvent('OnDocDuplicate', array( |
|
125 | - 'id' => $docid, |
|
126 | - 'new_id' => $newparent |
|
127 | - )); |
|
123 | + // invoke OnDocDuplicate event |
|
124 | + $evtOut = $modx->invokeEvent('OnDocDuplicate', array( |
|
125 | + 'id' => $docid, |
|
126 | + 'new_id' => $newparent |
|
127 | + )); |
|
128 | 128 | |
129 | - // Start duplicating all the child documents that aren't deleted. |
|
130 | - $_toplevel++; |
|
131 | - $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
|
132 | - while ($row = $modx->db->getRow($rs)) |
|
133 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
129 | + // Start duplicating all the child documents that aren't deleted. |
|
130 | + $_toplevel++; |
|
131 | + $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
|
132 | + while ($row = $modx->db->getRow($rs)) |
|
133 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
134 | 134 | |
135 | - // return the new doc id |
|
136 | - return $newparent; |
|
135 | + // return the new doc id |
|
136 | + return $newparent; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | // Duplicate Document TVs |
140 | 140 | function duplicateTVs($oldid,$newid){ |
141 | - global $modx; |
|
141 | + global $modx; |
|
142 | 142 | |
143 | - $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
143 | + $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
|
144 | 144 | |
145 | - $modx->db->insert( |
|
146 | - array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into |
|
147 | - "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from |
|
148 | - ); |
|
145 | + $modx->db->insert( |
|
146 | + array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into |
|
147 | + "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from |
|
148 | + ); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Duplicate Document Access Permissions |
152 | 152 | function duplicateAccess($oldid,$newid){ |
153 | - global $modx; |
|
153 | + global $modx; |
|
154 | 154 | |
155 | - $tbldg = $modx->getFullTableName('document_groups'); |
|
155 | + $tbldg = $modx->getFullTableName('document_groups'); |
|
156 | 156 | |
157 | - $modx->db->insert( |
|
158 | - array('document'=>'', 'document_group'=>''), $tbldg, // Insert into |
|
159 | - "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from |
|
160 | - ); |
|
157 | + $modx->db->insert( |
|
158 | + array('document'=>'', 'document_group'=>''), $tbldg, // Insert into |
|
159 | + "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from |
|
160 | + ); |
|
161 | 161 | } |
@@ -1,27 +1,27 @@ 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_document') || !$modx->hasPermission('save_document')) { |
|
5 | +if (!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | $children = array(); |
15 | 15 | |
16 | 16 | // check permissions on the document |
17 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
17 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
18 | 18 | $udperms = new udperms(); |
19 | 19 | $udperms->user = $modx->getLoginUserID(); |
20 | 20 | $udperms->document = $id; |
21 | 21 | $udperms->role = $_SESSION['mgrRole']; |
22 | 22 | $udperms->duplicateDoc = true; |
23 | 23 | |
24 | -if(!$udperms->checkPermissions()) { |
|
24 | +if (!$udperms->checkPermissions()) { |
|
25 | 25 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
26 | 26 | } |
27 | 27 | |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $_SESSION['itemname'] = $name; |
34 | 34 | |
35 | 35 | // finish cloning - redirect |
36 | -$header="Location: index.php?r=1&a=3&id=$id"; |
|
36 | +$header = "Location: index.php?r=1&a=3&id=$id"; |
|
37 | 37 | header($header); |
38 | 38 | |
39 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
39 | +function duplicateDocument($docid, $parent = null, $_toplevel = 0){ |
|
40 | 40 | global $modx, $_lang; |
41 | 41 | |
42 | 42 | // invoke OnBeforeDocDuplicate event |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $content = $modx->db->getRow($rs); |
58 | 58 | |
59 | 59 | // Handle incremental ID |
60 | - switch($modx->config['docid_incrmnt_method']) |
|
60 | + switch ($modx->config['docid_incrmnt_method']) |
|
61 | 61 | { |
62 | 62 | case '1': |
63 | 63 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $content['id'] = $modx->db->getValue($rs); |
66 | 66 | break; |
67 | 67 | case '2': |
68 | - $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
68 | + $rs = $modx->db->select('MAX(id)+1', $tblsc); |
|
69 | 69 | $content['id'] = $modx->db->getValue($rs); |
70 | 70 | break; |
71 | 71 | |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
80 | 80 | $pagetitle = $modx->db->escape($pagetitle); |
81 | 81 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
82 | - if($count>=1) $count = ' '.($count+1); |
|
82 | + if ($count >= 1) $count = ' '.($count + 1); |
|
83 | 83 | else $count = ''; |
84 | 84 | |
85 | 85 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
86 | 86 | $content['alias'] = null; |
87 | - } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
87 | + } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
88 | 88 | $content['alias'] = null; |
89 | 89 | } |
90 | 90 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | // Duplicate Document TVs |
140 | -function duplicateTVs($oldid,$newid){ |
|
140 | +function duplicateTVs($oldid, $newid){ |
|
141 | 141 | global $modx; |
142 | 142 | |
143 | 143 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | // Duplicate Document Access Permissions |
152 | -function duplicateAccess($oldid,$newid){ |
|
152 | +function duplicateAccess($oldid, $newid){ |
|
153 | 153 | global $modx; |
154 | 154 | |
155 | 155 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate Plugin |
21 | 24 | $newid = $modx->db->insert( |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('new_plugin')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,25 +19,25 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Plugin |
21 | 21 | $newid = $modx->db->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'disabled'=>'', |
|
26 | - 'moduleguid'=>'', |
|
27 | - 'plugincode'=>'', |
|
28 | - 'properties'=>'', |
|
29 | - 'category'=>'', |
|
30 | - ), $modx->getFullTableName('site_plugins'), // Insert into |
|
31 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'disabled'=>'', |
|
26 | + 'moduleguid'=>'', |
|
27 | + 'plugincode'=>'', |
|
28 | + 'properties'=>'', |
|
29 | + 'category'=>'', |
|
30 | + ), $modx->getFullTableName('site_plugins'), // Insert into |
|
31 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
32 | 32 | |
33 | 33 | // duplicate Plugin Event Listeners |
34 | 34 | $modx->db->insert( |
35 | - array( |
|
36 | - 'pluginid'=>'', |
|
37 | - 'evtid'=>'', |
|
38 | - 'priority'=>'', |
|
39 | - ), $modx->getFullTableName('site_plugin_events'), // Insert into |
|
40 | - "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
35 | + array( |
|
36 | + 'pluginid'=>'', |
|
37 | + 'evtid'=>'', |
|
38 | + 'priority'=>'', |
|
39 | + ), $modx->getFullTableName('site_plugin_events'), // Insert into |
|
40 | + "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
41 | 41 | |
42 | 42 | // Set the item name for logger |
43 | 43 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$newid}'")); |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_plugin')) { |
|
5 | +if (!$modx->hasPermission('new_plugin')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate Plugin |
@@ -44,5 +44,5 @@ discard block |
||
44 | 44 | $_SESSION['itemname'] = $name; |
45 | 45 | |
46 | 46 | // finish duplicating - redirect to new plugin |
47 | -$header="Location: index.php?r=2&a=102&id=$newid"; |
|
47 | +$header = "Location: index.php?r=2&a=102&id=$newid"; |
|
48 | 48 | header($header); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate TV |
21 | 24 | $newid = $modx->db->insert( |
@@ -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('edit_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 | // count duplicates |
@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate TV |
21 | 21 | $newid = $modx->db->insert( |
22 | - array( |
|
23 | - 'type'=>'', |
|
24 | - 'name'=>'', |
|
25 | - 'caption'=>'', |
|
26 | - 'description'=>'', |
|
27 | - 'default_text'=>'', |
|
28 | - 'elements'=>'', |
|
29 | - 'rank'=>'', |
|
30 | - 'display'=>'', |
|
31 | - 'display_params'=>'', |
|
32 | - 'category'=>'', |
|
33 | - ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
34 | - "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'type'=>'', |
|
24 | + 'name'=>'', |
|
25 | + 'caption'=>'', |
|
26 | + 'description'=>'', |
|
27 | + 'default_text'=>'', |
|
28 | + 'elements'=>'', |
|
29 | + 'rank'=>'', |
|
30 | + 'display'=>'', |
|
31 | + 'display_params'=>'', |
|
32 | + 'category'=>'', |
|
33 | + ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
34 | + "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
35 | 35 | |
36 | 36 | |
37 | 37 | // duplicate TV Template Access Permissions |
38 | 38 | $modx->db->insert( |
39 | - array( |
|
40 | - 'tmplvarid'=>'', |
|
41 | - 'templateid'=>'', |
|
42 | - 'rank'=>'', |
|
43 | - ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
44 | - "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
39 | + array( |
|
40 | + 'tmplvarid'=>'', |
|
41 | + 'templateid'=>'', |
|
42 | + 'rank'=>'', |
|
43 | + ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
44 | + "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
45 | 45 | |
46 | 46 | // duplicate TV Access Permissions |
47 | 47 | $modx->db->insert( |
48 | - array( |
|
49 | - 'tmplvarid'=>'', |
|
50 | - 'documentgroup'=>'', |
|
51 | - ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
52 | - "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
48 | + array( |
|
49 | + 'tmplvarid'=>'', |
|
50 | + 'documentgroup'=>'', |
|
51 | + ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
52 | + "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
53 | 53 | |
54 | 54 | // Set the item name for logger |
55 | 55 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$newid}'")); |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('edit_template')) { |
|
5 | +if (!$modx->hasPermission('edit_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 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate TV |
@@ -56,5 +56,5 @@ discard block |
||
56 | 56 | $_SESSION['itemname'] = $name; |
57 | 57 | |
58 | 58 | // finish duplicating - redirect to new variable |
59 | -$header="Location: index.php?r=2&a=301&id=$newid"; |
|
59 | +$header = "Location: index.php?r=2&a=301&id=$newid"; |
|
60 | 60 | header($header); |
@@ -4,7 +4,9 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!isset($_GET['id'])) { |
7 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + if(!$modx->hasPermission('remove_locks')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
8 | 10 | |
9 | 11 | // Remove all locks |
10 | 12 | $modx->db->truncate($modx->getFullTableName('active_user_locks')); |
@@ -4,23 +4,23 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!isset($_GET['id'])) { |
7 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
8 | 8 | |
9 | - // Remove all locks |
|
10 | - $modx->db->truncate($modx->getFullTableName('active_user_locks')); |
|
9 | + // Remove all locks |
|
10 | + $modx->db->truncate($modx->getFullTableName('active_user_locks')); |
|
11 | 11 | |
12 | - $header = "Location: index.php?a=2"; |
|
13 | - header($header); |
|
12 | + $header = "Location: index.php?a=2"; |
|
13 | + header($header); |
|
14 | 14 | } else { |
15 | - // Remove single locks via AJAX / window.onbeforeunload |
|
16 | - $type = (int)$_GET['type']; |
|
17 | - $id = (int)$_GET['id']; |
|
18 | - $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button |
|
19 | - if($type && $id) { |
|
20 | - $modx->unlockElement($type, $id, $includeAllUsers); |
|
21 | - echo '1'; |
|
22 | - exit; |
|
23 | - } else { |
|
24 | - echo 'No type or id sent with request.'; |
|
25 | - } |
|
15 | + // Remove single locks via AJAX / window.onbeforeunload |
|
16 | + $type = (int)$_GET['type']; |
|
17 | + $id = (int)$_GET['id']; |
|
18 | + $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button |
|
19 | + if($type && $id) { |
|
20 | + $modx->unlockElement($type, $id, $includeAllUsers); |
|
21 | + echo '1'; |
|
22 | + exit; |
|
23 | + } else { |
|
24 | + echo 'No type or id sent with request.'; |
|
25 | + } |
|
26 | 26 | } |
@@ -1,10 +1,10 @@ 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 | |
6 | -if(!isset($_GET['id'])) { |
|
7 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | +if (!isset($_GET['id'])) { |
|
7 | + if (!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
8 | 8 | |
9 | 9 | // Remove all locks |
10 | 10 | $modx->db->truncate($modx->getFullTableName('active_user_locks')); |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | header($header); |
14 | 14 | } else { |
15 | 15 | // Remove single locks via AJAX / window.onbeforeunload |
16 | - $type = (int)$_GET['type']; |
|
17 | - $id = (int)$_GET['id']; |
|
16 | + $type = (int) $_GET['type']; |
|
17 | + $id = (int) $_GET['id']; |
|
18 | 18 | $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button |
19 | - if($type && $id) { |
|
19 | + if ($type && $id) { |
|
20 | 20 | $modx->unlockElement($type, $id, $includeAllUsers); |
21 | 21 | echo '1'; |
22 | 22 | exit; |
@@ -117,7 +117,7 @@ |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure web documents - flag as private |
120 | -if($updategroupaccess==true){ |
|
120 | +if($updategroupaccess==true) { |
|
121 | 121 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
122 | 122 | secureWebDocument(); |
123 | 123 |
@@ -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('web_access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // web access group processor. |
@@ -20,111 +20,111 @@ 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->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_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->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names); |
|
29 | 29 | |
30 | - // invoke OnWebCreateGroup event |
|
31 | - $modx->invokeEvent('OnWebCreateGroup', 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->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names); |
|
30 | + // invoke OnWebCreateGroup event |
|
31 | + $modx->invokeEvent('OnWebCreateGroup', 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->db->insert(array('name'=>$modx->db->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->db->delete($tbl_webgroup_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->db->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
|
58 | 58 | |
59 | - $modx->db->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
59 | + $modx->db->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
60 | 60 | |
61 | - $modx->db->delete($tbl_web_groups, "webuser='{$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->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
61 | + $modx->db->delete($tbl_web_groups, "webuser='{$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->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
70 | 70 | |
71 | - $modx->db->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
71 | + $modx->db->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
72 | 72 | |
73 | - $modx->db->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 user group id specified for rename."); |
|
84 | - } |
|
85 | - $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
86 | - break; |
|
87 | - case "rename_document_group" : |
|
88 | - $newgroupname = $_REQUEST['newgroupname']; |
|
89 | - if(empty($newgroupname)) { |
|
90 | - $modx->webAlertAndQuit("No group name specified."); |
|
91 | - } |
|
92 | - $groupid = (int)$_REQUEST['groupid']; |
|
93 | - if(empty($groupid)) { |
|
94 | - $modx->webAlertAndQuit("No document group id specified for rename."); |
|
95 | - } |
|
96 | - $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
97 | - break; |
|
98 | - case "add_document_group_to_user_group" : |
|
99 | - $updategroupaccess = true; |
|
100 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
101 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
102 | - $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
103 | - $limit = $modx->db->getValue($rs); |
|
104 | - if($limit<=0) { |
|
105 | - $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
106 | - } else { |
|
107 | - //alert user that coupling already exists? |
|
108 | - } |
|
109 | - break; |
|
110 | - case "remove_document_group_from_user_group" : |
|
111 | - $updategroupaccess = true; |
|
112 | - $coupling = (int)$_REQUEST['coupling']; |
|
113 | - $modx->db->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
114 | - break; |
|
115 | - default : |
|
116 | - $modx->webAlertAndQuit("No operation set in request."); |
|
73 | + $modx->db->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 user group id specified for rename."); |
|
84 | + } |
|
85 | + $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
86 | + break; |
|
87 | + case "rename_document_group" : |
|
88 | + $newgroupname = $_REQUEST['newgroupname']; |
|
89 | + if(empty($newgroupname)) { |
|
90 | + $modx->webAlertAndQuit("No group name specified."); |
|
91 | + } |
|
92 | + $groupid = (int)$_REQUEST['groupid']; |
|
93 | + if(empty($groupid)) { |
|
94 | + $modx->webAlertAndQuit("No document group id specified for rename."); |
|
95 | + } |
|
96 | + $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
97 | + break; |
|
98 | + case "add_document_group_to_user_group" : |
|
99 | + $updategroupaccess = true; |
|
100 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
101 | + $docgroup = (int)$_REQUEST['docgroup']; |
|
102 | + $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
103 | + $limit = $modx->db->getValue($rs); |
|
104 | + if($limit<=0) { |
|
105 | + $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
106 | + } else { |
|
107 | + //alert user that coupling already exists? |
|
108 | + } |
|
109 | + break; |
|
110 | + case "remove_document_group_from_user_group" : |
|
111 | + $updategroupaccess = true; |
|
112 | + $coupling = (int)$_REQUEST['coupling']; |
|
113 | + $modx->db->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
114 | + break; |
|
115 | + default : |
|
116 | + $modx->webAlertAndQuit("No operation set in request."); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure web documents - flag as private |
120 | 120 | if($updategroupaccess==true){ |
121 | - include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
122 | - secureWebDocument(); |
|
121 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
122 | + secureWebDocument(); |
|
123 | 123 | |
124 | - // Update the private group column |
|
125 | - $modx->db->update( |
|
126 | - 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
127 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
124 | + // Update the private group column |
|
125 | + $modx->db->update( |
|
126 | + 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
127 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $header = "Location: index.php?a=91"; |
@@ -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('web_access_permissions')) { |
|
5 | +if (!$modx->hasPermission('web_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->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_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->db->insert(array('name'=>$modx->db->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->db->delete($tbl_webgroup_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->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -75,33 +75,33 @@ 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 user group id specified for rename."); |
84 | 84 | } |
85 | 85 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
86 | 86 | break; |
87 | 87 | case "rename_document_group" : |
88 | 88 | $newgroupname = $_REQUEST['newgroupname']; |
89 | - if(empty($newgroupname)) { |
|
89 | + if (empty($newgroupname)) { |
|
90 | 90 | $modx->webAlertAndQuit("No group name specified."); |
91 | 91 | } |
92 | - $groupid = (int)$_REQUEST['groupid']; |
|
93 | - if(empty($groupid)) { |
|
92 | + $groupid = (int) $_REQUEST['groupid']; |
|
93 | + if (empty($groupid)) { |
|
94 | 94 | $modx->webAlertAndQuit("No document group id specified for rename."); |
95 | 95 | } |
96 | 96 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
97 | 97 | break; |
98 | 98 | case "add_document_group_to_user_group" : |
99 | 99 | $updategroupaccess = true; |
100 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
101 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
100 | + $usergroup = (int) $_REQUEST['usergroup']; |
|
101 | + $docgroup = (int) $_REQUEST['docgroup']; |
|
102 | 102 | $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
103 | 103 | $limit = $modx->db->getValue($rs); |
104 | - if($limit<=0) { |
|
104 | + if ($limit <= 0) { |
|
105 | 105 | $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
106 | 106 | } else { |
107 | 107 | //alert user that coupling already exists? |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | break; |
110 | 110 | case "remove_document_group_from_user_group" : |
111 | 111 | $updategroupaccess = true; |
112 | - $coupling = (int)$_REQUEST['coupling']; |
|
112 | + $coupling = (int) $_REQUEST['coupling']; |
|
113 | 113 | $modx->db->delete($tbl_webgroup_access, "id='{$coupling}'"); |
114 | 114 | break; |
115 | 115 | default : |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure web documents - flag as private |
120 | -if($updategroupaccess==true){ |
|
120 | +if ($updategroupaccess == true) { |
|
121 | 121 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
122 | 122 | secureWebDocument(); |
123 | 123 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('edit_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,82 +25,82 @@ discard block |
||
25 | 25 | // check user has permission to move document to chosen location |
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | - if ($oldparent != $newParentID) { |
|
29 | - include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
30 | - $udperms = new udperms(); |
|
31 | - $udperms->user = $modx->getLoginUserID(); |
|
32 | - $udperms->document = $newParentID; |
|
33 | - $udperms->role = $_SESSION['mgrRole']; |
|
34 | - |
|
35 | - if (!$udperms->checkPermissions()) { |
|
36 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
37 | - } |
|
38 | - } |
|
28 | + if ($oldparent != $newParentID) { |
|
29 | + include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
30 | + $udperms = new udperms(); |
|
31 | + $udperms->user = $modx->getLoginUserID(); |
|
32 | + $udperms->document = $newParentID; |
|
33 | + $udperms->role = $_SESSION['mgrRole']; |
|
34 | + |
|
35 | + if (!$udperms->checkPermissions()) { |
|
36 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
37 | + } |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | function allChildren($currDocID) { |
42 | - global $modx; |
|
43 | - $children= array(); |
|
44 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
|
45 | - while ($child= $modx->db->getRow($rs)) { |
|
46 | - $children[]= $child['id']; |
|
47 | - $nextgen= array(); |
|
48 | - $nextgen= allChildren($child['id']); |
|
49 | - $children= array_merge($children, $nextgen); |
|
50 | - } |
|
51 | - return $children; |
|
42 | + global $modx; |
|
43 | + $children= array(); |
|
44 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
|
45 | + while ($child= $modx->db->getRow($rs)) { |
|
46 | + $children[]= $child['id']; |
|
47 | + $nextgen= array(); |
|
48 | + $nextgen= allChildren($child['id']); |
|
49 | + $children= array_merge($children, $nextgen); |
|
50 | + } |
|
51 | + return $children; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
55 | - "id_document" => $documentID, |
|
56 | - "old_parent" => $oldparent, |
|
57 | - "new_parent" => $newParentID |
|
55 | + "id_document" => $documentID, |
|
56 | + "old_parent" => $oldparent, |
|
57 | + "new_parent" => $newParentID |
|
58 | 58 | )); |
59 | 59 | if (is_array($evtOut) && count($evtOut) > 0){ |
60 | - $newParent = array_pop($evtOut); |
|
61 | - if($newParent == $oldparent) { |
|
62 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
63 | - }else{ |
|
64 | - $newParentID = $newParent; |
|
65 | - } |
|
60 | + $newParent = array_pop($evtOut); |
|
61 | + if($newParent == $oldparent) { |
|
62 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
63 | + }else{ |
|
64 | + $newParentID = $newParent; |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $children = allChildren($documentID); |
69 | 69 | if (!array_search($newParentID, $children)) { |
70 | - $modx->db->update(array( |
|
71 | - 'isfolder' => 1, |
|
72 | - ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
73 | - |
|
74 | - $modx->db->update(array( |
|
75 | - 'parent' => $newParentID, |
|
76 | - 'editedby' => $modx->getLoginUserID(), |
|
77 | - 'editedon' => time(), |
|
78 | - ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
79 | - |
|
80 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
81 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
82 | - $limit = $modx->db->getValue($rs); |
|
83 | - |
|
84 | - if(!$limit>0) { |
|
85 | - $modx->db->update(array( |
|
86 | - 'isfolder' => 0, |
|
87 | - ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
88 | - } |
|
89 | - // Set the item name for logger |
|
90 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
91 | - $_SESSION['itemname'] = $pagetitle; |
|
92 | - |
|
93 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
94 | - "id_document" => $documentID, |
|
95 | - "old_parent" => $oldparent, |
|
96 | - "new_parent" => $newParentID |
|
97 | - )); |
|
98 | - |
|
99 | - // empty cache & sync site |
|
100 | - $modx->clearCache('full'); |
|
101 | - |
|
102 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
103 | - header($header); |
|
70 | + $modx->db->update(array( |
|
71 | + 'isfolder' => 1, |
|
72 | + ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
73 | + |
|
74 | + $modx->db->update(array( |
|
75 | + 'parent' => $newParentID, |
|
76 | + 'editedby' => $modx->getLoginUserID(), |
|
77 | + 'editedon' => time(), |
|
78 | + ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
79 | + |
|
80 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
81 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
82 | + $limit = $modx->db->getValue($rs); |
|
83 | + |
|
84 | + if(!$limit>0) { |
|
85 | + $modx->db->update(array( |
|
86 | + 'isfolder' => 0, |
|
87 | + ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
88 | + } |
|
89 | + // Set the item name for logger |
|
90 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
91 | + $_SESSION['itemname'] = $pagetitle; |
|
92 | + |
|
93 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
94 | + "id_document" => $documentID, |
|
95 | + "old_parent" => $oldparent, |
|
96 | + "new_parent" => $newParentID |
|
97 | + )); |
|
98 | + |
|
99 | + // empty cache & sync site |
|
100 | + $modx->clearCache('full'); |
|
101 | + |
|
102 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
103 | + header($header); |
|
104 | 104 | } else { |
105 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
105 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
106 | 106 | } |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('edit_document')) { |
|
5 | +if (!$modx->hasPermission('edit_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
10 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
9 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
10 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
11 | 11 | |
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
18 | 18 | |
19 | 19 | $parents = $modx->getParentIds($newParentID); |
20 | 20 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | 28 | if ($oldparent != $newParentID) { |
29 | - include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
29 | + include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
30 | 30 | $udperms = new udperms(); |
31 | 31 | $udperms->user = $modx->getLoginUserID(); |
32 | 32 | $udperms->document = $newParentID; |
@@ -38,29 +38,29 @@ discard block |
||
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | -function allChildren($currDocID) { |
|
41 | +function allChildren($currDocID){ |
|
42 | 42 | global $modx; |
43 | - $children= array(); |
|
43 | + $children = array(); |
|
44 | 44 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
45 | - while ($child= $modx->db->getRow($rs)) { |
|
46 | - $children[]= $child['id']; |
|
47 | - $nextgen= array(); |
|
48 | - $nextgen= allChildren($child['id']); |
|
49 | - $children= array_merge($children, $nextgen); |
|
45 | + while ($child = $modx->db->getRow($rs)) { |
|
46 | + $children[] = $child['id']; |
|
47 | + $nextgen = array(); |
|
48 | + $nextgen = allChildren($child['id']); |
|
49 | + $children = array_merge($children, $nextgen); |
|
50 | 50 | } |
51 | 51 | return $children; |
52 | 52 | } |
53 | 53 | |
54 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
54 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
55 | 55 | "id_document" => $documentID, |
56 | 56 | "old_parent" => $oldparent, |
57 | 57 | "new_parent" => $newParentID |
58 | 58 | )); |
59 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
59 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
60 | 60 | $newParent = array_pop($evtOut); |
61 | - if($newParent == $oldparent) { |
|
61 | + if ($newParent == $oldparent) { |
|
62 | 62 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
63 | - }else{ |
|
63 | + } else { |
|
64 | 64 | $newParentID = $newParent; |
65 | 65 | } |
66 | 66 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
82 | 82 | $limit = $modx->db->getValue($rs); |
83 | 83 | |
84 | - if(!$limit>0) { |
|
84 | + if (!$limit > 0) { |
|
85 | 85 | $modx->db->update(array( |
86 | 86 | 'isfolder' => 0, |
87 | 87 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
91 | 91 | $_SESSION['itemname'] = $pagetitle; |
92 | 92 | |
93 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
93 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
94 | 94 | "id_document" => $documentID, |
95 | 95 | "old_parent" => $oldparent, |
96 | 96 | "new_parent" => $newParentID |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // empty cache & sync site |
100 | 100 | $modx->clearCache('full'); |
101 | 101 | |
102 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
102 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
103 | 103 | header($header); |
104 | 104 | } else { |
105 | 105 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
@@ -12,12 +12,20 @@ discard block |
||
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if($documentID==$newParentID) { |
|
16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
17 | +} |
|
18 | +if($documentID <= 0) { |
|
19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
20 | +} |
|
21 | +if($newParentID < 0) { |
|
22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
23 | +} |
|
18 | 24 | |
19 | 25 | $parents = $modx->getParentIds($newParentID); |
20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
26 | +if (in_array($documentID, $parents)) { |
|
27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
28 | +} |
|
21 | 29 | |
22 | 30 | $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
23 | 31 | $oldparent = $modx->db->getValue($rs); |
@@ -38,7 +46,8 @@ discard block |
||
38 | 46 | } |
39 | 47 | } |
40 | 48 | |
41 | -function allChildren($currDocID) { |
|
49 | +function allChildren($currDocID) |
|
50 | +{ |
|
42 | 51 | global $modx; |
43 | 52 | $children= array(); |
44 | 53 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
@@ -56,11 +65,11 @@ discard block |
||
56 | 65 | "old_parent" => $oldparent, |
57 | 66 | "new_parent" => $newParentID |
58 | 67 | )); |
59 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
68 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
60 | 69 | $newParent = array_pop($evtOut); |
61 | 70 | if($newParent == $oldparent) { |
62 | 71 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
63 | - }else{ |
|
72 | + } else { |
|
64 | 73 | $newParentID = $newParent; |
65 | 74 | } |
66 | 75 | } |
@@ -1,135 +1,135 @@ |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_role')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | 11 | if($name == '' || !isset ($name)) { |
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | // setup fields |
16 | 16 | $fields = array( |
17 | - 'name' => $name, |
|
18 | - 'description' => $description, |
|
19 | - 'frames' => $frames, |
|
20 | - 'home' => $home, |
|
21 | - 'view_document' => $view_document, |
|
22 | - 'new_document' => $new_document, |
|
23 | - 'save_document' => $save_document, |
|
24 | - 'publish_document' => $publish_document, |
|
25 | - 'delete_document' => $delete_document, |
|
26 | - 'empty_trash' => $empty_trash, |
|
27 | - 'action_ok' => $action_ok, |
|
28 | - 'logout' => $logout, |
|
29 | - 'help' => $help, |
|
30 | - 'messages' => $messages, |
|
31 | - 'new_user' => $new_user, |
|
32 | - 'edit_user' => $edit_user, |
|
33 | - 'logs' => $logs, |
|
34 | - 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | - 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | - 'edit_template' => $edit_template, |
|
37 | - 'settings' => $settings, |
|
38 | - 'credits' => $credits, |
|
39 | - 'new_template' => $new_template, |
|
40 | - 'save_template' => $save_template, |
|
41 | - 'delete_template' => $delete_template, |
|
42 | - 'edit_snippet' => $edit_snippet, |
|
43 | - 'new_snippet' => $new_snippet, |
|
44 | - 'save_snippet' => $save_snippet, |
|
45 | - 'delete_snippet' => $delete_snippet, |
|
46 | - 'edit_chunk' => $edit_chunk, |
|
47 | - 'new_chunk' => $new_chunk, |
|
48 | - 'save_chunk' => $save_chunk, |
|
49 | - 'delete_chunk' => $delete_chunk, |
|
50 | - 'empty_cache' => $empty_cache, |
|
51 | - 'edit_document' => $edit_document, |
|
52 | - 'change_password' => $change_password, |
|
53 | - 'error_dialog' => $error_dialog, |
|
54 | - 'about' => $about, |
|
55 | - 'file_manager' => $file_manager, |
|
56 | - 'assets_files' => $assets_files, |
|
57 | - 'assets_images' => $assets_images, |
|
58 | - 'save_user' => $save_user, |
|
59 | - 'delete_user' => $delete_user, |
|
60 | - 'save_password' => $save_password, |
|
61 | - 'edit_role' => $edit_role, |
|
62 | - 'save_role' => $save_role, |
|
63 | - 'delete_role' => $delete_role, |
|
64 | - 'new_role' => $new_role, |
|
65 | - 'access_permissions' => $access_permissions, |
|
66 | - 'bk_manager' => $bk_manager, |
|
67 | - 'new_plugin' => $new_plugin, |
|
68 | - 'edit_plugin' => $edit_plugin, |
|
69 | - 'save_plugin' => $save_plugin, |
|
70 | - 'delete_plugin' => $delete_plugin, |
|
71 | - 'new_module' => $new_module, |
|
72 | - 'edit_module' => $edit_module, |
|
73 | - 'save_module' => $save_module, |
|
74 | - 'delete_module' => $delete_module, |
|
75 | - 'exec_module' => $exec_module, |
|
76 | - 'view_eventlog' => $view_eventlog, |
|
77 | - 'delete_eventlog' => $delete_eventlog, |
|
78 | - 'new_web_user' => $new_web_user, |
|
79 | - 'edit_web_user' => $edit_web_user, |
|
80 | - 'save_web_user' => $save_web_user, |
|
81 | - 'delete_web_user' => $delete_web_user, |
|
82 | - 'web_access_permissions' => $web_access_permissions, |
|
83 | - 'view_unpublished' => $view_unpublished, |
|
84 | - 'import_static' => $import_static, |
|
85 | - 'export_static' => $export_static, |
|
86 | - 'remove_locks' => $remove_locks, |
|
87 | - 'display_locks' => $display_locks, |
|
88 | - 'change_resourcetype' => $change_resourcetype, |
|
89 | - 'category_manager' => $category_manager |
|
17 | + 'name' => $name, |
|
18 | + 'description' => $description, |
|
19 | + 'frames' => $frames, |
|
20 | + 'home' => $home, |
|
21 | + 'view_document' => $view_document, |
|
22 | + 'new_document' => $new_document, |
|
23 | + 'save_document' => $save_document, |
|
24 | + 'publish_document' => $publish_document, |
|
25 | + 'delete_document' => $delete_document, |
|
26 | + 'empty_trash' => $empty_trash, |
|
27 | + 'action_ok' => $action_ok, |
|
28 | + 'logout' => $logout, |
|
29 | + 'help' => $help, |
|
30 | + 'messages' => $messages, |
|
31 | + 'new_user' => $new_user, |
|
32 | + 'edit_user' => $edit_user, |
|
33 | + 'logs' => $logs, |
|
34 | + 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | + 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | + 'edit_template' => $edit_template, |
|
37 | + 'settings' => $settings, |
|
38 | + 'credits' => $credits, |
|
39 | + 'new_template' => $new_template, |
|
40 | + 'save_template' => $save_template, |
|
41 | + 'delete_template' => $delete_template, |
|
42 | + 'edit_snippet' => $edit_snippet, |
|
43 | + 'new_snippet' => $new_snippet, |
|
44 | + 'save_snippet' => $save_snippet, |
|
45 | + 'delete_snippet' => $delete_snippet, |
|
46 | + 'edit_chunk' => $edit_chunk, |
|
47 | + 'new_chunk' => $new_chunk, |
|
48 | + 'save_chunk' => $save_chunk, |
|
49 | + 'delete_chunk' => $delete_chunk, |
|
50 | + 'empty_cache' => $empty_cache, |
|
51 | + 'edit_document' => $edit_document, |
|
52 | + 'change_password' => $change_password, |
|
53 | + 'error_dialog' => $error_dialog, |
|
54 | + 'about' => $about, |
|
55 | + 'file_manager' => $file_manager, |
|
56 | + 'assets_files' => $assets_files, |
|
57 | + 'assets_images' => $assets_images, |
|
58 | + 'save_user' => $save_user, |
|
59 | + 'delete_user' => $delete_user, |
|
60 | + 'save_password' => $save_password, |
|
61 | + 'edit_role' => $edit_role, |
|
62 | + 'save_role' => $save_role, |
|
63 | + 'delete_role' => $delete_role, |
|
64 | + 'new_role' => $new_role, |
|
65 | + 'access_permissions' => $access_permissions, |
|
66 | + 'bk_manager' => $bk_manager, |
|
67 | + 'new_plugin' => $new_plugin, |
|
68 | + 'edit_plugin' => $edit_plugin, |
|
69 | + 'save_plugin' => $save_plugin, |
|
70 | + 'delete_plugin' => $delete_plugin, |
|
71 | + 'new_module' => $new_module, |
|
72 | + 'edit_module' => $edit_module, |
|
73 | + 'save_module' => $save_module, |
|
74 | + 'delete_module' => $delete_module, |
|
75 | + 'exec_module' => $exec_module, |
|
76 | + 'view_eventlog' => $view_eventlog, |
|
77 | + 'delete_eventlog' => $delete_eventlog, |
|
78 | + 'new_web_user' => $new_web_user, |
|
79 | + 'edit_web_user' => $edit_web_user, |
|
80 | + 'save_web_user' => $save_web_user, |
|
81 | + 'delete_web_user' => $delete_web_user, |
|
82 | + 'web_access_permissions' => $web_access_permissions, |
|
83 | + 'view_unpublished' => $view_unpublished, |
|
84 | + 'import_static' => $import_static, |
|
85 | + 'export_static' => $export_static, |
|
86 | + 'remove_locks' => $remove_locks, |
|
87 | + 'display_locks' => $display_locks, |
|
88 | + 'change_resourcetype' => $change_resourcetype, |
|
89 | + 'category_manager' => $category_manager |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | $fields = $modx->db->escape($fields); |
93 | 93 | |
94 | 94 | switch($_POST['mode']) { |
95 | - case '38' : |
|
96 | - $tbl = $modx->getFullTableName("user_roles"); |
|
95 | + case '38' : |
|
96 | + $tbl = $modx->getFullTableName("user_roles"); |
|
97 | 97 | |
98 | - // disallow duplicate names for role |
|
99 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | - if($modx->db->getValue($rs) > 0) { |
|
101 | - $modx->manager->saveFormValues(38); |
|
102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | - } |
|
98 | + // disallow duplicate names for role |
|
99 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | + if($modx->db->getValue($rs) > 0) { |
|
101 | + $modx->manager->saveFormValues(38); |
|
102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | + } |
|
104 | 104 | |
105 | - $modx->db->insert($fields, $tbl); |
|
105 | + $modx->db->insert($fields, $tbl); |
|
106 | 106 | |
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $_POST['name']; |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $_POST['name']; |
|
109 | 109 | |
110 | - $header = "Location: index.php?a=86&r=2"; |
|
111 | - header($header); |
|
112 | - break; |
|
113 | - case '35' : |
|
114 | - $tbl = $modx->getFullTableName("user_roles"); |
|
110 | + $header = "Location: index.php?a=86&r=2"; |
|
111 | + header($header); |
|
112 | + break; |
|
113 | + case '35' : |
|
114 | + $tbl = $modx->getFullTableName("user_roles"); |
|
115 | 115 | |
116 | - // disallow duplicate names for role |
|
117 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | - if($modx->db->getValue($rs) > 0) { |
|
119 | - $modx->manager->saveFormValues(35); |
|
120 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | - } |
|
116 | + // disallow duplicate names for role |
|
117 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | + if($modx->db->getValue($rs) > 0) { |
|
119 | + $modx->manager->saveFormValues(35); |
|
120 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | + } |
|
122 | 122 | |
123 | - $modx->db->update($fields, $tbl, "id='{$id}'"); |
|
123 | + $modx->db->update($fields, $tbl, "id='{$id}'"); |
|
124 | 124 | |
125 | - // Set the item name for logger |
|
126 | - $_SESSION['itemname'] = $_POST['name']; |
|
125 | + // Set the item name for logger |
|
126 | + $_SESSION['itemname'] = $_POST['name']; |
|
127 | 127 | |
128 | - $header = "Location: index.php?a=86&r=2"; |
|
129 | - header($header); |
|
130 | - break; |
|
131 | - default : |
|
132 | - $modx->webAlertAndQuit("No operation set in request."); |
|
128 | + $header = "Location: index.php?a=86&r=2"; |
|
129 | + header($header); |
|
130 | + break; |
|
131 | + default : |
|
132 | + $modx->webAlertAndQuit("No operation set in request."); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $modx->unlockElement(8, $id); |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('save_role')) { |
|
5 | +if (!$modx->hasPermission('save_role')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | -if($name == '' || !isset ($name)) { |
|
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
11 | +if ($name == '' || !isset ($name)) { |
|
12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}".($mode = 35 ? "&id={$id}" : "")); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | // setup fields |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | |
92 | 92 | $fields = $modx->db->escape($fields); |
93 | 93 | |
94 | -switch($_POST['mode']) { |
|
94 | +switch ($_POST['mode']) { |
|
95 | 95 | case '38' : |
96 | 96 | $tbl = $modx->getFullTableName("user_roles"); |
97 | 97 | |
98 | 98 | // disallow duplicate names for role |
99 | 99 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
100 | - if($modx->db->getValue($rs) > 0) { |
|
100 | + if ($modx->db->getValue($rs) > 0) { |
|
101 | 101 | $modx->manager->saveFormValues(38); |
102 | 102 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
103 | 103 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // disallow duplicate names for role |
117 | 117 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
118 | - if($modx->db->getValue($rs) > 0) { |
|
118 | + if ($modx->db->getValue($rs) > 0) { |
|
119 | 119 | $modx->manager->saveFormValues(35); |
120 | 120 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
121 | 121 | } |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate Snippet |
21 | 24 | $newid = $modx->db->insert( |
@@ -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_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 | // count duplicates |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Snippet |
21 | 21 | $newid = $modx->db->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'snippet'=>'', |
|
26 | - 'properties'=>'', |
|
27 | - 'category'=>'', |
|
28 | - ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'snippet'=>'', |
|
26 | + 'properties'=>'', |
|
27 | + 'category'=>'', |
|
28 | + ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
30 | 30 | |
31 | 31 | // Set the item name for logger |
32 | 32 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$newid}'")); |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_snippet')) { |
|
5 | +if (!$modx->hasPermission('new_snippet')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate Snippet |
@@ -33,5 +33,5 @@ discard block |
||
33 | 33 | $_SESSION['itemname'] = $name; |
34 | 34 | |
35 | 35 | // finish duplicating - redirect to new snippet |
36 | -$header="Location: index.php?r=2&a=22&id=$newid"; |
|
36 | +$header = "Location: index.php?r=2&a=22&id=$newid"; |
|
37 | 37 | header($header); |
@@ -4,8 +4,8 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!$modx->hasPermission('delete_plugin')) { |
7 | - $e->setError(3); |
|
8 | - $e->dumpError(); |
|
7 | + $e->setError(3); |
|
8 | + $e->dumpError(); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $tbl_site_plugins = $modx->getFullTablename('site_plugins'); |
@@ -1,9 +1,9 @@ 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 | exit(); |
4 | 4 | } |
5 | 5 | |
6 | -if(!$modx->hasPermission('delete_plugin')) { |
|
6 | +if (!$modx->hasPermission('delete_plugin')) { |
|
7 | 7 | $e->setError(3); |
8 | 8 | $e->dumpError(); |
9 | 9 | } |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | // Get unique list of latest added plugins by highest sql-id |
15 | 15 | $rs = $modx->db->query("SELECT t1.id FROM {$tbl_site_plugins} t1 LEFT JOIN {$tbl_site_plugins} t2 ON (t1.name = t2.name AND t1.id < t2.id) WHERE t2.id IS NULL;"); |
16 | 16 | $latestIds = array(); |
17 | -while($row = $modx->db->getRow($rs)) { |
|
17 | +while ($row = $modx->db->getRow($rs)) { |
|
18 | 18 | $latestIds[] = $row['id']; |
19 | 19 | } |
20 | 20 | |
21 | 21 | // Get list of plugins with disabled and enabled versions |
22 | 22 | $rs = $modx->db->query("SELECT id FROM {$tbl_site_plugins} t1 WHERE disabled = 1 AND name IN (SELECT name FROM {$tbl_site_plugins} t2 WHERE t1.name = t2.name AND t1.id != t2.id)"); |
23 | 23 | |
24 | -while($row = $modx->db->getRow($rs)) { |
|
24 | +while ($row = $modx->db->getRow($rs)) { |
|
25 | 25 | |
26 | 26 | $id = $row['id']; |
27 | 27 | |
28 | - if(in_array($id,$latestIds)) continue; // Keep latest version of disabled plugins |
|
28 | + if (in_array($id, $latestIds)) continue; // Keep latest version of disabled plugins |
|
29 | 29 | |
30 | 30 | // invoke OnBeforePluginFormDelete event |
31 | 31 | $modx->invokeEvent('OnBeforePluginFormDelete', array('id'=> $id)); |
@@ -25,7 +25,10 @@ |
||
25 | 25 | |
26 | 26 | $id = $row['id']; |
27 | 27 | |
28 | - if(in_array($id,$latestIds)) continue; // Keep latest version of disabled plugins |
|
28 | + if(in_array($id,$latestIds)) { |
|
29 | + continue; |
|
30 | + } |
|
31 | + // Keep latest version of disabled plugins |
|
29 | 32 | |
30 | 33 | // invoke OnBeforePluginFormDelete event |
31 | 34 | $modx->invokeEvent('OnBeforePluginFormDelete', array('id'=> $id)); |