1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 22:56:46 +02:00

Code style: avoid excesive mixing of PHP and HTML

This commit is contained in:
Jakub Vrana
2025-03-16 23:54:25 +01:00
parent dd47df9b9c
commit 22a3efe4ed
9 changed files with 81 additions and 103 deletions

View File

@@ -180,31 +180,26 @@ foreach ($engines as $engine) {
<form action="" method="post" id="form"> <form action="" method="post" id="form">
<p> <p>
<?php if (support("columns") || $TABLE == "") { ?> <?php
<?php echo lang('Table name'); ?>: <input name="name"<?php echo ($TABLE == "" && !$_POST ? " autofocus" : ""); ?> data-maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off"> if (support("columns") || $TABLE == "") {
<?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") : ""); ?> echo lang('Table name') . "<input name='name'" . ($TABLE == "" && !$_POST ? " autofocus" : "") . " data-maxlength='64' value='" . h($row["name"]) . "' autocapitalize='off'>\n";
<?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") . "\n" : "");
if ($collations) { if ($collations) {
echo "<datalist id='collations'>" . optionlist($collations) . "</datalist>"; echo "<datalist id='collations'>" . optionlist($collations) . "</datalist>";
echo (preg_match("~sqlite|mssql~", JUSH) ? "" : "<input list='collations' name='Collation' value='" . h($row["Collation"]) . "' placeholder='(" . lang('collation') . ")'>"); echo (preg_match("~sqlite|mssql~", JUSH) ? "" : "<input list='collations' name='Collation' value='" . h($row["Collation"]) . "' placeholder='(" . lang('collation') . ")'>");
} }
?> echo "<input type='submit' value='<?php echo lang('Save'); ?>'>\n";
<input type="submit" value="<?php echo lang('Save'); ?>"> }
<?php } ?>
<?php if (support("columns")) { ?> if (support("columns")) {
<div class="scrollable"> echo "<div class='scrollable'>\n";
<table id="edit-fields" class="nowrap"> echo "<table id='edit-fields' class='nowrap'>\n";
<?php
edit_fields($row["fields"], $collations, "TABLE", $foreign_keys); edit_fields($row["fields"], $collations, "TABLE", $foreign_keys);
?> echo "</table>\n";
</table> echo script("editFields();");
<?php echo script("editFields();"); ?> echo "</div>\n<p>\n";
</div> echo lang('Auto Increment') . "<input type='number' name='Auto_increment' class='size' value='" . h($row["Auto_increment"]) . "'>\n";
<p> echo checkbox("defaults", 1, ($_POST ? $_POST["defaults"] : get_setting("defaults")), lang('Default values'), "columnShow(this.checked, 5)", "jsonly");
<?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" class="size" value="<?php echo h($row["Auto_increment"]); ?>">
<?php echo checkbox("defaults", 1, ($_POST ? $_POST["defaults"] : get_setting("defaults")), lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
<?php
$comments = ($_POST ? $_POST["comments"] : get_setting("comments")); $comments = ($_POST ? $_POST["comments"] : get_setting("comments"));
echo (support("comment") echo (support("comment")
? checkbox("comments", 1, $comments, lang('Comment'), "editingCommentsClick(this, true);", "jsonly") ? checkbox("comments", 1, $comments, lang('Comment'), "editingCommentsClick(this, true);", "jsonly")
@@ -226,24 +221,18 @@ foreach ($engines as $engine) {
if (support("partitioning")) { if (support("partitioning")) {
$partition_table = preg_match('~RANGE|LIST~', $row["partition_by"]); $partition_table = preg_match('~RANGE|LIST~', $row["partition_by"]);
print_fieldset("partition", lang('Partition by'), $row["partition_by"]); print_fieldset("partition", lang('Partition by'), $row["partition_by"]);
?> echo "<p>" . html_select("partition_by", array("" => "") + $partition_by, $row["partition_by"]) . on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')", 1) . script("qsl('select').onchange = partitionByChange;");
<p> echo "(<input name='partition' value='" . h($row["partition"]) . "'>)\n";
<?php echo html_select("partition_by", array("" => "") + $partition_by, $row["partition_by"]) . on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')", 1) . script("qsl('select').onchange = partitionByChange;"); ?> echo lang('Partitions') . ": <input type='number' name='partitions' class='size" . ($partition_table || !$row["partition_by"] ? " hidden" : "") . "' value='" . h($row["partitions"]) . "'>\n";
(<input name="partition" value="<?php echo h($row["partition"]); ?>">) echo "<table id='partition-table'" . ($partition_table ? "" : " class='hidden'") . ">\n";
<?php echo lang('Partitions'); ?>: <input type="number" name="partitions" class="size<?php echo ($partition_table || !$row["partition_by"] ? " hidden" : ""); ?>" value="<?php echo h($row["partitions"]); ?>"> echo "<thead><tr><th>" . lang('Partition name') . "<th>" . lang('Values') . "</thead>\n";
<table id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
<thead><tr><th><?php echo lang('Partition name'); ?><th><?php echo lang('Values'); ?></thead>
<?php
foreach ($row["partition_names"] as $key => $val) { foreach ($row["partition_names"] as $key => $val) {
echo '<tr>'; echo '<tr>';
echo '<td><input name="partition_names[]" value="' . h($val) . '" autocapitalize="off">'; echo '<td><input name="partition_names[]" value="' . h($val) . '" autocapitalize="off">';
echo ($key == count($row["partition_names"]) - 1 ? script("qsl('input').oninput = partitionNameChange;") : ''); echo ($key == count($row["partition_names"]) - 1 ? script("qsl('input').oninput = partitionNameChange;") : '');
echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">'; echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
} }
?> echo "</table>\n</div></fieldset>\n";
</table>
</div></fieldset>
<?php
} }
?> ?>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">

View File

@@ -66,21 +66,16 @@ fQIDAQAB
$_COOKIE["adminer_version"] = $version["version"]; // doesn't need to send to the browser $_COOKIE["adminer_version"] = $version["version"]; // doesn't need to send to the browser
} }
} }
?> echo script("mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick"
<script<?php echo nonce(); ?>> . (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION', '" . js_escape(ME) . "', '" . get_token() . "')") // $token may be empty in auth.inc.php
mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick<?php . "});
echo (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION', '" . js_escape(ME) . "', '" . get_token() . "')"); // $token may be empty in auth.inc.php
?>});
document.body.className = document.body.className.replace(/ nojs/, ' js'); document.body.className = document.body.className.replace(/ nojs/, ' js');
var offlineMessage = '<?php echo js_escape(lang('You are offline.')); ?>'; var offlineMessage = '" . js_escape(lang('You are offline.')) . "';
var thousandsSeparator = '<?php echo js_escape(lang(',')); ?>'; var thousandsSeparator = '" . js_escape(lang(',')) . "';")
</script> ;
echo "<div id='help' class='jush-" . JUSH . " jsonly hidden'></div>\n";
<div id="help" class="jush-<?php echo JUSH; ?> jsonly hidden"></div> echo script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});");
<?php echo script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"); ?> echo "<div id='content'>\n";
<div id="content">
<?php
if ($breadcrumb !== null) { if ($breadcrumb !== null) {
$link = substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1); $link = substr(preg_replace('~\b(username|db|ns)=[^&]*&~', '', ME), 0, -1);
echo '<p id="breadcrumb"><a href="' . h($link ?: ".") . '">' . $drivers[DRIVER] . '</a> » '; echo '<p id="breadcrumb"><a href="' . h($link ?: ".") . '">' . $drivers[DRIVER] . '</a> » ';

View File

@@ -185,7 +185,7 @@ function json_row($key, $val = null) {
function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_types = array()) { function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_types = array()) {
global $driver; global $driver;
$type = $field["type"]; $type = $field["type"];
?><td><select name="<?php echo h($key); ?>[type]" class="type" aria-labelledby="label-type"><?php echo "<td><select name='" . h($key) . "[type]' class='type' aria-labelledby='label-type'>";
if ($type && !array_key_exists($type, $driver->types()) && !isset($foreign_keys[$type]) && !in_array($type, $extra_types)) { if ($type && !array_key_exists($type, $driver->types()) && !isset($foreign_keys[$type]) && !in_array($type, $extra_types)) {
$extra_types[] = $type; $extra_types[] = $type;
} }
@@ -194,12 +194,11 @@ function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_ty
$structured_types[lang('Foreign keys')] = $foreign_keys; $structured_types[lang('Foreign keys')] = $foreign_keys;
} }
echo optionlist(array_merge($extra_types, $structured_types), $type); echo optionlist(array_merge($extra_types, $structured_types), $type);
?></select><td><input echo "</select><td>";
name="<?php echo h($key); ?>[length]" echo "<input name='" . h($key) . "[length]' value='" . h($field["length"]) . "' size='3'"
value="<?php echo h($field["length"]); ?>" . (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : "") //! type="number" with enabled JavaScript
size="3" . " aria-labelledby='label-length'>";
<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); //! type="number" with enabled JavaScript ?> echo "<td class='options'>";
aria-labelledby="label-length"><td class="options"><?php
echo ($collations echo ($collations
? "<input list='collations' name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . " value='" . h($field["collation"]) . "' placeholder='(" . lang('collation') . ")'>" ? "<input list='collations' name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . " value='" . h($field["collation"]) . "' placeholder='(" . lang('collation') . ")'>"
: '' : ''
@@ -333,46 +332,43 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
<th id="label-name"><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?> <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-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 id="label-length"><?php echo lang('Length'); ?>
<td><?php echo lang('Options'); /* no label required, options have their own label */ ?> <td><?php
<?php if ($type == "TABLE") { ?> echo lang('Options'); // no label required, options have their own label
<td id="label-null">NULL if ($type == "TABLE") {
<td><input type="radio" name="auto_increment_col" value=""><abbr id="label-ai" title="<?php echo lang('Auto Increment'); ?>">AI</abbr><?php echo doc_link(array( 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>";
echo doc_link(array(
'sql' => "example-auto-increment.html", 'sql' => "example-auto-increment.html",
'mariadb' => "auto_increment/", 'mariadb' => "auto_increment/",
'sqlite' => "autoinc.html", 'sqlite' => "autoinc.html",
'pgsql' => "datatype-numeric.html#DATATYPE-SERIAL", 'pgsql' => "datatype-numeric.html#DATATYPE-SERIAL",
'mssql' => "t-sql/statements/create-table-transact-sql-identity-property", 'mssql' => "t-sql/statements/create-table-transact-sql-identity-property",
)); ?> ));
<td id="label-default"<?php echo $default_class; ?>><?php echo lang('Default value'); ?> echo "<td id='label-default'$default_class>" . lang('Default value');
<?php echo (support("comment") ? "<td id='label-comment'$comment_class>" . lang('Comment') : ""); ?> echo (support("comment") ? "<td id='label-comment'$comment_class>" . lang('Comment') : "");
<?php } ?> }
<td><?php echo "<input type='image' class='icon' name='add[" . (support("move_col") ? 0 : count($fields)) . "]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>" . script("row_count = " . count($fields) . ";"); ?> echo "<td><input type='image' class='icon' name='add[" . (support("move_col") ? 0 : count($fields)) . "]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>" . script("row_count = " . count($fields) . ";");
</thead> echo "</thead>\n<tbody>\n";
<tbody>
<?php
echo script("mixin(qsl('tbody'), {onclick: editingClick, onkeydown: editingKeydown, oninput: editingInput});"); echo script("mixin(qsl('tbody'), {onclick: editingClick, onkeydown: editingKeydown, oninput: editingInput});");
foreach ($fields as $i => $field) { foreach ($fields as $i => $field) {
$i++; $i++;
$orig = $field[($_POST ? "orig" : "field")]; $orig = $field[($_POST ? "orig" : "field")];
$display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i])) && (support("drop_col") || $orig == ""); $display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i])) && (support("drop_col") || $orig == "");
?> echo "<tr" . ($display ? "" : " style='display: none;'") . ">\n";
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>> echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $driver->inout), $field["inout"]) : "") . "<th>";
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $driver->inout), $field["inout"]) : "") . "<th>"; ?> if ($display) {
<?php if ($display) { ?> echo "<input name='fields[$][field]' value='" . h($field["field"]) . "' data-maxlength='64' autocapitalize='off' aria-labelledby='label-name'>\n";
<input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name"> }
<?php } ?> echo "<input type='hidden' name='fields[$i][orig]' value='" . h($orig) . "'>";
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>"><?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?> edit_type("fields[$i]", $field, $collations, $foreign_keys);
<?php
if ($type == "TABLE") { if ($type == "TABLE") {
?> echo "<td>" . checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null");
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?> echo "<td><label class='block'><input type='radio' name='auto_increment_col' value='$i'" . ($field["auto_increment"] ? " checked" : "") . " aria-labelledby='label-ai'></label>";
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php echo ($field["auto_increment"] ? " checked" : ""); ?> aria-labelledby="label-ai"></label><td<?php echo $default_class; ?>><?php echo "<td$default_class>" . ($driver->generated
echo ($driver->generated
? html_select("fields[$i][generated]", array_merge(array("", "DEFAULT"), $driver->generated), $field["generated"]) . " " ? html_select("fields[$i][generated]", array_merge(array("", "DEFAULT"), $driver->generated), $field["generated"]) . " "
: checkbox("fields[$i][generated]", 1, $field["generated"], "", "", "", "label-default") : checkbox("fields[$i][generated]", 1, $field["generated"], "", "", "", "label-default")
); );
?> echo "<input name='fields[$i][default]' value='" . h($field["default"]) . "' aria-labelledby='label-default'>";
<input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php
echo (support("comment") ? "<td$comment_class><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : ""); echo (support("comment") ? "<td$comment_class><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
} }
echo "<td>"; echo "<td>";

View File

@@ -299,8 +299,7 @@ function where($where, $fields = array()) {
. (JUSH == "sql" && $field_type == "json" ? " = CAST(" . q($val) . " AS JSON)" . (JUSH == "sql" && $field_type == "json" ? " = CAST(" . q($val) . " AS JSON)"
: (JUSH == "sql" && is_numeric($val) && preg_match('~\.~', $val) ? " LIKE " . q($val) // LIKE because of floats but slow with ints : (JUSH == "sql" && is_numeric($val) && preg_match('~\.~', $val) ? " LIKE " . q($val) // LIKE because of floats but slow with ints
: (JUSH == "mssql" && strpos($field_type, "datetime") === false ? " LIKE " . q(preg_replace('~[_%[]~', '[\0]', $val)) // LIKE because of text but it does not work with datetime : (JUSH == "mssql" && strpos($field_type, "datetime") === false ? " LIKE " . q(preg_replace('~[_%[]~', '[\0]', $val)) // LIKE because of text but it does not work with datetime
: " = " . unconvert_field($fields[$key], q($val)) : " = " . unconvert_field($fields[$key], q($val)))))
)))
; //! enum and set ; //! enum and set
if (JUSH == "sql" && preg_match('~char|text~', $field_type) && preg_match("~[^ -@]~", $val)) { // not just [a-z] to catch non-ASCII characters if (JUSH == "sql" && preg_match('~char|text~', $field_type) && preg_match("~[^ -@]~", $val)) { // not just [a-z] to catch non-ASCII characters
$return[] = "$column = " . q($val) . " COLLATE " . charset($connection) . "_bin"; $return[] = "$column = " . q($val) . " COLLATE " . charset($connection) . "_bin";
@@ -961,14 +960,7 @@ function slow_query($query) {
$connection2 = null; $connection2 = null;
if (!$slow_query && support("kill") && is_object($connection2 = connect($adminer->credentials())) && ($db == "" || $connection2->select_db($db))) { if (!$slow_query && support("kill") && is_object($connection2 = connect($adminer->credentials())) && ($db == "" || $connection2->select_db($db))) {
$kill = $connection2->result(connection_id()); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL $kill = $connection2->result(connection_id()); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL
?> echo script("var timeout = setTimeout(function () { ajax('" . js_escape(ME) . "script=kill', function () {}, 'kill=$kill&token=$token'); }, 1000 * $timeout);");
<script<?php echo nonce(); ?>>
var timeout = setTimeout(function () {
ajax('<?php echo js_escape(ME); ?>script=kill', function () {
}, 'kill=<?php echo $kill; ?>&token=<?php echo $token; ?>');
}, <?php echo 1000 * $timeout; ?>);
</script>
<?php
} }
ob_flush(); ob_flush();
flush(); flush();

View File

@@ -427,9 +427,7 @@ function edit_form($table, $fields, $row, $update) {
echo "<p class='error'>" . lang('No rows.') . "\n"; echo "<p class='error'>" . lang('No rows.') . "\n";
return; return;
} }
?> echo "<form action='' method='post' enctype='multipart/form-data' id='form'>\n";
<form action="" method="post" enctype="multipart/form-data" id="form">
<?php
if (!$fields) { if (!$fields) {
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n"; echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
} else { } else {

View File

@@ -77,8 +77,8 @@ function lang($idf, $number = null) {
: ($LANG == 'lt' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1, 12-19, other : ($LANG == 'lt' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1, 12-19, other
: ($LANG == 'lv' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number ? 1 : 2)) // different forms for 1 except 11, other, 0 : ($LANG == 'lv' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number ? 1 : 2)) // different forms for 1 except 11, other, 0
: (in_array($LANG, array('bs', 'ru', 'sr', 'uk')) ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1 except 11, 2-4 except 12-14, other : (in_array($LANG, array('bs', 'ru', 'sr', 'uk')) ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1 except 11, 2-4 except 12-14, other
: 1 // different forms for 1, other : 1)))))))) // different forms for 1, other
)))))))); // http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html ; // http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
$translation = $translation[$pos]; $translation = $translation[$pos];
} }
$args = func_get_args(); $args = func_get_args();

