<?php
# Subroutine: adm_blist_resync.php called by Admin.php
# Xinfeng Chen, 2002.11.19
# Input: None

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');
require_once('core/base_memo_file.php');
require_once('core/class_board.php');

$oBrdLst=new CBoardList;
$oBrd=new CBoard;

$blistpath=CForumBase::getFilePath('BLIST',$bid);
$blistpath=dirname($blistpath);

$dir=opendir($blistpath);
$oBrdLst->reset();

while ($file=readdir($dir)){
 if($file == '.' || $file == '..' || $file=='recycle' || !is_dir("$blistpath/$file")){continue;}

 $oBrdLst->appendNew();
 $oBrdLst->id=$file;
 if($oBrd->load($file)){
  $oBrdLst->name=$oBrd->name;
  $oBrdLst->desc=$oBrd->desc;
  $oBrdLst->secret=$oBrd->secret;
 }
 $oBrdLst->update();
}

$oBrdLst->store();
closedir($dir);

#--- Print Result ---
msgBox('论坛主列表已经重新生成！',mINFORMATION,'操作成功','?cmd=board','返回论坛管理');

?>