Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,39 +11,47 @@
|
||||
namespace IPS\core\modules\front\system;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Content" functions Controller
|
||||
*/
|
||||
class _content extends \IPS\Dispatcher\Controller
|
||||
class content extends Controller
|
||||
{
|
||||
/**
|
||||
* Find content
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function find()
|
||||
protected function find() : void
|
||||
{
|
||||
if ( ! \IPS\Request::i()->content_class AND ! \IPS\Request::i()->content_id AND ! \IPS\Request::i()->content_commentid )
|
||||
if ( ! Request::i()->content_class AND ! Request::i()->content_id AND ! Request::i()->content_commentid )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S226/1', 404, '' );
|
||||
Output::i()->error( 'node_error', '2S226/1', 404, '' );
|
||||
}
|
||||
|
||||
$class = 'IPS\\' . implode( '\\', explode( '_', \IPS\Request::i()->content_class ) );
|
||||
$class = 'IPS\\' . implode( '\\', explode( '_', Request::i()->content_class ) );
|
||||
|
||||
if ( ! class_exists( $class ) or ! \in_array( 'IPS\Content', class_parents( $class ) ) )
|
||||
if ( ! class_exists( $class ) or ! in_array( 'IPS\Content', class_parents( $class ) ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S226/2', 404, '' );
|
||||
Output::i()->error( 'node_error', '2S226/2', 404, '' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$item = $class::load( \IPS\Request::i()->content_id );
|
||||
$item = $class::load( Request::i()->content_id );
|
||||
|
||||
if( isset( $item::$archiveClass ) AND method_exists( $item, 'isArchived' ) AND $item->isArchived() )
|
||||
{
|
||||
@@ -54,21 +62,21 @@ class _content extends \IPS\Dispatcher\Controller
|
||||
$commentClass = $class::$commentClass;
|
||||
}
|
||||
|
||||
$comment = $commentClass::load( \IPS\Request::i()->content_commentid );
|
||||
$comment = $commentClass::load( Request::i()->content_commentid );
|
||||
}
|
||||
catch( \OutOfRangeException $ex )
|
||||
catch( OutOfRangeException $ex )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S226/3', 404, '' );
|
||||
Output::i()->error( 'node_error', '2S226/3', 404, '' );
|
||||
}
|
||||
|
||||
/* Make sure we have permission to see this */
|
||||
if ( $item->canView() AND $comment->canView() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $comment->url() );
|
||||
Output::i()->redirect( $comment->url() );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S226/4', 404, '' );
|
||||
Output::i()->error( 'node_error', '2S226/4', 404, '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user