]> git.joonet.de Git - adminer.git/commitdiff
Avoid excessive PHP and HTML mixing
authorJakub Vrana <jakub@vrana.cz>
Tue, 18 Mar 2025 15:45:15 +0000 (16:45 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 18 Mar 2025 15:45:15 +0000 (16:45 +0100)
adminer/include/adminer.inc.php
adminer/include/design.inc.php
adminer/include/editing.inc.php
adminer/include/html.inc.php
editor/include/adminer.inc.php

index a0e41ea31e94e5fc47c46a596b40d2cc1c6447b9..778b1fa41ed82624726f6657facb8bced21672ea 100644 (file)
@@ -986,15 +986,10 @@ class Adminer {
        */
        function navigation($missing) {
                global $VERSION, $drivers, $connection;
-               ?>
-<h1>
-<?php echo $this->name(); ?>
-<span class="version">
-<?php echo $VERSION; ?>
- <a href="https://www.adminer.org/#download"<?php echo target_blank(); ?> id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
-</span>
-</h1>
-<?php
+               echo "<h1>" . $this->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";
                // this is matched by compile.php
                switch_lang();
                if ($missing == "auth") {
@@ -1084,10 +1079,7 @@ class Adminer {
                if (DB && $databases && !in_array(DB, $databases)) {
                        array_unshift($databases, DB);
                }
-               ?>
-<form action="">
-<p id="dbs">
-<?php
+               echo "<form action=''>\n<p id='dbs'>\n";
                hidden_fields_get();
                $db_events = script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});");
                echo "<span title='" . lang('Database') . "'>" . lang('DB') . ":</span> " . ($databases
index 1d90e3089b2b44cdca2a3ac973931a1f819eca57..a96581b414385eb3bcf7f5fb351f0e198d5c22d2 100644 (file)
@@ -183,14 +183,11 @@ function page_messages($error) {
 */
 function page_footer($missing = "") {
        global $adminer;
-       ?>
-</div>
-
-<div id="menu">
-<?php $adminer->navigation($missing); ?>
-</div>
-
-<?php if ($missing != "auth") { ?>
+       echo "</div>\n\n<div id='menu'>\n";
+       $adminer->navigation($missing);
+       echo "</div>\n\n";
+       if ($missing != "auth") {
+               ?>
 <form action="" method="post">
 <p class="logout">
 <span><?php echo h($_GET["username"]) . "\n"; ?></span>
@@ -198,7 +195,7 @@ function page_footer($missing = "") {
 <?php echo input_token(); ?>
 </p>
 </form>
-<?php } ?>
 <?php
+       }
        echo script("setupSubmitHighlight(document);");
 }
index 342ead48fb2a1f89ad82e9439f9b01212dfc5700..ca3c49cc4e898b4a6e779e57c9016394a1cd954e 100644 (file)
@@ -326,14 +326,12 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
        $fields = array_values($fields);
        $default_class = (($_POST ? $_POST["defaults"] : get_setting("defaults")) ? "" : " class='hidden'");
        $comment_class = (($_POST ? $_POST["comments"] : get_setting("comments")) ? "" : " class='hidden'");
-       ?>
-<thead><tr>
-<?php echo ($type == "PROCEDURE" ? "<td>" : ""); ?>
-<th id="label-name"><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
-<td id="label-type"><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;"></textarea><?php echo script("qs('#enum-edit').onblur = editingLengthBlur;"); ?>
-<td id="label-length"><?php echo lang('Length'); ?>
-<td><?php
-       echo lang('Options'); // no label required, options have their own label
+       echo "<thead><tr>\n";
+       echo ($type == "PROCEDURE" ? "<td>" : "");
+       echo "<th id='label-name'>" . ($type == "TABLE" ? lang('Column name') : lang('Parameter name'));
+       echo "<td id='label-type'>" . lang('Type') . "<textarea id='enum-edit' rows='4' cols='12' wrap='off' style='display: none;'></textarea>" . script("qs('#enum-edit').onblur = editingLengthBlur;");
+       echo "<td id='label-length'>" . lang('Length');
+       echo "<td>" . lang('Options'); // no label required, options have their own label
        if ($type == "TABLE") {
                echo "<td id='label-null'>NULL\n";
                echo "<td><input type='radio' name='auto_increment_col' value=''><abbr id='label-ai' title='" . lang('Auto Increment') . "'>AI</abbr>";
index ca728e441446a9dbfd546feb7f14f517d0daf563..14b10e584399cd0f5c12815a8fd2be1258364507 100644 (file)
@@ -520,10 +520,8 @@ function edit_form($table, $fields, $row, $update) {
        if (isset($_GET["select"])) {
                hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));
        }
-       ?>
-<input type="hidden" name="referer" value="<?php echo h(isset($_POST["referer"]) ? $_POST["referer"] : $_SERVER["HTTP_REFERER"]); ?>">
-<input type="hidden" name="save" value="1">
-<?php echo input_token(); ?>
-</form>
-<?php
+       echo "<input type='hidden' name='referer' value='" . h(isset($_POST["referer"]) ? $_POST["referer"] : $_SERVER["HTTP_REFERER"]) . "'>\n";
+       echo "<input type='hidden' name='save' value='1'>\n";
+       echo input_token();
+       echo "</form>\n";
 }
index bab09e501b4a9dfa36fdba3276153f9debd8ce00..17fbbca0b972f2f5a99d6c76cece73c83c81cf61 100644 (file)
@@ -590,15 +590,10 @@ qsl('div').onclick = whisperClick;", "")
 
        function navigation($missing) {
                global $VERSION;
-               ?>
-<h1>
-<?php echo $this->name(); ?>
-<span class="version">
-<?php echo $VERSION; ?>
- <a href="https://www.adminer.org/editor/#download"<?php echo target_blank(); ?> id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
-</span>
-</h1>
-<?php
+               echo "<h1>" . $this->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";
                switch_lang();
                if ($missing == "auth") {
                        $first = true;