]> git.joonet.de Git - adminer.git/commitdiff
CSS: Add logo
authorJakub Vrana <jakub@vrana.cz>
Fri, 4 Apr 2025 05:39:08 +0000 (07:39 +0200)
committerJakub Vrana <jakub@vrana.cz>
Fri, 4 Apr 2025 05:59:17 +0000 (07:59 +0200)
CHANGELOG.md
adminer/file.inc.php
adminer/include/adminer.inc.php
adminer/include/design.inc.php
adminer/static/default.css
adminer/static/logo.png [new file with mode: 0644]
compile.php
editor/include/adminer.inc.php

index 3ef269e574624a9379dfa0fa5be9a392b0179098..fdd63adc6293c0c177e69139c8c536bf70481ef9 100644 (file)
@@ -4,6 +4,7 @@
 - PostgreSQL: Support COPY FROM stdin in SQL query (bug #942)
 - MySQL: Display number of found rows in group queries (regression from 5.1.1)
 - non-MySQL: Parse '--' without trailing space as comment in SQL command (bug SF-842)
+- CSS: Add logo
 - New plugin: Set up driver, server and database in Adminer Editor
 
 ## Adminer 5.1.1 (released 2025-04-02)
index 01b917c5ac68f64922402bbcf20f7a10c5df1593..f81f25cbda7f5e9a27c18a6c7cb84e116fc68a82 100644 (file)
@@ -35,5 +35,8 @@ if ($_GET["file"] == "favicon.ico") {
 ../externals/jush/modules/jush-mssql.js;
 ../externals/jush/modules/jush-oracle.js;
 ../externals/jush/modules/jush-simpledb.js', 'minify_js'));
+} elseif ($_GET["file"] == "logo.png") {
+       header("Content-Type: image/png");
+       echo compile_file('../adminer/static/logo.png');
 }
 exit;
index a80c7c3f81bb1a6ba48ed94e23580dbcb9da6828..86bb8f09157eee60f438c2c5c95e3bb258c66b87 100644 (file)
@@ -933,7 +933,7 @@ class Adminer {
        * @param string $missing can be "auth" if there is no database connection, "db" if there is no database selected, "ns" with invalid schema
        */
        function navigation(string $missing): void {
-               echo "<h1>" . adminer()->name() . " <span class='version'>" . VERSION;
+               echo "<h1><span id='logo'></span>" . adminer()->name() . " <span class='version'>" . VERSION;
                $new_version = $_COOKIE["adminer_version"];
                echo " <a href='https://www.adminer.org/#download'" . target_blank() . " id='version'>" . (version_compare(VERSION, $new_version) < 0 ? h($new_version) : "") . "</a>";
                echo "</span></h1>\n";
index a9fca3eaea97223e6228a1584841382246a1efab..4b04bc6316ad4e5a0ca0162443e7ae036415e915 100644 (file)
@@ -52,7 +52,7 @@ function page_header(string $title, string $error = "", $breadcrumb = array(), s
        echo script_src("static/editing.js");
        if (adminer()->head($dark)) {
                echo "<link rel='shortcut icon' type='image/x-icon' href='../adminer/static/favicon.ico'>\n";
-               echo "<link rel='apple-touch-icon' href='../adminer/static/favicon.ico'>\n";
+               echo "<link rel='apple-touch-icon' href='../adminer/static/logo.png'>\n";
        }
        foreach ($css as $val) {
                echo "<link rel='stylesheet'" . (preg_match('~-dark~', $val) && !$dark ? $media : "") . " href='" . h($val) . "'>\n";
index 62906f307e6c3c4406991e52811416adb0617bec..fb407c5ed494768392829cb7d6626ba58e4c55b7 100644 (file)
@@ -88,6 +88,7 @@ input.wayoff { left: -1000px; position: absolute; }
 #lang { position: absolute; top: -2.6em; left: 0; padding: .3em 1em; }
 #menuopen { display: none; }
 #breadcrumb { white-space: nowrap; position: absolute; top: 0; left: 21em; background: #eee; height: 2em; line-height: 1.8em; padding: 0 1em; margin: 0 0 0 -18px; }
+#logo { width: 24px; height: 24px; background-size: cover; display: inline-block; background-image: url(logo.png); margin-bottom: -3px; }
 #h1 { color: #777; text-decoration: none; font-style: italic; }
 #version { color: red; }
 #schema { margin-left: 60px; position: relative; user-select: none; -webkit-user-select: none; }
diff --git a/adminer/static/logo.png b/adminer/static/logo.png
new file mode 100644 (file)
index 0000000..fe35892
Binary files /dev/null and b/adminer/static/logo.png differ
index 53c2ac380ad043c79ac15cada724782acff2c140..c1afeeb0d502a0f91d731582872d4224fd044fb6 100755 (executable)
@@ -202,8 +202,11 @@ function get_translations($lang) {
 function minify_css($file) {
        global $project;
        if ($project == "editor") {
-               $file = preg_replace('~.*\.url\(.*~', '', $file);
+               $file = preg_replace('~.*url\(data:image/gif.*~', '', $file);
        }
+       $file = preg_replace_callback('~url\((\w+\.(gif|png|jpg))\)~', function ($match) {
+               return "url(data:image/$match[2];base64," . base64_encode(file_get_contents(__DIR__ . "/adminer/static/$match[1]")) . ")"; // we don't have ME in *.css; logo.png is still used for apple-touch-icon
+       }, $file);
        return lzw_compress(preg_replace('~\s*([:;{},])\s*~', '\1', preg_replace('~/\*.*?\*/\s*~s', '', $file)));
 }
 
index de9b4c99fd7004c929ab3fdd4c69ff6cc4726424..65ed681e2ba3f7a826440349e6a92e0512bc926f 100644 (file)
@@ -590,7 +590,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
        }
 
        function navigation($missing) {
-               echo "<h1>" . adminer()->name() . " <span class='version'>" . VERSION;
+               echo "<h1><span id='logo'></span>" . adminer()->name() . " <span class='version'>" . VERSION;
                $new_version = $_COOKIE["adminer_version"];
                echo " <a href='https://www.adminer.org/editor/#download'" . target_blank() . " id='version'>" . (version_compare(VERSION, $new_version) < 0 ? h($new_version) : "") . "</a>";
                echo "</span></h1>\n";