Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 462 lines (428 sloc) 17.154 kb
2c445a86 » jakubvrana
2009-07-03 Extensibility basics
1 <?php
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
2 class Adminer {
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
3 var $functions = array("char_length", "from_unixtime", "hex", "lower", "round", "sec_to_time", "time_to_sec", "unix_timestamp", "upper");
e0fbf333 » jakubvrana
2009-08-18 Rename distinct to count distinct
4 var $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
5 var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "REGEXP", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL");
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
6
7 /** Name in title and navigation
8 * @return string
9 */
10 function name() {
b3496120 » jakubvrana
2009-08-25 Remove useless translations
11 return "Adminer";
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
12 }
13
14 /** Connection parameters
15 * @return array ($server, $username, $password)
16 */
17 function credentials() {
18 return array($_GET["server"], $_SESSION["usernames"][$_GET["server"]], $_SESSION["passwords"][$_GET["server"]]);
19 }
20
21 /** Identifier of selected database
22 * @return string
23 */
24 function database() {
3022dcb8 » jakubvrana
2009-08-29 Define DB
25 // should be used everywhere instead of DB
26 return DB;
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
27 }
28
29 /** Print login form
30 * @param string
31 * @return null
32 */
33 function loginForm($username) {
2faa08cd » jakubvrana
2009-07-21 Customize login and login form
34 ?>
02054404 » jakubvrana
2009-07-21 HTML whitespace
35 <table cellspacing="0">
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
36 <tr><th><?php echo lang('Server'); ?><td><input name="server" value="<?php echo h($_GET["server"]); ?>">
37 <tr><th><?php echo lang('Username'); ?><td><input name="username" value="<?php echo h($username); ?>">
02054404 » jakubvrana
2009-07-21 HTML whitespace
38 <tr><th><?php echo lang('Password'); ?><td><input type="password" name="password">
39 </table>
2faa08cd » jakubvrana
2009-07-21 Customize login and login form
40 <?php
41 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
42
43 /** Authorize the user
44 * @param string
45 * @param string
46 * @return bool
47 */
48 function login($login, $password) {
49 return true;
97b8c7b6 » jakubvrana
2009-07-24 Display images in Editor
50 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
51
52 /** Table caption used in navigation and headings
53 * @param array result of SHOW TABLE STATUS
54 * @return string
55 */
56 function tableName($tableStatus) {
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
57 return h($tableStatus["Name"]);
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
58 }
59
60 /** Field caption used in select and edit
61 * @param array single field returned from fields()
6c97b806 » jakubvrana
2009-07-27 Display only first five columns in Editor example
62 * @param int order of column in select
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
63 * @return string
64 */
6c97b806 » jakubvrana
2009-07-27 Display only first five columns in Editor example
65 function fieldName($field, $order = 0) {
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
66 return '<span title="' . h($field["full_type"]) . '">' . h($field["field"]) . '</span>';
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
67 }
68
69 /** Links after select heading
70 * @param array result of SHOW TABLE STATUS
71 * @return string
72 */
73 function selectLinks($tableStatus) {
98507da3 » jakubvrana
2009-07-30 Function verify_version doesn't use version parameter
74 return '<a href="' . h(ME) . 'table=' . urlencode($_GET['select']) . '">' . lang('Table structure') . '</a>';
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
75 }
76
77 /** Find backward keys for table
78 * @param string
79 * @return array $return[$target_table][$key_name][$target_column] = $source_column;
80 */
81 function backwardKeys($table) {
82 return array();
83 }
84
85 /** Query printed in select before execution
86 * @param string query to be executed
87 * @return string
88 */
89 function selectQuery($query) {
90 // it would be nice if $query can be passed by reference and printed value would be returned but call_user() doesn't allow reference parameters
98507da3 » jakubvrana
2009-07-30 Function verify_version doesn't use version parameter
91 return "<p><code class='jush-sql'>" . h($query) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n";
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
92 }
93
94 /** Description of a row in a table
95 * @param string
96 * @return string SQL expression, empty string for no description
97 */
98 function rowDescription($table) {
99 return "";
100 }
101
102 /** Get descriptions of selected data
103 * @param array all data to print
104 * @param array
105 * @return array
106 */
107 function rowDescriptions($rows, $foreignKeys) {
108 return $rows;
109 }
110
111 /** Value printed in select table
a0def479 » jakubvrana
2009-07-27 Date localization
112 * @param string HTML-escaped value to print
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
113 * @param string link to foreign key
114 * @param array single field returned from fields()
115 * @return string
116 */
117 function selectVal($val, $link, $field) {
118 $return = ($field["type"] == "char" ? "<code>$val</code>" : $val);
119 if (ereg('blob|binary', $field["type"]) && !is_utf8($val)) {
120 $return = lang('%d byte(s)', strlen($val));
49212350 » jakubvrana
2009-07-23 Hide edit functions in Editor
121 }
12c042ce » jakubvrana
2009-07-30 Function htmlspecialchars now uses ENT_QUOTES
122 return ($link ? "<a href='$link'>$return</a>" : $return);
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
123 }
124
a0def479 » jakubvrana
2009-07-27 Date localization
125 /** Value conversion used in select and edit
126 * @param string
127 * @param array single field returned from fields()
20114285 » jakubvrana
2009-07-28 Use LIKE operator in Editor
128 * @return string
a0def479 » jakubvrana
2009-07-27 Date localization
129 */
130 function editVal($val, $field) {
131 return $val;
132 }
133
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
134 /** Print columns box in select
135 * @param array result of selectColumnsProcess()
136 * @param array selectable columns
137 * @return null
138 */
139 function selectColumnsPrint($select, $columns) {
140 echo '<fieldset><legend><a href="#fieldset-select" onclick="return !toggle(\'fieldset-select\');">' . lang('Select') . "</a></legend><div id='fieldset-select'" . ($select ? "" : " class='hidden'") . ">\n";
141 $i = 0;
142 $fun_group = array(lang('Functions') => $this->functions, lang('Aggregation') => $this->grouping);
143 foreach ($select as $key => $val) {
144 $val = $_GET["columns"][$key];
145 echo "<div><select name='columns[$i][fun]'><option>" . optionlist($fun_group, $val["fun"]) . "</select>";
146 echo "<select name='columns[$i][col]'><option>" . optionlist($columns, $val["col"], true) . "</select></div>\n";
147 $i++;
148 }
149 echo "<div><select name='columns[$i][fun]' onchange='this.nextSibling.onchange();'><option>" . optionlist($fun_group) . "</select>";
150 echo "<select name='columns[$i][col]' onchange='select_add_row(this);'><option>" . optionlist($columns, null, true) . "</select></div>\n";
151 echo "</div></fieldset>\n";
152 }
153
154 /** Print search box in select
155 * @param array result of selectSearchProcess()
156 * @param array selectable columns
157 * @param array
158 * @return null
159 */
160 function selectSearchPrint($where, $columns, $indexes) {
161 echo '<fieldset><legend><a href="#fieldset-search" onclick="return !toggle(\'fieldset-search\');">' . lang('Search') . "</a></legend><div id='fieldset-search'" . ($where ? "" : " class='hidden'") . ">\n";
162 foreach ($indexes as $i => $index) {
163 if ($index["type"] == "FULLTEXT") {
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
164 echo "(<i>" . implode("</i>, <i>", array_map('h', $index["columns"])) . "</i>) AGAINST";
165 echo " <input name='fulltext[$i]' value='" . h($_GET["fulltext"][$i]) . "'>";
b3496120 » jakubvrana
2009-08-25 Remove useless translations
166 echo "<label><input type='checkbox' name='boolean[$i]' value='1'" . (isset($_GET["boolean"][$i]) ? " checked" : "") . ">BOOL</label>";
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
167 echo "<br>\n";
168 }
169 }
170 $i = 0;
171 foreach ((array) $_GET["where"] as $val) {
172 if (strlen("$val[col]$val[val]") && in_array($val["op"], $this->operators)) {
173 echo "<div><select name='where[$i][col]'><option value=''>" . lang('(anywhere)') . optionlist($columns, $val["col"], true) . "</select>";
174 echo "<select name='where[$i][op]'>" . optionlist($this->operators, $val["op"]) . "</select>";
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
175 echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
176 $i++;
177 }
178 }
179 echo "<div><select name='where[$i][col]' onchange='select_add_row(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>";
180 echo "<select name='where[$i][op]'>" . optionlist($this->operators) . "</select>";
181 echo "<input name='where[$i][val]'></div>\n";
182 echo "</div></fieldset>\n";
183 }
184
185 /** Print order box in select
186 * @param array result of selectOrderProcess()
187 * @param array selectable columns
188 * @param array
189 * @return null
190 */
191 function selectOrderPrint($order, $columns, $indexes) {
192 echo '<fieldset><legend><a href="#fieldset-sort" onclick="return !toggle(\'fieldset-sort\');">' . lang('Sort') . "</a></legend><div id='fieldset-sort'" . ($order ? "" : " class='hidden'") . ">\n";
193 $i = 0;
194 foreach ((array) $_GET["order"] as $key => $val) {
195 if (isset($columns[$val])) {
196 echo "<div><select name='order[$i]'><option>" . optionlist($columns, $val, true) . "</select>";
cb6d36c0 » jakubvrana
2009-07-28 HTML instead of XHTML
197 echo "<label><input type='checkbox' name='desc[$i]' value='1'" . (isset($_GET["desc"][$key]) ? " checked" : "") . ">" . lang('descending') . "</label></div>\n";
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
198 $i++;
199 }
200 }
201 echo "<div><select name='order[$i]' onchange='select_add_row(this);'><option>" . optionlist($columns, null, true) . "</select>";
202 echo "<label><input type='checkbox' name='desc[$i]' value='1'>" . lang('descending') . "</label></div>\n";
203 echo "</div></fieldset>\n";
204 }
205
206 /** Print limit box in select
207 * @param string result of selectLimitProcess()
208 * @return null
209 */
210 function selectLimitPrint($limit) {
211 echo "<fieldset><legend>" . lang('Limit') . "</legend><div>"; // <div> for easy styling
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
212 echo "<input name='limit' size='3' value='" . h($limit) . "'>";
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
213 echo "</div></fieldset>\n";
214 }
215
216 /** Print text length box in select
217 * @param string result of selectLengthProcess()
218 * @return null
219 */
220 function selectLengthPrint($text_length) {
221 if (isset($text_length)) {
222 echo "<fieldset><legend>" . lang('Text length') . "</legend><div>";
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
223 echo '<input name="text_length" size="3" value="' . h($text_length) . '">';
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
224 echo "</div></fieldset>\n";
225 }
226 }
227
228 /** Print action box in select
229 * @return null
230 */
231 function selectActionPrint() {
232 echo "<fieldset><legend>" . lang('Action') . "</legend><div>";
233 echo "<input type='submit' value='" . lang('Select') . "'>";
234 echo "</div></fieldset>\n";
235 }
236
1a6a73ad » jakubvrana
2009-07-28 Rename selectExtra to selectEmail
237 /** Print extra text in the end of a select form
238 * @param array fields holding e-mails
239 * @return null
240 */
241 function selectEmailPrint($emailFields) {
242 }
243
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
244 /** Process columns box in select
245 * @param array selectable columns
246 * @return array (array(select_expressions), array(group_expressions))
247 */
248 function selectColumnsProcess($columns, $indexes) {
249 $select = array(); // select expressions, empty for *
250 $group = array(); // expressions without aggregation - will be used for GROUP BY if an aggregation function is used
251 foreach ((array) $_GET["columns"] as $key => $val) {
252 if ($val["fun"] == "count" || (isset($columns[$val["col"]]) && (!$val["fun"] || in_array($val["fun"], $this->functions) || in_array($val["fun"], $this->grouping)))) {
253 $select[$key] = apply_sql_function($val["fun"], (isset($columns[$val["col"]]) ? idf_escape($val["col"]) : "*"));
254 if (!in_array($val["fun"], $this->grouping)) {
255 $group[] = $select[$key];
256 }
257 }
258 }
259 return array($select, $group);
260 }
261
262 /** Process search box in select
263 * @param array
264 * @param array
265 * @return array expressions to join by AND
266 */
07e1ae10 » jakubvrana
2009-07-28 FOUND_ROWS only with GROUP BY
267 function selectSearchProcess($fields, $indexes) {
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
268 global $dbh;
269 $return = array();
270 foreach ($indexes as $i => $index) {
271 if ($index["type"] == "FULLTEXT" && strlen($_GET["fulltext"][$i])) {
272 $return[] = "MATCH (" . implode(", ", array_map('idf_escape', $index["columns"])) . ") AGAINST (" . $dbh->quote($_GET["fulltext"][$i]) . (isset($_GET["boolean"][$i]) ? " IN BOOLEAN MODE" : "") . ")";
273 }
274 }
275 foreach ((array) $_GET["where"] as $val) {
276 if (strlen("$val[col]$val[val]") && in_array($val["op"], $this->operators)) {
98b88eb1 » jakubvrana
2009-07-28 Remove fulltext search without index
277 $in = process_length($val["val"]);
278 $cond = " $val[op]" . (ereg('NULL$', $val["op"]) ? "" : (ereg('IN$', $val["op"]) ? " (" . (strlen($in) ? $in : "NULL") . ")" : " " . $this->processInput($fields[$val["col"]], $val["val"])));
279 if (strlen($val["col"])) {
280 $return[] = idf_escape($val["col"]) . $cond;
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
281 } else {
98b88eb1 » jakubvrana
2009-07-28 Remove fulltext search without index
282 // find anywhere
283 $cols = array();
284 foreach ($fields as $name => $field) {
285 if (is_numeric($val["val"]) || !ereg('int|float|double|decimal', $field["type"])) {
286 $cols[] = $name;
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
287 }
288 }
98b88eb1 » jakubvrana
2009-07-28 Remove fulltext search without index
289 $return[] = ($cols ? "(" . implode("$cond OR ", array_map('idf_escape', $cols)) . "$cond)" : "0");
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
290 }
291 }
292 }
293 return $return;
294 }
295
296 /** Process order box in select
297 * @param array
298 * @param array
299 * @return array expressions to join by comma
300 */
07e1ae10 » jakubvrana
2009-07-28 FOUND_ROWS only with GROUP BY
301 function selectOrderProcess($fields, $indexes) {
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
302 $return = array();
303 foreach ((array) $_GET["order"] as $key => $val) {
821d040d » jakubvrana
2009-08-24 Order by COUNT (thanks to paranoiq)
304 if (isset($fields[$val]) || preg_match('~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()`(?:[^`]|``)+`\\)|COUNT\\(\\*\\))$~', $val)) {
d24ad780 » jakubvrana
2009-07-27 Select boxes customization
305 $return[] = idf_escape($val) . (isset($_GET["desc"][$key]) ? " DESC" : "");
306 }
307 }
308 return $return;
309 }
310
311 /** Process limit box in select
312 * @return string expression to use in LIMIT, will be escaped
313 */
314 function selectLimitProcess() {
315 return (isset($_GET["limit"]) ? $_GET["limit"] : "30");
316 }
317
318 /** Process length box in select
319 * @return string number of characters to shorten texts, will be escaped
320 */
321 function selectLengthProcess() {
322 return (isset($_GET["text_length"]) ? $_GET["text_length"] : "100");
323 }
324
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
325 /** Process extras in select form
326 * @param array AND conditions
dea345cb » jakubvrana
2009-09-09 Substitute foreign keys in e-mail fields
327 * @param array
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
328 * @return bool true if processed, false to process other parts of form
329 */
dea345cb » jakubvrana
2009-09-09 Substitute foreign keys in e-mail fields
330 function selectEmailProcess($where, $foreignKeys) {
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
331 return false;
332 }
333
334 /** Query printed after execution in the message
335 * @param string executed query
336 * @return string
337 */
338 function messageQuery($query) {
339 $id = "sql-" . count($_SESSION["messages"]);
3022dcb8 » jakubvrana
2009-08-29 Define DB
340 $_SESSION["history"][$_GET["server"]][DB][] = $query;
341 return " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre class='jush-sql'>" . h($query) . '</pre><a href="' . h(ME . 'sql=&history=' . (count($_SESSION["history"][$_GET["server"]][DB]) - 1)) . '">' . lang('Edit') . '</a></div>';
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
342 }
343
344 /** Functions displayed in edit form
345 * @param array single field from fields()
346 * @return array
347 */
348 function editFunctions($field) {
349 $return = array("");
4cead560 » jakubvrana
2009-08-21 Edit default values directly in table creation
350 if (ereg('char|date|time', $field["type"])) {
351 $return = (ereg('char', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now")); //! JavaScript for disabling maxlength
352 }
353 if (!isset($_GET["call"]) && (isset($_GET["select"]) || where($_GET))) {
354 // relative functions
355 if (ereg('int|float|double|decimal', $field["type"])) {
356 $return = array("", "+", "-");
49212350 » jakubvrana
2009-07-23 Hide edit functions in Editor
357 }
4cead560 » jakubvrana
2009-08-21 Edit default values directly in table creation
358 if (ereg('date', $field["type"])) {
359 $return[] = "+ interval";
360 $return[] = "- interval";
361 }
362 if (ereg('time', $field["type"])) {
363 $return[] = "addtime";
364 $return[] = "subtime";
49212350 » jakubvrana
2009-07-23 Hide edit functions in Editor
365 }
309f6813 » jakubvrana
2009-08-28 Relative function concat
366 if (ereg('char|text', $field["type"])) {
367 $return[] = "concat";
368 }
49212350 » jakubvrana
2009-07-23 Hide edit functions in Editor
369 }
4cead560 » jakubvrana
2009-08-21 Edit default values directly in table creation
370 if ($field["null"]) {
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
371 array_unshift($return, "NULL");
372 }
9fc052b7 » jakubvrana
2009-07-28 Unselect original after value input
373 return $return;
49212350 » jakubvrana
2009-07-23 Hide edit functions in Editor
374 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
375
376 /** Get options to display edit field
377 * @param string table name
378 * @param array single field from fields()
e1abcda0 » jakubvrana
2009-07-28 Treat tinyint(1) as boolean
379 * @param string attributes to use inside the tag
380 * @param string
381 * @return string custom input field or empty string for default
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
382 */
e1abcda0 » jakubvrana
2009-07-28 Treat tinyint(1) as boolean
383 function editInput($table, $field, $attrs, $value) {
384 return '';
49212350 » jakubvrana
2009-07-23 Hide edit functions in Editor
385 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
386
387 /** Process sent input
388 * @param array single field from fields()
a0def479 » jakubvrana
2009-07-27 Date localization
389 * @param string
390 * @param string
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
391 * @return string expression to use in a query
392 */
a0def479 » jakubvrana
2009-07-27 Date localization
393 function processInput($field, $value, $function = "") {
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
394 global $dbh;
a0def479 » jakubvrana
2009-07-27 Date localization
395 $name = $field["field"];
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
396 $return = $dbh->quote($value);
397 if (ereg('^(now|uuid)$', $function)) {
398 $return = "$function()";
399 } elseif (ereg('^[+-]$', $function)) {
400 $return = idf_escape($name) . " $function $return";
401 } elseif (ereg('^[+-] interval$', $function)) {
402 $return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
309f6813 » jakubvrana
2009-08-28 Relative function concat
403 } elseif (ereg('^(addtime|subtime|concat)$', $function)) {
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
404 $return = "$function(" . idf_escape($name) . ", $return)";
405 } elseif (ereg('^(md5|sha1|password)$', $function)) {
406 $return = "$function($return)";
407 }
408 return $return;
a78c941c » jakubvrana
2009-07-23 Empty value in Editor as NULL
409 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
410
411 /** Prints navigation after Adminer title
412 * @param string can be "auth" if there is no database connection or "db" if there is no database selected
413 * @return null
414 */
415 function navigation($missing) {
98507da3 » jakubvrana
2009-07-30 Function verify_version doesn't use version parameter
416 global $dbh;
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
417 if ($missing != "auth") {
418 $databases = get_databases();
419 ?>
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
420 <form action="" method="post">
421 <p>
98507da3 » jakubvrana
2009-07-30 Function verify_version doesn't use version parameter
422 <a href="<?php echo h(ME); ?>sql="><?php echo lang('SQL command'); ?></a>
423 <a href="<?php echo h(ME); ?>dump=<?php echo urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]); ?>"><?php echo lang('Dump'); ?></a>
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
424 <input type="hidden" name="token" value="<?php echo $_SESSION["tokens"][$_GET["server"]]; ?>">
425 <input type="submit" name="logout" value="<?php echo lang('Logout'); ?>">
d2ba5938 » jakubvrana
2009-07-14 Browsers interpret <form><p></form> as <form><p></form></p>
426 </p>
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
427 </form>
428 <form action="">
25cef1ff » jakubvrana
2009-08-30 Disable session.use_trans_sid to preserve export result
429 <p>
430 <?php if (SID) { ?><input type="hidden" name="<?php echo session_name(); ?>" value="<?php echo h(session_id()); ?>"><?php } ?>
431 <?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo h($_GET["server"]); ?>"><?php } ?>
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
432 <?php if ($databases) { ?>
3022dcb8 » jakubvrana
2009-08-29 Define DB
433 <select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)<?php echo optionlist($databases, DB); ?></select>
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
434 <?php } else { ?>
3022dcb8 » jakubvrana
2009-08-29 Define DB
435 <input name="db" value="<?php echo h(DB); ?>">
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
436 <?php } ?>
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
437 <?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value=""><?php } ?>
438 <?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value=""><?php } ?>
439 <?php if (isset($_GET["dump"])) { ?><input type="hidden" name="dump" value=""><?php } ?>
440 <input type="submit" value="<?php echo lang('Use'); ?>"<?php echo ($databases ? " class='hidden'" : ""); ?>>
d2ba5938 » jakubvrana
2009-07-14 Browsers interpret <form><p></form> as <form><p></form></p>
441 </p>
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
442 </form>
443 <?php
24fc853e » jakubvrana
2009-09-07 Select database before SHOW TABLES (bug #2853561)
444 if ($missing != "db" && strlen(DB) && $dbh->select_db(DB)) {
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
445 $result = $dbh->query("SHOW TABLES");
24fc853e » jakubvrana
2009-09-07 Select database before SHOW TABLES (bug #2853561)
446 if (!$result->num_rows) {
447 echo "<p class='message'>" . lang('No tables.') . "\n";
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
448 } else {
24fc853e » jakubvrana
2009-09-07 Select database before SHOW TABLES (bug #2853561)
449 echo "<p id='tables'>\n";
450 while ($row = $result->fetch_row()) {
451 echo '<a href="' . h(ME) . 'select=' . urlencode($row[0]) . '">' . lang('select') . '</a> ';
452 echo '<a href="' . h(ME) . 'table=' . urlencode($row[0]) . '">' . $this->tableName(array("Name" => $row[0])) . "</a><br>\n"; //! Adminer::tableName may work with full table status
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
453 }
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
454 }
98507da3 » jakubvrana
2009-07-30 Function verify_version doesn't use version parameter
455 echo '<p><a href="' . h(ME) . 'create=">' . lang('Create new table') . "</a>\n";
b95f24ea » jakubvrana
2009-07-03 Editor: User friendly data editor
456 }
457 }
458 }
c64c4fd1 » jakubvrana
2009-07-27 Adminer class
459
2c445a86 » jakubvrana
2009-07-03 Extensibility basics
460 }
464d84af » jakubvrana
2009-09-09 Define functions unconditionally
461
462 $adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);
Something went wrong with that request. Please try again.