<?php
/**
* 此模块用于设置 URL Rewrite(伪静态)。
*
* @package 		dvphp
* @author		xiaodu@dv
* @version		$Revision: 1.0 beta $
* @date 		$Date: 2006/11/06 $
* @copyright 	http://p.dvbbs.net/license.html
*
*/
ini_set('display_errors','1');
define('THIS_SCRIPT', 'fulltext_settings');
require_once 'global.php';
require INC_PATH.'BoardCache.class.php';
require INC_PATH.'FileHandler.class.php';
checklogin();

$lang = load_lang($lang, 'bogushtml_settings' );
head();
if ( strpos($sysinfo['flag'],'57,') === false ){
	show_msg($lang['readme_tit'],$lang['error.str1'],0,'','','','');
	exit;
}
if ('save_settings' === $doaction) {
	if (!empty($_POST['bogushtml_settings'])) {
		$forum_settings = $db->scalar("SELECT forum_setting FROM {$dv}setup");
		$arrtmp1 = explode('|||', $forum_settings);
		$arrtmp2 = explode(',', $arrtmp1[1]);
		
		//add by hj 20071217
        $brs=$db->getResultSet("SELECT boardid,boardname FROM {$dv}board");
        foreach ($brs as $rs){
        	$rs['boardid']=intval($rs['boardid']);
        	$rs['boardname']=str_replace(array(',','@'),array('',''),$rs['boardname']);
        	$boardin[]=$rs['boardid'].'@'.$rs['boardname'];
        }
        $boardins=join(';',$boardin);
        //End add by hj 20071217
		$arrtmp2[102] = implode('|', $_POST['bogushtml_settings']);
		$arrtmp2[102].='|'.$boardins."|".strval($_POST['bogushtml_settings_domain']);
		$arrtmp1[1] = implode(',', $arrtmp2);
		$forum_settings = implode('|||', $arrtmp1);
        
		$db->query("UPDATE {$dv}setup SET forum_setting='".$db->escape_string($forum_settings)."'");
		require_once INC_PATH.'BoardCache.class.php';
		$objcache =& new BoardCache($db);
		$objcache->createForumSetting();
		$objcache->createmailconfig();
		unset($objcache);
		show_msg($lang['rewrite_settings.title'], $lang['rewrite_settings.str1'], 1, '', '', $lang['url'], $lang['comback']);
	} else {
		show_msg($lang['rewrite_settings.title'], $lang['rewrite_settings.err1'], 1, '', '', $lang['url'], $lang['comback']);
	}
	exit;
} else {
}
require printout('bogushtml_settings');
footer();
?>