-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathswitch_theme.php
More file actions
35 lines (30 loc) · 1022 Bytes
/
switch_theme.php
File metadata and controls
35 lines (30 loc) · 1022 Bytes
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
33
34
35
<?php
/**
* @version $Header$
* @package themes
* @subpackage functions
*/
/**
* Setup
*/
require_once( '../kernel/includes/setup_inc.php' );
include_once( KERNEL_PKG_CLASS_PATH.'BitBase.php' );
if (isset($_SERVER['HTTP_REFERER'])) {
$orig_url = $_SERVER['HTTP_REFERER'];
} else {
$orig_url = $bit_index;
}
if (isset($_GET['theme']) && $gBitSystem->getConfig('users_themes') == 'y'){
$new_theme = $_GET['theme'];
if(isset($gBitUser) && $gBitSystem->getConfig('users_preferences') == 'y' ) {
$gBitUser->storePreference('theme',$new_theme);
setcookie('bw-theme', '', time()-3600*24*30*12, $gBitSystem->getConfig('cookie_path'), $gBitSystem->getConfig('cookie_domain'));
} else {
setcookie('bw-theme', $new_theme, time()+3600*24*30*12, $gBitSystem->getConfig('cookie_path'), $gBitSystem->getConfig('cookie_domain'));
}
} else{
setcookie('bw-theme', '', time()-3600*24*30*12, $gBitSystem->getConfig('cookie_path'), $gBitSystem->getConfig('cookie_domain'));
}
header("location: $orig_url");
exit;
?>