@@ -1,5 +1,5 @@ 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 |
@@ -12,30 +12,30 @@ discard block |
||
12 | 12 | fwrite($hnd, $data); |
13 | 13 | fclose($hnd); |
14 | 14 | |
15 | - if(null !== $mode) chmod($path, $mode); |
|
16 | - }catch(Exception $e){ |
|
15 | + if (null !== $mode) chmod($path, $mode); |
|
16 | + } catch (Exception $e) { |
|
17 | 17 | // Nothing, this is NOT normal |
18 | 18 | unset($e); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
24 | -if( ! isset($_lang)) $_lang = array(); |
|
23 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
24 | +if (!isset($_lang)) $_lang = array(); |
|
25 | 25 | |
26 | 26 | echo '<div class="stepcontainer"> |
27 | 27 | <ul class="progressbar"> |
28 | - <li class="visited">' . $_lang['choose_language'] . '</li> |
|
29 | - <li class="visited">' . $_lang['installation_mode'] . '</li> |
|
30 | - <li class="visited">' . $_lang['optional_items'] . '</li> |
|
31 | - <li class="active">' . $_lang['preinstall_validation'] . '</li> |
|
32 | - <li>' . $_lang['install_results'] . '</li> |
|
28 | + <li class="visited">' . $_lang['choose_language'].'</li> |
|
29 | + <li class="visited">' . $_lang['installation_mode'].'</li> |
|
30 | + <li class="visited">' . $_lang['optional_items'].'</li> |
|
31 | + <li class="active">' . $_lang['preinstall_validation'].'</li> |
|
32 | + <li>' . $_lang['install_results'].'</li> |
|
33 | 33 | </ul> |
34 | 34 | <div class="clearleft"></div> |
35 | 35 | </div>'; |
36 | 36 | |
37 | -echo '<h2>' . $_lang['preinstall_validation'] . '</h2>'; |
|
38 | -echo '<h3>' . $_lang['summary_setup_check'] . '</h3>'; |
|
37 | +echo '<h2>'.$_lang['preinstall_validation'].'</h2>'; |
|
38 | +echo '<h3>'.$_lang['summary_setup_check'].'</h3>'; |
|
39 | 39 | |
40 | 40 | $errors = 0; |
41 | 41 | |
@@ -43,73 +43,73 @@ discard block |
||
43 | 43 | // check PHP version |
44 | 44 | define('PHP_MIN_VERSION', '5.4.0'); |
45 | 45 | $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility |
46 | -echo '<p>' . $_lang['checking_php_version']; |
|
46 | +echo '<p>'.$_lang['checking_php_version']; |
|
47 | 47 | // -1 if left is less, 0 if equal, +1 if left is higher |
48 | 48 | if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) { |
49 | 49 | $errors++; |
50 | - $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
51 | - echo '<span class="notok">' . $_lang['failed'] . '</span>' . $tmp . '</p>'; |
|
50 | + $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
51 | + echo '<span class="notok">'.$_lang['failed'].'</span>'.$tmp.'</p>'; |
|
52 | 52 | } else { |
53 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
53 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | // check if iconv is available |
58 | -echo '<p>' . $_lang['checking_iconv']; |
|
58 | +echo '<p>'.$_lang['checking_iconv']; |
|
59 | 59 | $iconv = (int) function_exists('iconv'); |
60 | -if ($iconv == '0'){ |
|
61 | - echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
60 | +if ($iconv == '0') { |
|
61 | + echo '<span class="notok">'.$_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
62 | 62 | $errors++; |
63 | 63 | } else { |
64 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
64 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
65 | 65 | } |
66 | 66 | // check sessions |
67 | -echo '<p>' . $_lang['checking_sessions']; |
|
67 | +echo '<p>'.$_lang['checking_sessions']; |
|
68 | 68 | if ($_SESSION['test'] != 1) { |
69 | - echo '<span class="notok">' . $_lang['failed']. '</span></p>'; |
|
69 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
70 | 70 | $errors++; |
71 | 71 | } else { |
72 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
72 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | // check directories |
77 | 77 | // cache exists? |
78 | -echo '<p>' . $_lang['checking_if_cache_exist']; |
|
78 | +echo '<p>'.$_lang['checking_if_cache_exist']; |
|
79 | 79 | if (!file_exists("../assets/cache") || !file_exists("../assets/cache/rss")) { |
80 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
80 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
81 | 81 | $errors++; |
82 | 82 | } else { |
83 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
83 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | 87 | // cache writable? |
88 | -echo '<p>' . $_lang['checking_if_cache_writable']; |
|
88 | +echo '<p>'.$_lang['checking_if_cache_writable']; |
|
89 | 89 | if (!is_writable("../assets/cache")) { |
90 | 90 | $errors++; |
91 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
91 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
92 | 92 | } else { |
93 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
93 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | 97 | // cache files writable? |
98 | -echo '<p>' . $_lang['checking_if_cache_file_writable']; |
|
98 | +echo '<p>'.$_lang['checking_if_cache_file_writable']; |
|
99 | 99 | $tmp = "../assets/cache/siteCache.idx.php"; |
100 | -if ( ! file_exists($tmp)) { |
|
100 | +if (!file_exists($tmp)) { |
|
101 | 101 | f_owc($tmp, "<?php //EVO site cache file ?>"); |
102 | 102 | } |
103 | -if ( ! is_writable($tmp)) { |
|
103 | +if (!is_writable($tmp)) { |
|
104 | 104 | $errors++; |
105 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
105 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
106 | 106 | } else { |
107 | 107 | echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | echo '<p>'.$_lang['checking_if_cache_file2_writable']; |
112 | -if ( ! is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
112 | +if (!is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
113 | 113 | $errors++; |
114 | 114 | echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
115 | 115 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // File Browser directories exists? |
121 | 121 | echo '<p>'.$_lang['checking_if_images_exist']; |
122 | -switch(true){ |
|
122 | +switch (true) { |
|
123 | 123 | case !file_exists("../assets/images"): |
124 | 124 | case !file_exists("../assets/files"): |
125 | 125 | case !file_exists("../assets/backup"): |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | // File Browser directories writable? |
136 | 136 | echo '<p>'.$_lang['checking_if_images_writable']; |
137 | -switch(true){ |
|
137 | +switch (true) { |
|
138 | 138 | case !is_writable("../assets/images"): |
139 | 139 | case !is_writable("../assets/files"): |
140 | 140 | case !is_writable("../assets/backup"): |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); |
195 | 195 | $database_connection_charset = $_POST['database_connection_charset']; |
196 | 196 | $database_connection_method = $_POST['database_connection_method']; |
197 | - $dbase = '`' . $_POST['database_name'] . '`'; |
|
197 | + $dbase = '`'.$_POST['database_name'].'`'; |
|
198 | 198 | $table_prefix = $_POST['tableprefix']; |
199 | 199 | } |
200 | 200 | echo '<p>'.$_lang['creating_database_connection']; |
@@ -234,54 +234,54 @@ discard block |
||
234 | 234 | |
235 | 235 | // check table prefix |
236 | 236 | if ($conn && $installMode == 0) { |
237 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
238 | - if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
239 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_already_inuse'] . '</p>'; |
|
237 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
238 | + if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
239 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_already_inuse'].'</p>'; |
|
240 | 240 | $errors++; |
241 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . '</p>'; |
|
241 | + echo "<p>".$_lang['table_prefix_already_inuse_note'].'</p>'; |
|
242 | 242 | } else { |
243 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
243 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
244 | 244 | } |
245 | 245 | } elseif ($conn && $installMode == 2) { |
246 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
247 | - if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
248 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>'; |
|
246 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
247 | + if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
248 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_not_exist'].'</p>'; |
|
249 | 249 | $errors++; |
250 | - echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>'; |
|
250 | + echo '<p>'.$_lang['table_prefix_not_exist_note'].'</p>'; |
|
251 | 251 | } else { |
252 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
252 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | 256 | // check mysql version |
257 | 257 | if ($conn) { |
258 | - echo '<p>' . $_lang['checking_mysql_version']; |
|
259 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
260 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong>' . $_lang['mysql_5051'] . '</strong></p>'; |
|
261 | - echo '<p><span class="notok">' . $_lang['mysql_5051_warning'] . '</span></p>'; |
|
258 | + echo '<p>'.$_lang['checking_mysql_version']; |
|
259 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
260 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong>'.$_lang['mysql_5051'].'</strong></p>'; |
|
261 | + echo '<p><span class="notok">'.$_lang['mysql_5051_warning'].'</span></p>'; |
|
262 | 262 | } else { |
263 | - echo '<span class="ok">' . $_lang['ok'] . '</span> <strong>' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . '</strong></p>'; |
|
263 | + echo '<span class="ok">'.$_lang['ok'].'</span> <strong>'.$_lang['mysql_version_is'].mysqli_get_server_info($conn).'</strong></p>'; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | // check for strict mode |
268 | 268 | if ($conn) { |
269 | - echo '<p>'. $_lang['checking_mysql_strict_mode']; |
|
269 | + echo '<p>'.$_lang['checking_mysql_strict_mode']; |
|
270 | 270 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
271 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
271 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
272 | 272 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
273 | 273 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
274 | 274 | // print_r($modes); |
275 | 275 | foreach ($modes as $mode) { |
276 | 276 | if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
277 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong> ' . $_lang['strict_mode'] . '</strong></p>'; |
|
278 | - echo '<p><span class="notok">' . $_lang['strict_mode_error'] . '</span></p>'; |
|
277 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong> '.$_lang['strict_mode'].'</strong></p>'; |
|
278 | + echo '<p><span class="notok">'.$_lang['strict_mode_error'].'</span></p>'; |
|
279 | 279 | } else { |
280 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
280 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | } else { |
284 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
284 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | // Version and strict mode check end |
@@ -297,18 +297,18 @@ discard block |
||
297 | 297 | f_owc("../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>'); |
298 | 298 | } |
299 | 299 | |
300 | -if($installMode > 0 && $_POST['installdata'] == "1") { |
|
301 | - echo '<p class="notes"><strong>' . $_lang['sample_web_site'] . ':</strong> ' . $_lang['sample_web_site_note'] . '</p>'; |
|
300 | +if ($installMode > 0 && $_POST['installdata'] == "1") { |
|
301 | + echo '<p class="notes"><strong>'.$_lang['sample_web_site'].':</strong> '.$_lang['sample_web_site_note'].'</p>'; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | if ($errors > 0) { |
305 | 305 | echo '<p>'; |
306 | - echo $_lang['setup_cannot_continue'] . ' '; |
|
306 | + echo $_lang['setup_cannot_continue'].' '; |
|
307 | 307 | |
308 | - if($errors > 1){ |
|
309 | - echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
|
310 | - }else{ |
|
311 | - echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']; |
|
308 | + if ($errors > 1) { |
|
309 | + echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural']; |
|
310 | + } else { |
|
311 | + echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again']; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | echo $_lang['visit_forum']; |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | |
318 | 318 | echo '<p> </p>'; |
319 | 319 | |
320 | -$nextAction= $errors > 0 ? 'summary' : 'install'; |
|
321 | -$nextButton= $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
322 | -$nextVisibility= $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
323 | -$agreeToggle= $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
320 | +$nextAction = $errors > 0 ? 'summary' : 'install'; |
|
321 | +$nextButton = $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
322 | +$nextVisibility = $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
323 | +$agreeToggle = $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
324 | 324 | ?> |
325 | 325 | <form name="install" id="install_form" action="index.php?action=<?php echo $nextAction ?>" method="post"> |
326 | 326 | <div> |
@@ -342,32 +342,32 @@ discard block |
||
342 | 342 | |
343 | 343 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
344 | 344 | <?php |
345 | - $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
|
345 | + $templates = isset ($_POST['template']) ? $_POST['template'] : array(); |
|
346 | 346 | foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
347 | 347 | |
348 | - $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
|
348 | + $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array(); |
|
349 | 349 | foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
350 | 350 | |
351 | - $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
|
351 | + $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array(); |
|
352 | 352 | foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
353 | 353 | |
354 | - $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
|
354 | + $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array(); |
|
355 | 355 | foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
356 | 356 | |
357 | - $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
|
357 | + $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array(); |
|
358 | 358 | foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
359 | 359 | |
360 | - $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
|
360 | + $modules = isset ($_POST['module']) ? $_POST['module'] : array(); |
|
361 | 361 | foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
362 | 362 | ?> |
363 | 363 | </div> |
364 | 364 | |
365 | -<h2><?php echo $_lang['agree_to_terms'];?></h2> |
|
365 | +<h2><?php echo $_lang['agree_to_terms']; ?></h2> |
|
366 | 366 | <p> |
367 | -<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ':""; ?><?php echo $agreeToggle;?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
367 | +<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ' : ""; ?><?php echo $agreeToggle; ?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
368 | 368 | </p> |
369 | 369 | <p class="buttonlinks"> |
370 | 370 | <a href="javascript:document.getElementById('install_form').action='index.php?action=options&language=<?php echo $install_language?>';document.getElementById('install_form').submit();" class="prev" title="<?php echo $_lang['btnback_value']?>"><span><?php echo $_lang['btnback_value']?></span></a> |
371 | - <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility;?>"><span><?php echo $nextButton ?></span></a> |
|
371 | + <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility; ?>"><span><?php echo $nextButton ?></span></a> |
|
372 | 372 | </p> |
373 | 373 | </form> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser{ |
|
7 | 7 | public $host; |
8 | 8 | public $dbname; |
9 | 9 | public $prefix; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | public $autoTemplateLogic; |
30 | 30 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
31 | + public function __construct($host, $user, $password, $db, $prefix = 'modx_', $adminname, $adminemail, $adminpass, $connection_charset = 'utf8', $managerlanguage = 'english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent'){ |
|
32 | 32 | $this->host = $host; |
33 | 33 | $this->dbname = $db; |
34 | 34 | $this->prefix = $prefix; |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 45 | } |
46 | 46 | |
47 | - public function connect() { |
|
47 | + public function connect(){ |
|
48 | 48 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
49 | 49 | mysqli_select_db($this->conn, $this->dbname); |
50 | 50 | if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
51 | 51 | |
52 | 52 | $this->dbVersion = 3.23; // assume version 3.23 |
53 | - if(function_exists("mysqli_get_server_info")) { |
|
53 | + if (function_exists("mysqli_get_server_info")) { |
|
54 | 54 | $ver = mysqli_get_server_info($this->conn); |
55 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
55 | + $this->dbMODx = version_compare($ver, "4.0.2"); |
|
56 | 56 | $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
57 | 57 | } |
58 | 58 | |
59 | - mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
|
59 | + mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}"); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function process($filename) { |
|
62 | + public function process($filename){ |
|
63 | 63 | global $custom_placeholders; |
64 | 64 | |
65 | 65 | // check to make sure file exists |
66 | 66 | if (!file_exists($filename)) { |
67 | 67 | $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
68 | - $this->installFailed = true ; |
|
68 | + $this->installFailed = true; |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | // check if in upgrade mode |
83 | 83 | if ($this->mode === 'upd') { |
84 | 84 | // remove non-upgradeable parts |
85 | - $s = strpos($idata,'non-upgrade-able[['); |
|
86 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | - if($s && $e) { |
|
88 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
85 | + $s = strpos($idata, 'non-upgrade-able[['); |
|
86 | + $e = strpos($idata, ']]non-upgrade-able') + 17; |
|
87 | + if ($s && $e) { |
|
88 | + $idata = str_replace(substr($idata, $s, $e - $s), ' Removed non upgradeable items', $idata); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
103 | 103 | |
104 | 104 | // Replace custom placeholders |
105 | - foreach($custom_placeholders as $key=>$val) { |
|
105 | + foreach ($custom_placeholders as $key=>$val) { |
|
106 | 106 | if (strpos($idata, '{'.$key.'}') !== false) { |
107 | 107 | $idata = str_replace('{'.$key.'}', $val, $idata); |
108 | 108 | } |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | $sql_array = explode("\n\n", $idata); |
112 | 112 | |
113 | 113 | $num = 0; |
114 | - foreach($sql_array as $sql_entry) { |
|
114 | + foreach ($sql_array as $sql_entry) { |
|
115 | 115 | $sql_do = trim($sql_entry, "\r\n; "); |
116 | 116 | |
117 | 117 | if (preg_match('/^\#/', $sql_do)) continue; |
118 | 118 | |
119 | 119 | // strip out comments and \n for mysql 3.x |
120 | - if ($this->dbVersion <4.0) { |
|
121 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
120 | + if ($this->dbVersion < 4.0) { |
|
121 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do); |
|
122 | 122 | $sql_do = str_replace('\r', "", $sql_do); |
123 | 123 | $sql_do = str_replace('\n', "", $sql_do); |
124 | 124 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | $num = $num + 1; |
128 | 128 | if ($sql_do) mysqli_query($this->conn, $sql_do); |
129 | - if(mysqli_error($this->conn)) { |
|
129 | + if (mysqli_error($this->conn)) { |
|
130 | 130 | // Ignore duplicate and drop errors - Raymond |
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
131 | + if ($this->ignoreDuplicateErrors) { |
|
132 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue; |
|
133 | 133 | } |
134 | 134 | // End Ignore duplicate |
135 | 135 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - public function close() { |
|
141 | + public function close(){ |
|
142 | 142 | mysqli_close($this->conn); |
143 | 143 | } |
144 | 144 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'sv' => 'svenska' |
38 | 38 | ); |
39 | 39 | $_langISO6391 = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); |
40 | -if (! empty($_langFiles[$_langISO6391])) { |
|
40 | +if (!empty($_langFiles[$_langISO6391])) { |
|
41 | 41 | $install_language = $_langFiles[$_langISO6391]; |
42 | 42 | } |
43 | 43 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | # load language file |
53 | 53 | require_once 'lang/english.inc.php'; // As fallback |
54 | -require_once 'lang/' . $install_language . '.inc.php'; |
|
54 | +require_once 'lang/'.$install_language.'.inc.php'; |
|
55 | 55 | |
56 | 56 | $manager_language = $install_language; |
57 | 57 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * |
16 | 16 | * Please commit your language changes on Transifex (https://www.transifex.com/projects/p/modx-evolution/) or on GitHub (https://github.com/modxcms/evolution). |
17 | 17 | */ |
18 | -setlocale (LC_ALL, 'ru_RU.UTF-8'); |
|
18 | +setlocale(LC_ALL, 'ru_RU.UTF-8'); |
|
19 | 19 | $_lang["agree_to_terms"] = 'Согласиться с условиями лицензии и приступить к установке'; |
20 | 20 | $_lang["alert_database_test_connection"] = 'Вы должны создать базу данных или выбрать базу данных для проверки!'; |
21 | 21 | $_lang["alert_database_test_connection_failed"] = 'Неудачная проверка выбранной базы данных!'; |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //:: EVO Installer Setup file |
3 | 3 | //::::::::::::::::::::::::::::::::::::::::: |
4 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
5 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
4 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
5 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
6 | 6 | } |
7 | 7 | if (!defined('MGR_DIR')) { |
8 | 8 | define('MGR_DIR', 'manager'); |
9 | 9 | } |
10 | 10 | |
11 | -require_once(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/version.inc.php'); |
|
11 | +require_once(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/version.inc.php'); |
|
12 | 12 | |
13 | -$chunkPath = $base_path . 'install/assets/chunks'; |
|
14 | -$snippetPath = $base_path . 'install/assets/snippets'; |
|
15 | -$pluginPath = $base_path . 'install/assets/plugins'; |
|
16 | -$modulePath = $base_path . 'install/assets/modules'; |
|
17 | -$templatePath = $base_path . 'install/assets/templates'; |
|
18 | -$tvPath = $base_path . 'install/assets/tvs'; |
|
13 | +$chunkPath = $base_path.'install/assets/chunks'; |
|
14 | +$snippetPath = $base_path.'install/assets/snippets'; |
|
15 | +$pluginPath = $base_path.'install/assets/plugins'; |
|
16 | +$modulePath = $base_path.'install/assets/modules'; |
|
17 | +$templatePath = $base_path.'install/assets/templates'; |
|
18 | +$tvPath = $base_path.'install/assets/tvs'; |
|
19 | 19 | |
20 | 20 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
21 | 21 | $mt = &$moduleTemplates; |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | $params = parse_docblock($templatePath, $tplfile); |
29 | 29 | if (is_array($params) && (count($params) > 0)) { |
30 | 30 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
31 | - $mt[] = array |
|
32 | - ( |
|
31 | + $mt[] = array( |
|
33 | 32 | $params['name'], |
34 | 33 | $description, |
35 | 34 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -149,7 +148,7 @@ discard block |
||
149 | 148 | $params['modx_category'], |
150 | 149 | $params['legacy_names'], |
151 | 150 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
152 | - (int)$params['disabled'] |
|
151 | + (int) $params['disabled'] |
|
153 | 152 | ); |
154 | 153 | } |
155 | 154 | } |
@@ -174,12 +173,12 @@ discard block |
||
174 | 173 | "$modulePath/{$params['filename']}", |
175 | 174 | $params['properties'], |
176 | 175 | $params['guid'], |
177 | - (int)$params['shareparams'], |
|
176 | + (int) $params['shareparams'], |
|
178 | 177 | $params['modx_category'], |
179 | 178 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
180 | 179 | ); |
181 | 180 | } |
182 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
181 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
183 | 182 | $dependencies = explode(',', $params['dependencies']); |
184 | 183 | foreach ($dependencies as $dependency) { |
185 | 184 | $dependency = explode(':', $dependency); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @deprecated EvolutionCMS\Legacy\ErrorHandler |
6 | 6 | * @todo could be unnecessary |
7 | 7 | */ |
8 | -class errorHandler extends EvolutionCMS\Legacy\ErrorHandler { |
|
8 | +class errorHandler extends EvolutionCMS\Legacy\ErrorHandler{ |
|
9 | 9 | public function include_lang($context = 'common') |
10 | 10 | { |
11 | 11 | parent::includeLang($context); |
@@ -71,11 +71,11 @@ |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($context === 'common') { |
74 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
74 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
75 | 75 | } else { |
76 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
76 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
77 | 77 | } |
78 | - include_once($lang_path . 'english.inc.php'); |
|
78 | + include_once($lang_path.'english.inc.php'); |
|
79 | 79 | $manager_language = $modx->config['manager_language']; |
80 | 80 | if (is_file("{$lang_path}{$manager_language}.inc.php")) { |
81 | 81 | include_once("{$lang_path}{$manager_language}.inc.php"); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
21 | 21 | |
22 | 22 | foreach ($this->elements as $element) { |
23 | - $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element); |
|
23 | + $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->db->select( |
55 | 55 | '*', |
56 | 56 | $this->db_tbl['categories'], |
57 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
57 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | { |
72 | 72 | $_value = $this->db->getValue( |
73 | 73 | $this->db->select( |
74 | - '`' . $value . '`', |
|
74 | + '`'.$value.'`', |
|
75 | 75 | $this->db_tbl['categories'], |
76 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
76 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->db->select( |
93 | 93 | '*', |
94 | 94 | $this->db_tbl[$element], |
95 | - "`category` = '" . (int)$category_id . "'" |
|
95 | + "`category` = '".(int) $category_id."'" |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | $this->db->update( |
136 | 136 | $_update, |
137 | 137 | $this->db_tbl[$element], |
138 | - "`category` = '" . (int)$category_id . "'" |
|
138 | + "`category` = '".(int) $category_id."'" |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
142 | 142 | $this->db->delete( |
143 | 143 | $this->db_tbl['categories'], |
144 | - "`id` = '" . (int)$category_id . "'" |
|
144 | + "`id` = '".(int) $category_id."'" |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | return $this->db->getAffectedRows() === 1; |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | |
161 | 161 | $_update = array( |
162 | 162 | 'category' => $this->db->escape($data['category']), |
163 | - 'rank' => (int)$data['rank'] |
|
163 | + 'rank' => (int) $data['rank'] |
|
164 | 164 | ); |
165 | 165 | |
166 | 166 | $this->db->update( |
167 | 167 | $_update, |
168 | 168 | $this->db_tbl['categories'], |
169 | - "`id` = '" . (int)$category_id . "'" |
|
169 | + "`id` = '".(int) $category_id."'" |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | if ($this->db->getAffectedRows() === 1) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $_insert = array( |
191 | 191 | 'category' => $this->db->escape($category_name), |
192 | - 'rank' => (int)$category_rank |
|
192 | + 'rank' => (int) $category_rank |
|
193 | 193 | ); |
194 | 194 | |
195 | 195 | $this->db->insert( |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $this->db->select( |
217 | 217 | '`id`', |
218 | 218 | $this->db_tbl['categories'], |
219 | - "`category` = '" . $category . "'" |
|
219 | + "`category` = '".$category."'" |
|
220 | 220 | ) |
221 | 221 | ); |
222 | 222 |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | $countChild++; |
91 | 91 | $id = $value[0]; |
92 | 92 | $ph['id'] = $id; |
93 | - $ph['li_class'] = $this->getItemClass($id) . $value[10]; |
|
93 | + $ph['li_class'] = $this->getItemClass($id).$value[10]; |
|
94 | 94 | $ph['href'] = $value[3]; |
95 | 95 | $ph['alt'] = $value[4]; |
96 | 96 | $ph['target'] = $value[7]; |
97 | 97 | $ph['onclick'] = $value[5]; |
98 | 98 | $ph['a_class'] = $this->getLinkClass($id); |
99 | 99 | $ph['LinkAttr'] = $this->getLinkAttr($id); |
100 | - $ph['itemName'] = $value[2] . $this->getItemName($id); |
|
100 | + $ph['itemName'] = $value[2].$this->getItemName($id); |
|
101 | 101 | |
102 | 102 | $ph['DrawSub'] = ''; |
103 | 103 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public function getLinkClass($id) |
146 | 146 | { |
147 | 147 | if (isset($this->menu[$id])) { |
148 | - return ' class="' . $this->defaults['parentLinkClass'] . '"'; |
|
148 | + return ' class="'.$this->defaults['parentLinkClass'].'"'; |
|
149 | 149 | } else { |
150 | 150 | return ''; |
151 | 151 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public function getItemClass($id) |
172 | 172 | { |
173 | 173 | if (isset($this->menu[$id])) { |
174 | - return $this->defaults['parentClass'] . ' '; |
|
174 | + return $this->defaults['parentClass'].' '; |
|
175 | 175 | } else { |
176 | 176 | return ''; |
177 | 177 | } |