From bc78866a8bd85840b289e42d3005007788ad38d6 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Fri, 2 Oct 2009 14:25:18 +0000 Subject: [PATCH] Link URLs in select git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1163 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/include/functions.inc.php | 9 +++++++++ adminer/select.inc.php | 3 +++ changes.txt | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index cf313325..53bc9e9f 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -501,6 +501,15 @@ function is_email($email) { return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$", $email); } +/** Check whether the string is URL address +* @param string +* @return bool +*/ +function is_url($string) { + $domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component + return preg_match("~^https?://($domain?\\.)+$domain(:[0-9]+)?(/.*)?(\\?.*)?(#.*)?\$~i", $string); //! restrict path, query and fragment characters +} + /** Print header for hidden fieldset (close by ) * @param string * @param string diff --git a/adminer/select.inc.php b/adminer/select.inc.php index ceca596c..d78ac68e 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -232,6 +232,9 @@ if (!$columns) { if (!$link && is_email($val)) { $link = "mailto:$val"; } + if (!$link && is_url($val)) { + $link = "http://www.adminer.org/redirect/?url=" . urlencode($val); // intermediate page to hide Referer + } $val = $adminer->selectVal($val, $link, $field); echo "$val"; } diff --git a/changes.txt b/changes.txt index 4eef390b..d351bc9e 100644 --- a/changes.txt +++ b/changes.txt @@ -1,8 +1,9 @@ Adminer 2.1.1-dev: Display table links above table structure +Link URLs in select +Display number of manipulated rows in JS confirm Fix removed default in ALTER Display whitespace in texts (bug #2858042) -Display number of manipulated rows in JS confirm ClickJacking protection in modern browsers E-mail attachments (Editor) Optional year in date (Editor)