function mcn_tplname($cnstr, $addno = 0) { global $db, $tblprefix, $m_index_tpl; if (!$cnstr) { return @$m_index_tpl; } $cnode = read_mcnode($cnstr); if ($tpls = $cnode['tpls']) { $tpls = explode(',', $tpls); } return empty($tpls[$addno]) ? '' : $tpls[$addno]; }
function mcnodearr($cnstr) { global $mcnodes, $mcn_max_addno; load_cache('mcnodes'); if ($cnode = read_mcnode($cnstr)) { $cnode['cname'] = $cnode['alias']; view_mcnurl($cnstr, $cnode); } else { $cnode = array('alias' => ''); for ($i = 0; $i <= $mcn_max_addno; $i++) { $cnode['mcnurl' . ($i ? $i : '')] = '#'; } } return $cnode; }
function mcn_format($cnstr, $addno) { //含{$page}的节点文件(相对系统根目录) global $memberdir, $homedefault; if (!$cnstr) { return $memberdir . '/' . $homedefault; } $cnode = read_mcnode($cnstr); $urlarr = empty($cnode['urls']) ? array() : explode(',', $cnode['urls']); return $memberdir . '/' . m_parseurl(empty($urlarr[$addno]) ? '{$cndir}/index' . ($addno ? $addno : '') . '_{$page}.html' : $urlarr[$addno], array('cndir' => mcn_dir($cnstr))); }
<?php include_once dirname(dirname(__FILE__)) . '/include/general.inc.php'; include_once M_ROOT . './include/common.fun.php'; parse_str(un_virtual($_SERVER['QUERY_STRING']), $temparr); $cnstr = mcnstr($temparr); $addno = max(0, intval(@$temparr['addno'])); $page = max(1, intval(@$temparr['page'])); if (!($cnode = read_mcnode($cnstr))) { $cnstr = ''; $addno = 0; } $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);
function mcn_blank($cnstr, $addnos = array(), $force = 0) { //force:强行覆盖第一个文件,为0时为修复链接 global $enablestatic, $memberdir; if (!$cnstr || !($cnode = read_mcnode($cnstr))) { return; } if (!is_array($addnos)) { $addnos = array($addnos); } if (!$addnos) { return; } $statics = empty($cnode['statics']) ? array() : explode(',', $cnode['statics']); for ($i = 0; $i <= $cnode['addnum']; $i++) { if (in_array($i, $addnos)) { if (empty($statics[$i]) ? $enablestatic : ($statics[$i] == 1 ? 0 : 1)) { $cnfile = M_ROOT . m_parseurl(mcn_format($cnstr, $i), array('page' => 1)); if ($force || !is_file($cnfile)) { @str2file(direct_html("{$memberdir}/index.php?{$cnstr}" . ($i ? "&&addno={$i}" : '')), $cnfile); } } } } }