function test_MAX_commonGetPostValueUnslashed() { // We can't really test slashed/unslashed $_POST['aaa'] = 'bbb'; $this->assertEqual('bbb', MAX_commonGetPostValueUnslashed('aaa')); $this->assertNull(MAX_commonGetPostValueUnslashed('aab')); }
/** * A to get the login credential supplied as POST parameters * * Additional checks are also performed and error eventually returned * * @param bool $performCookieCheck * @return mixed Array on success, PEAR_Error otherwise */ function _getCredentials($performCookieCheck = true) { if (empty($_POST['username']) || empty($_POST['password'])) { return new PEAR_Error($GLOBALS['strEnterBoth']); } if ($performCookieCheck && !isset($_COOKIE['sessionID'])) { return new PEAR_Error($GLOBALS['strEnableCookies']); } if ($performCookieCheck && $_COOKIE['sessionID'] != $_POST['oa_cookiecheck']) { return new PEAR_Error($GLOBALS['strSessionIDNotMatch']); } return array('username' => MAX_commonGetPostValueUnslashed('username'), 'password' => MAX_commonGetPostValueUnslashed('password')); }