<?php 
header("Content-Type: text/html; charset=gb2312");
require_once(dirname(__FILE__)."/config.php");
CheckPurview('sys_Edit');
if(empty($action)) $action = "";
$needDir = "$cfg_templets_dir|
$cfg_templets_dir/system|
$cfg_templets_dir/plus|
$cfg_templets_dir/default|
$cfg_plus_dir|
$cfg_plus_dir/js|
$cfg_plus_dir/rss|
$cfg_plus_dir/cache|
$cfg_medias_dir|
$cfg_image_dir|
$ddcfg_image_dir|
$cfg_user_dir|
$cfg_soft_dir|
$cfg_other_medias|
$cfg_cmspath/include|
$cfg_cmspath/freelist|
$cfg_cmspath/include/textdata|
$cfg_cmspath/include/sessions|
$cfg_cmspath/include/cache|
$cfg_cmspath/include/cache/user|
$cfg_special|
$cfg_member_dir/templets|
$cfg_cmspath$cfg_arcdir";
if(($isSafeMode || $cfg_ftp_mkdir=='是') && $cfg_ftp_host==""){
	echo "由于你的站点的PHP配置存在限制，程序只能通过FTP形式进行目录操作，因此你必须在后台指定FTP相关的变量！<br>";
	echo "<a href='sys_info.php'>&lt;&lt;修改系统参数&gt;&gt;</a>";
	exit();
}
if($action==""){
	echo "本程序将检测下列目录是否存在，或者是否具有写入的权限，并尝试创建或更改：<br>";
	echo "（如果你的主机使用的是windows系统，你无需进行此操作）<br>";
	echo "'/include' 目录和 '当前目录/templets' 文件夹请你在FTP中手工更改权限为可写入(0777)<br>";
	echo "<pre>".str_replace('|','',$needDir)."</pre>";
	echo "<a href='testenv.php?action=ok'>&lt;&lt;开始检测&gt;&gt;</a> &nbsp; <a href='index_body.php'>&lt;&lt;返回主页&gt;&gt;</a>";
}else{
	$needDirs = explode('|',$needDir);
	$needDir = "";
	foreach($needDirs as $needDir){
		$needDir = trim($needDir);
		$needDir = str_replace("\\","/",$needDir);
		$needDir = ereg_replace("/{1,}","/",$needDir);
		if(CreateDir($needDir)) echo "成功更改或创建：{$needDir} <br>";
		else echo "更改或创建目录：{$needDir} <font color='red'>失败！</font> <br>";
	}
	echo "<br>如果发现更改或创建错误的项目，请<a href='testenv.php?action=ok&play=".mytime()."'><u>重试</u></a>或手动登陆到FTP更改相关目录的权限为777或666<br>";
	echo "<br><a href='index_body.php'>&lt;&lt;返回主页&gt;&gt;</a>";
	CloseFtp();
}

?>