The branch, master has been updated via ffe203b09952de76eef527dec4a4c354bf90302e (commit) from 765d823bbda19c506567144446e1727990ac78d0 (commit)
- Log ----------------------------------------------------------------- commit ffe203b09952de76eef527dec4a4c354bf90302e Author: Michal Čihař mcihar@suse.cz Date: Mon Jul 25 14:38:05 2011 +0200
Simplify definition of new valid links
-----------------------------------------------------------------------
Summary of changes: libraries/sanitizing.lib.php | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/libraries/sanitizing.lib.php b/libraries/sanitizing.lib.php index 028149c..2c3e28c 100644 --- a/libraries/sanitizing.lib.php +++ b/libraries/sanitizing.lib.php @@ -15,14 +15,19 @@ */ function PMA_checkLink($url) { - if (substr($url, 0, 7) == 'http://') { - return true; - } elseif (substr($url, 0, 8) == 'https://') { - return true; - } elseif (!defined('PMA_SETUP') && substr($url, 0, 20) == './Documentation.html') { - return true; - } elseif (defined('PMA_SETUP') && substr($url, 0, 21) == '../Documentation.html') { - return true; + $valid_starts = array( + 'http://', + 'https://', + ); + if (defined('PMA_SETUP')) { + $valid_starts[] = '../Documentation.html'; + } else { + $valid_starts[] = './Documentation.html'; + } + foreach($valid_starts as $val) { + if (substr($url, 0, strlen($val)) == $val) { + return true; + } } return false; }
hooks/post-receive