diff --git a/libraries/sanitizing.lib.php b/libraries/sanitizing.lib.php index cbac64d3c4..241af1cf1d 100644 --- a/libraries/sanitizing.lib.php +++ b/libraries/sanitizing.lib.php @@ -17,6 +17,8 @@ function PMA_checkLink($url) $valid_starts = array( 'http://', 'https://', + 'http%3A%2F%2F', + 'https%3A%2F%2F', ); if (defined('PMA_SETUP')) { $valid_starts[] = '../Documentation.html'; @@ -56,7 +58,7 @@ function PMA_replaceBBLink($found) } /* Construct url */ - if (substr($found[1], 0, 4) == 'http') { + if (preg_match('/^https?:\/\//', $found[1])) { $url = PMA_linkURL($found[1]); } else { $url = $found[1]; diff --git a/test/libraries/common/PMA_showPHPDocu_test.php b/test/libraries/common/PMA_showPHPDocu_test.php index 0cd576f173..15f8b11c69 100644 --- a/test/libraries/common/PMA_showPHPDocu_test.php +++ b/test/libraries/common/PMA_showPHPDocu_test.php @@ -11,6 +11,8 @@ /* * Include to test. */ +require_once 'libraries/config.default.php'; +require_once 'libraries/core.lib.php'; require_once 'libraries/common.lib.php'; require_once 'libraries/Theme.class.php'; @@ -27,7 +29,7 @@ class PMA_showPHPDocu_test extends PHPUnit_Framework_TestCase $target = "docu"; $lang = _pgettext('PHP documentation language', 'en'); - $expected = '' . __('Documentation') . ''; @@ -40,7 +42,7 @@ class PMA_showPHPDocu_test extends PHPUnit_Framework_TestCase $target = "docu"; $lang = _pgettext('PHP documentation language', 'en'); - $expected = '[' . __('Documentation') . ']'; $this->assertEquals($expected, PMA_showPHPDocu($target)); diff --git a/test/libraries/core/PMA_getLinks_test.php b/test/libraries/core/PMA_getLinks_test.php index 5d96725076..2208bc63e2 100644 --- a/test/libraries/core/PMA_getLinks_test.php +++ b/test/libraries/core/PMA_getLinks_test.php @@ -26,7 +26,11 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase public function testPMA_getPHPDocLink() { $lang = _pgettext('PHP documentation language', 'en'); - $this->assertEquals(PMA_getPHPDocLink('function'), 'http://php.net/manual/' . $lang . '/function'); + $this->assertEquals( + PMA_getPHPDocLink('function'), + './url.php?url=http%3A%2F%2Fphp.net%2Fmanual%2F' + . $lang . '%2Ffunction&server=99&lang=en&token=token' + ); } public function providerLinkURL(){ diff --git a/test/libraries/core/PMA_warnMissingExtension_test.php b/test/libraries/core/PMA_warnMissingExtension_test.php index 24128e1fcd..522453dbc0 100644 --- a/test/libraries/core/PMA_warnMissingExtension_test.php +++ b/test/libraries/core/PMA_warnMissingExtension_test.php @@ -24,7 +24,7 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase function testMissingExtentionFatal(){ $ext = 'php_ext'; - $warn = 'The '.$ext.' extension is missing. Please check your PHP configuration.'; + $warn = 'The '.$ext.' extension is missing. Please check your PHP configuration.'; ob_start(); PMA_warnMissingExtension($ext, true); @@ -38,7 +38,7 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase $ext = 'php_ext'; $extra = 'Appended Extra String'; - $warn = 'The '.$ext.' extension is missing. Please check your PHP configuration.'.' '.$extra; + $warn = 'The '.$ext.' extension is missing. Please check your PHP configuration.'.' '.$extra; ob_start(); PMA_warnMissingExtension($ext, true, $extra);