Adminer - Extensions
Adminer - Extensions
Adminer Database management in a single PHP file English Čeština Slovenčina Deutsch Polski
Adminer - Extensions
Both Adminer and Editor offers support for extensions. It is possible to overwrite some default Adminer functionality
by a custom code. All you need is to define the adminer_object function which returns an object extending the basic
Adminer class. Then just include the original adminer.php or editor.php:
<?php
function adminer_object() {
function name() {
// custom name in title and heading
return 'Software';
}
function permanentLogin() {
// key used for permanent login
return 'f80936566cffdab966cacba086eee2d9';
}
function credentials() {
// server, username and password for connecting to database
return array('localhost', 'ODBC', '');
}
function database() {
// database name, will be escaped by Adminer
return 'software';
}
function tableName($tableStatus) {
// tables without comments would return empty string and will be ignored by Adminer
return h($tableStatus['Comment']);
}
include './editor.php';
To create an Adminer Editor customization for other drivers than MySQL, you have to define own loginForm method
and fill the auth[driver] field value by your driver (pgsql, sqlite, ...). You usually also need to implement the database
method.
API reference
https://www.adminer.org/en/extension/ 1/7
30/10/2019 Adminer - Extensions
https://www.adminer.org/en/extension/ 2/7
30/10/2019 Adminer - Extensions
string Adminer::selectVal(string $val, string $link, array $field, array $original) - Value printed in select table
string Adminer::editVal(string $val, array $field) - Value conversion used in select and edit
null Adminer::tableStructurePrint(array $fields) - Print table structure in tabular format
null Adminer::tableIndexesPrint(array $indexes) - Print list of indexes on table in tabular format
null Adminer::selectColumnsPrint(array $select, array $columns) - Print columns box in select
null Adminer::selectSearchPrint(array $where, array $columns, array $indexes) - Print search box in select
null Adminer::selectOrderPrint(array $order, array $columns, array $indexes) - Print order box in select
null Adminer::selectLimitPrint(string $limit) - Print limit box in select
null Adminer::selectLengthPrint(string $text_length) - Print text length box in select
null Adminer::selectActionPrint(array $indexes) - Print action box in select
bool Adminer::selectCommandPrint() - Print command box in select
bool Adminer::selectImportPrint() - Print import box in select
null Adminer::selectEmailPrint(array $emailFields, array $columns) - Print extra text in the end of a select
form
array Adminer::selectColumnsProcess(array $columns, array $indexes) - Process columns box in select
array Adminer::selectSearchProcess(array $fields, array $indexes) - Process search box in select
array Adminer::selectOrderProcess(array $fields, array $indexes) - Process order box in select
string Adminer::selectLimitProcess() - Process limit box in select
string Adminer::selectLengthProcess() - Process length box in select
bool Adminer::selectEmailProcess(array $where, array $foreignKeys) - Process extras in select form
string Adminer::selectQueryBuild(array $select, array $where, array $group, array $order, int $limit, int
$page) - Build SQL query used in select
string Adminer::messageQuery(string $query, string $time, bool $failed) - Query printed after execution in the
message
array Adminer::editFunctions(array $field) - Functions displayed in edit form
string Adminer::editInput(string $table, array $field, string $attrs, string $value) - Get options to display edit
field
string Adminer::editHint(string $table, array $field, string $value) - Get hint for edit field
string Adminer::processInput(array $field, string $value, string $function) - Process sent input
array Adminer::dumpOutput() - Returns export output options
array Adminer::dumpFormat() - Returns export format options
null Adminer::dumpDatabase(string $db) - Export database structure
null Adminer::dumpTable(string $table, string $style, int $is_view) - Export table structure
null Adminer::dumpData(string $table, string $style, string $query) - Export table data
string Adminer::dumpFilename(string $identifier) - Set export filename
string Adminer::dumpHeaders(string $identifier, bool $multi_table) - Send headers for export
string Adminer::importServerPath() - Set the path of the file for webserver load
bool Adminer::homepage() - Print homepage
null Adminer::navigation(string $missing) - Prints navigation after Adminer title
null Adminer::databasesPrint(string $missing) - Prints databases list in menu
null Adminer::tablesPrint(array $tables) - Prints table list in menu
https://www.adminer.org/en/extension/ 3/7
30/10/2019 Adminer - Extensions
https://www.adminer.org/en/extension/ 4/7
30/10/2019 Adminer - Extensions
null input(array $field, mixed $value, string $function) - Print edit input field
string process_input(one $field) - Process edit input field
array fields_from_edit() - Compute fields() from $_POST edit data
null search_tables() - Print results of search in all tables
string dump_headers(string $identifier, bool $multi_table) - Send headers for export
null dump_csv(array $row) - Print CSV row
string apply_sql_function(string $function, string $column) - Apply SQL function
string get_temp_dir() - Get path of the temporary directory
resource file_open_lock(string $filename) - Open and exclusively lock a file
file_write_unlock(resource $fp, string $data) - Write and unlock a file
string password_file(bool $create) - Read password from file adminer.key in temporary directory or create one
string rand_string() - Get a random string
string select_value(string $val, string $link, array $field, int $text_length) - Format value to use in select
bool is_mail(string $email) - Check whether the string is e-mail address
bool is_url(string $string) - Check whether the string is URL address
bool is_shortable(array $field) - Check if field should be shortened
string count_rows(string $table, array $where, bool $is_group, array $group) - Get query to compute number
of found rows
array slow_query(string $query) - Run query which can be killed by AJAX call after timing out
string get_token() - Generate BREACH resistant CSRF token
bool verify_token() - Verify if supplied CSRF token is valid
string on_help(string $command, bool $side) - Return events to display help on mouse over
null edit_form(string $TABLE, array $fields, mixed $row, bool $update) - Print edit data form
https://www.adminer.org/en/extension/ 5/7
30/10/2019 Adminer - Extensions
Min_Driver:
array select(Min_Result $result, Min_DB $connection2, array $orgtables) - Print select result
array referencable_primary(string $self) - Get referencable tables with single column primary key except self
array adminer_settings() - Get settings stored in a cookie
array adminer_setting(string $key) - Get setting stored in a cookie
bool set_adminer_settings(array $settings) - Store settings to a cookie
null textarea(string $name, string $value, int $rows, int $cols) - Print SQL <textarea> tag
null edit_type(string $key, array $field, array $collations, array $foreign_keys) - Print table columns for type
edit
string process_length(string $length) - Filter length value including enums
string process_type(array $field, string $collate) - Create SQL string from field type
array process_field(array $field, array $type_field) - Create SQL string from field
string default_value(array $field) - Get default value clause
string type_class(string $type) - Get type class to use in CSS
null edit_fields(array $fields, array $collations, string $type, array $foreign_keys) - Print table interior for
fields editing
bool process_fields(array $fields) - Move fields up and down or add field
string normalize_enum(array $match) - Callback used in routine()
bool grant(string $grant, array $privileges, string $columns, string $on) - Issue grant or revoke commands
null drop_create(string $drop, string $create, string $drop_created, string $test, string $drop_test, string
$location, string $message_drop, string $message_alter, string $message_create, string $old_name, string
$new_name) - Drop old object and create a new one
string create_trigger(string $on, array $row) - Generate SQL query for creating trigger
string create_routine(string $routine, array $row) - Generate SQL query for creating routine
string remove_definer(string $query) - Remove current user definer from SQL command
string format_foreign_key(array $foreign_key) - Format foreign key to use in SQL query
null tar_file(string $filename, TmpFile $tmp_file) - Add a file to TAR
int ini_bytes(string $ini) - Get INI bytes value
string doc_link(array $paths, string $text) - Create link to database documentation
string ob_gzencode(string $string) - Wrap gzencode() for usage in ob_start()
string db_size(string $db) - Compute size of database
null set_utf8mb4(string $create) - Print SET NAMES if utf8mb4 might be needed
Jakub Vrána
Design: Jan Smitka, Silk Icons, Translation: Jakub Vrána, Hosting
https://www.adminer.org/en/extension/ 7/7