mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 01:24:17 +02:00
Limit commands and import in customization (bug #3194432)
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// any method change in this file should be transferred to editor/include/adminer.inc.php and plugins/plugin.php
|
||||||
|
|
||||||
class Adminer {
|
class Adminer {
|
||||||
/** @var array operators used in select, null for all operators */
|
/** @var array operators used in select, null for all operators */
|
||||||
var $operators;
|
var $operators;
|
||||||
@@ -295,6 +297,20 @@ username.form['driver'].onchange();
|
|||||||
echo "</div></fieldset>\n";
|
echo "</div></fieldset>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Print command box in select
|
||||||
|
* @return bool whether to print default commands
|
||||||
|
*/
|
||||||
|
function selectCommandPrint() {
|
||||||
|
return !information_schema(DB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Print import box in select
|
||||||
|
* @return bool whether to print default import
|
||||||
|
*/
|
||||||
|
function selectImportPrint() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/** Print extra text in the end of a select form
|
/** Print extra text in the end of a select form
|
||||||
* @param array fields holding e-mails
|
* @param array fields holding e-mails
|
||||||
* @param array selectable columns
|
* @param array selectable columns
|
||||||
|
@@ -395,7 +395,7 @@ if (!$columns) {
|
|||||||
}
|
}
|
||||||
echo " (" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " . checkbox("all", 1, 0, lang('whole result')) . "\n";
|
echo " (" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " . checkbox("all", 1, 0, lang('whole result')) . "\n";
|
||||||
|
|
||||||
if (!information_schema(DB)) {
|
if ($adminer->selectCommandPrint()) {
|
||||||
?>
|
?>
|
||||||
<fieldset><legend><?php echo lang('Edit'); ?></legend><div>
|
<fieldset><legend><?php echo lang('Edit'); ?></legend><div>
|
||||||
<input type="submit" value="<?php echo lang('Save'); ?>" title="<?php echo lang('Double click on a value to modify it.'); ?>" class="jsonly">
|
<input type="submit" value="<?php echo lang('Save'); ?>" title="<?php echo lang('Double click on a value to modify it.'); ?>" class="jsonly">
|
||||||
@@ -412,12 +412,14 @@ if (!$columns) {
|
|||||||
echo " <input type='submit' name='export' value='" . lang('Export') . "' onclick='eventStop(event);'>\n";
|
echo " <input type='submit' name='export' value='" . lang('Export') . "' onclick='eventStop(event);'>\n";
|
||||||
echo "</div></fieldset>\n";
|
echo "</div></fieldset>\n";
|
||||||
}
|
}
|
||||||
print_fieldset("import", lang('Import'), !$rows);
|
if ($adminer->selectImportPrint()) {
|
||||||
echo "<input type='file' name='csv_file'> ";
|
print_fieldset("import", lang('Import'), !$rows);
|
||||||
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_export["format"], 1); // 1 - select
|
echo "<input type='file' name='csv_file'> ";
|
||||||
echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
|
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_export["format"], 1); // 1 - select
|
||||||
echo "<input type='hidden' name='token' value='$token'>\n";
|
echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
|
||||||
echo "</div></fieldset>\n";
|
echo "<input type='hidden' name='token' value='$token'>\n";
|
||||||
|
echo "</div></fieldset>\n";
|
||||||
|
}
|
||||||
|
|
||||||
$adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
|
$adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
|
||||||
|
|
||||||
|
@@ -275,6 +275,14 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
|||||||
echo "</div></fieldset>\n";
|
echo "</div></fieldset>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectCommandPrint() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectImportPrint() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function selectEmailPrint($emailFields, $columns) {
|
function selectEmailPrint($emailFields, $columns) {
|
||||||
if ($emailFields) {
|
if ($emailFields) {
|
||||||
print_fieldset("email", lang('E-mail'), $_POST["email_append"]);
|
print_fieldset("email", lang('E-mail'), $_POST["email_append"]);
|
||||||
|
@@ -215,6 +215,16 @@ class AdminerPlugin extends Adminer {
|
|||||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectCommandPrint() {
|
||||||
|
$args = func_get_args();
|
||||||
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectImportPrint() {
|
||||||
|
$args = func_get_args();
|
||||||
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
|
}
|
||||||
|
|
||||||
function selectEmailPrint() {
|
function selectEmailPrint() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||||
|
Reference in New Issue
Block a user