Completed
Pull Request — develop (#526)
by
unknown
06:55
created
install/actions/action_connection.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0;
2
+$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0;
3 3
 
4 4
 // Determine upgradeability
5
-$upgradeable= 0;
5
+$upgradeable = 0;
6 6
 if ($installMode === 0) {
7
-    $database_name= '';
8
-    $database_server= 'localhost';
9
-    $table_prefix= substr(md5(time()), rand(0, 27), rand(3, 5))."_";
7
+    $database_name = '';
8
+    $database_server = 'localhost';
9
+    $table_prefix = substr(md5(time()), rand(0, 27), rand(3, 5))."_";
10 10
 } else {
11 11
     $database_name = '';
12 12
     if (!is_file($base_path.MGR_DIR.'/includes/config.inc.php')) $upgradeable = 0;
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
         if ($dbase) {
18 18
           $database_name = trim($dbase, '`');
19 19
           if (!$conn = mysqli_connect($database_server, $database_user, $database_password))
20
-              $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2;
21
-          elseif (! mysqli_select_db($conn, trim($dbase, '`')))
22
-              $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2;
20
+              $upgradeable = (isset($_POST['installmode']) && $_POST['installmode'] == 'new') ? 0 : 2;
21
+          elseif (!mysqli_select_db($conn, trim($dbase, '`')))
22
+              $upgradeable = (isset($_POST['installmode']) && $_POST['installmode'] == 'new') ? 0 : 2;
23 23
           else
24 24
               $upgradeable = 1;
25 25
         }
26
-        else $upgradable= 2;
26
+        else $upgradable = 2;
27 27
     }
28 28
 }
29 29
 
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
     $database_connection_method = 'SET CHARACTER SET';
50 50
 }
51 51
 
52
-$ph['database_name'] = isset($_POST['database_name']) ? $_POST['database_name']: $database_name;
53
-$ph['tableprefix'] = isset($_POST['tableprefix']) ? $_POST['tableprefix']: $table_prefix;
52
+$ph['database_name'] = isset($_POST['database_name']) ? $_POST['database_name'] : $database_name;
53
+$ph['tableprefix'] = isset($_POST['tableprefix']) ? $_POST['tableprefix'] : $table_prefix;
54 54
 $ph['selected_set_character_set'] = isset($database_connection_method) && $database_connection_method == 'SET CHARACTER SET' ? 'selected' : '';
55 55
 $ph['selected_set_names'] = isset($database_connection_method) && $database_connection_method == 'SET NAMES' ? 'selected' : '';
56 56
 $ph['show#connection_method'] = (($installMode == 0) || ($installMode == 2)) ? 'block' : 'none';
57
-$ph['database_collation'] = isset($_POST['database_collation']) ? $_POST['database_collation']: $database_collation;
58
-$ph['show#AUH'] = ($installMode == 0) ? 'block':'none';
59
-$ph['cmsadmin'] = isset($_POST['cmsadmin']) ? $_POST['cmsadmin']:'admin';
60
-$ph['cmsadminemail'] = isset($_POST['cmsadminemail']) ? $_POST['cmsadminemail']:"";
61
-$ph['cmspassword'] = isset($_POST['cmspassword']) ? $_POST['cmspassword']:"";
62
-$ph['cmspasswordconfirm'] = isset($_POST['cmspasswordconfirm']) ? $_POST['cmspasswordconfirm']:"";
57
+$ph['database_collation'] = isset($_POST['database_collation']) ? $_POST['database_collation'] : $database_collation;
58
+$ph['show#AUH'] = ($installMode == 0) ? 'block' : 'none';
59
+$ph['cmsadmin'] = isset($_POST['cmsadmin']) ? $_POST['cmsadmin'] : 'admin';
60
+$ph['cmsadminemail'] = isset($_POST['cmsadminemail']) ? $_POST['cmsadminemail'] : "";
61
+$ph['cmspassword'] = isset($_POST['cmspassword']) ? $_POST['cmspassword'] : "";
62
+$ph['cmspasswordconfirm'] = isset($_POST['cmspasswordconfirm']) ? $_POST['cmspasswordconfirm'] : "";
63 63
 $ph['managerLangs'] = getLangs($install_language);
64 64
 $ph['install_language'] = $install_language;
65 65
 $ph['installMode'] = $installMode;
66
-$ph['checkedChkagree']  = isset($_POST['chkagree']) ? 'checked':"";
66
+$ph['checkedChkagree']  = isset($_POST['chkagree']) ? 'checked' : "";
67 67
 $ph['database_connection_method'] = isset($database_connection_method) ? $database_connection_method : '';
68
-$ph['databasehost'] = isset($_POST['databasehost']) ? $_POST['databasehost']: $database_server;
69
-$ph['databaseloginname'] = isset($_SESSION['databaseloginname']) ? $_SESSION['databaseloginname']: '';
70
-$ph['databaseloginpassword'] = isset($_SESSION['databaseloginpassword']) ? $_SESSION['databaseloginpassword']: "";
68
+$ph['databasehost'] = isset($_POST['databasehost']) ? $_POST['databasehost'] : $database_server;
69
+$ph['databaseloginname'] = isset($_SESSION['databaseloginname']) ? $_SESSION['databaseloginname'] : '';
70
+$ph['databaseloginpassword'] = isset($_SESSION['databaseloginpassword']) ? $_SESSION['databaseloginpassword'] : "";
71 71
 $ph['MGR_DIR'] = MGR_DIR;
72 72
 
73 73
 $content = file_get_contents('./actions/tpl_connection.html');
74
-$content = parse($content, $_lang, '[%','%]');
74
+$content = parse($content, $_lang, '[%', '%]');
75 75
 $content = parse($content, $ph);
76 76
 echo $content;
77 77
\ No newline at end of file
Please login to merge, or discard this patch.
install/functions.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 function install_sessionCheck()
3 3
 {
4
-	global $_lang;
4
+    global $_lang;
5 5
 	
6
-	// session loop-back tester
7
-	if(!isset($_GET['action']) || $_GET['action']!=='mode')
8
-	{
9
-		if(!isset($_SESSION['test']) || $_SESSION['test']!=1)
10
-		{
11
-			echo '
6
+    // session loop-back tester
7
+    if(!isset($_GET['action']) || $_GET['action']!=='mode')
8
+    {
9
+        if(!isset($_SESSION['test']) || $_SESSION['test']!=1)
10
+        {
11
+            echo '
12 12
 <html>
13 13
 <head>
14 14
 	<title>Install Problem</title>
@@ -27,88 +27,88 @@  discard block
 block discarded – undo
27 27
 	</div>
28 28
 </body>
29 29
 </html>';
30
-		exit;
31
-		}
32
-	}
30
+        exit;
31
+        }
32
+    }
33 33
 }
34 34
 
35 35
 function parse($src,$ph,$left='[+',$right='+]')
36 36
 {
37
-	foreach($ph as $k=>$v)
38
-	{
39
-		$k = $left . $k . $right;
40
-		$src = str_replace($k,$v,$src);
41
-	}
42
-	return $src;
37
+    foreach($ph as $k=>$v)
38
+    {
39
+        $k = $left . $k . $right;
40
+        $src = str_replace($k,$v,$src);
41
+    }
42
+    return $src;
43 43
 }
44 44
 
45 45
 function ph()
