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
@@ -12,9 +12,22 @@
|
||||
namespace IPS\core\modules\front\system;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use DateInterval;
|
||||
use IPS\DateTime;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Http\Url\Exception;
|
||||
use IPS\Http\Url\Internal;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use function defined;
|
||||
use function intval;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -23,33 +36,33 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*
|
||||
* Deprecated controller maintained for backwards compatibility with old referral links
|
||||
*/
|
||||
class _referrals extends \IPS\Dispatcher\Controller
|
||||
class referrals extends Controller
|
||||
{
|
||||
/**
|
||||
* Handle Referral
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
\IPS\Request::i()->setCookie( 'referred_by', \intval( \IPS\Request::i()->id ), \IPS\DateTime::create()->add( new \DateInterval( 'P1Y' ) ) );
|
||||
Request::i()->setCookie( 'referred_by', intval( Request::i()->id ), DateTime::create()->add( new DateInterval( 'P1Y' ) ) );
|
||||
|
||||
try
|
||||
{
|
||||
$target = \IPS\Request::i()->direct ? \IPS\Http\Url::createFromString( base64_decode( \IPS\Request::i()->direct ) ) : \IPS\Http\Url::baseUrl();
|
||||
$target = Request::i()->direct ? Url::createFromString( base64_decode( Request::i()->direct ) ) : Url::baseUrl();
|
||||
}
|
||||
catch( \IPS\Http\Url\Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$target = NULL;
|
||||
}
|
||||
|
||||
if ( $target instanceof \IPS\Http\Url\Internal )
|
||||
if ( $target instanceof Internal )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $target );
|
||||
Output::i()->redirect( $target );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Settings::i()->base_url );
|
||||
Output::i()->redirect( Settings::i()->base_url );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user