diff --git a/src/Controller/CaptchaHandlerController.php b/src/Controller/CaptchaHandlerController.php index b4dc224..4fc6a77 100644 --- a/src/Controller/CaptchaHandlerController.php +++ b/src/Controller/CaptchaHandlerController.php @@ -17,18 +17,18 @@ public function initialize() { if ($this->isGetResourceContentsRequest()) { // validate filename - $filename = $this->request->query('get'); + $filename = $this->request->getQuery('get'); if (!preg_match('/^[a-z-]+\.(css|gif|js)$/', $filename)) { $this->badRequest('Invalid file name.'); } } else { // validate captcha id and load CaptchaComponent - $captchaId = $this->request->query('c'); + $captchaId = $this->request->getQuery('c'); if (is_null($captchaId) || !preg_match('/^(\w+)$/ui', $captchaId)) { $this->badRequest('Invalid captcha id.'); } - $captchaInstanceId = $this->request->query('t'); + $captchaInstanceId = $this->request->getQuery('t'); if (is_null($captchaInstanceId) || !(32 == strlen($captchaInstanceId) && (1 === preg_match("/^([a-f0-9]+)$/u", $captchaInstanceId)))) { $this->badRequest('Invalid instance id.'); @@ -70,7 +70,7 @@ public function index() \BDC_HttpHelper::BadRequest('captcha'); } - $commandString = $this->request->query('get'); + $commandString = $this->request->getQuery('get'); if (!\BDC_StringHelper::HasValue($commandString)) { \BDC_HttpHelper::BadRequest('command'); } @@ -111,7 +111,7 @@ public function index() */ public function getResourceContents() { - $filename = $this->request->query('get'); + $filename = $this->request->getQuery('get'); $resourcePath = realpath(Path::getPublicDirPathInLibrary() . $filename); @@ -417,7 +417,7 @@ public function getScriptInclude() { */ private function getInstanceId() { - $instanceId = $this->request->query('t'); + $instanceId = $this->request->getQuery('t'); if (!\BDC_StringHelper::HasValue($instanceId) || !\BDC_CaptchaBase::IsValidInstanceId($instanceId) ) { @@ -434,13 +434,13 @@ private function getInstanceId() private function getUserInput() { // BotDetect built-in Ajax Captcha validation - $input = $this->request->query('i'); + $input = $this->request->getQuery('i'); if (is_null($input)) { // jQuery validation support, the input key may be just about anything, // so we have to loop through fields and take the first unrecognized one $recognized = array('get', 'c', 't', 'd'); - foreach ($this->request->query as $key => $value) { + foreach ($this->request->getQuery() as $key => $value) { if (!in_array($key, $recognized)) { $input = $value; break; @@ -467,7 +467,7 @@ private function getJsonValidationResult($result) */ private function isGetResourceContentsRequest() { - $http_get_data = $this->request->query; + $http_get_data = $this->request->getQuery(); return array_key_exists('get', $http_get_data) && !array_key_exists('c', $http_get_data); } diff --git a/src/Controller/Component/CaptchaComponent.php b/src/Controller/Component/CaptchaComponent.php index 79c7350..b4d73ea 100644 --- a/src/Controller/Component/CaptchaComponent.php +++ b/src/Controller/Component/CaptchaComponent.php @@ -36,7 +36,7 @@ public function initialize(array $params) { self::$instance =& $this; - $session = $this->request->session(); + $session = $this->request->getSession(); // load botdetect captcha library LibraryLoader::load($session); diff --git a/src/Controller/SimpleCaptchaHandlerController.php b/src/Controller/SimpleCaptchaHandlerController.php index b4e6427..b826677 100644 --- a/src/Controller/SimpleCaptchaHandlerController.php +++ b/src/Controller/SimpleCaptchaHandlerController.php @@ -20,12 +20,12 @@ public function initialize() SimpleLibraryLoader::load(); // validate captcha style name and load SimpleCaptchaComponent - $captchaStyleName = $this->request->query('c'); + $captchaStyleName = $this->request->getQuery('c'); if (is_null($captchaStyleName) || !preg_match('/^(\w+)$/ui', $captchaStyleName)) { return; } - $captchaId = $this->request->query('t'); + $captchaId = $this->request->getQuery('t'); if ($captchaId !== null) { $captchaId = \BDC_StringHelper::Normalize($captchaId); if (1 !== preg_match(\BDC_SimpleCaptchaBase::VALID_CAPTCHA_ID, $captchaId)) { @@ -60,7 +60,7 @@ public function index() // getting captcha image, sound, validation result - $commandString = $this->request->query('get'); + $commandString = $this->request->getQuery('get'); if (!\BDC_StringHelper::HasValue($commandString)) { \BDC_HttpHelper::BadRequest('command'); } @@ -577,7 +577,7 @@ private function isObviousBotRequest($p_Captcha) */ private function getCaptchaId() { - $captchaId = $this->request->query('t'); + $captchaId = $this->request->getQuery('t'); if (!\BDC_StringHelper::HasValue($captchaId) || !\BDC_CaptchaBase::IsValidInstanceId($captchaId) ) { @@ -594,13 +594,13 @@ private function getCaptchaId() private function getUserInput() { // BotDetect built-in Ajax Captcha validation - $input = $this->request->query('i'); + $input = $this->request->getQuery('i'); if (is_null($input)) { // jQuery validation support, the input key may be just about anything, // so we have to loop through fields and take the first unrecognized one $recognized = array('get', 'c', 't', 'd'); - foreach ($this->request->query as $key => $value) { + foreach ($this->request->getQuery() as $key => $value) { if (!in_array($key, $recognized)) { $input = $value; break; @@ -627,7 +627,7 @@ private function getJsonValidationResult($result) */ private function isGetResourceContentsRequest() { - $http_get_data = $this->request->query; + $http_get_data = $this->request->getQuery(); return array_key_exists('get', $http_get_data) && !array_key_exists('c', $http_get_data); }