mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 01:38:41 +00:00
fixes #191
This commit is contained in:
parent
71e2d7fc67
commit
0566a34093
|
|
@ -66,8 +66,14 @@ final class Dispatcher implements DispatcherInterface
|
|||
{
|
||||
$views = [];
|
||||
|
||||
if (\is_array($controller) && isset($controller['dest'])) {
|
||||
$controller = $controller['dest'];
|
||||
if (\is_array($controller)) {
|
||||
if (isset($controller['dest'])) {
|
||||
$controller = $controller['dest'];
|
||||
}
|
||||
|
||||
if (isset($controller['dest'])) {
|
||||
$data = \array_merge($data, $controller['data']);
|
||||
}
|
||||
}
|
||||
|
||||
if (\is_string($controller)) {
|
||||
|
|
|
|||
|
|
@ -127,16 +127,30 @@ final class SocketRouter implements RouterInterface
|
|||
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403') : $this->route('/e403');
|
||||
}
|
||||
|
||||
// if data check is invalid
|
||||
if (isset($d['data'])) {
|
||||
foreach ($d['data'] as $name => $pattern) {
|
||||
// if validation check is invalid
|
||||
if (isset($d['validation'])) {
|
||||
foreach ($d['validation'] as $name => $pattern) {
|
||||
if (!isset($data[$name]) || \preg_match($pattern, $data[$name]) !== 1) {
|
||||
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403') : $this->route('/e403');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$bound[] = ['dest' => $d['dest']];
|
||||
$temp = ['dest' => $d['dest']];
|
||||
|
||||
// fill data
|
||||
if (isset($d['data'])) {
|
||||
$data = [];
|
||||
foreach ($d['data'] as $name => $destination) {
|
||||
if (isset($data[$name])) {
|
||||
$data[$destination] = $data[$name];
|
||||
}
|
||||
}
|
||||
|
||||
$temp['data'] = $data;
|
||||
}
|
||||
|
||||
$bound[] = $temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ final class WebRouter implements RouterInterface
|
|||
* @param string $app Application name
|
||||
* @param int $orgId Organization id
|
||||
* @param mixed $account Account
|
||||
* @param array $data Data
|
||||
* @param array $data Validation
|
||||
*
|
||||
* @return array[]
|
||||
*
|
||||
|
|
@ -166,16 +166,25 @@ final class WebRouter implements RouterInterface
|
|||
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403', $csrf, $verb) : $this->route('/e403', $csrf, $verb);
|
||||
}
|
||||
|
||||
// if data check is invalid
|
||||
if (isset($d['data'])) {
|
||||
foreach ($d['data'] as $name => $pattern) {
|
||||
// if validation check is invalid
|
||||
if (isset($d['validation'])) {
|
||||
foreach ($d['validation'] as $name => $pattern) {
|
||||
if (!isset($data[$name]) || \preg_match($pattern, $data[$name]) !== 1) {
|
||||
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403', $csrf, $verb) : $this->route('/e403', $csrf, $verb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$bound[] = ['dest' => $d['dest']];
|
||||
$temp = ['dest' => $d['dest']];
|
||||
|
||||
// fill data
|
||||
if (isset($d['pattern'])) {
|
||||
\preg_match($d['pattern'], $route, $matches);
|
||||
|
||||
$temp['data'] = $matches;
|
||||
}
|
||||
|
||||
$bound[] = $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user