class Adminer {
/** @var array operators used in select, null for all operators */
var $operators;
-
+
/** Name in title and navigation
* @return string HTML code
*/
function name() {
return "<a href='http://www.adminer.org/' id='h1'>Adminer</a>";
}
-
+
/** Connection parameters
* @return array ($server, $username, $password)
*/
function credentials() {
return array(SERVER, $_GET["username"], get_session("pwds"));
}
-
+
/** Get key used for permanent login
* @param bool
* @return string cryptic string which gets combined with password or false in case of an error
function permanentLogin($create = false) {
return password_file($create);
}
-
+
/** Identifier of selected database
* @return string
*/
// should be used everywhere instead of DB
return DB;
}
-
+
/** Get cached list of databases
* @param bool
* @return array
function databases($flush = true) {
return get_databases($flush);
}
-
+
/** Specify limit for waiting on some slow queries like DB list
* @return float number of seconds
*/
function queryTimeout() {
return 5;
}
-
+
/** Headers to send before HTML output
* @return bool true to send security headers
*/
function headers() {
return true;
}
-
+
/** Print HTML code inside <head>
* @return bool true to link adminer.css if exists
*/
function head() {
return true;
}
-
+
/** Print login form
* @return null
*/
echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
echo checkbox("auth[permanent]", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
}
-
+
/** Authorize the user
* @param string
* @param string
function login($login, $password) {
return true;
}
-
+
/** Table caption used in navigation and headings
* @param array result of SHOW TABLE STATUS
* @return string HTML code, "" to ignore table
function tableName($tableStatus) {
return h($tableStatus["Name"]);
}
-
+
/** Field caption used in select and edit
* @param array single field returned from fields()
* @param int order of column in select
function fieldName($field, $order = 0) {
return '<span title="' . h($field["full_type"]) . '">' . h($field["field"]) . '</span>';
}
-
+
/** Print links after select heading
* @param array result of SHOW TABLE STATUS
* @param string new item options, NULL for no new item
}
echo "\n";
}
-
+
/** Get foreign keys for table
* @param string
* @return array same format as foreign_keys()
function foreignKeys($table) {
return foreign_keys($table);
}
-
+
/** Find backward keys for table
* @param string
* @param string
function backwardKeys($table, $tableName) {
return array();
}
-
+
/** Print backward keys for row
* @param array result of $this->backwardKeys()
* @param array
*/
function backwardKeysPrint($backwardKeys, $row) {
}
-
+
/** Query printed in select before execution
* @param string query to be executed
* @return string
*/
function selectQuery($query) {
- global $jush, $token;
- return "<form action='" . h(ME) . "sql=' method='post'><p><span onclick=\"return !selectEditSql(event, this, '" . lang('Execute') . "');\">"
- . "<code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code>"
+ global $jush;
+ return "<p><code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code>"
. " <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>"
- . "</span><input type='hidden' name='token' value='$token'></p></form>\n"; // </p> - required for IE9 inline edit
+ . "</p>" // </p> - required for IE9 inline edit
+ ;
}
-
+
/** Description of a row in a table
* @param string
* @return string SQL expression, empty string for no description
function rowDescription($table) {
return "";
}
-
+
/** Get descriptions of selected data
* @param array all data to print
* @param array
function rowDescriptions($rows, $foreignKeys) {
return $rows;
}
-
+
/** Get a link to use in select table
* @param string raw value of the field
* @param array single field returned from fields()
*/
function selectLink($val, $field) {
}
-
+
/** Value printed in select table
* @param string HTML-escaped value to print
* @param string link to foreign key
}
return ($link ? "<a href='" . h($link) . "'>$return</a>" : $return);
}
-
+
/** Value conversion used in select and edit
* @param string
* @param array single field returned from fields()
function editVal($val, $field) {
return $val;
}
-
+
/** Print columns box in select
* @param array result of selectColumnsProcess()[0]
* @param array selectable columns
}
echo "</div></fieldset>\n";
}
-
+
/** Print search box in select
* @param array result of selectSearchProcess()
* @param array selectable columns
}
echo "</div></fieldset>\n";
}
-
+
/** Print order box in select
* @param array result of selectOrderProcess()
* @param array selectable columns
echo checkbox("desc[$i]", 1, false, lang('descending')) . "</div>\n";
echo "</div></fieldset>\n";
}
-
+
/** Print limit box in select
* @param string result of selectLimitProcess()
* @return null
echo "<input type='number' name='limit' class='size' value='" . h($limit) . "' onchange='selectFieldChange(this.form);'>";
echo "</div></fieldset>\n";
}
-
+
/** Print text length box in select
* @param string result of selectLengthProcess()
* @return null
echo "</div></fieldset>\n";
}
}
-
+
/** Print action box in select
* @param array
* @return null
echo "</script>\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 !information_schema(DB);
}
-
+
/** Print extra text in the end of a select form
* @param array fields holding e-mails
* @param array selectable columns
*/
function selectEmailPrint($emailFields, $columns) {
}
-
+
/** Process columns box in select
* @param array selectable columns
* @param array
}
return array($select, $group);
}
-
+
/** Process search box in select
* @param array
* @param array
}
return $return;
}
-
+
/** Process order box in select
* @param array
* @param array
}
return $return;
}
-
+
/** Process limit box in select
* @return string expression to use in LIMIT, will be escaped
*/
function selectLimitProcess() {
return (isset($_GET["limit"]) ? $_GET["limit"] : "50");
}
-
+
/** Process length box in select
* @return string number of characters to shorten texts, will be escaped
*/
function selectLengthProcess() {
return (isset($_GET["text_length"]) ? $_GET["text_length"] : "100");
}
-
+
/** Process extras in select form
* @param array AND conditions
* @param array
function selectEmailProcess($where, $foreignKeys) {
return false;
}
-
+
/** Build SQL query used in select
* @param array result of selectColumnsProcess()[0]
* @param array result of selectSearchProcess()
function selectQueryBuild($select, $where, $group, $order, $limit, $page) {
return "";
}
-
+
/** Query printed after execution in the message
* @param string executed query
* @return string
$history[$_GET["db"]][] = array($query, time()); // not DB - $_GET["db"] is changed in database.inc.php //! respect $_GET["ns"]
return " <span class='time'>" . @date("H:i:s") . "</span> <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre><code class='jush-$jush'>" . shorten_utf8($query, 1000) . '</code></pre><p><a href="' . h(str_replace("db=" . urlencode(DB), "db=" . urlencode($_GET["db"]), ME) . 'sql=&history=' . (count($history[$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a></div>'; // @ - time zone may be not set
}
-
+
/** Functions displayed in edit form
* @param array single field from fields()
* @return array
}
return explode("/", $return);
}
-
+
/** Get options to display edit field
* @param string table name
* @param array single field from fields()
}
return "";
}
-
+
/** Process sent input
* @param array single field from fields()
* @param string
}
return unconvert_field($field, $return);
}
-
+
/** Returns export output options
* @return array
*/
}
return $return;
}
-
+
/** Returns export format options
* @return array empty to disable export
*/
function dumpFormat() {
return array('sql' => 'SQL', 'csv' => 'CSV,', 'csv;' => 'CSV;', 'tsv' => 'TSV');
}
-
+
/** Export database structure
* @param string
* @return null prints data
*/
function dumpDatabase($db) {
}
-
+
/** Export table structure
* @param string
* @param string
}
}
}
-
+
/** Export table data
* @param string
* @param string
}
}
}
-
+
/** Set export filename
* @param string
* @return string filename without extension
function dumpFilename($identifier) {
return friendly_url($identifier != "" ? $identifier : (SERVER != "" ? SERVER : "localhost"));
}
-
+
/** Send headers for export
* @param string
* @param bool
}
return $ext;
}
-
+
/** Print homepage
* @return bool whether to print default homepage
*/
echo (support("privileges") ? "<a href='" . h(ME) . "privileges='>" . lang('Privileges') . "</a>\n" : "");
return true;
}
-
+
/** Prints navigation after Adminer title
* @param string can be "auth" if there is no database connection, "db" if there is no database selected, "ns" with invalid schema
* @return null
}
}
}
-
+
/** Prints databases list in menu
* @param string
* @return null
: ""))));
echo "</p></form>\n";
}
-
+
/** Prints table list in menu
* @param array result of table_status('', true)
* @return null
) . "<br>\n";
}
}
-
+
}
$adminer = (function_exists('adminer_object') ? adminer_object() : new Adminer);