Completed
Pull Request — develop (#526)
by
unknown
06:55
created
install/connection.collation.php 1 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 1 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.