Completed
Branch develop (923a1c)
by Agel_Nash
06:47
created
manager/processors/logout.processor.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 
8 8
 // invoke OnBeforeManagerLogout event
9 9
 $modx->invokeEvent("OnBeforeManagerLogout",
10
-						array(
11
-							"userid"		=> $internalKey,
12
-							"username"		=> $username
13
-						));
10
+                        array(
11
+                            "userid"		=> $internalKey,
12
+                            "username"		=> $username
13
+                        ));
14 14
 
15 15
 //// Unset all of the session variables.
16 16
 //$_SESSION = array();
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 
34 34
 // invoke OnManagerLogout event
35 35
 $modx->invokeEvent("OnManagerLogout",
36
-						array(
37
-							"userid"		=> $internalKey,
38
-							"username"		=> $username
39
-						));
36
+                        array(
37
+                            "userid"		=> $internalKey,
38
+                            "username"		=> $username
39
+                        ));
40 40
 
41 41
 // show login screen
42 42
 header('Location: ' . MODX_MANAGER_URL);
Please login to merge, or discard this patch.
manager/processors/remove_content.processor.php 1 patch
Indentation   +14 added lines, -14 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('delete_document')) {
4
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
4
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
5 5
 }
6 6
 
7 7
 $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "deleted=1");
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 
10 10
 // invoke OnBeforeEmptyTrash event
11 11
 $modx->invokeEvent("OnBeforeEmptyTrash",
12
-						array(
13
-							"ids"=>$ids
14
-						));
12
+                        array(
13
+                            "ids"=>$ids
14
+                        ));
15 15
 
16 16
 // remove the document groups link.
17 17
 $sql = "DELETE document_groups
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 //'undelete' the document.
31 31
 $modx->db->delete($modx->getFullTableName('site_content'), "deleted=1");
32 32
 
33
-	// invoke OnEmptyTrash event
34
-	$modx->invokeEvent("OnEmptyTrash",
35
-						array(
36
-							"ids"=>$ids
37
-						));
33
+    // invoke OnEmptyTrash event
34
+    $modx->invokeEvent("OnEmptyTrash",
35
+                        array(
36
+                            "ids"=>$ids
37
+                        ));
38 38
 
39
-	// empty cache
40
-	$modx->clearCache('full');
39
+    // empty cache
40
+    $modx->clearCache('full');
41 41
 
42
-	// finished emptying cache - redirect
43
-	$header="Location: index.php?a=2&r=1";
44
-	header($header);
42
+    // finished emptying cache - redirect
43
+    $header="Location: index.php?a=2&r=1";
44
+    header($header);
Please login to merge, or discard this patch.
manager/processors/delete_web_user.processor.php 1 patch
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('delete_web_user')) {
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 OnBeforeWUsrFormDelete event
17 17
 $modx->invokeEvent("OnBeforeWUsrFormDelete",
18
-	array(
19
-		"id"	=> $id
20
-	));
18
+    array(
19
+        "id"	=> $id
20
+    ));
21 21
 
22 22
 // delete the user.
23 23
 $modx->db->delete($modx->getFullTableName('web_users'), "id='{$id}'");
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 
31 31
 // invoke OnWebDeleteUser event
32 32
 $modx->invokeEvent("OnWebDeleteUser",
33
-	array(
34
-		"userid"		=> $id,
35
-		"username"		=> $username
36
-	));
33
+    array(
34
+        "userid"		=> $id,
35
+        "username"		=> $username
36
+    ));
37 37
 
38 38
 // invoke OnWUsrFormDelete event
39 39
 $modx->invokeEvent("OnWUsrFormDelete",
40
-	array(
41
-		"id"	=> $id
42
-	));
40
+    array(
41
+        "id"	=> $id
42
+    ));
43 43
 
44 44
 $header="Location: index.php?a=99";
45 45
 header($header);
Please login to merge, or discard this patch.
manager/processors/delete_plugin.processor.php 1 patch
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.
manager/processors/duplicate_content.processor.php 1 patch
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.
manager/processors/move_document.processor.php 1 patch
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.
manager/processors/unpublish_content.processor.php 1 patch
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.
manager/processors/duplicate_template.processor.php 1 patch
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.
manager/processors/duplicate_snippet.processor.php 1 patch
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.