1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require_once('tiki-setup.php');
12
13$access->check_feature('change_theme');
14if (! empty($group_theme)) {
15	$access->display_error(null, 'A group theme is defined.');
16}
17
18if (isset($_REQUEST['theme'])) {
19	if (empty($_REQUEST['theme'])) {
20		$_REQUEST['theme_option'] = '';
21	}
22
23	$tikilib->set_user_preference($user, 'theme', $_REQUEST['theme']); //save user's theme preference
24	$tikilib->set_user_preference($user, 'theme_option', $_REQUEST['theme_option']);
25}
26
27if (isset($_SERVER['HTTP_REFERER'])) {
28	$orig_url = $_SERVER['HTTP_REFERER'];
29} else {
30	$orig_url = $prefs['tikiIndex'];
31}
32header("location: $orig_url");
33exit;
34