<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// www.bcoos.net 2006-09 1.0.2 GPL
//v1.2 www.exoops.info 2006/08 GPL 
//v1.11 www.exoops.info 2006/05  GPL
//v1.10 www.exoops.info 2006/03 GPL
// $Id: main.php,v 1.9 2003/03/19 07:04:04 half-dead Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Kazumi Ono
// Author Website : http://www.mywebaddons.com/ , http://www.myweb.ne.jp
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
if ( !preg_match("/admin\.php/i", _PHP_SELF) ) {
	exit();
	}
$op = "default";
include (XOOPS_ROOT_PATH."/modules/system/admin/preferences/preferences.php");
if ( isset($_POST) ) {
	foreach ( $_POST as $k => $v ) {
		$$k = $v;
	}
}
if( $xoopsUser->isAdmin($xoopsModule->mid()) ) {
switch($op) {
case "save":
	if ( !empty($changeusers) || empty($allow_theme) ) {
		$sql = "UPDATE ".$db->prefix("users")." SET theme='$default_theme'";
		$db->query($sql);
	}
	if ( @!is_writable(XOOPS_ROOT_PATH."/modules/system/cache/config.php") ) {
		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(
		$logourl,
		$title,
		$description,
		$adminmail,
		$mail_function,
		$language,
		$startpage,
		$default_TZ,
		$default_theme,
		$allow_theme,
		$anonymous,
		$minpass,
		$anonpost,
		$max_pms,
		$allow_register,
		$img_verify,
		$auto_register,
		$new_user_notify,
		$new_user_notify_group,
		$self_delete,
		$display_loading_img,
		$gzip_compression,
		$uname_test_level,
		$cookie_name,
		$session_name,
		$old_session_name,
		$session_expire,
		$use_sessions,
		$old_session_use,
		$banners,
		$com_mode,
		$com_order,
		$atags,
		$admin_html,
		$utags,
		$user_html,
		$allow_html,
		$allow_image,
		$allow_library,
		$lib_allow_upload,
		$lib_width,
		$lib_height,
		$lib_maxsize,
		$debug_mode,
		$cache_time,
		$avatar_allow_upload,
		$avatar_width,
		$avatar_height,
		$avatar_maxsize,
		$agree_register,
		$agree_register_text,
		$captcha_comments,
		$iconset);
		break;
default:
	xoops_cp_header();
	show_pref();
	echo "<br />";
	xoops_cp_footer();
	break;
}
}
?>
