Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions adminer/call.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$PROCEDURE = ($_GET["name"] ?: $_GET["call"]);
Expand Down
1 change: 1 addition & 0 deletions adminer/check.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$TABLE = $_GET["check"];
Expand Down
1 change: 1 addition & 0 deletions adminer/create.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$TABLE = $_GET["create"];
Expand Down
1 change: 1 addition & 0 deletions adminer/database.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$row = $_POST;
Expand Down
1 change: 1 addition & 0 deletions adminer/db.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]);
Expand Down
1 change: 1 addition & 0 deletions adminer/designs.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

function adminer_object() {
include_once "../plugins/designs.php";
$designs = array();
Expand Down
1 change: 1 addition & 0 deletions adminer/download.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$TABLE = $_GET["download"];
Expand Down
1 change: 1 addition & 0 deletions adminer/drivers/mssql.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Jakub Cernohuby
* @author Vladimir Stastka
Expand Down
1 change: 1 addition & 0 deletions adminer/drivers/mysql.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

SqlDriver::$drivers = array("server" => "MySQL / MariaDB") + SqlDriver::$drivers;
Expand Down
1 change: 1 addition & 0 deletions adminer/drivers/oracle.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

add_driver("oracle", "Oracle (beta)");
Expand Down
1 change: 1 addition & 0 deletions adminer/drivers/pgsql.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

add_driver("pgsql", "PostgreSQL");
Expand Down
1 change: 1 addition & 0 deletions adminer/drivers/sqlite.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

add_driver("sqlite", "SQLite");
Expand Down
1 change: 1 addition & 0 deletions adminer/dump.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$TABLE = $_GET["dump"];
Expand Down
1 change: 1 addition & 0 deletions adminer/edit.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$TABLE = $_GET["edit"];
Expand Down
1 change: 1 addition & 0 deletions adminer/elastic.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

// To create Adminer just for Elasticsearch, run `../compile.php elastic`.

function adminer_object() {
Expand Down
1 change: 1 addition & 0 deletions adminer/event.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$EVENT = $_GET["event"];
Expand Down
1 change: 1 addition & 0 deletions adminer/file.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

if (substr(VERSION, -4) != '-dev') {
Expand Down
1 change: 1 addition & 0 deletions adminer/foreign.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$TABLE = $_GET["foreign"];
Expand Down
1 change: 1 addition & 0 deletions adminer/include/auth.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$permanent = array();
Expand Down
1 change: 1 addition & 0 deletions adminer/include/bootstrap.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

include "../adminer/include/version.inc.php";
Expand Down
1 change: 1 addition & 0 deletions adminer/include/connect.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

if (isset($_GET["status"])) {
Expand Down
1 change: 1 addition & 0 deletions adminer/include/coverage.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

// coverage is used in tests and removed in compilation
Expand Down
1 change: 1 addition & 0 deletions adminer/include/db.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

// this could be interface when "Db extends \mysqli" can have compatible type declarations (PHP 7)
Expand Down
73 changes: 37 additions & 36 deletions adminer/include/design.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

/** Print HTML header
Expand Down Expand Up @@ -30,7 +31,7 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s

$css = adminer()->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);
Expand All @@ -40,31 +41,31 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s
);
$media = " media='(prefers-color-scheme: dark)'";
if ($dark !== false) {
echo "<link rel='stylesheet'" . ($dark ? "" : $media) . " href='../adminer/static/dark.css'>\n";
echo "<link rel='stylesheet'" . ($dark ? "" : $media) . " href='../adminer/static/dark.css'>\n";
}
echo "<meta name='color-scheme' content='" . ($dark === null ? "light dark" : ($dark ? "dark" : "light")) . "'>\n";

// this is matched by compile.php
echo script_src("../adminer/static/functions.js");
echo script_src("static/editing.js");
if (adminer()->head($dark)) {
echo "<link rel='icon' href='data:image/gif;base64,R0lGODlhEAAQAJEAAAQCBPz+/PwCBAROZCH5BAEAAAAALAAAAAAQABAAAAI2hI+pGO1rmghihiUdvUBnZ3XBQA7f05mOak1RWXrNq5nQWHMKvuoJ37BhVEEfYxQzHjWQ5qIAADs='>\n";
echo "<link rel='apple-touch-icon' href='../adminer/static/logo.png'>\n";
echo "<link rel='icon' href='data:image/gif;base64,R0lGODlhEAAQAJEAAAQCBPz+/PwCBAROZCH5BAEAAAAALAAAAAAQABAAAAI2hI+pGO1rmghihiUdvUBnZ3XBQA7f05mOak1RWXrNq5nQWHMKvuoJ37BhVEEfYxQzHjWQ5qIAADs='>\n";
echo "<link rel='apple-touch-icon' href='../adminer/static/logo.png'>\n";
}
foreach ($css as $url => $mode) {
$attrs = ($mode == 'dark' && !$dark
? $media
: ($mode == 'light' && $has_dark ? " media='(prefers-color-scheme: light)'" : "")
);
echo "<link rel='stylesheet'$attrs href='" . h($url) . "'>\n";
$attrs = ($mode == 'dark' && !$dark
? $media
: ($mode == 'light' && $has_dark ? " media='(prefers-color-scheme: light)'" : "")
);
echo "<link rel='stylesheet'$attrs href='" . h($url) . "'>\n";
}
echo "\n<body class='" . lang('ltr') . " nojs";
adminer()->bodyClass();
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
Expand All @@ -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() . "')")
Expand All @@ -90,39 +91,39 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s
echo "<div id='content'>\n";
echo "<span id='menuopen' class='jsonly'>" . icon("move", "", "menu", "") . "</span>" . 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 '<p id="breadcrumb"><a href="' . h($link ?: ".") . '">' . get_driver(DRIVER) . '</a> » ';
$link = substr(preg_replace('~\b(db|ns)=[^&]*&~', '', ME), 0, -1);
$server = adminer()->serverName(SERVER);
$server = ($server != "" ? $server : lang('Server'));
if ($breadcrumb === false) {
echo "$server\n";
} else {
echo "<a href='" . h($link) . "' accesskey='1' title='Alt+Shift+1'>$server</a> » ";
if ($_GET["ns"] != "" || (DB != "" && is_array($breadcrumb))) {
echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> » ';
$link = substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1);
echo '<p id="breadcrumb"><a href="' . h($link ?: ".") . '">' . get_driver(DRIVER) . '</a> » ';
$link = substr(preg_replace('~\b(db|ns)=[^&]*&~', '', ME), 0, -1);
$server = adminer()->serverName(SERVER);
$server = ($server != "" ? $server : lang('Server'));
if ($breadcrumb === false) {
echo "$server\n";
} else {
echo "<a href='" . h($link) . "' accesskey='1' title='Alt+Shift+1'>$server</a> » ";
if ($_GET["ns"] != "" || (DB != "" && is_array($breadcrumb))) {
echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> » ';
}
if (is_array($breadcrumb)) {
if ($_GET["ns"] != "") {
echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> » ';
}
if (is_array($breadcrumb)) {
if ($_GET["ns"] != "") {
echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> » ';
}
foreach ($breadcrumb as $key => $val) {
$desc = (is_array($val) ? $val[1] : h($val));
if ($desc != "") {
echo "<a href='" . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . "'>$desc</a> » ";
}
foreach ($breadcrumb as $key => $val) {
$desc = (is_array($val) ? $val[1] : h($val));
if ($desc != "") {
echo "<a href='" . h(ME . "$key=") . urlencode(is_array($val) ? $val[0] : $val) . "'>$desc</a> » ";
}
}
echo "$title\n";
}
echo "$title\n";
}
}
echo "<h2>$title_all</h2>\n";
echo "<div id='ajaxstatus' class='jsonly hidden'></div>\n";
restart_session();
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);
Expand Down
1 change: 1 addition & 0 deletions adminer/include/driver.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

/** Add or overwrite a driver */
Expand Down
1 change: 1 addition & 0 deletions adminer/include/editing.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

// This file is not used in Adminer Editor.
Expand Down
1 change: 1 addition & 0 deletions adminer/include/errors.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

error_reporting(24575); // all but E_DEPRECATED (overriding mysqli methods without types is deprecated)
Expand Down
1 change: 1 addition & 0 deletions adminer/include/functions.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

// This file is used both in Adminer and Adminer Editor.
Expand Down
1 change: 1 addition & 0 deletions adminer/include/html.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

/** Return <script> element */
Expand Down
1 change: 1 addition & 0 deletions adminer/include/lang.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

/** Translate string
Expand Down
1 change: 1 addition & 0 deletions adminer/include/pdo.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

// PDO can be used in several database drivers
Expand Down
1 change: 1 addition & 0 deletions adminer/include/plugin.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

// the overridable methods don't use return type declarations so that plugins can be compatible with PHP 5
Expand Down
1 change: 1 addition & 0 deletions adminer/include/plugins.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

class Plugins {
Expand Down
1 change: 1 addition & 0 deletions adminer/include/tmpfile.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

class TmpFile {
Expand Down
1 change: 1 addition & 0 deletions adminer/include/version.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

const VERSION = "5.4.2-dev";
1 change: 1 addition & 0 deletions adminer/include/xxtea.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

/** PHP implementation of XXTEA encryption algorithm
Expand Down
2 changes: 2 additions & 0 deletions adminer/index.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

/** Adminer - Compact database management
* @link https://www.adminer.org/
* @author Jakub Vrana, https://www.vrana.cz/
* @copyright 2007 Jakub Vrana
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/

// this is matched by compile.php

namespace Adminer;
Expand Down
1 change: 1 addition & 0 deletions adminer/indexes.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

$TABLE = $_GET["indexes"];
Expand Down
1 change: 1 addition & 0 deletions adminer/lang/ar.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

Lang::$translations = array(
Expand Down
1 change: 1 addition & 0 deletions adminer/lang/bg.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Adminer;

Lang::$translations = array(
Expand Down
Loading
Loading