mirror of
https://github.com/YGGverse/Pulsar.git
synced 2026-03-31 17:55:37 +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;
|
break;
|
||||||
|
|
||||||
// Chanel item
|
// 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 = [];
|
$lines = [];
|
||||||
|
|
||||||
// Get channel item info
|
|
||||||
if ($channelItem = $this->_database->getChannelItem($attribute['id']))
|
|
||||||
{
|
|
||||||
if ($channelItem->title)
|
if ($channelItem->title)
|
||||||
{
|
{
|
||||||
$lines[] = sprintf(
|
$lines[] = sprintf(
|
||||||
|
|
@ -134,7 +137,6 @@ class Nex implements MessageComponentInterface
|
||||||
$channelItem->link
|
$channelItem->link
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Get channel info
|
// Get channel info
|
||||||
if ($channel = $this->_database->getChannel($channelItem->channelId))
|
if ($channel = $this->_database->getChannel($channelItem->channelId))
|
||||||
|
|
@ -155,13 +157,16 @@ class Nex implements MessageComponentInterface
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Channel page
|
// Channel page
|
||||||
case (bool) preg_match('/^\/(?<alias>.+)$/i', $request, $attribute):
|
case preg_match(
|
||||||
|
'/^\/(?<alias>.+)$/i',
|
||||||
|
$request,
|
||||||
|
$attribute
|
||||||
|
) && $channel = $this->_database->getChannelByAlias(
|
||||||
|
$attribute['alias']
|
||||||
|
):
|
||||||
|
|
||||||
$lines = [];
|
$lines = [];
|
||||||
|
|
||||||
// Get channel info
|
|
||||||
if ($channel = $this->_database->getChannelByAlias($attribute['alias']))
|
|
||||||
{
|
|
||||||
if ($channel->title)
|
if ($channel->title)
|
||||||
{
|
{
|
||||||
$lines[] = sprintf(
|
$lines[] = sprintf(
|
||||||
|
|
@ -202,7 +207,6 @@ class Nex implements MessageComponentInterface
|
||||||
) . PHP_EOL;
|
) . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Build response
|
// Build response
|
||||||
$response = implode(
|
$response = implode(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue