<?php
# Subroutine: adm_list_submit.php called by Admin.php
# Xinfeng Chen, 2002.11.28
# Input: $f_list

require_once('bin/config.php');
require_once('admin/adm.inc');

#--- Validate dministrator ---
include('admin/adm_validate.php');
if(!$adm_validated){jumpTo('admin.php?cmd=logon'); exit;}

#--- Start Processing ---
require_once('core/class_forum_base.php');
CForumBase::setFileBase("$filepath");
require_once('core/base_array_file.php');
require_once('core/class_board_list.php');

$oBrdLst=new CBoardList;
$oNewLst=new CBoardList;
$oBrdLst->load();
$oNewLst->reset();

$f_list=stripslashes($f_list);
$f_list=str_replace("\r",'',$f_list);
$items=explode("\n",$f_list);

foreach($items as $item){
 $item=trim($item);
 if($item==''){continue;}
 if(substr($item,0,2)=='--'){
  $oNewLst->appendNew();
  $oNewLst->id=$item;
  $oNewLst->secret=$oNewLst->name=$oNewLst->desc='';
  $oNewLst->update();
 }elseif($oBrdLst->find($item)){
  $oNewLst->appendNew();
  $oNewLst->id=$item;
  $oNewLst->secret=$oBrdLst->secret;
  $oNewLst->name=$oBrdLst->name;
  $oNewLst->desc=$oBrdLst->desc;
  $oNewLst->update();
 }else{
  msgBox("论坛ID [$item] 错误！",mCRITICAL,'论坛检验错误'); exit;
 }
}

if($oNewLst->store('community')){
 msgBox('已经成功更新论坛列表。',mINFORMATION,'更新成功','?cmd=list','返回论坛列表');
}else{
 msgBox('资料保存错误！',mCRITICAL,'更新错误');
}

?>