65 lines
1.2 KiB
PHP
65 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* @brief Theme Changer
|
|
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
|
* @copyright (c) Invision Power Services, Inc.
|
|
* @license https://www.invisioncommunity.com/legal/standards/
|
|
* @package Invision Community
|
|
* @since 17 Dec 2013
|
|
*/
|
|
|
|
namespace IPS\core\modules\front\system;
|
|
|
|
/* To prevent PHP errors (extending class does not exist) revealing path */
|
|
|
|
use IPS\Dispatcher\Controller;
|
|
use IPS\Http\Url;
|
|
use IPS\Member;
|
|
use IPS\Output;
|
|
use IPS\Request;
|
|
use IPS\Session;
|
|
use function defined;
|
|
|
|
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
|
{
|
|
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Theme Changer
|
|
*/
|
|
class theme extends Controller
|
|
{
|
|
/**
|
|
* Execute
|
|
*
|
|
* @return void
|
|
*/
|
|
public function execute() : void
|
|
{
|
|
parent::execute();
|
|
}
|
|
|
|
/**
|
|
* Manage
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function manage() : void
|
|
{
|
|
Session::i()->csrfCheck();
|
|
|
|
if( Member::loggedIn()->member_id )
|
|
{
|
|
Member::loggedIn()->skin = (int) Request::i()->id;
|
|
Member::loggedIn()->save();
|
|
}
|
|
else
|
|
{
|
|
Request::i()->setCookie( 'theme', (int) Request::i()->id );
|
|
}
|
|
|
|
Output::i()->redirect( Request::i()->referrer() ?: Url::internal( '' ) );
|
|
}
|
|
} |