Completed
Push — develop ( 8dee05 )
by Dmytro
20:08
created
manager/processors/save_template.processor.php 1 patch
Spacing   +7 added lines, -7 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 5
 if (!$modx->hasPermission('save_template')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $template = $modx->getDatabase()->escape($_POST['post']);
11 11
 $templatename = $modx->getDatabase()->escape(trim($_POST['templatename']));
12 12
 $description = $modx->getDatabase()->escape($_POST['description']);
13 13
 $locked = isset($_POST['locked']) && $_POST['locked'] == 'on' ? 1 : 0;
14
-$selectable = $id == $modx->config['default_template'] ? 1 :    // Force selectable
14
+$selectable = $id == $modx->config['default_template'] ? 1 : // Force selectable
15 15
     isset($_POST['selectable']) && $_POST['selectable'] == 'on' ? 1 : 0;
16 16
 $currentdate = time() + $modx->config['server_offset_time'];
17 17
 
18 18
 //Kyle Jaebker - added category support
19 19
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
20
-    $categoryid = (int)$_POST['categoryid'];
20
+    $categoryid = (int) $_POST['categoryid'];
21 21
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
22 22
     $categoryid = 0;
23 23
 } else {
24
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
24
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
25 25
     $categoryid = checkCategory($_POST['newcategory']);
26 26
     if (!$categoryid) {
27 27
         $categoryid = newCategory($_POST['newcategory']);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         // finished emptying cache - redirect
79 79
         if ($_POST['stay'] != '') {
80 80
             $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19";
81
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
81
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
82 82
             header($header);
83 83
         } else {
84 84
             $header = "Location: index.php?a=76&r=2";
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         // finished emptying cache - redirect
131 131
         if ($_POST['stay'] != '') {
132 132
             $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19";
133
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
133
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
134 134
             header($header);
135 135
         } else {
136 136
             $modx->unlockElement(1, $id);
Please login to merge, or discard this patch.
manager/processors/duplicate_tmplvars.processor.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  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('edit_template')) {
5
+if (!$modx->hasPermission('edit_template')) {
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
 // count duplicates
15
-$tmplvar = EvolutionCMS\Models\SiteTmplvar::with(['tmplvarAccess','tmplvarTemplate'])->findOrFail($id);
15
+$tmplvar = EvolutionCMS\Models\SiteTmplvar::with(['tmplvarAccess', 'tmplvarTemplate'])->findOrFail($id);
16 16
 $name = $tmplvar->name;
17 17
 $count = EvolutionCMS\Models\SiteTmplvar::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count();
18
-if($count>=1) $count = ' '.($count+1);
18
+if ($count >= 1) $count = ' '.($count + 1);
19 19
 else $count = '';
20 20
 
21 21
 
@@ -38,5 +38,5 @@  discard block
 block discarded – undo
38 38
 $_SESSION['itemname'] = $newTmplvar->name;
39 39
 
40 40
 // finish duplicating - redirect to new variable
41
-$header="Location: index.php?r=2&a=301&id=".$newTmplvar->getKey();
41
+$header = "Location: index.php?r=2&a=301&id=".$newTmplvar->getKey();
42 42
 header($header);
Please login to merge, or discard this patch.
manager/processors/delete_web_user.processor.php 1 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_web_user')) {
5
+if (!$modx->hasPermission('delete_web_user')) {
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
 
@@ -39,5 +39,5 @@  discard block
 block discarded – undo
39 39
         "id"	=> $id
40 40
     ));
41 41
 
42
-$header="Location: index.php?a=99";
42
+$header = "Location: index.php?a=99";
43 43
 header($header);
Please login to merge, or discard this patch.
manager/processors/duplicate_htmlsnippet.processor.php 1 patch
Spacing   +6 added lines, -6 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('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'])? (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
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $htmlsnippet = EvolutionCMS\Models\SiteHtmlsnippet::findOrFail($id);
16 16
 $name = $htmlsnippet->name;
17 17
 $count = EvolutionCMS\Models\SiteHtmlsnippet::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count();
18
-if($count>=1) $count = ' '.($count+1);
18
+if ($count >= 1) $count = ' '.($count + 1);
19 19
 else $count = '';
20 20
 
21 21
 // duplicate htmlsnippet
@@ -26,5 +26,5 @@  discard block
 block discarded – undo
26 26
 $_SESSION['itemname'] = $newHtmlsnippet->name;
27 27
 
28 28
 // finish duplicating - redirect to new chunk
29
-$header="Location: index.php?r=2&a=78&id=".$newHtmlsnippet->getKey();
29
+$header = "Location: index.php?r=2&a=78&id=".$newHtmlsnippet->getKey();
30 30
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_htmlsnippet.processor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-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_chunk')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $snippet = $_POST['post'];
11 11
 $name = trim($_POST['name']);
12 12
 $description = $_POST['description'];
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 
17 17
 //Kyle Jaebker - added category support
18 18
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
19
-    $category = (int)$_POST['categoryid'];
19
+    $category = (int) $_POST['categoryid'];
20 20
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
21 21
     $category = 0;
22 22
 } else {
23
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
23
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
24 24
     $category = checkCategory($_POST['newcategory']);
25 25
     if (!$category) {
26 26
         $category = newCategory($_POST['newcategory']);
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
         ));
45 45
 
46 46
         // disallow duplicate names for new chunks
47
-        if (EvolutionCMS\Models\SiteHtmlsnippet::where('name','=',$name)->first()) {
47
+        if (EvolutionCMS\Models\SiteHtmlsnippet::where('name', '=', $name)->first()) {
48 48
             $modx->getManagerApi()->saveFormValues(77);
49 49
             $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['chunk'], $name), "index.php?a=77");
50 50
         }
51 51
 
52 52
         //do stuff to save the new doc
53
-        $id = EvolutionCMS\Models\SiteHtmlsnippet::create(compact('name', 'description','snippet','locked','category','editor_type','editor_name','disabled','createdon','editedon'))->getKey();
53
+        $id = EvolutionCMS\Models\SiteHtmlsnippet::create(compact('name', 'description', 'snippet', 'locked', 'category', 'editor_type', 'editor_name', 'disabled', 'createdon', 'editedon'))->getKey();
54 54
 
55 55
         // invoke OnChunkFormSave event
56 56
         $modx->invokeEvent("OnChunkFormSave", array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         // finished emptying cache - redirect
68 68
         if ($_POST['stay'] != '') {
69 69
             $a = ($_POST['stay'] == '2') ? "78&id=$id" : "77";
70
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
70
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
71 71
             header($header);
72 72
         } else {
73 73
             $header = "Location: index.php?a=76&r=2";
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         ));
83 83
 
84 84
         // disallow duplicate names for chunks
85
-        if (EvolutionCMS\Models\SiteHtmlsnippet::where('id','!=',$id)->where('name','=',$name)->first()) {
85
+        if (EvolutionCMS\Models\SiteHtmlsnippet::where('id', '!=', $id)->where('name', '=', $name)->first()) {
86 86
             $modx->getManagerApi()->saveFormValues(78);
87 87
             $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['chunk'], $name), "index.php?a=78&id={$id}");
88 88
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         //do stuff to save the edited doc
91 91
         $chunk = EvolutionCMS\Models\SiteHtmlsnippet::find($id);
92 92
 
93
-        $chunk->update(compact('name', 'description','snippet','locked','category','editor_type','editor_name','disabled','editedon'));
93
+        $chunk->update(compact('name', 'description', 'snippet', 'locked', 'category', 'editor_type', 'editor_name', 'disabled', 'editedon'));
94 94
 
95 95
         // invoke OnChunkFormSave event
96 96
         $modx->invokeEvent("OnChunkFormSave", array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         // finished emptying cache - redirect
108 108
         if ($_POST['stay'] != '') {
109 109
             $a = ($_POST['stay'] == '2') ? "78&id=$id" : "77";
110
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
110
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
111 111
             header($header);
112 112
         } else {
113 113
             $modx->unlockElement(3, $id);
Please login to merge, or discard this patch.
manager/processors/save_user.processor.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 $input = $_POST;
10 10
 
11
-$id = (int)$input['id'];
11
+$id = (int) $input['id'];
12 12
 $oldusername = $input['oldusername'];
13 13
 $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User";
14 14
 $fullname = $input['fullname'];
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 		$field = array();
97 97
 		$field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
98 98
 		$field['username'] = $newusername;
99
-		$managerUser= EvolutionCMS\Models\ManagerUser::create($field);
99
+		$managerUser = EvolutionCMS\Models\ManagerUser::create($field);
100 100
 		$internalKey = $managerUser->getKey();
101
-		$field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
101
+		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
102 102
 		$managerUser->attributes()->create($field);
103 103
 
104 104
         $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street',
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 		/*******************************************************************************/
133 133
 		// put the user in the user_groups he/ she should be in
134 134
 		// first, check that up_perms are switched on!
135
-		if($modx->getConfig('use_udperms') == 1) {
136
-			if(!empty($user_groups)) {
137
-				for($i = 0; $i < count($user_groups); $i++) {
135
+		if ($modx->getConfig('use_udperms') == 1) {
136
+			if (!empty($user_groups)) {
137
+				for ($i = 0; $i < count($user_groups); $i++) {
138 138
 					$field = array();
139
-					$field['user_group'] = (int)$user_groups[$i];
139
+					$field['user_group'] = (int) $user_groups[$i];
140 140
 					$field['member'] = $id;
141 141
 					$managerUser->memberGroups()->create($field);
142 142
 				}
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
149 149
             if ($input['stay'] != '') {
150 150
 				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
151
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
151
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
152 152
 				header($header);
153 153
 			} else {
154 154
 				$header = "Location: index.php?a=75&r=2";
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		} else {
158 158
             if ($input['stay'] != '') {
159 159
 				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
160
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
161 161
 			} else {
162 162
 				$stayUrl = "index.php?a=75&r=2";
163 163
 			}
164 164
 
165
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
165
+			include_once MODX_MANAGER_PATH."includes/header.inc.php";
166 166
 			?>
167 167
 
168 168
 			<h1><?php echo $_lang['user_title']; ?></h1>
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			</div>
186 186
 			<?php
187 187
 
188
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
188
+			include_once MODX_MANAGER_PATH."includes/footer.inc.php";
189 189
 		}
190 190
 		break;
191 191
 	case '12' : // edit user
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 		/*******************************************************************************/
276 276
 		// put the user in the user_groups he/ she should be in
277 277
 		// first, check that up_perms are switched on!
278
-		if($modx->getConfig('use_udperms') == 1) {
278
+		if ($modx->getConfig('use_udperms') == 1) {
279 279
 			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
280 280
 			$managerUser->memberGroups()->delete();
281 281
             if (!empty($user_groups)) {
282 282
                 for ($i = 0; $i < count($user_groups); $i++) {
283 283
 					$field = array();
284
-					$field['user_group'] = (int)$user_groups[$i];
284
+					$field['user_group'] = (int) $user_groups[$i];
285 285
 					$field['member'] = $id;
286 286
 					$managerUser->memberGroups()->create($field);
287 287
 				}
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
         if ($genpassword == 1 && $passwordnotifymethod == 's') {
296 296
             if ($input['stay'] != '') {
297 297
 				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
298
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
298
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
299 299
 			} else {
300 300
 				$stayUrl = "index.php?a=75&r=2";
301 301
 			}
302 302
 
303
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
303
+			include_once MODX_MANAGER_PATH."includes/header.inc.php";
304 304
 			?>
305 305
 
306 306
 			<h1><?php echo $_lang['user_title']; ?></h1>
@@ -318,17 +318,17 @@  discard block
 block discarded – undo
318 318
                 <div class="tab-page">
319 319
                     <div class="container container-body" id="disp">
320 320
                         <p><?php echo sprintf($_lang["password_msg"], $modx->getPhpCompat()->htmlspecialchars($newusername),
321
-                                    $modx->getPhpCompat()->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p>
321
+                                    $modx->getPhpCompat()->htmlspecialchars($newpassword)).(($id == $modx->getLoginUserID()) ? ' '.$_lang['user_changeddata'] : ''); ?></p>
322 322
 					</div>
323 323
 				</div>
324 324
 			</div>
325 325
 			<?php
326 326
 
327
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
327
+			include_once MODX_MANAGER_PATH."includes/footer.inc.php";
328 328
 		} else {
329 329
             if ($input['stay'] != '') {
330 330
 				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
331
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
331
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
332 332
 				header($header);
333 333
 			} else {
334 334
 				$header = "Location: index.php?a=75&r=2";
Please login to merge, or discard this patch.
manager/processors/execute_module.processor.php 1 patch
Spacing   +10 added lines, -10 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->getDatabase()->select(
17 17
 		'sma.usergroup,mg.member',
18 18
 		$modx->getDatabase()->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->getDatabase()->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->getDatabase()->select('*', $modx->getDatabase()->getFullTableName("site_modules"), "id='{$id}'");
45 45
 $content = $modx->getDatabase()->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
 
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 1 patch
Spacing   +39 added lines, -39 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_BASE_PATH . '.htaccess';
15
-	$sample_htaccess = MODX_BASE_PATH . 'ht.access';
16
-	$dir = '/' . trim(MODX_BASE_URL,'/');
17
-	if(is_file($htaccess))
14
+	$htaccess        = MODX_BASE_PATH.'.htaccess';
15
+	$sample_htaccess = MODX_BASE_PATH.'ht.access';
16
+	$dir = '/'.trim(MODX_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_BASE_URL!=='/')
39
+		elseif (MODX_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;
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 	$savethese = array();
68 68
 	$data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']);
69
-	$data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
69
+	$data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
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,28 +92,28 @@  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
 				}
113 113
 				break;
114 114
 			case 'session_timeout':
115 115
 				$mail_check_timeperiod = $data['mail_check_timeperiod'];
116
-				$v = (int)$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
116
+				$v = (int) $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
117 117
 				break;
118 118
 			default:
119 119
 			break;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		$modx->config[$k] = $v;
124 124
 
125
-		if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')';
125
+		if (!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')';
126 126
 	}
127 127
 
128 128
 	// Run a single query to save all the values
@@ -132,16 +132,16 @@  discard block
 block discarded – undo
132 132
 
133 133
 	// Reset Template Pages
134 134
 	if (isset($data['reset_template'])) {
135
-		$newtemplate = (int)$data['default_template'];
136
-		$oldtemplate = (int)$data['old_template'];
135
+		$newtemplate = (int) $data['default_template'];
136
+		$oldtemplate = (int) $data['old_template'];
137 137
 		$tbl = $modx->getDatabase()->getFullTableName('site_content');
138 138
 		$reset = $data['reset_template'];
139
-		if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'");
140
-		else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
139
+		if ($reset == 1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'");
140
+		else if ($reset == 2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
141 141
 	}
142 142
 
143 143
 	// empty cache
144 144
 	$modx->clearCache('full');
145 145
 }
146
-$header="Location: index.php?a=7&r=10";
146
+$header = "Location: index.php?a=7&r=10";
147 147
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_tmplvars.processor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-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_template')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $name = trim($_POST['name']);
11 11
 $description = $_POST['description'];
12 12
 $caption = $_POST['caption'];
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
 $display = $_POST['display'];
18 18
 $params = $_POST['params'];
19 19
 $locked = isset($_POST['locked']) && $_POST['locked'] == 'on' ? 1 : 0;
20
-$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76;
21
-$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null;
20
+$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76;
21
+$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : null;
22 22
 $currentdate = time() + $modx->config['server_offset_time'];
23 23
 
24 24
 //Kyle Jaebker - added category support
25 25
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
26
-    $categoryid = (int)$_POST['categoryid'];
26
+    $categoryid = (int) $_POST['categoryid'];
27 27
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
28 28
     $categoryid = 0;
29 29
 } else {
30
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
30
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
31 31
     $categoryid = checkCategory($_POST['newcategory']);
32 32
     if (!$categoryid) {
33 33
         $categoryid = newCategory($_POST['newcategory']);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             'createdon' => $currentdate,
75 75
             'editedon' => $currentdate
76 76
         );
77
-        $tmplVar= EvolutionCMS\Models\SiteTmplvar::create($field);
77
+        $tmplVar = EvolutionCMS\Models\SiteTmplvar::create($field);
78 78
         $newid = $tmplVar->getKey();
79 79
 
80 80
         // save access permissions
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         // finished emptying cache - redirect
97 97
         if ($_POST['stay'] != '') {
98 98
             $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300";
99
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
99
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
100 100
             header($header);
101 101
         } else {
102 102
             $header = "Location: index.php?a=76&r=2";
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
         // finished emptying cache - redirect
159 159
         if ($_POST['stay'] != '') {
160 160
             $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300";
161
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId;
161
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId;
162 162
             header($header);
163 163
         } else {
164 164
             $modx->unlockElement(2, $id);
165
-            $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId);
165
+            $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId);
166 166
             header($header);
167 167
         }
168 168
 
Please login to merge, or discard this patch.