function handlelinks() { $links = array(); $aregions = array(); $regex = "/<a(.+?)href\\s*=\\s*(\"(.+?)\"|'(.+?)'|(.+?)(\\s|\\/?>))/is"; if (preg_match_all($regex, $this->html, $matches)) { $aregions = array_filter(array_unique(array_merge($matches[3], $matches[4], $matches[5]))); foreach ($aregions as $aregion) { $nregion = fillurl($aregion, $this->reflink); $links[] = $nregion; $regex1 = preg_quote($aregion, '/'); $regex1 = "/href[ ]*=[ |'|\"]*" . $regex1 . "[ |'|\"]+/is"; $this->html = preg_replace($regex1, "href=\"{$nregion}\" ", $this->html); } } $regex = "/<[img|embed]([^<|>]+?)src\\s*=\\s*(\"(.+?)\"|'(.+?)'|(.+?)(\\s|\\/?>))/is"; if (preg_match_all($regex, $this->html, $matches)) { $aregions = array_filter(array_unique(array_merge($matches[3], $matches[4], $matches[5]))); foreach ($aregions as $aregion) { $nregion = fillurl($aregion, $this->reflink); $nregion = view_url($this->remotefile($nregion)); $links[] = $nregion; $regex1 = preg_quote($aregion, '/'); $regex1 = "/src[ ]*=[ |'|\"]*" . $regex1 . "[ |'|\"]+/is"; $this->html = preg_replace($regex1, "src=\"{$nregion}\" ", $this->html); } } $this->links = $links; unset($links, $regex, $matches, $aregions, $nregion); }
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 urlpre($addno = 0, $static = 0) { //分页url模印含{$page}的可变参数 $novus = empty($this->channel['novus']) ? array() : explode(',', $this->channel['novus']); if (defined('WAP_MODE')) { return view_url('wap/archive.php?aid=' . $this->aid . ($addno ? '&addno=' . $addno : '') . '&page={$page}'); } else { return $static ? view_url(m_parseurl(arc_format($this->archive), array('addno' => arc_addno($addno, $this->channel['addnos'])))) : view_url(en_virtual('archive.php?aid=' . $this->aid . ($addno ? '&addno=' . $addno : '') . '&page={$page}', 1, @$novus[$addno])); } }
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);
in_array($k . '=' . $id, $cnode_keys) && ($cnodes1[] = $k . '=' . $id); } } else { foreach ($cnodes1 as $k1) { foreach ($ids as $id) { in_array($k1 . '&' . $k . '=' . $id, $cnode_keys) && ($cnodes1[] = $k1 . '&' . $k . '=' . $id); } } } } unset($cnode_keys); $datastr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n"; $datastr .= " <url>\n" . " <loc>" . htmlspecialchars($cms_abs) . "</loc>\n" . " <lastmod>" . date('Y-m-d') . "</lastmod>\n" . " <changefreq>daily</changefreq>\n" . " <priority>1.0</priority>\n" . " </url>\n"; foreach ($cnodes1 as $cnstr) { $cnode = cnodearr($cnstr); $datastr .= " <url>\n" . " <loc>" . htmlspecialchars(view_url($cnode['indexurl'])) . "</loc>\n" . " <lastmod>" . date('Y-m-d') . "</lastmod>\n" . " <changefreq>daily</changefreq>\n" . " <priority>0.8</priority>\n" . " </url>\n"; } $query = $db->query("SELECT * FROM {$tblprefix}archives {$sqlstr} ORDER BY aid DESC LIMIT 0,10000"); while ($archive = $db->fetch_array($query)) { $priority = $archive['clicks'] > 1000 ? '0.5' : '0.3'; $datastr .= " <url>\n" . " <loc>" . htmlspecialchars(view_arcurl($archive)) . "</loc>\n" . " <lastmod>" . date('Y-m-d', $archive['createdate']) . "</lastmod>\n" . " <changefreq>yearly</changefreq>\n" . " <priority>" . ($archive['clicks'] > 1000 ? '0.5' : '0.3') . "</priority>\n" . " </url>\n"; } $datastr .= "</urlset>"; } elseif ($sitemap['ename'] == 'baidu') { include_once M_ROOT . "./include/arcedit.cls.php"; $sqlstr = "WHERE checked=1 AND salecp=''"; if (!empty($sitemap['setting']['indays'])) { $sqlstr .= " AND createdate>" . ($timestamp - 86400 * $sitemap['setting']['indays']); } if (empty($sitemap['setting']['chsource'])) { $sqlstr .= " AND chid " . multi_str($chids);
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)) : '#'; } } } }
switch_cache($nsid); $sid = $nsid; if_siteclosed($sid); @extract($btags); $cnstr = cnstr($temparr); if ($cnstr && ($cnode = cnodearr($cnstr, $sid))) { if (!$curuser->pmbypmids('cread', cn_pmids($cnstr, $sid))) { message('wap_nocatabrowseperm'); } } else { $cnstr = ''; $addno = 0; } $_da = array(); if (!$cnstr) { $tplname = !$sid ? $w_index_tpl : $btags['w_index_tpl']; $_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); } empty($tplname) && message('definereltem'); $_mp = array('durlpre' => view_url("wap/index.php?" . substr(($cnstr ? "&{$cnstr}" : '') . ($addno ? "&addno={$addno}" : '') . ($sid ? "&sid={$sid}" : '') . '&page={$page}', 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(); wap_exit($_content);
include_once M_ROOT . "./include/parse.fun.php"; include_once M_ROOT . "./include/fcn_static.fun.php"; if ($action == 'freeinfosedit') { if (!submitcheck('bfreeinfoadd') && !submitcheck('bfreeinfosedit')) { $url_type = 'static'; include 'urlsarr.inc.php'; url_nav(lang('staticadmin'), $urlsarr, 'freeinfos'); tabheader(lang('isolute_page_manager'), 'freeinfosedit', "?entry=freeinfos&action=freeinfosedit{$param_suffix}", '5'); trcategory(array('<input class="checkbox" type="checkbox" name="chkall" onclick="checkall(this.form)">' . lang('del'), 'ID', lang('isolute_page_cname'), lang('page_template'), lang('page_pick_url'), lang('static'))); foreach ($freeinfos as $fid => $freeinfo) { if ($freeinfo['sid'] == $sid) { if (empty($freeinfo['arcurl'])) { $arcurl = $cms_abs . "info.php?fid={$fid}"; $staticstr = "<a href=\"?entry=freeinfos&action=fstatic&fid={$fid}{$param_suffix}\">" . lang('create') . "</a>"; } else { $arcurl = ($sid ? view_url($subsites[$sid]['dirname'] . '/') : view_url($infohtmldir . '/')) . $freeinfo['arcurl']; $staticstr = "<a href=\"?entry=freeinfos&action=funstatic&fid={$fid}{$param_suffix}\">" . lang('cancel') . "</a>"; } $staticstr = empty($freeinfo['arcurl']) ? "<a href=\"?entry=freeinfos&action=fstatic&fid={$fid}{$param_suffix}\">" . lang('create') . "</a>" : "<a href=\"?entry=freeinfos&action=funstatic&fid={$fid}{$param_suffix}\">" . lang('cancel') . "</a>"; echo "<tr class=\"txt\">" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fid}]\" value=\"{$fid}\"></td>\n" . "<td class=\"txtC w40\">{$fid}</td>\n" . "<td class=\"txtC w150\"><input type=\"text\" size=\"25\" name=\"freeinfosnew[{$fid}][cname]\" value=\"{$freeinfo['cname']}\"></td>\n" . "<td class=\"txtC w120\"><select style=\"vertical-align: middle;\" name=\"freeinfosnew[{$fid}][tplname]\">" . makeoption(mtplsarr('other'), $freeinfo['tplname'], lang('noset')) . "</select></td>\n" . "<td class=\"txtL\"><a href=\"{$arcurl}\" target=\"_blank\">{$arcurl}</a></td>\n" . "<td class=\"txtC w40\">{$staticstr}</td></tr>\n"; } } tabfooter('bfreeinfosedit'); tabheader(lang('add_isolute_page'), 'freeinfoadd', "?entry=freeinfos&action=freeinfosedit{$param_suffix}"); trbasic(lang('isolute_page_cname'), 'freeinfoadd[cname]'); trbasic(lang('isolute_page_template'), 'freeinfoadd[tplname]', makeoption(array('' => lang('noset')) + mtplsarr('other')), 'select'); tabfooter('bfreeinfoadd', lang('add')); a_guide('freeinfosedit'); } elseif (submitcheck('bfreeinfoadd')) { $freeinfoadd['cname'] = trim($freeinfoadd['cname']); if (empty($freeinfoadd['cname'])) {
trbasic(lang('impamomaxlim'), 'hotimport[amount]', 100); trbasic(lang('keyvpclar'), 'hotimport[vpcs]', 10); tabfooter('bhotkeywords', lang('import')); tabheader(lang('handaddswo'), 'wordlinksadd', "?entry=wordlinks&page={$page}"); trbasic(lang('sword'), 'wordlinkadd[sword]'); trbasic(lang('relateurl'), 'wordlinkadd[url]'); tabfooter('bwordlinksadd', lang('add')); $pagetmp = $page; do { $query = $db->query("SELECT * FROM {$tblprefix}wordlinks ORDER BY wlid DESC LIMIT " . ($pagetmp - 1) * $atpp . ",{$atpp}"); $pagetmp--; } while (!$db->num_rows($query) && $pagetmp); $itemstr = ''; while ($item = $db->fetch_array($query)) { $itemid = $item['wlid']; $item['rword'] = '<a href="' . view_url($item['url']) . '" target="_blank">' . lang('look') . '</a>'; $itemstr .= "<tr class=\"txt\"><td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$itemid}]\" value=\"{$itemid}\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($item['sword']) . "</td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"60\" name=\"wordlinksnew[{$itemid}][url]\" value=\"{$item['url']}\"></td>\n" . "<td class=\"txtC w70\">{$item['pcs']}</td>\n" . "<td class=\"txtC w45\"><input class=\"checkbox\" type=\"checkbox\" name=\"wordlinksnew[{$itemid}][available]\" value=\"1\"" . ($item['available'] ? " checked" : "") . "></td>\n" . "<td class=\"txtC w40\">{$item['rword']}</td></tr>\n"; } $counts = $db->result_one("SELECT count(*) FROM {$tblprefix}wordlinks"); $multi = multi($counts, $atpp, $page, "?entry=wordlinks"); $counts = $db->result_one("SELECT count(*) FROM {$tblprefix}wordlinks WHERE available=1"); tabheader(lang('swordmanager', $counts), 'wordlinksedit', "?entry=wordlinks&page={$page}", 6); trcategory(array("<input class=\"checkbox\" type=\"checkbox\" name=\"chkall\" onclick=\"checkall(this.form,'delete', 'chkall')\">" . lang('del'), lang('sword'), lang('relateurl'), lang('vpcs'), lang('enable') . "<input class=\"checkbox\" type=\"checkbox\" name=\"chkall1\" onclick=\"checkall(this.form, 'wordlinksnew','chkall1')\">", lang('look'))); echo $itemstr; tabfooter(); echo $multi; echo "<input class=\"button\" type=\"submit\" name=\"bwordlinksedit\" value=\"" . lang('modify') . "\">"; a_guide('wordlinks'); } elseif (submitcheck('bwordlinksadd')) { $wordlinkadd['sword'] = empty($wordlinkadd['sword']) ? '' : trim(strip_tags($wordlinkadd['sword'])); $wordlinkadd['sword'] = str_replace(array(' ', chr(0xa1) . chr(0xa1), chr(0xa1) . chr(0x40), chr(0xe3) . chr(0x80) . chr(0x80)), '', $wordlinkadd['sword']);
function common_field($fname, &$html, $reflink) { //当前任务,当前url情况下 if ($html == '') { return ''; } empty($this->fields) && $this->gather_fields(); if (!($field = $this->fields[$fname]) || empty($field['ftag'])) { return ''; } $linkparse = new linkparse(); if (!in_array($field['datatype'], array('images', 'files', 'flashs', 'medias'))) { $content = $this->fetch_detail($field['ftag'], $html); $this->c_replace($field['fromreplace'], $field['toreplace'], $content); $this->clearhtml($field['clearhtml'], $content); $linkparse->setsource($content, $reflink, $field['rpid'], $field['jumpfile']); if (!$field['islink']) { $linkparse->handlelinks(); $content = $linkparse->html; } else { $content = $linkparse->handlelink($content); if (in_array(mextension($content), array('jpg', 'gif', 'png', 'jpeg', 'bmp'))) { $imageinfo = @getimagesize(view_url($content)); !empty($imageinfo) && ($content .= '#' . $imageinfo[0] . '#' . $imageinfo[1]); } } } else { $content = $this->fetch_detail($field['ftag'], $html); $fregions = explode($field['splittag'], $content); $furls = array(); $linkparse->setsource('', $reflink, $field['rpid'], $field['jumpfile']); foreach ($fregions as $fregion) { $urlarr = array(); $this->clean_blank($fregion); if (!($furl = $this->fetch_detail($field['remotetag'], $fregion))) { continue; } $furl = $linkparse->handlelink($furl); $urlarr['remote'] = $furl; if ($field['datatype'] == 'images') { $imageinfo = @getimagesize(view_url($furl)); !empty($imageinfo[0]) && ($urlarr['width'] = $imageinfo[0]); !empty($imageinfo[1]) && ($urlarr['height'] = $imageinfo[1]); } $urlarr['title'] = $this->fetch_detail($field['titletag'], $fregion); $furls[] = $urlarr; } $content = serialize($furls); } !empty($field['func']) && $this->func_deal($field['func'], $content); unset($linkparse, $urlarr, $furls); return $content; }
//是否权限控制页 $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); ?>