|
@@ -69,13 +69,13 @@ discard block |
|
|
block discarded – undo |
|
69
|
69
|
return $next($request, $response); |
|
70
|
70
|
} |
|
71
|
71
|
|
|
72
|
|
- $tokens =& self::getStorage($request, self::KEY); |
|
|
72
|
+ $tokens = & self::getStorage($request, self::KEY); |
|
73
|
73
|
|
|
74
|
74
|
if (Utils\Helpers::isPost($request) && !$this->validateRequest($request, $tokens)) { |
|
75
|
75
|
return $response->withStatus(403); |
|
76
|
76
|
} |
|
77
|
77
|
|
|
78
|
|
- $generator = function ($action = null) use ($request, &$tokens) { |
|
|
78
|
+ $generator = function($action = null) use ($request, &$tokens) { |
|
79
|
79
|
if (empty($action)) { |
|
80
|
80
|
$action = $request->getUri()->getPath(); |
|
81
|
81
|
} |
|
@@ -90,7 +90,7 @@ discard block |
|
|
block discarded – undo |
|
90
|
90
|
|
|
91
|
91
|
$response = $next($request, $response); |
|
92
|
92
|
|
|
93
|
|
- return $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
|
93
|
+ return $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
94
|
94
|
preg_match('/action=["\']?([^"\'\s]+)["\']?/i', $match[0], $matches); |
|
95
|
95
|
|
|
96
|
96
|
return $match[0].$generator(isset($matches[1]) ? $matches[1] : null); |
Please login to merge, or discard this patch.