Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -599,22 +599,38 @@ class _Vanilla extends \IPS\convert\Software
|
||||
$url = \IPS\Request::i()->url();
|
||||
|
||||
if( preg_match( '#/discussion/([0-9]+)/#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
$class = '\IPS\forums\Topic';
|
||||
$types = array( 'topics', 'forums_topics' );
|
||||
$oldId = (int) $matches[1];
|
||||
}
|
||||
elseif( preg_match( '#/discussion/comment/([0-9]+)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
$class = '\IPS\forums\Topic\Post';
|
||||
$types = array( 'posts', 'forums_posts' );
|
||||
$oldId = $matches[1];
|
||||
}
|
||||
|
||||
if( isset( $class ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( (int) $matches[1], array( 'topics', 'forums_topics' ) );
|
||||
$data = (string) $this->app->getLink( $oldId, $types );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$data = (string) $this->app->getLink( (int) $matches[1], array( 'topics', 'forums_topics' ), FALSE, TRUE );
|
||||
$data = (string) $this->app->getLink( $oldId, $types, FALSE, TRUE );
|
||||
}
|
||||
$item = \IPS\forums\Topic::load( $data );
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item->canView() )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
return $item->url();
|
||||
if( $item->canView() )
|
||||
{
|
||||
return $item->url();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $e )
|
||||
|
||||
Reference in new issue
Block a user