Completed
Push — develop ( 923a1c...1e9876 )
by Maxim
47s queued 29s
created
manager/processors/delete_plugin.processor.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3 3
 if(!$modx->hasPermission('delete_plugin')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $id = isset($_GET['id'])? intval($_GET['id']) : 0;
8 8
 if($id==0) {
9
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
9
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 // Set the item name for logger
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 
16 16
 // invoke OnBeforePluginFormDelete event
17 17
 $modx->invokeEvent("OnBeforePluginFormDelete",
18
-	array(
19
-		"id"	=> $id
20
-	));
18
+    array(
19
+        "id"	=> $id
20
+    ));
21 21
 
22 22
 // delete the plugin.
23 23
 $modx->db->delete($modx->getFullTableName('site_plugins'), "id='{$id}'");
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
 // invoke OnPluginFormDelete event
29 29
 $modx->invokeEvent("OnPluginFormDelete",
30
-	array(
31
-		"id"	=> $id
32
-	));
30
+    array(
31
+        "id"	=> $id
32
+    ));
33 33
 
34 34
 // empty cache
35 35
 $modx->clearCache('full');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
-if(!$modx->hasPermission('delete_plugin')) {
2
+if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+if (!$modx->hasPermission('delete_plugin')) {
4 4
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
8
-if($id==0) {
7
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
8
+if ($id == 0) {
9 9
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
@@ -35,5 +35,5 @@  discard block
 block discarded – undo
35 35
 $modx->clearCache('full');
36 36
 
37 37
 // finished emptying cache - redirect
38
-$header="Location: index.php?a=76&r=2";
38
+$header = "Location: index.php?a=76&r=2";
39 39
 header($header);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
manager/processors/save_template.processor.php 2 patches
Switch Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -33,115 +33,115 @@
 block discarded – undo
33 33
 }
34 34
 
35 35
 switch ($_POST['mode']) {
36
-    case '19':
37
-
38
-        // invoke OnBeforeTempFormSave event
39
-        $modx->invokeEvent("OnBeforeTempFormSave", array(
40
-            "mode" => "new",
41
-            "id" => $id
42
-        ));
43
-
44
-        // disallow duplicate names for new templates
45
-        $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'");
46
-        $count = $modx->db->getValue($rs);
47
-        if ($count > 0) {
48
-            $modx->manager->saveFormValues(19);
49
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19");
50
-        }
51
-
52
-        //do stuff to save the new doc
53
-        $newid = $modx->db->insert(array(
54
-            'templatename' => $templatename,
55
-            'description' => $description,
56
-            'content' => $template,
57
-            'locked' => $locked,
58
-            'selectable' => $selectable,
59
-            'category' => $categoryid,
60
-            'createdon' => $currentdate,
61
-            'editedon' => $currentdate
62
-        ), $modx->getFullTableName('site_templates'));
63
-
64
-        // invoke OnTempFormSave event
65
-        $modx->invokeEvent("OnTempFormSave", array(
66
-            "mode" => "new",
67
-            "id" => $newid
68
-        ));
69
-        // Set new assigned Tvs
70
-        saveTemplateAccess($newid);
71
-
72
-        // Set the item name for logger
73
-        $_SESSION['itemname'] = $templatename;
74
-
75
-        // empty cache
76
-        $modx->clearCache('full');
77
-
78
-        // finished emptying cache - redirect
79
-        if ($_POST['stay'] != '') {
80
-            $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19";
81
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
82
-            header($header);
83
-        } else {
84
-            $header = "Location: index.php?a=76&r=2";
85
-            header($header);
86
-        }
87
-
88
-        break;
89
-    case '16':
90
-
91
-        // invoke OnBeforeTempFormSave event
92
-        $modx->invokeEvent("OnBeforeTempFormSave", array(
93
-            "mode" => "upd",
94
-            "id" => $id
95
-        ));
96
-
97
-        // disallow duplicate names for templates
98
-        $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'");
99
-        $count = $modx->db->getValue($rs);
100
-        if ($count > 0) {
101
-            $modx->manager->saveFormValues(16);
102
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}");
103
-        }
104
-
105
-        //do stuff to save the edited doc
106
-        $modx->db->update(array(
107
-            'templatename' => $templatename,
108
-            'description' => $description,
109
-            'content' => $template,
110
-            'locked' => $locked,
111
-            'selectable' => $selectable,
112
-            'category' => $categoryid,
113
-            'editedon' => $currentdate
114
-        ), $modx->getFullTableName('site_templates'), "id='{$id}'");
115
-        // Set new assigned Tvs
116
-        saveTemplateAccess($id);
117
-
118
-        // invoke OnTempFormSave event
119
-        $modx->invokeEvent("OnTempFormSave", array(
120
-            "mode" => "upd",
121
-            "id" => $id
122
-        ));
123
-
124
-        // Set the item name for logger
125
-        $_SESSION['itemname'] = $templatename;
126
-
127
-        // first empty the cache
128
-        $modx->clearCache('full');
129
-
130
-        // finished emptying cache - redirect
131
-        if ($_POST['stay'] != '') {
132
-            $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19";
133
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
134
-            header($header);
135
-        } else {
136
-            $modx->unlockElement(1, $id);
137
-            $header = "Location: index.php?a=76&r=2";
138
-            header($header);
139
-        }
140
-
141
-
142
-        break;
143
-    default:
144
-        $modx->webAlertAndQuit("No operation set in request.");
36
+        case '19':
37
+
38
+            // invoke OnBeforeTempFormSave event
39
+            $modx->invokeEvent("OnBeforeTempFormSave", array(
40
+                "mode" => "new",
41
+                "id" => $id
42
+            ));
43
+
44
+            // disallow duplicate names for new templates
45
+            $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'");
46
+            $count = $modx->db->getValue($rs);
47
+            if ($count > 0) {
48
+                $modx->manager->saveFormValues(19);
49
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19");
50
+            }
51
+
52
+            //do stuff to save the new doc
53
+            $newid = $modx->db->insert(array(
54
+                'templatename' => $templatename,
55
+                'description' => $description,
56
+                'content' => $template,
57
+                'locked' => $locked,
58
+                'selectable' => $selectable,
59
+                'category' => $categoryid,
60
+                'createdon' => $currentdate,
61
+                'editedon' => $currentdate
62
+            ), $modx->getFullTableName('site_templates'));
63
+
64
+            // invoke OnTempFormSave event
65
+            $modx->invokeEvent("OnTempFormSave", array(
66
+                "mode" => "new",
67
+                "id" => $newid
68
+            ));
69
+            // Set new assigned Tvs
70
+            saveTemplateAccess($newid);
71
+
72
+            // Set the item name for logger
73
+            $_SESSION['itemname'] = $templatename;
74
+
75
+            // empty cache
76
+            $modx->clearCache('full');
77
+
78
+            // finished emptying cache - redirect
79
+            if ($_POST['stay'] != '') {
80
+                $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19";
81
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
82
+                header($header);
83
+            } else {
84
+                $header = "Location: index.php?a=76&r=2";
85
+                header($header);
86
+            }
87
+
88
+            break;
89
+        case '16':
90
+
91
+            // invoke OnBeforeTempFormSave event
92
+            $modx->invokeEvent("OnBeforeTempFormSave", array(
93
+                "mode" => "upd",
94
+                "id" => $id
95
+            ));
96
+
97
+            // disallow duplicate names for templates
98
+            $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'");
99
+            $count = $modx->db->getValue($rs);
100
+            if ($count > 0) {
101
+                $modx->manager->saveFormValues(16);
102
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}");
103
+            }
104
+
105
+            //do stuff to save the edited doc
106
+            $modx->db->update(array(
107
+                'templatename' => $templatename,
108
+                'description' => $description,
109
+                'content' => $template,
110
+                'locked' => $locked,
111
+                'selectable' => $selectable,
112
+                'category' => $categoryid,
113
+                'editedon' => $currentdate
114
+            ), $modx->getFullTableName('site_templates'), "id='{$id}'");
115
+            // Set new assigned Tvs
116
+            saveTemplateAccess($id);
117
+
118
+            // invoke OnTempFormSave event
119
+            $modx->invokeEvent("OnTempFormSave", array(
120
+                "mode" => "upd",
121
+                "id" => $id
122
+            ));
123
+
124
+            // Set the item name for logger
125
+            $_SESSION['itemname'] = $templatename;
126
+
127
+            // first empty the cache
128
+            $modx->clearCache('full');
129
+
130
+            // finished emptying cache - redirect
131
+            if ($_POST['stay'] != '') {
132
+                $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19";
133
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
134
+                header($header);
135
+            } else {
136
+                $modx->unlockElement(1, $id);
137
+                $header = "Location: index.php?a=76&r=2";
138
+                header($header);
139
+            }
140
+
141
+
142
+            break;
143
+        default:
144
+            $modx->webAlertAndQuit("No operation set in request.");
145 145
 }
146 146
 
147 147
 function saveTemplateAccess($id)
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 $templatename = $modx->db->escape(trim($_POST['templatename']));
12 12
 $description = $modx->db->escape($_POST['description']);
13 13
 $locked = $_POST['locked'] == 'on' ? 1 : 0;
14
-$selectable = $id == $modx->config['default_template'] ? 1 :    // Force selectable
14
+$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable
15 15
     $_POST['selectable'] == 'on' ? 1 : 0;
16 16
 $currentdate = time() + $modx->config['server_offset_time'];
17 17
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
22 22
     $categoryid = 0;
23 23
 } else {
24
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
24
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
25 25
     $categoryid = checkCategory($_POST['newcategory']);
26 26
     if (!$categoryid) {
27 27
         $categoryid = newCategory($_POST['newcategory']);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         // finished emptying cache - redirect
79 79
         if ($_POST['stay'] != '') {
80 80
             $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19";
81
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
81
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
82 82
             header($header);
83 83
         } else {
84 84
             $header = "Location: index.php?a=76&r=2";
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         // finished emptying cache - redirect
131 131
         if ($_POST['stay'] != '') {
132 132
             $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19";
133
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
133
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
134 134
             header($header);
135 135
         } else {
136 136
             $modx->unlockElement(1, $id);
Please login to merge, or discard this patch.
manager/processors/duplicate_content.processor.php 3 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3 3
 if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $id = isset($_GET['id'])? intval($_GET['id']) : 0;
8 8
 if($id==0) {
9
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
9
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 $children = array();
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $udperms->duplicateDoc = true;
21 21
 
22 22
 if(!$udperms->checkPermissions()) {
23
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
23
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
24 24
 }
25 25
 
26 26
 // Run the duplicator
@@ -35,125 +35,125 @@  discard block
 block discarded – undo
35 35
 header($header);
36 36
 
37 37
 function duplicateDocument($docid, $parent=null, $_toplevel=0) {
38
-	global $modx, $_lang;
39
-
40
-	// invoke OnBeforeDocDuplicate event
41
-	$evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array(
42
-		'id' => $docid
43
-	));
44
-
45
-	// if( !in_array( 'false', array_values( $evtOut ) ) ){}
46
-	// TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication 
47
-	// [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false');
48
-
49
-	$userID = $modx->getLoginUserID();
50
-
51
-	$tblsc = $modx->getFullTableName('site_content');
52
-
53
-	// Grab the original document
54
-	$rs = $modx->db->select('*', $tblsc, "id='{$docid}'");
55
-	$content = $modx->db->getRow($rs);
56
-
57
-	// Handle incremental ID
58
-	switch($modx->config['docid_incrmnt_method'])
59
-	{
60
-		case '1':
61
-			$from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
62
-			$rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
63
-			$content['id'] = $modx->db->getValue($rs);
64
-			break;
65
-		case '2':
66
-			$rs = $modx->db->select('MAX(id)+1',$tblsc);
67
-			$content['id'] = $modx->db->getValue($rs);
68
-			break;
69
-
70
-		default:
71
-			unset($content['id']); // remove the current id.
72
-	}
73
-
74
-	// Once we've grabbed the document object, start doing some modifications
75
-	if ($_toplevel == 0) {
76
-		// count duplicates
77
-		$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'"));
78
-		$pagetitle = $modx->db->escape($pagetitle);
79
-		$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 = '';
38
+    global $modx, $_lang;
39
+
40
+    // invoke OnBeforeDocDuplicate event
41
+    $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array(
42
+        'id' => $docid
43
+    ));
44
+
45
+    // if( !in_array( 'false', array_values( $evtOut ) ) ){}
46
+    // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication 
47
+    // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false');
48
+
49
+    $userID = $modx->getLoginUserID();
50
+
51
+    $tblsc = $modx->getFullTableName('site_content');
52
+
53
+    // Grab the original document
54
+    $rs = $modx->db->select('*', $tblsc, "id='{$docid}'");
55
+    $content = $modx->db->getRow($rs);
56
+
57
+    // Handle incremental ID
58
+    switch($modx->config['docid_incrmnt_method'])
59
+    {
60
+        case '1':
61
+            $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
62
+            $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
63
+            $content['id'] = $modx->db->getValue($rs);
64
+            break;
65
+        case '2':
66
+            $rs = $modx->db->select('MAX(id)+1',$tblsc);
67
+            $content['id'] = $modx->db->getValue($rs);
68
+            break;
69
+
70
+        default:
71
+            unset($content['id']); // remove the current id.
72
+    }
73
+
74
+    // Once we've grabbed the document object, start doing some modifications
75
+    if ($_toplevel == 0) {
76
+        // count duplicates
77
+        $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'"));
78
+        $pagetitle = $modx->db->escape($pagetitle);
79
+        $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 82
 		
83
-		$content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
84
-		$content['alias'] = null;
85
-	} elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
86
-		$content['alias'] = null;
87
-	}
88
-
89
-	// change the parent accordingly
90
-	if ($parent !== null) $content['parent'] = $parent;
91
-
92
-	// Change the author
93
-	$content['createdby'] = $userID;
94
-	$content['createdon'] = time();
95
-	// Remove other modification times
96
-	$content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0;
97
-
98
-	// [FS#922] Should the published status be honored? - sirlancelot
83
+        $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
84
+        $content['alias'] = null;
85
+    } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
86
+        $content['alias'] = null;
87
+    }
88
+
89
+    // change the parent accordingly
90
+    if ($parent !== null) $content['parent'] = $parent;
91
+
92
+    // Change the author
93
+    $content['createdby'] = $userID;
94
+    $content['createdon'] = time();
95
+    // Remove other modification times
96
+    $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0;
97
+
98
+    // [FS#922] Should the published status be honored? - sirlancelot
99 99
 //	if ($modx->hasPermission('publish_document')) {
100 100
 //		if ($modx->config['publish_default'])
101 101
 //			$content['pub_date'] = $content['pub_date']; // should this be changed to 1?
102 102
 //		else	$content['pub_date'] = 0;
103 103
 //	} else {
104
-		// User can't publish documents
104
+        // User can't publish documents
105 105
 //		$content['published'] = $content['pub_date'] = 0;
106 106
 //	}
107 107
 
108 108
     // Set the published status to unpublished by default (see above ... commit #3388)
109 109
     $content['published'] = $content['pub_date'] = 0;
110 110
 
111
-	// Escape the proper strings
112
-	$content = $modx->db->escape($content);
111
+    // Escape the proper strings
112
+    $content = $modx->db->escape($content);
113 113
 
114
-	// Duplicate the Document
115
-	$newparent = $modx->db->insert($content, $tblsc);
114
+    // Duplicate the Document
115
+    $newparent = $modx->db->insert($content, $tblsc);
116 116
 
117
-	// duplicate document's TVs
118
-	duplicateTVs($docid, $newparent);
119
-	duplicateAccess($docid, $newparent);
117
+    // duplicate document's TVs
118
+    duplicateTVs($docid, $newparent);
119
+    duplicateAccess($docid, $newparent);
120 120
 	
121
-	// invoke OnDocDuplicate event
122
-	$evtOut = $modx->invokeEvent('OnDocDuplicate', array(
123
-		'id' => $docid,
124
-		'new_id' => $newparent
125
-	));
126
-
127
-	// Start duplicating all the child documents that aren't deleted.
128
-	$_toplevel++;
129
-	$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);
132
-
133
-	// return the new doc id
134
-	return $newparent;
121
+    // invoke OnDocDuplicate event
122
+    $evtOut = $modx->invokeEvent('OnDocDuplicate', array(
123
+        'id' => $docid,
124
+        'new_id' => $newparent
125
+    ));
126
+
127
+    // Start duplicating all the child documents that aren't deleted.
128
+    $_toplevel++;
129
+    $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);
132
+
133
+    // return the new doc id
134
+    return $newparent;
135 135
 }
