Skip to content

Deprecated functions in CakePHP #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/Controller/CaptchaHandlerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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)
) {
Expand All @@ -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;
Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Component/CaptchaComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions src/Controller/SimpleCaptchaHandlerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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)
) {
Expand All @@ -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;
Expand All @@ -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);
}

Expand Down