function mindex_static($cnstr = '', $addno = 0, $needwri = 1) { global $db, $tblprefix, $cms_abs, $liststaticnum, $homedefault, $sid, $enablestatic, $timestamp, $templatedir, $G, $_no_dbhalt, $btags, $mconfigs, $_mp, $_actid, $_midarr, $_a_vars, $_a_var, $mpnav, $mptitle, $mpstart, $mpend, $mppre, $mpnext, $mppage, $mpcount, $mpacount; @extract($mconfigs, EXTR_SKIP); @extract($btags); $nenablestatic = $enablestatic; if ($cnstr) { if (!($cnode = read_mcnode($cnstr)) || $addno > $cnode['addnum']) { return false; } $statics = empty($cnode['statics']) ? array() : explode(',', $cnode['statics']); $nenablestatic = empty($statics[$addno]) ? $enablestatic : ($statics[$addno] == 1 ? 0 : 1); } elseif ($addno) { return false; } //频道首页不能带附加页 if (!$nenablestatic || !($tplname = mcn_tplname($cnstr, $addno))) { mindex_unstatic($cnstr, $addno, $needwri); return false; } if ($cnstr) { parse_str($cnstr, $_da); $_da += m_cnparse($cnstr) + mcnodearr($cnstr); } else { $_da = array(); } $cnformat = mcn_format($cnstr, $addno); $_o_content = ob_get_contents(); ob_clean(); $_no_dbhalt = true; $pcount = 1; for ($_pp = 1; $_pp <= $pcount; $_pp++) { $_mp = $G = array(); $_mp['durlpre'] = $memberurl . en_virtual($cnstr ? "index.php?{$cnstr}" . ($addno ? "&addno={$addno}" : '') . '&page={$page}' : 'index.php?page={$page}', 1); $_mp['surlpre'] = view_url($cnformat); $_mp['static'] = 1; $_mp['nowpage'] = max(1, intval($_pp)); $_mp['s_num'] = $liststaticnum; _aenter($_da, 1); extract($_da, EXTR_OVERWRITE); $sid = 0; //???????????????????????????????????????? tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); $_content .= "<script language=\"javascript\" src=\"" . $cms_abs . "tools/static.php?mode=mcnode" . ($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . "\"></script>"; @str2file($_content, M_ROOT . m_parseurl($cnformat, array('page' => $_pp))); unset($_content); $pcount = empty($liststaticnum) ? @$_mp['pcount'] : min(@$_mp['pcount'], $liststaticnum); } echo $_o_content; unset($_o_content, $_da, $cnode); $_no_dbhalt = false; if ($needwri) { mcn_update_needstatic($cnstr, $addno, 1); } return true; }
function index_static($cnstr = '', $addno = 0, $needwri = 1) { global $db, $tblprefix, $cms_abs, $liststaticnum, $sid, $enablestatic, $timestamp, $templatedir, $G, $_no_dbhalt, $btags, $mconfigs, $_mp, $_actid, $_midarr, $_a_vars, $_a_var, $mpnav, $mptitle, $mpstart, $mpend, $mppre, $mpnext, $mppage, $mpcount, $mpacount; @extract($mconfigs, EXTR_SKIP); @extract($btags); $nenablestatic = $enablestatic; $_da = array(); if (!$cnstr) { if ($addno) { return false; } $tplname = !$sid ? $hometpl : $btags['hometpl']; if (!$nenablestatic || !$tplname || !($template = load_tpl($tplname))) { //子站的各种配置切换 index_unstatic($cnstr, $addno, $needwri); return false; } $cnformat = idx_format($sid); $_da['rss'] = $cms_abs . 'rss.php' . ($sid ? "?sid={$sid}" : ''); } else { if (!($cnode = cnodearr($cnstr, $sid))) { return false; } $statics = empty($cnode['statics']) ? array() : explode(',', $cnode['statics']); $nenablestatic = empty($statics[$addno]) ? $enablestatic : ($statics[$addno] == 1 ? 0 : 1); if (!$nenablestatic || !cn_allowstatic($cnstr, $sid) || !($tplname = cn_tplname($cnstr, $cnode, $addno))) { index_unstatic($cnstr, $addno, $needwri); return false; } $cnformat = cn_format($cnstr, $addno, $cnode); $_da = cn_parse($cnstr, $sid, -1); re_cnode($_da, $cnstr, $cnode); } $_o_content = ob_get_contents(); ob_clean(); $_no_dbhalt = true; $pcount = 1; for ($_pp = 1; $_pp <= $pcount; $_pp++) { $G = array(); $_mp = array('durlpre' => view_url(en_virtual("index.php?" . substr(($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . ($sid ? "&sid={$sid}" : '') . '&page={$page}', 1), 1)), 'surlpre' => view_url($cnformat), 'static' => 1, 'nowpage' => $_pp, 's_num' => $liststaticnum); _aenter($_da, 1); extract($_da, EXTR_OVERWRITE); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); $_content .= "<script language=\"javascript\" src=\"" . $cms_abs . "tools/static.php?mode=cnindex" . ($sid ? "&sid={$sid}" : '') . ($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . "\"></script>"; @str2file($_content, M_ROOT . m_parseurl($cnformat, array('page' => $_pp))); unset($_content); $pcount = empty($liststaticnum) ? @$_mp['pcount'] : min(@$_mp['pcount'], $liststaticnum); } echo $_o_content; unset($_o_content, $_da, $cnode); $_no_dbhalt = false; if ($needwri) { cn_update_needstatic($cnstr, $sid, $addno, 1); } return true; }
$arc = new cls_archive(); if (!$arc->arcid($_offer['aid'])) { message('choosearchive'); } if (!$arc->archive['checked'] && !$curuser->isadmin()) { message('poinarcnoche'); } $tplname = ms_arctpl($arc->archive['chid'], 'product'); if (!$tplname) { message('definereltem'); } $arc->detail_data(); $_arc =& $arc->archive; arc_parse($_arc); $_mp = array(); $_mp['durlpre'] = $mspaceurl . en_virtual('product.php?mid=' . $mid . '&cid=' . $cid . '&page={$page}', 1); $_mp['static'] = 0; $_mp['nowpage'] = max(1, intval($page)); _aenter($_arc, 1); _aenter($_da); _aenter($_offer); @extract($btags); extract($_arc, EXTR_OVERWRITE); extract($_da, EXTR_OVERWRITE); extract($_offer, EXTR_OVERWRITE); $sid = 0; tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); if ($cachemscircle && (!$mslistcachenum || $page <= $mslistcachenum)) {
switch_cache($freeinfos[$fid]['sid']); $sid = $freeinfos[$fid]['sid']; if_siteclosed($sid); if (!$addid && $cache1circle && (!$listcachenum || $page <= $listcachenum)) { //带附加参数则不缓存 $cachefile = htmlcac_dir('farc', '', 1) . cac_namepre($fid) . '_' . $page . '.php'; if (is_file($cachefile) && filemtime($cachefile) > $timestamp - $cache1circle * 60) { mexit(read_htmlcac($cachefile)); } } if (!($tplname = $freeinfos[$fid]['tplname'])) { message('definereltem'); } $_da = array('fid' => $fid, 'sid' => $sid, 'addid' => $addid); $_mp = array(); $_mp['durlpre'] = view_url(en_virtual('info.php?fid=' . $fid . ($addid ? "&addid={$addid}" : '') . '&page={$page}', 1)); $_mp['static'] = 0; $_mp['nowpage'] = max(1, intval($page)); $_mp['s_num'] = 0; //静态页数不限 @extract($btags); extract($_da, EXTR_OVERWRITE); _aenter($_da, 1); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); if (!$addid && $cache1circle) { save_htmlcac($_content, $cachefile); } mexit($_content);
function view_cnurl(&$cnstr, &$cnode) { global $enablestatic, $cn_max_addno, $cn_urls, $wap_suffix; if (empty($cnode)) { return; } if (defined('WAP_MODE')) { for ($i = 0; $i <= $cn_max_addno; $i++) { $cnode['indexurl' . ($i ? $i : '')] = $i <= @$cnode['addnum'] ? view_url("wap/index.php?{$cnstr}" . ($i ? "&addno={$i}" : '') . (empty($cnode['sid']) ? '' : '&sid=' . $cnode['sid']) . $wap_suffix) : '#'; } } elseif (!empty($cnode['appurl'])) { for ($i = 0; $i <= $cn_max_addno; $i++) { $cnode['indexurl' . ($i ? $i : '')] = $cnode['appurl']; } } else { $staticarr = empty($cnode['statics']) ? array() : explode(',', $cnode['statics']); for ($i = 0; $i <= $cn_max_addno; $i++) { if (empty($staticarr[$i]) ? $enablestatic : ($staticarr[$i] == 1 ? 0 : 1)) { $cnode['indexurl' . ($i ? $i : '')] = $i <= @$cnode['addnum'] ? view_url(m_parseurl(cn_format($cnstr, $i, $cnode), array('page' => 1))) : '#'; } else { $cnode['indexurl' . ($i ? $i : '')] = $i <= @$cnode['addnum'] ? view_url(en_virtual("index.php?{$cnstr}" . ($i ? "&addno={$i}" : '') . (empty($cnode['sid']) ? '' : '&sid=' . $cnode['sid']), 1)) : '#'; } } } }
if ($cache1circle && is_file($cachefile) && filemtime($cachefile) > $timestamp - $cache1circle * 60) { mexit(read_htmlcac($cachefile)); } $_da = array(); if (!$cnstr) { $tplname = !$sid ? $hometpl : $btags['hometpl']; $_da['rss'] = $cms_abs . 'rss.php' . ($sid ? "?sid={$sid}" : ''); } else { $_da = cn_parse($cnstr, $sid, -1); re_cnode($_da, $cnstr, $cnode); $tplname = cn_tplname($cnstr, $cnode, $addno); $statics = empty($cnode['statics']) ? array() : explode(',', $cnode['statics']); $enablestatic = empty($statics[$addno]) ? $enablestatic : ($statics[$addno] == 1 ? 0 : 1); } empty($tplname) && message('definereltem'); $_mp = array('durlpre' => view_url(en_virtual("index.php?" . substr(($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . ($sid ? "&sid={$sid}" : '') . '&page={$page}', 1), 1)), 'static' => 0, 'nowpage' => $page); _aenter($_da, 1); extract($_da, EXTR_OVERWRITE); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); if ($enablestatic) { $_content .= "<script language=\"javascript\" src=\"" . $cms_abs . "tools/static.php?mode=cnindex" . ($sid ? "&sid={$sid}" : '') . ($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . "\"></script>"; } elseif ($cache1circle) { save_htmlcac($_content, $cachefile); } mexit($_content); ?>
} $cache1circle && ($cachefile = htmlcac_dir('mcn', '', 1) . cac_namepre($cnstr, $addno) . '_' . $page . '.php'); if ($cache1circle && is_file($cachefile) && filemtime($cachefile) > $timestamp - $cache1circle * 60) { mexit(read_htmlcac($cachefile)); } $_da = $temparr; if ($cnstr) { $_da += m_cnparse($cnstr); $_da += mcnodearr($cnstr); $tplname = mcn_tplname($cnstr, $addno); $statics = empty($cnode['statics']) ? array() : explode(',', $cnode['statics']); $enablestatic = empty($statics[$addno]) ? $enablestatic : ($statics[$addno] == 1 ? 0 : 1); } else { $tplname = @$m_index_tpl; } empty($tplname) && message('definereltem'); $_mp = array('durlpre' => $memberurl . en_virtual("index.php?" . substr(($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . '&page={$page}', 1), 1), 'static' => 0, 'nowpage' => $page); _aenter($_da, 1); @extract($btags); extract($_da, EXTR_OVERWRITE); $sid = 0; tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); if ($enablestatic) { $_content .= "<script language=\"javascript\" src=\"" . $cms_abs . "tools/static.php?mode=mcnode" . ($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . "\"></script>"; } elseif ($cache1circle) { save_htmlcac($_content, $cachefile); } mexit($_content);
function m_urlpre($addno = '') { global $mspaceurl; return $mspaceurl . en_virtual('archive.php?mid=' . $this->archive['mid'] . '&aid=' . $this->aid . ($addno ? '&addno=' . $addno : '') . '&page={$page}', 1); }
function mcn_url($mcaid = 0, $ucid = 0, $addno = 0) { //$mode:0为首页1为列表页 global $mid, $cms_abs, $virtualurl, $mspaceurl; $url = 'index.php?mid=' . $mid . ($addno ? '&addno=1' : ''); if ($mcaid) { $url .= '&mcaid=' . $mcaid . ($ucid ? "&ucid={$ucid}" : ''); } return $mspaceurl . en_virtual($url); }
//是否权限控制页 $arc = new cls_marchive(); if (!$arc->arcid($maid, $matid)) { message('choosemarchive'); } if (!$arc->archive['checked'] && !$curuser->isadmin()) { message('pointmarchinoch'); } if ($isp && !$curuser->pmbypmids('aread', $arc->matype['rpmid'])) { message('nomarcreadpermission'); } //分析模板来源 $tplname = $isp ? $arc->matype['parctpl'] : $arc->matype['arctpl']; !$tplname && message('definereltem'); $_da =& $arc->archive; marc_parse($_da); $_mp = array(); $_mp['durlpre'] = view_url(en_virtual('marchive.php?maid=' . $maid . '&matid=' . $matid . ($isp ? '&isp=1' : '') . '&page={$page}', 1)); $_mp['static'] = 0; $_mp['nowpage'] = max(1, intval($page)); _aenter($_da, 1); @extract($btags); extract($_da, EXTR_OVERWRITE); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); mexit($_content); ?>