@@ -1,5 +1,7 @@ |
||
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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $internalKey = $modx->getLoginUserID(); |
5 | 7 | $username = $_SESSION['mgrShortname']; |
@@ -1,5 +1,7 @@ |
||
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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_document')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -177,7 +177,9 @@ discard block |
||
177 | 177 | // save selected system events |
178 | 178 | $formEventList = array(); |
179 | 179 | foreach ($sysevents as $evtId) { |
180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
180 | + if(!preg_match('@^[1-9][0-9]*$@',$evtId)) { |
|
181 | + $evtId = getEventIdByName($evtId); |
|
182 | + } |
|
181 | 183 | if ($mode == '101') { |
182 | 184 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
183 | 185 | } else { |
@@ -203,10 +205,14 @@ discard block |
||
203 | 205 | $dbEventList = array(); |
204 | 206 | $del = array(); |
205 | 207 | while($row = $modx->db->getRow($rs)) { |
206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
208 | + if(!in_array($row['evtid'], $evtids)) { |
|
209 | + $del[] = $row['evtid']; |
|
210 | + } |
|
207 | 211 | } |
208 | 212 | |
209 | - if(!$del) return; |
|
213 | + if(!$del) { |
|
214 | + return; |
|
215 | + } |
|
210 | 216 | |
211 | 217 | foreach($del as $delid) { |
212 | 218 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
@@ -218,7 +224,9 @@ discard block |
||
218 | 224 | global $modx; |
219 | 225 | static $eventIds=array(); |
220 | 226 | |
221 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
227 | + if(isset($eventIds[$name])) { |
|
228 | + return $eventIds[$name]; |
|
229 | + } |
|
222 | 230 | |
223 | 231 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
224 | 232 | while ($row = $modx->db->getRow($rs)) { |
@@ -1,5 +1,7 @@ |
||
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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_web_user')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,5 +1,7 @@ |
||
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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_plugin')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,5 +1,7 @@ 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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -34,7 +36,8 @@ discard block |
||
34 | 36 | $header="Location: index.php?r=1&a=3&id=$id"; |
35 | 37 | header($header); |
36 | 38 | |
37 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
39 | +function duplicateDocument($docid, $parent=null, $_toplevel=0) |
|
40 | +{ |
|
38 | 41 | global $modx, $_lang; |
39 | 42 | |
40 | 43 | // invoke OnBeforeDocDuplicate event |
@@ -55,8 +58,7 @@ discard block |
||
55 | 58 | $content = $modx->db->getRow($rs); |
56 | 59 | |
57 | 60 | // Handle incremental ID |
58 | - switch($modx->config['docid_incrmnt_method']) |
|
59 | - { |
|
61 | + switch($modx->config['docid_incrmnt_method']) { |
|
60 | 62 | case '1': |
61 | 63 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
62 | 64 | $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
@@ -77,8 +79,11 @@ discard block |
||
77 | 79 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
78 | 80 | $pagetitle = $modx->db->escape($pagetitle); |
79 | 81 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
80 | - if($count>=1) $count = ' '.($count+1); |
|
81 | - else $count = ''; |
|
82 | + if($count>=1) { |
|
83 | + $count = ' '.($count+1); |
|
84 | + } else { |
|
85 | + $count = ''; |
|
86 | + } |
|
82 | 87 | |
83 | 88 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
84 | 89 | $content['alias'] = null; |
@@ -87,7 +92,9 @@ discard block |
||
87 | 92 | } |
88 | 93 | |
89 | 94 | // change the parent accordingly |
90 | - if ($parent !== null) $content['parent'] = $parent; |
|
95 | + if ($parent !== null) { |
|
96 | + $content['parent'] = $parent; |
|
97 | + } |
|
91 | 98 | |
92 | 99 | // Change the author |
93 | 100 | $content['createdby'] = $userID; |
@@ -127,15 +134,17 @@ discard block |
||
127 | 134 | // Start duplicating all the child documents that aren't deleted. |
128 | 135 | $_toplevel++; |
129 | 136 | $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC'); |
130 | - while ($row = $modx->db->getRow($rs)) |
|
131 | - duplicateDocument($row['id'], $newparent, $_toplevel); |
|
137 | + while ($row = $modx->db->getRow($rs)) { |
|
138 | + duplicateDocument($row['id'], $newparent, $_toplevel); |
|
139 | + } |
|
132 | 140 | |
133 | 141 | // return the new doc id |
134 | 142 | return $newparent; |
135 | 143 | } |
136 | 144 | |
137 | 145 | // Duplicate Document TVs |
138 | -function duplicateTVs($oldid,$newid){ |
|
146 | +function duplicateTVs($oldid,$newid) |
|
147 | +{ |
|
139 | 148 | global $modx; |
140 | 149 | |
141 | 150 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -147,7 +156,8 @@ discard block |
||
147 | 156 | } |
148 | 157 | |
149 | 158 | // Duplicate Document Access Permissions |
150 | -function duplicateAccess($oldid,$newid){ |
|
159 | +function duplicateAccess($oldid,$newid) |
|
160 | +{ |
|
151 | 161 | global $modx; |
152 | 162 | |
153 | 163 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -1,5 +1,7 @@ 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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('edit_document')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -10,12 +12,20 @@ discard block |
||
10 | 12 | // ok, two things to check. |
11 | 13 | // first, document cannot be moved to itself |
12 | 14 | // 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"]); |
|
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 | +} |
|
16 | 24 | |
17 | 25 | $parents = $modx->getParentIds($newParentID); |
18 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
26 | +if (in_array($documentID, $parents)) { |
|
27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
28 | +} |
|
19 | 29 | |
20 | 30 | $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
21 | 31 | $oldparent = $modx->db->getValue($rs); |
@@ -36,7 +46,8 @@ discard block |
||
36 | 46 | } |
37 | 47 | } |
38 | 48 | |
39 | -function allChildren($currDocID) { |
|
49 | +function allChildren($currDocID) |
|
50 | +{ |
|
40 | 51 | global $modx; |
41 | 52 | $children= array(); |
42 | 53 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
@@ -54,11 +65,11 @@ discard block |
||
54 | 65 | "old_parent" => $oldparent, |
55 | 66 | "new_parent" => $newParentID |
56 | 67 | )); |
57 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
68 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
58 | 69 | $newParent = array_pop($evtOut); |
59 | 70 | if($newParent == $oldparent) { |
60 | 71 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
61 | - }else{ |
|
72 | + } else { |
|
62 | 73 | $newParentID = $newParent; |
63 | 74 | } |
64 | 75 | } |
@@ -1,5 +1,7 @@ |
||
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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,5 +1,7 @@ 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."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('new_template')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -12,8 +14,11 @@ discard block |
||
12 | 14 | // count duplicates |
13 | 15 | $name = $modx->db->getValue($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "id='{$id}'")); |
14 | 16 | $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); |
|
16 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
17 | 22 | |
18 | 23 | // duplicate template |
19 | 24 | $newid = $modx->db->insert( |