Example #1
0
function makeprenext() {  }
******************************/
if ($dopost == 'makeprenext') {
    require_once DEDEINC . '/arc.archives.class.php';
    $aid = intval($aid);
    $preRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id<{$aid} AND arcrank>-1 AND typeid='{$typeid}' ORDER BY id DESC");
    $nextRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id>{$aid} AND arcrank>-1 AND typeid='{$typeid}' ORDER BY id ASC");
    if (is_array($preRow)) {
        $envs['aid'] = $preRow['id'];
        $arc = new Archives($preRow['id']);
        $arc->MakeHtml();
    }
    if (is_array($nextRow)) {
        $envs['aid'] = $nextRow['id'];
        $arc = new Archives($nextRow['id']);
        $arc->MakeHtml();
    }
    if (empty($nextdo)) {
        ShowMsg("<b>完成上下篇文档更新任务!完成所有更新任务!</b>", "close::tgtable");
        exit;
    } else {
        $jumpurl = GetNextUrl();
        ShowMsg("完成下篇文档更新任务! 继续执行其它任务...", $jumpurl, 0, 500);
        exit;
    }
}
/******************************
//更新主页的任务
function makeindex() {  }
******************************/
if ($dopost == 'makeindex') {
/**
 *  创建指定ID的文档
 *
 * @access    public
 * @param     string  $aid  文档ID
 * @param     string  $ismakesign  生成标志
 * @param     int  $isremote  是否远程
 * @return    string
 */
function MakeArt($aid, $mkindex = FALSE, $ismakesign = FALSE, $isremote = 0)
{
    global $envs, $typeid;
    require_once DEDEINC . '/arc.archives.class.php';
    if ($ismakesign) {
        $envs['makesign'] = 'yes';
    }
    $arc = new Archives($aid);
    $reurl = $arc->MakeHtml($isremote);
    return $reurl;
}
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)) {
        exit('Error:None FTP Connection!');
    }
}
while ($row = $dsql->GetObject('out')) {
    $tjnum++;
    $id = $row->id;
    $ac = new Archives($id);
    $rurl = $ac->MakeHtml($isremote);
}
$t2 = ExecTime();
$t2 = $t2 - $est1;
$ttime = time() - $sstime;
$ttime = number_format($ttime / 60, 2);
//返回提示信息
$tjlen = $totalnum > 0 ? ceil($tjnum / $totalnum * 100) : 100;
$dvlen = $tjlen * 2;
$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:{$dvlen};height:15;background-color:#829D83'></div></div>";
if ($cfg_remote_site == 'Y' && $isremote == "1") {
    $tjsta .= "<br/><font color='red'>您已开启远程发布功能,生成速度会比较慢,请您耐心等待..</font>";
}
$tjsta .= "<br/>本次用时:" . number_format($t2, 2) . ",总用时:{$ttime} 分钟,到达位置:" . ($startdd + $pagesize) . "<br/>完成创建文件总数的:{$tjlen} %,继续执行任务...";
//速度测试
/*
 $MaiSql = ereg_replace('@([a-z0-9]{1,})@', '', $MaiSql);
 $AddSql = ereg_replace('@([a-z0-9]{1,})@', '', $AddSql);
 if (!$dsql->ExecuteNoneQuery($MaiSql)) {
     $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='{$aid}' ");
 } else {
     if (!$dsql->ExecuteNoneQuery($AddSql)) {
         $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='{$aid}' ");
         $dsql->ExecuteNoneQuery("Delete From `{$Maitable}` where id='{$aid}' ");
     } else {
         if ($make) {
             require_once DEDEINC . "/arc.archives.class.php";
             $ac = new Archives($aid);
             $rurl = $ac->MakeHtml();
             $ac->Close();
             $ac = new Archives($aid - 1);
             $rurl = $ac->MakeHtml();
             $ac->Close();
             $dsql->ExecuteNoneQuery("Update `#@__co_note` set cotime='" . time() . "' where nid='{$nid}'; ");
         }
         //更新数据
         $row = $dsql->GetOne("SELECT a.id,a.title,a.click,a.typeid,b.body,c.typename,c.zuozhe,c.bookclick,c.bookclickm,c.bookclickw,c.tuijian,c.tuijianm,c.tuijianw,c.booksize,c.lastclick,c.lasttuijian,c.startdate,c.reid,d.typename as retypename FROM `{$Maitable}` a left join `{$Addtable}` b on(a.id=b.aid) left join `#@__arctype` c on(a.typeid=c.id) left join `#@__arctype` d on(c.reid=d.id) WHERE a.id='{$aid}'");
         if ($row) {
             $txt_filename = $row['zuozhe'] . "-" . $row['typename'];
             $typename = $row['typename'];
             $txt_comtens = "";
             $startdatesql = "";
             $txt_title = $row['title'];
             $treid = $row['reid'];
             $tretypename = $row['retypename'];
             $updatetime = time();
             $lastclick = $row['lastclick'];
function MakeArt($aid,$mkindex=true,$upcache=true)
{
	global $cfg_makeindex,$cfg_basedir,$cfg_templets_dir,$cfg_df_style,$cfg_up_prenext,$typeid,$envs,$typeid;
	include_once(DEDEADMIN."/../include/inc_archives_view.php");
	if(!$upcache) $envs['nocache'] = true;
	$arc = new Archives($aid);
  $reurl = $arc->MakeHtml();
  if($mkindex)
  {
  	//更新上下篇文章
  	if($cfg_up_prenext=='Y' && !empty($typeid))
  	{
     		$preRow =  $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And ID>".($aid-1000)." And arcrank>-1 And typeid='$typeid' order by ID desc");
        $nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID>$aid And ID<".($aid+1000)." And arcrank>-1 And typeid='$typeid' order by ID asc");
    		
    		if(is_array($preRow)){
  	   			$arc = new Archives($preRow['ID']);
       			$arc->MakeHtml();
    		}
    		if(is_array($nextRow)){
  	   		$arc = new Archives($nextRow['ID']);
       		$arc->MakeHtml();
    		}
  	}
  	//更新主页
  	if($cfg_makeindex=='Y')
  	{
  			$pv = new PartView();
  			$row = $pv->dsql->GetOne("Select * From #@__homepageset");
  			$templet = str_replace("{style}",$cfg_df_style,$row['templet']);
  			$homeFile = dirname(__FILE__)."/../".$row['position'];
	  		$homeFile = str_replace("\\","/",$homeFile);
	  		$homeFile = str_replace("//","/",$homeFile);
	  		$fp = fopen($homeFile,"w") or die("主页文件:{$homeFile} 没有写权限!");
	  		fclose($fp);
	  		$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
	  		$pv->SaveToHtml($homeFile);
  	}
  }
  return $reurl;
}
 public function refreshThreads($aidList)
 {
     foreach ($aidList as $aid) {
         $arc = new Archives($aid);
         if ($arc) {
             $arc->MakeHtml();
         }
     }
 }
/**
 *  创建指定ID的文档
 *
 * @param     int  $aid
 * @param     bool  $ismakesign
 * @return    string
 */
function MakeArt($aid, $ismakesign = FALSE)
{
    global $cfg_makeindex, $cfg_basedir, $cfg_templets_dir, $cfg_df_style;
    include_once DEDEINC . '/arc.archives.class.php';
    if ($ismakesign) {
        $envs['makesign'] = 'yes';
    }
    $arc = new Archives($aid);
    $reurl = $arc->MakeHtml();
    if (isset($typeid)) {
        $preRow = $arc->dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id<{$aid} AND arcrank>-1 AND typeid='{$typeid}' order by id desc");
        $nextRow = $arc->dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id>{$aid} AND arcrank>-1 AND typeid='{$typeid}' order by id asc");
        if (is_array($preRow)) {
            $arc = new Archives($preRow['id']);
            $arc->MakeHtml();
        }
        if (is_array($nextRow)) {
            $arc = new Archives($nextRow['id']);
            $arc->MakeHtml();
        }
    }
    return $reurl;
}
function MakeArt($aid,$checkLike=false)
{
	include_once(dirname(__FILE__)."/../../include/inc_archives_view.php");
	$arc = new Archives($aid);
  $reurl = $arc->MakeHtml();
  return $reurl;
}