mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-30 17:58:39 +00:00
fixes #192
This commit is contained in:
parent
d0d77c9b9b
commit
71e2d7fc67
|
|
@ -95,6 +95,7 @@ final class SocketRouter implements RouterInterface
|
||||||
* @param string $app Application name
|
* @param string $app Application name
|
||||||
* @param int $orgId Organization id
|
* @param int $orgId Organization id
|
||||||
* @param mixed $account Account
|
* @param mixed $account Account
|
||||||
|
* @param array $data Data
|
||||||
*
|
*
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*
|
*
|
||||||
|
|
@ -104,7 +105,8 @@ final class SocketRouter implements RouterInterface
|
||||||
string $uri,
|
string $uri,
|
||||||
string $app = null,
|
string $app = null,
|
||||||
int $orgId = null,
|
int $orgId = null,
|
||||||
$account = null
|
$account = null,
|
||||||
|
array $data = null
|
||||||
) : array
|
) : array
|
||||||
{
|
{
|
||||||
$bound = [];
|
$bound = [];
|
||||||
|
|
@ -125,6 +127,15 @@ final class SocketRouter implements RouterInterface
|
||||||
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403') : $this->route('/e403');
|
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 (!isset($data[$name]) || \preg_match($pattern, $data[$name]) !== 1) {
|
||||||
|
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403') : $this->route('/e403');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$bound[] = ['dest' => $d['dest']];
|
$bound[] = ['dest' => $d['dest']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ final class WebRouter implements RouterInterface
|
||||||
* @param string $app Application name
|
* @param string $app Application name
|
||||||
* @param int $orgId Organization id
|
* @param int $orgId Organization id
|
||||||
* @param mixed $account Account
|
* @param mixed $account Account
|
||||||
|
* @param array $data Data
|
||||||
*
|
*
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*
|
*
|
||||||
|
|
@ -134,7 +135,8 @@ final class WebRouter implements RouterInterface
|
||||||
int $verb = RouteVerb::GET,
|
int $verb = RouteVerb::GET,
|
||||||
string $app = null,
|
string $app = null,
|
||||||
int $orgId = null,
|
int $orgId = null,
|
||||||
$account = null
|
$account = null,
|
||||||
|
array $data = null
|
||||||
) : array
|
) : array
|
||||||
{
|
{
|
||||||
$bound = [];
|
$bound = [];
|
||||||
|
|
@ -164,6 +166,15 @@ final class WebRouter implements RouterInterface
|
||||||
return $app !== null ? $this->route('/' . \strtolower($app) . '/e403', $csrf, $verb) : $this->route('/e403', $csrf, $verb);
|
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 (!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']];
|
$bound[] = ['dest' => $d['dest']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user