Completed
Push — develop ( a67439...00fbcc )
by
unknown
06:22
created
install/connection.databasetest.php 1 patch
Braces   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
 $output = $_lang["status_checking_database"];
19 19
 if (!$conn = mysqli_connect($host, $uid, $pwd)) {
20 20
     $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>';
21
-}
22
-else {
21
+} else {
23 22
     $database_name = mysqli_real_escape_string($conn, $_POST['database_name']);
24 23
     $database_name = str_replace("`", "", $database_name);
25 24
     $tableprefix = mysqli_real_escape_string($conn, $_POST['tableprefix']);
@@ -31,20 +30,16 @@  discard block
 block discarded – undo
31 30
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
32 31
         $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";";
33 32
 
34
-        if (! mysqli_query($conn, $query)){
33
+        if (! mysqli_query($conn, $query)) {
35 34
             $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>';
36
-        }
37
-        else {
35
+        } else {
38 36
             $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>';
39 37
         }
40
-    }
41
-    elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) {
38
+    } elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) {
42 39
         $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>';
43
-    }
44
-    elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) {
40
+    } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) {
45 41
         $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'], $row[1]).'</span>';
46
-    }
47
-    else {
42
+    } else {
48 43
         $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>';
49 44
     }
50 45
 }
Please login to merge, or discard this patch.
install/functions.php 1 patch
Braces   +30 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,10 +4,8 @@  discard block
 block discarded – undo
4 4
 	global $_lang;
5 5
 	
6 6
 	// session loop-back tester