46 46
 {
47
-	global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date;
47
+    global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date;
48 48
 
49
-	if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode'];
50
-	else                                $installmode = get_installmode();
49
+    if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode'];
50
+    else                                $installmode = get_installmode();
51 51
 
52
-	$ph['pagetitle']     = $_lang['modx_install'];
53
-	$ph['textdir']       = $modx_textdir ? ' id="rtl"':'';
54
-	$ph['help_link']     = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
55
-	$ph['version']       = $moduleVersion;
56
-	$ph['release_date']  = ($modx_textdir ? '&rlm;':'') . $modx_release_date;
57
-	$ph['footer1']       = $_lang['modx_footer1'];
58
-	$ph['footer2']       = $_lang['modx_footer2'];
59
-	$ph['current_year']  = date('Y');
60
-	return $ph;
52
+    $ph['pagetitle']     = $_lang['modx_install'];
53
+    $ph['textdir']       = $modx_textdir ? ' id="rtl"':'';
54
+    $ph['help_link']     = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
55
+    $ph['version']       = $moduleVersion;
56
+    $ph['release_date']  = ($modx_textdir ? '&rlm;':'') . $modx_release_date;
57
+    $ph['footer1']       = $_lang['modx_footer1'];
58
+    $ph['footer2']       = $_lang['modx_footer2'];
59
+    $ph['current_year']  = date('Y');
60
+    return $ph;
61 61
 }
62 62
 
63 63
 function get_installmode()
