/** * Changes the active style. * * @param integer $styleID */ public static final function changeStyle($styleID, $ignorePermissions = false) { // load cache self::getCache(); // check permission if (!$ignorePermissions) { if (isset(self::$cache['styles'][$styleID])) { if ((self::$cache['styles'][$styleID]->disabled || !empty(self::$cache['packages'][PACKAGE_ID]['disabled'][$styleID])) && !WCF::getUser()->getPermission('admin.style.canUseDisabledStyle')) { $styleID = 0; } } } // fallback to default style if (!isset(self::$cache['styles'][$styleID])) { // get package default style if (!empty(self::$cache['packages'][PACKAGE_ID]['default'])) { $styleID = self::$cache['packages'][PACKAGE_ID]['default']; } else { $styleID = self::$cache['default']; } if (!isset(self::$cache['styles'][$styleID])) { throw new SystemException('no default style defined', 100000); } } // init style self::$style = self::$cache['styles'][$styleID]->getActiveStyle(); // set template pack id if (WCF::getTPL()) { WCF::getTPL()->setTemplatePackID(self::$style->templatePackID); } }