Completed
Pull Request — develop (#714)
by Agel_Nash
15:06 queued 06:49
created
manager/processors/duplicate_content.processor.php 3 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 $children = array();
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 $udperms->duplicateDoc = true;
23 23
 
24 24
 if(!$udperms->checkPermissions()) {
25
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
25
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
26 26
 }
27 27
 
28 28
 // Run the duplicator
@@ -43,103 +43,103 @@  discard block
 block discarded – undo
43 43
  * @return int
44 44
  */
45 45
 function duplicateDocument($docid, $parent=null, $_toplevel=0) {
46
-	$modx = evolutionCMS(); global $_lang;
47
-
48
-	// invoke OnBeforeDocDuplicate event
49
-	$evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array(
50
-		'id' => $docid
51
-	));
52
-
53
-	// if( !in_array( 'false', array_values( $evtOut ) ) ){}
54
-	// TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication
55
-	// [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false');
56
-
57
-	$userID = $modx->getLoginUserID();
58
-
59
-	$tblsc = $modx->getFullTableName('site_content');
60
-
61
-	// Grab the original document
62
-	$rs = $modx->db->select('*', $tblsc, "id='{$docid}'");
63
-	$content = $modx->db->getRow($rs);
64
-
65
-	// Handle incremental ID
66
-	switch($modx->config['docid_incrmnt_method'])
67
-	{
68
-		case '1':
69
-			$from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
70
-			$rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
71
-			$content['id'] = $modx->db->getValue($rs);
72
-			break;
73
-		case '2':
74
-			$rs = $modx->db->select('MAX(id)+1',$tblsc);
75
-			$content['id'] = $modx->db->getValue($rs);
76
-			break;
77
-
78
-		default:
79
-			unset($content['id']); // remove the current id.
80
-	}
81
-
82
-	// Once we've grabbed the document object, start doing some modifications
83
-	if ($_toplevel == 0) {
84
-		// count duplicates
85
-		$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'"));
86
-		$pagetitle = $modx->db->escape($pagetitle);
87
-		$count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'"));
88
-		if($count>=1) $count = ' '.($count+1);
89
-		else $count = '';
90
-
91
-		$content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
92
-		$content['alias'] = null;
93
-	} elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
94
-		$content['alias'] = null;
95
-	}
96
-
97
-	// change the parent accordingly
98
-	if ($parent !== null) $content['parent'] = $parent;
99
-
100
-	// Change the author
101
-	$content['createdby'] = $userID;
102
-	$content['createdon'] = time();
103
-	// Remove other modification times
104
-	$content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0;
105
-
106
-	// [FS#922] Should the published status be honored? - sirlancelot
46
+    $modx = evolutionCMS(); global $_lang;
47
+
48
+    // invoke OnBeforeDocDuplicate event
49
+    $evtOut = $modx->invokeEvent('OnBeforeDocDuplicate', array(
50
+        'id' => $docid
51
+    ));
52
+
53
+    // if( !in_array( 'false', array_values( $evtOut ) ) ){}
54
+    // TODO: Determine necessary handling for duplicateDocument "return $newparent" if OnBeforeDocDuplicate were able to conditially control duplication
55
+    // [DISABLED]: Proceed with duplicateDocument if OnBeforeDocDuplicate did not return false via: $event->output('false');
56
+
57
+    $userID = $modx->getLoginUserID();
58
+
59
+    $tblsc = $modx->getFullTableName('site_content');
60
+
61
+    // Grab the original document
62
+    $rs = $modx->db->select('*', $tblsc, "id='{$docid}'");
63
+    $content = $modx->db->getRow($rs);
64
+
65
+    // Handle incremental ID
66
+    switch($modx->config['docid_incrmnt_method'])
67
+    {
68
+        case '1':
69
+            $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
70
+            $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
71
+            $content['id'] = $modx->db->getValue($rs);
72
+            break;
73
+        case '2':
74
+            $rs = $modx->db->select('MAX(id)+1',$tblsc);
75
+            $content['id'] = $modx->db->getValue($rs);
76
+            break;
77
+
78
+        default:
79
+            unset($content['id']); // remove the current id.
80
+    }
81
+
82
+    // Once we've grabbed the document object, start doing some modifications
83
+    if ($_toplevel == 0) {
84
+        // count duplicates
85
+        $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'"));
86
+        $pagetitle = $modx->db->escape($pagetitle);
87
+        $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'"));
88
+        if($count>=1) $count = ' '.($count+1);
89
+        else $count = '';
90
+
91
+        $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
92
+        $content['alias'] = null;
93
+    } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
94
+        $content['alias'] = null;
95
+    }
96
+
97
+    // change the parent accordingly
98
+    if ($parent !== null) $content['parent'] = $parent;
99
+
100
+    // Change the author
101
+    $content['createdby'] = $userID;
102
+    $content['createdon'] = time();
103
+    // Remove other modification times
104
+    $content['editedby'] = $content['editedon'] = $content['deleted'] = $content['deletedby'] = $content['deletedon'] = 0;
105
+
106
+    // [FS#922] Should the published status be honored? - sirlancelot
107 107
 //	if ($modx->hasPermission('publish_document')) {
108 108
 //		if ($modx->config['publish_default'])
109 109
 //			$content['pub_date'] = $content['pub_date']; // should this be changed to 1?
110 110
 //		else	$content['pub_date'] = 0;
111 111
 //	} else {
112
-		// User can't publish documents
112
+        // User can't publish documents
113 113
 //		$content['published'] = $content['pub_date'] = 0;
114 114
 //	}
115 115
 
116 116
     // Set the published status to unpublished by default (see above ... commit #3388)
117 117
     $content['published'] = $content['pub_date'] = 0;
118 118
 
119
-	// Escape the proper strings
120
-	$content = $modx->db->escape($content);
119
+    // Escape the proper strings
120
+    $content = $modx->db->escape($content);
121 121
 
122
-	// Duplicate the Document
123
-	$newparent = $modx->db->insert($content, $tblsc);
122
+    // Duplicate the Document
123
+    $newparent = $modx->db->insert($content, $tblsc);
124 124
 
125
-	// duplicate document's TVs
126
-	duplicateTVs($docid, $newparent);
127
-	duplicateAccess($docid, $newparent);
125
+    // duplicate document's TVs
126
+    duplicateTVs($docid, $newparent);
127
+    duplicateAccess($docid, $newparent);
128 128
 
129
-	// invoke OnDocDuplicate event
130
-	$evtOut = $modx->invokeEvent('OnDocDuplicate', array(
131
-		'id' => $docid,
132
-		'new_id' => $newparent
133
-	));
129
+    // invoke OnDocDuplicate event
130
+    $evtOut = $modx->invokeEvent('OnDocDuplicate', array(
131
+        'id' => $docid,
132
+        'new_id' => $newparent
133
+    ));
134 134
 
135
-	// Start duplicating all the child documents that aren't deleted.
136
-	$_toplevel++;
137
-	$rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC');
138
-		while ($row = $modx->db->getRow($rs))
139
-			duplicateDocument($row['id'], $newparent, $_toplevel);
135
+    // Start duplicating all the child documents that aren't deleted.
136
+    $_toplevel++;
137
+    $rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC');
138
+        while ($row = $modx->db->getRow($rs))
139
+            duplicateDocument($row['id'], $newparent, $_toplevel);
140 140
 
141
-	// return the new doc id
142
-	return $newparent;
141
+    // return the new doc id
142
+    return $newparent;
143 143
 }
144 144
 
145 145
 /**
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
  * @param int $newid
150 150
  */
151 151
 function duplicateTVs($oldid, $newid){
152
-	$modx = evolutionCMS();
152
+    $modx = evolutionCMS();
153 153
 
154
-	$tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
154
+    $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
155 155
 
156 156
     $newid = (int)$newid;
157 157
     $oldid = (int)$oldid;
158 158
 
159 159
     $modx->db->insert(
160
-		array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into
161
-		"{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from
162
-	);
160
+        array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into
161
+        "{$newid}, tmplvarid, value", $tbltvc, "contentid='{$oldid}'" // Copy from
162
+    );
163 163
 }
164 164
 
165 165
 /**
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
  * @param int $newid
170 170
  */
