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,68 +11,80 @@
|
||||
namespace IPS\core\modules\front\discover;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\core\Rss as RssClass;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Login;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* rss
|
||||
*/
|
||||
class _rss extends \IPS\Dispatcher\Controller
|
||||
class rss extends Controller
|
||||
{
|
||||
/**
|
||||
* Display Feed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
try
|
||||
{
|
||||
$feed = \IPS\core\Rss::load( \IPS\Request::i()->id );
|
||||
$feed = RssClass::load( Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C340/1', 404, '' );
|
||||
Output::i()->error( 'node_error', '2C340/1', 404, '' );
|
||||
}
|
||||
|
||||
if ( !$feed->_enabled )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error_no_perm', '2C340/2', 403, '' );
|
||||
Output::i()->error( 'node_error_no_perm', '2C340/2', 403, '' );
|
||||
}
|
||||
|
||||
/* Specific Member? */
|
||||
if ( isset( \IPS\Request::i()->member_id ) AND isset( \IPS\Request::i()->key ) )
|
||||
if ( isset( Request::i()->member_id ) AND isset( Request::i()->key ) )
|
||||
{
|
||||
/* Load Member */
|
||||
$member = \IPS\Member::load( \IPS\Request::i()->member_id );
|
||||
$member = Member::load( Request::i()->member_id );
|
||||
|
||||
/* Make sure we have an actual member, and that the key matches. If it doesn't, we can bubble up and see if the feed works for guests, and just use that */
|
||||
if ( $member->member_id AND \IPS\Login::compareHashes( $member->getUniqueMemberHash(), (string) \IPS\Request::i()->key ) )
|
||||
if ( $member->member_id AND Login::compareHashes( $member->getUniqueMemberHash(), (string) Request::i()->key ) )
|
||||
{
|
||||
/* Make sure we have access to this feed. */
|
||||
if ( $feed->groups == '*' OR $member->inGroup( $feed->groups ) )
|
||||
{
|
||||
/* Send It */
|
||||
\IPS\Output::i()->sendOutput( $feed->generate( $member ), 200, 'text/xml' );
|
||||
Output::i()->sendOutput( $feed->generate( $member ), 200, 'text/xml' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error_no_perm', '2C340/3', 403, '' );
|
||||
Output::i()->error( 'node_error_no_perm', '2C340/3', 403, '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* We're working with a guest. */
|
||||
if ( $feed->groups == '*' OR \in_array( \IPS\Settings::i()->guest_group, $feed->groups ) )
|
||||
if ( $feed->groups == '*' OR in_array( Settings::i()->guest_group, $feed->groups ) )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( $feed->generate(), 200, 'text/xml' );
|
||||
Output::i()->sendOutput( $feed->generate(), 200, 'text/xml' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error_no_perm', '2C340/4', 403, '' );
|
||||
Output::i()->error( 'node_error_no_perm', '2C340/4', 403, '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user