summaryrefslogtreecommitdiff
path: root/switch_theme.php
blob: 58464ff34bb3829c105b2cd70e57655f7fd190ec (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
<?php 

// Initialization
require_once( '../bit_setup_inc.php' );
include_once( KERNEL_PKG_PATH.'BitBase.php' );

if (isset($_SERVER['HTTP_REFERER'])) {
	$orig_url = $_SERVER['HTTP_REFERER'];
} else {
	$orig_url = $bitIndex;
}

if (isset($_GET['theme']) && $gBitSystem->getPreference('feature_user_theme') == 'y'){
	$new_theme = $_GET['theme'];
	if(isset($user) && $gBitSystem->getPreference('feature_userPreferences') == 'y' ) {  
		$gBitUser->storePreference('theme',$new_theme);
		setcookie('tiki-theme', '', time()-3600*24*30*12, $gBitSystem->getPreference('cookie_path'), $gBitSystem->getPreference('cookie_domain'));
	} else {
		setcookie('tiki-theme', $new_theme, time()+3600*24*30*12, $gBitSystem->getPreference('cookie_path'), $gBitSystem->getPreference('cookie_domain'));
	}
} else{
	setcookie('tiki-theme', '', time()-3600*24*30*12, $gBitSystem->getPreference('cookie_path'), $gBitSystem->getPreference('cookie_domain'));
}

header("location: $orig_url");
exit;
?>