Completed
Push — develop ( 663a1f...4a4b5c )
by Agel_Nash
15s
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 1 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 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
     foreach ($_ as $collation=>$selected) {
51 51
         $collation = htmlentities($collation);
52 52
         // if(substr($collation,0,4)!=='utf8') continue;
53
-        if (strpos($collation, 'sjis')===0) {
53
+        if (strpos($collation, 'sjis') === 0) {
54 54
             continue;
55 55
         }
56
-        if ($collation=='recommend') {
56
+        if ($collation == 'recommend') {
57 57
             $output .= '<optgroup label="recommend">';
58
-        } elseif ($collation=='unrecommend') {
58
+        } elseif ($collation == 'unrecommend') {
59 59
             $output .= '</optgroup><optgroup label="unrecommend">';
60 60
         } else {
61 61
             $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation);
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
 echo $output;
68 68
 exit;
69 69
 
70
-function sortItem($array=array(), $order='utf8mb4,utf8')
70
+function sortItem($array = array(), $order = 'utf8mb4,utf8')
71 71
 {
72 72
     $rs = array('recommend'=>'');
73 73
     $order = explode(',', $order);
74 74
     foreach ($order as $v) {
75 75
         foreach ($array as $name=>$sel) {
76
-            if (strpos($name, $v)!==false) {
76
+            if (strpos($name, $v) !== false) {
77 77
                 $rs[$name] = $array[$name];
78 78
                 unset($array[$name]);
79 79
             }
80 80
         }
81 81
     }
82
-    $rs['unrecommend']='';
82
+    $rs['unrecommend'] = '';
83 83
     return $rs + $array;
84 84
 }
85 85
\ No newline at end of file
Please login to merge, or discard this patch.