Completed
Pull Request — develop (#522)
by Agel_Nash
07:16
created
manager/processors/delete_category.processor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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
 if (!$modx->hasPermission('save_plugin') && !$modx->hasPermission('save_snippet') && !$modx->hasPermission('save_template') && !$modx->hasPermission('save_module')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['catId'])? intval($_GET['catId']) : 0;
10
-if ($id==0) {
9
+$id = isset($_GET['catId']) ? intval($_GET['catId']) : 0;
10
+if ($id == 0) {
11 11
     $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
@@ -19,5 +19,5 @@  discard block
 block discarded – undo
19 19
 deleteCategory($id);
20 20
 
21 21
 // finished emptying cache - redirect
22
-$header="Location: index.php?a=76";
22
+$header = "Location: index.php?a=76";
23 23
 header($header);
Please login to merge, or discard this patch.
manager/processors/delete_snippet.processor.php 2 patches
Indentation   +8 added lines, -8 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('delete_snippet')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? intval($_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
 // Set the item name for logger
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforeSnipFormDelete event
19 19
 $modx->invokeEvent("OnBeforeSnipFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the snippet.
25 25
 $modx->db->delete($modx->getFullTableName('site_snippets'), "id='{$id}'");
26 26
 
27 27
 // invoke OnSnipFormDelete event
28 28
 $modx->invokeEvent("OnSnipFormDelete",
29
-	array(
30
-		"id"	=> $id
31
-	));
29
+    array(
30
+        "id"	=> $id
31
+    ));
32 32
 
33 33
 // empty cache
34 34
 $modx->clearCache('full');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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('delete_snippet')) {
5
+if (!$modx->hasPermission('delete_snippet')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
@@ -34,5 +34,5 @@  discard block
 block discarded – undo
34 34
 $modx->clearCache('full');
35 35
 
36 36
 // finished emptying cache - redirect
37
-$header="Location: index.php?a=76&r=2";
37
+$header = "Location: index.php?a=76&r=2";
38 38
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_plugin.processor.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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
 if (!$modx->hasPermission('save_plugin')) {
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
25 25
     $categoryid = 0;
26 26
 } else {
27
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
27
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
28 28
     $categoryid = getCategory($_POST['newcategory']);
29 29
 }
30 30
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
     $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid;
41 41
 
42 42
     $description = isset($parsed['description']) ? $parsed['description'] : $description;
43
-    $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : '';
43
+    $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : '';
44 44
     if ($version) {
45
-        $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
45
+        $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
46 46
     }
47 47
     if (isset($parsed['modx_category'])) {
48
-        include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
48
+        include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
49 49
         $categoryid = getCategory($parsed['modx_category']);
50 50
     }
51 51
 }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         // finished emptying cache - redirect
104 104
         if ($_POST['stay'] != '') {
105 105
             $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101';
106
-            $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay'];
106
+            $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay'];
107 107
             header($header);
108 108
         } else {
109 109
             $header = 'Location: index.php?a=76&r=2';
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // finished emptying cache - redirect
159 159
         if ($_POST['stay'] != '') {
160 160
             $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101';
161
-            $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay'];
161
+            $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay'];
162 162
             header($header);
163 163
         } else {
164 164
             $modx->unlockElement(5, $id);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     // save selected system events
178 178
     $formEventList = array();
179 179
     foreach ($sysevents as $evtId) {
180
-        if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId);
180
+        if (!preg_match('@^[1-9][0-9]*$@', $evtId)) $evtId = getEventIdByName($evtId);
181 181
         if ($mode == '101') {
182 182
             $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'");
183 183
         } else {
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
     $rs = $modx->db->select('*', '[+prefix+]site_plugin_events', sprintf("pluginid='%s'", $id));
203 203
     $dbEventList = array();
204 204
     $del = array();
205
-    while($row = $modx->db->getRow($rs)) {
206
-        if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid'];
205
+    while ($row = $modx->db->getRow($rs)) {
206
+        if (!in_array($row['evtid'], $evtids)) $del[] = $row['evtid'];
207 207
     }
208 208
 
209
-    if(!$del) return;
209
+    if (!$del) return;
210 210
 
211
-    foreach($del as $delid) {
211
+    foreach ($del as $delid) {
212 212
         $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id));
213 213
     }
214 214
 }
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 function getEventIdByName($name)
217 217
 {
218 218
     global $modx;
219
-    static $eventIds=array();
219
+    static $eventIds = array();
220 220
 
221
-    if(isset($eventIds[$name])) return $eventIds[$name];
221
+    if (isset($eventIds[$name])) return $eventIds[$name];
222 222
 
223 223
     $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames');
224 224
     while ($row = $modx->db->getRow($rs)) {
Please login to merge, or discard this patch.
manager/processors/delete_role.processor.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,22 +3,22 @@
 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('delete_role')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? intval($_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
 if($id==1){
15
-	$modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!");
15
+    $modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!");
16 16
 }
17 17
 
18 18
 $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_attributes'), "role='{$id}'");
19 19
 $count=$modx->db->getValue($rs);
20 20
 if($count>0){
21
-	$modx->webAlertAndQuit("There are users with this role. It can't be deleted.");
21
+    $modx->webAlertAndQuit("There are users with this role. It can't be deleted.");
22 22
 }
23 23
 
24 24
 // Set the item name for logger
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  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('delete_role')) {
5
+if (!$modx->hasPermission('delete_role')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14
-if($id==1){
14
+if ($id == 1) {
15 15
 	$modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!");
16 16
 }
17 17
 
18 18
 $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_attributes'), "role='{$id}'");
19
-$count=$modx->db->getValue($rs);
20
-if($count>0){
19
+$count = $modx->db->getValue($rs);
20
+if ($count > 0) {
21 21
 	$modx->webAlertAndQuit("There are users with this role. It can't be deleted.");
22 22
 }
23 23
 
@@ -28,5 +28,5 @@  discard block
 block discarded – undo
28 28
 // delete the attributes
29 29
 $modx->db->delete($modx->getFullTableName('user_roles'), "id='{$id}'");
30 30
 
31
-$header="Location: index.php?a=86";
31
+$header = "Location: index.php?a=86";
32 32
 header($header);
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14
-if($id==1){
14
+if($id==1) {
15 15
 	$modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!");
16 16
 }
17 17
 
18 18
 $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_attributes'), "role='{$id}'");
19 19
 $count=$modx->db->getValue($rs);
20
-if($count>0){
20
+if($count>0) {
21 21
 	$modx->webAlertAndQuit("There are users with this role. It can't be deleted.");
22 22
 }
23 23
 
Please login to merge, or discard this patch.
manager/processors/save_snippet.processor.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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
 if (!$modx->hasPermission('save_snippet')) {
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
38 38
     $categoryid = 0;
39 39
 } else {
40
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
40
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
41 41
     $categoryid = checkCategory($_POST['newcategory']);
42 42
     if (!$categoryid) {
43 43
         $categoryid = newCategory($_POST['newcategory']);
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
     $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid;
56 56
 
57 57
     $description = isset($parsed['description']) ? $parsed['description'] : $description;
58
-    $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : '';
58
+    $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : '';
59 59
     if ($version) {
60
-        $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
60
+        $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
61 61
     }
62 62
     if (isset($parsed['modx_category'])) {
63
-        include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
63
+        include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
64 64
         $categoryid = getCategory($parsed['modx_category']);
65 65
     }
66 66
 }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         // finished emptying cache - redirect
112 112
         if ($_POST['stay'] != '') {
113 113
             $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23";
114
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
114
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
115 115
             header($header);
116 116
         } else {
117 117
             $header = "Location: index.php?a=76&r=2";
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // finished emptying cache - redirect
164 164
         if ($_POST['stay'] != '') {
165 165
             $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23";
166
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
166
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
167 167
             header($header);
168 168
         } else {
169 169
             $modx->unlockElement(4, $id);
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 3 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  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('settings')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 $data = $_POST;
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
@@ -11,41 +11,41 @@  discard block
 block discarded – undo
11 11
 
12 12
 if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
13 13
 {
14
-	$htaccess        = $modx->config['base_path'] . '.htaccess';
15
-	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16
-	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
18
-	{
19
-		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
21
-		{
22
-			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23
-		}
24
-		elseif(is_writable($htaccess))
25
-		{
26
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
28
-			{
29
-				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30
-			}
31
-		}
32
-	}
33
-	elseif(is_file($sample_htaccess))
34
-	{
35
-		if(!@rename($sample_htaccess,$htaccess))
14
+    $htaccess        = $modx->config['base_path'] . '.htaccess';
15
+    $sample_htaccess = $modx->config['base_path'] . 'ht.access';
16
+    $dir = '/' . trim($modx->config['base_url'],'/');
17
+    if(is_file($htaccess))
18
+    {
19
+        $_ = file_get_contents($htaccess);
20
+        if(strpos($_,'RewriteBase')===false)
36 21
         {
37
-        	$warnings[] = $_lang["settings_friendlyurls_alert"];
38
-		}
39
-		elseif($modx->config['base_url']!=='/')
40
-		{
41
-			$_ = file_get_contents($htaccess);
42
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
44
-			{
45
-				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46
-			}
47
-		}
48
-	}
22
+            $warnings[] = $_lang["settings_friendlyurls_alert2"];
23
+        }
24
+        elseif(is_writable($htaccess))
25
+        {
26
+            $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
+            if(!@file_put_contents($htaccess,$_))
28
+            {
29
+                $warnings[] = $_lang["settings_friendlyurls_alert2"];
30
+            }
31
+        }
32
+    }
33
+    elseif(is_file($sample_htaccess))
34
+    {
35
+        if(!@rename($sample_htaccess,$htaccess))
36
+        {
37
+            $warnings[] = $_lang["settings_friendlyurls_alert"];
38
+        }
39
+        elseif($modx->config['base_url']!=='/')
40
+        {
41
+            $_ = file_get_contents($htaccess);
42
+            $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
+            if(!@file_put_contents($htaccess,$_))
44
+            {
45
+                $warnings[] = $_lang["settings_friendlyurls_alert2"];
46
+            }
47
+        }
48
+    }
49 49
 }
50 50
 
51 51
 if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 $data['rb_base_dir']      = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']);
57 57
 
58 58
 if (isset($data) && count($data) > 0) {
59
-	if(isset($data['manager_language'])) {
60
-		$lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
-		if(is_file($lang_path)) {
62
-			include($lang_path);
59
+    if(isset($data['manager_language'])) {
60
+        $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
+        if(is_file($lang_path)) {
62
+            include($lang_path);
63 63
             global $modx_lang_attribute;
64 64
             $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
65
-		}
66
-	}
67
-	$savethese = array();
68
-	$data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']);
69
-	$data['mail_check_timeperiod'] = intval($data['mail_check_timeperiod']) < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70
-	foreach ($data as $k => $v) {
71
-		switch ($k) {
65
+        }
66
+    }
67
+    $savethese = array();
68
+    $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']);
69
+    $data['mail_check_timeperiod'] = intval($data['mail_check_timeperiod']) < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70
+    foreach ($data as $k => $v) {
71
+        switch ($k) {
72 72
             case 'settings_version':{
73 73
                 if($modx->getVersionData('version')!=$data['settings_version']){
74 74
                     $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
                 }
77 77
                 break;
78 78
             }
79
-			case 'error_page':
80
-			case 'unauthorized_page':
81
-			if (trim($v) == '' || !is_numeric($v)) {
82
-				$v = $data['site_start'];
83
-			}
84
-			break;
79
+            case 'error_page':
80
+            case 'unauthorized_page':
81
+            if (trim($v) == '' || !is_numeric($v)) {
82
+                $v = $data['site_start'];
83
+            }
84
+            break;
85 85
 
86
-			case 'lst_custom_contenttype':
87
-			case 'txt_custom_contenttype':
88
-				// Skip these
89
-				$k = '';
90
-				break;
91
-			case 'rb_base_dir':
92
-			case 'rb_base_url':
93
-			case 'filemanager_path':
94
-				$v = trim($v);
95
-				$v = rtrim($v,'/') . '/';
96
-				break;
86
+            case 'lst_custom_contenttype':
87
+            case 'txt_custom_contenttype':
88
+                // Skip these
89
+                $k = '';
90
+                break;
91
+            case 'rb_base_dir':
92
+            case 'rb_base_url':
93
+            case 'filemanager_path':
94
+                $v = trim($v);
95
+                $v = rtrim($v,'/') . '/';
96
+                break;
97 97
             case 'manager_language':
98 98
                 $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang');
99 99
                 $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php');
@@ -101,56 +101,56 @@  discard block
 block discarded – undo
101 101
                 if($langDir !== $langFileDir || !file_exists($langFile)) {
102 102
                     $v = 'english';
103 103
                 }
104
-				break;
105
-			case 'smtppw':
106
-				if ($v !== '********************' && $v !== '') {
107
-					$v = trim($v);
108
-					$v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
-					$v = str_replace('=','%',$v);
110
-				} elseif ($v === '********************') {
111
-					$k = '';
112
-				}
113
-				break;
104
+                break;
105
+            case 'smtppw':
106
+                if ($v !== '********************' && $v !== '') {
107
+                    $v = trim($v);
108
+                    $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
+                    $v = str_replace('=','%',$v);
110
+                } elseif ($v === '********************') {
111
+                    $k = '';
112
+                }
113
+                break;
114 114
             case 'valid_hostnames':
115
-				$v = str_replace(array(' ,', ', '), ',', $v);
116
-				if ($v !== ',') {
117
-					$v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : '';
118
-					$configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n";
119
-					@file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString);
120
-				}
121
-				$k = '';
122
-				break;
123
-			case 'session_timeout':
124
-				$mail_check_timeperiod = $data['mail_check_timeperiod'];
125
-				$v = intval($v) < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
126
-				break;
127
-			default:
128
-			break;
129
-		}
130
-		$v = is_array($v) ? implode(",", $v) : $v;
115
+                $v = str_replace(array(' ,', ', '), ',', $v);
116
+                if ($v !== ',') {
117
+                    $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : '';
118
+                    $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n";
119
+                    @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString);
120
+                }
121
+                $k = '';
122
+                break;
123
+            case 'session_timeout':
124
+                $mail_check_timeperiod = $data['mail_check_timeperiod'];
125
+                $v = intval($v) < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
126
+                break;
127
+            default:
128
+            break;
129
+        }
130
+        $v = is_array($v) ? implode(",", $v) : $v;
131 131
 
132
-		$modx->config[$k] = $v;
132
+        $modx->config[$k] = $v;
133 133
 
134
-		if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
135
-	}
134
+        if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
135
+    }
136 136
 
137
-	// Run a single query to save all the values
138
-	$sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value)
137
+    // Run a single query to save all the values
138
+    $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value)
139 139
 		VALUES ".implode(', ', $savethese);
140
-	$modx->db->query($sql);
140
+    $modx->db->query($sql);
141 141
 
142
-	// Reset Template Pages
143
-	if (isset($data['reset_template'])) {
144
-		$newtemplate = intval($data['default_template']);
145
-		$oldtemplate = intval($data['old_template']);
146
-		$tbl = $modx->getFullTableName('site_content');
147
-		$reset = $data['reset_template'];
148
-		if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
149
-		else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
150
-	}
142
+    // Reset Template Pages
143
+    if (isset($data['reset_template'])) {
144
+        $newtemplate = intval($data['default_template']);
145
+        $oldtemplate = intval($data['old_template']);
146
+        $tbl = $modx->getFullTableName('site_content');
147
+        $reset = $data['reset_template'];
148
+        if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
149
+        else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
150
+    }
151 151
 
152
-	// empty cache
153
-	$modx->clearCache('full');
152
+    // empty cache
153
+    $modx->clearCache('full');
154 154
 }
155 155
 $header="Location: index.php?a=7&r=10";
156 156
 header($header);
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@  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('settings')) {
5
+if (!$modx->hasPermission('settings')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 $data = $_POST;
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
10 10
 unset($_POST);
11 11
 
12
-if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
12
+if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false)
13 13
 {
14
-	$htaccess        = $modx->config['base_path'] . '.htaccess';
15
-	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16
-	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
14
+	$htaccess        = $modx->config['base_path'].'.htaccess';
15
+	$sample_htaccess = $modx->config['base_path'].'ht.access';
16
+	$dir = '/'.trim($modx->config['base_url'], '/');
17
+	if (is_file($htaccess))
18 18
 	{
19 19
 		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
20
+		if (strpos($_, 'RewriteBase') === false)
21 21
 		{
22 22
 			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23 23
 		}
24
-		elseif(is_writable($htaccess))
24
+		elseif (is_writable($htaccess))
25 25
 		{
26
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
26
+			$_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_);
27
+			if (!@file_put_contents($htaccess, $_))
28 28
 			{
29 29
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30 30
 			}
31 31
 		}
32 32
 	}
33
-	elseif(is_file($sample_htaccess))
33
+	elseif (is_file($sample_htaccess))
34 34
 	{
35
-		if(!@rename($sample_htaccess,$htaccess))
35
+		if (!@rename($sample_htaccess, $htaccess))
36 36
         {
37 37
         	$warnings[] = $_lang["settings_friendlyurls_alert"];
38 38
 		}
39
-		elseif($modx->config['base_url']!=='/')
39
+		elseif ($modx->config['base_url'] !== '/')
40 40
 		{
41 41
 			$_ = file_get_contents($htaccess);
42
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
42
+			$_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_);
43
+			if (!@file_put_contents($htaccess, $_))
44 44
 			{
45 45
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46 46
 			}
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 }
50 50
 
51
-if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
52
-    unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css');
51
+if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
52
+    unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css');
53 53
 }
54 54
 
55
-$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']);
56
-$data['rb_base_dir']      = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']);
55
+$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']);
56
+$data['rb_base_dir']      = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']);
57 57
 
58 58
 if (isset($data) && count($data) > 0) {
59
-	if(isset($data['manager_language'])) {
60
-		$lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
-		if(is_file($lang_path)) {
59
+	if (isset($data['manager_language'])) {
60
+		$lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php';
61
+		if (is_file($lang_path)) {
62 62
 			include($lang_path);
63 63
             global $modx_lang_attribute;
64 64
             $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	foreach ($data as $k => $v) {
71 71
 		switch ($k) {
72 72
             case 'settings_version':{
73
-                if($modx->getVersionData('version')!=$data['settings_version']){
74
-                    $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
73
+                if ($modx->getVersionData('version') != $data['settings_version']) {
74
+                    $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version');
75 75
                     $v = $modx->getVersionData('version');
76 76
                 }
77 77
                 break;
@@ -92,21 +92,21 @@  discard block
 block discarded – undo
92 92
 			case 'rb_base_url':
93 93
 			case 'filemanager_path':
94 94
 				$v = trim($v);
95
-				$v = rtrim($v,'/') . '/';
95
+				$v = rtrim($v, '/').'/';
96 96
 				break;
97 97
             case 'manager_language':
98
-                $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang');
99
-                $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php');
98
+                $langDir = realpath(MODX_MANAGER_PATH.'includes/lang');
99
+                $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php');
100 100
                 $langFileDir = dirname($langFile);
101
-                if($langDir !== $langFileDir || !file_exists($langFile)) {
101
+                if ($langDir !== $langFileDir || !file_exists($langFile)) {
102 102
                     $v = 'english';
103 103
                 }
104 104
 				break;
105 105
 			case 'smtppw':
106 106
 				if ($v !== '********************' && $v !== '') {
107 107
 					$v = trim($v);
108
-					$v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
-					$v = str_replace('=','%',$v);
108
+					$v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
+					$v = str_replace('=', '%', $v);
110 110
 				} elseif ($v === '********************') {
111 111
 					$k = '';
112 112
 				}
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 				$v = str_replace(array(' ,', ', '), ',', $v);
116 116
 				if ($v !== ',') {
117 117
 					$v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : '';
118
-					$configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n";
119
-					@file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString);
118
+					$configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n";
119
+					@file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString);
120 120
 				}
121 121
 				$k = '';
122 122
 				break;
123 123
 			case 'session_timeout':
124 124
 				$mail_check_timeperiod = $data['mail_check_timeperiod'];
125
-				$v = intval($v) < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
125
+				$v = intval($v) < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
126 126
 				break;
127 127
 			default:
128 128
 			break;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$modx->config[$k] = $v;
133 133
 
134
-		if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
134
+		if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
135 135
 	}
136 136
 
137 137
 	// Run a single query to save all the values
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 		$oldtemplate = intval($data['old_template']);
146 146
 		$tbl = $modx->getFullTableName('site_content');
147 147
 		$reset = $data['reset_template'];
148
-		if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
149
-		else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
148
+		if ($reset == 1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
149
+		else if ($reset == 2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
150 150
 	}
151 151
 
152 152
 	// empty cache
153 153
 	$modx->clearCache('full');
154 154
 }
155
-$header="Location: index.php?a=7&r=10";
155
+$header = "Location: index.php?a=7&r=10";
156 156
 header($header);
Please login to merge, or discard this patch.
Braces   +18 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,39 +9,27 @@  discard block
 block discarded – undo
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
10 10
 unset($_POST);
11 11
 
12
-if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
13
-{
12
+if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) {
14 13
 	$htaccess        = $modx->config['base_path'] . '.htaccess';
15 14
 	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16 15
 	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
18
-	{
16
+	if(is_file($htaccess)) {
19 17
 		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
21
-		{
18
+		if(strpos($_,'RewriteBase')===false) {
22 19
 			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23
-		}
24
-		elseif(is_writable($htaccess))
25
-		{
20
+		} elseif(is_writable($htaccess)) {
26 21
 			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
28
-			{
22
+			if(!@file_put_contents($htaccess,$_)) {
29 23
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30 24
 			}
31 25
 		}
32
-	}
33
-	elseif(is_file($sample_htaccess))
34
-	{
35
-		if(!@rename($sample_htaccess,$htaccess))
36
-        {
26
+	} elseif(is_file($sample_htaccess)) {
27
+		if(!@rename($sample_htaccess,$htaccess)) {
37 28
         	$warnings[] = $_lang["settings_friendlyurls_alert"];
38
-		}
39
-		elseif($modx->config['base_url']!=='/')
40
-		{
29
+		} elseif($modx->config['base_url']!=='/') {
41 30
 			$_ = file_get_contents($htaccess);
42 31
 			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
44
-			{
32
+			if(!@file_put_contents($htaccess,$_)) {
45 33
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46 34
 			}
47 35
 		}
@@ -70,7 +58,7 @@  discard block
 block discarded – undo
70 58
 	foreach ($data as $k => $v) {
71 59
 		switch ($k) {
72 60
             case 'settings_version':{
73
-                if($modx->getVersionData('version')!=$data['settings_version']){
61
+                if($modx->getVersionData('version')!=$data['settings_version']) {
74 62
                     $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
75 63
                     $v = $modx->getVersionData('version');
76 64
                 }
@@ -131,7 +119,9 @@  discard block
 block discarded – undo
131 119
 
132 120
 		$modx->config[$k] = $v;
133 121
 
134
-		if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
122
+		if(!empty($k)) {
123
+		    $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
124
+		}
135 125
 	}
136 126
 
137 127
 	// Run a single query to save all the values
@@ -145,8 +135,11 @@  discard block
 block discarded – undo
145 135
 		$oldtemplate = intval($data['old_template']);
146 136
 		$tbl = $modx->getFullTableName('site_content');
147 137
 		$reset = $data['reset_template'];
148
-		if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
149
-		else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
138
+		if($reset==1) {
139
+		    $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
140
+		} else if($reset==2) {
141
+		    $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
142
+		}
150 143
 	}
151 144
 
152 145
 	// empty cache
Please login to merge, or discard this patch.
manager/processors/duplicate_htmlsnippet.processor.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -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_chunk')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? intval($_GET['id']) : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate htmlsnippet
21 21
 $newid = $modx->db->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'snippet'=>'',
26
-		'category'=>'',
27
-		), $modx->getFullTableName('site_htmlsnippets'), // Insert into
28
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'category'=>'',
27
+        ), $modx->getFullTableName('site_htmlsnippets'), // Insert into
28
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // Set the item name for logger
31 31
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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_chunk')) {
5
+if (!$modx->hasPermission('new_chunk')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
15 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
16 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate htmlsnippet
@@ -32,5 +32,5 @@  discard block
 block discarded – undo
32 32
 $_SESSION['itemname'] = $name;
33 33
 
34 34
 // finish duplicating - redirect to new chunk
35
-$header="Location: index.php?r=2&a=78&id=$newid";
35
+$header = "Location: index.php?r=2&a=78&id=$newid";
36 36
 header($header);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
16 16
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate htmlsnippet
21 24
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
manager/processors/delete_plugin.processor.php 2 patches
Indentation   +8 added lines, -8 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('delete_plugin')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? intval($_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
 // Set the item name for logger
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforePluginFormDelete event
19 19
 $modx->invokeEvent("OnBeforePluginFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the plugin.
25 25
 $modx->db->delete($modx->getFullTableName('site_plugins'), "id='{$id}'");
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
 // invoke OnPluginFormDelete event
31 31
 $modx->invokeEvent("OnPluginFormDelete",
32
-	array(
33
-		"id"	=> $id
34
-	));
32
+    array(
33
+        "id"	=> $id
34
+    ));
35 35
 
36 36
 // empty cache
37 37
 $modx->clearCache('full');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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('delete_plugin')) {
5
+if (!$modx->hasPermission('delete_plugin')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
@@ -37,5 +37,5 @@  discard block
 block discarded – undo
37 37
 $modx->clearCache('full');
38 38
 
39 39
 // finished emptying cache - redirect
40
-$header="Location: index.php?a=76&r=2";
40
+$header = "Location: index.php?a=76&r=2";
41 41
 header($header);
Please login to merge, or discard this patch.
manager/processors/undelete_content.processor.php 3 patches
Indentation   +26 added lines, -26 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('delete_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_REQUEST['id'])? intval($_REQUEST['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
 /************ webber ********/
@@ -32,50 +32,50 @@  discard block
 block discarded – undo
32 32
 $udperms->role = $_SESSION['mgrRole'];
33 33
 
34 34
 if(!$udperms->checkPermissions()) {
35
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
35
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
36 36
 }
37 37
 
38 38
 // get the timestamp on which the document was deleted.
39 39
 $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1");
40 40
 $deltime = $modx->db->getValue($rs);
41 41
 if(!$deltime) {
42
-	$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
42
+    $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
43 43
 }
44 44
 
45 45
 $children = array();
46 46
 
47 47
 function getChildren($parent) {
48 48
 
49
-	global $modx;
50
-	global $children;
51
-	global $deltime;
52
-
53
-	$rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'");
54
-		// the document has children documents, we'll need to delete those too
55
-		while ($row=$modx->db->getRow($rs)) {
56
-			$children[] = $row['id'];
57
-			getChildren($row['id']);
58
-			//echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
59
-		}
49
+    global $modx;
50
+    global $children;
51
+    global $deltime;
52
+
53
+    $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'");
54
+        // the document has children documents, we'll need to delete those too
55
+        while ($row=$modx->db->getRow($rs)) {
56
+            $children[] = $row['id'];
57
+            getChildren($row['id']);
58
+            //echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
59
+        }
60 60
 }
61 61
 
62 62
 getChildren($id);
63 63
 
64 64
 if(count($children)>0) {
65
-	$modx->db->update(
66
-		array(
67
-			'deleted'   => 0,
68
-			'deletedby' => 0,
69
-			'deletedon' => 0,
70
-		), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
65
+    $modx->db->update(
66
+        array(
67
+            'deleted'   => 0,
68
+            'deletedby' => 0,
69
+            'deletedon' => 0,
70
+        ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
71 71
 }
72 72
 //'undelete' the document.
73 73
 $modx->db->update(
74
-	array(
75
-		'deleted'   => 0,
76
-		'deletedby' => 0,
77
-		'deletedon' => 0,
78
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
74
+    array(
75
+        'deleted'   => 0,
76
+        'deletedby' => 0,
77
+        'deletedon' => 0,
78
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
79 79
 
80 80
 $modx->invokeEvent("OnDocFormUnDelete",
81 81
     array(
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,50 +1,50 @@  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('delete_document')) {
5
+if (!$modx->hasPermission('delete_document')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0;
10
-if($id==0) {
9
+$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 /************ webber ********/
15
-$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
-$pid=($content['parent']==0?$id:$content['parent']);
15
+$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
+$pid = ($content['parent'] == 0 ? $id : $content['parent']);
17 17
 
18 18
 /************** webber *************/
19
-$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC';
20
-$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon';
21
-$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:'';
22
-$add_path=$sd.$sb.$pg;
19
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
20
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
21
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
22
+$add_path = $sd.$sb.$pg;
23 23
 
24 24
 /***********************************/
25 25
 
26 26
 
27 27
 // check permissions on the document
28
-include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
28
+include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
29 29
 $udperms = new udperms();
30 30
 $udperms->user = $modx->getLoginUserID();
31 31
 $udperms->document = $id;
32 32
 $udperms->role = $_SESSION['mgrRole'];
33 33
 
34
-if(!$udperms->checkPermissions()) {
34
+if (!$udperms->checkPermissions()) {
35 35
 	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
36 36
 }
37 37
 
38 38
 // get the timestamp on which the document was deleted.
39 39
 $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1");
40 40
 $deltime = $modx->db->getValue($rs);
41
-if(!$deltime) {
41
+if (!$deltime) {
42 42
 	$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
43 43
 }
44 44
 
45 45
 $children = array();
46 46
 
47
-function getChildren($parent) {
47
+function getChildren($parent){
48 48
 
49 49
 	global $modx;
50 50
 	global $children;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	$rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'");
54 54
 		// the document has children documents, we'll need to delete those too
55
-		while ($row=$modx->db->getRow($rs)) {
55
+		while ($row = $modx->db->getRow($rs)) {
56 56
 			$children[] = $row['id'];
57 57
 			getChildren($row['id']);
58 58
 			//echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 getChildren($id);
63 63
 
64
-if(count($children)>0) {
64
+if (count($children) > 0) {
65 65
 	$modx->db->update(
66 66
 		array(
67 67
 			'deleted'   => 0,
@@ -90,5 +90,5 @@  discard block
 block discarded – undo
90 90
 $modx->clearCache('full');
91 91
 
92 92
 // finished emptying cache - redirect
93
-$header="Location: index.php?a=3&id=$pid&r=1".$add_path;
93
+$header = "Location: index.php?a=3&id=$pid&r=1".$add_path;
94 94
 header($header);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,8 @@
 block discarded – undo
44 44
 
45 45
 $children = array();
46 46
 
47
-function getChildren($parent) {
47
+function getChildren($parent)
48
+{
48 49
 
49 50
 	global $modx;
50 51
 	global $children;
Please login to merge, or discard this patch.