171 171
 function duplicateAccess($oldid, $newid){
172
-	$modx = evolutionCMS();
172
+    $modx = evolutionCMS();
173 173
 
174
-	$tbldg = $modx->getFullTableName('document_groups');
174
+    $tbldg = $modx->getFullTableName('document_groups');
175 175
 
176 176
     $newid = (int)$newid;
177 177
     $oldid = (int)$oldid;
178 178
 
179 179
     $modx->db->insert(
180
-		array('document'=>'', 'document_group'=>''), $tbldg, // Insert into
181
-		"{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from
182
-	);
180
+        array('document'=>'', 'document_group'=>''), $tbldg, // Insert into
181
+        "{$newid}, document_group", $tbldg, "document='{$oldid}'" // Copy from
182
+    );
183 183
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) {
5
+if (!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 $children = array();
15 15
 
16 16
 // check permissions on the document
17
-include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
17
+include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
18 18
 $udperms = new udperms();
19 19
 $udperms->user = $modx->getLoginUserID();
20 20
 $udperms->document = $id;
21 21
 $udperms->role = $_SESSION['mgrRole'];
22 22
 $udperms->duplicateDoc = true;
23 23
 
24
-if(!$udperms->checkPermissions()) {
24
+if (!$udperms->checkPermissions()) {
25 25
 	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
26 26
 }
27 27
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 $_SESSION['itemname'] = $name;
34 34
 
35 35
 // finish cloning - redirect
36
-$header="Location: index.php?r=1&a=3&id=$id";
36
+$header = "Location: index.php?r=1&a=3&id=$id";
37 37
 header($header);
38 38
 
39 39
 /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  * @param int $_toplevel
43 43
  * @return int
44 44
  */
45
-function duplicateDocument($docid, $parent=null, $_toplevel=0) {
45
+function duplicateDocument($docid, $parent = null, $_toplevel = 0){
46 46
 	$modx = evolutionCMS(); global $_lang;
47 47
 
48 48
 	// invoke OnBeforeDocDuplicate event
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	$content = $modx->db->getRow($rs);
64 64
 
65 65
 	// Handle incremental ID
66
-	switch($modx->config['docid_incrmnt_method'])
66
+	switch ($modx->config['docid_incrmnt_method'])
67 67
 	{
68 68
 		case '1':
69 69
 			$from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			$content['id'] = $modx->db->getValue($rs);
72 72
 			break;
73 73
 		case '2':
74
-			$rs = $modx->db->select('MAX(id)+1',$tblsc);
74
+			$rs = $modx->db->select('MAX(id)+1', $tblsc);
75 75
 			$content['id'] = $modx->db->getValue($rs);
76 76
 			break;
77 77
 
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 		$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'"));
86 86
 		$pagetitle = $modx->db->escape($pagetitle);
87 87
 		$count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'"));
88
-		if($count>=1) $count = ' '.($count+1);
88
+		if ($count >= 1) $count = ' '.($count + 1);
89 89
 		else $count = '';
90 90
 
91 91
 		$content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
92 92
 		$content['alias'] = null;
93
-	} elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
93
+	} elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
94 94
 		$content['alias'] = null;
95 95
 	}
96 96
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 
154 154
 	$tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
155 155
 
156
-    $newid = (int)$newid;
157
-    $oldid = (int)$oldid;
156
+    $newid = (int) $newid;
157
+    $oldid = (int) $oldid;
158 158
 
159 159
     $modx->db->insert(
160 160
 		array('contentid'=>'', 'tmplvarid'=>'', 'value'=>''), $tbltvc, // Insert into
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 
174 174
 	$tbldg = $modx->getFullTableName('document_groups');
175 175
 
176
-    $newid = (int)$newid;
177
-    $oldid = (int)$oldid;
176
+    $newid = (int) $newid;
177
+    $oldid = (int) $oldid;
178 178
 
179 179
     $modx->db->insert(
180 180
 		array('document'=>'', 'document_group'=>''), $tbldg, // Insert into
Please login to merge, or discard this patch.
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
  * @param int $_toplevel
43 43
  * @return int
44 44
  */
45
-function duplicateDocument($docid, $parent=null, $_toplevel=0) {
45
+function duplicateDocument($docid, $parent=null, $_toplevel=0)
46
+{
46 47
 	$modx = evolutionCMS(); global $_lang;
47 48
 
48 49
 	// invoke OnBeforeDocDuplicate event
@@ -63,8 +64,7 @@  discard block
 block discarded – undo
63 64
 	$content = $modx->db->getRow($rs);
64 65
 
65 66
 	// Handle incremental ID
66
-	switch($modx->config['docid_incrmnt_method'])
67
-	{
67
+	switch($modx->config['docid_incrmnt_method']) {
68 68
 		case '1':
69 69
 			$from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id";
70 70
 			$rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
@@ -85,8 +85,11 @@  discard block
 block discarded – undo
85 85
 		$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'"));
86 86
 		$pagetitle = $modx->db->escape($pagetitle);
87 87
 		$count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'"));
88
-		if($count>=1) $count = ' '.($count+1);
89
-		else $count = '';
88
+		if($count>=1) {
89
+		    $count = ' '.($count+1);
90
+		} else {
91
+		    $count = '';
92
+		}
90 93
 
91 94
 		$content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
92 95
 		$content['alias'] = null;
@@ -95,7 +98,9 @@  discard block
 block discarded – undo
95 98
 	}
96 99
 
97 100
 	// change the parent accordingly
98
-	if ($parent !== null) $content['parent'] = $parent;
101
+	if ($parent !== null) {
102
+	    $content['parent'] = $parent;
103
+	}
99 104
 
100 105
 	// Change the author
101 106
 	$content['createdby'] = $userID;
@@ -135,8 +140,9 @@  discard block
 block discarded – undo
135 140
 	// Start duplicating all the child documents that aren't deleted.
136 141
 	$_toplevel++;
137 142
 	$rs = $modx->db->select('id', $tblsc, "parent='{$docid}' AND deleted=0", 'id ASC');
138
-		while ($row = $modx->db->getRow($rs))
139
-			duplicateDocument($row['id'], $newparent, $_toplevel);
143
+		while ($row = $modx->db->getRow($rs)) {
144
+					duplicateDocument($row['id'], $newparent, $_toplevel);
145
+		}
140 146
 
141 147
 	// return the new doc id
142 148
 	return $newparent;
@@ -148,7 +154,8 @@  discard block
 block discarded – undo
148 154
  * @param int $oldid
149 155
  * @param int $newid
150 156
  */
151
-function duplicateTVs($oldid, $newid){
157
+function duplicateTVs($oldid, $newid)
158
+{
152 159
 	$modx = evolutionCMS();
153 160
 
154 161
 	$tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
@@ -168,7 +175,8 @@  discard block
 block discarded – undo
168 175
  * @param int $oldid
169 176
  * @param int $newid
170 177
  */
171
-function duplicateAccess($oldid, $newid){
178
+function duplicateAccess($oldid, $newid)
179
+{
172 180
 	$modx = evolutionCMS();
173 181
 
174 182
 	$tbldg = $modx->getFullTableName('document_groups');
Please login to merge, or discard this patch.
manager/processors/execute_module.processor.php 3 patches
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 }
13 13
 
14 14
 // check if user has access permission, except admins
15
-if($_SESSION['mgrRole']!=1){
15
+if($_SESSION['mgrRole']!=1) {
16 16
 	$rs = $modx->db->select(
17 17
 		'sma.usergroup,mg.member',
18 18
 		$modx->getFullTableName("site_module_access")." sma
@@ -70,7 +70,8 @@  discard block
 block discarded – undo
70 70
  * @param array $params
71 71
  * @return string
72 72
  */
73
-function evalModule($moduleCode,$params){
73
+function evalModule($moduleCode,$params)
74
+{
74 75
 	$modx = evolutionCMS();
75 76
 	$modx->event->params = &$params; // store params inside event object
76 77
 	if(is_array($params)) {
@@ -80,11 +81,9 @@  discard block
 block discarded – undo
80 81
 	$mod = eval($moduleCode);
81 82
 	$msg = ob_get_contents();
82 83
 	ob_end_clean();
83
-	if (isset($php_errormsg))
84
-	{
84
+	if (isset($php_errormsg)) {
85 85
 		$error_info = error_get_last();
86
-        switch($error_info['type'])
87
-        {
86
+        switch($error_info['type']) {
88 87
         	case E_NOTICE :
89 88
         		$error_level = 1;
90 89
         	case E_USER_NOTICE :
@@ -97,8 +96,7 @@  discard block
 block discarded – undo
97 96
         	default:
98 97
         		$error_level = 99;
99 98
         }
100
-		if($modx->config['error_reporting']==='99' || 2<$error_level)
101
-		{
99
+		if($modx->config['error_reporting']==='99' || 2<$error_level) {
102 100
 			$modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
103 101
 			$modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
104 102
 		}
Please login to merge, or discard this patch.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -3,51 +3,51 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('exec_module')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // check if user has access permission, except admins
15 15
 if($_SESSION['mgrRole']!=1){
16
-	$rs = $modx->db->select(
17
-		'sma.usergroup,mg.member',
18
-		$modx->getFullTableName("site_module_access")." sma
16
+    $rs = $modx->db->select(
17
+        'sma.usergroup,mg.member',
18
+        $modx->getFullTableName("site_module_access")." sma
19 19
 			LEFT JOIN ".$modx->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'",
20
-		"sma.module = '{$id}'"
21
-		);
22
-	//initialize permission to -1, if it stays -1 no permissions
23
-	//attached so permission granted
24
-	$permissionAccessInt = -1;
20
+        "sma.module = '{$id}'"
21
+        );
22
+    //initialize permission to -1, if it stays -1 no permissions
23
+    //attached so permission granted
24
+    $permissionAccessInt = -1;
25 25
 
26
-	while ($row = $modx->db->getRow($rs)) {
27
-		if($row["usergroup"] && $row["member"]) {
28
-			//if there are permissions and this member has permission, ofcourse
29
-			//this is granted
30
-			$permissionAccessInt = 1;
31
-		} elseif ($permissionAccessInt==-1) {
32
-			//if there are permissions but this member has no permission and the
33
-			//variable was still in init state we set permission to 0; no permissions
34
-			$permissionAccessInt = 0;
35
-		}
36
-	}
26
+    while ($row = $modx->db->getRow($rs)) {
27
+        if($row["usergroup"] && $row["member"]) {
28
+            //if there are permissions and this member has permission, ofcourse
29
+            //this is granted
30
+            $permissionAccessInt = 1;
31
+        } elseif ($permissionAccessInt==-1) {
32
+            //if there are permissions but this member has no permission and the
33
+            //variable was still in init state we set permission to 0; no permissions
34
+            $permissionAccessInt = 0;
35
+        }
36
+    }
37 37
 
38
-	if($permissionAccessInt==0) {
39
-		$modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106");
40
-	}
38
+    if($permissionAccessInt==0) {
39
+        $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106");
40
+    }
41 41
 }
42 42
 
43 43
 // get module data
44 44
 $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'");
45 45
 $content = $modx->db->getRow($rs);
46 46
 if(!$content) {
47
-	$modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106");
47
+    $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106");
48 48
 }
49 49
 if($content['disabled']) {
50
-	$modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106");
50
+    $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106");
51 51
 }
52 52
 
53 53
 // Set the item name for logger
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 $output = evalModule($content["modulecode"],$parameter);
64 64
 if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) {
65
-	echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller
65
+    echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller
66 66
 }
67 67
 echo $output;
68 68
 include MODX_MANAGER_PATH."includes/sysalert.display.inc.php";
@@ -75,38 +75,38 @@  discard block
 block discarded – undo
75 75
  * @return string
76 76
  */
77 77
 function evalModule($moduleCode,$params){
78
-	$modx = evolutionCMS();
79
-	$modx->event->params = &$params; // store params inside event object
80
-	if(is_array($params)) {
81
-		extract($params, EXTR_SKIP);
82
-	}
83
-	ob_start();
84
-	$mod = eval($moduleCode);
85
-	$msg = ob_get_contents();
86
-	ob_end_clean();
87
-	if (isset($php_errormsg))
88
-	{
89
-		$error_info = error_get_last();
78
+    $modx = evolutionCMS();
79
+    $modx->event->params = &$params; // store params inside event object
80
+    if(is_array($params)) {
81
+        extract($params, EXTR_SKIP);
82
+    }
83
+    ob_start();
84
+    $mod = eval($moduleCode);
85
+    $msg = ob_get_contents();
86
+    ob_end_clean();
87
+    if (isset($php_errormsg))
88
+    {
89
+        $error_info = error_get_last();
90 90
         switch($error_info['type'])
91 91
         {
92
-        	case E_NOTICE :
93
-        		$error_level = 1;
94
-        	case E_USER_NOTICE :
95
-        		break;
96
-        	case E_DEPRECATED :
97
-        	case E_USER_DEPRECATED :
98
-        	case E_STRICT :
99
-        		$error_level = 2;
100
-        		break;
101
-        	default:
102
-        		$error_level = 99;
92
+            case E_NOTICE :
93
+                $error_level = 1;
94
+            case E_USER_NOTICE :
95
+                break;
96
+            case E_DEPRECATED :
97
+            case E_USER_DEPRECATED :
98
+            case E_STRICT :
99
+                $error_level = 2;
100
+                break;
101
+            default:
102
+                $error_level = 99;
103
+        }
104
+        if($modx->config['error_reporting']==='99' || 2<$error_level)
105
+        {
106
+            $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
107
+            $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
103 108
         }
104
-		if($modx->config['error_reporting']==='99' || 2<$error_level)
105
-		{
106
-			$modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
107
-			$modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
108
-		}
109
-	}
110
-	unset($modx->event->params);
111
-	return $mod.$msg;
109
+    }
110
+    unset($modx->event->params);
111
+    return $mod.$msg;
112 112
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('exec_module')) {
5
+if (!$modx->hasPermission('exec_module')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // check if user has access permission, except admins
15
-if($_SESSION['mgrRole']!=1){
15
+if ($_SESSION['mgrRole'] != 1) {
16 16
 	$rs = $modx->db->select(
17 17
 		'sma.usergroup,mg.member',
18 18
 		$modx->getFullTableName("site_module_access")." sma
@@ -24,18 +24,18 @@  discard block
 block discarded – undo
24 24
 	$permissionAccessInt = -1;
25 25
 
26 26
 	while ($row = $modx->db->getRow($rs)) {
27
-		if($row["usergroup"] && $row["member"]) {
27
+		if ($row["usergroup"] && $row["member"]) {
28 28
 			//if there are permissions and this member has permission, ofcourse
29 29
 			//this is granted
30 30
 			$permissionAccessInt = 1;
31
-		} elseif ($permissionAccessInt==-1) {
31
+		} elseif ($permissionAccessInt == -1) {
32 32
 			//if there are permissions but this member has no permission and the
33 33
 			//variable was still in init state we set permission to 0; no permissions
34 34
 			$permissionAccessInt = 0;
35 35
 		}
36 36
 	}
37 37
 
38
-	if($permissionAccessInt==0) {
38
+	if ($permissionAccessInt == 0) {
39 39
 		$modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106");
40 40
 	}
41 41
 }
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 // get module data
44 44
 $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'");
45 45
 $content = $modx->db->getRow($rs);
46
-if(!$content) {
46
+if (!$content) {
47 47
 	$modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106");
48 48
 }
49
-if($content['disabled']) {
49
+if ($content['disabled']) {
50 50
 	$modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106");
51 51
 }
52 52
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 $_SESSION['itemname'] = $content['name'];
61 61
 
62 62
 
63
-$output = evalModule($content["modulecode"],$parameter);
64
-if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) {
63
+$output = evalModule($content["modulecode"], $parameter);
64
+if (strpos(trim($output), '<') === 0 && strpos(trim($output), '<?xml') !== 0) {
65 65
 	echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller
66 66
 }
67 67
 echo $output;
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
  * @param array $params
75 75
  * @return string
76 76
  */
77
-function evalModule($moduleCode,$params){
77
+function evalModule($moduleCode, $params){
78 78
 	$modx = evolutionCMS();
79 79
 	$modx->event->params = &$params; // store params inside event object
80
-	if(is_array($params)) {
80
+	if (is_array($params)) {
81 81
 		extract($params, EXTR_SKIP);
82 82
 	}
83 83
 	ob_start();
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	if (isset($php_errormsg))
88 88
 	{
89 89
 		$error_info = error_get_last();
90
-        switch($error_info['type'])
90
+        switch ($error_info['type'])
91 91
         {
92 92
         	case E_NOTICE :
93 93
         		$error_level = 1;
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
         	default:
102 102
         		$error_level = 99;
103 103
         }
104
-		if($modx->config['error_reporting']==='99' || 2<$error_level)
104
+		if ($modx->config['error_reporting'] === '99' || 2 < $error_level)
105 105
 		{
106
-			$modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
106
+			$modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg);
107 107
 			$modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
108 108
 		}
109 109
 	}
Please login to merge, or discard this patch.
manager/includes/preload.functions.inc.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession
5 5
 
6 6
 
7
-if( ! function_exists('evolutionCMS')) {
7
+if (!function_exists('evolutionCMS')) {
8 8
     /**
9 9
      * @return DocumentParser
10 10
      */
11 11
     function evolutionCMS()
12 12
     {
13
-        if( ! defined('MODX_CLASS')) {
14
-            if( ! class_exists('DocumentParser')) {
13
+        if (!defined('MODX_CLASS')) {
14
+            if (!class_exists('DocumentParser')) {
15 15
                 throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists');
16 16
             }
17 17
             define('MODX_CLASS', 'DocumentParser');
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     $_ = crc32(__FILE__);
30 30
     $_ = sprintf('%u', $_);
31 31
 
32
-    return 'evo' . base_convert($_, 10, 36);
32
+    return 'evo'.base_convert($_, 10, 36);
33 33
 }
34 34
 
35 35
 /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 function startCMSSession()
39 39
 {
40 40
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
41
-    if(MODX_CLI) return;
41
+    if (MODX_CLI) return;
42 42
 
43 43
     session_name($site_sessionname);
44 44
     removeInvalidCmsSessionIds($site_sessionname);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     session_start();
51 51
     $key = "modx.mgr.session.cookie.lifetime";
52 52
     if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
53
-        $cookieLifetime = (int)$_SESSION[$key];
53
+        $cookieLifetime = (int) $_SESSION[$key];
54 54
         if ($cookieLifetime) {
55 55
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
56 56
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
  */
80 80
 function removeInvalidCmsSessionIds($session_name)
81 81
 {
82
-    if(MODX_CLI) return;
82
+    if (MODX_CLI) return;
83 83
     // session ids is invalid iff it is empty string
84 84
     // storage priorioty can see in PHP source ext/session/session.c
85 85
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
Braces   +24 added lines, -20 removed lines patch added patch discarded remove patch
@@ -4,21 +4,21 @@  discard block
 block discarded – undo
4 4
 $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession
5 5
 
6 6
 
7
-if( ! function_exists('evolutionCMS')) {
7
+if( ! function_exists('evolutionCMS')) {
8 8
     /**
9 9
      * @return DocumentParser
10 10
      */
11
-    function evolutionCMS()
12
-    {
13
-        if( ! defined('MODX_CLASS')) {
14
-            if( ! class_exists('DocumentParser')) {
11
+    function evolutionCMS()
12
+    {
13
+        if( ! defined('MODX_CLASS')) {
14
+            if( ! class_exists('DocumentParser')) {
15 15
                 throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists');
16 16
             }
17 17
             define('MODX_CLASS', 'DocumentParser');
18 18
         }
19 19
         
20 20
         global $modx;
21
-        if ($modx === null) {
21
+        if ($modx === null) {
22 22
             $obj = new ReflectionClass(MODX_CLASS);
23 23
             $modx = $obj->newInstanceWithoutConstructor()->getInstance();
24 24
         }
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * @return string
31 31
  */
32
-function genEvoSessionName()
33
-{
32
+function genEvoSessionName()
33
+{
34 34
     $_ = crc32(__FILE__);
35 35
     $_ = sprintf('%u', $_);
36 36
 
@@ -40,10 +40,12 @@  discard block
 block discarded – undo
40 40
 /**
41 41
  * @return void
42 42
  */
43
-function startCMSSession()
44
-{
43
+function startCMSSession()
44
+{
45 45
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
46
-    if(MODX_CLI) return;
46
+    if(MODX_CLI) {
47
+        return;
48
+    }
47 49
 
48 50
     session_name($site_sessionname);
49 51
     removeInvalidCmsSessionIds($site_sessionname);
@@ -54,14 +56,14 @@  discard block
 block discarded – undo
54 56
     session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
55 57
     session_start();
56 58
     $key = "modx.mgr.session.cookie.lifetime";
57
-    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
59
+    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
58 60
         $cookieLifetime = (int)$_SESSION[$key];
59
-        if ($cookieLifetime) {
61
+        if ($cookieLifetime) {
60 62
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
61 63
         }
62 64
         setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
63 65
     }
64
-    if (!isset($_SESSION['modx.session.created.time'])) {
66
+    if (!isset($_SESSION['modx.session.created.time'])) {
65 67
         $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME'];
66 68
     }
67 69
 }
@@ -71,9 +73,9 @@  discard block
 block discarded – undo
71 73
  * @param $session_name
72 74
  * @return void
73 75
  */
74
-function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
75
-{
76
-    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
76
+function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
77
+{
78
+    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
77 79
         unset($storage[$session_name]);
78 80
     }
79 81
 }
@@ -82,9 +84,11 @@  discard block
 block discarded – undo
82 84
  * @param $session_name
83 85
  * @return void
84 86
  */
85
-function removeInvalidCmsSessionIds($session_name)
86
-{
87
-    if(MODX_CLI) return;
87
+function removeInvalidCmsSessionIds($session_name)
88
+{
89
+    if(MODX_CLI) {
90
+        return;
91
+    }
88 92
     // session ids is invalid iff it is empty string
89 93
     // storage priorioty can see in PHP source ext/session/session.c
90 94
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
manager/processors/save_content.processor.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -492,7 +492,7 @@
 block discarded – undo
492 492
                 }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
493 493
                 $publishedon = $pub_date;
494 494
                 $publishedby = $modx->getLoginUserID();
495
-                   }elseif ($was_published && !$published) {
495
+                    }elseif ($was_published && !$published) {
496 496
                 $publishedon = 0;
497 497
                 $publishedby = 0;
498 498
             } else {
Please login to merge, or discard this patch.
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -280,19 +280,19 @@
 block discarded – undo
280 280
             // invoke OnBeforeDocFormSave event
281 281
             switch($modx->config['docid_incrmnt_method'])
282 282
             {
283
-            case '1':
284
-                $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
285
-                $where = "T1.id IS NULL";
286
-                $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
287
-                $id = $modx->db->getValue($rs);
283
+                case '1':
284
+                    $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
285
+                    $where = "T1.id IS NULL";
286
+                    $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
287
+                    $id = $modx->db->getValue($rs);
288
+                    break;
289
+                case '2':
290
+                    $rs = $modx->db->select('MAX(id)+1', $tbl_site_content);
291
+                    $id = $modx->db->getValue($rs);
288 292
                 break;
289
-            case '2':
290
-                $rs = $modx->db->select('MAX(id)+1', $tbl_site_content);
291
-                $id = $modx->db->getValue($rs);
292
-            break;
293 293
 
294
-            default:
295
-                $id = '';
294
+                default:
295
+                    $id = '';
296 296
             }
297 297
 
298 298
         $modx->invokeEvent("OnBeforeDocFormSave", array(
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         case 'new' :
279 279
 
280 280
             // invoke OnBeforeDocFormSave event
281
-            switch($modx->config['docid_incrmnt_method'])
281
+            switch ($modx->config['docid_incrmnt_method'])
282 282
             {
283 283
             case '1':
284 284
                 $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             if (!$was_published && $published) {
490 490
                 $publishedon = $currentdate;
491 491
                 $publishedby = $modx->getLoginUserID();
492
-                }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
492
+                }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) {
493 493
                 $publishedon = $pub_date;
494 494
                 $publishedby = $modx->getLoginUserID();
495 495
                    }elseif ($was_published && !$published) {
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
             }
502 502
 
503 503
             // invoke OnBeforeDocFormSave event
504
-            $modx->invokeEvent("OnBeforeDocFormSave", array (
504
+            $modx->invokeEvent("OnBeforeDocFormSave", array(
505 505
                 "mode" => "upd",
506 506
                 "id" => $id
507 507
             ));
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 . "menuindex={$menuindex}, "
527 527
                 . "searchable={$searchable}, "
528 528
                 . "cacheable={$cacheable}, "
529
-                . "editedby=" . $modx->getLoginUserID() . ", "
529
+                . "editedby=".$modx->getLoginUserID().", "
530 530
                 . "editedon={$currentdate}, "
531 531
                 . "publishedon={$publishedon}, "
532 532
                 . "publishedby={$publishedby}, "
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 
541 541
             // update template variables
542 542
             $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'");
543
-            $tvIds = array ();
543
+            $tvIds = array();
544 544
             while ($row = $modx->db->getRow($rs)) {
545 545
                 $tvIds[$row['tmplvarid']] = $row['id'];
546 546
             }
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
                     'groups.id, groups.document_group',
594 594
                     "{$tbl_document_groups} AS groups
595 595
                     LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group",
596
-                    "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
596
+                    "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
597 597
                     );
598 598
                 $old_groups = array();
599 599
                 while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id'];
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
                         unset($old_groups[$group]);
606 606
                         continue;
607 607
                     } elseif ($link_id == 'new') {
608
-                        $insertions[] = '('.(int)$group.','.$id.')';
608
+                        $insertions[] = '('.(int) $group.','.$id.')';
609 609
                     }
610 610
                 }
611 611
                 if (!empty($insertions)) {
@@ -637,17 +637,17 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
             // invoke OnDocFormSave event
640
-            $modx->invokeEvent("OnDocFormSave", array (
640
+            $modx->invokeEvent("OnDocFormSave", array(
641 641
                 "mode" => "upd",
642 642
                 "id" => $id
643 643
             ));
644 644
 
645 645
             // secure web documents - flag as private
646
-            include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php";
646
+            include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
647 647
             secureWebDocument($id);
648 648
 
649 649
             // secure manager documents - flag as private
650
-            include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php";
650
+            include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php";
651 651
             secureMgrDocument($id);
652 652
 
653 653
             // Set the item name for logger
@@ -673,13 +673,13 @@  discard block
 block discarded – undo
673 673
                         // document
674 674
                         $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent";
675 675
                     }
676
-                    $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path;
676
+                    $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path;
677 677
                 } else {
678 678
                     $header = "Location: index.php?a=3&id=$id&r=1".$add_path;
679 679
                 }
680 680
             }
681 681
             if (headers_sent()) {
682
-                $header = str_replace('Location: ','',$header);
682
+                $header = str_replace('Location: ', '', $header);
683 683
                 echo "<script>document.location.href='$header';</script>\n";
684 684
             } else {
685 685
                 header($header);
Please login to merge, or discard this patch.
Braces   +23 added lines, -19 removed lines patch added patch discarded remove patch
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
         }
135 135
         //end webber
136 136
     }
137
-}
138
-elseif ($alias) {
137
+} elseif ($alias) {
139 138
     $alias = $modx->stripAlias($alias);
140 139
 }
141 140
 
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
 
150 149
     if ($pub_date < $currentdate) {
151 150
         $published = 1;
152
-    }
153
-    elseif ($pub_date > $currentdate) {
151
+    } elseif ($pub_date > $currentdate) {
154 152
         $published = 0;
155 153
     }
156 154
 }
@@ -278,8 +276,7 @@  discard block
 block discarded – undo
278 276
         case 'new' :
279 277
 
280 278
             // invoke OnBeforeDocFormSave event
281
-            switch($modx->config['docid_incrmnt_method'])
282
-            {
279
+            switch($modx->config['docid_incrmnt_method']) {
283 280
             case '1':
284 281
                 $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
285 282
                 $where = "T1.id IS NULL";
@@ -347,8 +344,9 @@  discard block
 block discarded – undo
347 344
             "alias_visible"    => $aliasvisible
348 345
         );
349 346
 
350
-        if ($id != '')
351
-            $dbInsert["id"] = $id;
347
+        if ($id != '') {
348
+                    $dbInsert["id"] = $id;
349
+        }
352 350
 
353 351
         $key = $modx->db->insert($dbInsert, $tbl_site_content);
354 352
 
@@ -424,11 +422,13 @@  discard block
 block discarded – undo
424 422
         // redirect/stay options
425 423
         if ($_POST['stay'] != '') {
426 424
             // weblink
427
-            if ($_POST['mode'] == "72")
428
-                $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent";
425
+            if ($_POST['mode'] == "72") {
426
+                            $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent";
427
+            }
429 428
             // document
430
-            if ($_POST['mode'] == "4")
431
-                $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent";
429
+            if ($_POST['mode'] == "4") {
430
+                            $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent";
431
+            }
432 432
             $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'];
433 433
         } else {
434 434
             $header = "Location: index.php?a=3&id=$key&r=1";
@@ -489,10 +489,10 @@  discard block
 block discarded – undo
489 489
             if (!$was_published && $published) {
490 490
                 $publishedon = $currentdate;
491 491
                 $publishedby = $modx->getLoginUserID();
492
-                }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
492
+                } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
493 493
                 $publishedon = $pub_date;
494 494
                 $publishedby = $modx->getLoginUserID();
495
-                   }elseif ($was_published && !$published) {
495
+                   } elseif ($was_published && !$published) {
496 496
                 $publishedon = 0;
497 497
                 $publishedby = 0;
498 498
             } else {
@@ -548,7 +548,9 @@  discard block
 block discarded – undo
548 548
             $tvChanges = array();
549 549
             foreach ($tmplvars as $field => $value) {
550 550
                 if (!is_array($value)) {
551
-                    if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value];
551
+                    if (isset($tvIds[$value])) {
552
+                        $tvDeletions[] = $tvIds[$value];
553
+                    }
552 554
                 } else {
553 555
                     $tvId = $value[0];
554 556
                     $tvVal = $value[1];
@@ -596,7 +598,9 @@  discard block
 block discarded – undo
596 598
                     "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
597 599
                     );
598 600
                 $old_groups = array();
599
-                while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id'];
601
+                while ($row = $modx->db->getRow($rs)) {
602
+                    $old_groups[$row['document_group']] = $row['id'];
603
+                }
600 604
 
601 605
                 // update the permissions in the database
602 606
                 $insertions = $deletions = array();
@@ -658,9 +662,9 @@  discard block
 block discarded – undo
658 662
                 $modx->clearCache('full');
659 663
             }
660 664
 
661
-            if ($_POST['refresh_preview'] == '1')
662
-                $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev";
663
-            else {
665
+            if ($_POST['refresh_preview'] == '1') {
666
+                            $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev";
667
+            } else {
664 668
                 if ($_POST['stay'] != '2' && $id > 0) {
665 669
                     $modx->unlockElement(7, $id);
666 670
                 }
Please login to merge, or discard this patch.
manager/actions/help/version_notices/1.3.6.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 ?>
Please login to merge, or discard this patch.
manager/actions/help/version_notices/1.4.1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 ?>
Please login to merge, or discard this patch.
manager/actions/help/version_notices/1.4.0.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 ?>
Please login to merge, or discard this patch.
manager/includes/log.class.inc.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,7 +105,8 @@  discard block
 block discarded – undo
105 105
         }
106 106
     }
107 107
 
108
-    private function getUserIP() {
108
+    private function getUserIP()
109
+    {
109 110
         if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
110 111
             if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) {
111 112
                 $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
@@ -113,8 +114,7 @@  discard block
 block discarded – undo
113 114
             } else {
114 115
                 return $_SERVER['HTTP_X_FORWARDED_FOR'];
115 116
             }
116
-        }
117
-        else {
117
+        } else {
118 118
             return $_SERVER['REMOTE_ADDR'];
119 119
         }
120 120
     }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
         $action = "",
37 37
         $itemid = "",
38 38
         $itemname = ""
39
-    ) {
39
+    ){
40 40
         $modx = evolutionCMS();
41 41
         $this->entry['msg'] = $msg; // writes testmessage to the object
42
-        $this->entry['action'] = empty($action) ? $modx->manager->action : $action;    // writes the action to the object
42
+        $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object
43 43
 
44 44
         // User Credentials
45 45
         $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey;
46 46
         $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username;
47 47
 
48
-        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid;  // writes the id to the object
48
+        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object
49 49
         if ($this->entry['itemId'] == 0) {
50 50
             $this->entry['itemId'] = "-";
51 51
         } // to stop items having id 0
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
             
97 97
         $insert_id = $modx->db->insert($fields, $tbl_manager_log);
98 98
         if (!$insert_id) {
99
-            $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError());
99
+            $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError());
100 100
         } else {
101
-            $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000;
102
-            $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100;
101
+            $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000;
102
+            $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100;
103 103
             if (($insert_id % $trim) === 0) {
104 104
                 $modx->rotate_log('manager_log', $limit, $trim);
105 105
             }
106 106
         }
107 107
     }
108 108
 
109
-    private function getUserIP() {
110
-        if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
111
-            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) {
112
-                $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
109
+    private function getUserIP(){
110
+        if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
111
+            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) {
112
+                $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
113 113
                 return trim($addr[0]);
114 114
             } else {
115 115
                 return $_SERVER['HTTP_X_FORWARDED_FOR'];
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 3 patches
Indentation   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
3
+    die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8 8
 if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9
-	// seems to be a new install - send the user to the configuration page
10
-	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
9
+    // seems to be a new install - send the user to the configuration page
10
+    exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
12 12
 
13 13
 // set placeholders
@@ -17,92 +17,92 @@  discard block
 block discarded – undo
17 17
 
18 18
 // setup message info
19 19
 if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
-	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
-	$_SESSION['nrnewmessages'] = $nrnewmessages;
23
-
24
-	$msg = array();
25
-	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
-	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
-	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
-	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
-	$ph['MessageInfo'] = implode("\n", $msg);
20
+    include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
+    $_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
+    $_SESSION['nrnewmessages'] = $nrnewmessages;
23
+
24
+    $msg = array();
25
+    $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
+    $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
+    $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
+    $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
+    $ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35 35
 if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
-	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
-	$ph['SecurityIcon'] = wrapIcon($icon, 75);
36
+    $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
+    $ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39 39
 if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
-	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
-	$ph['WebUserIcon'] = wrapIcon($icon, 99);
40
+    $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
+    $ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43 43
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
-	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
-	$ph['ModulesIcon'] = wrapIcon($icon, 106);
44
+    $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
+    $ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47 47
 if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48
-	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
-	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
48
+    $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
+    $ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51 51
 if($modx->hasPermission('bk_manager')) {
52
-	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
-	$ph['BackupIcon'] = wrapIcon($icon, 93);
52
+    $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
+    $ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55 55
 if($modx->hasPermission('help')) {
56
-	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
-	$ph['HelpIcon'] = wrapIcon($icon, 9);
56
+    $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
+    $ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 
60 60
 if($modx->hasPermission('new_document')) {
61
-	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62
-	$ph['ResourceIcon'] = wrapIcon($icon, 4);
63
-	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64
-	$ph['WeblinkIcon'] = wrapIcon($icon, 72);
61
+    $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62
+    $ph['ResourceIcon'] = wrapIcon($icon, 4);
63
+    $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64
+    $ph['WeblinkIcon'] = wrapIcon($icon, 72);
65 65
 }
66 66
 if($modx->hasPermission('assets_images')) {
67
-	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68
-	$ph['ImagesIcon'] = wrapIcon($icon, 72);
67
+    $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68
+    $ph['ImagesIcon'] = wrapIcon($icon, 72);
69 69
 }
70 70
 if($modx->hasPermission('assets_files')) {
71
-	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72
-	$ph['FilesIcon'] = wrapIcon($icon, 72);
71
+    $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72
+    $ph['FilesIcon'] = wrapIcon($icon, 72);
73 73
 }
74 74
 if($modx->hasPermission('change_password')) {
75
-	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76
-	$ph['PasswordIcon'] = wrapIcon($icon, 28);
75
+    $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76
+    $ph['PasswordIcon'] = wrapIcon($icon, 28);
77 77
 }
78 78
 $icon = '<i class="[&icons_logout_large&]"></i>[%logout%]';
79 79
 $ph['LogoutIcon'] = wrapIcon($icon, 8);
80 80
 
81 81
 // do some config checks
82 82
 if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
85
-		$ph['config_check_results'] = $config_check_results;
86
-		$ph['config_display'] = 'block';
87
-	} else {
88
-		$ph['config_display'] = 'none';
89
-	}
83
+    include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
+    if($config_check_results != $_lang['configcheck_ok']) {
85
+        $ph['config_check_results'] = $config_check_results;
86
+        $ph['config_display'] = 'block';
87
+    } else {
88
+        $ph['config_display'] = 'none';
89
+    }
90 90
 } else {
91
-	$ph['config_display'] = 'none';
91
+    $ph['config_display'] = 'none';
92 92
 }
93 93
 
94 94
 // Check logout-reminder
95 95
 if(isset($_SESSION['show_logout_reminder'])) {
96
-	switch($_SESSION['show_logout_reminder']['type']) {
97
-		case 'logout_reminder':
98
-			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99
-			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
100
-			break;
101
-	}
102
-	$ph['show_logout_reminder'] = 'block';
103
-	unset($_SESSION['show_logout_reminder']);
96
+    switch($_SESSION['show_logout_reminder']['type']) {
97
+        case 'logout_reminder':
98
+            $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99
+            $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
100
+            break;
101
+    }
102
+    $ph['show_logout_reminder'] = 'block';
103
+    unset($_SESSION['show_logout_reminder']);
104 104
 } else {
105
-	$ph['show_logout_reminder'] = 'none';
105
+    $ph['show_logout_reminder'] = 'none';
106 106
 }
107 107
 
108 108
 // Check multiple sessions
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
151 151
 
152 152
 $ph['UserInfo'] = $modx->parseText($tpl, array(
153
-	'username' => $modx->getLoginUserName(),
154
-	'role' => $_SESSION['mgrPermissions']['name'],
155
-	'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
156
-	'logincount' => $_SESSION['mgrLogincount'] + 1,
157
-	'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
153
+    'username' => $modx->getLoginUserName(),
154
+    'role' => $_SESSION['mgrPermissions']['name'],
155
+    'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
156
+    'logincount' => $_SESSION['mgrLogincount'] + 1,
157
+    'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
158 158
 ));
159 159
 
160 160
 $from = array();
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
164 164
 
165 165
 if($modx->db->getRecordCount($rs) < 1) {
166
-	$html = '<p>[%no_active_users_found%]</p>';
166
+    $html = '<p>[%no_active_users_found%]</p>';
167 167
 } else {
168
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169
-	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170
-	$ph['now'] = strftime('%H:%M:%S', $now);
171
-	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
172
-	$html = '
168
+    include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169
+    $now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170
+    $ph['now'] = strftime('%H:%M:%S', $now);
171
+    $timetocheck = ($now - (60 * 20)); //+$server_offset_time;
172
+    $html = '
173 173
 	<div class="card-body">
174 174
 		[%onlineusers_message%] 
175 175
 		<b>[+now+]</b>):
@@ -187,33 +187,33 @@  discard block
 block discarded – undo
187 187
 	</thead>
188 188
 	<tbody>';
189 189
 
190
-	$userList = array();
191
-	$userCount = array();
192
-	// Create userlist with session-count first before output
193
-	while($activeusers = $modx->db->getRow($rs)) {
194
-		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195
-
196
-		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
197
-		$webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
198
-		$ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
199
-		$currentaction = getAction($activeusers['action'], $activeusers['id']);
200
-		$userList[] = array(
201
-			$idle,
202
-			'',
203
-			$activeusers['username'],
204
-			$webicon,
205
-			abs($activeusers['internalKey']),
206
-			$ip,
207
-			strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
208
-			$currentaction
209
-		);
210
-	}
211
-	foreach($userList as $params) {
212
-		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214
-	}
215
-
216
-	$html .= '
190
+    $userList = array();
191
+    $userCount = array();
192
+    // Create userlist with session-count first before output
193
+    while($activeusers = $modx->db->getRow($rs)) {
194
+        $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195
+
196
+        $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
197
+        $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
198
+        $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
199
+        $currentaction = getAction($activeusers['action'], $activeusers['id']);
200
+        $userList[] = array(
201
+            $idle,
202
+            '',
203
+            $activeusers['username'],
204
+            $webicon,
205
+            abs($activeusers['internalKey']),
206
+            $ip,
207
+            strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
208
+            $currentaction
209
+        );
210
+    }
211
+    foreach($userList as $params) {
212
+        $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213
+        $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214
+    }
215
+
216
+    $html .= '
217 217
 	</tbody>
218 218
 	</table>
219 219
 </div>
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 // invoke event OnManagerWelcomePrerender
255 255
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
256 256
 if(is_array($evtOut)) {
257
-	$output = implode('', $evtOut);
258
-	$ph['OnManagerWelcomePrerender'] = $output;
257
+    $output = implode('', $evtOut);
258
+    $ph['OnManagerWelcomePrerender'] = $output;
259 259
 }
260 260
 
261 261
 $widgets['welcome'] = array(
262
-	'menuindex' => '10',
263
-	'id' => 'welcome',
264
-	'cols' => 'col-lg-6',
265
-	'icon' => 'fa-home',
266
-	'title' => '[%welcome_title%]',
267
-	'body' => '
262
+    'menuindex' => '10',
263
+    'id' => 'welcome',
264
+    'cols' => 'col-lg-6',
265
+    'icon' => 'fa-home',
266
+    'title' => '[%welcome_title%]',
267
+    'body' => '
268 268
 				<div class="wm_buttons card-body"> 
269 269
 					<!--@IF:[[#hasPermission?key=new_document]]--> 
270 270
 					<span class="wm_button">
@@ -338,25 +338,25 @@  discard block
 block discarded – undo
338 338
 					</table>
339 339
 				</div>
340 340
 		',
341
-	'hide'=>'0'
341
+    'hide'=>'0'
342 342
 );
343 343
 $widgets['onlineinfo'] = array(
344
-	'menuindex' => '20',
345
-	'id' => 'onlineinfo',
346
-	'cols' => 'col-lg-6',
347
-	'icon' => 'fa-user',
348
-	'title' => '[%onlineusers_title%]',
349
-	'body' => '<div class="userstable">[+OnlineInfo+]</div>',
350
-	'hide'=>'0'
344
+    'menuindex' => '20',
345
+    'id' => 'onlineinfo',
346
+    'cols' => 'col-lg-6',
347
+    'icon' => 'fa-user',
348
+    'title' => '[%onlineusers_title%]',
349
+    'body' => '<div class="userstable">[+OnlineInfo+]</div>',
350
+    'hide'=>'0'
351 351
 );
352 352
 $widgets['recentinfo'] = array(
353
-	'menuindex' => '30',
354
-	'id' => 'modxrecent_widget',
355
-	'cols' => 'col-sm-12',
356
-	'icon' => 'fa-pencil-square-o',
357
-	'title' => '[%activity_title%]',
358
-	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359
-	'hide'=>'0'
353
+    'menuindex' => '30',
354
+    'id' => 'modxrecent_widget',
355
+    'cols' => 'col-sm-12',
356
+    'icon' => 'fa-pencil-square-o',
357
+    'title' => '[%activity_title%]',
358
+    'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359
+    'hide'=>'0'
360 360
 );
361 361
 if ($modx->config['rss_url_news']) {
362 362
     $widgets['news'] = array(
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 // invoke OnManagerWelcomeHome event
385 385
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
386 386
 if(is_array($sitewidgets)) {
387
-	$newwidgets = array();
387
+    $newwidgets = array();
388 388
     foreach($sitewidgets as $widget){
389 389
         $newwidgets = array_merge($newwidgets, unserialize($widget));
390 390
     }
@@ -392,21 +392,21 @@  discard block
 block discarded – undo
392 392
 }
393 393
 
394 394
 usort($widgets, function ($a, $b) {
395
-	return $a['menuindex'] - $b['menuindex'];
395
+    return $a['menuindex'] - $b['menuindex'];
396 396
 });
397 397
 
398 398
 $tpl = getTplWidget();
399 399
 $output = '';
400 400
 foreach($widgets as $widget) {
401
-	if ($widget['hide'] != '1'){
402
-		$output .= $modx->parseText($tpl, $widget);
403
-	}
401
+    if ($widget['hide'] != '1'){
402
+        $output .= $modx->parseText($tpl, $widget);
403
+    }
404 404
 }
405 405
 $ph['widgets'] = $output;
406 406
 
407 407
 // load template
408 408
 if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
409
+    $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
410 410
 }
411 411
 
412 412
 $target = $modx->config['manager_welcome_tpl'];
@@ -414,27 +414,27 @@  discard block
 block discarded – undo
414 414
 $target = $modx->mergeSettingsContent($target);
415 415
 
416 416
 if(substr($target, 0, 1) === '@') {
417
-	if(substr($target, 0, 6) === '@CHUNK') {
418
-		$content = $modx->getChunk(trim(substr($target, 7)));
419
-	} elseif(substr($target, 0, 5) === '@FILE') {
420
-		$content = file_get_contents(trim(substr($target, 6)));
421
-	} else {
422
-		$content = '';
423
-	}
417
+    if(substr($target, 0, 6) === '@CHUNK') {
418
+        $content = $modx->getChunk(trim(substr($target, 7)));
419
+    } elseif(substr($target, 0, 5) === '@FILE') {
420
+        $content = file_get_contents(trim(substr($target, 6)));
421
+    } else {
422
+        $content = '';
423
+    }
424 424
 } else {
425
-	$chunk = $modx->getChunk($target);
426
-	if($chunk !== false && !empty($chunk)) {
427
-		$content = $chunk;
428
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
429
-		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
433
-	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
-	} else {
436
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437
-	}
425
+    $chunk = $modx->getChunk($target);
426
+    if($chunk !== false && !empty($chunk)) {
427
+        $content = $chunk;
428
+    } elseif(is_file(MODX_BASE_PATH . $target)) {
429
+        $content = file_get_contents(MODX_BASE_PATH . $target);
430
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
433
+    {
434
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
+    } else {
436
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437
+    }
438 438
 }
439 439
 
440 440
 // merge placeholders
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 $content = $modx->mergeSettingsContent($content);
443 443
 $content = $modx->parseText($content, $ph);
444 444
 if(strpos($content, '[+') !== false) {
445
-	$modx->toPlaceholders($ph);
446
-	$content = $modx->mergePlaceholderContent($content);
445
+    $modx->toPlaceholders($ph);
446
+    $content = $modx->mergePlaceholderContent($content);
447 447
 }
448 448
 $content = $modx->parseDocumentSource($content);
449 449
 $content = $modx->parseText($content, $_lang, '[%', '%]');
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 452
 
453 453
 if($js = $modx->getRegisteredClientScripts()) {
454
-	$content .= $js;
454
+    $content .= $js;
455 455
 }
456 456
 
457 457
 echo $content;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 462
 //</span>
463 463
 function getTplWidget() { // recent document info
464
-	return '
464
+    return '
465 465
 		<div class="[+cols+]" id="[+id+]">
466 466
 			<div class="card"[+cardAttr+]>
467 467
 				<div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div>
@@ -472,11 +472,11 @@  discard block
 block discarded – undo
472 472
 }
473 473
 
474 474
 function getRecentInfo() { // recent document info
475
-	$modx = evolutionCMS();
475
+    $modx = evolutionCMS();
476 476
 
477
-	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
477
+    $modx->addSnippet('recentInfoList', 'getRecentInfoList');
478 478
 
479
-	$html = '
479
+    $html = '
480 480
 			<div class="table-responsive">
481 481
 				<table class="table data">
482 482
 					<thead>
@@ -494,96 +494,96 @@  discard block
 block discarded – undo
494 494
 				</table>
495 495
 			</div>
496 496
 ';
497
-	return $html;
497
+    return $html;
498 498
 }
499 499
 
500 500
 function getRecentInfoList() {
501
-	$modx = evolutionCMS();
502
-
503
-	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504
-
505
-	if($modx->db->getRecordCount($rs) < 1) {
506
-		return '<tr><td>[%no_activity_message%]</td></tr>';
507
-	}
508
-
509
-	$tpl = getRecentInfoRowTpl();
510
-
511
-	$btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
512
-	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513
-
514
-	$output = array();
515
-	while($ph = $modx->db->getRow($rs)) {
516
-		$docid = $ph['id'];
517
-		$_ = $modx->getUserInfo($ph['editedby']);
518
-		$ph['username'] = $_['username'];
519
-
520
-		if($ph['deleted'] == 1) {
521
-			$ph['status'] = 'deleted text-danger';
522
-		} elseif($ph['published'] == 0) {
523
-			$ph['status'] = 'unpublished font-italic text-muted';
524
-		} else {
525
-			$ph['status'] = 'published';
526
-		}
527
-
528
-		if($modx->hasPermission('edit_document')) {
529
-			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530
-		} else {
531
-			$ph['edit_btn'] = '';
532
-		}
533
-
534
-		$preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
535
-		$ph['preview_btn'] = str_replace(array(
536
-			'[+id+]',
537
-			'[+preview_disabled+]'
538
-		), array(
539
-			$docid,
540
-			$preview_disabled
541
-		), $btntpl['preview_btn']);
542
-
543
-		if($modx->hasPermission('delete_document')) {
544
-			if($ph['deleted'] == 0) {
545
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546
-			} else {
547
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
548
-			}
549
-			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
550
-		} else {
551
-			$ph['delete_btn'] = '';
552
-		}
553
-
554
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
555
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
557
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
559
-			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560
-		} else {
561
-			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
562
-		}
563
-		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
564
-
565
-		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566
-
567
-		if($ph['longtitle'] == '') {
568
-			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
569
-		}
570
-		if($ph['description'] == '') {
571
-			$ph['description'] = '(<i>[%not_set%]</i>)';
572
-		}
573
-		if($ph['introtext'] == '') {
574
-			$ph['introtext'] = '(<i>[%not_set%]</i>)';
575
-		}
576
-		if($ph['alias'] == '') {
577
-			$ph['alias'] = '(<i>[%not_set%]</i>)';
578
-		}
579
-
580
-		$output[] = $modx->parseText($tpl, $ph);
581
-	}
582
-	return implode("\n", $output);
501
+    $modx = evolutionCMS();
502
+
503
+    $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504
+
505
+    if($modx->db->getRecordCount($rs) < 1) {
506
+        return '<tr><td>[%no_activity_message%]</td></tr>';
507
+    }
508
+
509
+    $tpl = getRecentInfoRowTpl();
510
+
511
+    $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
512
+    $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513
+
514
+    $output = array();
515
+    while($ph = $modx->db->getRow($rs)) {
516
+        $docid = $ph['id'];
517
+        $_ = $modx->getUserInfo($ph['editedby']);
518
+        $ph['username'] = $_['username'];
519
+
520
+        if($ph['deleted'] == 1) {
521
+            $ph['status'] = 'deleted text-danger';
522
+        } elseif($ph['published'] == 0) {
523
+            $ph['status'] = 'unpublished font-italic text-muted';
524
+        } else {
525
+            $ph['status'] = 'published';
526
+        }
527
+
528
+        if($modx->hasPermission('edit_document')) {
529
+            $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530
+        } else {
531
+            $ph['edit_btn'] = '';
532
+        }
533
+
534
+        $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
535
+        $ph['preview_btn'] = str_replace(array(
536
+            '[+id+]',
537
+            '[+preview_disabled+]'
538
+        ), array(
539
+            $docid,
540
+            $preview_disabled
541
+        ), $btntpl['preview_btn']);
542
+
543
+        if($modx->hasPermission('delete_document')) {
544
+            if($ph['deleted'] == 0) {
545
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546
+            } else {
547
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
548
+            }
549
+            $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
550
+        } else {
551
+            $ph['delete_btn'] = '';
552
+        }
553
+
554
+        if($ph['deleted'] == 1 && $ph['published'] == 0) {
555
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
+        } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
557
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
+        } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
559
+            $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560
+        } else {
561
+            $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
562
+        }
563
+        $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
564
+
565
+        $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566
+
567
+        if($ph['longtitle'] == '') {
568
+            $ph['longtitle'] = '(<i>[%not_set%]</i>)';
569
+        }
570
+        if($ph['description'] == '') {
571
+            $ph['description'] = '(<i>[%not_set%]</i>)';
572
+        }
573
+        if($ph['introtext'] == '') {
574
+            $ph['introtext'] = '(<i>[%not_set%]</i>)';
575
+        }
576
+        if($ph['alias'] == '') {
577
+            $ph['alias'] = '(<i>[%not_set%]</i>)';
578
+        }
579
+
580
+        $output[] = $modx->parseText($tpl, $ph);
581
+    }
582
+    return implode("\n", $output);
583 583
 }
584 584
 
585 585
 function getRecentInfoRowTpl() {
586
-	$tpl = '
586
+    $tpl = '
587 587
 						<tr>
588 588
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
589 589
 							<td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&amp;id=[+id+]" target="main">[+pagetitle+]</a></td>
@@ -607,16 +607,16 @@  discard block
 block discarded – undo
607 607
 								</div>
608 608
 							</td>
609 609
 						</tr>';
610
-	return $tpl;
610
+    return $tpl;
611 611
 }
612 612
 
613 613
 // setup icons
614 614
 function wrapIcon($i, $action) {
615
-	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
615
+    return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
616 616
 }
617 617
 
618 618
 function getStartUpScript() {
619
-	$script = '
619
+    $script = '
620 620
         <script type="text/javascript">
621 621
         function hideConfigCheckWarning(key) {
622 622
         	var xhr = new XMLHttpRequest();
@@ -640,5 +640,5 @@  discard block
 block discarded – undo
640 640
 		})(jQuery);        
641 641
         </script>
642 642
 ';
643
-	return $script;
643
+    return $script;
644 644
 }
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 25
 	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 27
 	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if ($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if ($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 
60
-if($modx->hasPermission('new_document')) {
60
+if ($modx->hasPermission('new_document')) {
61 61
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62 62
 	$ph['ResourceIcon'] = wrapIcon($icon, 4);
63 63
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64 64
 	$ph['WeblinkIcon'] = wrapIcon($icon, 72);
65 65
 }
66
-if($modx->hasPermission('assets_images')) {
66
+if ($modx->hasPermission('assets_images')) {
67 67
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68 68
 	$ph['ImagesIcon'] = wrapIcon($icon, 72);
69 69
 }
70
-if($modx->hasPermission('assets_files')) {
70
+if ($modx->hasPermission('assets_files')) {
71 71
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72 72
 	$ph['FilesIcon'] = wrapIcon($icon, 72);
73 73
 }
74
-if($modx->hasPermission('change_password')) {
74
+if ($modx->hasPermission('change_password')) {
75 75
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76 76
 	$ph['PasswordIcon'] = wrapIcon($icon, 28);
77 77
 }
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 $ph['LogoutIcon'] = wrapIcon($icon, 8);
80 80
 
81 81
 // do some config checks
82
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
82
+if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
+	include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php');
84
+	if ($config_check_results != $_lang['configcheck_ok']) {
85 85
 		$ph['config_check_results'] = $config_check_results;
86 86
 		$ph['config_display'] = 'block';
87 87
 	} else {
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 }
93 93
 
94 94
 // Check logout-reminder
95
-if(isset($_SESSION['show_logout_reminder'])) {
96
-	switch($_SESSION['show_logout_reminder']['type']) {
95
+if (isset($_SESSION['show_logout_reminder'])) {
96
+	switch ($_SESSION['show_logout_reminder']['type']) {
97 97
 		case 'logout_reminder':
98 98
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99 99
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	</tr>
148 148
 </table>';
149 149
 
150
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
150
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
151 151
 
152 152
 $ph['UserInfo'] = $modx->parseText($tpl, array(
153 153
 	'username' => $modx->getLoginUserName(),
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
163 163
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
164 164
 
165
-if($modx->db->getRecordCount($rs) < 1) {
165
+if ($modx->db->getRecordCount($rs) < 1) {
166 166
 	$html = '<p>[%no_active_users_found%]</p>';
167 167
 } else {
168
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
168
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
169 169
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170 170
 	$ph['now'] = strftime('%H:%M:%S', $now);
171 171
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	$userList = array();
191 191
 	$userCount = array();
192 192
 	// Create userlist with session-count first before output
193
-	while($activeusers = $modx->db->getRow($rs)) {
193
+	while ($activeusers = $modx->db->getRow($rs)) {
194 194
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195 195
 
196 196
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 			$currentaction
209 209
 		);
210 210
 	}
211
-	foreach($userList as $params) {
211
+	foreach ($userList as $params) {
212 212
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
213
+		$html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214 214
 	}
215 215
 
216 216
 	$html .= '
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 $ph['OnlineInfo'] = $html;
223 223
 
224 224
 // include rss feeds for important forum topics
225
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
225
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
226 226
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
227 227
 $ph['modx_news_content'] = $feedData['modx_news_content'];
228 228
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 // invoke event OnManagerWelcomePrerender
255 255
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
256
-if(is_array($evtOut)) {
256
+if (is_array($evtOut)) {
257 257
 	$output = implode('', $evtOut);
258 258
 	$ph['OnManagerWelcomePrerender'] = $output;
259 259
 }
@@ -383,57 +383,57 @@  discard block
 block discarded – undo
383 383
 
384 384
 // invoke OnManagerWelcomeHome event
385 385
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
386
-if(is_array($sitewidgets)) {
386
+if (is_array($sitewidgets)) {
387 387
 	$newwidgets = array();
388
-    foreach($sitewidgets as $widget){
388
+    foreach ($sitewidgets as $widget) {
389 389
         $newwidgets = array_merge($newwidgets, unserialize($widget));
390 390
     }
391 391
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
392 392
 }
393 393
 
394
-usort($widgets, function ($a, $b) {
394
+usort($widgets, function($a, $b){
395 395
 	return $a['menuindex'] - $b['menuindex'];
396 396
 });
397 397
 
398 398
 $tpl = getTplWidget();
399 399
 $output = '';
400
-foreach($widgets as $widget) {
401
-	if ($widget['hide'] != '1'){
400
+foreach ($widgets as $widget) {
401
+	if ($widget['hide'] != '1') {
402 402
 		$output .= $modx->parseText($tpl, $widget);
403 403
 	}
404 404
 }
405 405
 $ph['widgets'] = $output;
406 406
 
407 407
 // load template
408
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
408
+if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
+	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl';
410 410
 }
411 411
 
412 412
 $target = $modx->config['manager_welcome_tpl'];
413 413
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
414 414
 $target = $modx->mergeSettingsContent($target);
415 415
 
416
-if(substr($target, 0, 1) === '@') {
417
-	if(substr($target, 0, 6) === '@CHUNK') {
416
+if (substr($target, 0, 1) === '@') {
417
+	if (substr($target, 0, 6) === '@CHUNK') {
418 418
 		$content = $modx->getChunk(trim(substr($target, 7)));
419
-	} elseif(substr($target, 0, 5) === '@FILE') {
419
+	} elseif (substr($target, 0, 5) === '@FILE') {
420 420
 		$content = file_get_contents(trim(substr($target, 6)));
421 421
 	} else {
422 422
 		$content = '';
423 423
 	}
424 424
 } else {
425 425
 	$chunk = $modx->getChunk($target);
426
-	if($chunk !== false && !empty($chunk)) {
426
+	if ($chunk !== false && !empty($chunk)) {
427 427
 		$content = $chunk;
428
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
429
-		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
428
+	} elseif (is_file(MODX_BASE_PATH.$target)) {
429
+		$content = file_get_contents(MODX_BASE_PATH.$target);
430
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
431
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl');
432
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible
433 433
 	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
434
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
435 435
 	} else {
436
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
436
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
437 437
 	}
438 438
 }
439 439
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 $content = $modx->mergeConditionalTagsContent($content);
442 442
 $content = $modx->mergeSettingsContent($content);
443 443
 $content = $modx->parseText($content, $ph);
444
-if(strpos($content, '[+') !== false) {
444
+if (strpos($content, '[+') !== false) {
445 445
 	$modx->toPlaceholders($ph);
446 446
 	$content = $modx->mergePlaceholderContent($content);
447 447
 }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 $content = $modx->parseText($content, $_style, '[&', '&]');
451 451
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 452
 
453
-if($js = $modx->getRegisteredClientScripts()) {
453
+if ($js = $modx->getRegisteredClientScripts()) {
454 454
 	$content .= $js;
455 455
 }
456 456
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
461 461
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 462
 //</span>
463
-function getTplWidget() { // recent document info
463
+function getTplWidget(){ // recent document info
464 464
 	return '
465 465
 		<div class="[+cols+]" id="[+id+]">
466 466
 			<div class="card"[+cardAttr+]>
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 ';
472 472
 }
473 473
 
474
-function getRecentInfo() { // recent document info
474
+function getRecentInfo(){ // recent document info
475 475
 	$modx = evolutionCMS();
476 476
 
477 477
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
 	return $html;
498 498
 }
499 499
 
500
-function getRecentInfoList() {
500
+function getRecentInfoList(){
501 501
 	$modx = evolutionCMS();
502 502
 
503 503
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504 504
 
505
-	if($modx->db->getRecordCount($rs) < 1) {
505
+	if ($modx->db->getRecordCount($rs) < 1) {
506 506
 		return '<tr><td>[%no_activity_message%]</td></tr>';
507 507
 	}
508 508
 
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513 513
 
514 514
 	$output = array();
515
-	while($ph = $modx->db->getRow($rs)) {
515
+	while ($ph = $modx->db->getRow($rs)) {
516 516
 		$docid = $ph['id'];
517 517
 		$_ = $modx->getUserInfo($ph['editedby']);
518 518
 		$ph['username'] = $_['username'];
519 519
 
520
-		if($ph['deleted'] == 1) {
520
+		if ($ph['deleted'] == 1) {
521 521
 			$ph['status'] = 'deleted text-danger';
522
-		} elseif($ph['published'] == 0) {
522
+		} elseif ($ph['published'] == 0) {
523 523
 			$ph['status'] = 'unpublished font-italic text-muted';
524 524
 		} else {
525 525
 			$ph['status'] = 'published';
526 526
 		}
527 527
 
528
-		if($modx->hasPermission('edit_document')) {
528
+		if ($modx->hasPermission('edit_document')) {
529 529
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530 530
 		} else {
531 531
 			$ph['edit_btn'] = '';
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 			$preview_disabled
541 541
 		), $btntpl['preview_btn']);
542 542
 
543
-		if($modx->hasPermission('delete_document')) {
544
-			if($ph['deleted'] == 0) {
543
+		if ($modx->hasPermission('delete_document')) {
544
+			if ($ph['deleted'] == 0) {
545 545
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546 546
 			} else {
547 547
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
 			$ph['delete_btn'] = '';
552 552
 		}
553 553
 
554
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
554
+		if ($ph['deleted'] == 1 && $ph['published'] == 0) {
555 555
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
556
+		} elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
557 557
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
558
+		} elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
559 559
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560 560
 		} else {
561 561
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
@@ -564,16 +564,16 @@  discard block
 block discarded – undo
564 564
 
565 565
 		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566 566
 
567
-		if($ph['longtitle'] == '') {
567
+		if ($ph['longtitle'] == '') {
568 568
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
569 569
 		}
570
-		if($ph['description'] == '') {
570
+		if ($ph['description'] == '') {
571 571
 			$ph['description'] = '(<i>[%not_set%]</i>)';
572 572
 		}
573
-		if($ph['introtext'] == '') {
573
+		if ($ph['introtext'] == '') {
574 574
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
575 575
 		}
576
-		if($ph['alias'] == '') {
576
+		if ($ph['alias'] == '') {
577 577
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
578 578
 		}
579 579
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	return implode("\n", $output);
583 583
 }
584 584
 
585
-function getRecentInfoRowTpl() {
585
+function getRecentInfoRowTpl(){
586 586
 	$tpl = '
587 587
 						<tr>
588 588
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -611,11 +611,11 @@  discard block
 block discarded – undo
611 611
 }
612 612
 
613 613
 // setup icons
614
-function wrapIcon($i, $action) {
614
+function wrapIcon($i, $action){
615 615
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
616 616
 }
617 617
 
618
-function getStartUpScript() {
618
+function getStartUpScript(){
619 619
 	$script = '
620 620
         <script type="text/javascript">
621 621
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
Braces   +81 added lines, -71 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
19
+if($modx->hasPermission('messages')) {
20 20
 	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 
60
-if($modx->hasPermission('new_document')) {
60
+if($modx->hasPermission('new_document')) {
61 61
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62 62
 	$ph['ResourceIcon'] = wrapIcon($icon, 4);
63 63
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64 64
 	$ph['WeblinkIcon'] = wrapIcon($icon, 72);
65 65
 }
66
-if($modx->hasPermission('assets_images')) {
66
+if($modx->hasPermission('assets_images')) {
67 67
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68 68
 	$ph['ImagesIcon'] = wrapIcon($icon, 72);
69 69
 }
70
-if($modx->hasPermission('assets_files')) {
70
+if($modx->hasPermission('assets_files')) {
71 71
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72 72
 	$ph['FilesIcon'] = wrapIcon($icon, 72);
73 73
 }
74
-if($modx->hasPermission('change_password')) {
74
+if($modx->hasPermission('change_password')) {
75 75
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76 76
 	$ph['PasswordIcon'] = wrapIcon($icon, 28);
77 77
 }
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 $ph['LogoutIcon'] = wrapIcon($icon, 8);
80 80
 
81 81
 // do some config checks
82
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
82
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83 83
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
84
+	if($config_check_results != $_lang['configcheck_ok']) {
85 85
 		$ph['config_check_results'] = $config_check_results;
86 86
 		$ph['config_display'] = 'block';
87
-	} else {
87
+	} else {
88 88
 		$ph['config_display'] = 'none';
89 89
 	}
90
-} else {
90
+} else {
91 91
 	$ph['config_display'] = 'none';
92 92
 }
93 93
 
94 94
 // Check logout-reminder
95
-if(isset($_SESSION['show_logout_reminder'])) {
96
-	switch($_SESSION['show_logout_reminder']['type']) {
95
+if(isset($_SESSION['show_logout_reminder'])) {
96
+	switch($_SESSION['show_logout_reminder']['type']) {
97 97
 		case 'logout_reminder':
98 98
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99 99
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	$ph['show_logout_reminder'] = 'block';
103 103
 	unset($_SESSION['show_logout_reminder']);
104
-} else {
104
+} else {
105 105
 	$ph['show_logout_reminder'] = 'none';
106 106
 }
107 107
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
163 163
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
164 164
 
165
-if($modx->db->getRecordCount($rs) < 1) {
165
+if($modx->db->getRecordCount($rs) < 1) {
166 166
 	$html = '<p>[%no_active_users_found%]</p>';
167
-} else {
167
+} else {
168 168
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169 169
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170 170
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	$userList = array();
191 191
 	$userCount = array();
192 192
 	// Create userlist with session-count first before output
193
-	while($activeusers = $modx->db->getRow($rs)) {
193
+	while($activeusers = $modx->db->getRow($rs)) {
194 194
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195 195
 
196 196
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			$currentaction
209 209
 		);
210 210
 	}
211
-	foreach($userList as $params) {
211
+	foreach($userList as $params) {
212 212
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213 213
 		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214 214
 	}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 // invoke event OnManagerWelcomePrerender
255 255
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
256
-if(is_array($evtOut)) {
256
+if(is_array($evtOut)) {
257 257
 	$output = implode('', $evtOut);
258 258
 	$ph['OnManagerWelcomePrerender'] = $output;
259 259
 }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359 359
 	'hide'=>'0'
360 360
 );
361
-if ($modx->config['rss_url_news']) {
361
+if ($modx->config['rss_url_news']) {
362 362
     $widgets['news'] = array(
363 363
         'menuindex' => '40',
364 364
         'id' => 'news',
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         'hide'=>'0'
370 370
     );
371 371
 }
372
-if ($modx->config['rss_url_security']) {
372
+if ($modx->config['rss_url_security']) {
373 373
     $widgets['security'] = array(
374 374
         'menuindex' => '50',
375 375
         'id' => 'security',
@@ -383,29 +383,29 @@  discard block
 block discarded – undo
383 383
 
384 384
 // invoke OnManagerWelcomeHome event
385 385
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
386
-if(is_array($sitewidgets)) {
386
+if(is_array($sitewidgets)) {
387 387
 	$newwidgets = array();
388
-    foreach($sitewidgets as $widget){
388
+    foreach($sitewidgets as $widget) {
389 389
         $newwidgets = array_merge($newwidgets, unserialize($widget));
390 390
     }
391 391
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
392 392
 }
393 393
 
394
-usort($widgets, function ($a, $b) {
394
+usort($widgets, function ($a, $b){
395 395
 	return $a['menuindex'] - $b['menuindex'];
396 396
 });
397 397
 
398 398
 $tpl = getTplWidget();
399 399
 $output = '';
400
-foreach($widgets as $widget) {
401
-	if ($widget['hide'] != '1'){
400
+foreach($widgets as $widget) {
401
+	if ($widget['hide'] != '1') {
402 402
 		$output .= $modx->parseText($tpl, $widget);
403 403
 	}
404 404
 }
405 405
 $ph['widgets'] = $output;
406 406
 
407 407
 // load template
408
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
408
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409 409
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
410 410
 }
411 411
 
@@ -413,26 +413,28 @@  discard block
 block discarded – undo
413 413
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
414 414
 $target = $modx->mergeSettingsContent($target);
415 415
 
416
-if(substr($target, 0, 1) === '@') {
417
-	if(substr($target, 0, 6) === '@CHUNK') {
416
+if(substr($target, 0, 1) === '@') {
417
+	if(substr($target, 0, 6) === '@CHUNK') {
418 418
 		$content = $modx->getChunk(trim(substr($target, 7)));
419
-	} elseif(substr($target, 0, 5) === '@FILE') {
419
+	} elseif(substr($target, 0, 5) === '@FILE') {
420 420
 		$content = file_get_contents(trim(substr($target, 6)));
421
-	} else {
421
+	} else {
422 422
 		$content = '';
423 423
 	}
424
-} else {
424
+} else {
425 425
 	$chunk = $modx->getChunk($target);
426
-	if($chunk !== false && !empty($chunk)) {
426
+	if($chunk !== false && !empty($chunk)) {
427 427
 		$content = $chunk;
428
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
428
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
429 429
 		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
430
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431 431
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
432
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
433
+	    // ClipperCMS compatible
433 434
 	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
-	} else {
435
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
+	}
437
+	} else {
436 438
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437 439
 	}
438 440
 }
@@ -441,7 +443,7 @@  discard block
 block discarded – undo
441 443
 $content = $modx->mergeConditionalTagsContent($content);
442 444
 $content = $modx->mergeSettingsContent($content);
443 445
 $content = $modx->parseText($content, $ph);
444
-if(strpos($content, '[+') !== false) {
446
+if(strpos($content, '[+') !== false) {
445 447
 	$modx->toPlaceholders($ph);
446 448
 	$content = $modx->mergePlaceholderContent($content);
447 449
 }
@@ -450,7 +452,7 @@  discard block
 block discarded – undo
450 452
 $content = $modx->parseText($content, $_style, '[&', '&]');
451 453
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 454
 
453
-if($js = $modx->getRegisteredClientScripts()) {
455
+if($js = $modx->getRegisteredClientScripts()) {
454 456
 	$content .= $js;
455 457
 }
456 458
 
@@ -460,7 +462,9 @@  discard block
 block discarded – undo
460 462
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
461 463
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 464
 //</span>
463
-function getTplWidget() { // recent document info
465
+function getTplWidget()
466
+{
467
+// recent document info
464 468
 	return '
465 469
 		<div class="[+cols+]" id="[+id+]">
466 470
 			<div class="card"[+cardAttr+]>
@@ -471,7 +475,9 @@  discard block
 block discarded – undo
471 475
 ';
472 476
 }
473 477
 
474
-function getRecentInfo() { // recent document info
478
+function getRecentInfo()
479
+{
480
+// recent document info
475 481
 	$modx = evolutionCMS();
476 482
 
477 483
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -497,12 +503,13 @@  discard block
 block discarded – undo
497 503
 	return $html;
498 504
 }
499 505
 
500
-function getRecentInfoList() {
506
+function getRecentInfoList()
507
+{
501 508
 	$modx = evolutionCMS();
502 509
 
503 510
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504 511
 
505
-	if($modx->db->getRecordCount($rs) < 1) {
512
+	if($modx->db->getRecordCount($rs) < 1) {
506 513
 		return '<tr><td>[%no_activity_message%]</td></tr>';
507 514
 	}
508 515
 
@@ -512,22 +519,22 @@  discard block
 block discarded – undo
512 519
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513 520
 
514 521
 	$output = array();
515
-	while($ph = $modx->db->getRow($rs)) {
522
+	while($ph = $modx->db->getRow($rs)) {
516 523
 		$docid = $ph['id'];
517 524
 		$_ = $modx->getUserInfo($ph['editedby']);
518 525
 		$ph['username'] = $_['username'];
519 526
 
520
-		if($ph['deleted'] == 1) {
527
+		if($ph['deleted'] == 1) {
521 528
 			$ph['status'] = 'deleted text-danger';
522
-		} elseif($ph['published'] == 0) {
529
+		} elseif($ph['published'] == 0) {
523 530
 			$ph['status'] = 'unpublished font-italic text-muted';
524
-		} else {
531
+		} else {
525 532
 			$ph['status'] = 'published';
526 533
 		}
527 534
 
528
-		if($modx->hasPermission('edit_document')) {
535
+		if($modx->hasPermission('edit_document')) {
529 536
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530
-		} else {
537
+		} else {
531 538
 			$ph['edit_btn'] = '';
532 539
 		}
533 540
 
@@ -540,40 +547,40 @@  discard block
 block discarded – undo
540 547
 			$preview_disabled
541 548
 		), $btntpl['preview_btn']);
542 549
 
543
-		if($modx->hasPermission('delete_document')) {
544
-			if($ph['deleted'] == 0) {
550
+		if($modx->hasPermission('delete_document')) {
551
+			if($ph['deleted'] == 0) {
545 552
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546
-			} else {
553
+			} else {
547 554
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
548 555
 			}
549 556
 			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
550
-		} else {
557
+		} else {
551 558
 			$ph['delete_btn'] = '';
552 559
 		}
553 560
 
554
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
561
+		if($ph['deleted'] == 1 && $ph['published'] == 0) {
555 562
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
563
+		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
557 564
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
565
+		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
559 566
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560
-		} else {
567
+		} else {
561 568
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
562 569
 		}
563 570
 		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
564 571
 
565 572
 		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566 573
 
567
-		if($ph['longtitle'] == '') {
574
+		if($ph['longtitle'] == '') {
568 575
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
569 576
 		}
570
-		if($ph['description'] == '') {
577
+		if($ph['description'] == '') {
571 578
 			$ph['description'] = '(<i>[%not_set%]</i>)';
572 579
 		}
573
-		if($ph['introtext'] == '') {
580
+		if($ph['introtext'] == '') {
574 581
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
575 582
 		}
576
-		if($ph['alias'] == '') {
583
+		if($ph['alias'] == '') {
577 584
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
578 585
 		}
579 586
 
@@ -582,7 +589,8 @@  discard block
 block discarded – undo
582 589
 	return implode("\n", $output);
583 590
 }
584 591
 
585
-function getRecentInfoRowTpl() {
592
+function getRecentInfoRowTpl()
593
+{
586 594
 	$tpl = '
587 595
 						<tr>
588 596
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -611,11 +619,13 @@  discard block
 block discarded – undo
611 619
 }
612 620
 
613 621
 // setup icons
614
-function wrapIcon($i, $action) {
622
+function wrapIcon($i, $action)
623
+{
615 624
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
616 625
 }
617 626
 
618
-function getStartUpScript() {
627
+function getStartUpScript()
628
+{
619 629
 	$script = '
620 630
         <script type="text/javascript">
621 631
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.