diff options
author | xue <> | 2006-07-16 01:50:23 +0000 |
---|---|---|
committer | xue <> | 2006-07-16 01:50:23 +0000 |
commit | af68030fcf0c266300feb2c100149ecadef7d364 (patch) | |
tree | 76b7c8ad5d8227870b9ef10c3e7b92a36336b320 /tests/test_tools/simpletest/authentication.php | |
parent | 4b78404c20490a615459267426ce9e6737bf4485 (diff) |
Merge from 3.0 branch till 1264.
Diffstat (limited to 'tests/test_tools/simpletest/authentication.php')
-rw-r--r-- | tests/test_tools/simpletest/authentication.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/test_tools/simpletest/authentication.php b/tests/test_tools/simpletest/authentication.php index 7b6ed4ba..bc413b2c 100644 --- a/tests/test_tools/simpletest/authentication.php +++ b/tests/test_tools/simpletest/authentication.php @@ -3,7 +3,7 @@ * Base include file for SimpleTest * @package SimpleTest * @subpackage WebTester - * @version $Id: authentication.php,v 1.9 2004/09/19 17:24:11 lastcraft Exp $ + * @version $Id: authentication.php,v 1.10 2005/07/26 01:27:18 lastcraft Exp $ */ /** * include http class @@ -100,7 +100,26 @@ * @access public */ function isWithin($url) { - return (strpos($url->getBasePath(), $this->_root) === 0); + if ($this->_isIn($this->_root, $url->getBasePath())) { + return true; + } + if ($this->_isIn($this->_root, $url->getBasePath() . $url->getPage() . '/')) { + return true; + } + return false; + } + + /** + * Tests to see if one string is a substring of + * another. + * @param string $part Small bit. + * @param string $whole Big bit. + * @return boolean True if the small bit is + * in the big bit. + * @access private + */ + function _isIn($part, $whole) { + return strpos($whole, $part) === 0; } } |