<?php
if ( !eregi("admin.php", $PHP_SELF) ) { 
	die ("Access Denied"); 
}
$op = "default";
include (XOOPS_ROOT_PATH."/modules/system/admin/preferences/preferences.php");
if ( isset($HTTP_POST_VARS) ) {
	foreach ( $HTTP_POST_VARS as $k => $v ) {
		$$k = $v;
	}
}

if( $xoopsUser->isAdmin($xoopsModule->mid()) ) {
	switch($op) {
		case "save":
			if (!empty($changeusers) ) {
				$sql = "UPDATE ".$xoopsDB->prefix("users")." SET theme='$default_theme'";
				$xoopsDB->query($sql);
			}
			if ( !is_writable(XOOPS_ROOT_PATH."/modules/system/cache/config.php") ) {
		// attempt to chmod 666
				if ( !chmod(XOOPS_ROOT_PATH."/modules/system/cache/config.php", 0666) ) {
					xoops_cp_header();
					printf(_MUSTWABLE, "<b>".XOOPS_ROOT_PATH."/modules/system/cache/config.php</b>");
					xoops_cp_footer();
					exit();
				}
			}
			save_pref($sitename, $slogan, $adminmail, $language, $startpage, $server_TZ, $default_TZ, $default_theme, $allow_theme, $anonymous, $minpass, $anonpost, $new_user_notify, $new_user_notify_group, $self_delete, $display_loading_img, $gzip_compression, $uname_test_level, $usercookie, $sessioncookie, $old_sessioncookie, $sessionexpire, $banners, $tags, $my_ip, $com_mode, $com_order, $debug_mode, $avatar_allow_upload, $avatar_width, $avatar_height, $avatar_maxsize);
			break;
		case "default":
		default:
			xoops_cp_header();
			show_pref();
			echo "<br />";
			xoops_cp_footer();
			break;
	}
}
?>