use wcf\data\package\PackageEditor;
use wcf\data\page\Page;
use wcf\data\page\PageCache;
-use wcf\data\style\StyleAction;
use wcf\page\CmsPage;
use wcf\system\application\ApplicationHandler;
use wcf\system\application\IApplication;
use wcf\system\exception\IPrintableException;
use wcf\system\exception\NamedUserException;
use wcf\system\exception\ParentClassException;
-use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\SystemException;
-use wcf\system\exception\UserInputException;
use wcf\system\language\LanguageFactory;
use wcf\system\package\PackageInstallationDispatcher;
use wcf\system\registry\RegistryHandler;
*/
protected function initStyle()
{
- $styleID = 0;
-
/** @deprecated The 'styleID' parameter is deprecated. */
if (isset($_REQUEST['styleID'])) {
- $styleID = \intval($_REQUEST['styleID']);
-
- try {
- $action = new StyleAction([$styleID], 'changeStyle');
- $action->validateAction();
- $action->executeAction();
- } catch (PermissionDeniedException | UserInputException $e) {
- $styleID = 0;
- }
- }
-
- if ($styleID === 0) {
- if (self::getSession()->getUser()->userID) {
- $styleID = self::getSession()->getUser()->styleID ?: 0;
- } else {
- $styleID = self::getSession()->getVar('styleID') ?: 0;
- }
+ self::getSession()->setStyleID(\intval($_REQUEST['styleID']));
}
$styleHandler = StyleHandler::getInstance();
- $styleHandler->changeStyle($styleID);
+ $styleHandler->changeStyle(self::getSession()->getStyleID());
}
/**
use ParagonIE\ConstantTime\Hex;
use wcf\data\session\Session as LegacySession;
use wcf\data\session\SessionEditor;
-use wcf\data\style\StyleAction;
use wcf\data\user\User;
use wcf\data\user\UserEditor;
use wcf\system\application\ApplicationHandler;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\event\EventHandler;
use wcf\system\exception\PermissionDeniedException;
-use wcf\system\exception\UserInputException;
use wcf\system\page\PageLocationManager;
use wcf\system\request\RouteHandler;
use wcf\system\SingletonFactory;
-use wcf\system\style\StyleHandler;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\WCF;
use wcf\system\WCFACP;
*/
protected $legacySession;
+ /**
+ * style id
+ * @var int
+ */
+ protected $styleID;
+
/**
* user object
* @var User
{
$this->defineConstants();
- // assign language
+ // assign language and style id
$this->languageID = $this->getVar('languageID') ?: $this->user->languageID;
+ $this->styleID = $this->getVar('styleID') ?: $this->user->styleID;
// https://github.com/WoltLab/WCF/issues/2568
if ($this->getVar('__wcfIsFirstVisit') === true) {
$this->groupData = null;
$this->languageIDs = null;
$this->languageID = $this->user->languageID;
+ $this->styleID = $this->user->styleID;
// change language
WCF::setLanguage($this->languageID ?: 0);
// If we reach this point we determined that a new authentication is not necessary.
\assert(
($lastAuthentication >= TIME_NOW - $softLimit)
- || ($lastAuthentication >= TIME_NOW - self::REAUTHENTICATION_HARD_LIMIT
- && $lastCheck >= TIME_NOW - self::REAUTHENTICATION_GRACE_PERIOD)
+ || ($lastAuthentication >= TIME_NOW - self::REAUTHENTICATION_HARD_LIMIT
+ && $lastCheck >= TIME_NOW - self::REAUTHENTICATION_GRACE_PERIOD)
);
// Update the lastCheck timestamp to make sure that the grace period works properly.
}
/**
- * @deprecated 5.5 - Use `StyleHandler::getInstance()->getStyle()->styleID` instead.
+ * Returns currently active style id.
+ *
+ * @return int
*/
public function getStyleID()
{
- return StyleHandler::getInstance()->getStyle()->styleID;
+ return $this->styleID;
}
/**
- * @deprecated 5.5 - Set the style directly with the `StyleAction::changeStyle()`.
+ * Sets the currently active style id.
+ *
+ * @param int $styleID
*/
public function setStyleID($styleID)
{
- try {
- $action = new StyleAction([$styleID], 'changeStyle');
- $action->validateAction();
- $action->executeAction();
- } catch (PermissionDeniedException | UserInputException $e) {
- }
+ $this->styleID = $styleID;
+ $this->register('styleID', $this->styleID);
}
/**