diff --git a/Makefile b/Makefile index 8c5dcfbf6..325d034be 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +PHPCS_BIN := $(HOME)/.composer/vendor/bin/phpcs +PHPCBF_BIN := $(HOME)/.composer/vendor/bin/phpcbf + ROOT_DIRECTORY = $(shell dirname "$(realpath $(lastword $(MAKEFILE_LIST)))") PHP := $(shell which php) PORT := 8000 @@ -37,3 +40,16 @@ clean: .PHONY: clean.all clean.all: clean + +.PHONY: get-phpcs +get-phpcs: + @echo "Global PHPCS path: $(PHPCS_BIN)" + @$(PHPCS_BIN) --version || echo "PHPCS not installed globally" + +.PHONY: phpcs +phpcs: + $(PHPCS_BIN) $(ROOT_DIRECTORY) --standard=$(ROOT_DIRECTORY)/phpcs.xml --report=full + +.PHONY: phpcbf +phpcbf: + $(PHPCBF_BIN) $(ROOT_DIRECTORY) --standard=$(ROOT_DIRECTORY)/phpcs.xml diff --git a/adminer/call.inc.php b/adminer/call.inc.php index 4658e6619..bbedb3882 100644 --- a/adminer/call.inc.php +++ b/adminer/call.inc.php @@ -1,4 +1,5 @@ "MySQL / MariaDB") + SqlDriver::$drivers; diff --git a/adminer/drivers/oracle.inc.php b/adminer/drivers/oracle.inc.php index 831effc9d..45a682240 100644 --- a/adminer/drivers/oracle.inc.php +++ b/adminer/drivers/oracle.inc.php @@ -1,4 +1,5 @@ css(); if (is_int(key($css))) { // legacy return value - $css = array_fill_keys($css, 'light'); + $css = array_fill_keys($css, 'light'); } $has_light = in_array('light', $css) || in_array('', $css); $has_dark = in_array('dark', $css) || in_array('', $css); @@ -40,7 +41,7 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s ); $media = " media='(prefers-color-scheme: dark)'"; if ($dark !== false) { - echo "\n"; + echo "\n"; } echo "\n"; @@ -48,23 +49,23 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s echo script_src("../adminer/static/functions.js"); echo script_src("static/editing.js"); if (adminer()->head($dark)) { - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; } foreach ($css as $url => $mode) { - $attrs = ($mode == 'dark' && !$dark - ? $media - : ($mode == 'light' && $has_dark ? " media='(prefers-color-scheme: light)'" : "") - ); - echo "\n"; + $attrs = ($mode == 'dark' && !$dark + ? $media + : ($mode == 'light' && $has_dark ? " media='(prefers-color-scheme: light)'" : "") +); +echo "\n"; } echo "\nbodyClass(); echo "'>\n"; $filename = get_temp_dir() . "/adminer.version"; if (!$_COOKIE["adminer_version"] && function_exists('openssl_verify') && file_exists($filename) && filemtime($filename) + 86400 > time()) { // 86400 - 1 day in seconds - $version = unserialize(file_get_contents($filename)); - $public = "-----BEGIN PUBLIC KEY----- + $version = unserialize(file_get_contents($filename)); + $public = "-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwqWOVuF5uw7/+Z70djoK RlHIZFZPO0uYRezq90+7Amk+FDNd7KkL5eDve+vHRJBLAszF/7XKXe11xwliIsFs DFWQlsABVZB3oisKCBEuI71J4kPH8dKGEWR9jDHFw3cWmoH3PmqImX6FISWbG3B8 @@ -74,9 +75,9 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s fQIDAQAB -----END PUBLIC KEY----- "; - if (openssl_verify($version["version"], base64_decode($version["signature"]), $public) == 1) { - $_COOKIE["adminer_version"] = $version["version"]; // doesn't need to send to the browser - } + if (openssl_verify($version["version"], base64_decode($version["signature"]), $public) == 1) { + $_COOKIE["adminer_version"] = $version["version"]; // doesn't need to send to the browser + } } echo script("mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick" . (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '" . VERSION . "', '" . js_escape(ME) . "', '" . get_token() . "')") @@ -90,31 +91,31 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s echo "
\n"; echo "" . icon("move", "", "menu", "") . "" . script("qs('#menuopen').onclick = event => { qs('#foot').classList.toggle('foot'); event.stopPropagation(); }"); if ($breadcrumb !== null) { - $link = substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1); - echo '

$title_all

\n"; echo "\n"; @@ -122,7 +123,7 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s page_messages($error); $databases = &get_session("dbs"); if (DB != "" && $databases && !in_array(DB, $databases, true)) { - $databases = null; + $databases = null; } stop_session(); define('Adminer\PAGE_HEADER', 1); diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php index 61a7d3953..ffac3be35 100644 --- a/adminer/include/driver.inc.php +++ b/adminer/include/driver.inc.php @@ -1,4 +1,5 @@ element */ diff --git a/adminer/include/lang.inc.php b/adminer/include/lang.inc.php index d648cea3c..4d5d24e30 100644 --- a/adminer/include/lang.inc.php +++ b/adminer/include/lang.inc.php @@ -1,4 +1,5 @@ select_db(adminer()->database()); diff --git a/editor/include/editing.inc.php b/editor/include/editing.inc.php index f0fdc494e..fb5659a70 100644 --- a/editor/include/editing.inc.php +++ b/editor/include/editing.inc.php @@ -1,4 +1,5 @@ /externals/ /designs/ /(adminer|editor)[-.] + /vendor @@ -51,6 +52,7 @@ adminer/include/pdo.inc.php adminer/plugins/foreign-system.php adminer/plugins/drivers/ + plugins/* @@ -79,7 +81,6 @@ - @@ -93,19 +94,7 @@ - - - - - - - - - - - - diff --git a/plugins/drivers/clickhouse.php b/plugins/drivers/clickhouse.php index 7fa1d5fc8..191ca2ff3 100644 --- a/plugins/drivers/clickhouse.php +++ b/plugins/drivers/clickhouse.php @@ -1,4 +1,5 @@ and link to the uploaded files from select diff --git a/plugins/login-table.php b/plugins/login-table.php index 3fa4a979f..cfe6f4ed5 100644 --- a/plugins/login-table.php +++ b/plugins/login-table.php @@ -1,4 +1,5 @@