summaryrefslogtreecommitdiff
path: root/modules/mod_switch_theme.php
blob: f199b6dd66f86af1bc84ea762d650feb6bbf0a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
 * @version $Header$
 * @package themes
 * @subpackage modules
 */

/**
 * Setup
 */
global $gBitThemes;
$change_theme = $gBitSystem->getConfig('users_themes');
$gBitSmarty->assign( 'change_theme', $change_theme);
$style = $gBitThemes->getStyle();

if( $change_theme == 'y' ) {
	if ($gBitUser->isValid() && $gBitSystem->getConfig('users_preferences') == 'y') {
		$userStyle = $gBitUser->getPreference('theme');
		$style = empty($userStyle) ? $style : $userStyle;
	}
	if (isset($_COOKIE['bw-theme'])) {
		$style = $_COOKIE['bw-theme'];
	}

	$styles = $gBitThemes->getStyles( null, true );
	$stylesList = $gBitThemes->getStyles();

	$gBitSmarty->assign( 'styleslist', $stylesList );
	if(isset($style)){
		$gBitSmarty->assign( 'style', $style);
	}
}