Allow specifying external links (bug #3392685)
This commit is contained in:
parent
61dc40a512
commit
f6e1c589f9
|
@ -185,6 +185,14 @@ username.form['auth[driver]'].onchange();
|
|||
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
|
||||
|
|
|
@ -384,9 +384,9 @@ if (!$columns) {
|
|||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -162,6 +162,9 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
|||
return $return;
|
||||
}
|
||||
|
||||
function selectLink($val, $field) {
|
||||
}
|
||||
|
||||
function selectVal($val, $link, $field) {
|
||||
$return = ($val === null ? " " : $val);
|
||||
$link = h($link);
|
||||
|
|
17
plugins/links-direct.php
Normal file
17
plugins/links-direct.php
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -191,6 +191,11 @@ class AdminerPlugin extends Adminer {
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue