Link URLs in select

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1163 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-10-02 14:25:18 +00:00
parent 06984091d5
commit bc78866a8b
3 changed files with 14 additions and 1 deletions

View file

@ -501,6 +501,15 @@ function is_email($email) {
return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$", $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 </div></fieldset>) /** Print header for hidden fieldset (close by </div></fieldset>)
* @param string * @param string
* @param string * @param string

View file

@ -232,6 +232,9 @@ if (!$columns) {
if (!$link && is_email($val)) { if (!$link && is_email($val)) {
$link = "mailto:$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); $val = $adminer->selectVal($val, $link, $field);
echo "<td>$val"; echo "<td>$val";
} }

View file

@ -1,8 +1,9 @@
Adminer 2.1.1-dev: Adminer 2.1.1-dev:
Display table links above table structure Display table links above table structure
Link URLs in select
Display number of manipulated rows in JS confirm
Fix removed default in ALTER Fix removed default in ALTER
Display whitespace in texts (bug #2858042) Display whitespace in texts (bug #2858042)
Display number of manipulated rows in JS confirm
ClickJacking protection in modern browsers ClickJacking protection in modern browsers
E-mail attachments (Editor) E-mail attachments (Editor)
Optional year in date (Editor) Optional year in date (Editor)