Faster getpreferredstylesheet with custom style support and no dependencies
This commit is contained in:
parent
751b61bf2c
commit
671d7a4ddd
|
@ -29,7 +29,7 @@
|
|||
title="{$|capitalize}"
|
||||
{if $__.customstyle eq $}data-custom="true"{/if}/>
|
||||
{/loop}{/strip}')</script>
|
||||
<noscript><link rel="stylesheet" href="{$cwebpath}getpreferredstylesheet.php"></noscript>
|
||||
<noscript><link rel="stylesheet" href="{$cwebpath}getpreferredstylesheet.php?allowed={implode(',', $ku_styles)}&default={$__.ku_defaultstyle}&v={%KU_CSSVER}{if $__.customstyle}&custom={$__.customstyle}&cv={$__.csver}{/if}"></noscript>
|
||||
<link href="{$cwebpath}css/prettify.css" type="text/css" rel="stylesheet" />
|
||||
{if $locale eq 'ja'}
|
||||
{literal}
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
<?php
|
||||
$_GLOBALS['skipdb'] = true;
|
||||
require 'config.php';
|
||||
|
||||
$style = $_COOKIE['kustyle'];
|
||||
if (!$style)
|
||||
$style = KU_DEFAULTSTYLE;
|
||||
|
||||
redirect(KU_WEBPATH.KU_BOARDSFOLDER.'css/'.strtolower($style).'.css?v='.KU_CSSVER);
|
||||
|
||||
function redirect($url, $statusCode = 303) {
|
||||
header('Location: ' . $url, true, $statusCode);
|
||||
die();
|
||||
$c = strtolower($_COOKIE['kustyle']);
|
||||
if ($c && in_array($c, explode(',', $_GET['allowed']))) {
|
||||
$is_custom = ($c == $_GET['custom']);
|
||||
$style = $_COOKIE['kustyle'];
|
||||
}
|
||||
elseif ($_GET['custom']) {
|
||||
$style = $_GET['custom'];
|
||||
$is_custom = true;
|
||||
}
|
||||
else {
|
||||
$style = $_GET['default'];
|
||||
$is_custom = false;
|
||||
}
|
||||
|
||||
$url = '/css/'.
|
||||
($is_custom ? 'custom/' : '').
|
||||
strtolower($style).'.css?v='.
|
||||
($is_custom ? $_GET['cv'] : $_GET['v']);
|
||||
header('Location: ' . $url, true, 303);
|
||||
die();
|
||||
?>
|
Loading…
Reference in New Issue