-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Technical Wiki
apmuthu edited this page Nov 27, 2014
·
30 revisions
Welcome to the adminer wiki!
Best project EVER.
Please enable Issues in Project Settings here in GitHub for this project.
Line 1031 in adminer/adminer/drivers/mysql.inc.php can include "year", "month", "day"
The example.php can be used to limit the tables displayed to a specific list with:
function tableName($tableStatus) {
// tables without comments would return empty string and will be ignored by Adminer
$allowed_tables = Array('mytable1', 'mytable2');
if (in_array($tableStatus["Name"], $allowed_tables))
return h($tableStatus["Comment"]);
else
return '';
}
Different possibilities with columns to be displayed in the table initial listing:
function fieldName($field, $order = 0) {
/*
$field = Array
(
[field] => stock_id
[full_type] => varchar(20)
[type] => varchar
[length] => 20
[unsigned] =>
[default] =>
[null] =>
[auto_increment] =>
[on_update] =>
[collation] => utf8_general_ci
[privileges] => Array
(
[select] => 0
[insert] => 1
[update] => 2
[references] => 3
)
[comment] => Part#
[primary] => 1
)
*/
if ($order && preg_match('~_(md5|sha1)$~', $field["field"])) {
return ""; // hide hashes in select
}
// display only column with comments, first two of them plus searched columns and specific columns
if ($order < 2) {
return h($field["comment"]);
} else if ($order) {
if (preg_match('~^(ItemDesc|category_id|UPC)$~', $field["field"])) {
return h($field["comment"]); // chosen fields ItemDesc,category_id,UPC in select
}
if (preg_match('~(Price)$~', $field["field"])) {
return h($field["comment"]); // chosen field names in select ending with Price
}
if (preg_match('~^(Product#)$~', $field["comment"])) {
return h($field["comment"]); // chosen field label Product# in select
}
}
foreach ((array) $_GET["where"] as $key => $where) {
if ($where["col"] == $field["field"] && ($key >= 0 || $where["val"] != "")) {
return h($field["comment"]);
}
}
return "";
}
Different number of records in listing and select choices:
function selectLimitProcess() {
return (isset($_GET["limit"]) ? $_GET["limit"] : "20");
}
function selectLimitPrint($limit) {
echo "<fieldset><legend>" . lang('Limit') . "</legend><div>"; // <div> for easy styling
echo html_select("limit", array("", "20", "50", "100"), $limit);
echo "</div></fieldset>\n";
}