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