@@ -4,7 +4,9 @@ discard block |
||
4 | 4 | if (is_file($base_path . 'assets/cache/siteManager.php')) { |
5 | 5 | include_once($base_path . 'assets/cache/siteManager.php'); |
6 | 6 | } |
7 | -if(!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
7 | +if(!defined('MGR_DIR')) { |
|
8 | + define('MGR_DIR', 'manager'); |
|
9 | +} |
|
8 | 10 | |
9 | 11 | require_once('../'.MGR_DIR.'/includes/version.inc.php'); |
10 | 12 | |
@@ -19,12 +21,12 @@ discard block |
||
19 | 21 | $mt = &$moduleTemplates; |
20 | 22 | if(is_dir($templatePath) && is_readable($templatePath)) { |
21 | 23 | $d = dir($templatePath); |
22 | - while (false !== ($tplfile = $d->read())) |
|
23 | - { |
|
24 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
24 | + while (false !== ($tplfile = $d->read())) { |
|
25 | + if(substr($tplfile, -4) != '.tpl') { |
|
26 | + continue; |
|
27 | + } |
|
25 | 28 | $params = parse_docblock($templatePath, $tplfile); |
26 | - if(is_array($params) && (count($params)>0)) |
|
27 | - { |
|
29 | + if(is_array($params) && (count($params)>0)) { |
|
28 | 30 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
29 | 31 | $mt[] = array |
30 | 32 | ( |
@@ -48,7 +50,9 @@ discard block |
||
48 | 50 | if(is_dir($tvPath) && is_readable($tvPath)) { |
49 | 51 | $d = dir($tvPath); |
50 | 52 | while (false !== ($tplfile = $d->read())) { |
51 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
53 | + if(substr($tplfile, -4) != '.tpl') { |
|
54 | + continue; |
|
55 | + } |
|
52 | 56 | $params = parse_docblock($tvPath, $tplfile); |
53 | 57 | if(is_array($params) && (count($params)>0)) { |
54 | 58 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
@@ -241,7 +245,8 @@ discard block |
||
241 | 245 | // setup callback function |
242 | 246 | $callBackFnc = "clean_up"; |
243 | 247 | |
244 | -function clean_up($sqlParser) { |
|
248 | +function clean_up($sqlParser) |
|
249 | +{ |
|
245 | 250 | $ids = array(); |
246 | 251 | $mysqlVerOk = -1; |
247 | 252 | |
@@ -259,9 +264,10 @@ discard block |
||
259 | 264 | $ds = mysqli_query($sqlParser->conn,$sql); |
260 | 265 | if(!$ds) { |
261 | 266 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
262 | - } |
|
263 | - else { |
|
264 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
267 | + } else { |
|
268 | + while($r = mysqli_fetch_assoc($ds)) { |
|
269 | + $ids[]=$r["id"]; |
|
270 | + } |
|
265 | 271 | if(count($ids)>0) { |
266 | 272 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
267 | 273 | unset($ids); |
@@ -278,9 +284,10 @@ discard block |
||
278 | 284 | $ds = mysqli_query($sqlParser->conn,$sql); |
279 | 285 | if(!$ds) { |
280 | 286 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
281 | - } |
|
282 | - else { |
|
283 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
287 | + } else { |
|
288 | + while($r = mysqli_fetch_assoc($ds)) { |
|
289 | + $ids[]=$r["id"]; |
|
290 | + } |
|
284 | 291 | if(count($ids)>0) { |
285 | 292 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
286 | 293 | unset($ids); |
@@ -288,7 +295,8 @@ discard block |
||
288 | 295 | } |
289 | 296 | } |
290 | 297 | |
291 | -function parse_docblock($element_dir, $filename) { |
|
298 | +function parse_docblock($element_dir, $filename) |
|
299 | +{ |
|
292 | 300 | $params = array(); |
293 | 301 | $fullpath = $element_dir . '/' . $filename; |
294 | 302 | if(is_readable($fullpath)) { |
@@ -4,11 +4,14 @@ |
||
4 | 4 | $content = parse($content,$_lang,'[%','%]'); |
5 | 5 | echo $content; |
6 | 6 | |
7 | -function getLangOptions($install_language='english') { |
|
7 | +function getLangOptions($install_language='english') |
|
8 | +{ |
|
8 | 9 | $langs = array(); |
9 | 10 | if( $handle = opendir('lang/') ) { |
10 | 11 | while( false !== ( $file = readdir( $handle ) ) ) { |
11 | - if( strpos( $file, '.' ) ) $langs[] = str_replace('.inc.php', '', $file); |
|
12 | + if( strpos( $file, '.' ) ) { |
|
13 | + $langs[] = str_replace('.inc.php', '', $file); |
|
14 | + } |
|
12 | 15 | } |
13 | 16 | closedir( $handle ); |
14 | 17 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | // check if iconv is available |
29 | 29 | echo "<p>" . $_lang['checking_iconv']; |
30 | 30 | $iconv = (int) function_exists('iconv'); |
31 | -if ($iconv == '0'){ |
|
31 | +if ($iconv == '0') { |
|
32 | 32 | echo "<span class=\"notok\">" . $_lang['failed']. "</span></p><p><strong>".$_lang['checking_iconv_note']."</strong></p>"; |
33 | 33 | $errors += 1; |
34 | 34 | } else { |
@@ -119,8 +119,9 @@ discard block |
||
119 | 119 | @ $hnd = fopen("../".MGR_DIR."/includes/config.inc.php", 'w'); |
120 | 120 | @ fwrite($hnd, "<?php //EVO configuration file ?>"); |
121 | 121 | @ fclose($hnd); |
122 | +} else { |
|
123 | + @chmod("../".MGR_DIR."/includes/config.inc.php", 0666); |
|
122 | 124 | } |
123 | -else @chmod("../".MGR_DIR."/includes/config.inc.php", 0666); |
|
124 | 125 | $isWriteable = is_writable("../".MGR_DIR."/includes/config.inc.php"); |
125 | 126 | if (!$isWriteable) { |
126 | 127 | echo "<span class=\"notok\">".$_lang['failed']."</span></p><p><strong>".$_lang['config_permissions_note']."</strong></p>"; |
@@ -212,7 +213,7 @@ discard block |
||
212 | 213 | if ($conn) { |
213 | 214 | echo "<p>". $_lang['checking_mysql_strict_mode']; |
214 | 215 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
215 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
216 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
216 | 217 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
217 | 218 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
218 | 219 | // print_r($modes); |
@@ -254,12 +255,21 @@ discard block |
||
254 | 255 | <?php |
255 | 256 | echo $_lang['setup_cannot_continue'] . ' '; |
256 | 257 | echo $errors > 1 ? $errors." " : ""; |
257 | - if ($errors > 1) echo $_lang['errors']; |
|
258 | - else echo $_lang['error']; |
|
259 | - if ($errors > 1) echo $_lang['please_correct_errors']; |
|
260 | - else echo $_lang['please_correct_error']; |
|
261 | - if ($errors > 1) echo $_lang['and_try_again_plural']; |
|
262 | - else echo $_lang['and_try_again']; |
|
258 | + if ($errors > 1) { |
|
259 | + echo $_lang['errors']; |
|
260 | + } else { |
|
261 | + echo $_lang['error']; |
|
262 | + } |
|
263 | + if ($errors > 1) { |
|
264 | + echo $_lang['please_correct_errors']; |
|
265 | + } else { |
|
266 | + echo $_lang['please_correct_error']; |
|
267 | + } |
|
268 | + if ($errors > 1) { |
|
269 | + echo $_lang['and_try_again_plural']; |
|
270 | + } else { |
|
271 | + echo $_lang['and_try_again']; |
|
272 | + } |
|
263 | 273 | echo $_lang['visit_forum']; |
264 | 274 | ?> |
265 | 275 | </p> |
@@ -294,17 +304,29 @@ discard block |
||
294 | 304 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
295 | 305 | <?php |
296 | 306 | $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
297 | -foreach ($templates as $i => $template) echo "<input type=\"hidden\" name=\"template[]\" value=\"$template\" />\n"; |
|
307 | +foreach ($templates as $i => $template) { |
|
308 | + echo "<input type=\"hidden\" name=\"template[]\" value=\"$template\" />\n"; |
|
309 | +} |
|
298 | 310 | $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
299 | -foreach ($tvs as $i => $tv) echo "<input type=\"hidden\" name=\"tv[]\" value=\"$tv\" />\n"; |
|
311 | +foreach ($tvs as $i => $tv) { |
|
312 | + echo "<input type=\"hidden\" name=\"tv[]\" value=\"$tv\" />\n"; |
|
313 | +} |
|
300 | 314 | $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
301 | -foreach ($chunks as $i => $chunk) echo "<input type=\"hidden\" name=\"chunk[]\" value=\"$chunk\" />\n"; |
|
315 | +foreach ($chunks as $i => $chunk) { |
|
316 | + echo "<input type=\"hidden\" name=\"chunk[]\" value=\"$chunk\" />\n"; |
|
317 | +} |
|
302 | 318 | $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
303 | -foreach ($snippets as $i => $snippet) echo "<input type=\"hidden\" name=\"snippet[]\" value=\"$snippet\" />\n"; |
|
319 | +foreach ($snippets as $i => $snippet) { |
|
320 | + echo "<input type=\"hidden\" name=\"snippet[]\" value=\"$snippet\" />\n"; |
|
321 | +} |
|
304 | 322 | $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
305 | -foreach ($plugins as $i => $plugin) echo "<input type=\"hidden\" name=\"plugin[]\" value=\"$plugin\" />\n"; |
|
323 | +foreach ($plugins as $i => $plugin) { |
|
324 | + echo "<input type=\"hidden\" name=\"plugin[]\" value=\"$plugin\" />\n"; |
|
325 | +} |
|
306 | 326 | $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
307 | -foreach ($modules as $i => $module) echo "<input type=\"hidden\" name=\"module[]\" value=\"$module\" />\n"; |
|
327 | +foreach ($modules as $i => $module) { |
|
328 | + echo "<input type=\"hidden\" name=\"module[]\" value=\"$module\" />\n"; |
|
329 | +} |
|
308 | 330 | ?> |
309 | 331 | </div> |
310 | 332 |
@@ -9,21 +9,24 @@ discard block |
||
9 | 9 | $table_prefix= 'evo_'; |
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 | // check the database collation if not specified in the configuration |
@@ -74,19 +77,25 @@ discard block |
||
74 | 77 | $content = parse($content, $ph); |
75 | 78 | echo $content; |
76 | 79 | |
77 | -function getLangs($install_language) { |
|
78 | - if (isset($_POST['managerlanguage'])) $manager_language = $_POST['managerlanguage']; |
|
79 | - elseif(isset($_GET['managerlanguage'])) $manager_language = $_GET['managerlanguage']; |
|
80 | - if ($install_language != "english" && is_file(sprintf("../%s/includes/lang/%s.inc.php",MGR_DIR,$install_language))) |
|
81 | - $manager_language = $install_language; |
|
82 | - else |
|
83 | - $manager_language = "english"; |
|
80 | +function getLangs($install_language) |
|
81 | +{ |
|
82 | + if (isset($_POST['managerlanguage'])) { |
|
83 | + $manager_language = $_POST['managerlanguage']; |
|
84 | + } elseif(isset($_GET['managerlanguage'])) { |
|
85 | + $manager_language = $_GET['managerlanguage']; |
|
86 | + } |
|
87 | + if ($install_language != "english" && is_file(sprintf("../%s/includes/lang/%s.inc.php",MGR_DIR,$install_language))) { |
|
88 | + $manager_language = $install_language; |
|
89 | + } else { |
|
90 | + $manager_language = "english"; |
|
91 | + } |
|
84 | 92 | |
85 | 93 | $langs = array(); |
86 | 94 | if ($handle = opendir("../".MGR_DIR."/includes/lang")) { |
87 | 95 | while (false !== ($file = readdir($handle))) { |
88 | - if (strpos($file, '.inc.') !== false) |
|
89 | - $langs[] = $file; |
|
96 | + if (strpos($file, '.inc.') !== false) { |
|
97 | + $langs[] = $file; |
|
98 | + } |
|
90 | 99 | } |
91 | 100 | closedir($handle); |
92 | 101 | } |
@@ -5,12 +5,13 @@ discard block |
||
5 | 5 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
6 | 6 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
7 | 7 | $_POST['database_connection_charset'] = $database_charset; |
8 | - if(empty($_SESSION['databaseloginpassword'])) |
|
9 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
10 | - if(empty($_SESSION['databaseloginname'])) |
|
11 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
12 | -} |
|
13 | -elseif ($installMode == 1) { |
|
8 | + if(empty($_SESSION['databaseloginpassword'])) { |
|
9 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
10 | + } |
|
11 | + if(empty($_SESSION['databaseloginname'])) { |
|
12 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
13 | + } |
|
14 | + } elseif ($installMode == 1) { |
|
14 | 15 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
15 | 16 | if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
16 | 17 | if (@ mysqli_query($conn, "USE {$dbase}")) { |
@@ -22,7 +23,9 @@ discard block |
||
22 | 23 | } |
23 | 24 | } |
24 | 25 | } |
25 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
26 | + if (empty ($database_collation)) { |
|
27 | + $database_collation = 'utf8_general_ci'; |
|
28 | + } |
|
26 | 29 | |
27 | 30 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
28 | 31 | if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
@@ -31,7 +34,9 @@ discard block |
||
31 | 34 | |
32 | 35 | if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
33 | 36 | $database_connection_method = 'SET CHARACTER SET'; |
34 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
37 | + if (function_exists('mysqli_set_charset')) { |
|
38 | + mysqli_set_charset($conn, $database_connection_charset); |
|
39 | + } |
|
35 | 40 | } |
36 | 41 | if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
37 | 42 | $database_connection_method = 'SET NAMES'; |
@@ -79,8 +84,11 @@ discard block |
||
79 | 84 | |
80 | 85 | |
81 | 86 | |
82 | -function getTemplates($presets=array()) { |
|
83 | - if(!count($presets)) return ''; |
|
87 | +function getTemplates($presets=array()) |
|
88 | +{ |
|
89 | + if(!count($presets)) { |
|
90 | + return ''; |
|
91 | + } |
|
84 | 92 | $selectedTemplates = isset ($_POST['template']) ? $_POST['template'] : array (); |
85 | 93 | $tpl = '<label><input type="checkbox" name="template[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />'; |
86 | 94 | $_ = array(); |
@@ -94,11 +102,16 @@ discard block |
||
94 | 102 | $_[] = parse($tpl,$ph); |
95 | 103 | $i++; |
96 | 104 | } |
97 | - if(0<count($_)) return '<h3>[%templates%]</h3>' . join("\n", $_); |
|
98 | -} |
|
105 | + if(0<count($_)) { |
|
106 | + return '<h3>[%templates%]</h3>' . join("\n", $_); |
|
107 | + } |
|
108 | + } |
|
99 | 109 | |
100 | -function getTVs($presets=array()) { |
|
101 | - if(!count($presets)) return ''; |
|
110 | +function getTVs($presets=array()) |
|
111 | +{ |
|
112 | + if(!count($presets)) { |
|
113 | + return ''; |
|
114 | + } |
|
102 | 115 | $selectedTvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
103 | 116 | $tpl = '<label><input type="checkbox" name="tv[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+alterName+] <span class="description">([+desc+])</span></label><hr />'; |
104 | 117 | $_ = array(); |
@@ -113,12 +126,17 @@ discard block |
||
113 | 126 | $_[] = parse($tpl,$ph); |
114 | 127 | $i++; |
115 | 128 | } |
116 | - if(0<count($_)) return '<h3>[%tvs%]</h3>' . join("\n", $_); |
|
117 | -} |
|
129 | + if(0<count($_)) { |
|
130 | + return '<h3>[%tvs%]</h3>' . join("\n", $_); |
|
131 | + } |
|
132 | + } |
|
118 | 133 | |
119 | 134 | // display chunks |
120 | -function getChunks($presets=array()) { |
|
121 | - if(!count($presets)) return ''; |
|
135 | +function getChunks($presets=array()) |
|
136 | +{ |
|
137 | + if(!count($presets)) { |
|
138 | + return ''; |
|
139 | + } |
|
122 | 140 | $selected = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
123 | 141 | $tpl = '<label><input type="checkbox" name="chunk[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />'; |
124 | 142 | $_ = array(); |
@@ -132,12 +150,17 @@ discard block |
||
132 | 150 | $_[] = parse($tpl,$ph); |
133 | 151 | $i++; |
134 | 152 | } |
135 | - if(0<count($_)) return '<h3>[%chunks%]</h3>' . join("\n", $_); |
|
136 | -} |
|
153 | + if(0<count($_)) { |
|
154 | + return '<h3>[%chunks%]</h3>' . join("\n", $_); |
|
155 | + } |
|
156 | + } |
|
137 | 157 | |
138 | 158 | // display modules |
139 | -function getModules($presets=array()) { |
|
140 | - if(!count($presets)) return ''; |
|
159 | +function getModules($presets=array()) |
|
160 | +{ |
|
161 | + if(!count($presets)) { |
|
162 | + return ''; |
|
163 | + } |
|
141 | 164 | $selected = isset ($_POST['module']) ? $_POST['module'] : array (); |
142 | 165 | $tpl = '<label><input type="checkbox" name="module[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />'; |
143 | 166 | $_ = array(); |
@@ -151,12 +174,17 @@ discard block |
||
151 | 174 | $_[] = parse($tpl,$ph); |
152 | 175 | $i++; |
153 | 176 | } |
154 | - if(0<count($_)) return '<h3>[%modules%]</h3>' . join("\n", $_); |
|
155 | -} |
|
177 | + if(0<count($_)) { |
|
178 | + return '<h3>[%modules%]</h3>' . join("\n", $_); |
|
179 | + } |
|
180 | + } |
|
156 | 181 | |
157 | 182 | // display plugins |
158 | -function getPlugins($presets=array()) { |
|
159 | - if(!count($presets)) return ''; |
|
183 | +function getPlugins($presets=array()) |
|
184 | +{ |
|
185 | + if(!count($presets)) { |
|
186 | + return ''; |
|
187 | + } |
|
160 | 188 | $selected = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
161 | 189 | $tpl = '<label><input type="checkbox" name="plugin[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />'; |
162 | 190 | $_ = array(); |
@@ -167,19 +195,24 @@ discard block |
||
167 | 195 | $ph['desc'] = $preset[1]; |
168 | 196 | if (is_array($preset[8])) { |
169 | 197 | $ph['class'] = !in_array('sample', $preset[8]) ? 'toggle' : 'toggle demo'; |
170 | - }else{ |
|
198 | + } else { |
|
171 | 199 | $ph['class'] = 'toggle demo'; |
172 | 200 | } |
173 | 201 | $ph['checked'] = in_array($i, $selected) || (!isset($_POST['options_selected'])) ? 'checked' : ''; |
174 | 202 | $_[] = parse($tpl,$ph); |
175 | 203 | $i++; |
176 | 204 | } |
177 | - if(0<count($_)) return '<h3>[%plugins%]</h3>' . join("\n", $_); |
|
178 | -} |
|
205 | + if(0<count($_)) { |
|
206 | + return '<h3>[%plugins%]</h3>' . join("\n", $_); |
|
207 | + } |
|
208 | + } |
|
179 | 209 | |
180 | 210 | // display snippets |
181 | -function getSnippets($presets=array()) { |
|
182 | - if(!count($presets)) return ''; |
|
211 | +function getSnippets($presets=array()) |
|
212 | +{ |
|
213 | + if(!count($presets)) { |
|
214 | + return ''; |
|
215 | + } |
|
183 | 216 | $selected = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
184 | 217 | $tpl = '<label><input type="checkbox" name="snippet[]" value="[+i+]" class="[+class+]" [+checked+] />[%install_update%] <span class="comname">[+name+]</span> - [+desc+]</label><hr />'; |
185 | 218 | $_ = array(); |
@@ -193,5 +226,7 @@ discard block |
||
193 | 226 | $_[] = parse($tpl,$ph); |
194 | 227 | $i++; |
195 | 228 | } |
196 | - if(0<count($_)) return '<h3>[%snippets%]</h3>' . join("\n", $_); |
|
197 | -} |
|
229 | + if(0<count($_)) { |
|
230 | + return '<h3>[%snippets%]</h3>' . join("\n", $_); |
|
231 | + } |
|
232 | + } |
@@ -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 | $ph['moduleName'] = $moduleName; |
19 | 21 | $ph['displayNew'] = ($upgradeable!=0) ? 'display:none;' : ''; |
20 | 22 | $ph['displayUpg'] = ($upgradeable==0) ? 'display:none;' : ''; |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | $output = $_lang["status_checking_database"]; |
19 | 19 | if (!$conn = mysqli_connect($host, $uid, $pwd)) { |
20 | 20 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>'; |
21 | -} |
|
22 | -else { |
|
21 | +} else { |
|
23 | 22 | $database_name = mysqli_real_escape_string($conn, $_POST['database_name']); |
24 | 23 | $database_name = str_replace("`", "", $database_name); |
25 | 24 | $tableprefix = mysqli_real_escape_string($conn, $_POST['tableprefix']); |
@@ -31,20 +30,16 @@ discard block |
||
31 | 30 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
32 | 31 | $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";"; |
33 | 32 | |
34 | - if (! mysqli_query($conn, $query)){ |
|
33 | + if (! mysqli_query($conn, $query)) { |
|
35 | 34 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>'; |
36 | - } |
|
37 | - else { |
|
35 | + } else { |
|
38 | 36 | $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>'; |
39 | 37 | } |
40 | - } |
|
41 | - elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) { |
|
38 | + } elseif (($installMode == 0) && (mysqli_query($conn, "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) { |
|
42 | 39 | $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>'; |
43 | - } |
|
44 | - elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) { |
|
40 | + } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn, "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) { |
|
45 | 41 | $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'], $row[1]).'</span>'; |
46 | - } |
|
47 | - else { |
|
42 | + } else { |
|
48 | 43 | $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>'; |
49 | 44 | } |
50 | 45 | } |
@@ -4,10 +4,8 @@ discard block |
||
4 | 4 | global $_lang; |
5 | 5 | |
6 | 6 | // session loop-back tester |
7 | - if(!isset($_GET['action']) || $_GET['action']!=='mode') |
|
8 | - { |
|
9 | - if(!isset($_SESSION['test']) || $_SESSION['test']!=1) |
|
10 | - { |
|
7 | + if(!isset($_GET['action']) || $_GET['action']!=='mode') { |
|
8 | + if(!isset($_SESSION['test']) || $_SESSION['test']!=1) { |
|
11 | 9 | echo ' |
12 | 10 | <html> |
13 | 11 | <head> |
@@ -34,8 +32,7 @@ discard block |
||
34 | 32 | |
35 | 33 | function parse($src,$ph,$left='[+',$right='+]') |
36 | 34 | { |
37 | - foreach($ph as $k=>$v) |
|
38 | - { |
|
35 | + foreach($ph as $k=>$v) { |
|
39 | 36 | $k = $left . $k . $right; |
40 | 37 | $src = str_replace($k,$v,$src); |
41 | 38 | } |
@@ -46,8 +43,11 @@ discard block |
||
46 | 43 | { |
47 | 44 | global $_lang,$moduleName,$moduleVersion,$modx_textdir,$modx_release_date; |
48 | 45 | |
49 | - if(isset($_SESSION['installmode'])) $installmode = $_SESSION['installmode']; |
|
50 | - else $installmode = get_installmode(); |
|
46 | + if(isset($_SESSION['installmode'])) { |
|
47 | + $installmode = $_SESSION['installmode']; |
|
48 | + } else { |
|
49 | + $installmode = get_installmode(); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | $ph['pagetitle'] = $_lang['modx_install']; |
53 | 53 | $ph['textdir'] = $modx_textdir ? ' id="rtl"':''; |
@@ -65,29 +65,29 @@ discard block |
||
65 | 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 | - if (!is_file($conf_path)) $installmode = 0; |
|
69 | - elseif(isset($_POST['installmode'])) $installmode = $_POST['installmode']; |
|
70 | - else |
|
71 | - { |
|
68 | + if (!is_file($conf_path)) { |
|
69 | + $installmode = 0; |
|
70 | + } elseif(isset($_POST['installmode'])) { |
|
71 | + $installmode = $_POST['installmode']; |
|
72 | + } else { |
|
72 | 73 | include_once("{$base_path}manager/includes/config.inc.php"); |
73 | 74 | |
74 | - if(!isset($dbase) || empty($dbase)) $installmode = 0; |
|
75 | - else |
|
76 | - { |
|
75 | + if(!isset($dbase) || empty($dbase)) { |
|
76 | + $installmode = 0; |
|
77 | + } else { |
|
77 | 78 | $conn = mysqli_connect($database_server, $database_user, $database_password); |
78 | - if($conn) |
|
79 | - { |
|
79 | + if($conn) { |
|
80 | 80 | $_SESSION['database_server'] = $database_server; |
81 | 81 | $_SESSION['database_user'] = $database_user; |
82 | 82 | $_SESSION['database_password'] = $database_password; |
83 | 83 | |
84 | 84 | $dbase = trim($dbase, '`'); |
85 | 85 | $rs = mysqli_select_db($conn, $dbase); |
86 | + } else { |
|
87 | + $rs = false; |
|
86 | 88 | } |
87 | - else $rs = false; |
|
88 | 89 | |
89 | - if($rs) |
|
90 | - { |
|
90 | + if($rs) { |
|
91 | 91 | $_SESSION['dbase'] = $dbase; |
92 | 92 | $_SESSION['table_prefix'] = $table_prefix; |
93 | 93 | $_SESSION['database_collation'] = 'utf8_general_ci'; |
@@ -95,17 +95,21 @@ discard block |
||
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) |
|
99 | - { |
|
98 | + if($rs) { |
|
100 | 99 | $row = mysqli_fetch_assoc($rs); |
101 | 100 | $settings_version = $row['setting_value']; |
101 | + } else { |
|
102 | + $settings_version = ''; |
|
102 | 103 | } |
103 | - else $settings_version = ''; |
|
104 | 104 | |
105 | - if (empty($settings_version)) $installmode = 0; |
|
106 | - else $installmode = 1; |
|
105 | + if (empty($settings_version)) { |
|
106 | + $installmode = 0; |
|
107 | + } else { |
|
108 | + $installmode = 1; |
|
109 | + } |
|
110 | + } else { |
|
111 | + $installmode = 1; |
|
107 | 112 | } |
108 | - else $installmode = 1; |
|
109 | 113 | } |
110 | 114 | } |
111 | 115 | return $installmode; |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | $output = $_lang["status_connecting"]; |
18 | 18 | if (!$conn = @mysqli_connect($host, $uid, $pwd)) { |
19 | 19 | $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>'; |
20 | -} |
|
21 | -else { |
|
20 | +} else { |
|
22 | 21 | $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>'; |
23 | 22 | |
24 | 23 | // Mysql version check |
@@ -27,13 +26,17 @@ discard block |
||
27 | 26 | } |
28 | 27 | // Mode check |
29 | 28 | $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode"); |
30 | - if (@mysqli_num_rows($mysqlmode) > 0){ |
|
29 | + if (@mysqli_num_rows($mysqlmode) > 0) { |
|
31 | 30 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
32 | 31 | $strictMode = false; |
33 | 32 | foreach ($modes as $mode) { |
34 | - if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) $strictMode = true; |
|
33 | + if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
|
34 | + $strictMode = true; |
|
35 | + } |
|
36 | + } |
|
37 | + if ($strictMode) { |
|
38 | + $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>'; |
|
35 | 39 | } |
36 | - if ($strictMode) $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>'; |
|
37 | 40 | } |
38 | 41 | } |
39 | 42 | echo $output; |