#[加载工厂类]
require_once SYSTEM_ROOT . "/class/factory.php";
$CF = new C_Factory($DB, $prefix, $dbType);
#[启用数据库SESSION]
require_once SYSTEM_ROOT . "/class/db/" . $dbType . "/session.php";
#[加载常用函数信息]
require_once SYSTEM_ROOT . "/include/global.func.php";
#[加载网站常规选项]
if (!file_exists(SYSTEM_ROOT . "/data/system.php")) {
    echo "Not Set System.";
    exit;
}
include_once SYSTEM_ROOT . "/data/system.php";
if (!$system["siteurl"] || substr(strtolower($msg), 0, 7) != "http://") {
    #[计算URL]
    $__siteurl = GetSystemUrl();
    if ($system["urlseo"] == "urlseo") {
        #[判断URL]
        if (substr($__siteurl, -5) == ".php/") {
            $tmparray = explode("/", $__siteurl);
            $count = count($tmparray) - 2;
            $__siteurl = "";
            for ($i = 0; $i < $count; $i++) {
                $__siteurl .= $tmparray[$i] . "/";
            }
            unset($tmparray);
        }
    }
    $system["siteurl"] = $__siteurl;
}
#[定义网址]
function FckToHtml($msg)
{
    if (!$msg) {
        return false;
    }
    $url = GetSystemUrl();
    $msg = str_replace($url, "", $msg);
    $imgArray = array();
    preg_match_all("/src=[\"|'| ]((.*)\\.(gif|jpg|jpeg|bmp|png|swf))/isU", $msg, $imgArray);
    $imgArray = array_unique($imgArray[1]);
    $count = count($imgArray);
    if ($count < 1) {
        return $msg;
    }
    foreach ($imgArray as $key => $value) {
        $value = trim($value);
        if (strpos($value, "http://") === false && $value) {
            $msg = str_replace($value, $url . $value, $msg);
        }
    }
    return $msg;
}
#[附件上传]
include SYSTEM_ROOT . "/class/xu.php";
$myUpload = new XUpload_class();
$myUpload->SetOverlayMode(true);
// 覆盖同名文件
$myUpload->InitParameters();
if ($myUpload->IsUploadFile()) {
    $filename = $myUpload->CreateFileName("./upfiles/xu_temp", "", $_POST['xu_filename']);
    if ($filename != "") {
        $filename = $myUpload->SaveToFile($filename);
    }
}
$list = array();
$list = $FS->Dir("upfiles/xu_temp/");
$return_msg = "";
$system_url = GetSystemUrl();
$C_Upfile = $CF->build("upfile");
foreach ($list as $key => $value) {
    $value = trim($value);
    if ($value) {
        $tmpname = basename($value);
        $extfile = substr($value, -3);
        $extfile = strtolower($extfile);
        if ($extfile == ".gz") {
            $extfile = "tar.gz";
        }
        $filename = $system_time . "_" . rand(0, 100) . "." . $extfile;
        $mypath = "upfiles/" . date("Ym/d/", $system_time);
        $FS->Move($value, $mypath . $filename);
        if (strpos("jpg,gif,png", $extfile) !== false) {
            #[生成缩略图]