136 136
 
137 137
 // Duplicate Document TVs
138 138
 function duplicateTVs($oldid,$newid){
139
-	global $modx;
139
+    global $modx;
140 140
 
141
-	$tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
141
+    $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
142 142
 
143
-	$modx->db->insert(
144
-		array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into
145
-		"{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from
146
-	);
143
+    $modx->db->insert(
144
+        array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into
145
+        "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from
146
+    );
147 147
 }
148 148
 
149 149
 // Duplicate Document Access Permissions
150 150
 function duplicateAccess($oldid,$newid){
151
-	global $modx;
151
+    global $modx;
152 152
 
153
-	$tbldg = $modx->getFullTableName('document_groups');
153
+    $tbldg = $modx->getFullTableName('document_groups');
154 154
 
155
-	$modx->db->insert(
156
-		array('document'=>'', 'document_group'=>''), $tbldg, // Insert into
157
-		"{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from
158
-	);
155
+    $modx->db->insert(
156
+        array('document'=>'', 'document_group'=>''), $tbldg, // Insert into
157
+        "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from
158
+    );
159 159
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
-if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) {
2
+if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+if (!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) {
4 4
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
8
-if($id==0) {
7
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
8
+if ($id == 0) {
9 9
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 $children = array();
13 13
 
14 14
 // check permissions on the document
15
-include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
15
+include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
16 16
 $udperms = new udperms();
17 17
 $udperms->user = $modx->getLoginUserID();
18 18
 $udperms->document = $id;
19 19
 $udperms->role = $_SESSION['mgrRole'];
20 20
 $udperms->duplicateDoc = true;
21 21
 
22
-if(!$udperms->checkPermissions()) {
22
+if (!$udperms->checkPermissions()) {
23 23
 	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
24 24
 }
25 25
 
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 $_SESSION['itemname'] = $name;
32 32
 
33 33
 // finish cloning - redirect
34
-$header="Location: index.php?r=1&a=3&id=$id";
34
+$header = "Location: index.php?r=1&a=3&id=$id";
35 35
 header($header);
36 36
 
37
-function duplicateDocument($docid, $parent=null, $_toplevel=0) {
37
+function duplicateDocument($docid, $parent = null, $_toplevel = 0){
38 38
 	global $modx, $_lang;
39 39
 
40 40
 	// invoke OnBeforeDocDuplicate event
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	$content = $modx->db->getRow($rs);
56 56
 
57 57
 	// Handle incremental ID
58
-	switch($modx->config['docid_incrmnt_method'])
58
+	switch ($modx->config['docid_incrmnt_method'])
59 59
 	{
60 60
 		case '1':
61 61
 			$from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			$content['id'] = $modx->db->getValue($rs);
64 64
 			break;
65 65
 		case '2':
66
-			$rs = $modx->db->select('MAX(id)+1',$tblsc);
66
+			$rs = $modx->db->select('MAX(id)+1', $tblsc);
67 67
 			$content['id'] = $modx->db->getValue($rs);
68 68
 			break;
69 69
 
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
 		$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'"));
78 78
 		$pagetitle = $modx->db->escape($pagetitle);
79 79
 		$count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'"));
80
-		if($count>=1) $count = ' '.($count+1);
80
+		if ($count >= 1) $count = ' '.($count + 1);
81 81
 		else $count = '';
82 82
 		
83 83
 		$content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
84 84
 		$content['alias'] = null;
85
-	} elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
85
+	} elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
86 86
 		$content['alias'] = null;
87 87
 	}
88 88
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 }
136 136
 
137 137
 // Duplicate Document TVs
138
-function duplicateTVs($oldid,$newid){
138
+function duplicateTVs($oldid, $newid){
139 139
 	global $modx;
140 140
 
141 141
 	$tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 }
148 148
 
149 149
 // Duplicate Document Access Permissions
150
-function duplicateAccess($oldid,$newid){
150
+function duplicateAccess($oldid, $newid){
151 151
 	global $modx;
152 152
 
153 153
 	$tbldg = $modx->getFullTableName('document_groups');
Please login to merge, or discard this patch.
Braces   +21 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
manager/processors/move_document.processor.php 3 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3 3
 if(!$modx->hasPermission('edit_document')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0;
@@ -23,82 +23,82 @@  discard block
 block discarded – undo
23 23
 // check user has permission to move document to chosen location
24 24
 
25 25
 if ($use_udperms == 1) {
26
-	if ($oldparent != $newParentID) {
27
-		include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
28
-		$udperms = new udperms();
29
-		$udperms->user = $modx->getLoginUserID();
30
-		$udperms->document = $newParentID;
31
-		$udperms->role = $_SESSION['mgrRole'];
32
-
33
-		 if (!$udperms->checkPermissions()) {
34
-			$modx->webAlertAndQuit($_lang["access_permission_parent_denied"]);
35
-		 }
36
-	}
26
+    if ($oldparent != $newParentID) {
27
+        include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
28
+        $udperms = new udperms();
29
+        $udperms->user = $modx->getLoginUserID();
30
+        $udperms->document = $newParentID;
31
+        $udperms->role = $_SESSION['mgrRole'];
32
+
33
+            if (!$udperms->checkPermissions()) {
34
+            $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]);
35
+            }
36
+    }
37 37
 }
38 38
 
39 39
 function allChildren($currDocID) {
40
-	global $modx;
41
-	$children= array();
42
-	$rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'");
43
-	while ($child= $modx->db->getRow($rs)) {
44
-		$children[]= $child['id'];
45
-		$nextgen= array();
46
-		$nextgen= allChildren($child['id']);
47
-		$children= array_merge($children, $nextgen);
48
-	}
49
-	return $children;
40
+    global $modx;
41
+    $children= array();
42
+    $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'");
43
+    while ($child= $modx->db->getRow($rs)) {
44
+        $children[]= $child['id'];
45
+        $nextgen= array();
46
+        $nextgen= allChildren($child['id']);
47
+        $children= array_merge($children, $nextgen);
48
+    }
49
+    return $children;
50 50
 }
51 51
 
52 52
 $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array (
53
-	"id_document" => $documentID,
54
-	"old_parent" => $oldparent,
55
-	"new_parent" => $newParentID
53
+    "id_document" => $documentID,
54
+    "old_parent" => $oldparent,
55
+    "new_parent" => $newParentID
56 56
 ));
57 57
 if (is_array($evtOut) && count($evtOut) > 0){
58
-	$newParent = array_pop($evtOut);
59
-	if($newParent == $oldparent) {
60
-		$modx->webAlertAndQuit($_lang["error_movedocument2"]);
61
-	}else{
62
-		$newParentID = $newParent;
63
-	}
58
+    $newParent = array_pop($evtOut);
59
+    if($newParent == $oldparent) {
60
+        $modx->webAlertAndQuit($_lang["error_movedocument2"]);
61
+    }else{
62
+        $newParentID = $newParent;
63
+    }
64 64
 }
65 65
 
66 66
 $children = allChildren($documentID);
67 67
 if (!array_search($newParentID, $children)) {
68
-	$modx->db->update(array(
69
-		'isfolder' => 1,
70
-	), $modx->getFullTableName('site_content'), "id='{$newParentID}'");
71
-
72
-	$modx->db->update(array(
73
-		'parent'   => $newParentID,
74
-		'editedby' => $modx->getLoginUserID(),
75
-		'editedon' => time(),
76
-	), $modx->getFullTableName('site_content'), "id='{$documentID}'");
77
-
78
-	// finished moving the document, now check to see if the old_parent should no longer be a folder.
79
-	$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
80
-	$limit = $modx->db->getValue($rs);
81
-
82
-	if(!$limit>0) {
83
-		$modx->db->update(array(
84
-			'isfolder' => 0,
85
-		), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
86
-	}
87
-	// Set the item name for logger
88
-	$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'"));
89
-	$_SESSION['itemname'] = $pagetitle;
90
-
91
-	$modx->invokeEvent("onAfterMoveDocument", array (
92
-		"id_document" => $documentID,
93
-		"old_parent" => $oldparent,
94
-		"new_parent" => $newParentID
95
-	));
96
-
97
-	// empty cache & sync site
98
-	$modx->clearCache('full');
99
-
100
-	$header="Location: index.php?a=3&id={$documentID}&r=9";
101
-	header($header);
68
+    $modx->db->update(array(
69
+        'isfolder' => 1,
70
+    ), $modx->getFullTableName('site_content'), "id='{$newParentID}'");
71
+
72
+    $modx->db->update(array(
73
+        'parent'   => $newParentID,
74
+        'editedby' => $modx->getLoginUserID(),
75
+        'editedon' => time(),
76
+    ), $modx->getFullTableName('site_content'), "id='{$documentID}'");
77
+
78
+    // finished moving the document, now check to see if the old_parent should no longer be a folder.
79
+    $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
80
+    $limit = $modx->db->getValue($rs);
81
+
82
+    if(!$limit>0) {
83
+        $modx->db->update(array(
84
+            'isfolder' => 0,
85
+        ), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
86
+    }
87
+    // Set the item name for logger
88
+    $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'"));
89
+    $_SESSION['itemname'] = $pagetitle;
90
+
91
+    $modx->invokeEvent("onAfterMoveDocument", array (
92
+        "id_document" => $documentID,
93
+        "old_parent" => $oldparent,
94
+        "new_parent" => $newParentID
95
+    ));
96
+
97
+    // empty cache & sync site
98
+    $modx->clearCache('full');
99
+
100
+    $header="Location: index.php?a=3&id={$documentID}&r=9";
101
+    header($header);
102 102
 } else {
103
-	$modx->webAlertAndQuit("You cannot move a document to a child document!");
103
+    $modx->webAlertAndQuit("You cannot move a document to a child document!");
104 104
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
-if(!$modx->hasPermission('edit_document')) {
2
+if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+if (!$modx->hasPermission('edit_document')) {
4 4
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7
-$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0;
8
-$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
7
+$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0;
8
+$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
9 9
 
10 10
 // ok, two things to check.
11 11
 // first, document cannot be moved to itself
12 12
 // second, new parent must be a folder. If not, set it to folder.
13
-if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]);
14
-if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
15
-if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
13
+if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]);
14
+if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
15
+if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
16 16
 
17 17
 $parents = $modx->getParentIds($newParentID);
18 18
 if (in_array($documentID, $parents))  $modx->webAlertAndQuit($_lang["error_movedocument2"]);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 if ($use_udperms == 1) {
26 26
 	if ($oldparent != $newParentID) {
27
-		include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
27
+		include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
28 28
 		$udperms = new udperms();
29 29
 		$udperms->user = $modx->getLoginUserID();
30 30
 		$udperms->document = $newParentID;
@@ -36,29 +36,29 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 }
38 38
 
39
-function allChildren($currDocID) {
39
+function allChildren($currDocID){
40 40
 	global $modx;
41
-	$children= array();
41
+	$children = array();
42 42
 	$rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'");
43
-	while ($child= $modx->db->getRow($rs)) {
44
-		$children[]= $child['id'];
45
-		$nextgen= array();
46
-		$nextgen= allChildren($child['id']);
47
-		$children= array_merge($children, $nextgen);
43
+	while ($child = $modx->db->getRow($rs)) {
44
+		$children[] = $child['id'];
45
+		$nextgen = array();
46
+		$nextgen = allChildren($child['id']);
47
+		$children = array_merge($children, $nextgen);
48 48
 	}
49 49
 	return $children;
50 50
 }
51 51
 
52
-$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array (
52
+$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array(
53 53
 	"id_document" => $documentID,
54 54
 	"old_parent" => $oldparent,
55 55
 	"new_parent" => $newParentID
56 56
 ));
57
-if (is_array($evtOut) && count($evtOut) > 0){
57
+if (is_array($evtOut) && count($evtOut) > 0) {
58 58
 	$newParent = array_pop($evtOut);
59
-	if($newParent == $oldparent) {
59
+	if ($newParent == $oldparent) {
60 60
 		$modx->webAlertAndQuit($_lang["error_movedocument2"]);
61
-	}else{
61
+	} else {
62 62
 		$newParentID = $newParent;
63 63
 	}
64 64
 }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	$rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
80 80
 	$limit = $modx->db->getValue($rs);
81 81
 
82
-	if(!$limit>0) {
82
+	if (!$limit > 0) {
83 83
 		$modx->db->update(array(
84 84
 			'isfolder' => 0,
85 85
 		), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'"));
89 89
 	$_SESSION['itemname'] = $pagetitle;
90 90
 
91
-	$modx->invokeEvent("onAfterMoveDocument", array (
91
+	$modx->invokeEvent("onAfterMoveDocument", array(
92 92
 		"id_document" => $documentID,
93 93
 		"old_parent" => $oldparent,
94 94
 		"new_parent" => $newParentID
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	// empty cache & sync site
98 98
 	$modx->clearCache('full');
99 99
 
100
-	$header="Location: index.php?a=3&id={$documentID}&r=9";
100
+	$header = "Location: index.php?a=3&id={$documentID}&r=9";
101 101
 	header($header);
102 102
 } else {
103 103
 	$modx->webAlertAndQuit("You cannot move a document to a child document!");
Please login to merge, or discard this patch.
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
manager/processors/unpublish_content.processor.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3 3
 if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0;
8 8
 if($id==0) {
9
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
9
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 /************webber ********/
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
 $udperms->role = $_SESSION['mgrRole'];
32 32
 
33 33
 if(!$udperms->checkPermissions()) {
34
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
35 35
 }
36 36
 
37 37
 // update the document
38 38
 $modx->db->update(
39
-	array(
40
-		'published'   => 0,
41
-		'pub_date'    => 0,
42
-		'unpub_date'  => 0,
43
-		'editedby'    => $modx->getLoginUserID(),
44
-		'editedon'    => time(),
45
-		'publishedby' => 0,
46
-		'publishedon' => 0,
47
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
39
+    array(
40
+        'published'   => 0,
41
+        'pub_date'    => 0,
42
+        'unpub_date'  => 0,
43
+        'editedby'    => $modx->getLoginUserID(),
44
+        'editedon'    => time(),
45
+        'publishedby' => 0,
46
+        'publishedon' => 0,
47
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
48 48
 
49 49
 // invoke OnDocUnPublished  event
50 50
 $modx->invokeEvent("OnDocUnPublished",array("docid"=>$id));
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
-if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) {
2
+if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) {
4 4
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7
-$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0;
8
-if($id==0) {
7
+$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
8
+if ($id == 0) {
9 9
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 /************webber ********/
13
-$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
14
-$pid=($content['parent']==0?$id:$content['parent']);
13
+$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
14
+$pid = ($content['parent'] == 0 ? $id : $content['parent']);
15 15
 
16 16
 /************** webber *************/
17
-$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC';
18
-$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon';
19
-$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:'';
20
-$add_path=$sd.$sb.$pg;
17
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
18
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
19
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
20
+$add_path = $sd.$sb.$pg;
21 21
 
22 22
 /***********************************/
23 23
 
24 24
 
25 25
 
26 26
 // check permissions on the document
27
-include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
27
+include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
28 28
 $udperms = new udperms();
29 29
 $udperms->user = $modx->getLoginUserID();
30 30
 $udperms->document = $id;
31 31
 $udperms->role = $_SESSION['mgrRole'];
32 32
 
33
-if(!$udperms->checkPermissions()) {
33
+if (!$udperms->checkPermissions()) {
34 34
 	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
35 35
 }
36 36
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	), $modx->getFullTableName('site_content'), "id='{$id}'");
48 48
 
49 49
 // invoke OnDocUnPublished  event
50
-$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id));
50
+$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id));
51 51
 
52 52
 // Set the item name for logger
53 53
 $_SESSION['itemname'] = $content['pagetitle'];
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
 // empty cache
56 56
 $modx->clearCache('full');
57 57
 
58
-$header="Location: index.php?a=3&id=$pid&r=1".$add_path;
58
+$header = "Location: index.php?a=3&id=$pid&r=1".$add_path;
59 59
 
60 60
 header($header);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
manager/processors/duplicate_template.processor.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3 3
 if(!$modx->hasPermission('new_template')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $id = isset($_GET['id'])? intval($_GET['id']) : 0;
8 8
 if($id==0) {
9
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
9
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 // count duplicates
@@ -17,22 +17,22 @@  discard block
 block discarded – undo
17 17
 
18 18
 // duplicate template
19 19
 $newid = $modx->db->insert(
20
-	array(
21
-		'templatename'=>'',
22
-		'description'=>'',
23
-		'content'=>'',
24
-		'category'=>'',
25
-		), $modx->getFullTableName('site_templates'), // Insert into
26
-	"CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
20
+    array(
21
+        'templatename'=>'',
22
+        'description'=>'',
23
+        'content'=>'',
24
+        'category'=>'',
25
+        ), $modx->getFullTableName('site_templates'), // Insert into
26
+    "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
27 27
 
28 28
 // duplicate TV values
29 29
 $modx->db->insert(
30
-	array(
31
-		'tmplvarid'=>'',
32
-		'templateid'=>'',
33
-		'rank'=>'',
34
-		), $modx->getFullTableName('site_tmplvar_templates'), // Insert into
35
-	"tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
30
+    array(
31
+        'tmplvarid'=>'',
32
+        'templateid'=>'',
33
+        'rank'=>'',
34
+        ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into
35
+    "tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
36 36
 
37 37
 // Set the item name for logger
38 38
 $name = $modx->db->getValue($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
-if(!$modx->hasPermission('new_template')) {
2
+if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+if (!$modx->hasPermission('new_template')) {
4 4
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
8
-if($id==0) {
7
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
8
+if ($id == 0) {
9 9
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 // count duplicates
13 13
 $name = $modx->db->getValue($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "id='{$id}'"));
14 14
 $count = $modx->db->getRecordCount($modx->db->select('templatename', $modx->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
15
-if($count>=1) $count = ' '.($count+1);
15
+if ($count >= 1) $count = ' '.($count + 1);
16 16
 else $count = '';
17 17
 
18 18
 // duplicate template
@@ -39,5 +39,5 @@  discard block
 block discarded – undo
39 39
 $_SESSION['itemname'] = $name;
40 40
 
41 41
 // finish duplicating - redirect to new template
42
-$header="Location: index.php?r=2&a=16&id=$newid";
42
+$header = "Location: index.php?r=2&a=16&id=$newid";
43 43
 header($header);
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
manager/processors/duplicate_snippet.processor.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3 3
 if(!$modx->hasPermission('new_snippet')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $id = isset($_GET['id'])? intval($_GET['id']) : 0;
8 8
 if($id==0) {
9
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
9
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 // count duplicates
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 
18 18
 // duplicate Snippet
19 19
 $newid = $modx->db->insert(
20
-	array(
21
-		'name'=>'',
22
-		'description'=>'',
23
-		'snippet'=>'',
24
-		'properties'=>'',
25
-		'category'=>'',
26
-		), $modx->getFullTableName('site_snippets'), // Insert into
27
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from
20
+    array(
21
+        'name'=>'',
22
+        'description'=>'',
23
+        'snippet'=>'',
24
+        'properties'=>'',
25
+        'category'=>'',
26
+        ), $modx->getFullTableName('site_snippets'), // Insert into
27
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from
28 28
 
29 29
 // Set the item name for logger
30 30
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
-if(!$modx->hasPermission('new_snippet')) {
2
+if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+if (!$modx->hasPermission('new_snippet')) {
4 4
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
8
-if($id==0) {
7
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
8
+if ($id == 0) {
9 9
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 // count duplicates
13 13
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'"));
14 14
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
15
-if($count>=1) $count = ' '.($count+1);
15
+if ($count >= 1) $count = ' '.($count + 1);
16 16
 else $count = '';
17 17
 
18 18
 // duplicate Snippet
@@ -31,5 +31,5 @@  discard block
 block discarded – undo
31 31
 $_SESSION['itemname'] = $name;
32 32
 
33 33
 // finish duplicating - redirect to new snippet
34
-$header="Location: index.php?r=2&a=22&id=$newid";
34
+$header = "Location: index.php?r=2&a=22&id=$newid";
35 35
 header($header);
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
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_snippet')) {
4 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 7
 }
@@ -12,8 +14,11 @@  discard block
 block discarded – undo
12 14
 // count duplicates
13 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'"));
14 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
15
-if($count>=1) $count = ' '.($count+1);
16
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
17 22
 
18 23
 // duplicate Snippet
19 24
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
manager/processors/duplicate_htmlsnippet.processor.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3 3
 if(!$modx->hasPermission('new_chunk')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $id = isset($_GET['id'])? intval($_GET['id']) : 0;
8 8
 if($id==0) {
9
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
9
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 // count duplicates
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 
18 18
 // duplicate htmlsnippet
19 19
 $newid = $modx->db->insert(
20
-	array(
21
-		'name'=>'',
22
-		'description'=>'',
23
-		'snippet'=>'',
24
-		'category'=>'',
25
-		), $modx->getFullTableName('site_htmlsnippets'), // Insert into
26
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
20
+    array(
21
+        'name'=>'',
22
+        'description'=>'',
23
+        'snippet'=>'',
24
+        'category'=>'',
25
+        ), $modx->getFullTableName('site_htmlsnippets'), // Insert into
26
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
27 27
 
28 28
 // Set the item name for logger
29 29
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
-if(!$modx->hasPermission('new_chunk')) {
2
+if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+if (!$modx->hasPermission('new_chunk')) {
4 4
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
8
-if($id==0) {
7
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
8
+if ($id == 0) {
9 9
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
10 10
 }
11 11
 
12 12
 // count duplicates
13 13
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
14 14
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
15
-if($count>=1) $count = ' '.($count+1);
15
+if ($count >= 1) $count = ' '.($count + 1);
16 16
 else $count = '';
17 17
 
18 18
 // duplicate htmlsnippet
@@ -30,5 +30,5 @@  discard block
 block discarded – undo
30 30
 $_SESSION['itemname'] = $name;
31 31
 
32 32
 // finish duplicating - redirect to new chunk
33
-$header="Location: index.php?r=2&a=78&id=$newid";
33
+$header = "Location: index.php?r=2&a=78&id=$newid";
34 34
 header($header);
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
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_chunk')) {
4 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 7
 }
@@ -12,8 +14,11 @@  discard block
 block discarded – undo
12 14
 // count duplicates
13 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
14 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
15
-if($count>=1) $count = ' '.($count+1);
16
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
17 22
 
18 23
 // duplicate htmlsnippet
19 24
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
manager/processors/user_documents_permissions.class.php 4 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -2,43 +2,43 @@  discard block
 block discarded – undo
2 2
 
3 3
 class udperms{
4 4
 
5
-	var $user;
6
-	var $document;
7
-	var $role;
8
-	var $duplicateDoc = false;
5
+    var $user;
6
+    var $document;
7
+    var $role;
8
+    var $duplicateDoc = false;
9 9
 	
10
-	function checkPermissions() {
10
+    function checkPermissions() {
11 11
 		
12
-		global $udperms_allowroot;
13
-		global $modx;
12
+        global $udperms_allowroot;
13
+        global $modx;
14 14
 
15
-		$tblsc = $modx->getFullTableName('site_content');
16
-		$tbldg = $modx->getFullTableName('document_groups');
17
-		$tbldgn = $modx->getFullTableName('documentgroup_names');
15
+        $tblsc = $modx->getFullTableName('site_content');
16
+        $tbldg = $modx->getFullTableName('document_groups');
17
+        $tbldgn = $modx->getFullTableName('documentgroup_names');
18 18
 
19
-		$document = $this->document;
20
-		$role = $this->role;
19
+        $document = $this->document;
20
+        $role = $this->role;
21 21
 
22
-		if($role==1) {
23
-			return true;  // administrator - grant all document permissions
24
-		}
22
+        if($role==1) {
23
+            return true;  // administrator - grant all document permissions
24
+        }
25 25
 		
26
-		if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) {
27
-			return true; // permissions aren't in use
28
-		}
26
+        if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) {
27
+            return true; // permissions aren't in use
28
+        }
29 29
 		
30
-		$parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'"));
31
-		if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root
32
-		if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) {
33
-			return false; // deny duplicate || create new document at root if Allow Root is No
34
-		}
30
+        $parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'"));
31
+        if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root
32
+        if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) {
33
+            return false; // deny duplicate || create new document at root if Allow Root is No
34
+        }
35 35
 		
36
-		// get document groups for current user
37
-		if($_SESSION['mgrDocgroups']) {
38
-			$docgrp = implode(" || dg.document_group = ",$_SESSION['mgrDocgroups']);
39
-		}
36
+        // get document groups for current user
37
+        if($_SESSION['mgrDocgroups']) {
38
+            $docgrp = implode(" || dg.document_group = ",$_SESSION['mgrDocgroups']);
39
+        }
40 40
 
41
-		/* Note:
41
+        /* Note:
42 42
 			A document is flagged as private whenever the document group that it
43 43
 			belongs to is assigned or links to a user group. In other words if 
44 44
 			the document is assigned to a document group that is not yet linked 
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 			are private to the manager users will not be private to web users if the 
47 47
 			document group is not assigned to a web user group and visa versa.
48 48
 		 */
49
-		$permissionsok = false;  // set permissions to false
49
+        $permissionsok = false;  // set permissions to false
50 50
 		
51
-		$rs = $modx->db->select(
52
-			'count(DISTINCT sc.id)',
53
-			"{$tblsc} AS sc 
51
+        $rs = $modx->db->select(
52
+            'count(DISTINCT sc.id)',
53
+            "{$tblsc} AS sc 
54 54
 				LEFT JOIN {$tbldg} AS dg on dg.document = sc.id 
55 55
 				LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group",
56
-			"sc.id='{$this->document}' AND (". ( (!$docgrp) ? null : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)"
57
-			);
58
-		$limit = $modx->db->getValue($rs);
59
-		if($limit==1) $permissionsok = true;
56
+            "sc.id='{$this->document}' AND (". ( (!$docgrp) ? null : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)"
57
+            );
58
+        $limit = $modx->db->getValue($rs);
59
+        if($limit==1) $permissionsok = true;
60 60
 		
61
-		return $permissionsok;
62
-	}
61
+        return $permissionsok;
62
+    }
63 63
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 	var $role;
8 8
 	var $duplicateDoc = false;
9 9
 	
10
-	function checkPermissions() {
10
+	function checkPermissions(){
11 11
 		
12 12
 		global $udperms_allowroot;
13 13
 		global $modx;
@@ -19,23 +19,23 @@  discard block
 block discarded – undo
19 19
 		$document = $this->document;
20 20
 		$role = $this->role;
21 21
 
22
-		if($role==1) {
23
-			return true;  // administrator - grant all document permissions
22
+		if ($role == 1) {
23
+			return true; // administrator - grant all document permissions
24 24
 		}
25 25
 		
26
-		if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) {
26
+		if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) {
27 27
 			return true; // permissions aren't in use
28 28
 		}
29 29
 		
30 30
 		$parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'"));
31
-		if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root
32
-		if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) {
31
+		if ($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root
32
+		if (($this->duplicateDoc == true || $document == 0) && $parent == 0 && $udperms_allowroot == 0) {
33 33
 			return false; // deny duplicate || create new document at root if Allow Root is No
34 34
 		}
35 35
 		
36 36
 		// get document groups for current user
37
-		if($_SESSION['mgrDocgroups']) {
38
-			$docgrp = implode(" || dg.document_group = ",$_SESSION['mgrDocgroups']);
37
+		if ($_SESSION['mgrDocgroups']) {
38
+			$docgrp = implode(" || dg.document_group = ", $_SESSION['mgrDocgroups']);
39 39
 		}
40 40
 
41 41
 		/* Note:
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 			are private to the manager users will not be private to web users if the 
47 47
 			document group is not assigned to a web user group and visa versa.
48 48
 		 */
49
-		$permissionsok = false;  // set permissions to false
49
+		$permissionsok = false; // set permissions to false
50 50
 		
51 51
 		$rs = $modx->db->select(
52 52
 			'count(DISTINCT sc.id)',
53 53
 			"{$tblsc} AS sc 
54 54
 				LEFT JOIN {$tbldg} AS dg on dg.document = sc.id 
55 55
 				LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group",
56
-			"sc.id='{$this->document}' AND (". ( (!$docgrp) ? null : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)"
56
+			"sc.id='{$this->document}' AND (".((!$docgrp) ? null : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)"
57 57
 			);
58 58
 		$limit = $modx->db->getValue($rs);
59
-		if($limit==1) $permissionsok = true;
59
+		if ($limit == 1) $permissionsok = true;
60 60
 		
61 61
 		return $permissionsok;
62 62
 	}
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class udperms{
3
+class udperms
4
+{
4 5
 
5 6
 	var $user;
6 7
 	var $document;
7 8
 	var $role;
8 9
 	var $duplicateDoc = false;
9 10
 	
10
-	function checkPermissions() {
11
+	function checkPermissions()
12
+	{
11 13
 		
12 14
 		global $udperms_allowroot;
13 15
 		global $modx;
@@ -28,7 +30,10 @@  discard block
 block discarded – undo
28 30
 		}
29 31
 		
30 32
 		$parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'"));
31
-		if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root
33
+		if($document == 0 && $parent == NULL && $udperms_allowroot == 1) {
34
+		    return true;
35
+		}
36
+		// User is allowed to create new document in root
32 37
 		if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) {
33 38
 			return false; // deny duplicate || create new document at root if Allow Root is No
34 39
 		}
@@ -56,7 +61,9 @@  discard block
 block discarded – undo
56 61
 			"sc.id='{$this->document}' AND (". ( (!$docgrp) ? null : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)"
57 62
 			);
58 63
 		$limit = $modx->db->getValue($rs);
59
-		if($limit==1) $permissionsok = true;
64
+		if($limit==1) {
65
+		    $permissionsok = true;
66
+		}
60 67
 		
61 68
 		return $permissionsok;
62 69
 	}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 		}
29 29
 		
30 30
 		$parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'"));
31
-		if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root
31
+		if($document == 0 && $parent == null && $udperms_allowroot == 1) return true; // User is allowed to create new document in root
32 32
 		if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) {
33 33
 			return false; // deny duplicate || create new document at root if Allow Root is No
34 34
 		}
Please login to merge, or discard this patch.