Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow specifying external links (bug #3392685)

  • Loading branch information...
commit f6e1c589f918f6f96700eb58b0734190efc3522c 1 parent 61dc40a
@vrana authored
View
8 adminer/include/adminer.inc.php
@@ -185,6 +185,14 @@ function rowDescriptions($rows, $foreignKeys) {
return $rows;
}
+ /** Get a link to use in select table
+ * @param string raw value of the field
+ * @param array single field returned from fields()
+ * @return string or null to create the default link
+ */
+ function selectLink($val, $field) {
+ }
+
/** Value printed in select table
* @param string HTML-escaped value to print
* @param string link to foreign key
View
6 adminer/select.inc.php
@@ -384,9 +384,9 @@
}
}
}
- if (!$link) {
- if (is_mail($val)) {
- $link = "mailto:$val";
+ if (!$link && ($link = $adminer->selectLink($row[$key], $field)) === null) {
+ if (is_mail($row[$key])) {
+ $link = "mailto:$row[$key]";
}
if ($protocol = is_url($row[$key])) {
$link = ($protocol == "http" && $HTTPS
View
1  changes.txt
@@ -1,5 +1,6 @@
Adminer 3.6.3-dev:
Display error code in SQL query
+Allow specifying external links
Treat Meta key same as Ctrl
Don't use type="number" for decimal numbers
View
3  editor/include/adminer.inc.php
@@ -162,6 +162,9 @@ function rowDescriptions($rows, $foreignKeys) {
return $return;
}
+ function selectLink($val, $field) {
+ }
+
function selectVal($val, $link, $field) {
$return = ($val === null ? " " : $val);
$link = h($link);
View
17 plugins/links-direct.php
@@ -0,0 +1,17 @@
+<?php
+
+/** Avoid redirecting of external links through adminer.org and disclose the URL of installed Adminer to visited links
+* @link http://www.adminer.org/plugins/#use
+* @author Jakub Vrana, http://www.vrana.cz/
+* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
+*/
+class AdminerLinksDirect {
+
+ function selectLink($val, $field) {
+ if (is_url($val)) {
+ return $val;
+ }
+ }
+
+}
View
5 plugins/plugin.php
@@ -191,6 +191,11 @@ function rowDescriptions() {
return $this->_applyPlugin(__FUNCTION__, $args);
}
+ function selectLink() {
+ $args = func_get_args();
+ return $this->_applyPlugin(__FUNCTION__, $args);
+ }
+
function selectVal() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
Please sign in to comment.
Something went wrong with that request. Please try again.