<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// www.bcoos.net 2006-09 1.0.2 GPL
//v1.3 www.bcoos.net 2006-08 GPL
//v1.2 www.exoops.info 2006/03 GPL
// $Id: preferences.php,v 1.13 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
// ------------------------------------------------------------------------- //
// check if the user is authorised
if ( $xoopsUser->isAdmin($xoopsModule->mid()) ) {
	include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php");
	include_once(XOOPS_ROOT_PATH."/class/xoopsform/formselectlang.php");
	include_once(XOOPS_ROOT_PATH."/class/xoopsform/formselecttimezone.php");
	include_once(XOOPS_ROOT_PATH."/class/xoopsform/formselecticonset.php");
	include_once(XOOPS_ROOT_PATH."/class/xoopsform/formselecttheme.php");
	include_once(XOOPS_ROOT_PATH."/class/xoopslists.php");
	function show_pref() {
		global $bcoosConfig, $xoopsUser;
		
		$logo_img       =  new XoopsFormFile(_MD_AM_LOGO."<br /><img src='".XOOPS_URL."/images/".$bcoosConfig['logo']."' alt='site logo' />" , "image",100000);
		$title =  new XoopsFormText(_MD_AM_TITLE, "title", 50, 100, $bcoosConfig['title']);
		$description =  new XoopsFormText(_MD_AM_DESCRIPTION, "description", 75, 100, $bcoosConfig['description']);
		$amail          = !empty($bcoosConfig['adminmail']) ? $bcoosConfig['adminmail'] : $xoopsUser->getVar("email", "E");
		$adminmail_text = new XoopsFormText(_MD_AM_ADMINML, "adminmail", 50, 100, $amail);
		$mod_select        = new XoopsFormSelect(_MD_AM_STARTPAGE, "startpage", $bcoosConfig['startpage']);
		$moduleslist       =& XoopsModule::getHasMainModulesList(true);
		$moduleslist["--"] = _NONE;
		$mod_select->addOptionArray($moduleslist);
		$mail_function  = new XoopsFormSelect(_MD_AM_MAILFUNC, "mail_function", $bcoosConfig['mail_function']);
		$mail_function->addOptionArray(array("mail"=>"mail()", "email"=>"email()"));
		$lang_select       = new XoopsFormSelectLang(_MD_AM_LANGUAGE, "language", $bcoosConfig['language']);
		$defaulttz_select = new XoopsFormSelectTimezone(_MD_AM_DEFAULTTZ, "default_TZ", $bcoosConfig['default_TZ']);
		$theme_select     = new XoopsFormSelectTheme("", "default_theme", $bcoosConfig['default_theme']);
		$theme_cbox       = new XoopsFormCheckBox("", "changeusers");
		$theme_cbox->addOption(1, _MD_AM_CHNGUTHEME);
		$theme_tray = new XoopsFormElementTray(_MD_AM_DTHEME, "");
		$theme_tray->addElement($theme_select);
		$theme_tray->addElement($theme_cbox);
		$allowtheme_radio     = new XoopsFormRadioYN(_MD_AM_ALLOWTHEME, "allow_theme", $bcoosConfig['allow_theme'], _YES,_NO);
		$anon_text            = new XoopsFormText(_MD_AM_ANONNAME, "anonymous", 50, 100, $bcoosConfig['anonymous']);
		$minnpass_text        = new XoopsFormText(_MD_AM_MINPASS, "minpass", 10, 10, $bcoosConfig['minpass']);
		$anonpost_radio       = new XoopsFormRadioYN(_MD_AM_ANONPOST, "anonpost", $bcoosConfig['anonpost'], _YES,_NO);
		$max_pms              = new XoopsFormText(_MD_AM_MAXPMS, "max_pms", 5, 5, $bcoosConfig['max_pms']);
		$allowhtml_radio      = new XoopsFormRadioYN(_MD_AM_ALLOWHTML, "allow_html", $bcoosConfig['allow_html'], _YES,_NO);
		$allow_register       = new XoopsFormRadioYN(_MD_AM_ALLOW_REGISTER, "allow_register", $bcoosConfig['allow_register'], _YES,_NO);
		$img_verify           = new XoopsFormRadioYN(_MD_AM_VERIFY_IMG, "img_verify", $bcoosConfig['img_verify'], _YES,_NO);
		$allowimage_radio     = new XoopsFormRadioYN(_MD_AM_ALLOWIMAGE, "allow_image", $bcoosConfig['allow_image'], _YES,_NO);
		$libuse_radio    = new XoopsFormRadioYN(_MD_AM_LIBUSE, "allow_library", $bcoosConfig['allow_library'], _YES,_NO);
		$libupload_radio = new XoopsFormRadioYN(_MD_AM_LIBUPLOAD, "lib_allow_upload", $bcoosConfig['lib_allow_upload'], _YES, _NO);
		$libwidth_text   = new XoopsFormText(_MD_AM_LIBW, "lib_width", 4, 4, $bcoosConfig['lib_width']);
		$libheight_text  = new XoopsFormText(_MD_AM_LIBH, "lib_height", 4, 4, $bcoosConfig['lib_height']);
		$libsize_text    = new XoopsFormText(_MD_AM_LIBMAX, "lib_maxsize", 7, 7, $bcoosConfig['lib_maxsize']);
		$lib_tray        = new XoopsFormElementTray(_MD_AM_LIBCONF, "<br />");
		$lib_tray->addElement($libuse_radio);
		$lib_tray->addElement($libupload_radio);
		$lib_tray->addElement($libwidth_text);
		$lib_tray->addElement($libheight_text);
		$lib_tray->addElement($libsize_text);
		$auto_register        = new XoopsFormRadioYN(_MD_AM_AUTOREGISTER, "auto_register", $bcoosConfig['auto_register'], _YES,_NO);
		$newuser_radio        = new XoopsFormRadioYN("", "new_user_notify", $bcoosConfig['new_user_notify'], _YES,_NO);
		$newuser_group_select = new XoopsFormSelectGroup(_MD_AM_NOTIFYTO, "new_user_notify_group", false, $bcoosConfig['new_user_notify_group'], 1, false);
		$newuser_tray         = new XoopsFormElementTray(_MD_AM_NEWUNOTIFY, "<br />");
		$newuser_tray->addElement($newuser_radio);
		$newuser_tray->addElement($newuser_group_select);
		$sdelete_radio  = new XoopsFormRadioYN(_MD_AM_SELFDELETE, "self_delete", $bcoosConfig['self_delete'], _YES,_NO);
		$loading_radio  = new XoopsFormRadioYN(_MD_AM_LOADINGIMG, "display_loading_img", $bcoosConfig['display_loading_img'], _YES,_NO);
		$gzip_radio     = new XoopsFormRadioYN(sprintf(_MD_AM_USEGZIP,phpversion()), "gzip_compression", $bcoosConfig['gzip_compression'], _YES,_NO);
		$unamelv_select = new XoopsFormSelect(_MD_AM_UNAMELVL, "uname_test_level", $bcoosConfig['uname_test_level']);
		$unamelv_select->addOptionArray(array(0=>_MD_AM_STRICT,1=>_MD_AM_MEDIUM,2=>_MD_AM_LIGHT));
		$ucookie_text      = new XoopsFormText(_MD_AM_USERCOOKIE, "cookie_name", 50, 100, $bcoosConfig['cookie_name']);
		$scookie_text      = new XoopsFormText(_MD_AM_SESSCOOKIE, "session_name", 50, 100, $bcoosConfig['session_name']);
		$scookieold_hidden = new XoopsFormHidden("old_session_name", $bcoosConfig['session_name']);
		$sexpire_text      = new XoopsFormText(_MD_AM_SESSEXPIRE, "session_expire", 15, 8, $bcoosConfig['session_expire']);
		$suse_sessions     = new XoopsFormRadioYN(_MD_AM_SESSUSE, "use_sessions", $bcoosConfig['use_sessions'], _YES, _NO);
		$suse_old_hidden   = new XoopsFormHidden("old_session_use", $bcoosConfig['use_sessions']);
		$banner_radio      = new XoopsFormRadioYN(_MD_AM_BANNERS, "banners", $bcoosConfig['banners'], _YES, _NO);
		$debug_ops[] = ($bcoosConfig['debug_mode'] & 1)  ? 1  : 0;
		$debug_ops[] = ($bcoosConfig['debug_mode'] & 2)  ? 2  : 0;
		$debug_ops[] = ($bcoosConfig['debug_mode'] & 4)  ? 4  : 0;
		$debug_ops[] = ($bcoosConfig['debug_mode'] & 8)  ? 8  : 0;
		$debug_ops[] = ($bcoosConfig['debug_mode'] & 16) ? 16 : 0;
		$debug_radio   = new XoopsFormCheckBox(_MD_AM_DEBUGMODE, "debug_mode", $debug_ops, 1);
		$debug_options = array(
						"1" =>_MD_AM_DBGERR,
						"2" =>_MD_AM_DBGTIME,
						"4" =>_MD_AM_DBGINFO,
						"8" =>_MD_AM_DBGLOG,
						"16"=>_MD_AM_DBGVIS);
		$debug_radio->addOptionArray($debug_options);
		$cache_text = new XoopsFormSelect(_MD_AM_CACHETIME, "cache_time", $bcoosConfig['cache_time']);
		$cache_text->addOptionArray(array(0=>_OFF, 300=>5, 600=>10, 900=>15, 1800=>30, 3600=>60, 5400=>90, 7200=>120, 10800=>180));
		$cmode_select = new XoopsFormSelect(_MD_AM_COMMODE, "com_mode", $bcoosConfig['com_mode']);
		$cmode_select->addOptionArray(array("0"=>_NOCOMMENTS, "flat"=>_FLAT, "thread"=>_THREADED));
		$corder_select = new XoopsFormSelect(_MD_AM_COMORDER, "com_order", $bcoosConfig['com_order']);
		$corder_select->addOptionArray(array("0"=>_OLDESTFIRST, "1"=>_NEWESTFIRST));
		$avallow_radio = new XoopsFormRadioYN(_MD_AM_AVATARALLOW, "avatar_allow_upload", $bcoosConfig['avatar_allow_upload'], _YES, _NO);
		$avwidth_text  = new XoopsFormText(_MD_AM_AVATARW, "avatar_width", 4, 4, $bcoosConfig['avatar_width']);
		$avheight_text = new XoopsFormText(_MD_AM_AVATARH, "avatar_height", 4, 4, $bcoosConfig['avatar_height']);
		$avsize_text   = new XoopsFormText(_MD_AM_AVATARMAX, "avatar_maxsize", 7, 7, $bcoosConfig['avatar_maxsize']);
		$av_tray       = new XoopsFormElementTray(_MD_AM_AVATARCONF, "<br />");
		$av_tray->addElement($avallow_radio);
		$av_tray->addElement($avwidth_text);
		$av_tray->addElement($avheight_text);
		$av_tray->addElement($avsize_text);
		$htmlarray    = XoopsLists::getHtmlList();
		$atags        = array();
		$atags        = explode("|", $bcoosConfig['admin_html']);
		$ahtml_select = new XoopsFormSelect(_MD_AM_ADMTAGS, "atags", $atags, 10, true);
		$ahtml_select->addOptionArray($htmlarray);
		$utags        = array();
		$utags        = explode("|", $bcoosConfig['user_html']);
		$uhtml_select = new XoopsFormSelect(_MD_AM_USRTAGS, "utags", $utags, 10, true);
		$uhtml_select->addOptionArray($htmlarray);
		$html_tray = new XoopsFormElementTray(_MD_AM_DEFHTML, "&nbsp;");
		$html_tray->addElement($ahtml_select);
		$html_tray->addElement($uhtml_select);
		$op_hidden     = new XoopsFormHidden("op", "save");
		$submit_button = new XoopsFormButton("", "button", _GO, "submit");
		$wrap1 =  new XoopsFormLabel("<br /> "," ");
		$wrap2 =  new XoopsFormLabel("<br /> "," ");
		$agree_register  = new XoopsFormRadioYN(_MD_AM_PREF_AGREE, "agree_register", $bcoosConfig['agree_register'], _YES,_NO);
		$agree_register_text  = new  XoopsFormTextArea(_MD_AM_PREF_AGREE_TEXT, "agree_register_text", $bcoosConfig['agree_register_text'], 10, 50);
		$captcha_comments_radio  = new XoopsFormRadioYN(_MD_AM_PREF_CAPTCHA_COMMENTS, "captcha_comments", $bcoosConfig['captcha_comments'], _YES,_NO);
		$icon_select        = new XoopsFormSelectIconset(_MD_AM_ICONSET, "iconset",substr($bcoosConfig['iconset'],0,-1));
		
		$form = new XoopsThemeForm(_MD_AM_SITEPREF, "pref_form", "admin.php?fct=preferences");
		$form->setExtra("enctype='multipart/form-data'");
		$form->addElement($logo_img);
		$form->addElement($title);
		$form->addElement($description);
		$form->addElement($adminmail_text);
		$form->addElement($mod_select);
		$form->addElement($lang_select);
		$form->addElement($theme_tray);
		$form->addElement($icon_select);
		$form->addElement($defaulttz_select);
		$form->addElement($loading_radio);
		$form->addElement($banner_radio);
		$form->addElement($cmode_select);
		$form->addElement($corder_select);
			$form->addElement($wrap1);
		$form->addElement($allow_register);
		$form->addElement($agree_register);
		$form->addElement($agree_register_text);
		$form->addElement($auto_register);
		$form->addElement($minnpass_text);
		$form->addElement($unamelv_select);
		$form->addElement($img_verify);
		$form->addElement($newuser_tray);
		$form->addElement($av_tray);
		$form->addElement($allowimage_radio);
		$form->addElement($lib_tray);
		$form->addElement($sdelete_radio);
		$form->addElement($max_pms);
		$form->addElement($allowtheme_radio);
		$form->addElement($anon_text);
		$form->addElement($anonpost_radio);
		$form->addElement($captcha_comments_radio);
		$form->addElement($allowhtml_radio);
		$form->addElement($html_tray);
			$form->addElement($wrap2);
		$form->addElement($mail_function);
		$form->addElement($gzip_radio);
		$form->addElement($ucookie_text);
		$form->addElement($scookie_text);
		$form->addElement($scookieold_hidden);
		$form->addElement($sexpire_text);
		$form->addElement($suse_sessions);
		$form->addElement($suse_old_hidden);
		$form->addElement($debug_radio);
		$form->addElement($cache_text);
		$form->addElement($op_hidden);
		$form->addElement($submit_button);
		OpenTable();
		$form->display();
		CloseTable();
	}
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function save_pref(
		$logo_img,
		$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) {
		global $bcoosConfig, $myts, $_COOKIE,$_POST,$_FILES;
		
		
		if ( !empty($_FILES['image']['name']) ) {
		include(XOOPS_ROOT_PATH."/class/upload.class.php");
        $upload = new Upload();
		$upload->setAllowedMimeTypes(".gif|.jpeg|.jpg|.png");
		$upload->setUploadPath(XOOPS_ROOT_PATH."/images");
		$upload->setDestinationFileName('image');
		$upload->setFileName("logo");
		$result = $upload->doUpload();
		
			if ($result) {
					$logourl = $upload->FileName.".".$upload->getFileExtension();
				} else {
					$errors = $upload->getUploadErrors();
					$errorstring = "";
					$errorstring .= "<strong>::Errors occured::</strong><br />\n";
					while(list($filename,$values) = each($errors)) {
						$errorstring .= "File: " . $filename . "<br />";
						$count = count($values);
						for($i=0; $i<$count; $i++) { $errorstring .= "==>" . $values[$i] . "<br />"; }
					}
					redirect_header("admin.php?fct=preferences", 3, $errorstring);
					exit();
				}
		} else {$logourl = $bcoosConfig['logo'];}
		$error = "";
		if ( !function_exists("$mail_function") ) {
		$error .= "<h4>".sprintf(_MD_AM_INVLDMAILFUNC, $mail_function)."</h4>";
		}
		if ( !is_numeric($minpass) ) {
			$error .= "<h4>"._MD_AM_INVLDMINPASS."</h4>";
		}
		if ( !is_numeric($session_expire) ) {
			$error .= "<h4>"._MD_AM_INVLDSEXP."</h4>";
		}
		if ( empty($cookie_name) || preg_match("/[^a-z0-9_-]/", $cookie_name) ) {
		 	$error .= "<h4>"._MD_AM_INVLDUCOOK."</h4>";
		}
		if ( empty($session_name) || preg_match("/[^a-z0-9_-]/i", $session_name) ) {
		 	$error .= "<h4>"._MD_AM_INVLDSCOOK."</h4>";
		}
		if ( empty($adminmail) ) {
		 	$error .= "<h4>"._MD_AM_ADMNOTSET."</h4>";
		}
		if ($error != "") {
			xoops_cp_header();
			echo $error;
			xoops_cp_footer();
			exit();
		}
		$admin_html = "";
		if ( count($atags) > 0 ) {
			foreach ( $atags as $atag ) {
				$admin_html .= $atag."|";
			}
			$admin_html = substr($admin_html, 0, -1);
		}
		$user_html = "";
		if ( count($utags) > 0 ) {
			foreach ( $utags as $utag ) {
				$user_html .= $utag."|";
			}
			$user_html = substr($user_html, 0, -1);
		}
		$debug_size = count($debug_mode);
		for ($i=0;$i<$debug_size;$i++) {
			$debug_out += $debug_mode[$i];
		}
$config = "<"."?php
/*********************************************************************
"._MD_AM_REMEMBER."
"._MD_AM_IFUCANT."
*********************************************************************/
// "._MD_AM_LOGOIMG."
\$bcoosConfig['logo'] = \"".$logourl."\";
// "._MD_AM_TITLE."
\$bcoosConfig['title'] = \"".$myts->makeTboxData4PreviewInForm($title)."\";
// "._MD_AM_DESCRIPTION."
\$bcoosConfig['description'] = \"".$myts->makeTboxData4PreviewInForm($description)."\";
// "._MD_AM_ADMINML."
\$bcoosConfig['adminmail'] = \"".$myts->makeTboxData4PreviewInForm($adminmail)."\";
// "._MD_AM_MAILFUNC."
\$bcoosConfig['mail_function'] = \"".$mail_function."\";
// "._MD_AM_LANGUAGE."
\$bcoosConfig['language'] = \"".$myts->makeTboxData4PreviewInForm($language)."\";
// "._MD_AM_STARTPAGE."
\$bcoosConfig['startpage'] = \"".$myts->makeTboxData4PreviewInForm($startpage)."\";
// "._MD_AM_DTHEME."
\$bcoosConfig['default_theme'] = \"".$myts->makeTboxData4PreviewInForm($default_theme)."\";
// "._MD_AM_ALLOWTHEME." (1="._YES." 0="._NO.")
\$bcoosConfig['allow_theme'] = ".intval($allow_theme).";
// "._MD_AM_ANONNAME."
\$bcoosConfig['anonymous'] = \"".$myts->makeTboxData4PreviewInForm($anonymous)."\";
// "._MD_AM_MINPASS."
\$bcoosConfig['minpass'] = ".intval($minpass).";
// "._MD_AM_ANONPOST." (1="._YES." 0="._NO.")
\$bcoosConfig['anonpost'] = ".intval($anonpost).";
// "._MD_AM_MAXPMS."
\$bcoosConfig['max_pms'] = ".intval($max_pms).";
// "._MD_AM_ALLOWHTML." (1="._YES." 0="._NO.")
\$bcoosConfig['allow_html'] = ".intval($allow_html).";
// "._MD_AM_LIBUSE." (1="._YES." 0="._NO.")
\$bcoosConfig['allow_library'] = ".intval($allow_library).";
// "._MD_AM_LIBUPLOAD." (1="._YES." 0="._NO.")
\$bcoosConfig['lib_allow_upload'] = ".intval($lib_allow_upload).";
// "._MD_AM_LIBW."
\$bcoosConfig['lib_width'] = ".intval($lib_width).";
// "._MD_AM_LIBH."
\$bcoosConfig['lib_height'] = ".intval($lib_height).";
// "._MD_AM_LIBMAX."
\$bcoosConfig['lib_maxsize'] = ".intval($lib_maxsize).";
// "._MD_AM_ALLOWIMAGE." (1="._YES." 0="._NO.")
\$bcoosConfig['allow_image'] = ".intval($allow_image).";
// "._MD_AM_ALLOW_REGISTER." (1="._YES." 0="._NO.")
\$bcoosConfig['allow_register'] = ".intval($allow_register).";
// "._MD_AM_VERIFY_IMG." (1="._YES." 0="._NO.")
\$bcoosConfig['img_verify'] = ".intval($img_verify).";
// "._MD_AM_AUTOREGISTER." (1="._YES." 0="._NO.")
\$bcoosConfig['auto_register'] = ".intval($auto_register).";
// "._MD_AM_NEWUNOTIFY." (1="._YES." 0="._NO.")
\$bcoosConfig['new_user_notify'] = ".intval($new_user_notify).";
// "._MD_AM_NOTIFYTO."
\$bcoosConfig['new_user_notify_group'] = ".intval($new_user_notify_group).";
// "._MD_AM_SELFDELETE." (1="._YES." 0="._NO.")
\$bcoosConfig['self_delete'] = ".intval($self_delete).";
// "._MD_AM_LOADINGIMG." (1="._YES." 0="._NO.")
\$bcoosConfig['display_loading_img'] = ".intval($display_loading_img).";
// ".sprintf(_MD_AM_USEGZIP,phpversion())." (1="._YES." 0="._NO.")
\$bcoosConfig['gzip_compression'] = ".intval($gzip_compression).";
// "._MD_AM_UNAMELVL."  ("._MD_AM_STRICT."=0 "._MD_AM_MEDIUM."=1 "._MD_AM_LIGHT."=2)
\$bcoosConfig['uname_test_level'] = ".intval($uname_test_level).";
// "._MD_AM_USERCOOKIE."
\$bcoosConfig['cookie_name'] = \"".$cookie_name."\";
// "._MD_AM_SESSCOOKIE."
\$bcoosConfig['session_name'] = \"".$session_name."\";
// "._MD_AM_SESSEXPIRE."
\$bcoosConfig['session_expire'] = ".intval($session_expire).";
// "._MD_AM_SESSUSE."
\$bcoosConfig['use_sessions'] = ".intval($use_sessions).";
// "._MD_AM_SERVERTZ."
\$bcoosConfig['server_TZ'] = \"".(date('Z')/3600)."\";
// "._MD_AM_DEFAULTTZ."
\$bcoosConfig['default_TZ'] = \"".$default_TZ."\";
// "._MD_AM_BANNERS." (1="._YES." 0="._NO.")
\$bcoosConfig['banners'] = ".intval($banners).";
// "._MD_AM_DEBUGMODE."
\$bcoosConfig['debug_mode'] = ".intval($debug_out).";
// "._MD_AM_CACHETIME."
\$bcoosConfig['cache_time'] = ".intval($cache_time).";
// "._MD_AM_COMMODE." (0="._NOCOMMENTS." flat="._FLAT." thread="._THREADED.")
\$bcoosConfig['com_mode'] = \"".$com_mode."\";
// "._MD_AM_COMORDER." (0="._OLDESTFIRST." 1="._NEWESTFIRST.")
\$bcoosConfig['com_order'] = ".intval($com_order).";
// "._MD_AM_AVATARALLOW." (1="._YES." 0="._NO.")
\$bcoosConfig['avatar_allow_upload'] = ".intval($avatar_allow_upload).";
// "._MD_AM_AVATARW."
\$bcoosConfig['avatar_width'] = ".intval($avatar_width).";
// "._MD_AM_AVATARH."
\$bcoosConfig['avatar_height'] = ".intval($avatar_height).";
// "._MD_AM_AVATARMAX."
\$bcoosConfig['avatar_maxsize'] = ".intval($avatar_maxsize).";
// "._MD_AM_ADMHTML."
\$bcoosConfig['admin_html'] = \"".$admin_html."\";
// "._MD_AM_USRHTML."
\$bcoosConfig['user_html'] = \"".$user_html."\";
// agree to register
\$bcoosConfig['agree_register'] = \"".$agree_register."\";
// agree register text
\$bcoosConfig['agree_register_text'] = \"".$agree_register_text."\";
// captcha comments?
\$bcoosConfig['captcha_comments'] = \"".$captcha_comments."\";
// captcha comments?
\$bcoosConfig['iconset'] = \"".$iconset."_\";
?".">";
		$file = fopen(XOOPS_ROOT_PATH."/modules/system/cache/config.php", "w");
		if ( -1 != fwrite($file, $config) ) {
			if ( ( $session_name != $old_session_name) || ($use_sessions !=  $old_session_use) ) {
				global $_SESSION, $_COOKIE;
				if ($use_sessions == 1) {
					if (session_is_registered($old_session_name)) {
						$_SESSION[$session_name] = $_SESSION[$old_session_name];
						session_unregister($old_session_name);
						} else {
							session_start();
							$_SESSION[$session_name] = $_COOKIE[$old_session_name];
						}
					} else {
						if (session_is_registered($old_session_name)) {
							cookie($session_name, $_SESSION[$old_session_name], 360000);
							} else {
								cookie($session_name, $_COOKIE[$old_session_name], 360000);
								cookie($old_session_name);
							}
					}
			}
		fclose($file);
		redirect_header("admin.php?fct=preferences", 2, _UPDATED);
		exit();
	}
}
	} else {
		redirect_header(XOOPS_URL.'/', 2, _NOPERM);
		exit();
	}
?>