View File

@@ -90,8 +90,8 @@ if (!$error && $_POST) {
$pattern = ($found == '/*' ? '\*/' $pattern = ($found == '/*' ? '\*/'
: ($found == '[' ? ']' : ($found == '[' ? ']'
: (preg_match('~^-- |^#~', $found) ? "\n" : (preg_match('~^-- |^#~', $found) ? "\n"
: preg_quote($found) . ($c_style_escapes ? "|\\\\." : "") : preg_quote($found) . ($c_style_escapes ? "|\\\\." : "")))
))); );
while (preg_match("($pattern|\$)s", $query, $match, PREG_OFFSET_CAPTURE, $offset)) { while (preg_match("($pattern|\$)s", $query, $match, PREG_OFFSET_CAPTURE, $offset)) {
$s = $match[0][0]; $s = $match[0][0];

View File

@@ -32,11 +32,19 @@
<exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/> <exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/>
<exclude name="Squiz.Scope.MethodScope.Missing"/> <exclude name="Squiz.Scope.MethodScope.Missing"/>
<!-- TODO: Ignore only in <?php if () { ?><?php } ?> --> <!-- False positives. -->
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/> <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/> <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/>
</rule> </rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="ignoreIndentationTokens" type="array">
<element value="T_OPEN_TAG"/>
</property>
</properties>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"> <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>adminer/drivers/</exclude-pattern> <exclude-pattern>adminer/drivers/</exclude-pattern>
<exclude-pattern>adminer/include/pdo.inc.php</exclude-pattern> <exclude-pattern>adminer/include/pdo.inc.php</exclude-pattern>

View File

@@ -73,8 +73,8 @@ if (isset($_GET["mongo"])) {
(is_a($val, 'MongoDB\BSON\Binary') ? $val->getData() : //! allow downloading (is_a($val, 'MongoDB\BSON\Binary') ? $val->getData() : //! allow downloading
(is_a($val, 'MongoDB\BSON\Regex') ? "$val" : (is_a($val, 'MongoDB\BSON\Regex') ? "$val" :
(is_object($val) || is_array($val) ? json_encode($val, 256) : // 256 = JSON_UNESCAPED_UNICODE (is_object($val) || is_array($val) ? json_encode($val, 256) : // 256 = JSON_UNESCAPED_UNICODE
$val // MongoMinKey, MongoMaxKey $val))))) // MongoMinKey, MongoMaxKey
))))); ;
} }
$this->rows[] = $row; $this->rows[] = $row;
foreach ($row as $key => $val) { foreach ($row as $key => $val) {