示例#1
0
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;
}
示例#2
0
<?php

include_once dirname(dirname(__FILE__)) . '/include/general.inc.php';
include_once M_ROOT . './include/common.fun.php';
empty($action) && die;
switch ($action) {
    case 'fetchcnodeurl':
        //取得节点的url,必须有节点所在$sid,url类型$urltype,及$caid,$ccid2形式的类目参数
        parse_str($_SERVER['QUERY_STRING'], $temparr);
        $nsid = empty($sid) ? 0 : max(0, intval($sid));
        $cnstr = cnstr($temparr);
        if (!($cnode = cnodearr($cnstr, $nsid))) {
            ajax_info('#');
        }
        ajax_info($cnode[empty($urltype) ? 'indexurl' : $urltype]);
        break;
    case 'arcsamevalue':
        //能否通过一个数组传数据过来
        //$ret = $db->result_one("SELECT COUNT(*) FROM {$tblprefix}archives WHERE aid='$aid' AND oid='0' AND mid='$memberid'")
        break;
    case 'ablock':
        $caid = max(0, intval($caid));
        $caid_suffix = $caid ? "&caid={$caid}" : '';
        $param_suffix = $sid ? "&sid={$sid}" : '';
        $output = '';
        if ($curuser->isadmin()) {
            load_cache('aurls,amconfigs');
            foreach ($aurls as $k => $v) {
                if (!in_array($v['uclass'], array('archives', 'arcadd', 'arcupdate', 'comments', 'offers', 'replys', 'reports', 'answers', 'custom'))) {
                    unset($aurls[$k]);
                }
示例#3
0
include_once dirname(dirname(__FILE__)) . '/include/general.inc.php';
include M_ROOT . 'wap/wap.fun.php';
parse_str($_SERVER['QUERY_STRING'], $temparr);
//处理子站id
$nsid = max(0, intval($sid));
$addno = max(0, intval(@$addno));
$page = max(1, intval(@$page));
if ($nsid && empty($subsites[$nsid])) {
    $nsid = 0;
}
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);
示例#4
0
            foreach ($ids as $id) {
                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'])) {
示例#5
0
 function deal_incell()
 {
     global $cotypes, $sid, $orelays, $acatalogs, $m_thumb;
     if (in_array($this->tclass, array('archives', 'alarchives', 'relates', 'searchs'))) {
         arc_parse($this->item, $this->temparr['m_thumbid']);
     } elseif (in_array($this->tclass, array('marchives', 'masearchs'))) {
         marc_parse($this->item, $this->temparr['m_thumbid']);
     } elseif ($this->tclass == 'catalogs') {
         //这是一个特例(含节点),在标识中会加入新元素,需要先处理midarr,
         //读取继承参数
         parse_str(cnstr($this->temparr), $midarr);
         if (isset($midarr['caid']) && @$this->tag['cainherit'] != 'active') {
             unset($midarr['caid']);
         }
         foreach ($cotypes as $k => $v) {
             if (isset($midarr['ccid' . $k]) && @$this->tag['coinherit' . $k] != 'active') {
                 unset($midarr['ccid' . $k]);
             }
         }
         $listby = $this->tag['listby'] == 'ca' ? 0 : intval(str_replace('co', '', $this->tag['listby']));
         if (!$listby) {
             //先处理非列表项目,因为列表项id要放在最后
             foreach ($cotypes as $k => $v) {
                 //读取手动指定的参数
                 if ($v['sortable'] && !empty($this->tag['coinherit' . $k]) && is_numeric($this->tag['coinherit' . $k])) {
                     $midarr['ccid' . $k] = $this->tag['coinherit' . $k];
                 }
             }
             unset($midarr['caid']);
             $midarr['caid'] = $this->item['caid'];
         } else {
             $coid = $listby;
             if (!empty($this->tag['cainherit']) && is_numeric($this->tag['cainherit'])) {
                 $midarr['caid'] = $this->tag['cainherit'];
             }
             foreach ($cotypes as $k => $v) {
                 $k != $coid && $v['sortable'] && !empty($this->tag['coinherit' . $k]) && is_numeric($this->tag['coinherit' . $k]) && ($midarr['ccid' . $k] = $this->tag['coinherit' . $k]);
             }
             unset($midarr['ccid' . $coid]);
             $midarr['ccid' . $coid] = $this->item['ccid'];
         }
         if (!empty($this->tag['urlmode']) && !empty($midarr[$this->tag['urlmode']])) {
             $midarr = array_merge(array($this->tag['urlmode'] => $midarr[$this->tag['urlmode']]), $midarr);
         }
         $nsid = empty($this->tag['nsid']) ? 0 : intval($this->tag['nsid']);
         if (!$nsid) {
             $nsid = isset($temparr['nsid']) ? $temparr['nsid'] : $sid;
             //当前子站需要分析是否有传下来的id,否则认为是全局id
         } elseif ($nsid == -1) {
             $nsid = 0;
         } elseif ($nsid == -2) {
             $nsid = $sid;
         }
         $cnstr = cnstr($midarr);
         $this->item = cn_parsearr($cnstr, $nsid, $listby, $this->temparr['m_thumbid']);
         $cnode = cnodearr($cnstr, $this->item['sid']);
         re_cnode($this->item, $cnstr, $cnode);
         unset($cnode, $midarr);
     } elseif ($this->tclass == 'farchives') {
         $m_thumb->config[$this->temparr['m_thumbid']] = array('id' => $this->item['aid'], 'mode' => 'fa', 'smode' => $this->item['chid']);
     } elseif ($this->tclass == 'commus') {
         $m_thumb->config[$this->temparr['m_thumbid']] = array('id' => $this->item['cid'], 'mode' => 'cu', 'smode' => @$this->tag['cuid']);
     } elseif ($this->tclass == 'mcommus') {
         $m_thumb->config[$this->temparr['m_thumbid']] = array('id' => $this->item['cid'], 'mode' => 'mcu', 'smode' => @$this->tag['cuid']);
     } elseif ($this->tclass == 'mcatalogs') {
         if ($this->tag['listby'] == 'ca') {
             $this->item['indexurl'] = mcn_url($this->item['mcaid']);
             $this->item['listurl'] = mcn_url($this->item['mcaid'], 0, 1);
         } elseif ($this->tag['listby'] == 'uc') {
             $this->item['indexurl'] = mcn_url($this->item['mcaid'], $this->item['ucid']);
             $this->item['listurl'] = mcn_url($this->item['mcaid'], $this->item['ucid'], 1);
         }
     } elseif ($this->tclass == 'images') {
         if ($this->tmode == 'p') {
             $m_thumb->config[$this->temparr['m_thumbid']] = $m_thumb->config['main'];
         }
         if (@$this->tag['thumb'] && @$this->tag['maxwidth'] && @$this->tag['maxheight'] && islocal($this->item['url'], 1)) {
             //生成缩略图或启用缩略图
             $true_local = islocal($this->item['url'], 2);
             if ($true_local && is_file(local_atm($this->item['url']) . 's/' . $this->tag['maxwidth'] . '_' . $this->tag['maxheight'] . '.jpg') || !$true_local && in_str($this->tag['maxwidth'] . '_' . $this->tag['maxheight'], @$this->item['thumbs'])) {
                 //已生成缩略图
                 $this->item['url_s'] = $this->item['url'] . 's/' . $this->tag['maxwidth'] . '_' . $this->tag['maxheight'] . '.jpg';
             } else {
                 $this->item['url_s'] = @$m_thumb->thumb($this->item['url'], $this->temparr['m_thumbid'], $this->tag['tname'], $this->item['fid'], @$this->tag['maxwidth'], @$this->tag['maxheight']);
             }
         } else {
             $this->item['url_s'] = $this->item['url'];
         }
         if ($this->item['url_s'] != $this->item['url']) {
             //真正启用了缩略图,直接使用设定的宽高
             $this->item['width'] = @$this->tag['maxwidth'];
             $this->item['height'] = @$this->tag['maxheight'];
         } else {
             //使用原图来重计宽高
             $wh = imagewh($this->item['url'], @$this->item['width'], @$this->item['height'], @$this->tag['maxwidth'], @$this->tag['maxheight']);
             $this->item['width'] = $wh['width'];
             $this->item['height'] = $wh['height'];
         }
     } elseif ($this->tclass == 'members') {
         global $grouptypes;
         foreach ($grouptypes as $k => $v) {
             $this->item['grouptype' . $k . 'name'] = '';
             if (!empty($this->item['grouptype' . $k])) {
                 $usergroups = read_cache('usergroups', $k);
                 $this->item['grouptype' . $k . 'name'] = $usergroups[$this->item['grouptype' . $k]]['cname'];
             }
         }
         $m_thumb->config = array('id' => $this->item['mid'], 'mode' => 'm', 'smode' => $this->item['mchid']);
         unset($usergroups, $v);
     }
     //从上级标识接受参数作为当前原始标识
     if (!empty($this->tag['rrelays'])) {
         $midarr = array();
         $relays = relays2arr($this->tag['rrelays']);
         foreach ($relays as $k => $v) {
             if (isset($this->temparr[$v])) {
                 $midarr[$k] = $this->temparr[$v];
             }
         }
         $this->item += $midarr;
         unset($midarr);
     }
     $this->item += $this->temparr;
     //从当前原始标识向下级标识传送参数
     $this->midarr = $this->temparr;
     $relays = $orelays;
     !empty($this->tag['relays']) && ($relays = relays2arr($this->tag['relays']) + $relays);
     foreach ($relays as $k => $v) {
         if (isset($this->item[$v])) {
             $this->midarr[$k] = $this->item[$v];
         }
     }
     unset($relays);
 }