@@ -1,19 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('f_owc')){ |
|
2 | +if( ! function_exists('f_owc')) { |
|
3 | 3 | /** |
4 | 4 | * @param $path |
5 | 5 | * @param $data |
6 | 6 | * @param null|int $mode |
7 | 7 | */ |
8 | - function f_owc($path, $data, $mode = null){ |
|
8 | + function f_owc($path, $data, $mode = null) |
|
9 | + { |
|
9 | 10 | try { |
10 | 11 | // make an attempt to create the file |
11 | 12 | $hnd = fopen($path, 'w'); |
12 | 13 | fwrite($hnd, $data); |
13 | 14 | fclose($hnd); |
14 | 15 | |
15 | - if(null !== $mode) chmod($path, $mode); |
|
16 | - }catch(Exception $e){ |
|
16 | + if(null !== $mode) { |
|
17 | + chmod($path, $mode); |
|
18 | + } |
|
19 | + } catch(Exception $e) { |
|
17 | 20 | // Nothing, this is NOT normal |
18 | 21 | unset($e); |
19 | 22 | } |
@@ -21,7 +24,9 @@ discard block |
||
21 | 24 | } |
22 | 25 | |
23 | 26 | $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
24 | -if( ! isset($_lang)) $_lang = array(); |
|
27 | +if( ! isset($_lang)) { |
|
28 | + $_lang = array(); |
|
29 | +} |
|
25 | 30 | |
26 | 31 | echo '<div class="stepcontainer"> |
27 | 32 | <ul class="progressbar"> |
@@ -57,7 +62,7 @@ discard block |
||
57 | 62 | // check if iconv is available |
58 | 63 | echo '<p>' . $_lang['checking_iconv']; |
59 | 64 | $iconv = (int) function_exists('iconv'); |
60 | -if ($iconv == '0'){ |
|
65 | +if ($iconv == '0') { |
|
61 | 66 | echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
62 | 67 | $errors++; |
63 | 68 | } else { |
@@ -119,7 +124,7 @@ discard block |
||
119 | 124 | |
120 | 125 | // File Browser directories exists? |
121 | 126 | echo '<p>'.$_lang['checking_if_images_exist']; |
122 | -switch(true){ |
|
127 | +switch(true) { |
|
123 | 128 | case !file_exists("../assets/images"): |
124 | 129 | case !file_exists("../assets/files"): |
125 | 130 | case !file_exists("../assets/backup"): |
@@ -134,7 +139,7 @@ discard block |
||
134 | 139 | |
135 | 140 | // File Browser directories writable? |
136 | 141 | echo '<p>'.$_lang['checking_if_images_writable']; |
137 | -switch(true){ |
|
142 | +switch(true) { |
|
138 | 143 | case !is_writable("../assets/images"): |
139 | 144 | case !is_writable("../assets/files"): |
140 | 145 | case !is_writable("../assets/backup"): |
@@ -268,7 +273,7 @@ discard block |
||
268 | 273 | if ($conn) { |
269 | 274 | echo '<p>'. $_lang['checking_mysql_strict_mode']; |
270 | 275 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
271 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
276 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
272 | 277 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
273 | 278 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
274 | 279 | // print_r($modes); |
@@ -305,9 +310,9 @@ discard block |
||
305 | 310 | echo '<p>'; |
306 | 311 | echo $_lang['setup_cannot_continue'] . ' '; |
307 | 312 | |
308 | - if($errors > 1){ |
|
313 | + if($errors > 1) { |
|
309 | 314 | echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
310 | - }else{ |
|
315 | + } else { |
|
311 | 316 | echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']; |
312 | 317 | } |
313 | 318 | |
@@ -343,23 +348,35 @@ discard block |
||
343 | 348 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
344 | 349 | <?php |
345 | 350 | $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
346 | - foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
|
351 | + foreach ($templates as $i => $template) { |
|
352 | + echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
|
353 | + } |
|
347 | 354 | |
348 | 355 | $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
349 | - foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
|
356 | + foreach ($tvs as $i => $tv) { |
|
357 | + echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
|
358 | + } |
|
350 | 359 | |
351 | 360 | $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
352 | - foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
|
361 | + foreach ($chunks as $i => $chunk) { |
|
362 | + echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
|
363 | + } |
|
353 | 364 | |
354 | 365 | $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
355 | - foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
|
366 | + foreach ($snippets as $i => $snippet) { |
|
367 | + echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
|
368 | + } |
|
356 | 369 | |
357 | 370 | $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
358 | - foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
|
371 | + foreach ($plugins as $i => $plugin) { |
|
372 | + echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
|
373 | + } |
|
359 | 374 | |
360 | 375 | $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
361 | - foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
|
362 | -?> |
|
376 | + foreach ($modules as $i => $module) { |
|
377 | + echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
|
378 | + } |
|
379 | + ?> |
|
363 | 380 | </div> |
364 | 381 | |
365 | 382 | <h2><?php echo $_lang['agree_to_terms'];?></h2> |
@@ -1,20 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | // Determine upgradeability |
3 | 3 | $upgradeable = 0; |
4 | -if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) { // Include the file so we can test its validity |
|
4 | +if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) { |
|
5 | +// Include the file so we can test its validity |
|
5 | 6 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
6 | 7 | // We need to have all connection settings - tho prefix may be empty so we have to ignore it |
7 | 8 | if (isset($dbase)) { |
8 | - if (!$conn = @mysqli_connect($database_server, $database_user, $database_password)) |
|
9 | - $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2; |
|
10 | - elseif (!@mysqli_select_db($conn, trim($dbase, '`'))) |
|
11 | - $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2; |
|
12 | - else |
|
13 | - $upgradeable = 1; |
|
9 | + if (!$conn = @mysqli_connect($database_server, $database_user, $database_password)) { |
|
10 | + $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2; |
|
11 | + } elseif (!@mysqli_select_db($conn, trim($dbase, '`'))) { |
|
12 | + $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2; |
|
13 | + } else { |
|
14 | + $upgradeable = 1; |
|
15 | + } |
|
16 | + } else { |
|
17 | + $upgradeable = 2; |
|
18 | + } |
|
14 | 19 | } |
15 | - else |
|
16 | - $upgradeable = 2; |
|
17 | -} |
|
18 | 20 | |
19 | 21 | $ph['moduleName'] = $moduleName; |
20 | 22 | $ph['displayNew'] = ($upgradeable!=0) ? 'display:none;' : ''; |
@@ -1,16 +1,18 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
3 | 3 | |
4 | -switch($installMode){ |
|
4 | +switch($installMode) { |
|
5 | 5 | case 0: |
6 | 6 | case 2: |
7 | 7 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
8 | 8 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
9 | 9 | $_POST['database_connection_charset'] = $database_charset; |
10 | - if(empty($_SESSION['databaseloginpassword'])) |
|
11 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
12 | - if(empty($_SESSION['databaseloginname'])) |
|
13 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
10 | + if(empty($_SESSION['databaseloginpassword'])) { |
|
11 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
12 | + } |
|
13 | + if(empty($_SESSION['databaseloginname'])) { |
|
14 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
15 | + } |
|
14 | 16 | break; |
15 | 17 | case 1: |
16 | 18 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
@@ -24,7 +26,9 @@ discard block |
||
24 | 26 | } |
25 | 27 | } |
26 | 28 | } |
27 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
29 | + if (empty ($database_collation)) { |
|
30 | + $database_collation = 'utf8_general_ci'; |
|
31 | + } |
|
28 | 32 | |
29 | 33 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
30 | 34 | if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
@@ -33,7 +37,9 @@ discard block |
||
33 | 37 | |
34 | 38 | if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
35 | 39 | $database_connection_method = 'SET CHARACTER SET'; |
36 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
40 | + if (function_exists('mysqli_set_charset')) { |
|
41 | + mysqli_set_charset($conn, $database_connection_charset); |
|
42 | + } |
|
37 | 43 | } |
38 | 44 | if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
39 | 45 | $database_connection_method = 'SET NAMES'; |
@@ -9,21 +9,24 @@ |
||
9 | 9 | $table_prefix= substr(md5(time()), rand(0, 27), rand(3, 5))."_"; |
10 | 10 | } else { |
11 | 11 | $database_name = ''; |
12 | - if (!is_file($base_path.MGR_DIR.'/includes/config.inc.php')) $upgradeable = 0; |
|
13 | - else { |
|
12 | + if (!is_file($base_path.MGR_DIR.'/includes/config.inc.php')) { |
|
13 | + $upgradeable = 0; |
|
14 | + } else { |
|
14 | 15 | // Include the file so we can test its validity |
15 | 16 | include($base_path.MGR_DIR.'/includes/config.inc.php'); |
16 | 17 | // We need to have all connection settings - but prefix may be empty so we have to ignore it |
17 | 18 | if ($dbase) { |
18 | 19 | $database_name = trim($dbase, '`'); |
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; |
|
23 | - else |
|
24 | - $upgradeable = 1; |
|
20 | + if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) { |
|
21 | + $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2; |
|
22 | + } elseif (! mysqli_select_db($conn, trim($dbase, '`'))) { |
|
23 | + $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2; |
|
24 | + } else { |
|
25 | + $upgradeable = 1; |
|
26 | + } |
|
27 | + } else { |
|
28 | + $upgradable= 2; |
|
25 | 29 | } |
26 | - else $upgradable= 2; |
|
27 | 30 | } |
28 | 31 | } |
29 | 32 |