PHP: Use namespace

This commit is contained in:
Jakub Vrana
2025-03-05 11:28:53 +01:00
parent 5a708df6ca
commit 52c5392089
111 changed files with 230 additions and 20 deletions

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$PROCEDURE = ($_GET["name"] ? $_GET["name"] : $_GET["call"]);
page_header(lang('Call') . ": " . h($PROCEDURE), $error);

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["check"];
$name = $_GET["name"];
$row = $_POST;

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["create"];
$partition_by = array();
foreach (array('HASH', 'LINEAR HASH', 'KEY', 'LINEAR KEY', 'RANGE', 'LIST') as $key) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$row = $_POST;
if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP changes add.x to add_x

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]);
if ($tables_views && !$error && !$_POST["search"]) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["download"];
$fields = fields($TABLE);
header("Content-Type: application/octet-stream");

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$drivers["mongo"] = "MongoDB (alpha)";
if (isset($_GET["mongo"])) {

View File

@@ -5,6 +5,8 @@
* @author Jakub Vrana
*/
namespace Adminer;
$drivers["mssql"] = "MS SQL";
if (isset($_GET["mssql"])) {

View File

@@ -1,11 +1,13 @@
<?php
namespace Adminer;
$drivers = array("server" => "MySQL") + $drivers;
if (!defined("DRIVER")) {
define("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")) {
class Min_DB extends MySQLi {
class Min_DB extends \MySQLi {
var $extension = "MySQLi";
function __construct() {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$drivers["oracle"] = "Oracle (beta)";
if (isset($_GET["oracle"])) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$drivers["pgsql"] = "PostgreSQL";
if (isset($_GET["pgsql"])) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$drivers["sqlite"] = "SQLite";
if (isset($_GET["sqlite"])) {
@@ -9,7 +11,7 @@ if (isset($_GET["sqlite"])) {
var $extension = "SQLite3", $server_info, $affected_rows, $errno, $error, $_link;
function __construct($filename) {
$this->_link = new SQLite3($filename);
$this->_link = new \SQLite3($filename);
$version = $this->_link->version();
$this->server_info = $version["versionString"];
}
@@ -90,7 +92,7 @@ if (isset($_GET["sqlite"])) {
}
if (class_exists("Min_SQLite")) {
if (class_exists('Adminer\Min_SQLite')) {
class Min_DB extends Min_SQLite {
function __construct() {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["dump"];
if ($_POST && !$error) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["edit"];
$fields = fields($TABLE);
$where = (isset($_GET["select"]) ? ($_POST["check"] && count($_POST["check"]) == 1 ? where_check($_POST["check"][0], $fields) : "") : where($_GET, $fields));

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$EVENT = $_GET["event"];
$intervals = array("YEAR", "QUARTER", "MONTH", "DAY", "HOUR", "MINUTE", "WEEK", "SECOND", "YEAR_MONTH", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "HOUR_MINUTE", "HOUR_SECOND", "MINUTE_SECOND");
$statuses = array("ENABLED" => "ENABLE", "DISABLED" => "DISABLE", "SLAVESIDE_DISABLED" => "DISABLE ON SLAVE");

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
// caching headers added in compile.php
if ($_GET["file"] == "favicon.ico") {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["foreign"];
$name = $_GET["name"];
$row = $_POST;

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
// any method change in this file should be transferred to editor/include/adminer.inc.php and plugins/plugin.php
class Adminer {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$connection = '';
$has_token = $_SESSION["token"];
@@ -144,7 +146,7 @@ function auth_error($error) {
exit;
}
if (isset($_GET["username"]) && !class_exists("Min_DB")) {
if (isset($_GET["username"]) && !class_exists('Adminer\Min_DB')) {
unset($_SESSION["pwds"][DRIVER]);
unset_permanent();
page_header(lang('No extension'), lang('None of the supported PHP extensions (%s) are available.', implode(", ", $possible_drivers)), false);

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
include "../adminer/include/version.inc.php";
include "../adminer/include/errors.inc.php";
include "../adminer/include/coverage.inc.php";

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
if (isset($_GET["status"])) {
$_GET["variables"] = $_GET["status"];
}

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
// coverage is used in tests and removed in compilation
if (extension_loaded("xdebug") && file_exists(sys_get_temp_dir() . "/adminer_coverage.ser")) {
function save_coverage() {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
if (!ob_get_level()) {
ob_start(null, 4096);
}

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$drivers = array();
/** Add a driver

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
// This file is not used in Adminer Editor.
/** Print select result

View File

@@ -1,7 +1,9 @@
<?php
namespace Adminer;
function adminer_errors($errno, $errstr) {
return !!preg_match('~^(Trying to access array offset on( value of type)? null|Undefined (array key|property))~', $errstr);
}
error_reporting(6135); // errors and warnings
set_error_handler('adminer_errors', E_WARNING);
set_error_handler('Adminer\adminer_errors', E_WARNING);

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
// This file is used both in Adminer and Adminer Editor.
/** Get database connection

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
// not used in a single language version
$langs = array(

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
// PDO can be used in several database drivers
if (extension_loaded('pdo')) {
/*abstract*/ class Min_PDO {
@@ -80,7 +82,7 @@ if (extension_loaded('pdo')) {
}
}
class Min_PDOStatement extends PDOStatement {
class Min_PDOStatement extends \PDOStatement {
var $_offset = 0, $num_rows;
function fetch_assoc() {

View File

@@ -1,4 +1,5 @@
<?php
namespace Adminer;
class TmpFile {
var $handler;

View File

@@ -1,2 +1,4 @@
<?php
namespace Adminer;
$VERSION = "5.0.0-dev";

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
/** PHP implementation of XXTEA encryption algorithm
* @author Ma Bingyao <andot@ujn.edu.cn>
* @link http://www.coolcode.cn/?action=show&id=128

View File

@@ -7,6 +7,8 @@
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
namespace Adminer;
include "./include/bootstrap.inc.php";
include "./include/tmpfile.inc.php";

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["indexes"];
$index_types = array("PRIMARY", "UNIQUE", "INDEX");
$table_status = table_status($TABLE, true);

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'تسجيل الدخول',
'Logout successful.' => 'تم تسجيل الخروج بنجاح.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Система',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'লগইন',
'Logout successful.' => 'সফলভাবে লগআউট হয়েছে।',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Inicia la sessió',
'Logout successful.' => 'Desconnexió correcta.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Systém',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'System' => 'System',
'Server' => 'Server',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Login',
'Logout successful.' => 'Abmeldung erfolgreich.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Σύστημα',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Too many unsuccessful logins, try again in %d minute(s).' => array('Too many unsuccessful logins, try again in %d minute.', 'Too many unsuccessful logins, try again in %d minutes.'),
'Query executed OK, %d row(s) affected.' => array('Query executed OK, %d row affected.', 'Query executed OK, %d rows affected.'),

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Login',
'Logout successful.' => 'Sesión finalizada con éxito.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Logi sisse',
'Logout successful.' => 'Väljalogimine õnnestus.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'سیستم',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Järjestelmä',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Authentification',
'Logout successful.' => 'Au revoir !',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Conectar',
'Logout successful.' => 'Pechouse a sesión con éxito.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'התחברות',
'Logout successful.' => 'ההתחברות הצליחה',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Belépés',
'Logout successful.' => 'Sikeres kilépés.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Autenticazione',
'Logout successful.' => 'Uscita effettuata con successo.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'ログイン',
'Logout successful.' => 'ログアウト',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'შესვლა',
'Logout successful.' => 'გამოხვედით სისტემიდან.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'$1-$3-$5' => '$1-$3-$5',
'%.3f s' => '%.3f 초',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistema',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Ieiet',
'Logout successful.' => 'Jūs veiksmīgi izgājāt no sistēmas.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Aanmelden',
'Logout successful.' => 'Successvol afgemeld.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'System' => 'System',
'Server' => 'Server',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Rodzaj bazy',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Entrar',
'Logout successful.' => 'Saída bem sucedida.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Entrar',
'Logout successful.' => 'Sessão terminada com sucesso.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Intră',
'Logout successful.' => 'Ați ieșit cu succes.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Войти',
'Logout successful.' => 'Вы успешно покинули систему.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'Prihlásiť sa',
'Logout successful.' => 'Odhlásenie prebehlo v poriadku.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Систем',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'System',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'நுழை',
'Logout successful.' => 'வெற்றிக‌ர‌மாய் வெளியேறியாயிற்று.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
'Login' => 'เข้าสู่ระบบ',
'Logout successful.' => 'ออกจากระบบเรียบร้อยแล้ว.',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Sistem',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Система Бази Даних',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Hệ thống',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Xx',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => '資料庫系統',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$translations = array(
// label for database system selection (MySQL, SQLite, ...)
'System' => '系统',

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
page_header(lang('Privileges'));
echo '<p class="links"><a href="' . h(ME) . 'user=">' . lang('Create user') . "</a>";

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$PROCEDURE = ($_GET["name"] ? $_GET["name"] : $_GET["procedure"]);
$routine = (isset($_GET["function"]) ? "FUNCTION" : "PROCEDURE");
$row = $_POST;

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
if (support("kill")) {
if ($_POST && !$error) {
$killed = 0;

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
page_header(lang('Database schema'), "", array(), h(DB . ($_GET["ns"] ? ".$_GET[ns]" : "")));
$table_pos = array();

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$row = $_POST;
if ($_POST && !$error) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
header("Content-Type: text/javascript; charset=utf-8");
if ($_GET["script"] == "db") {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["select"];
$table_status = table_status1($TABLE);
$indexes = indexes($TABLE);

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$SEQUENCE = $_GET["sequence"];
$row = $_POST;

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
if (!$error && $_POST["export"]) {
dump_headers("sql");
$adminer->dumpTable("", "");

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["table"];
$fields = fields($TABLE);
if (!$fields) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["trigger"];
$name = $_GET["name"];
$trigger_options = trigger_options();

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TYPE = $_GET["type"];
$row = $_POST;

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$USER = $_GET["user"];
$privileges = array("" => array("All privileges" => ""));
foreach (get_rows("SHOW PRIVILEGES") as $row) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$status = isset($_GET["status"]);
page_header($status ? lang('Status') : lang('Variables'));

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
$TABLE = $_GET["view"];
$row = $_POST;
$orig_type = "VIEW";

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env php
<?php
namespace Adminer;
include __DIR__ . "/adminer/include/version.inc.php";
include __DIR__ . "/adminer/include/errors.inc.php";
include __DIR__ . "/externals/JsShrink/jsShrink.php";

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
page_header(lang('Server'), "", false);
if ($adminer->homepage()) {

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
class Adminer {
var $operators = array("<=", ">=");
var $_values = array();

View File

@@ -1,2 +1,4 @@
<?php
namespace Adminer;
$connection->select_db($adminer->database());

View File

@@ -1,4 +1,6 @@
<?php
namespace Adminer;
/** Encode e-mail header in UTF-8
* @param string
* @return string

View File

@@ -7,6 +7,8 @@
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
namespace Adminer;
include "../adminer/include/bootstrap.inc.php";
$drivers[DRIVER] = lang('Login');

Some files were not shown because too many files have changed in this diff Show More