mirror of
https://github.com/YGGverse/Pulsar.git
synced 2026-04-03 03:05:32 +00:00
add record exist validation on route request
This commit is contained in:
parent
cf36d79cad
commit
67c6fab4cf
1 changed files with 80 additions and 76 deletions
|
|
@ -88,13 +88,16 @@ class Nex implements MessageComponentInterface
|
|||
break;
|
||||
|
||||
// Chanel item
|
||||
case (bool) preg_match('/\/(?<id>\d+)($|\.gmi)$/i', $request, $attribute):
|
||||
case preg_match(
|
||||
'/\/(?<id>\d+)($|\.gmi)$/i',
|
||||
$request,
|
||||
$attribute
|
||||
) && $channelItem = $this->_database->getChannelItem(
|
||||
$attribute['id']
|
||||
):
|
||||
|
||||
$lines = [];
|
||||
|
||||
// Get channel item info
|
||||
if ($channelItem = $this->_database->getChannelItem($attribute['id']))
|
||||
{
|
||||
if ($channelItem->title)
|
||||
{
|
||||
$lines[] = sprintf(
|
||||
|
|
@ -134,7 +137,6 @@ class Nex implements MessageComponentInterface
|
|||
$channelItem->link
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Get channel info
|
||||
if ($channel = $this->_database->getChannel($channelItem->channelId))
|
||||
|
|
@ -155,13 +157,16 @@ class Nex implements MessageComponentInterface
|
|||
break;
|
||||
|
||||
// Channel page
|
||||
case (bool) preg_match('/^\/(?<alias>.+)$/i', $request, $attribute):
|
||||
case preg_match(
|
||||
'/^\/(?<alias>.+)$/i',
|
||||
$request,
|
||||
$attribute
|
||||
) && $channel = $this->_database->getChannelByAlias(
|
||||
$attribute['alias']
|
||||
):
|
||||
|
||||
$lines = [];
|
||||
|
||||
// Get channel info
|
||||
if ($channel = $this->_database->getChannelByAlias($attribute['alias']))
|
||||
{
|
||||
if ($channel->title)
|
||||
{
|
||||
$lines[] = sprintf(
|
||||
|
|
@ -202,7 +207,6 @@ class Nex implements MessageComponentInterface
|
|||
) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build response
|
||||
$response = implode(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue