function ac_xml() { global $cfg_basedir, $cfg_cmspath; require_once DEDEINC . "/arc.partview.class.php"; $murl = $cfg_cmspath . "/sitemap.xml"; $tmpfile = SEOTEMPLETS . "/admin/sitemap.xml"; $pv = new PartView(); $pv->SetTemplet($tmpfile); $pv->SaveToHtml($cfg_basedir . $murl); echo "<a href='{$murl}' target='_blank'>成功更新文件: {$murl} 浏览...</a>"; exit; }
function lib_mytag(&$ctag, &$refObj) { $attlist = "typeid|0,name|,ismake|no"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if (trim($ismake) == '') { $ismake = 'no'; } $body = lib_GetMyTagT($refObj, $typeid, $name, '#@__mytag'); //编译 if ($ismake == 'yes') { require_once DEDEINC . '/arc.partview.class.php'; $pvCopy = new PartView($typeid); $pvCopy->SetTemplet($body, "string"); $body = $pvCopy->GetResult(); } return $body; }
/** * php5构造函数 * * @access public * @param int $aid 内容ID * @return string */ function __construct($aid) { global $cfg_basedir, $cfg_templets_dir, $cfg_df_style, $envs; $this->dsql = $GLOBALS['dsql']; $this->dtp = new DedeTagParse(); $this->dtp->refObj = $this; $this->dtp->SetNameSpace("dede", "{", "}"); $this->Fields = $this->dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='{$aid}' "); $envs['aid'] = $this->Fields['aid']; //设置一些全局参数的值 foreach ($GLOBALS['PubFields'] as $k => $v) { $this->Fields[$k] = $v; } if ($this->Fields['ismake'] == 1) { $pv = new PartView(); $pv->SetTemplet($this->Fields['body'], 'string'); $this->Fields['body'] = $pv->GetResult(); } $tplfile = $cfg_basedir . str_replace('{style}', $cfg_templets_dir . '/' . $cfg_df_style, $this->Fields['template']); $this->dtp->LoadTemplate($tplfile); $this->ParseTemplet(); }
$pv = new PartView(); $row = $pv->dsql->GetOne(" SELECT * FROM `#@__mytag` WHERE aid='{$aid}' "); if (!is_array($row)) { $myvalues = "<!--\r\ndocument.write('Not found input!');\r\n-->"; } else { $tagbody = ''; if ($row['timeset'] == 0) { $tagbody = $row['normbody']; } else { $ntime = time(); if ($ntime > $row['endtime'] || $ntime < $row['starttime']) { $tagbody = $row['expbody']; } else { $tagbody = $row['normbody']; } } $pv->SetTemplet($tagbody, 'string'); $myvalues = $pv->GetResult(); $myvalues = str_replace('"', '\\"', $myvalues); $myvalues = str_replace("\r", "\\r", $myvalues); $myvalues = str_replace("\n", "\\n", $myvalues); $myvalues = "<!--\r\ndocument.write(\"{$myvalues}\");\r\n-->\r\n"; file_put_contents($cacheFile, $myvalues); /* 使用 file_put_contents替换下列代码提高执行效率 $fp = fopen($cacheFile, 'w'); fwrite($fp, $myvalues); fclose($fp); */ } } include $cacheFile;
function lib_channelartlist(&$ctag, &$refObj) { global $dsql, $envs, $_sys_globals, $cfg_tui; //处理标记属性、innertext $attlist = 'typeid|0,row|20,showhide|no,cacheid|'; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $showhideArr = array('yes' => 0, 'no' => 1, 'both' => -1); $hideflag = $showhideArr[$showhide]; $artlist = ''; //读取固定的缓存块 $cacheid = trim($cacheid); if ($cacheid != '') { $artlist = GetCacheBlock($cacheid); if ($artlist != '') { return $artlist; } } if (empty($typeid)) { $typeid = !empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0; } if ($innertext == '') { $innertext = GetSysTemplets('part_channelartlist.htm'); } $totalnum = $row; if (empty($totalnum)) { $totalnum = 20; } //获得类别ID总数的信息 $typeids = array(); if ($typeid == 0) { $tpsql = " reid<>0 AND ispart<>2 AND ishidden<>{$hideflag} AND channeltype>0 "; } else { if ($typeid == '-1') { $tpsql = " reid=0 and ishidden<>{$hideflag} AND channeltype>0 "; } else { if ($typeid == '-9999999') { $tpsql = " id={$cfg_tui} AND ispart<>2 AND ishidden<>{$hideflag} "; } else { if (!preg_match('#,#', $typeid) && $typeid > 0) { $tpsql = " reid='{$typeid}' AND ispart<>2 AND ishidden<>{$hideflag} "; } else { if ($typeid < 0) { $typeid = 0 - $typeid; $tpsql = " id={$typeid} AND ispart<>2 AND ishidden<>{$hideflag} "; } else { $tpsql = " reid IN({$typeid}) AND ispart<>2 AND ishidden<>{$hideflag} "; } } } } } if ($orderby == '') { $orderbysql = "ORDER BY id"; } else { $orderbysql = "ORDER BY {$orderby}"; } if ($orderway == '') { $orderwaysql = "desc"; } else { $orderwaysql = "{$orderway}"; } $dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath \r\n FROM `#@__arctype` WHERE {$tpsql} {$orderbysql} {$orderwaysql} LIMIT {$totalnum}"); $dsql->Execute(); while ($row = $dsql->GetArray()) { $typeids[] = $row; } if (!isset($typeids[0])) { return ''; } $GLOBALS['itemindex'] = 0; $GLOBALS['itemparity'] = 1; for ($i = 0; isset($typeids[$i]); $i++) { $GLOBALS['itemindex']++; $pv = new PartView($typeids[$i]['id']); $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]); $pv->SetTemplet($innertext, 'string'); $artlist .= $pv->GetResult(); $GLOBALS['itemparity'] = $GLOBALS['itemparity'] == 1 ? 2 : 1; } //注销环境变量,以防止后续调用中被使用 $GLOBALS['envs']['typeid'] = $_sys_globals['typeid']; $GLOBALS['envs']['reid'] = ''; if ($cacheid != '') { WriteCacheBlock($cacheid, $artlist); } return $artlist; }
$dsql = new DedeSql(false); $dsql->SetQuery($inQuery); if(!$dsql->ExecuteNoneQuery()) { $dsql->Close(); ShowMsg("增加页面失败,请检查长相是否有问题!","-1"); exit(); } $dsql->Close(); $filename = $cfg_basedir.$cfg_cmspath."/".$filename; if($ismake==1) { $pv = new PartView(); $pv->SetTemplet(stripslashes($body),"string"); $pv->SaveToHtml($filename); $pv->Close(); } else { $fp = fopen($filename,"w") or die("创建:{$filename} 失败,可能是没有权限!"); fwrite($fp,stripslashes($body)); fclose($fp); } ShowMsg("成功增加一个页面!","templets_one.php"); exit(); } require_once(dirname(__FILE__)."/templets/templets_one_add.htm");
$page_html = GetPageList('list_'.$arctype_id.'_{page}.html', $page, $tags_count, $each, 5); // 创建栏目目录 $true_typedir = str_replace("{cmspath}",$cfg_cmspath,$arctype['typedir']); $true_typedir = ereg_replace("/{1,}","/",$true_typedir); if(!CreateDir($true_typedir)) { ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!","-1"); exit(); } // 生成静态页面文件 $output = $cfg_basedir.str_replace('{cmspath}', $cfg_cmspath, $arctype['typedir']).'/list_'.$arctype_id.'_'.$page.'.html'; // 写死了 $tpl_file = $cfg_basedir.$cfg_templets_dir.'/tmcms/tag.htm'; $pv = new PartView(); $pv->SetTemplet($tpl_file); $pv->SaveToHtml($output); if($page == 1) { $output = $cfg_basedir.str_replace('{cmspath}', $cfg_cmspath, $arctype['typedir']).'/index.html'; $pv->SaveToHtml($output); } $page++; $goto = "ex_tags_main.php?action=makeHtml&typeid={$arctype_id}&page={$page}"; ShowMsg('继续生成下一页['.$page.']静态页面', $goto); exit; } //获取静态的分页列表
<?php if (!file_exists(dirname(__FILE__) . '/data/common.inc.php')) { header('Location:install/index.php'); exit; } require_once dirname(__FILE__) . "/include/common.inc.php"; require_once DEDEINC . "/arc.partview.class.php"; $GLOBALS['_arclistEnv'] = 'index'; $row = $dsql->GetOne("Select * From `dede_homepageset`"); $row['templet'] = MfTemplet($row['templet']); $pv = new PartView(); $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']); $pv->Display();
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; }
$typedir = $tinfos['typedir']; } else { @header("http/1.1 404 not found"); @header("status: 404 not found"); include "../404.html"; exit; } if ($actype == "download") { if ($reid == 0 || $reid == 45) { header('HTTP/1.1 301 Moved Permanently'); header("Location:{$typedir}.html"); exit; } else { include_once DEDEINC . "/arc.partview.class.php"; $pv = new PartView($tid, $needtypelink = TRUE, $actype); $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $cfg_df_style . "/downlist.htm"); $pv->SaveToHtml($tfilename); $pv->Close(); } } else { //sbYou.net 修改 去除自动生成静态,用另一种方法生成 /* include_once(DEDEINC."/arc.listview.class.php"); $lv = new ListView($tid,"",$actype); $reurl = $lv->MakeHtml(); $lv->Close(); */ } } //系统参数 $sys_newtag_fig = str_replace('AU', 'au', str_replace('0x68,0x72,0x65', '', $new_sysconfig_new));
function IncludeFile($filename,$ismake='no') { global $cfg_df_style; $restr = ""; if(file_exists($filename)){ $okfile = $filename; } else if( file_exists(dirname(__FILE__)."/".$filename) ){ $okfile = dirname(__FILE__)."/".$filename; } else if( file_exists(dirname(__FILE__)."/../".$filename) ){ $okfile = dirname(__FILE__)."/../".$filename; } else if( file_exists(dirname(__FILE__)."/../templets/".$filename) ){ $okfile = dirname(__FILE__)."/../templets/".$filename; } else if( file_exists(dirname(__FILE__)."/../templets/".$cfg_df_style."/".$filename) ){ $okfile = dirname(__FILE__)."/../templets/".$cfg_df_style."/".$filename; } else{ return "无法在这个位置找到: $filename"; } //编译 if($ismake=="yes"){ require_once(dirname(__FILE__)."/inc_arcpart_view.php"); $pvCopy = new PartView(); $pvCopy->SetTemplet($okfile,"file"); $restr = $pvCopy->GetResult(); }else{ $fp = @fopen($okfile,"r"); while($line=fgets($fp,1024)) $restr.=$line; fclose($fp); } return $restr; }
<?php require_once dirname(__FILE__) . "/config.php"; CheckPurview('sys_MakeHtml'); require_once DEDEINC . "/arc.partview.class.php"; $tagFile = DEDEADMIN . "/../tags.html"; $fp = fopen($tagFile, "w") or die("你指定的文件名有问题,无法创建文件"); fclose($fp); $pv = new PartView(); $GLOBALS['_arclistEnv'] = 'index'; $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $cfg_df_style . "/index_tag.htm"); //打开TAG页模板 $pv->SaveToHtml($tagFile); echo "成功更新TAG主页:" . $tagFile; echo "<br/><br/><a href='../tags.html' target='_blank'>浏览...</a>";
function pasterTempletDiy($path) { require_once DEDEINC . "/arc.partview.class.php"; global $cfg_basedir, $cfg_templets_dir; $tmpfile = $cfg_basedir . $cfg_templets_dir . "/" . $path; //模版文件的路径 $dtp = new PartView(); $dtp->SetTemplet($tmpfile); $dtp->Display(); }
$homeFile = dirname(__FILE__) . "/../html/index.html"; $cfg_autoindex_time = intval($cfg_autoindex_time) >= 0 ? intval($cfg_autoindex_time) : 600; if (abs(time() - @filemtime($homeFile)) > $cfg_autoindex_time) { //生成首页 by QISIP 2014-04-01 $tid = ''; $dsql->ExecuteNoneQuery("Delete From `#@__arccache`"); include_once DEDEINC . "/arc.partview.class.php"; $row = $dsql->GetOne("Select * From `#@__homepageset`"); $row['templet'] = MfTemplet($row['templet']); $pv = new PartView(); $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']); $pv->SaveToHtml('../html/index.html'); $dsql->Close(); //生成sitemap by QISIP 2014-04-01 $sitemaptemplet = $cfg_df_style . "/sitemap.htm"; $pv2 = new PartView(); $pv2->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $sitemaptemplet); $sitemapFile = "../sitemap.html"; $pv2->SaveToHtml($sitemapFile); //生成排行榜 by QISIP 2014-04-03 $tid = '375'; $paihangbangtemplet = $cfg_df_style . "/paihang.htm"; $paihangbangtemplet = $cfg_basedir . $cfg_templets_dir . "/" . $paihangbangtemplet; if (file_exists($paihangbangtemplet)) { $lv = new ListView($tid); $reurl = $lv->MakeHtml(); $lv->Close(); } } } setcookie("upflag", '1', time() + $co_oldpertime);
$pv->Display(); $pv->Close(); } else if($dopost=="make") { header("Content-Type: text/html; charset={$cfg_ver_lang}"); $homeFile = dirname(__FILE__)."/".$position; $homeFile = str_replace("\\","/",$homeFile); $homeFile = str_replace("//","/",$homeFile); $fp = fopen($homeFile,"w") or die("你指定的文件名有问题,无法创建文件"); fclose($fp); if($saveset==1) { $dsql = new DedeSql(false); $dsql->SetQuery("update #@__homepageset set templet='$templet',position='$position' "); $dsql->ExecuteNoneQuery(); $dsql->Close(); } $templet = str_replace("{style}",$cfg_df_style,$templet); $pv = new PartView(); $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet); $pv->SaveToHtml($homeFile); $pv->Close(); echo "成功更新主页HTML:".$homeFile; echo "<br/><br/><a href='$position' target='_blank'>浏览...</a>"; } $t2 = ExecTime(); echo "<!-- ".($t2-$t1)." -->"; ClearAllLink(); ?>
/*---------------------- function __makeAll(); -------------------*/ else if($dopost=="makeall") { require_once(dirname(__FILE__)."/../include/inc_arcpart_view.php"); $dsql->ExecuteNoneQuery("update #@__sgpage set uptime='".time()."'"); $row = $dsql->Execute('meoutside',"Select * From #@__sgpage "); while($row = $dsql->GetArray('meoutside')) { $fileurl = $cfg_cmspath."/".$row['filename']; $filename = $cfg_basedir.$cfg_cmspath."/".$row['filename']; if($row['ismake']==1) { $pv = new PartView(); $pv->SetTemplet($row['body'],"string"); $pv->SaveToHtml($filename); } else { $fp = fopen($filename,"w") or die("创建:{$filename} 失败,可能是没有权限!"); fwrite($fp,$row['body']); fclose($fp); } } $dsql->Close(); ShowMsg("成功更新所有页面!","templets_one.php"); exit(); } $row = $dsql->GetOne("Select * From #@__sgpage where aid='$aid'");
<?php require_once dirname(__FILE__) . "/config.php"; CheckPurview('temp_Test'); require_once DEDEINC . "/arc.partview.class.php"; $partcode = stripslashes($partcode); if (empty($typeid)) { $typeid = 0; } if (empty($showsource)) { $showsource = ""; } if ($typeid > 0) { $pv = new PartView($typeid); } else { $pv = new PartView(); } $pv->SetTemplet($partcode, "string"); if ($showsource == "" || $showsource == "yes") { echo "模板代码:"; echo "<span style='color:red;'><pre>" . htmlspecialchars($partcode) . "</pre></span>"; echo "结果:<hr size='1' width='100%'>"; } $pv->Display();
$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');
function lib_channelartlist(&$ctag, &$refObj) { global $dsql, $envs, $_sys_globals; //处理标记属性、innertext $attlist = 'typeid|0,row|20,cacheid|'; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $artlist = ''; //读取固定的缓存块 $cacheid = trim($cacheid); if ($cacheid != '') { $artlist = GetCacheBlock($cacheid); if ($artlist != '') { return $artlist; } } if (empty($typeid)) { $typeid = !empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0; } if ($innertext == '') { $innertext = GetSysTemplets('part_channelartlist.htm'); } $totalnum = $row; if (empty($totalnum)) { $totalnum = 20; } //获得类别ID总数的信息 $typeids = array(); if ($typeid == 0 || $typeid == 'top') { $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 "; } else { if (!preg_match('#,#', $typeid)) { $tpsql = " reid='{$typeid}' AND ispart<>2 AND ishidden<>1 "; } else { $tpsql = " id IN({$typeid}) AND ispart<>2 AND ishidden<>1 "; } } $dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath \n FROM `#@__arctype` WHERE {$tpsql} ORDER BY substring_index( '{$typeid}',id,1) limit {$totalnum}"); $dsql->Execute(); while ($row = $dsql->GetArray()) { $typeids[] = $row; } if (!isset($typeids[0])) { return ''; } $GLOBALS['itemindex'] = 0; $GLOBALS['itemparity'] = 1; for ($i = 0; isset($typeids[$i]); $i++) { $GLOBALS['itemindex']++; $pv = new PartView($typeids[$i]['id']); $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]); if ($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid']) { $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current'; } else { $pv->Fields['currentstyle'] = ''; } $pv->SetTemplet($innertext, 'string'); $artlist .= $pv->GetResult(); $GLOBALS['itemparity'] = $GLOBALS['itemparity'] == 1 ? 2 : 1; } //注销环境变量,以防止后续调用中被使用 $GLOBALS['envs']['typeid'] = $_sys_globals['typeid']; $GLOBALS['envs']['reid'] = ''; if ($cacheid != '') { WriteCacheBlock($cacheid, $artlist); } return $artlist; }