7
-	if(!isset($_GET['action']) || $_GET['action']!=='mode')
8
-	{
9
-		if(!isset($_SESSION['test']) || $_SESSION['test']!=1)
10
-		{
7
+	if(!isset($_GET['action']) || $_GET['action']!=='mode') {
8
+		if(!isset($_SESSION['test']) || $_SESSION['test']!=1) {
11 9
 			echo '
12 10
 <html>
13 11
 <head>
@@ -34,8 +32,7 @@  discard block
 block discarded – undo
34 32
 
35 33
 function parse($src,$ph,$left='[+',$right='+]')
36 34
 {
37
-	foreach($ph as $k=>$v)
38
-	{
35
+	foreach($ph as $k=>$v) {
39 36
 		$k = $left . $k . $right;
40 37
 		$src = str_replace($k,$v,$src);
41 38
 	}
@@ -46,8 +43,11 @@  discard block
 block discarded – undo
46 43
 {
47 44
 	global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date;
48 45
 
49
-	if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode'];
50
-	else                                $installmode = get_installmode();
46
+	if(isset($_SESSION['installmode'])) {
47
+	    $installmode = $_SESSION['installmode'];
48
+	} else {
49
+	    $installmode = get_installmode();
50
+	}
51 51
 
52 52
 	$ph['pagetitle']     = $_lang['modx_install'];
53 53
 	$ph['textdir']       = $modx_textdir ? ' id="rtl"':'';
@@ -65,29 +65,29 @@  discard block
 block discarded – undo
65 65
 	global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix;
66 66
 	
67 67
 	$conf_path = "{$base_path}manager/includes/config.inc.php";
68
-	if (!is_file($conf_path)) $installmode = 0;
69
-	elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode'];
70
-	else
71
-	{
68
+	if (!is_file($conf_path)) {
69
+	    $installmode = 0;
70
+	} elseif(isset($_POST['installmode'])) {
71
+	    $installmode = $_POST['installmode'];
72
+	} else {
72 73
 		include_once("{$base_path}manager/includes/config.inc.php");
73 74
 		
74
-		if(!isset($dbase) || empty($dbase)) $installmode = 0;
75
-		else
76
-		{
75
+		if(!isset($dbase) || empty($dbase)) {
76
+		    $installmode = 0;
77
+		} else {
77 78
 			$conn = mysqli_connect($database_server, $database_user, $database_password);
78
-			if($conn)
79
-			{
79
+			if($conn) {
80 80
 				$_SESSION['database_server']   = $database_server;
81 81
 				$_SESSION['database_user']     = $database_user;
82 82
 				$_SESSION['database_password'] = $database_password;
83 83
 				
84 84
 				$dbase = trim($dbase, '`');
85 85
 				$rs = mysqli_select_db($conn, $dbase);
86
+			} else {
87
+			    $rs = false;
86 88
 			}
87
-			else $rs = false;
88 89
 			
89
-			if($rs)
90
-			{
90
+			if($rs) {
91 91
 				$_SESSION['dbase']                      = $dbase;
92 92
 				$_SESSION['table_prefix']               = $table_prefix;
93 93
 				$_SESSION['database_collation']         = 'utf8_general_ci';
@@ -95,17 +95,21 @@  discard block
 block discarded – undo
95 95
 				
96 96
 				$tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`";
97 97
 				$rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'");
98
-				if($rs)
99
-				{
98
+				if($rs) {
100 99
 					$row = mysqli_fetch_assoc($rs);
101 100
 					$settings_version = $row['setting_value'];
101
+				} else {
102
+				    $settings_version = '';
102 103
 				}
103
-				else $settings_version = '';
104 104
 				
105
-				if (empty($settings_version)) $installmode = 0;
106
-				else                          $installmode = 1;
105
+				if (empty($settings_version)) {
106
+				    $installmode = 0;
107
+				} else {
108
+				    $installmode = 1;
109
+				}
110
+			} else {
111
+			    $installmode = 1;
107 112
 			}
108
-			else $installmode = 1;
109 113
 		}
110 114
 	}
111 115
 	return $installmode;
Please login to merge, or discard this patch.
install/connection.servertest.php 1 patch
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 $output = $_lang["status_connecting"];
18 18
 if (!$conn = @mysqli_connect($host, $uid, $pwd)) {
19 19
     $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>';
20
-}
21
-else {
20
+} else {
22 21
     $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>';
23 22
 
24 23
     // Mysql version check
@@ -27,13 +26,17 @@  discard block
 block discarded – undo
27 26
     }
28 27
     // Mode check
29 28
     $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode");
30
-    if (@mysqli_num_rows($mysqlmode) > 0){
29
+    if (@mysqli_num_rows($mysqlmode) > 0) {
31 30
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
32 31
         $strictMode = false;
33 32
         foreach ($modes as $mode) {
34
-    		    if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true;
33
+    		    if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
34
+    		        $strictMode = true;
35
+    		    }
36
+        }
37
+        if ($strictMode) {
38
+            $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
35 39
         }
36
-        if ($strictMode) $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
37 40
     }
38 41
 }
39 42
 echo $output;
Please login to merge, or discard this patch.
install/connection.collation.php 1 patch
Braces   +24 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 require_once('lang.php');
16 16
 
17 17
 $conn = mysqli_connect($host, $uid, $pwd);
18
-if(!$conn) exit('can not connect');
18
+if(!$conn) {
19
+    exit('can not connect');
20
+}
19 21
 
20 22
 // get collation
21 23
 $rs = mysqli_query($conn, "SHOW COLLATION");
@@ -29,23 +31,31 @@  discard block
 block discarded – undo
29 31
     $database_collation = htmlentities($_POST['database_collation']);
30 32
     $recommend_collation = $_lang['recommend_collation'];
31 33
     
32
-    if    (isset($_[$recommend_collation])) $_[$recommend_collation] = ' selected';
33
-    elseif(isset($_['utf8mb4_general_ci'])) $_['utf8mb4_general_ci'] = ' selected';
34
-    elseif(isset($_['utf8_general_ci']))    $_['utf8_general_ci']    = ' selected';
35
-    elseif(isset($_[$database_collation]))  $_[$database_collation]  = ' selected';
34
+    if    (isset($_[$recommend_collation])) {
35
+        $_[$recommend_collation] = ' selected';
36
+    } elseif(isset($_['utf8mb4_general_ci'])) {
37
+        $_['utf8mb4_general_ci'] = ' selected';
38
+    } elseif(isset($_['utf8_general_ci'])) {
39
+        $_['utf8_general_ci']    = ' selected';
40
+    } elseif(isset($_[$database_collation])) {
41
+        $_[$database_collation]  = ' selected';
42
+    }
36 43
     
37 44
     $_ = sortItem($_,$_lang['recommend_collations_order']);
38 45
     
39 46
     foreach($_ as $collation=>$selected) {
40 47
         $collation = htmlentities($collation);
41 48
         // if(substr($collation,0,4)!=='utf8') continue;
42
-        if(strpos($collation,'sjis')===0) continue;
43
-        if($collation=='recommend')
44
-            $output .= '<optgroup label="recommend">';
45
-        elseif($collation=='unrecommend')
46
-            $output .= '</optgroup><optgroup label="unrecommend">';
47
-        else
48
-            $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation);
49
+        if(strpos($collation,'sjis')===0) {
50
+            continue;
51
+        }
52
+        if($collation=='recommend') {
53
+                    $output .= '<optgroup label="recommend">';
54
+        } elseif($collation=='unrecommend') {
55
+                    $output .= '</optgroup><optgroup label="unrecommend">';
56
+        } else {
57
+                    $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation);
58
+        }
49 59
     }
50 60
     $output .= '</optgroup></select>';
51 61
 }
@@ -55,7 +65,8 @@  discard block
 block discarded – undo
55 65
 
56 66
 
57 67
 
58
-function sortItem($array=array(),$order='utf8mb4,utf8') {
68
+function sortItem($array=array(),$order='utf8mb4,utf8')
69
+{
59 70
     $rs = array('recommend'=>'');
60 71
     $order = explode(',', $order);
61 72
     foreach($order as $v) {
Please login to merge, or discard this patch.
manager/actions/mutate_content.dynamic.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -478,7 +478,8 @@  discard block
 block discarded – undo
478 478
 			return s;
479 479
 		}
480 480
 
481
-		<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
481
+		<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') {
482
+// Web Link specific ?>
482 483
 		var lastImageCtrl;
483 484
 		var lastFileCtrl;
484 485
 
@@ -694,7 +695,8 @@  discard block
 block discarded – undo
694 695
 									</td>
695 696
 								</tr>
696 697
 
697
-								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
698
+								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') {
699
+// Web Link specific ?>
698 700
 
699 701
 									<tr>
700 702
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -1356,7 +1358,9 @@  discard block
 block discarded – undo
1356 1358
 						if($documentId > 0) {
1357 1359
 							// Load up, the permissions from the parent (if new document) or existing document
1358 1360
 							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1359
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1361
+							while($currentgroup = $modx->db->getRow($rs)) {
1362
+							    $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1363
+							}
1360 1364
 
1361 1365
 							// Load up the current permissions and names
1362 1366
 							$vs = array(
@@ -1418,7 +1422,9 @@  discard block
 block discarded – undo
1418 1422
 
1419 1423
 							// Create attribute string list
1420 1424
 							$inputString = array();
1421
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1425
+							foreach($inputAttributes as $k => $v) {
1426
+							    $inputString[] = $k . '="' . $v . '"';
1427
+							}
1422 1428
 
1423 1429
 							// Make the <input> HTML
1424 1430
 							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
@@ -1535,7 +1541,8 @@  discard block
 block discarded – undo
1535 1541
 	}
1536 1542
 }
1537 1543
 
1538
-function getDefaultTemplate() {
1544
+function getDefaultTemplate()
1545
+{
1539 1546
 	global $modx;
1540 1547
 
1541 1548
 	switch($modx->config['auto_template_logic']) {
Please login to merge, or discard this patch.
manager/actions/resources.static.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	'type7' => $_lang["lock_element_type_7"],
29 29
 	'type8' => $_lang["lock_element_type_8"]
30 30
 );
31
-foreach($unlockTranslations as $key => $value) $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
31
+foreach($unlockTranslations as $key => $value) {
32
+    $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
33
+}
32 34
 
33 35
 // Prepare lang-strings for mgrResAction()
34 36
 $mraTranslations = array(
@@ -44,7 +46,9 @@  discard block
 block discarded – undo
44 46
 	'confirm_delete_plugin' => $_lang["confirm_delete_plugin"],
45 47
 	'confirm_delete_module' => $_lang["confirm_delete_module"],
46 48
 );
47
-foreach($mraTranslations as $key => $value) $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
49
+foreach($mraTranslations as $key => $value) {
50
+    $mraTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value);
51
+}
48 52
 ?>
49 53
 <script>var trans = <?php echo json_encode($unlockTranslations); ?>;</script>
50 54
 <script>var mraTrans = <?php echo json_encode($mraTranslations); ?>;</script>
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 1 patch
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -101,7 +101,8 @@  discard block
 block discarded – undo
101 101
 	</div>
102 102
 
103 103
 <?php
104
-function run() {
104
+function run()
105
+{
105 106
 	global $modx;
106 107
 
107 108
 	$tbl_site_content = $modx->getFullTableName('site_content');
@@ -160,7 +161,8 @@  discard block
 block discarded – undo
160 161
 	return $output;
161 162
 }
162 163
 
163
-function importFiles($parent, $filedir, $files, $mode) {
164
+function importFiles($parent, $filedir, $files, $mode)
165
+{
164 166
 	global $modx;
165 167
 	global $_lang, $allowedfiles;
166 168
 	global $search_default, $cache_default, $publish_default;
@@ -302,7 +304,8 @@  discard block
 block discarded – undo
302 304
 	}
303 305
 }
304 306
 
305
-function getFiles($directory, $listing = array(), $count = 0) {
307
+function getFiles($directory, $listing = array(), $count = 0)
308
+{
306 309
 	global $_lang;
307 310
 	global $filesfound;
308 311
 	$dummy = $count;
@@ -326,7 +329,8 @@  discard block
 block discarded – undo
326 329
 	return ($listing);
327 330
 }
328 331
 
329
-function getFileContent($filepath) {
332
+function getFileContent($filepath)
333
+{
330 334
 	global $_lang;
331 335
 	// get the file
332 336
 	if(!$buffer = file_get_contents($filepath)) {
@@ -336,7 +340,8 @@  discard block
 block discarded – undo
336 340
 	}
337 341
 }
338 342
 
339
-function pop_index($array) {
343
+function pop_index($array)
344
+{
340 345
 	$new_array = array();
341 346
 	foreach($array as $k => $v) {
342 347
 		if($v !== 'index.html' && $v !== 'index.htm') {
@@ -353,7 +358,8 @@  discard block
 block discarded – undo
353 358
 	return $new_array;
354 359
 }
355 360
 
356
-function treatContent($src, $filename, $alias) {
361
+function treatContent($src, $filename, $alias)
362
+{
357 363
 	global $modx;
358 364
 
359 365
 	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
@@ -394,7 +400,8 @@  discard block
 block discarded – undo
394 400
 	);
395 401
 }
396 402
 
397
-function convertLink() {
403
+function convertLink()
404
+{
398 405
 	global $modx;
399 406
 	$tbl_site_content = $modx->getFullTableName('site_content');
400 407
 
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab5_security_settings.inc.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
     $MODX_SITE_HOSTNAMES = MODX_SITE_HOSTNAMES; // Fix for PHP 5.4
3
-    if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) $valid_hostnames = $_SERVER['HTTP_HOST'];
4
-?>
3
+    if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) {
4
+        $valid_hostnames = $_SERVER['HTTP_HOST'];
5
+    }
6
+    ?>
5 7
 <!-- Interface & editor settings -->
6 8
 <div class="tab-page" id="tabPageSecurity">
7 9
 <h2 class="tab"><?php echo $_lang['settings_security'] ?></h2>
@@ -153,7 +155,9 @@  discard block
 block discarded – undo
153 155
 <th><?php echo $_lang['pwd_hash_algo_title'] ?><br><small>[(pwd_hash_algo)]</small></th>
154 156
 <td>
155 157
 <?php
156
-if(empty($pwd_hash_algo)) $phm['sel']['UNCRYPT'] = 1;
158
+if(empty($pwd_hash_algo)) {
159
+    $phm['sel']['UNCRYPT'] = 1;
160
+}
157 161
 $phm['e']['BLOWFISH_Y'] = $modx->manager->checkHashAlgorithm('BLOWFISH_Y') ? 0:1;
158 162
 $phm['e']['BLOWFISH_A'] = $modx->manager->checkHashAlgorithm('BLOWFISH_A') ? 0:1;
159 163
 $phm['e']['SHA512']     = $modx->manager->checkHashAlgorithm('SHA512') ? 0:1;
@@ -182,7 +186,9 @@  discard block
 block discarded – undo
182 186
   ?>
183 187
 <?php
184 188
 $gdAvailable = extension_loaded('gd');
185
-if(!$gdAvailable) $use_captcha = 0;
189
+if(!$gdAvailable) {
190
+    $use_captcha = 0;
191
+}
186 192
 ?>
187 193
   <tr>
188 194
     <td nowrap class="warning"><?php echo $_lang['captcha_title'] ?><br><small>[(use_captcha)]</small></td>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab3_user_settings.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,9 @@
 block discarded – undo
127 127
         <?php
128 128
             // invoke OnUserSettingsRender event
129 129
             $evtOut = $modx->invokeEvent('OnUserSettingsRender');
130
-            if(is_array($evtOut)) echo implode("",$evtOut);
130
+            if(is_array($evtOut)) {
131
+                echo implode("",$evtOut);
132
+            }
131 133
         ?>
132 134
     </td>
133 135
   </tr>
Please login to merge, or discard this patch.