@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('getLangOptions')) { |
|
2 | +if (!function_exists('getLangOptions')) { |
|
3 | 3 | /** |
4 | 4 | * @param string $install_language |
5 | 5 | * @return string |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $abrv_language = explode('-', $language); |
22 | 22 | $selected = ($language === $install_language) ? 'selected' : ''; |
23 | 23 | $_[] = sprintf('<option value="%s" %s>%s</option>', $language, $selected, |
24 | - ucwords($abrv_language[0])) . "\n"; |
|
24 | + ucwords($abrv_language[0]))."\n"; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | return implode("\n", $_); |
@@ -32,6 +32,6 @@ discard block |
||
32 | 32 | $content = parse($content, array( |
33 | 33 | 'langOptions' => getLangOptions($install_language)) |
34 | 34 | ); |
35 | -$content = parse($content, $_lang,'[%','%]'); |
|
35 | +$content = parse($content, $_lang, '[%', '%]'); |
|
36 | 36 | |
37 | 37 | echo $content; |
@@ -190,53 +190,53 @@ |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | switch($installMode){ |
193 | - case 0: |
|
194 | - case 2: |
|
195 | - $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
|
196 | - $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
197 | - $_POST['database_connection_charset'] = $database_charset; |
|
198 | - if(empty($_SESSION['databaseloginpassword'])) |
|
199 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | - if(empty($_SESSION['databaseloginname'])) |
|
201 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
202 | - break; |
|
203 | - case 1: |
|
204 | - include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
205 | - if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
|
206 | - if (@ mysqli_query($conn, "USE {$dbase}")) { |
|
207 | - if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
|
208 | - $rs = mysqli_query($conn, "show session variables like 'collation_server'"); |
|
209 | - } |
|
210 | - if ($rs && $collation = mysqli_fetch_row($rs)) { |
|
211 | - $database_collation = trim($collation[1]); |
|
193 | + case 0: |
|
194 | + case 2: |
|
195 | + $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
|
196 | + $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
197 | + $_POST['database_connection_charset'] = $database_charset; |
|
198 | + if(empty($_SESSION['databaseloginpassword'])) |
|
199 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | + if(empty($_SESSION['databaseloginname'])) |
|
201 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
202 | + break; |
|
203 | + case 1: |
|
204 | + include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
205 | + if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
|
206 | + if (@ mysqli_query($conn, "USE {$dbase}")) { |
|
207 | + if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
|
208 | + $rs = mysqli_query($conn, "show session variables like 'collation_server'"); |
|
209 | + } |
|
210 | + if ($rs && $collation = mysqli_fetch_row($rs)) { |
|
211 | + $database_collation = trim($collation[1]); |
|
212 | + } |
|
212 | 213 | } |
213 | 214 | } |
214 | - } |
|
215 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
215 | + if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
216 | 216 | |
217 | - $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
218 | - if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
|
219 | - $database_connection_charset = $database_charset; |
|
220 | - } |
|
217 | + $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
|
218 | + if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
|
219 | + $database_connection_charset = $database_charset; |
|
220 | + } |
|
221 | 221 | |
222 | - if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
|
223 | - $database_connection_method = 'SET CHARACTER SET'; |
|
224 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
225 | - } |
|
226 | - if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
|
227 | - $database_connection_method = 'SET NAMES'; |
|
228 | - } |
|
222 | + if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
|
223 | + $database_connection_method = 'SET CHARACTER SET'; |
|
224 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
225 | + } |
|
226 | + if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
|
227 | + $database_connection_method = 'SET NAMES'; |
|
228 | + } |
|
229 | 229 | |
230 | - $_POST['database_name'] = $dbase; |
|
231 | - $_POST['tableprefix'] = $table_prefix; |
|
232 | - $_POST['database_connection_charset'] = $database_connection_charset; |
|
233 | - $_POST['database_connection_method'] = $database_connection_method; |
|
234 | - $_POST['databasehost'] = $database_server; |
|
235 | - $_SESSION['databaseloginname'] = $database_user; |
|
236 | - $_SESSION['databaseloginpassword'] = $database_password; |
|
237 | - break; |
|
238 | - default: |
|
239 | - throw new Exception('installmode is undefined'); |
|
230 | + $_POST['database_name'] = $dbase; |
|
231 | + $_POST['tableprefix'] = $table_prefix; |
|
232 | + $_POST['database_connection_charset'] = $database_connection_charset; |
|
233 | + $_POST['database_connection_method'] = $database_connection_method; |
|
234 | + $_POST['databasehost'] = $database_server; |
|
235 | + $_SESSION['databaseloginname'] = $database_user; |
|
236 | + $_SESSION['databaseloginpassword'] = $database_password; |
|
237 | + break; |
|
238 | + default: |
|
239 | + throw new Exception('installmode is undefined'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | $ph['install_language'] = $install_language; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
2 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
3 | 3 | |
4 | -if( ! function_exists('getTemplates')) { |
|
4 | +if (!function_exists('getTemplates')) { |
|
5 | 5 | /** |
6 | 6 | * @param array $presets |
7 | 7 | * @return string |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | $i++; |
27 | 27 | } |
28 | 28 | if (0 < count($_)) { |
29 | - return '<h3>[%templates%]</h3>' . join("\n", $_); |
|
29 | + return '<h3>[%templates%]</h3>'.join("\n", $_); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | -if( ! function_exists('getTVs')) { |
|
34 | +if (!function_exists('getTVs')) { |
|
35 | 35 | /** |
36 | 36 | * @param array $presets |
37 | 37 | * @return string |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | $i++; |
57 | 57 | } |
58 | 58 | if (0 < count($_)) { |
59 | - return '<h3>[%tvs%]</h3>' . join("\n", $_); |
|
59 | + return '<h3>[%tvs%]</h3>'.join("\n", $_); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -if( ! function_exists('getChunks')) { |
|
64 | +if (!function_exists('getChunks')) { |
|
65 | 65 | /** |
66 | 66 | * display chunks |
67 | 67 | * |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | $i++; |
88 | 88 | } |
89 | 89 | if (0 < count($_)) { |
90 | - return '<h3>[%chunks%]</h3>' . join("\n", $_); |
|
90 | + return '<h3>[%chunks%]</h3>'.join("\n", $_); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | -if( ! function_exists('getModules')) { |
|
95 | +if (!function_exists('getModules')) { |
|
96 | 96 | /** |
97 | 97 | * display modules |
98 | 98 | * |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | $i++; |
119 | 119 | } |
120 | 120 | if (0 < count($_)) { |
121 | - return '<h3>[%modules%]</h3>' . join("\n", $_); |
|
121 | + return '<h3>[%modules%]</h3>'.join("\n", $_); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | -if( ! function_exists('getPlugins')) { |
|
126 | +if (!function_exists('getPlugins')) { |
|
127 | 127 | /** |
128 | 128 | * display plugins |
129 | 129 | * |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | $i++; |
154 | 154 | } |
155 | 155 | if (0 < count($_)) { |
156 | - return '<h3>[%plugins%]</h3>' . join("\n", $_); |
|
156 | + return '<h3>[%plugins%]</h3>'.join("\n", $_); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | -if( ! function_exists('getSnippets')) { |
|
161 | +if (!function_exists('getSnippets')) { |
|
162 | 162 | /** |
163 | 163 | * display snippets |
164 | 164 | * |
@@ -184,24 +184,24 @@ discard block |
||
184 | 184 | $i++; |
185 | 185 | } |
186 | 186 | if (0 < count($_)) { |
187 | - return '<h3>[%snippets%]</h3>' . join("\n", $_); |
|
187 | + return '<h3>[%snippets%]</h3>'.join("\n", $_); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | -switch($installMode){ |
|
192 | +switch ($installMode) { |
|
193 | 193 | case 0: |
194 | 194 | case 2: |
195 | 195 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
196 | 196 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
197 | 197 | $_POST['database_connection_charset'] = $database_charset; |
198 | - if(empty($_SESSION['databaseloginpassword'])) |
|
198 | + if (empty($_SESSION['databaseloginpassword'])) |
|
199 | 199 | $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
200 | - if(empty($_SESSION['databaseloginname'])) |
|
200 | + if (empty($_SESSION['databaseloginname'])) |
|
201 | 201 | $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
202 | 202 | break; |
203 | 203 | case 1: |
204 | - include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
204 | + include $base_path.MGR_DIR.'/includes/config.inc.php'; |
|
205 | 205 | if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
206 | 206 | if (@ mysqli_query($conn, "USE {$dbase}")) { |
207 | 207 | if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : ''; |
257 | 257 | |
258 | 258 | # load setup information file |
259 | -include($base_path . 'install/setup.info.php'); |
|
259 | +include($base_path.'install/setup.info.php'); |
|
260 | 260 | $ph['templates'] = getTemplates($moduleTemplates); |
261 | 261 | $ph['tvs'] = getTVs($moduleTVs); |
262 | 262 | $ph['chunks'] = getChunks($moduleChunks); |
@@ -266,6 +266,6 @@ discard block |
||
266 | 266 | |
267 | 267 | $ph['action'] = ($installMode == 1) ? 'mode' : 'connection'; |
268 | 268 | |
269 | -$tpl = file_get_contents($base_path . 'install/actions/tpl_options.html'); |
|
270 | -$content = parse($tpl,$ph); |
|
271 | -echo parse($content,$_lang,'[%','%]'); |
|
269 | +$tpl = file_get_contents($base_path.'install/actions/tpl_options.html'); |
|
270 | +$content = parse($tpl, $ph); |
|
271 | +echo parse($content, $_lang, '[%', '%]'); |
@@ -189,16 +189,18 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | -switch($installMode){ |
|
192 | +switch($installMode) { |
|
193 | 193 | case 0: |
194 | 194 | case 2: |
195 | 195 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
196 | 196 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
197 | 197 | $_POST['database_connection_charset'] = $database_charset; |
198 | - if(empty($_SESSION['databaseloginpassword'])) |
|
199 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | - if(empty($_SESSION['databaseloginname'])) |
|
201 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
198 | + if(empty($_SESSION['databaseloginpassword'])) { |
|
199 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
200 | + } |
|
201 | + if(empty($_SESSION['databaseloginname'])) { |
|
202 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
203 | + } |
|
202 | 204 | break; |
203 | 205 | case 1: |
204 | 206 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
@@ -212,7 +214,9 @@ discard block |
||
212 | 214 | } |
213 | 215 | } |
214 | 216 | } |
215 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
217 | + if (empty ($database_collation)) { |
|
218 | + $database_collation = 'utf8_general_ci'; |
|
219 | + } |
|
216 | 220 | |
217 | 221 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
218 | 222 | if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
@@ -221,7 +225,9 @@ discard block |
||
221 | 225 | |
222 | 226 | if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
223 | 227 | $database_connection_method = 'SET CHARACTER SET'; |
224 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
228 | + if (function_exists('mysqli_set_charset')) { |
|
229 | + mysqli_set_charset($conn, $database_connection_charset); |
|
230 | + } |
|
225 | 231 | } |
226 | 232 | if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
227 | 233 | $database_connection_method = 'SET NAMES'; |