123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <?php
- require(dirname(__FILE__).'/config.php');
- $dopost = (!isset($dopost) ? '' : $dopost);
- function GetNextUrl($notallowArr = array('dopost', 'f', 'del'))
- {
- $reurl = "task_do.php?f=0";
- foreach($_GET as $k=>$v)
- {
- if($k=='nextdo')
- {
- $nextdo = '';
- $nextdos = explode(',', $GLOBALS[$k]);
- if(isset($nextdos[1]))
- {
- for($i=1; $i < count($nextdos); $i++)
- {
- if( trim($nextdos[$i]) == '' ) continue;
- $nextdo .= ($nextdo=='' ? $nextdos[$i] : ','.$nextdos[$i]);
- }
- }
-
- if( in_array('morejob', $notallowArr) )
- {
- $reurl .= "&doposttmp=".$nextdos[0];
- if($nextdo != '') $reurl .= "&nextdotmp=$nextdo";
- }
- else
- {
- $reurl .= "&dopost=".$nextdos[0];
- if($nextdo != '') $reurl .= "&nextdo=$nextdo";
- }
- }
- else if( in_array($k, $notallowArr) )
- {
- continue;
- }
- else
- {
- $reurl .= "&{$k}=".urlencode($GLOBALS[$k]);
- }
- }
- return $reurl;
- }
- 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();
- }
- }
- if($dopost=='makeindex')
- {
- require_once(DEDEINC.'/arc.partview.class.php');
- $envs = $_sys_globals = array();
- $envs['aid'] = 0;
- $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("//", "/", str_replace("\\", "/", $homeFile));
- $fp = fopen($homeFile, 'w') or die("无法更新网站主页到:$homeFile 位置");
- fclose($fp);
- $tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet;
- if(!file_exists($tpl))
- {
- $tpl = $cfg_basedir.$cfg_templets_dir.'/default/index.htm';
- if(!file_exists($tpl)) exit("无法找到主页模板:$tpl ");
- }
- $GLOBALS['_arclistEnv'] = 'index';
- $pv->SetTemplet($tpl);
- $pv->SaveToHtml($homeFile);
- $pv->Close();
- if( empty($nextdo) )
- {
- ShowMsg("<b>完成主页更新任务!完成所有更新任务!</b>", "close::tgtable");
- exit();
- }
- else
- {
- $jumpurl = GetNextUrl();
- ShowMsg("完成主页更新! 现在跳转到其它更新任务...", $jumpurl,0,500);
- exit();
- }
- }
- else if($dopost=='makeparenttype')
- {
- require_once(DEDEDATA."/cache/inc_catalog_base.inc");
- require_once(DEDEINC.'/arc.listview.class.php');
- $notallowArr = array('dopost', 'f', 'del', 'curpage', 'morejob');
- $jumpurl = GetNextUrl($notallowArr);
-
- if( empty($typeid) )
- {
- ShowMsg("<b>完成栏目更新任务!完成所有更新任务!</b>", "close::tgtable");
- exit();
- }
- $topids = explode(',', GetTopids($typeid));
- if(empty($curpage)) $curpage = 0;
- $tid = $topids[$curpage];
-
- if(isset($cfg_Cs[$tid]) && $cfg_Cs[$tid][1]>0)
- {
- require_once(DEDEINC."/arc.listview.class.php");
- $lv = new ListView($tid);
- $lv->CountRecord();
- $lv->MakeHtml();
- $lv->Close();
- }
- else
- {
- require_once(DEDEINC."/arc.sglistview.class.php");
- $lv = new SgListView($tid);
- $lv->CountRecord();
- $lv->MakeHtml();
- $lv->Close();
- }
-
- if($curpage >= count($topids)-1)
- {
- if( !empty($doposttmp) )
- {
- $jumpurl = preg_replace("#doposttmp|nextdotmp#", 'del', $jumpurl);
- $jumpurl .= "&dopost={$doposttmp}&nextdo={$nextdotmp}";
- ShowMsg("完成栏目:{$tid} 更新!<br /><b>完成栏目更新任务,继续执行后续任务...</b>", $jumpurl,0,500);
- exit();
- }
- else
- {
- ShowMsg("完成栏目:{$tid} 更新!<br /><b>完成栏目更新任务,完成所有更新任务!</b>", "close::tgtable");
- exit();
- }
- }
- else
- {
- $curpage++;
- $jumpurl .= "&curpage={$curpage}&dopost=makeparenttype";
- ShowMsg("完成栏目:{$tid} 更新,继续更新其它栏目...", $jumpurl,0,500);
- exit();
- }
- }
|