64 64
 {
65
-	global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix;
65
+    global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix;
66 66
 	
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
-	{
72
-		include_once("{$base_path}manager/includes/config.inc.php");
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
+    {
72
+        include_once("{$base_path}manager/includes/config.inc.php");
73 73
 		
74
-		if(!isset($dbase) || empty($dbase)) $installmode = 0;
75
-		else
76
-		{
77
-			$conn = mysqli_connect($database_server, $database_user, $database_password);
78
-			if($conn)
79
-			{
80
-				$_SESSION['database_server']   = $database_server;
81
-				$_SESSION['database_user']     = $database_user;
82
-				$_SESSION['database_password'] = $database_password;
74
+        if(!isset($dbase) || empty($dbase)) $installmode = 0;
75
+        else
76
+        {
77
+            $conn = mysqli_connect($database_server, $database_user, $database_password);
78
+            if($conn)
79
+            {
80
+                $_SESSION['database_server']   = $database_server;
81
+                $_SESSION['database_user']     = $database_user;
82
+                $_SESSION['database_password'] = $database_password;
83 83
 				
84
-				$dbase = trim($dbase, '`');
85
-				$rs = mysqli_select_db($conn, $dbase);
86
-			}
87
-			else $rs = false;
84
+                $dbase = trim($dbase, '`');
85
+                $rs = mysqli_select_db($conn, $dbase);
86
+            }
87
+            else $rs = false;
88 88
 			
89
-			if($rs)
90
-			{
91
-				$_SESSION['dbase']                      = $dbase;
92
-				$_SESSION['table_prefix']               = $table_prefix;
93
-				$_SESSION['database_collation']         = 'utf8_general_ci';
94
-				$_SESSION['database_connection_method'] = 'SET CHARACTER SET';
89
+            if($rs)
90
+            {
91
+                $_SESSION['dbase']                      = $dbase;
92
+                $_SESSION['table_prefix']               = $table_prefix;
93
+                $_SESSION['database_collation']         = 'utf8_general_ci';
94
+                $_SESSION['database_connection_method'] = 'SET CHARACTER SET';
95 95
 				
96
-				$tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`";
97
-				$rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'");
98
-				if($rs)
99
-				{
100
-					$row = mysqli_fetch_assoc($rs);
101
-					$settings_version = $row['setting_value'];
102
-				}
103
-				else $settings_version = '';
96
+                $tbl_system_settings = "`{$dbase}`.`{$table_prefix}system_settings`";
97
+                $rs = mysqli_query($conn, "SELECT setting_value FROM {$tbl_system_settings} WHERE setting_name='settings_version'");
98
+                if($rs)
99
+                {
100
+                    $row = mysqli_fetch_assoc($rs);
101
+                    $settings_version = $row['setting_value'];
102
+                }
103
+                else $settings_version = '';
104 104
 				
105
-				if (empty($settings_version)) $installmode = 0;
106
-				else                          $installmode = 1;
107
-			}
108
-			else $installmode = 1;
109
-		}
110
-	}
111
-	return $installmode;
105
+                if (empty($settings_version)) $installmode = 0;
106
+                else                          $installmode = 1;
107
+            }
108
+            else $installmode = 1;
109
+        }
110
+    }
111
+    return $installmode;
112 112
 }
113 113
 
114 114
 function getLangs($install_language)
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     sort($langs);
132 132
 
133 133
     $_ = array();
134
-   foreach ($langs as $language) {
134
+    foreach ($langs as $language) {
135 135
         $abrv_language = explode('.', $language);
136 136
         $selected = (strtolower($abrv_language[0]) == strtolower($manager_language)) ? ' selected' : '';
137 137
         $_[] = sprintf('<option value="%s" %s>%s</option>', $abrv_language[0], $selected,
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  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')
7
+	if (!isset($_GET['action']) || $_GET['action'] !== 'mode')
8 8
 	{
9
-		if(!isset($_SESSION['test']) || $_SESSION['test']!=1)
9
+		if (!isset($_SESSION['test']) || $_SESSION['test'] != 1)
10 10
 		{
11 11
 			echo '
12 12
 <html>
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 </head>
23 23
 <body>
24 24
 	<div class="install">
25
-		<p>' . $_lang["session_problem"] . '</p>
26
-		<p><a href="./">' .$_lang["session_problem_try_again"] . '</a></p>
25
+		<p>' . $_lang["session_problem"].'</p>
26
+		<p><a href="./">' .$_lang["session_problem_try_again"].'</a></p>
27 27
 	</div>
28 28
 </body>
29 29
 </html>';
@@ -32,28 +32,28 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 }
34 34
 
35
-function parse($src,$ph,$left='[+',$right='+]')
35
+function parse($src, $ph, $left = '[+', $right = '+]')
36 36
 {
37
-	foreach($ph as $k=>$v)
37
+	foreach ($ph as $k=>$v)
38 38
 	{
39
-		$k = $left . $k . $right;
40
-		$src = str_replace($k,$v,$src);
39
+		$k = $left.$k.$right;
40
+		$src = str_replace($k, $v, $src);
41 41
 	}
42 42
 	return $src;
43 43
 }
44 44
 
45 45
 function ph()
46 46
 {
47
-	global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date;
47
+	global $_lang, $moduleName, $moduleVersion, $modx_textdir, $modx_release_date;
48 48
 
49
-	if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode'];
49
+	if (isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode'];
50 50
 	else                                $installmode = get_installmode();
51 51
 
52 52
 	$ph['pagetitle']     = $_lang['modx_install'];
53
-	$ph['textdir']       = $modx_textdir ? ' id="rtl"':'';
53
+	$ph['textdir']       = $modx_textdir ? ' id="rtl"' : '';
54 54
 	$ph['help_link']     = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
55 55
 	$ph['version']       = $moduleVersion;
56
-	$ph['release_date']  = ($modx_textdir ? '&rlm;':'') . $modx_release_date;
56
+	$ph['release_date']  = ($modx_textdir ? '&rlm;' : '').$modx_release_date;
57 57
 	$ph['footer1']       = $_lang['modx_footer1'];
58 58
 	$ph['footer2']       = $_lang['modx_footer2'];
59 59
 	$ph['current_year']  = date('Y');
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 
63 63
 function get_installmode()
64 64
 {
65
-	global $base_path,$database_server, $database_user, $database_password, $dbase, $table_prefix;
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 68
 	if (!is_file($conf_path)) $installmode = 0;
69
-	elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode'];
69
+	elseif (isset($_POST['installmode'])) $installmode = $_POST['installmode'];
70 70
 	else
71 71
 	{
72 72
 		include_once("{$base_path}manager/includes/config.inc.php");
73 73
 		
74
-		if(!isset($dbase) || empty($dbase)) $installmode = 0;
74
+		if (!isset($dbase) || empty($dbase)) $installmode = 0;
75 75
 		else
76 76
 		{
77 77
 			$conn = mysqli_connect($database_server, $database_user, $database_password);
78
-			if($conn)
78
+			if ($conn)
79 79
 			{
80 80
 				$_SESSION['database_server']   = $database_server;
81 81
 				$_SESSION['database_user']     = $database_user;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			}
87 87
 			else $rs = false;
88 88
 			
89
-			if($rs)
89
+			if ($rs)
90 90
 			{
91 91
 				$_SESSION['dbase']                      = $dbase;
92 92
 				$_SESSION['table_prefix']               = $table_prefix;
@@ -95,7 +95,7 @@  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)
98
+				if ($rs)
99 99
 				{
100 100
 					$row = mysqli_fetch_assoc($rs);
101 101
 					$settings_version = $row['setting_value'];
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     }
121 121
 
122 122
     $langs = array();
123
-    if ($handle = opendir("../" . MGR_DIR . "/includes/lang")) {
123
+    if ($handle = opendir("../".MGR_DIR."/includes/lang")) {
124 124
         while (false !== ($file = readdir($handle))) {
125 125
             if (strpos($file, '.inc.') !== false) {
126 126
                 $langs[] = $file;
Please login to merge, or discard this patch.
install/connection.collation.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
 $pwd = $_POST['pwd'];
6 6
 
7 7
 $self = 'install/connection.collation.php';
8
-$base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
8
+$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
9 9
 if (is_file("{$base_path}assets/cache/siteManager.php")) {
10 10
 	include_once("{$base_path}assets/cache/siteManager.php");
11 11
 }
12
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
13
-	define('MGR_DIR','manager');
12
+if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
13
+	define('MGR_DIR', 'manager');
14 14
 }
15 15
 require_once('lang.php');
16 16
 
17
-if(function_exists('mysqli_connect')) {  
17
+if (function_exists('mysqli_connect')) {  
18 18
     $conn = mysqli_connect($host, $uid, $pwd);
19
-    if(!$conn) exit('can not connect');
19
+    if (!$conn) exit('can not connect');
20 20
 }
21 21
 else {
22 22
     exit('undefined function mysqli_connect()');
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
     $database_collation = htmlentities($_POST['database_collation']);
35 35
     $recommend_collation = $_lang['recommend_collation'];
36 36
     
37
-    if    (isset($_[$recommend_collation])) $_[$recommend_collation] = ' selected';
38
-    elseif(isset($_['utf8mb4_general_ci'])) $_['utf8mb4_general_ci'] = ' selected';
39
-    elseif(isset($_['utf8_general_ci']))    $_['utf8_general_ci']    = ' selected';
40
-    elseif(isset($_[$database_collation]))  $_[$database_collation]  = ' selected';
37
+    if (isset($_[$recommend_collation])) $_[$recommend_collation] = ' selected';
38
+    elseif (isset($_['utf8mb4_general_ci'])) $_['utf8mb4_general_ci'] = ' selected';
39
+    elseif (isset($_['utf8_general_ci']))    $_['utf8_general_ci']    = ' selected';
40
+    elseif (isset($_[$database_collation]))  $_[$database_collation]  = ' selected';
41 41
     
42
-    $_ = sortItem($_,$_lang['recommend_collations_order']);
42
+    $_ = sortItem($_, $_lang['recommend_collations_order']);
43 43
     
44
-    foreach($_ as $collation=>$selected) {
44
+    foreach ($_ as $collation=>$selected) {
45 45
         $collation = htmlentities($collation);
46 46
         // if(substr($collation,0,4)!=='utf8') continue;
47
-        if(strpos($collation,'sjis')===0) continue;
48
-        if($collation=='recommend')
47
+        if (strpos($collation, 'sjis') === 0) continue;
48
+        if ($collation == 'recommend')
49 49
             $output .= '<optgroup label="recommend">';
50
-        elseif($collation=='unrecommend')
50
+        elseif ($collation == 'unrecommend')
51 51
             $output .= '</optgroup><optgroup label="unrecommend">';
52 52
         else
53 53
             $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation);
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
 
61 61
 
62 62
 
63
-function sortItem($array=array(),$order='utf8mb4,utf8') {
63
+function sortItem($array = array(), $order = 'utf8mb4,utf8'){
64 64
     $rs = array('recommend'=>'');
65 65
     $order = explode(',', $order);
66
-    foreach($order as $v) {
67
-    	foreach($array as $name=>$sel) {
68
-        	if(strpos($name,$v)!==false) {
66
+    foreach ($order as $v) {
67
+    	foreach ($array as $name=>$sel) {
68
+        	if (strpos($name, $v) !== false) {
69 69
         		$rs[$name] = $array[$name];
70 70
         		unset($array[$name]);
71 71
         	}
72 72
     	}
73 73
     }
74
-    $rs['unrecommend']='';
74
+    $rs['unrecommend'] = '';
75 75
     return $rs + $array;
76 76
 }
Please login to merge, or discard this patch.
Braces   +26 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,11 +14,12 @@  discard block
 block discarded – undo
14 14
 }
15 15
 require_once('lang.php');
16 16
 
17
-if(function_exists('mysqli_connect')) {  
17
+if(function_exists('mysqli_connect')) {
18 18
     $conn = mysqli_connect($host, $uid, $pwd);
19
-    if(!$conn) exit('can not connect');
20
-}
21
-else {
19
+    if(!$conn) {
20
+        exit('can not connect');
21
+    }
22
+    } else {
22 23
     exit('undefined function mysqli_connect()');
23 24
 }
24 25
 
@@ -34,23 +35,31 @@  discard block
 block discarded – undo
34 35
     $database_collation = htmlentities($_POST['database_collation']);
35 36
     $recommend_collation = $_lang['recommend_collation'];
36 37
     
37
-    if    (isset($_[$recommend_collation])) $_[$recommend_collation] = ' selected';
38
-    elseif(isset($_['utf8mb4_general_ci'])) $_['utf8mb4_general_ci'] = ' selected';
39
-    elseif(isset($_['utf8_general_ci']))    $_['utf8_general_ci']    = ' selected';
40
-    elseif(isset($_[$database_collation]))  $_[$database_collation]  = ' selected';
38
+    if    (isset($_[$recommend_collation])) {
39
+        $_[$recommend_collation] = ' selected';
40
+    } elseif(isset($_['utf8mb4_general_ci'])) {
41
+        $_['utf8mb4_general_ci'] = ' selected';
42
+    } elseif(isset($_['utf8_general_ci'])) {
43
+        $_['utf8_general_ci']    = ' selected';
44
+    } elseif(isset($_[$database_collation])) {
45
+        $_[$database_collation]  = ' selected';
46
+    }
41 47
     
42 48
     $_ = sortItem($_,$_lang['recommend_collations_order']);
43 49
     
44 50
     foreach($_ as $collation=>$selected) {
45 51
         $collation = htmlentities($collation);
46 52
         // if(substr($collation,0,4)!=='utf8') continue;
47
-        if(strpos($collation,'sjis')===0) continue;
48
-        if($collation=='recommend')
49
-            $output .= '<optgroup label="recommend">';
50
-        elseif($collation=='unrecommend')
51
-            $output .= '</optgroup><optgroup label="unrecommend">';
52
-        else
53
-            $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation);
53
+        if(strpos($collation,'sjis')===0) {
54
+            continue;
55
+        }
56
+        if($collation=='recommend') {
57
+                    $output .= '<optgroup label="recommend">';
58
+        } elseif($collation=='unrecommend') {
59
+                    $output .= '</optgroup><optgroup label="unrecommend">';
60
+        } else {
61
+                    $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation);
62
+        }
54 63
     }
55 64
     $output .= '</optgroup></select>';
56 65
 }
@@ -60,7 +69,8 @@  discard block
 block discarded – undo
60 69
 
61 70
 
62 71
 
63
-function sortItem($array=array(),$order='utf8mb4,utf8') {
72
+function sortItem($array=array(),$order='utf8mb4,utf8')
73
+{
64 74
     $rs = array('recommend'=>'');
65 75
     $order = explode(',', $order);
66 76
     foreach($order as $v) {
Please login to merge, or discard this patch.
install/connection.servertest.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 $self = 'install/connection.servertest.php';
8 8
 $base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
9 9
 if (is_file("{$base_path}assets/cache/siteManager.php")) {
10
-	include_once("{$base_path}assets/cache/siteManager.php");
10
+    include_once("{$base_path}assets/cache/siteManager.php");
11 11
 }
12 12
 if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
13
-	define('MGR_DIR','manager');
13
+    define('MGR_DIR','manager');
14 14
 }
15 15
 require_once("lang.php");
16 16
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
33 33
             $strictMode = false;
34 34
             foreach ($modes as $mode) {
35
-    		    if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true;
35
+                if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true;
36 36
             }
37 37
             if ($strictMode) $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
38 38
         }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,17 +5,17 @@  discard block
 block discarded – undo
5 5
 $pwd = $_POST['pwd'];
6 6
 
7 7
 $self = 'install/connection.servertest.php';
8
-$base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
8
+$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
9 9
 if (is_file("{$base_path}assets/cache/siteManager.php")) {
10 10
 	include_once("{$base_path}assets/cache/siteManager.php");
11 11
 }
12
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
13
-	define('MGR_DIR','manager');
12
+if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
13
+	define('MGR_DIR', 'manager');
14 14
 }
15 15
 require_once("lang.php");
16 16
 
17 17
 $output = $_lang["status_connecting"];
18
-if(function_exists('mysqli_connect')) {
18
+if (function_exists('mysqli_connect')) {
19 19
     if (!$conn = @mysqli_connect($host, $uid, $pwd)) {
20 20
         $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>';
21 21
     }
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
         $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>';
24 24
 
25 25
         // Mysql version check
26
-        if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) {
26
+        if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
27 27
             $output .= '<br /><span style="color:#FF0000;"> '.$_lang['mysql_5051'].'</span>';
28 28
         }
29 29
         // Mode check
30 30
         $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode");
31
-        if (@mysqli_num_rows($mysqlmode) > 0){
31
+        if (@mysqli_num_rows($mysqlmode) > 0) {
32 32
             $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
33 33
             $strictMode = false;
34 34
             foreach ($modes as $mode) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
 if(function_exists('mysqli_connect')) {
19 19
     if (!$conn = @mysqli_connect($host, $uid, $pwd)) {
20 20
         $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>';
21
-    }
22
-    else {
21
+    } else {
23 22
         $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>';
24 23
 
25 24
         // Mysql version check
@@ -28,17 +27,20 @@  discard block
 block discarded – undo
28 27
         }
29 28
         // Mode check
30 29
         $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode");
31
-        if (@mysqli_num_rows($mysqlmode) > 0){
30
+        if (@mysqli_num_rows($mysqlmode) > 0) {
32 31
             $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
33 32
             $strictMode = false;
34 33
             foreach ($modes as $mode) {
35
-    		    if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true;
34
+    		    if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
35
+    		        $strictMode = true;
36
+    		    }
37
+            }
38
+            if ($strictMode) {
39
+                $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
36 40
             }
37
-            if ($strictMode) $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
38 41
         }
39 42
     }
40
-}
41
-else {
43
+} else {
42 44
     $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed_mysqli'].'</span>';
43 45
 }
44 46
 echo $output;
Please login to merge, or discard this patch.