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; }
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 arc_static($aid = 0, $addno = 0, $needwri = 1) { //可能需要多个页面同时进行 global $db, $tblprefix, $arc, $sid, $timestamp, $cms_abs, $enablestatic, $archivecircle, $templatedir, $G, $_no_dbhalt, $btags, $mconfigs, $_mp, $_actid, $_midarr, $_a_vars, $_a_var, $mpnav, $mptitle, $mpstart, $mpend, $mppre, $mpnext, $mppage, $mpcount, $mpacount; if ($aid) { $arc->arcid($aid); } if (empty($arc->aid) || $addno > $arc->channel['addnum']) { return false; } @extract($mconfigs, EXTR_SKIP); switch_cache($arc->archive['sid']); $sid = $arc->archive['sid']; @extract($btags); $tplname = arc_tplname($addno, $arc->archive['arctpls'], $arc->channel['arctpls']); $staticarr = empty($arc->channel['statics']) ? array() : explode(',', $arc->channel['statics']); $nenablestatic = empty($staticarr[$addno]) ? $enablestatic : ($staticarr[$addno] == 1 ? 0 : 1); if (!$nenablestatic || !arc_allowstatic($arc->archive) || !$tplname) { arc_un_static(0, $addno, $needwri, 1); return false; } $arc->detail_data(); $surlpre = $arc->urlpre($addno, 1); $filepre = $arc->filepre($addno); $_da =& $arc->archive; arc_parse($_da); $_o_content = ob_get_contents(); ob_clean(); $_no_dbhalt = true; $pcount = 1; for ($_pp = 1; $_pp <= $pcount; $_pp++) { $_mp = $G = array(); $_mp['surlpre'] = $surlpre; $_mp['static'] = 1; $_mp['nowpage'] = $_pp; _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=arc&aid={$aid}" . ($addno ? "&addno={$addno}" : '') . ($sid ? "&sid={$sid}" : '') . "\"></script>"; $arcfile = m_parseurl($filepre, array('page' => $_pp)); str2file($_content, M_ROOT . $arcfile); unset($_content); $pcount = @$_mp['pcount']; } echo $_o_content; unset($_o_content); $_no_dbhalt = false; if ($needwri) { $arc->update_needstatic($addno, 1); } return true; }
function marc_static($maid = 0, $matid = 0) { //只是将公示页生成静态,受限页不生成静态 global $db, $tblprefix, $arc, $cms_abs, $marchtmldir, $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); if ($maid) { $arc->init(); $arc->arcid($maid, $matid); } if (empty($arc->maid)) { return false; } if (!$arc->archive['checked']) { marc_un_static(0); return false; } if (!($tplname = $arc->matype['arctpl'])) { return false; } $subpath = $arc->archive['matid'] . '/' . date('Ym', $arc->archive['createdate']) . '/'; mmkdir(M_ROOT . $marchtmldir . '/' . $subpath); $namepre = $subpath . $arc->maid . '_'; $arc->archive['arcurl'] = $cms_abs . $marchtmldir . '/' . $namepre . '1.html'; $_da =& $arc->archive; marc_parse($_da); $_o_content = ob_get_contents(); ob_clean(); $_no_dbhalt = true; $pcount = 1; for ($_pp = 1; $_pp <= $pcount; $_pp++) { $_mp = $G = array(); $_mp['surlpre'] = $cms_abs . $marchtmldir . '/' . $namepre . '{$page}.html'; $_mp['static'] = 1; $_mp['nowpage'] = $_pp; _aenter($_da, 1); extract($_da, EXTR_OVERWRITE); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); str2file($_content, M_ROOT . $marchtmldir . '/' . $namepre . "{$_pp}.html"); unset($_content); $pcount = @$_mp['pcount']; } echo $_o_content; unset($_o_content); $_no_dbhalt = false; $db->query("UPDATE {$tblprefix}marchives_{$matid} SET arcurl='" . $namepre . "1.html' WHERE maid='" . $arc->maid . "'"); return true; }
function farc_static($aid = 0) { global $db, $tblprefix, $arc, $timestamp, $cms_abs, $infohtmldir, $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); if ($aid) { $arc->init(); $arc->arcid($aid); } if (empty($arc->aid)) { return false; } if (!$arc->archive['checked'] || !$arc->archive['startdate'] || $arc->archive['enddate'] && $arc->archive['enddate'] < $timestamp) { //失效信息,取消静态 farc_unstatic(0); return false; } if (!($tplname = $arc->catalog['arctpl'])) { return false; } $namepre = $infohtmldir . '/a-' . $arc->aid . '-'; $_da =& $arc->archive; $_o_content = ob_get_contents(); ob_clean(); $_no_dbhalt = true; $pcount = 1; for ($_pp = 1; $_pp <= $pcount; $_pp++) { $_mp = $G = array(); $_mp['surlpre'] = $cms_abs . $namepre . '{$page}.html'; $_mp['static'] = 1; $_mp['nowpage'] = $_pp; _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(); str2file($_content, M_ROOT . $namepre . "{$_pp}.html"); unset($_content); $pcount = @$_mp['pcount']; } echo $_o_content; unset($_o_content); $_no_dbhalt = false; $db->query("UPDATE {$tblprefix}farchives SET arcurl='a-" . $arc->aid . "-1.html' WHERE aid='" . $arc->aid . "'"); return true; }
function fcn_static($fid = 0) { //静态是在确定的子站环境下 global $db, $tblprefix, $cms_abs, $sid, $timestamp, $freeinfos, $infohtmldir, $subsites, $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); if (!$fid || empty($freeinfos[$fid])) { return; } if (!($tplname = $freeinfos[$fid]['tplname'])) { return; } $namepre = (empty($freeinfos[$fid]['sid']) ? $infohtmldir : $subsites[$freeinfos[$fid]['sid']]['dirname']) . '/f-' . $fid . '-'; $_da = array('sid' => $sid, 'fid' => $fid); $_o_content = ob_get_contents(); ob_clean(); $_no_dbhalt = true; $pcount = 1; for ($_pp = 1; $_pp <= $pcount; $_pp++) { $_mp = $G = array(); $_mp['surlpre'] = $cms_abs . $namepre . '{$page}.html'; $_mp['static'] = 1; $_mp['nowpage'] = max(1, intval($_pp)); _aenter($_da, 1); extract($_da, EXTR_OVERWRITE); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); @str2file($_content, M_ROOT . $namepre . "{$_pp}.html"); unset($_content); $pcount = @$_mp['pcount']; } echo $_o_content; unset($_o_content, $_da); $_no_dbhalt = false; $db->query("UPDATE {$tblprefix}freeinfos SET arcurl='f-{$fid}-1.html' WHERE fid={$fid}"); return true; }
if (isset($oldmsg[$k])) { $a_field->oldvalue = $oldmsg[$k]; } else { $a_field->isadd = 1; } $a_field->trfield('communew', '', 'ml'); $submitstr .= $a_field->submitstr; } } unset($a_field); tabfooter('newcommu'); check_submit_func($submitstr); _footer(); } else { $_da =& $actuser->info; _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); } } else { load_cache('mlfields'); include_once M_ROOT . "./include/fields.cls.php"; include_once M_ROOT . "./include/upload.cls.php"; include_once M_ROOT . "./include/cheader.inc.php"; include_once M_ROOT . "./include/mcuedit.cls.php"; $inajax ? aheader() : _header();
function follow_dynamic($aid = 0, $mode = 'down', $temparr = array()) { global $db, $tblprefix, $arc, $sptpls, $memberid, $sid, $timestamp, $cms_abs, $cache1circle, $currencys, $curuser, $templatedir, $btags, $mconfigs, $_mp, $_actid, $_midarr, $_a_vars, $_a_var, $mpnav, $mptitle; @extract($mconfigs, EXTR_SKIP); $arc->arcid($aid); if (empty($arc->aid)) { message(lang('confchoosarchi')); } !$arc->archive['checked'] && message(lang('poinarchnoch')); switch_cache($arc->archive['sid']); $sid = $arc->archive['sid']; if_siteclosed($sid); if (!arc_allow($arc->archive, 'down')) { message(lang('noarchivbrowpermis')); } if ($crids = $arc->arc_crids(1)) { //需要对当前用户扣值 $cridstr = ''; foreach ($crids['total'] as $k => $v) { $cridstr .= ($cridstr ? ',' : '') . abs($v) . $currencys[$k]['unit'] . $currencys[$k]['cname']; } $commu = read_cache('commu', 8); if (empty($commu['setting']['autoatm'])) { //不自动扣值的情况:提示出订阅链接,选择是否订阅 message(lang('subattachwanpaycur') . $cridstr . "<br><br><a href=\"{$cms_abs}tools/subscribe.php?aid={$aid}&isatm=1\">>>" . lang('subscribe') . "</a>"); } else { //自动扣值,当前会员扣值及向出售者支付积分 if (!$curuser->crids_enough($crids['total'])) { message(lang('subattachwanpaycur') . $cridstr . lang('younosuatwaencur')); } $curuser->updatecrids($crids['total'], 0, lang('subsattach')); $curuser->payrecord($arc->aid, 1, $cridstr, 1); if (!empty($crids['sale'])) { $actuser = new cls_userinfo(); $actuser->activeuser($arc->archive['mid']); foreach ($crids['sale'] as $k => $v) { $crids['sale'][$k] = -$v; } $actuser->updatecrids($crids['sale'], 1, lang('saleattach')); unset($actuser); } } } $arc->detail_data(); $_da =& $arc->archive; arc_parse($_da); if (empty($temparr['tmode'])) { if ($temp = @unserialize($_da[$temparr['tname']])) { $temp = @$temp[$temparr['fid']]; } } else { $temp = @explode('#', $arc->archive[$temparr['tname']]); } $_da['url'] = view_atmurl(@$temp['remote']); $_da['player'] = @$temp['player']; unset($temp); empty($_da['url']) && message(lang('noattach')); save_nums($aid, $mode); //统计下载或播放数 if (!($tplname = $sptpls[$mode])) { follow_notpl($mode, $_da['url'], $_da['player']); } if ($mode == 'down') { $auth = authcode($memberid . "\t" . $aid . "\t" . $temparr['tname'] . "\t" . $temparr['tmode'] . "\t" . $temparr['fid'], 'ENCODE'); $_da['trueurl'] = $cms_abs . "tools/down.php?auth={$auth}&aid=" . $arc->aid . "&tname={$temparr['tname']}&tmode={$temparr['tmode']}&fid={$temparr['fid']}"; //真实下载地址 } elseif ($cache1circle) { $auth = authcode($temparr['tname'] . "\t" . $temparr['tmode'] . "\t" . $temparr['fid'], 'ENCODE'); $cachefile = htmlcac_dir('fw', date('Ym', $arc->archive['createdate']), 1) . cac_namepre($arc->aid, $arc->archive['createdate']) . '_' . $auth . '.php'; if (is_file($cachefile) && filemtime($cachefile) > $timestamp - $cache1circle * 60) { mexit(read_htmlcac($cachefile)); } } _aenter($_da, 1, array('url', 'player')); @extract($btags); extract($_da, EXTR_OVERWRITE); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); if ($cache1circle && $mode != 'down') { save_htmlcac($_content, $cachefile); } mexit($_content); }
} 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)) { save_htmlcac($template, $_content); } mexit($_content);
function template($spname = '', $_da = array()) { global $sptpls, $templatedir, $btags, $mconfigs; if (!($tplname = @$sptpls[$spname]) || !($template = load_tpl($tplname))) { return ''; } extract($mconfigs, EXTR_SKIP); extract($btags); _aenter($_da, 1); extract($_da, EXTR_OVERWRITE); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); return $_content; }
message('choosearchive'); } if (!$arc->archive['checked'] && !$curuser->isadmin()) { message('poinarcnoche'); } $tplname = ms_arctpl($arc->archive['chid'], 'archive'); if (!$tplname) { message('definereltem'); } $arc->detail_data(); $durlpre = $arc->m_urlpre($addno); $_arc =& $arc->archive; arc_parse($_arc); $_mp = array(); $_mp['durlpre'] = $durlpre; $_mp['static'] = 0; $_mp['nowpage'] = max(1, intval($page)); _aenter($_arc, 1); _aenter($_da); @extract($btags); extract($_arc, EXTR_OVERWRITE); extract($_da, 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)) { save_htmlcac($template, $_content); } mexit($_content);
} if (empty($confirm)) { $message = lang('del_alert') . "<br><br>"; $message .= lang('confirmclick') . "[<a href='?entry=csstpls&action=filedel&filename={$filename}{$param_suffix}&jsmode={$jsmode}&confirm=1{$forwardstr}'>" . lang('delete') . "</a>] "; $message .= lang('giveupclick') . "[<a href='?entry=csstpls'>" . lang('goback') . "</a>]"; amessage($message); } @unlink($true_tpldir . $filename); adminlog(lang('delete_file', $jsmode ? 'JS' : 'CSS')); amessage('filedelfinish', $forward, $jsmode ? 'JS' : 'CSS'); } elseif ($action == 'fileupdate') { include_once M_ROOT . "./include/parse.fun.php"; if (empty($filename)) { amessage('pointfilename', M_REFERER); } $tplname = empty($jstpls[$filename]['tplname']) ? '' : $jstpls[$filename]['tplname']; if (!$tplname) { amessage('definejsfiletemplate', M_REFERER); } $filename = $js_tpldir . $filename; $data = array(); _aenter($data, 1); @extract($btags); tpl_refresh($tplname); @(include M_ROOT . "template/{$templatedir}/pcache/{$tplname}.php"); $_content = ob_get_contents(); ob_clean(); @str2file($_content, $filename); adminlog(lang('update_js_file')); amessage('jsfileupdatefinish', M_REFERER); }