[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_5-20529-g9cd4a96

Madhura Jayaratne madhuracj at users.sourceforge.net
Sat Oct 1 21:36:16 CEST 2011


The branch, master has been updated
       via  9cd4a96902c6f35944e82baacd45707857fa5a3d (commit)
       via  5a6a74481a341111a4b2e34021753a42a17f908e (commit)
      from  2f889c0bba879fa4b275e28a2258fd96bfe4884e (commit)


- Log -----------------------------------------------------------------
commit 9cd4a96902c6f35944e82baacd45707857fa5a3d
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date:   Sun Oct 2 01:04:32 2011 +0530

    Fix failing tests

commit 5a6a74481a341111a4b2e34021753a42a17f908e
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date:   Sun Oct 2 00:59:53 2011 +0530

    For PMA_linkURL() applied URLs

-----------------------------------------------------------------------

Summary of changes:
 libraries/sanitizing.lib.php                       |    4 +++-
 test/libraries/common/PMA_showPHPDocu_test.php     |    5 +++--
 test/libraries/core/PMA_getLinks_test.php          |    6 +++++-
 .../core/PMA_warnMissingExtension_test.php         |    4 ++--
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/libraries/sanitizing.lib.php b/libraries/sanitizing.lib.php
index cbac64d..241af1c 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 0cd576f..2bf53d0 100644
--- a/test/libraries/common/PMA_showPHPDocu_test.php
+++ b/test/libraries/common/PMA_showPHPDocu_test.php
@@ -11,6 +11,7 @@
 /*
  * Include to test.
  */
+require_once 'libraries/core.lib.php';
 require_once 'libraries/common.lib.php';
 require_once 'libraries/Theme.class.php';
 
@@ -27,7 +28,7 @@ class PMA_showPHPDocu_test extends PHPUnit_Framework_TestCase
 
         $target = "docu";
         $lang = _pgettext('PHP documentation language', 'en');
-        $expected = '<a href="http://php.net/manual/' . $lang . '/' . $target
+        $expected = '<a href="./url.php?url=http%3A%2F%2Fphp.net%2Fmanual%2F' . $lang . '%2F' . $target
             . '" target="documentation"><img src="themes/dot.gif" title="'
             . __('Documentation') . '" alt="' . __('Documentation') . '" class="icon ic_b_help" /></a>';
 
@@ -40,7 +41,7 @@ class PMA_showPHPDocu_test extends PHPUnit_Framework_TestCase
 
         $target = "docu";
         $lang = _pgettext('PHP documentation language', 'en');
-        $expected = '[<a href="http://php.net/manual/' . $lang . '/' . $target 
+        $expected = '[<a href="./url.php?url=http%3A%2F%2Fphp.net%2Fmanual%2F' . $lang . '%2F' . $target
             . '" target="documentation">' . __('Documentation') . '</a>]';
 
         $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 5d96725..2208bc6 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 24128e1..522453d 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 <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.';
+        $warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php') . '" target="Documentation"><em>'.$ext.'</em></a> 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 <a href="'.PMA_linkURL(PMA_getPHPDocLink('book.' . $ext . '.php')).'" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.'.' '.$extra;
+        $warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php') . '" target="Documentation"><em>'.$ext.'</em></a> extension is missing. Please check your PHP configuration.'.' '.$extra;
 
         ob_start();
         PMA_warnMissingExtension($ext, true, $extra);


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list