Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (42 sloc) 1.205 kb
70b7207 Customization example
jakubvrana authored
1 <?php
c64c4fd Adminer class
jakubvrana authored
2 function adminer_object() {
70b7207 Customization example
jakubvrana authored
3
c64c4fd Adminer class
jakubvrana authored
4 class AdminerCds extends Adminer {
5
6 function name() {
7 // custom name in title and heading
8 return 'CDs';
9 }
10
11 function credentials() {
12 // ODBC user without password on localhost
13 return array('localhost', 'ODBC', '');
14 }
15
16 function database() {
17 // will be escaped by Adminer
18 return 'adminer_test';
19 }
20
21 function login($login, $password) {
22 // username: 'admin', password: anything
23 return ($login == 'admin');
24 }
25
6c97b80 Display only first five columns in Editor example
jakubvrana authored
26 function tableName($tableStatus) {
c64c4fd Adminer class
jakubvrana authored
27 // tables without comments would return empty string and will be ignored by Adminer
689699a Shortcut for htmlspecialchars
jakubvrana authored
28 return h($tableStatus["Comment"]);
c64c4fd Adminer class
jakubvrana authored
29 }
30
6c97b80 Display only first five columns in Editor example
jakubvrana authored
31 function fieldName($field, $order = 0) {
014373c @vrana Hide hashes in select
authored
32 if ($order && ereg('_(md5|sha1)$', $field["field"])) {
33 return ""; // hide hashes in select
34 }
a9b2ac9 @vrana Display searched columns
authored
35 // display only column with comments, first five of them plus searched columns
36 if ($order < 5) {
37 return h($field["comment"]);
38 }
39 foreach ((array) $_GET["where"] as $key => $where) {
40 if ($where["col"] == $field["field"] && ($key >= 0 || $where["val"] != "")) {
41 return h($field["comment"]);
42 }
43 }
44 return "";
c64c4fd Adminer class
jakubvrana authored
45 }
46
116c873 Ignore tables and fields with empty name
jakubvrana authored
47 }
48
c64c4fd Adminer class
jakubvrana authored
49 return new AdminerCds;
70b7207 Customization example
jakubvrana authored
50 }
51
1e92cfe Don't compile editor for example
jakubvrana authored
52 include "./index.php";
Something went wrong with that request. Please try again.