|
@@ 503-530 (lines=28) @@
|
| 500 |
|
$guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
| 501 |
|
$shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
| 502 |
|
$category = mysqli_real_escape_string($conn, $moduleModule[6]); |
| 503 |
|
if (!file_exists($filecontent)) |
| 504 |
|
echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
| 505 |
|
else { |
| 506 |
|
|
| 507 |
|
// Create the category if it does not already exist |
| 508 |
|
$category = getCreateDbCategory($category, $sqlParser); |
| 509 |
|
|
| 510 |
|
$module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
| 511 |
|
// $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
| 512 |
|
$module = mysqli_real_escape_string($conn, $module); |
| 513 |
|
$rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
| 514 |
|
if (mysqli_num_rows($rs)) { |
| 515 |
|
$row = mysqli_fetch_assoc($rs); |
| 516 |
|
$props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 517 |
|
if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
| 518 |
|
echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 519 |
|
return; |
| 520 |
|
} |
| 521 |
|
echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
| 522 |
|
} else { |
| 523 |
|
$properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 524 |
|
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);")) { |
| 525 |
|
echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 526 |
|
return; |
| 527 |
|
} |
| 528 |
|
echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
| 529 |
|
} |
| 530 |
|
} |
| 531 |
|
} |
| 532 |
|
} |
| 533 |
|
} |
|
@@ 634-661 (lines=28) @@
|
| 631 |
|
$filecontent = $moduleSnippet[2]; |
| 632 |
|
$properties = $moduleSnippet[3]; |
| 633 |
|
$category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
| 634 |
|
if (!file_exists($filecontent)) |
| 635 |
|
echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
| 636 |
|
else { |
| 637 |
|
|
| 638 |
|
// Create the category if it does not already exist |
| 639 |
|
$category = getCreateDbCategory($category, $sqlParser); |
| 640 |
|
|
| 641 |
|
$snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
| 642 |
|
$snippet = removeDocblock($snippet, 'snippet'); |
| 643 |
|
$snippet = mysqli_real_escape_string($conn, $snippet); |
| 644 |
|
$rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
| 645 |
|
if (mysqli_num_rows($rs)) { |
| 646 |
|
$row = mysqli_fetch_assoc($rs); |
| 647 |
|
$props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 648 |
|
if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
| 649 |
|
echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 650 |
|
return; |
| 651 |
|
} |
| 652 |
|
echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
| 653 |
|
} else { |
| 654 |
|
$properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 655 |
|
if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
| 656 |
|
echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 657 |
|
return; |
| 658 |
|
} |
| 659 |
|
echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
| 660 |
|
} |
| 661 |
|
} |
| 662 |
|
} |
| 663 |
|
} |
| 664 |
|
} |