mirror of
https://github.com/vrana/adminer.git
synced 2025-08-11 17:14:07 +02:00
Define functions unconditionally
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1075 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -1,31 +1,6 @@
|
||||
<?php
|
||||
$TABLE = $_GET["dump"];
|
||||
|
||||
function tar_file($filename, $contents) {
|
||||
$return = pack("a100a8a8a8a12a12", $filename, 644, 0, 0, decoct(strlen($contents)), decoct(time()));
|
||||
$checksum = 8*32; // space for checksum itself
|
||||
for ($i=0; $i < strlen($return); $i++) {
|
||||
$checksum += ord($return{$i});
|
||||
}
|
||||
$return .= sprintf("%06o", $checksum) . "\0 ";
|
||||
return $return . str_repeat("\0", 512 - strlen($return)) . $contents . str_repeat("\0", 511 - (strlen($contents) + 511) % 512);
|
||||
}
|
||||
|
||||
function dump_triggers($table, $style) {
|
||||
global $dbh;
|
||||
if ($_POST["format"] == "sql" && $style && $dbh->server_info >= 5) {
|
||||
$result = $dbh->query("SHOW TRIGGERS LIKE " . $dbh->quote(addcslashes($table, "%_")));
|
||||
if ($result->num_rows) {
|
||||
$s = "\nDELIMITER ;;\n";
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$s .= "\n" . ($style == 'CREATE+ALTER' ? "DROP TRIGGER IF EXISTS " . idf_escape($row["Trigger"]) . ";;\n" : "")
|
||||
. "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . idf_escape($row["Table"]) . " FOR EACH ROW\n$row[Statement];;\n";
|
||||
}
|
||||
dump("$s\nDELIMITER ;\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST) {
|
||||
$ext = dump_headers((strlen($TABLE) ? $TABLE : DB), (!strlen(DB) || count((array) $_POST["tables"] + (array) $_POST["data"]) > 1));
|
||||
if ($_POST["format"] == "sql") {
|
||||
|
Reference in New Issue
Block a user