<?php
// $Id: main.php,v 1.1 2004/07/11 10:28:55 Farsus Exp $
// -------------------------------------------------------------------------//
//			       RUNCMS                                                   //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// 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($HTTP_POST_VARS) ) {
	foreach ( $HTTP_POST_VARS 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(
		$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);
		break;

default:
	xoops_cp_header();
	show_pref();
	echo "<br />";
	xoops_cp_footer();
	break;
}

}
?>
