<?php
namespace Adminer;
-$PROCEDURE = ($_GET["name"] ? $_GET["name"] : $_GET["call"]);
+$PROCEDURE = ($_GET["name"] ?: $_GET["call"]);
page_header(lang('Call') . ": " . h($PROCEDURE), $error);
$routine = routine($_GET["call"], (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE"));
"table" => idf_unescape($match[4] != "" ? $match[4] : $match[3]),
"source" => array_map('Adminer\idf_unescape', $source[0]),
"target" => array_map('Adminer\idf_unescape', $target[0]),
- "on_delete" => ($match[6] ? $match[6] : "RESTRICT"),
- "on_update" => ($match[7] ? $match[7] : "RESTRICT"),
+ "on_delete" => ($match[6] ?: "RESTRICT"),
+ "on_update" => ($match[7] ?: "RESTRICT"),
);
}
}
function get_current_db() {
global $connection;
- $db = $connection->_current_db ? $connection->_current_db : DB;
+ $db = $connection->_current_db ?: DB;
unset($connection->_current_db);
return $db;
}
function views_table($columns) {
$owner = where_owner('');
- return "(SELECT $columns FROM all_views WHERE " . ($owner ? $owner : "rownum < 0") . ")";
+ return "(SELECT $columns FROM all_views WHERE " . ($owner ?: "rownum < 0") . ")";
}
function tables_list() {
function schemas() {
$return = get_vals("SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX')) ORDER BY 1");
- return ($return ? $return : get_vals("SELECT DISTINCT owner FROM all_tables WHERE tablespace_name = " . q(DB) . " ORDER BY 1"));
+ return ($return ?: get_vals("SELECT DISTINCT owner FROM all_tables WHERE tablespace_name = " . q(DB) . " ORDER BY 1"));
}
function get_schema() {
$error = lang('Session support must be enabled.');
}
$params = session_get_cookie_params();
- cookie("adminer_key", ($_COOKIE["adminer_key"] ? $_COOKIE["adminer_key"] : rand_string()), $params["lifetime"]);
+ cookie("adminer_key", ($_COOKIE["adminer_key"] ?: rand_string()), $params["lifetime"]);
page_header(lang('Login'), $error, null);
echo "<form action='' method='post'>\n";
echo "<div>";
<?php
if ($breadcrumb !== null) {
$link = substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1);
- echo '<p id="breadcrumb"><a href="' . h($link ? $link : ".") . '">' . $drivers[DRIVER] . '</a> » ';
+ echo '<p id="breadcrumb"><a href="' . h($link ?: ".") . '">' . $drivers[DRIVER] . '</a> » ';
$link = substr(preg_replace('~\b(db|ns)=[^&]*&~', '', ME), 0, -1);
$server = $adminer->serverName(SERVER);
$server = ($server != "" ? $server : lang('Server'));
*/
function table_status1($table, $fast = false) {
$return = table_status($table, $fast);
- return ($return ? $return : array("Name" => $table));
+ return ($return ?: array("Name" => $table));
}
/** Find out foreign keys for each column
}
ob_flush();
flush();
- $return = @get_key_vals(($slow_query ? $slow_query : $query), $connection2, false); // @ - may be killed
+ $return = @get_key_vals(($slow_query ?: $query), $connection2, false); // @ - may be killed
if ($connection2) {
echo script("clearTimeout(timeout);");
ob_flush();
*/
function lang($idf, $number = null) {
global $LANG, $translations;
- $translation = ($translations[$idf] ? $translations[$idf] : $idf);
+ $translation = ($translations[$idf] ?: $idf);
if (is_array($translation)) {
$pos = ($number == 1 ? 0
: ($LANG == 'cs' || $LANG == 'sk' ? ($number && $number < 5 ? 1 : 2) // different forms for 1, 2-4, other
$desc = $index["descs"][$key];
$set[] = idf_escape($column) . ($length ? "(" . (+$length) . ")" : "") . ($desc ? " DESC" : "");
$columns[] = $column;
- $lengths[] = ($length ? $length : null);
+ $lengths[] = ($length ?: null);
$descs[] = $desc;
}
}
<?php
namespace Adminer;
-$PROCEDURE = ($_GET["name"] ? $_GET["name"] : $_GET["procedure"]);
+$PROCEDURE = ($_GET["name"] ?: $_GET["procedure"]);
$routine = (isset($_GET["function"]) ? "FUNCTION" : "PROCEDURE");
$row = $_POST;
$row["fields"] = (array) $row["fields"];
$table_pos = array();
$table_pos_js = array();
-$SCHEMA = ($_GET["schema"] ? $_GET["schema"] : $_COOKIE["adminer_schema-" . str_replace(".", "_", DB)]); // $_COOKIE["adminer_schema"] was used before 3.2.0 //! ':' in table name
+$SCHEMA = ($_GET["schema"] ?: $_COOKIE["adminer_schema-" . str_replace(".", "_", DB)]); // $_COOKIE["adminer_schema"] was used before 3.2.0 //! ':' in table name
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $SCHEMA, $matches, PREG_SET_ORDER);
foreach ($matches as $i => $match) {
$table_pos[$match[1]] = array($match[2], $match[3]);
$field["pos"] = $pos;
$schema[$table]["fields"][$name] = $field;
}
- $schema[$table]["pos"] = ($table_pos[$table] ? $table_pos[$table] : array($top, 0));
+ $schema[$table]["pos"] = ($table_pos[$table] ?: array($top, 0));
foreach ($adminer->foreignKeys($table) as $val) {
if (!$val["db"]) {
$left = $base_left;
header("Content-Type: text/plain; charset=utf-8");
foreach ($_GET["val"] as $unique_idf => $row) {
$as = convert_field($fields[key($row)]);
- $select = array($as ? $as : idf_escape(key($row)));
+ $select = array($as ?: idf_escape(key($row)));
$where[] = where_check($unique_idf, $fields);
$return = $driver->select($TABLE, $select, $where, $select);
if ($return) {
function remove_lang($match) {
global $translations;
$idf = strtr($match[2], array("\\'" => "'", "\\\\" => "\\"));
- $s = ($translations[$idf] ? $translations[$idf] : $idf);
+ $s = ($translations[$idf] ?: $idf);
if ($match[3] == ",") { // lang() has parameters
return $match[1] . (is_array($s) ? "lang(array('" . implode("', '", array_map('add_apo_slashes', $s)) . "')," : "sprintf('" . add_apo_slashes($s) . "',");
}
}
}
-foreach (glob(__DIR__ . "/adminer/lang/" . ($_SESSION["lang"] ? $_SESSION["lang"] : "*") . ".inc.php") as $filename) {
+foreach (glob(__DIR__ . "/adminer/lang/" . ($_SESSION["lang"] ?: "*") . ".inc.php") as $filename) {
$messages = $messages_all;
$file = file_get_contents($filename);
$file = str_replace("\r", "", $file);
function connect($server, $username, $password) {
preg_match('~^(https?://)?(.*)~', $server, $match);
- $this->_url = ($match[1] ? $match[1] : "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
+ $this->_url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$return = $this->query('SELECT 1');
return (bool) $return;
}
*/
function connect($server, $username, $password) {
preg_match('~^(https?://)?(.*)~', $server, $match);
- $this->_url = ($match[1] ? $match[1] : "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
+ $this->_url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$return = $this->query('');
if ($return) {
$this->server_info = $return['version']['number'];
$properties = array();
foreach ($fields as $f) {
$field_name = trim($f[1][0]);
- $field_type = trim($f[1][1] ? $f[1][1] : "text");
+ $field_type = trim($f[1][1] ?: "text");
$properties[$field_name] = array(
'type' => $field_type
);
function connect($server, $username, $password) {
preg_match('~^(https?://)?(.*)~', $server, $match);
- $this->_url = ($match[1] ? $match[1] : "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
+ $this->_url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
$return = $this->query('');
if ($return) {
$this->server_info = $return['version']['number'];
$properties = array();
foreach ($fields as $f) {
$field_name = trim($f[1][0]);
- $field_type = trim($f[1][1] ? $f[1][1] : "text");
+ $field_type = trim($f[1][1] ?: "text");
$properties[$field_name] = array(
'type' => $field_type
);
}
$connection->error = '';
$tag = $action . "Result";
- return ($xml->$tag ? $xml->$tag : true);
+ return ($xml->$tag ?: true);
}
function sdb_request_all($action, $tag, $params = array(), $timeout = 0) {