mirror of
https://github.com/vrana/adminer.git
synced 2025-08-05 14:17:26 +02:00
Code style: Fix
This commit is contained in:
@@ -11,6 +11,7 @@ add_driver("mssql", "MS SQL");
|
||||
|
||||
if (isset($_GET["mssql"])) {
|
||||
define('Adminer\DRIVER', "mssql");
|
||||
|
||||
if (extension_loaded("sqlsrv") && $_GET["ext"] != "pdo") {
|
||||
class Db extends SqlDb {
|
||||
public $extension = "sqlsrv";
|
||||
|
@@ -5,6 +5,7 @@ SqlDriver::$drivers = array("server" => "MySQL / MariaDB") + SqlDriver::$drivers
|
||||
|
||||
if (!defined('Adminer\DRIVER')) {
|
||||
define('Adminer\DRIVER', "server"); // server - backwards compatibility
|
||||
|
||||
// MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable
|
||||
if (extension_loaded("mysqli") && $_GET["ext"] != "pdo") {
|
||||
class Db extends \MySQLi {
|
||||
|
@@ -5,6 +5,7 @@ add_driver("oracle", "Oracle (beta)");
|
||||
|
||||
if (isset($_GET["oracle"])) {
|
||||
define('Adminer\DRIVER', "oracle");
|
||||
|
||||
if (extension_loaded("oci8") && $_GET["ext"] != "pdo") {
|
||||
class Db extends SqlDb {
|
||||
public $extension = "oci8";
|
||||
|
@@ -5,6 +5,7 @@ add_driver("pgsql", "PostgreSQL");
|
||||
|
||||
if (isset($_GET["pgsql"])) {
|
||||
define('Adminer\DRIVER', "pgsql");
|
||||
|
||||
if (extension_loaded("pgsql") && $_GET["ext"] != "pdo") {
|
||||
class PgsqlDb extends SqlDb {
|
||||
public $extension = "PgSQL";
|
||||
@@ -94,8 +95,9 @@ if (isset($_GET["pgsql"])) {
|
||||
*/
|
||||
function copyFrom(string $table, array $rows): bool {
|
||||
$this->error = '';
|
||||
set_error_handler(function ($errno, $error) {
|
||||
set_error_handler(function (int $errno, string $error): bool {
|
||||
$this->error = (ini_bool('html_errors') ? html_entity_decode($error) : $error);
|
||||
return true;
|
||||
});
|
||||
$return = pg_copy_from($this->link, $table, $rows);
|
||||
restore_error_handler();
|
||||
|
@@ -5,8 +5,8 @@ add_driver("sqlite", "SQLite");
|
||||
|
||||
if (isset($_GET["sqlite"])) {
|
||||
define('Adminer\DRIVER', "sqlite");
|
||||
if (class_exists("SQLite3") && $_GET["ext"] != "pdo") {
|
||||
|
||||
if (class_exists("SQLite3") && $_GET["ext"] != "pdo") {
|
||||
abstract class SqliteDb extends SqlDb {
|
||||
public $extension = "SQLite3";
|
||||
private $link;
|
||||
|
@@ -11,7 +11,7 @@ if (substr(VERSION, -4) != '-dev') {
|
||||
header("Cache-Control: immutable");
|
||||
}
|
||||
|
||||
@ini_set("zlib.output_compression", 1); // @ - may be disabled
|
||||
@ini_set("zlib.output_compression", '1'); // @ - may be disabled
|
||||
|
||||
if ($_GET["file"] == "default.css") {
|
||||
header("Content-Type: text/css; charset=utf-8");
|
||||
|
@@ -257,10 +257,12 @@ AND CHECK_CLAUSE NOT LIKE '% IS NOT NULL'", $this->conn); // ignore default IS N
|
||||
*/
|
||||
function allFields(): array {
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT TABLE_NAME AS tab, COLUMN_NAME AS field, IS_NULLABLE AS nullable, DATA_TYPE AS type, CHARACTER_MAXIMUM_LENGTH AS length" . (JUSH == 'sql' ? ", COLUMN_KEY = 'PRI' AS `primary`" : "") . "
|
||||
foreach (
|
||||
get_rows("SELECT TABLE_NAME AS tab, COLUMN_NAME AS field, IS_NULLABLE AS nullable, DATA_TYPE AS type, CHARACTER_MAXIMUM_LENGTH AS length" . (JUSH == 'sql' ? ", COLUMN_KEY = 'PRI' AS `primary`" : "") . "
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = " . q($_GET["ns"] != "" ? $_GET["ns"] : DB) . "
|
||||
ORDER BY TABLE_NAME, ORDINAL_POSITION", $this->conn) as $row) {
|
||||
ORDER BY TABLE_NAME, ORDINAL_POSITION", $this->conn) as $row
|
||||
) {
|
||||
$row["null"] = ($row["nullable"] == "YES");
|
||||
$return[$row["tab"]][] = $row;
|
||||
}
|
||||
|
@@ -595,10 +595,10 @@ function column_foreign_keys(string $table): array {
|
||||
return $return;
|
||||
}
|
||||
|
||||
/** Compute fields() from $_POST edit data
|
||||
/** Compute fields() from $_POST edit data; used by Mongo and SimpleDB
|
||||
* @return Field[] same as fields()
|
||||
*/
|
||||
function fields_from_edit(): array { // used by Mongo and SimpleDB
|
||||
function fields_from_edit(): array {
|
||||
$return = array();
|
||||
foreach ((array) $_POST["field_keys"] as $key => $val) {
|
||||
if ($val != "") {
|
||||
|
14
compile.php
14
compile.php
@@ -199,10 +199,10 @@ function minify_css($file) {
|
||||
}
|
||||
|
||||
function minify_js($file) {
|
||||
$file = preg_replace_callback("~'use strict';~", function ($match) { // keep only the first one
|
||||
$file = preg_replace_callback("~'use strict';~", function ($match) {
|
||||
static $count = 0;
|
||||
$count++;
|
||||
return ($count == 1 ? $match[0] : '');
|
||||
return ($count == 1 ? $match[0] : ''); // keep only the first one
|
||||
}, $file);
|
||||
if (function_exists('jsShrink')) {
|
||||
$file = jsShrink($file);
|
||||
@@ -210,7 +210,8 @@ function minify_js($file) {
|
||||
return lzw_compress($file);
|
||||
}
|
||||
|
||||
function compile_file($match, $callback = '') { // $callback only to match signature
|
||||
// $callback only to match signature
|
||||
function compile_file($match, $callback = '') {
|
||||
global $project;
|
||||
$file = "";
|
||||
list(, $filenames, $callback) = $match;
|
||||
@@ -303,7 +304,12 @@ if ($vendor) {
|
||||
}
|
||||
}
|
||||
if ($project != "editor" && count(Adminer\SqlDriver::$drivers) == 1) {
|
||||
$file = str_replace('html_select("auth[driver]", SqlDriver::$drivers, DRIVER, "loginDriver(this);")', 'input_hidden("auth[driver]", "' . ($vendor == "mysql" ? "server" : $vendor) . '") . "' . reset(Adminer\SqlDriver::$drivers) . '"', $file, $count);
|
||||
$file = str_replace(
|
||||
'html_select("auth[driver]", SqlDriver::$drivers, DRIVER, "loginDriver(this);")',
|
||||
'input_hidden("auth[driver]", "' . ($vendor == "mysql" ? "server" : $vendor) . '") . "' . reset(Adminer\SqlDriver::$drivers) . '"',
|
||||
$file,
|
||||
$count
|
||||
);
|
||||
if (!$count) {
|
||||
echo "auth[driver] form field not found\n";
|
||||
}
|
||||
|
@@ -47,7 +47,9 @@
|
||||
|
||||
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
|
||||
<exclude-pattern>adminer/drivers/</exclude-pattern>
|
||||
<exclude-pattern>adminer/include/db.inc.php</exclude-pattern>
|
||||
<exclude-pattern>adminer/include/pdo.inc.php</exclude-pattern>
|
||||
<exclude-pattern>adminer/plugins/foreign-system.php</exclude-pattern>
|
||||
<exclude-pattern>adminer/plugins/drivers/</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
foreach (array(
|
||||
foreach (
|
||||
array(
|
||||
'create' => array(1106, 412),
|
||||
'dark' => array(816, 750),
|
||||
'database' => array(896, 666),
|
||||
@@ -12,7 +13,8 @@ foreach (array(
|
||||
'schema' => array(690, 406),
|
||||
'sql' => array(870, 788),
|
||||
'table' => array(816, 750),
|
||||
) as $filename => list($w, $h)) {
|
||||
) as $filename => list($w, $h)
|
||||
) {
|
||||
$im = imagecreatefrompng("screenshots/$filename.png");
|
||||
$im2 = imagecreatetruecolor($w, $h);
|
||||
imagecopy($im2, $im, 0, 0, 0, 0, $w, $h);
|
||||
|
Reference in New Issue
Block a user