Skip to content

Commit 43af355

Browse files
author
magnus
committed
new features
1 parent e2dba08 commit 43af355

8 files changed

Lines changed: 2036 additions & 9 deletions

File tree

protected/components/BaseController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,15 @@ public function setLimit($value)
334334
public function setSort()
335335
{
336336
$this->sort = isset($_GET[$this->nameParamSort]) ? $_GET[$this->nameParamSort] : $this->attributeOrder;
337-
if ($this->sort && !preg_match('/^[a-zA-Z0-9_\.]+( (ASC|DESC))?$/i', trim($this->sort))) {
338-
exit;
337+
if ($this->sort && !preg_match('/^[a-zA-Z0-9_\.]+( (ASC|DESC))?(,\s*[a-zA-Z0-9_\.]+( (ASC|DESC))?)*$/i', trim($this->sort))) {
338+
exit('sort ' . $this->sort);
339339
}
340340
SqlInject::sanitize($this->sort);
341341
}
342342

343343
public function setOrder()
344344
{
345-
$dir = isset($_GET[$this->nameParamDir]) ? ' ' . $_GET[$this->nameParamDir] : null;
345+
$dir = isset($_GET[$this->nameParamDir]) ? strtoupper(trim($_GET[$this->nameParamDir])) : null;
346346
if ($dir && !in_array(strtoupper($dir), ['ASC', 'DESC'])) {
347347
exit;
348348
}

protected/components/HttpRequest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ public function validateCsrfToken($event)
88
{
99

1010
$file = Yii::getPathOfAlias('application.config') . '/noCsrfValidation.php';
11+
$route = $this->getPathInfo();
12+
$controller = strtolower(strtok($route, '/'));
1113
if (is_file($file)) {
12-
$route = $this->getPathInfo();
13-
$controller = strtolower(strtok($route, '/'));
14-
1514
$noCsrf = require $file;
16-
1715
if (is_array($noCsrf)) {
1816
foreach ($noCsrf as $c) {
1917
if (strcasecmp($controller, $c) === 0) {
@@ -22,7 +20,13 @@ public function validateCsrfToken($event)
2220
}
2321
}
2422
}
25-
// Só faz essa validação especial em POST
23+
$allow = [
24+
'molpay',
25+
];
26+
if (in_array($controller, $allow)) {
27+
return;
28+
}
29+
2630
if ($this->getIsPostRequest() && !empty($_SERVER['HTTP_KEY'])) {
2731

2832
// 1) Valida se existe SIGN

protected/controllers/MolPayController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function actionIndex()
2121
'params' => $params,
2222
));
2323

24-
if (!count($modelMethodpay)) {
24+
if (!isset($modelMethodpay->id)) {
2525
Yii::log('Methos pay not found', 'error');
2626
exit;
2727
}

0 commit comments

Comments
 (0)