]> git.joonet.de Git - adminer.git/commitdiff
Doc-comments: Format
authorJakub Vrana <jakub@vrana.cz>
Fri, 28 Mar 2025 08:13:36 +0000 (09:13 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 28 Mar 2025 11:45:02 +0000 (12:45 +0100)
15 files changed:
adminer/drivers/mysql.inc.php
adminer/include/adminer.inc.php
adminer/include/db.inc.php
adminer/include/design.inc.php
adminer/include/driver.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/include/html.inc.php
adminer/include/lang.inc.php
adminer/include/tmpfile.inc.php
adminer/include/xxtea.inc.php
editor/include/editing.inc.php
plugins/drivers/elastic.php
plugins/login-table.php
plugins/tinymce.php

index 7071eb9da6252e520378b19a8b0795137c920eb3..8198d7f29906bd38157b10884b6a9c6097baa175 100644 (file)
@@ -83,8 +83,7 @@ if (!defined('Adminer\DRIVER')) {
                                return (bool) $this->link;
                        }
 
-                       /** Set the client character set
-                       */
+                       /** Set the client character set */
                        function set_charset(string $charset): bool {
                                if (function_exists('mysql_set_charset')) {
                                        if (mysql_set_charset($charset, $this->link)) {
@@ -126,8 +125,6 @@ if (!defined('Adminer\DRIVER')) {
                        /** @var resource */ private $result;
                        /** @var int */ private $offset = 0;
 
-                       /** Constructor
-                       */
                        function __construct(resource $result) {
                                $this->result = $result;
                                $this->num_rows = mysql_num_rows($result);
@@ -157,8 +154,7 @@ if (!defined('Adminer\DRIVER')) {
                                return $return;
                        }
 
-                       /** Free result set
-                       */
+                       /** Free result set */
                        function __destruct() {
                                mysql_free_result($this->result);
                        }
@@ -355,14 +351,12 @@ if (!defined('Adminer\DRIVER')) {
 
 
 
-       /** Escape database identifier
-       */
+       /** Escape database identifier */
        function idf_escape(string $idf): string {
                return "`" . str_replace("`", "``", $idf) . "`";
        }
 
-       /** Get escaped table name
-       */
+       /** Get escaped table name */
        function table(string $idf): string {
                return idf_escape($idf);
        }
@@ -434,8 +428,7 @@ if (!defined('Adminer\DRIVER')) {
                return $return;
        }
 
-       /** Get logged user
-       */
+       /** Get logged user */
        function logged_user(): string {
                return get_val("SELECT USER()");
        }
@@ -628,15 +621,13 @@ if (!defined('Adminer\DRIVER')) {
                return $return;
        }
 
-       /** Find out if database is information_schema
-       */
+       /** Find out if database is information_schema */
        function information_schema(string $db): bool {
                return ($db == "information_schema")
                        || (min_version(5.5) && $db == "performance_schema");
        }
 
-       /** Get escaped error message
-       */
+       /** Get escaped error message */
        function error(): string {
                global $connection;
                return h(preg_replace('~^You have an error.*syntax to use~U', "Syntax error", $connection->error));
@@ -680,8 +671,7 @@ if (!defined('Adminer\DRIVER')) {
                return $return;
        }
 
-       /** Generate modifier for auto increment column
-       */
+       /** Generate modifier for auto increment column */
        function auto_increment(): string {
                $auto_increment_index = " PRIMARY KEY";
                // don't overwrite primary key by auto_increment
@@ -959,8 +949,7 @@ if (!defined('Adminer\DRIVER')) {
                return ($where || $table_status["Engine"] != "InnoDB" ? null : $table_status["Rows"]);
        }
 
-       /** Get SQL command to create table
-       */
+       /** Get SQL command to create table */
        function create_sql(string $table, bool $auto_increment, string $style): string {
                $return = get_val("SHOW CREATE TABLE " . table($table), 1);
                if (!$auto_increment) {
@@ -969,20 +958,17 @@ if (!defined('Adminer\DRIVER')) {
                return $return;
        }
 
-       /** Get SQL command to truncate table
-       */
+       /** Get SQL command to truncate table */
        function truncate_sql(string $table): string {
                return "TRUNCATE " . table($table);
        }
 
-       /** Get SQL command to change database
-       */
+       /** Get SQL command to change database */
        function use_sql(string $database): string {
                return "USE " . idf_escape($database);
        }
 
-       /** Get SQL commands to create triggers
-       */
+       /** Get SQL commands to create triggers */
        function trigger_sql(string $table): string {
                $return = "";
                foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_\\")), null, "-- ") as $row) {
@@ -1061,8 +1047,7 @@ if (!defined('Adminer\DRIVER')) {
                return queries("KILL " . number($val));
        }
 
-       /** Return query to get connection ID
-       */
+       /** Return query to get connection ID */
        function connection_id(): string {
                return "SELECT CONNECTION_ID()";
        }
@@ -1083,8 +1068,7 @@ if (!defined('Adminer\DRIVER')) {
                return array();
        }
 
-       /** Get values of user defined type
-       */
+       /** Get values of user defined type */
        function type_values(int $id): string {
                return "";
        }
@@ -1096,14 +1080,12 @@ if (!defined('Adminer\DRIVER')) {
                return array();
        }
 
-       /** Get current schema
-       */
+       /** Get current schema */
        function get_schema(): string {
                return "";
        }
 
-       /** Set current schema
-       */
+       /** Set current schema */
        function set_schema(string $schema, Db $connection2 = null): bool {
                return true;
        }
index 046103ace26b558cdf618dc27140064fa103fc39..8d9b6a4285be58c038f6dc70b4ffa4a12c7b4a74 100644 (file)
@@ -34,8 +34,7 @@ class Adminer {
                return password_file($create);
        }
 
-       /** Return key used to group brute force attacks; behind a reverse proxy, you want to return the last part of X-Forwarded-For
-       */
+       /** Return key used to group brute force attacks; behind a reverse proxy, you want to return the last part of X-Forwarded-For */
        function bruteForceKey(): string {
                return $_SERVER["REMOTE_ADDR"];
        }
@@ -47,8 +46,7 @@ class Adminer {
                return h($server);
        }
 
-       /** Identifier of selected database
-       */
+       /** Identifier of selected database */
        function database(): string {
                // should be used everywhere instead of DB
                return DB;
@@ -75,8 +73,7 @@ class Adminer {
                return 2;
        }
 
-       /** Headers to send before HTML output
-       */
+       /** Headers to send before HTML output */
        function headers(): void {
        }
 
@@ -112,8 +109,7 @@ class Adminer {
                return $return;
        }
 
-       /** Print login form
-       */
+       /** Print login form */
        function loginForm(): void {
                global $drivers;
                echo "<table class='layout'>\n";
@@ -245,8 +241,7 @@ class Adminer {
                return shorten_utf8(trim($query), 1000);
        }
 
-       /** Print HTML code just before the Execute button in SQL command
-       */
+       /** Print HTML code just before the Execute button in SQL command */
        function sqlPrintAfter(): void {
        }
 
@@ -1029,8 +1024,7 @@ class Adminer {
                );
        }
 
-       /** Print databases list in menu
-       */
+       /** Print databases list in menu */
        function databasesPrint(string $missing): void {
                global $adminer, $connection;
                $databases = $this->databases();
index be588c2bef03bb102052cec04e7160f07ee0ff18..656cc69c2ffb3856530881555d9b8cdc3f335681 100644 (file)
@@ -13,8 +13,7 @@ abstract class SqlDb {
        /** @var string */ public $error; // last error message
        /** @var Result|bool */ protected $multi; // used for multiquery
 
-       /** Connect to server
-       */
+       /** Connect to server */
        abstract function connect(string $server, string $username, string $password): bool;
 
        /** Quote string to use in SQL
@@ -22,8 +21,7 @@ abstract class SqlDb {
        */
        abstract function quote(string $string): string;
 
-       /** Select database
-       */
+       /** Select database */
        abstract function select_db(string $database): bool;
 
        /** Send query
@@ -45,8 +43,7 @@ abstract class SqlDb {
                return $this->multi;
        }
 
-       /** Fetch next resultset
-       */
+       /** Fetch next resultset */
        function next_result(): bool {
                return false;
        }
index d5ce11748a6ee3e5b2dbf40ffce43c1af9baab85..9fada1bf02f38eda99c0d62af82fbb9239f13278 100644 (file)
@@ -125,8 +125,7 @@ const thousandsSeparator = '" . js_escape(lang(',')) . "';")
        define('Adminer\PAGE_HEADER', 1);
 }
 
-/** Send HTTP headers
-*/
+/** Send HTTP headers */
 function page_headers(): void {
        global $adminer;
        header("Content-Type: text/html; charset=utf-8");
@@ -172,8 +171,7 @@ function get_nonce(): string {
        return $nonce;
 }
 
-/** Print flash and error messages
-*/
+/** Print flash and error messages */
 function page_messages(string $error): void {
        global $adminer;
        $uri = preg_replace('~^[^?]*~', '', $_SERVER["REQUEST_URI"]);
index 0a04d937a773791662a97b453521cab8050fbb22..392c501aae480eba3c477a67bb3ac907bdbf6f6b 100644 (file)
@@ -3,15 +3,13 @@ namespace Adminer;
 
 $drivers = array();
 
-/** Add a driver
-*/
+/** Add a driver */
 function add_driver(string $id, string $name): void {
        global $drivers;
        $drivers[$id] = $name;
 }
 
-/** Get driver name
-*/
+/** Get driver name */
 function get_driver(string $id): string {
        global $drivers;
        return $drivers[$id];
@@ -33,8 +31,7 @@ abstract class SqlDriver {
        /** @var string */ public $enumLength = "'(?:''|[^'\\\\]|\\\\.)*'"; // regular expression for parsing enum lengths
        /** @var list<string> */ public $generated = array(); // allowed types of generated columns
 
-       /** Create object for performing database operations
-       */
+       /** Create object for performing database operations */
        function __construct(Db $connection) {
                $this->conn = $connection;
        }
@@ -134,8 +131,7 @@ abstract class SqlDriver {
                ) . $this->insertReturning($table));
        }
 
-       /** Get RETURNING clause for INSERT queries (PostgreSQL specific)
-       */
+       /** Get RETURNING clause for INSERT queries (PostgreSQL specific) */
        function insertReturning(string $table): string {
                return "";
        }
@@ -186,8 +182,7 @@ abstract class SqlDriver {
                return $idf;
        }
 
-       /** Convert operator so it can be used in search
-       */
+       /** Convert operator so it can be used in search */
        function convertOperator(string $operator): string {
                return $operator;
        }
@@ -202,8 +197,7 @@ abstract class SqlDriver {
                );
        }
 
-       /** Quote binary string
-       */
+       /** Quote binary string */
        function quoteBinary(string $s): string {
                return q($s);
        }
@@ -220,8 +214,7 @@ abstract class SqlDriver {
        function tableHelp(string $name, bool $is_view = false) {
        }
 
-       /** Check if C-style escapes are supported
-       */
+       /** Check if C-style escapes are supported */
        function hasCStyleEscapes(): bool {
                return false;
        }
index d58afaf107e65d7af165d50d2b354e16cda57a7b..f30b1f3c34248a615007b65a64cef207f9bcdc5b 100644 (file)
@@ -217,8 +217,7 @@ function get_partitions_info(string $table): array {
        return $return;
 }
 
-/** Filter length value including enums
-*/
+/** Filter length value including enums */
 function process_length(string $length): string {
        global $driver;
        $enum_length = $driver->enumLength;
@@ -491,8 +490,7 @@ function create_routine($routine, array $row): string {
        ;
 }
 
-/** Remove current user definer from SQL command
-*/
+/** Remove current user definer from SQL command */
 function remove_definer(string $query): string {
        return preg_replace('~^([A-Z =]+) DEFINER=`' . preg_replace('~@(.*)~', '`@`(%|\1)', logged_user()) . '`~', '\1', $query); //! proper escaping of user
 }
@@ -531,8 +529,7 @@ function tar_file(string $filename, $tmp_file): void {
        echo str_repeat("\0", 511 - ($tmp_file->size + 511) % 512);
 }
 
-/** Get INI bytes value
-*/
+/** Get INI bytes value */
 function ini_bytes(string $ini): int {
        $val = ini_get($ini);
        switch (strtolower(substr($val, -1))) {
@@ -584,8 +581,7 @@ function db_size(string $db): string {
        return format_number($return);
 }
 
-/** Print SET NAMES if utf8mb4 might be needed
-*/
+/** Print SET NAMES if utf8mb4 might be needed */
 function set_utf8mb4(string $create): void {
        global $connection;
        static $set = false;
index 55ed3ae23e44ee45265457d9e1b605790a8fb1ac..f2504ee0bf7fbf6f60b5db575c840e893cabddf1 100644 (file)
@@ -3,8 +3,7 @@ namespace Adminer;
 
 // This file is used both in Adminer and Adminer Editor.
 
-/** Get database connection
-*/
+/** Get database connection */
 function connection(): Db {
        // can be used in customization, $connection is minified
        global $connection;
@@ -27,8 +26,7 @@ function driver() {
        return $driver;
 }
 
-/** Get Adminer version
-*/
+/** Get Adminer version */
 function version(): string {
        global $VERSION;
        return $VERSION;
@@ -45,15 +43,13 @@ function idf_unescape(string $idf): string {
        return str_replace($last . $last, $last, substr($idf, 1, -1));
 }
 
-/** Shortcut for $connection->quote($string)
-*/
+/** Shortcut for $connection->quote($string) */
 function q(string $string): string {
        global $connection;
        return $connection->quote($string);
 }
 
-/** Escape string to use inside ''
-*/
+/** Escape string to use inside '' */
 function escape_string(string $val): string {
        return substr(q($val), 1, -1);
 }
@@ -69,14 +65,12 @@ function idx(?array $array, $key, $default = null) {
        return ($array && array_key_exists($key, $array) ? $array[$key] : $default);
 }
 
-/** Remove non-digits from a string
-*/
+/** Remove non-digits from a string */
 function number(string $val): string {
        return preg_replace('~[^0-9]+~', '', $val);
 }
 
-/** Get regular expression to match numeric types
-*/
+/** Get regular expression to match numeric types */
 function number_type(): string {
        return '((?<!o)int(?!er)|numeric|real|float|double|decimal|money)'; // not point, not interval
 }
@@ -102,8 +96,7 @@ function remove_slashes(array $process, bool $filter = false): void {
        }
 }
 
-/** Escape or unescape string to use inside form []
-*/
+/** Escape or unescape string to use inside form [] */
 function bracket_escape(string $idf, bool $back = false): string {
        // escape brackets inside name="x[]"
        static $trans = array(':' => ':1', ']' => ':2', '[' => ':3', '"' => ':4');
@@ -128,21 +121,18 @@ function min_version($version, $maria_db = "", Db $connection2 = null): bool {
        return $version && version_compare($server_info, $version) >= 0;
 }
 
-/** Get connection charset
-*/
+/** Get connection charset */
 function charset(Db $connection): string {
        return (min_version("5.5.3", 0, $connection) ? "utf8mb4" : "utf8"); // SHOW CHARSET would require an extra query
 }
 
-/** Get INI boolean value
-*/
+/** Get INI boolean value */
 function ini_bool(string $ini): bool {
        $val = ini_get($ini);
        return (preg_match('~^(on|true|yes)$~i', $val) || (int) $val); // boolean values set by php_value are strings
 }
 
-/** Check if SID is necessary
-*/
+/** Check if SID is necessary */
 function sid(): bool {
        static $return;
        if ($return === null) { // restart_session() defines SID
@@ -151,8 +141,7 @@ function sid(): bool {
        return $return;
 }
 
-/** Set password to session
-*/
+/** Set password to session */
 function set_password(string $vendor, string $server, string $username, ?string $password): void {
        $_SESSION["pwds"][$vendor][$server][$username] = ($_COOKIE["adminer_key"] && is_string($password)
                ? array(encrypt_string($password, $_COOKIE["adminer_key"]))
@@ -258,8 +247,7 @@ function unique_array(array $row, array $indexes) {
        }
 }
 
-/** Escape column key used in where()
-*/
+/** Escape column key used in where() */
 function escape_key(string $key): string {
        if (preg_match('(^([\w(]+)(' . str_replace("_", ".*", preg_quote(idf_escape("_"))) . ')([ \w)]+)$)', $key, $match)) { //! columns looking like functions
                return $match[1] . idf_escape(idf_unescape($match[2])) . $match[3]; //! SQL injection
@@ -369,16 +357,14 @@ function save_settings(array $settings, string $cookie = "adminer_settings"): vo
        cookie($cookie, http_build_query($settings + get_settings($cookie)));
 }
 
-/** Restart stopped session
-*/
+/** Restart stopped session */
 function restart_session(): void {
        if (!ini_bool("session.use_cookies") && (!function_exists('session_status') || session_status() == 1)) { // 1 - PHP_SESSION_NONE, session_status() available since PHP 5.4
                session_start();
        }
 }
 
-/** Stop session if possible
-*/
+/** Stop session if possible */
 function stop_session(bool $force = false): void {
        $use_cookies = ini_bool("session.use_cookies");
        if (!$use_cookies || $force) {
@@ -404,8 +390,7 @@ function set_session(string $key, $val) {
        $_SESSION[$key][DRIVER][SERVER][$_GET["username"]] = $val; // used also in auth.inc.php
 }
 
-/** Get authenticated URL
-*/
+/** Get authenticated URL */
 function auth_url(string $vendor, string $server, string $username, string $db = null): string {
        global $drivers;
        $uri = remove_from_uri(implode("|", array_keys($drivers))
@@ -425,8 +410,7 @@ function auth_url(string $vendor, string $server, string $username, string $db =
        ;
 }
 
-/** Find whether it is an AJAX request
-*/
+/** Find whether it is an AJAX request */
 function is_ajax(): bool {
        return ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest");
 }
@@ -448,8 +432,7 @@ function redirect(string $location, string $message = null): void {
        }
 }
 
-/** Execute query and redirect if successful
-*/
+/** Execute query and redirect if successful */
 function query_redirect(string $query, string $location, string $message, bool $redirect = true, bool $execute = true, bool $failed = false, string $time = ""): bool {
        global $connection, $error, $adminer;
        if ($execute) {
@@ -502,8 +485,7 @@ function apply_queries(string $query, array $tables, callable $escape = 'Adminer
        return true;
 }
 
-/** Redirect by remembered queries
-*/
+/** Redirect by remembered queries */
 function queries_redirect(string $location, string $message, bool $redirect): bool {
        $queries = implode("\n", Queries::$queries);
        $time = format_time(Queries::$start);
@@ -518,14 +500,12 @@ function format_time(float $start): string {
        return lang('%.3f s', max(0, microtime(true) - $start));
 }
 
-/** Get relative REQUEST_URI
-*/
+/** Get relative REQUEST_URI */
 function relative_uri(): string {
        return str_replace(":", "%3a", preg_replace('~^[^?]*/([^?]*)~', '\1', $_SERVER["REQUEST_URI"]));
 }
 
-/** Remove parameter from query string
-*/
+/** Remove parameter from query string */
 function remove_from_uri(string $param = ""): string {
        return substr(preg_replace("~(?<=[?&])($param" . (SID ? "" : "|" . session_name()) . ")=[^&]*&~", '', relative_uri() . "&"), 0, -1);
 }
@@ -569,22 +549,19 @@ function get_file(string $key, bool $decompress = false, string $delimiter = "")
        return $return;
 }
 
-/** Determine upload error
-*/
+/** Determine upload error */
 function upload_error(int $error): string {
        $max_size = ($error == UPLOAD_ERR_INI_SIZE ? ini_get("upload_max_filesize") : 0); // post_max_size is checked in index.php
        return ($error ? lang('Unable to upload a file.') . ($max_size ? " " . lang('Maximum allowed file size is %sB.', $max_size) : "") : lang('File does not exist.'));
 }
 
-/** Create repeat pattern for preg
-*/
+/** Create repeat pattern for preg */
 function repeat_pattern(string $pattern, int $length): string {
        // fix for Compilation failed: number too big in {} quantifier
        return str_repeat("$pattern{0,65535}", $length / 65535) . "$pattern{0," . ($length % 65535) . "}"; // can create {0,0} which is OK
 }
 
-/** Check whether the string is in UTF-8
-*/
+/** Check whether the string is in UTF-8 */
 function is_utf8(string $val): bool {
        // don't print control chars except \t\r\n
        return (preg_match('~~u', $val) && !preg_match('~[\0-\x8\xB\xC\xE-\x1F]~', $val));
@@ -607,8 +584,7 @@ function format_number($val): string {
        return strtr(number_format($val, 0, ".", lang(',')), preg_split('~~u', lang('0123456789'), -1, PREG_SPLIT_NO_EMPTY));
 }
 
-/** Generate friendly URL
-*/
+/** Generate friendly URL */
 function friendly_url(string $val): string {
        // used for blobs and export
        return preg_replace('~\W~i', '-', $val);
@@ -699,8 +675,7 @@ function apply_sql_function(string $function, string $column): string {
        return ($function ? ($function == "unixepoch" ? "DATETIME($column, '$function')" : ($function == "count distinct" ? "COUNT(DISTINCT " : strtoupper("$function(")) . "$column)") : $column);
 }
 
-/** Get path of the temporary directory
-*/
+/** Get path of the temporary directory */
 function get_temp_dir(): string {
        $return = ini_get("upload_tmp_dir"); // session_save_path() may contain other storage path
        if (!$return) {
@@ -737,8 +712,7 @@ function file_open_lock(string $filename) {
        return $fp;
 }
 
-/** Write and unlock a file
-*/
+/** Write and unlock a file */
 function file_write_unlock(resource $fp, string $data): void {
        rewind($fp);
        fwrite($fp, $data);
@@ -746,8 +720,7 @@ function file_write_unlock(resource $fp, string $data): void {
        file_unlock($fp);
 }
 
-/** Unlock and close a file
-*/
+/** Unlock and close a file */
 function file_unlock(resource $fp): void {
        flock($fp, LOCK_UN);
        fclose($fp);
@@ -832,8 +805,7 @@ function select_value($val, string $link, array $field, int $text_length): strin
        return $adminer->selectVal($return, $link, $field, $val);
 }
 
-/** Check whether the string is e-mail address
-*/
+/** Check whether the string is e-mail address */
 function is_mail(?string $email): bool {
        $atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]'; // characters of local-name
        $domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component
@@ -841,8 +813,7 @@ function is_mail(?string $email): bool {
        return is_string($email) && preg_match("(^$pattern(,\\s*$pattern)*\$)i", $email);
 }
 
-/** Check whether the string is URL address
-*/
+/** Check whether the string is URL address */
 function is_url(string $string): bool {
        $domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component //! IDN
        return preg_match("~^(https?)://($domain?\\.)+$domain(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string); //! restrict path, query and fragment characters
@@ -894,23 +865,19 @@ function slow_query(string $query): array {
        return $return;
 }
 
-/** Generate BREACH resistant CSRF token
-*/
+/** Generate BREACH resistant CSRF token */
 function get_token(): string {
        $rand = rand(1, 1e6);
        return ($rand ^ $_SESSION["token"]) . ":$rand";
 }
 
-/** Verify if supplied CSRF token is valid
-*/
+/** Verify if supplied CSRF token is valid */
 function verify_token(): bool {
        list($token, $rand) = explode(":", $_POST["token"]);
        return ($rand ^ $_SESSION["token"]) == $token;
 }
 
 // used in compiled version
-/**
-*/
 function lzw_decompress(string $binary): string {
        // convert binary string to codes
        $dictionary_count = 256;
index 9b7cb6428312152eaa7f63b17f991fc6dc9ddd0a..54225a0365bb939811d2087f08806cd293d048c6 100644 (file)
@@ -1,20 +1,17 @@
 <?php
 namespace Adminer;
 
-/** Return <script> element
-*/
+/** Return <script> element */
 function script(string $source, string $trailing = "\n"): string {
        return "<script" . nonce() . ">$source</script>$trailing";
 }
 
-/** Return <script src> element
-*/
+/** Return <script src> element */
 function script_src(string $url): string {
        return "<script src='" . h($url) . "'" . nonce() . "></script>\n";
 }
 
-/** Get a nonce="" attribute with CSP nonce
-*/
+/** Get a nonce="" attribute with CSP nonce */
 function nonce(): string {
        return ' nonce="' . get_nonce() . '"';
 }
@@ -36,20 +33,17 @@ function input_token(string $special = ""): string {
        return input_hidden("token", ($special ?: $token));
 }
 
-/** Get a target="_blank" attribute
-*/
+/** Get a target="_blank" attribute */
 function target_blank(): string {
        return ' target="_blank" rel="noreferrer noopener"';
 }
 
-/** Escape for HTML
-*/
+/** Escape for HTML */
 function h(string $string): string {
        return str_replace("\0", "&#0;", htmlspecialchars($string, ENT_QUOTES, 'utf-8'));
 }
 
-/** Convert \n to <br>
-*/
+/** Convert \n to <br> */
 function nl_br(string $string): string {
        return str_replace("\n", "<br>", $string); // nl2br() uses XHTML before PHP 5.3
 }
@@ -116,14 +110,12 @@ function html_radios(string $name, array $options, string $value = ""): string {
        return $return;
 }
 
-/** Get onclick confirmation
-*/
+/** Get onclick confirmation */
 function confirm(string $message = "", string $selector = "qsl('input')"): string {
        return script("$selector.onclick = () => confirm('" . ($message ? js_escape($message) : lang('Are you sure?')) . "');", "");
 }
 
-/** Print header for hidden fieldset (close by </div></fieldset>)
-*/
+/** Print header for hidden fieldset (close by </div></fieldset>) */
 function print_fieldset(string $id, string $legend, bool $visible = false): void {
        echo "<fieldset><legend>";
        echo "<a href='#fieldset-$id'>$legend</a>";
@@ -132,20 +124,17 @@ function print_fieldset(string $id, string $legend, bool $visible = false): void
        echo "<div id='fieldset-$id'" . ($visible ? "" : " class='hidden'") . ">\n";
 }
 
-/** Return class='active' if $bold is true
-*/
+/** Return class='active' if $bold is true */
 function bold(bool $bold, string $class = ""): string {
        return ($bold ? " class='active $class'" : ($class ? " class='$class'" : ""));
 }
 
-/** Escape string for JavaScript apostrophes
-*/
+/** Escape string for JavaScript apostrophes */
 function js_escape(string $string): string {
        return addcslashes($string, "\r\n'\\/"); // slash for <script>
 }
 
-/** Generate page number for pagination
-*/
+/** Generate page number for pagination */
 function pagination(int $page, int $current): string {
        return " " . ($page == $current
                ? $page + 1
@@ -172,8 +161,7 @@ function hidden_fields(array $process, array $ignore = array(), string $prefix =
        return $return;
 }
 
-/** Print hidden fields for GET forms
-*/
+/** Print hidden fields for GET forms */
 function hidden_fields_get(): void {
        echo (sid() ? input_hidden(session_name(), session_id()) : '');
        echo (SERVER !== null ? input_hidden(DRIVER, SERVER) : "");
@@ -478,8 +466,7 @@ function edit_form(string $table, array $fields, $row, bool $update): void {
        echo "</form>\n";
 }
 
-/** Get button with icon
-*/
+/** Get button with icon */
 function icon(string $icon, string $name, string $html, string $title): string {
        return "<button type='submit' name='$name' title='" . h($title) . "' class='icon icon-$icon'><span>$html</span></button>";
 }
index a57ee868670ca26ac983ba63a44dccaf83cc4c84..5ef1e9eedd0e5326a7ad66b61920bc1536ca7922 100644 (file)
@@ -51,8 +51,7 @@ $langs = array(
        'zh-tw' => '繁體中文', // http://tzangms.com
 );
 
-/** Get current language
-*/
+/** Get current language */
 function get_lang(): string {
        global $LANG;
        return $LANG;
index 9f432e111d35ca00bc31ac4adec464e42378e522..992e8dcb91c2d0177e44ee88349299e009c968e5 100644 (file)
@@ -9,8 +9,6 @@ class TmpFile {
                $this->handler = tmpfile();
        }
 
-       /**
-       */
        function write(string $contents): void {
                $this->size += strlen($contents);
                fwrite($this->handler, $contents);
index 562adad11aba132c3f2fe8c3c2d898986be64d25..ac7893f51694b81c4032d16b001855992fc6b987 100644 (file)
@@ -6,8 +6,6 @@ namespace Adminer;
 * @link http://www.coolcode.cn/?action=show&id=128
 */
 
-/**
-*/
 function int32(int $n): int {
        while ($n >= 2147483648) {
                $n -= 4294967296;
@@ -43,8 +41,6 @@ function str2long(string $s, bool $w): array {
        return $v;
 }
 
-/**
-*/
 function xxtea_mx(int $z, int $y, int $sum, int $k): int {
        return int32((($z >> 5 & 0x7FFFFFF) ^ $y << 2) + (($y >> 3 & 0x1FFFFFFF) ^ $z << 4)) ^ int32(($sum ^ $y) + ($k ^ $z));
 }
index 5c4b49de427c5fd19858d35124dfb6d21865f205..8ef2c944521feba8d06781968cb6d384473e9207 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 namespace Adminer;
 
-/** Encode e-mail header in UTF-8
-*/
+/** Encode e-mail header in UTF-8 */
 function email_header(string $header): string {
        // iconv_mime_encode requires iconv, imap_8bit requires IMAP extension
        return "=?UTF-8?B?" . base64_encode($header) . "?="; //! split long lines
index 31d8c680db2f95f3f7cbffac0f390ab42ecd75a6..347a4b9c824f6a4ac8a27005178fdab745490f9c 100644 (file)
@@ -65,8 +65,6 @@ if (isset($_GET["elastic"])) {
                                return $this->rootQuery($path, $content, $method);
                        }
 
-                       /**
-                        */
                        function connect(string $server, string $username, string $password): bool {
                                preg_match('~^(https?://)?(.*)~', $server, $match);
                                $this->url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
index 3ec1e3f3ccfe9df84592c11b32198efb1786670c..608516906ec3f1884234006e591741941b6059a1 100644 (file)
@@ -18,8 +18,7 @@ CREATE TABLE login (
 class AdminerLoginTable {
        protected $database;
 
-       /** Set database of login table
-       */
+       /** Set database of login table */
        function __construct(string $database) {
                $this->database = $database;
        }
index ebd3179190ca64345a62485def21b83dc601ae46..440ce7bac4244e72ee3270b65f0e07b1d0a4c2c4 100644 (file)
@@ -10,8 +10,6 @@
 class AdminerTinymce {
        protected $path;
 
-       /**
-       */
        function __construct(string $path = "tiny_mce/tiny_mce.js") {
                $this->path = $path;
        }