@@ -57,10 +57,12 @@ discard block |
||
57 | 57 | |
58 | 58 | $args = array_slice($argv, 1); |
59 | 59 | |
60 | -if ( empty($args) ){ |
|
60 | +if ( empty($args) ) { |
|
61 | 61 | echo 'Install Evolution CMS?'.PHP_EOL; |
62 | 62 | $installYes = readline("Type 'y' to continue: "); |
63 | - if ($installYes != 'y') return; |
|
63 | + if ($installYes != 'y') { |
|
64 | + return; |
|
65 | + } |
|
64 | 66 | |
65 | 67 | //set param manual |
66 | 68 | $databasehost = readline($_lang['connection_screen_database_host']. ' [localhost] '); |
@@ -76,7 +78,7 @@ discard block |
||
76 | 78 | $managerlanguage = readline('Мanager language:' . ' [en] '); |
77 | 79 | $installData = readline('Instal demo-site (y/n):' . ' [n] '); |
78 | 80 | |
79 | -}else{ |
|
81 | +} else { |
|
80 | 82 | |
81 | 83 | $cli_variables = []; |
82 | 84 | foreach ($args as $arg) { |
@@ -130,21 +132,24 @@ discard block |
||
130 | 132 | } |
131 | 133 | |
132 | 134 | ////////////////////////////////////////////////////////////////////////////////////// |
133 | -if( ! function_exists('f_owc')){ |
|
135 | +if( ! function_exists('f_owc')) { |
|
134 | 136 | /** |
135 | 137 | * @param $path |
136 | 138 | * @param $data |
137 | 139 | * @param null|int $mode |
138 | 140 | */ |
139 | - function f_owc($path, $data, $mode = null){ |
|
141 | + function f_owc($path, $data, $mode = null) |
|
142 | + { |
|
140 | 143 | try { |
141 | 144 | // make an attempt to create the file |
142 | 145 | $hnd = fopen($path, 'w'); |
143 | 146 | fwrite($hnd, $data); |
144 | 147 | fclose($hnd); |
145 | 148 | |
146 | - if(null !== $mode) chmod($path, $mode); |
|
147 | - }catch(Exception $e){ |
|
149 | + if(null !== $mode) { |
|
150 | + chmod($path, $mode); |
|
151 | + } |
|
152 | + } catch(Exception $e) { |
|
148 | 153 | // Nothing, this is NOT normal |
149 | 154 | unset($e); |
150 | 155 | } |
@@ -210,7 +215,7 @@ discard block |
||
210 | 215 | |
211 | 216 | // File Browser directories exists? |
212 | 217 | echo strip_tags($_lang['checking_if_images_exist']); |
213 | -switch(true){ |
|
218 | +switch(true) { |
|
214 | 219 | case !file_exists("../assets/images"): |
215 | 220 | case !file_exists("../assets/files"): |
216 | 221 | case !file_exists("../assets/backup"): |
@@ -225,7 +230,7 @@ discard block |
||
225 | 230 | |
226 | 231 | // File Browser directories writable? |
227 | 232 | echo strip_tags($_lang['checking_if_images_writable']); |
228 | -switch(true){ |
|
233 | +switch(true) { |
|
229 | 234 | case !is_writable("../assets/images"): |
230 | 235 | case !is_writable("../assets/files"): |
231 | 236 | case !is_writable("../assets/backup"): |
@@ -361,7 +366,7 @@ discard block |
||
361 | 366 | if ($conn) { |
362 | 367 | echo $_lang['checking_mysql_strict_mode']; |
363 | 368 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
364 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
369 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
365 | 370 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
366 | 371 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
367 | 372 | // print_r($modes); |
@@ -397,9 +402,9 @@ discard block |
||
397 | 402 | if ($errors > 0) { |
398 | 403 | echo $_lang['setup_cannot_continue'] . ' '; |
399 | 404 | |
400 | - if($errors > 1){ |
|
405 | + if($errors > 1) { |
|
401 | 406 | echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
402 | - }else{ |
|
407 | + } else { |
|
403 | 408 | echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL; |
404 | 409 | } |
405 | 410 | |
@@ -412,7 +417,7 @@ discard block |
||
412 | 417 | |
413 | 418 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
414 | 419 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
415 | -}else{ |
|
420 | +} else { |
|
416 | 421 | define('MGR_DIR', 'manager'); |
417 | 422 | } |
418 | 423 | |
@@ -453,13 +458,15 @@ discard block |
||
453 | 458 | |
454 | 459 | // get base path and url |
455 | 460 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
456 | -if (count($a) > 1) |
|
461 | +if (count($a) > 1) { |
|
457 | 462 | array_pop($a); |
463 | +} |
|
458 | 464 | $url = implode("install", $a); |
459 | 465 | reset($a); |
460 | 466 | $a = explode("install", str_replace("\\", "/", realpath(dirname(__FILE__)))); |
461 | -if (count($a) > 1) |
|
467 | +if (count($a) > 1) { |
|
462 | 468 | array_pop($a); |
469 | +} |
|
463 | 470 | $pth = implode("install", $a); |
464 | 471 | unset ($a); |
465 | 472 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -480,7 +487,9 @@ discard block |
||
480 | 487 | echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL; |
481 | 488 | $create = true; |
482 | 489 | } else { |
483 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
490 | + if (function_exists('mysqli_set_charset')) { |
|
491 | + mysqli_set_charset($conn, $database_charset); |
|
492 | + } |
|
484 | 493 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
485 | 494 | echo $_lang['ok'].PHP_EOL; |
486 | 495 | } |
@@ -526,7 +535,8 @@ discard block |
||
526 | 535 | * @param string $propertyString |
527 | 536 | * @return array |
528 | 537 | */ |
529 | - function parseProperties($propertyString) { |
|
538 | + function parseProperties($propertyString) |
|
539 | + { |
|
530 | 540 | $parameter= array (); |
531 | 541 | if (!empty ($propertyString)) { |
532 | 542 | $tmpParams= explode("&", $propertyString); |
@@ -535,11 +545,14 @@ discard block |
||
535 | 545 | if (strpos($tmpParams[$x], '=', 0)) { |
536 | 546 | $pTmp= explode("=", $tmpParams[$x]); |
537 | 547 | $pvTmp= explode(";", trim($pTmp[1])); |
538 | - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
|
539 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
548 | + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { |
|
549 | + $parameter[trim($pTmp[0])]= $pvTmp[3]; |
|
550 | + } |
|
551 | + //list default |
|
540 | 552 | else |
541 | - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
|
542 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
553 | + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { |
|
554 | + $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
555 | + } |
|
543 | 556 | } |
544 | 557 | } |
545 | 558 | } |
@@ -587,12 +600,12 @@ discard block |
||
587 | 600 | $mt = &$moduleTemplates; |
588 | 601 | if(is_dir($templatePath) && is_readable($templatePath)) { |
589 | 602 | $d = dir($templatePath); |
590 | - while (false !== ($tplfile = $d->read())) |
|
591 | - { |
|
592 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
603 | + while (false !== ($tplfile = $d->read())) { |
|
604 | + if(substr($tplfile, -4) != '.tpl') { |
|
605 | + continue; |
|
606 | + } |
|
593 | 607 | $params = parse_docblock($templatePath, $tplfile); |
594 | - if(is_array($params) && (count($params)>0)) |
|
595 | - { |
|
608 | + if(is_array($params) && (count($params)>0)) { |
|
596 | 609 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
597 | 610 | $mt[] = array |
598 | 611 | ( |
@@ -616,7 +629,9 @@ discard block |
||
616 | 629 | if(is_dir($tvPath) && is_readable($tvPath)) { |
617 | 630 | $d = dir($tvPath); |
618 | 631 | while (false !== ($tplfile = $d->read())) { |
619 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
632 | + if(substr($tplfile, -4) != '.tpl') { |
|
633 | + continue; |
|
634 | + } |
|
620 | 635 | $params = parse_docblock($tvPath, $tplfile); |
621 | 636 | if(is_array($params) && (count($params)>0)) { |
622 | 637 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
@@ -809,7 +824,8 @@ discard block |
||
809 | 824 | // setup callback function |
810 | 825 | $callBackFnc = "clean_up"; |
811 | 826 | |
812 | -function clean_up($sqlParser) { |
|
827 | +function clean_up($sqlParser) |
|
828 | +{ |
|
813 | 829 | $ids = array(); |
814 | 830 | |
815 | 831 | // secure web documents - privateweb |
@@ -822,9 +838,10 @@ discard block |
||
822 | 838 | $ds = mysqli_query($sqlParser->conn,$sql); |
823 | 839 | if(!$ds) { |
824 | 840 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
825 | - } |
|
826 | - else { |
|
827 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
841 | + } else { |
|
842 | + while($r = mysqli_fetch_assoc($ds)) { |
|
843 | + $ids[]=$r["id"]; |
|
844 | + } |
|
828 | 845 | if(count($ids)>0) { |
829 | 846 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
830 | 847 | unset($ids); |
@@ -841,9 +858,10 @@ discard block |
||
841 | 858 | $ds = mysqli_query($sqlParser->conn,$sql); |
842 | 859 | if(!$ds) { |
843 | 860 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
844 | - } |
|
845 | - else { |
|
846 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
861 | + } else { |
|
862 | + while($r = mysqli_fetch_assoc($ds)) { |
|
863 | + $ids[]=$r["id"]; |
|
864 | + } |
|
847 | 865 | if(count($ids)>0) { |
848 | 866 | mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
849 | 867 | unset($ids); |
@@ -851,7 +869,8 @@ discard block |
||
851 | 869 | } |
852 | 870 | } |
853 | 871 | |
854 | -function parse_docblock($element_dir, $filename) { |
|
872 | +function parse_docblock($element_dir, $filename) |
|
873 | +{ |
|
855 | 874 | $params = array(); |
856 | 875 | $fullpath = $element_dir . '/' . $filename; |
857 | 876 | if(is_readable($fullpath)) { |
@@ -952,7 +971,7 @@ discard block |
||
952 | 971 | // custom or not |
953 | 972 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
954 | 973 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
955 | -}else{ |
|
974 | +} else { |
|
956 | 975 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
957 | 976 | } |
958 | 977 | |
@@ -1092,7 +1111,9 @@ discard block |
||
1092 | 1111 | echo mysqli_error($sqlParser->conn) . PHP_EOL; |
1093 | 1112 | die(); |
1094 | 1113 | } |
1095 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1114 | + if(!is_null($save_sql_id_as)) { |
|
1115 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1116 | + } |
|
1096 | 1117 | echo " $name: " . $_lang['installed'] . PHP_EOL; |
1097 | 1118 | } |
1098 | 1119 | } |
@@ -1187,9 +1208,9 @@ discard block |
||
1187 | 1208 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
1188 | 1209 | $filecontent = $moduleChunk[2]; |
1189 | 1210 | |
1190 | - if (!file_exists($filecontent)) |
|
1191 | - echo " $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1192 | - else { |
|
1211 | + if (!file_exists($filecontent)) { |
|
1212 | + echo " $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1213 | + } else { |
|
1193 | 1214 | |
1194 | 1215 | // Create the category if it does not already exist |
1195 | 1216 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -1242,9 +1263,9 @@ discard block |
||
1242 | 1263 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
1243 | 1264 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
1244 | 1265 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
1245 | - if (!file_exists($filecontent)) |
|
1246 | - echo " $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1247 | - else { |
|
1266 | + if (!file_exists($filecontent)) { |
|
1267 | + echo " $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1268 | + } else { |
|
1248 | 1269 | |
1249 | 1270 | // Create the category if it does not already exist |
1250 | 1271 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -1262,7 +1283,7 @@ discard block |
||
1262 | 1283 | } |
1263 | 1284 | echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
1264 | 1285 | } else { |
1265 | - if ($properties != NULL ){ |
|
1286 | + if ($properties != NULL ) { |
|
1266 | 1287 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1267 | 1288 | } |
1268 | 1289 | if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
@@ -1297,9 +1318,9 @@ discard block |
||
1297 | 1318 | // parse comma-separated legacy names and prepare them for sql IN clause |
1298 | 1319 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
1299 | 1320 | } |
1300 | - if (!file_exists($filecontent)) |
|
1301 | - echo " $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1302 | - else { |
|
1321 | + if (!file_exists($filecontent)) { |
|
1322 | + echo " $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1323 | + } else { |
|
1303 | 1324 | |
1304 | 1325 | // disable legacy versions based on legacy_names provided |
1305 | 1326 | if(!empty($leg_names)) { |
@@ -1318,7 +1339,7 @@ discard block |
||
1318 | 1339 | $insert = true; |
1319 | 1340 | while($row = mysqli_fetch_assoc($rs)) { |
1320 | 1341 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
1321 | - if($row['description'] == $desc){ |
|
1342 | + if($row['description'] == $desc) { |
|
1322 | 1343 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
1323 | 1344 | echo mysqli_error($sqlParser->conn) . PHP_EOL; |
1324 | 1345 | return; |
@@ -1340,7 +1361,7 @@ discard block |
||
1340 | 1361 | } |
1341 | 1362 | echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
1342 | 1363 | } else { |
1343 | - if ($properties != NULL ){ |
|
1364 | + if ($properties != NULL ) { |
|
1344 | 1365 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1345 | 1366 | } |
1346 | 1367 | if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
@@ -1379,9 +1400,9 @@ discard block |
||
1379 | 1400 | $filecontent = $moduleSnippet[2]; |
1380 | 1401 | $properties = $moduleSnippet[3]; |
1381 | 1402 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
1382 | - if (!file_exists($filecontent)) |
|
1383 | - echo " $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1384 | - else { |
|
1403 | + if (!file_exists($filecontent)) { |
|
1404 | + echo " $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1405 | + } else { |
|
1385 | 1406 | |
1386 | 1407 | // Create the category if it does not already exist |
1387 | 1408 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -1399,7 +1420,7 @@ discard block |
||
1399 | 1420 | } |
1400 | 1421 | echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
1401 | 1422 | } else { |
1402 | - if ($properties != NULL ){ |
|
1423 | + if ($properties != NULL ) { |
|
1403 | 1424 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1404 | 1425 | } |
1405 | 1426 | if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
@@ -1492,11 +1513,14 @@ discard block |
||
1492 | 1513 | } |
1493 | 1514 | |
1494 | 1515 | // call back function |
1495 | -if ($callBackFnc != "") |
|
1516 | +if ($callBackFnc != "") { |
|
1496 | 1517 | $callBackFnc ($sqlParser); |
1518 | +} |
|
1497 | 1519 | |
1498 | 1520 | // Setup the MODX API -- needed for the cache processor |
1499 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
1521 | +if (!defined('MODX_MANAGER_PATH')) { |
|
1522 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
1523 | +} |
|
1500 | 1524 | $database_type = 'mysqli'; |
1501 | 1525 | // initiate a new document parser |
1502 | 1526 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -1535,7 +1559,7 @@ discard block |
||
1535 | 1559 | } |
1536 | 1560 | |
1537 | 1561 | |
1538 | -if ( empty($args) ){ |
|
1562 | +if ( empty($args) ) { |
|
1539 | 1563 | echo PHP_EOL . 'Remove install folder?'.PHP_EOL; |
1540 | 1564 | $removeInstall = readline("Type 'y' or 'n' to continue: "); |
1541 | 1565 | } |
@@ -1551,11 +1575,12 @@ discard block |
||
1551 | 1575 | * @param string $old |
1552 | 1576 | * @return string |
1553 | 1577 | */ |
1554 | -function propUpdate($new,$old){ |
|
1578 | +function propUpdate($new,$old) |
|
1579 | +{ |
|
1555 | 1580 | $newArr = parseProperties($new); |
1556 | 1581 | $oldArr = parseProperties($old); |
1557 | - foreach ($oldArr as $k => $v){ |
|
1558 | - if (isset($v['0']['options'])){ |
|
1582 | + foreach ($oldArr as $k => $v) { |
|
1583 | + if (isset($v['0']['options'])) { |
|
1559 | 1584 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
1560 | 1585 | } |
1561 | 1586 | } |
@@ -1570,12 +1595,17 @@ discard block |
||
1570 | 1595 | * @param bool|mixed $json |
1571 | 1596 | * @return string |
1572 | 1597 | */ |
1573 | -function parseProperties($propertyString, $json=false) { |
|
1598 | +function parseProperties($propertyString, $json=false) |
|
1599 | +{ |
|
1574 | 1600 | $propertyString = str_replace('{}', '', $propertyString ); |
1575 | 1601 | $propertyString = str_replace('} {', ',', $propertyString ); |
1576 | 1602 | |
1577 | - if(empty($propertyString)) return array(); |
|
1578 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
1603 | + if(empty($propertyString)) { |
|
1604 | + return array(); |
|
1605 | + } |
|
1606 | + if($propertyString=='{}' || $propertyString=='[]') { |
|
1607 | + return array(); |
|
1608 | + } |
|
1579 | 1609 | |
1580 | 1610 | $jsonFormat = isJson($propertyString, true); |
1581 | 1611 | $property = array(); |
@@ -1617,7 +1647,7 @@ discard block |
||
1617 | 1647 | |
1618 | 1648 | } |
1619 | 1649 | // new json-format |
1620 | - } else if(!empty($jsonFormat)){ |
|
1650 | + } else if(!empty($jsonFormat)) { |
|
1621 | 1651 | $property = $jsonFormat; |
1622 | 1652 | } |
1623 | 1653 | if ($json) { |
@@ -1632,7 +1662,8 @@ discard block |
||
1632 | 1662 | * @param bool $returnData |
1633 | 1663 | * @return bool|mixed |
1634 | 1664 | */ |
1635 | -function isJson($string, $returnData=false) { |
|
1665 | +function isJson($string, $returnData=false) |
|
1666 | +{ |
|
1636 | 1667 | $data = json_decode($string, true); |
1637 | 1668 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
1638 | 1669 | } |
@@ -1642,7 +1673,8 @@ discard block |
||
1642 | 1673 | * @param SqlParser $sqlParser |
1643 | 1674 | * @return int |
1644 | 1675 | */ |
1645 | -function getCreateDbCategory($category, $sqlParser) { |
|
1676 | +function getCreateDbCategory($category, $sqlParser) |
|
1677 | +{ |
|
1646 | 1678 | $dbase = $sqlParser->dbname; |
1647 | 1679 | $dbase = '`' . trim($dbase,'`') . '`'; |
1648 | 1680 | $table_prefix = $sqlParser->prefix; |
@@ -1670,7 +1702,8 @@ discard block |
||
1670 | 1702 | * @param string $type |
1671 | 1703 | * @return string |
1672 | 1704 | */ |
1673 | -function removeDocblock($code, $type) { |
|
1705 | +function removeDocblock($code, $type) |
|
1706 | +{ |
|
1674 | 1707 | |
1675 | 1708 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
1676 | 1709 | |
@@ -1691,8 +1724,9 @@ discard block |
||
1691 | 1724 | default: |
1692 | 1725 | return $cleaned; |
1693 | 1726 | }; |
1694 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
1695 | - return $cleaned; |
|
1727 | + if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
1728 | + return $cleaned; |
|
1729 | + } |
|
1696 | 1730 | |
1697 | 1731 | // fileBinding not found - return code incl docblock |
1698 | 1732 | return $code; |