Ejemplo n.º 1
0
 /**
  *  引入文件
  *
  * @access    public
  * @param     string  $filename  文件名
  * @param     string  $ismake  是否需要编译
  * @return    string
  */
 function IncludeFile($filename, $ismake = 'no')
 {
     global $cfg_df_style;
     $restr = '';
     if ($filename == '') {
         return '';
     }
     if (file_exists(DEDEROOT . "/templets/" . $filename)) {
         $okfile = DEDEROOT . "/templets/" . $filename;
     } else {
         if (file_exists(DEDEROOT . '/templets/' . $cfg_df_style . '/' . $filename)) {
             $okfile = DEDEROOT . '/templets/' . $cfg_df_style . '/' . $filename;
         } else {
             return "无法在这个位置找到: {$filename}";
         }
     }
     //编译
     if ($ismake != "no") {
         require_once DEDEINC . "/channelunit.func.php";
         $dtp = new DedeTagParse();
         $dtp->LoadTemplet($okfile);
         MakeOneTag($dtp, $this->refObj);
         $restr = $dtp->GetResult();
     } else {
         $fp = @fopen($okfile, "r");
         while ($line = fgets($fp, 1024)) {
             $restr .= $line;
         }
         fclose($fp);
     }
     return $restr;
 }
Ejemplo n.º 2
0
    ShowMsg("参数错误!", "-1");
    exit;
}
$isremote = empty($isremote) ? 0 : $isremote;
$serviterm = empty($serviterm) ? "" : $serviterm;
$sm = new SiteMap();
$maplist = $sm->GetSiteMap($dopost);
if ($dopost == "site") {
    $murl = $cfg_cmspath . "/data/sitemap.html";
    $tmpfile = $cfg_basedir . $cfg_templets_dir . "/plus/sitemap.htm";
} else {
    $murl = $cfg_cmspath . "/data/rssmap.html";
    $tmpfile = $cfg_basedir . $cfg_templets_dir . "/plus/rssmap.htm";
}
$dtp = new DedeTagParse();
$dtp->LoadTemplet($tmpfile);
$dtp->SaveTo($cfg_basedir . $murl);
if ($cfg_remote_site == 'Y' && $isremote == 1) {
    if ($serviterm != "") {
        list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
        $config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE');
    } else {
        $config = array();
    }
    if ($ftp->connect($config)) {
        //分析远程文件路径
        $remotefile = $murl;
        $localfile = '..' . $remotefile;
        $remotedir = preg_replace('#[^\\/]*\\.html#', '', $remotefile);
        $ftp->rmkdir($remotedir);
        if ($ftp->upload($localfile, $remotefile, 'acii')) {