separate parameter values for different functionalities
This commit is contained in:
parent
9eba41598d
commit
b2c2283817
2 changed files with 31 additions and 24 deletions
|
@ -82,24 +82,28 @@ class Photo extends BaseModule
|
||||||
$square_resize = !in_array($parameters['type'], ['media', 'preview']);
|
$square_resize = !in_array($parameters['type'], ['media', 'preview']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($parameters['nickname_ext'])) {
|
if (!empty($parameters['guid'])) {
|
||||||
if (in_array($parameters['type'], ['contact', 'header'])) {
|
$guid = pathinfo($parameters['guid'], PATHINFO_FILENAME);
|
||||||
$guid = pathinfo($parameters['nickname_ext'], PATHINFO_FILENAME);
|
$account = DBA::selectFirst('account-user-view', ['id'], ['guid' => $guid], ['order' => ['uid' => true]]);
|
||||||
$account = DBA::selectFirst('account-user-view', ['id'], ['guid' => $guid], ['order' => ['uid' => true]]);
|
if (empty($account)) {
|
||||||
if (empty($account)) {
|
throw new HTTPException\NotFoundException();
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $account['id'];
|
|
||||||
} else {
|
|
||||||
$nickname = pathinfo($parameters['nickname_ext'], PATHINFO_FILENAME);
|
|
||||||
$user = User::getByNickname($nickname, ['uid']);
|
|
||||||
if (empty($user)) {
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $user['uid'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id = $account['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($parameters['contact_id'])) {
|
||||||
|
$id = intval(pathinfo($parameters['contact_id'], PATHINFO_FILENAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($parameters['nickname_ext'])) {
|
||||||
|
$nickname = pathinfo($parameters['nickname_ext'], PATHINFO_FILENAME);
|
||||||
|
$user = User::getByNickname($nickname, ['uid']);
|
||||||
|
if (empty($user)) {
|
||||||
|
throw new HTTPException\NotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $user['uid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// User Id Fallback, to remove after version 2021.12
|
// User Id Fallback, to remove after version 2021.12
|
||||||
|
|
|
@ -373,15 +373,18 @@ return [
|
||||||
'/permission/tooltip/{type}/{id:\d+}' => [Module\PermissionTooltip::class, [R::GET]],
|
'/permission/tooltip/{type}/{id:\d+}' => [Module\PermissionTooltip::class, [R::GET]],
|
||||||
|
|
||||||
'/photo' => [
|
'/photo' => [
|
||||||
'/{name}' => [Module\Photo::class, [R::GET]],
|
'/{name}' => [Module\Photo::class, [R::GET]],
|
||||||
'/{type}/{id:\d+}' => [Module\Photo::class, [R::GET]],
|
'/{type}/{id:\d+}' => [Module\Photo::class, [R::GET]],
|
||||||
// User Id Fallback, to remove after version 2021.12
|
// User Id Fallback, to remove after version 2021.12
|
||||||
'/{type}/{uid_ext:\d+\..*}' => [Module\Photo::class, [R::GET]],
|
'/{type}/{uid_ext:\d+\..*}' => [Module\Photo::class, [R::GET]],
|
||||||
'/{type}/{nickname_ext}' => [Module\Photo::class, [R::GET]],
|
'/{type}/{nickname_ext}' => [Module\Photo::class, [R::GET]],
|
||||||
'/{type}/{customsize}/{id:\d+}' => [Module\Photo::class, [R::GET]],
|
// Contact Id Fallback, to remove after version 2021.12
|
||||||
|
'/{type:contact|header}/{customsize:\d+}/{contact_id:\d+}' => [Module\Photo::class, [R::GET]],
|
||||||
|
'/{type:contact|header}/{customsize:\d+}/{guid}' => [Module\Photo::class, [R::GET]],
|
||||||
|
'/{type}/{customsize:\d+}/{id:\d+}' => [Module\Photo::class, [R::GET]],
|
||||||
// User Id Fallback, to remove after version 2021.12
|
// User Id Fallback, to remove after version 2021.12
|
||||||
'/{type}/{customsize}/{uid_ext:\d+\..*}' => [Module\Photo::class, [R::GET]],
|
'/{type}/{customsize:\d+}/{uid_ext:\d+\..*}' => [Module\Photo::class, [R::GET]],
|
||||||
'/{type}/{customsize}/{nickname_ext}' => [Module\Photo::class, [R::GET]],
|
'/{type}/{customsize:\d+}/{nickname_ext}' => [Module\Photo::class, [R::GET]],
|
||||||
],
|
],
|
||||||
|
|
||||||
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
||||||
|
|
Loading…
Reference in a new issue