diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 720be4cc..20e14463 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -850,6 +850,13 @@ class Adminer { return $ext; } + /** Set the path of the file for webserver load + * @return string path of the sql dump file + */ + function importServerPath() { + return "adminer.sql"; + } + /** Print homepage * @return bool whether to print default homepage */ diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index f218dc93..7f8e5d95 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -21,9 +21,10 @@ if (!$error && $_POST) { if (!isset($_GET["import"])) { $query = $_POST["query"]; } elseif ($_POST["webfile"]) { - $fp = @fopen((file_exists("adminer.sql") - ? "adminer.sql" - : "compress.zlib://adminer.sql.gz" + $sql_file_path = $adminer->importServerPath(); + $fp = @fopen((file_exists($sql_file_path) + ? $sql_file_path + : "compress.zlib://{$sql_file_path}.gz" ), "rb"); $query = ($fp ? fread($fp, 1e6) : false); } else { @@ -220,7 +221,7 @@ if (!isset($_GET["import"])) { ); echo "\n"; echo "
" . lang('From server') . "
"; - echo lang('Webserver file %s', "adminer.sql" . (extension_loaded("zlib") ? "[.gz]" : "") . ""); + echo lang('Webserver file %s', "" . h($adminer->importServerPath()) . (extension_loaded("zlib") ? "[.gz]" : "") . ""); echo ' '; echo "
\n"; echo "

"; diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 9131dba0..81907bca 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -549,6 +549,9 @@ qsl('div').onclick = whisperClick;", "") return $ext; } + function importServerPath() { + } + function homepage() { return true; } diff --git a/plugins/plugin.php b/plugins/plugin.php index a8bc0144..0b1d1c32 100644 --- a/plugins/plugin.php +++ b/plugins/plugin.php @@ -347,6 +347,11 @@ class AdminerPlugin extends Adminer { return $this->_applyPlugin(__FUNCTION__, $args); } + function importServerPath() { + $args = func_get_args(); + return $this->_applyPlugin(__FUNCTION__, $args); + } + function homepage() { $args = func_get_args(); return $this->_applyPlugin(__FUNCTION__, $args);