Example #1
0
     $wheresql .= " AND a.sid " . multi_str($u_sids);
 }
 //模型范围
 if (!empty($u_chids)) {
     $wheresql .= " AND a.chid " . multi_str($u_chids);
 }
 $filterstr = '';
 foreach (array('nmuid', 'viewdetail', 'caid', 'keyword') as $k) {
     ${$k} && ($filterstr .= "&{$k}=" . rawurlencode(stripslashes(${$k})));
 }
 foreach (array('checked', 'valid') as $k) {
     ${$k} != -1 && ($filterstr .= "&{$k}=" . ${$k});
 }
 foreach ($cotypes as $coid => $cotype) {
     if (!empty(${'u_ccids' . $coid})) {
         if ($cnsql = cnsql($coid, ${'u_ccids' . $coid}, 'a.')) {
             $wheresql .= " AND {$cnsql}";
         }
         ///////////////////////
     }
 }
 $wheresql = "WHERE " . (empty($no_list) ? $wheresql : '1=0');
 if (!submitcheck('barcsedit')) {
     if (empty($u_tplname)) {
         echo form_str($action . 'archivesedit', "?action=archives&nmuid={$nmuid}&page={$page}");
         tabheader_e();
         echo "<tr><td class=\"item2\">";
         echo lang('keyword') . "&nbsp; <input class=\"text\" name=\"keyword\" type=\"text\" value=\"{$keyword}\" size=\"8\" style=\"vertical-align: middle;\">&nbsp; ";
         //审核状态
         if (empty($u_filters) || in_array('check', $u_filters)) {
             $checkedarr = array('-1' => lang('nolimit') . lang('check'), '0' => lang('nocheck'), '1' => lang('checked'));
Example #2
0
 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);
 } else {
     $sqlstr .= " AND chid " . multi_str($sitemap['setting']['chids']);
 }
 if (!empty($sitemap['setting']['casource'])) {
     $sqlstr .= " AND caid " . multi_str($sitemap['setting']['caids']);
 }
 foreach ($cotypes as $coid => $cotype) {
     if (!empty($sitemap['setting']['cosource' . $coid])) {
         if ($cnsql = cnsql($coid, $sitemap['setting']['ccids' . $coid], '')) {
             $sqlstr .= " AND {$cnsql}";
         }
     }
 }
 $life = empty($sitemap['setting']['life']) ? 0 : $sitemap['setting']['life'];
 $datastr = "<?xml version=\"1.0\" encoding=\"{$mcharset}\"?>\n" . "<document>\n" . "  <webSite>" . htmlspecialchars($cms_abs) . "</webSite>\n" . "  <webMaster>{$adminemail}</webMaster>\n" . "  <updatePeri>" . $life * 60 . "</updatePeri>\n";
 $query = $db->query("SELECT aid FROM {$tblprefix}archives {$sqlstr} ORDER BY aid DESC LIMIT 0,100");
 $aedit = new cls_arcedit();
 while ($row = $db->fetch_array($query)) {
     $aid = $row['aid'];
     $aedit->init();
     $aedit->set_aid($aid);
     $aedit->detail_data(0);
     $datastr .= "  <item>\n" . "    <title>" . htmlspecialchars($aedit->archive['subject']) . "</title>\n" . "    <link>" . htmlspecialchars(view_arcurl($aedit->archive)) . "</link>\n" . "    <text>" . htmlspecialchars($aedit->archive[$aedit->channel['baidu']]) . "</text>\n" . "    <image>" . htmlspecialchars(view_atmurl($aedit->archive['thumb'])) . "</image>\n" . "    <keywords>" . htmlspecialchars($aedit->archive['keywords']) . "</keywords>\n" . "    <category>" . $catalogs[$aedit->archive['caid']]['title'] . "</category>\n" . "    <author>" . htmlspecialchars($aedit->archive['author']) . "</author>\n" . "    <source>" . htmlspecialchars($aedit->archive['source']) . "</source>\n" . "    <pubDate>" . date('Y-m-d H:i:s', $aedit->archive['createdate']) . "</pubDate>\n" . "  </item>\n";
 }
Example #3
0
if ($caid) {
    $_da['catalog'] = $catalogs[$caid]['title'];
    if ($cnsql = cnsql(0, cnsonids($caid, $catalogs), 'a.')) {
        $wherestr .= " AND {$cnsql}";
    }
    $filterstr .= ($filterstr ? '&' : '') . "caid={$caid}";
}
//分类因素
foreach ($cotypes as $k => $v) {
    ${"ccid{$k}"} = empty(${"ccid{$k}"}) ? 0 : max(0, intval(${"ccid{$k}"}));
    $_da["ccid{$k}"] = ${"ccid{$k}"};
    $_da['ccid' . $k . 'title'] = '';
    if (${"ccid{$k}"}) {
        $coclasses = read_cache('coclasses', $k);
        $_da['ccid' . $k . 'title'] = $coclasses[${"ccid{$k}"}]['title'];
        if ($cnsql = cnsql($k, cnsonids(${"ccid{$k}"}, $coclasses), 'a.')) {
            $wherestr .= " AND {$cnsql}";
        }
        $filterstr .= ($filterstr ? '&' : '') . "ccid{$k}=" . ${"ccid{$k}"};
    }
}
//处理indays多少天以内添加的
$indays = empty($indays) ? 0 : max(0, intval($indays));
$_da['indays'] = $indays;
if ($indays) {
    $wherestr .= " AND a.createdate>'" . ($timestamp - 86400 * $indays) . "'";
    $filterstr .= ($filterstr ? '&' : '') . "indays={$indays}";
}
//处理outdays多少天以前添加的
$outdays = empty($outdays) ? 0 : max(0, intval($outdays));
$_da['outdays'] = $outdays;
Example #4
0
function cn_statsum()
{
    //暂时不处理层的关系//需要更新缓存
    global $db, $tblprefix, $timestamp, $cotypestats, $cnodestatcircle, $cotypes, $subsites, $acatalogs;
    $cachetimefile = M_ROOT . './dynamic/stats/cotypesum_time.cac';
    if (empty($cotypestats) || $timestamp - @filemtime($cachetimefile) < $cnodestatcircle * 3600) {
        return;
    }
    $statarr = array_filter(explode(',', $cotypestats));
    if (!$statarr) {
        return;
    }
    @set_time_limit(1000);
    @ignore_user_abort(TRUE);
    load_cache('cotypes,acatalogs');
    if (in_array('ca', $statarr)) {
        $query = $db->query("SELECT caid,COUNT(aid) AS archives,SUM(clicks) AS clicks FROM {$tblprefix}archives GROUP BY caid");
        while ($item = $db->fetch_array($query)) {
            $db->query("UPDATE {$tblprefix}catalogs SET archives='{$item['archives']}',clicks='{$item['clicks']}' WHERE caid='{$item['caid']}'", 'UNBUFFERED');
        }
        foreach ($acatalogs as $k1 => $v1) {
            $ids = cnsonids($k1, $acatalogs);
            if (count($ids) > 1) {
                $row = $db->fetch_one("SELECT SUM(archives) AS archives,SUM(clicks) AS clicks FROM {$tblprefix}catalogs WHERE caid " . multi_str($ids));
                $db->query("UPDATE {$tblprefix}catalogs SET archives='{$row['archives']}',clicks='{$row['clicks']}' WHERE caid='{$k1}'", 'UNBUFFERED');
            }
        }
        $sids = array_keys($subsites);
        $sids[] = 0;
        foreach ($sids as $v) {
            updatecache('catalogs', '', $v);
        }
    }
    foreach ($cotypes as $k => $v) {
        if (!$v['self_reg'] && in_array($k, $statarr)) {
            $coclasses = read_cache('coclasses', $k);
            foreach ($coclasses as $k1 => $v1) {
                if ($cnsql = cnsql($k, $k1, '')) {
                    $row = $db->fetch_one("SELECT COUNT(aid) AS archives,SUM(clicks) AS clicks FROM {$tblprefix}archives WHERE {$cnsql}");
                    $db->query("UPDATE {$tblprefix}coclass SET archives='{$row['archives']}',clicks='{$row['clicks']}' WHERE ccid='{$k1}'", 'UNBUFFERED');
                }
            }
            foreach ($coclasses as $k1 => $v1) {
                $ids = cnsonids($k1, $coclasses);
                if (count($ids) > 1 && ($cnsql = cnsql($k, $ids, ''))) {
                    $row = $db->fetch_one("SELECT SUM(archives) AS archives,SUM(clicks) AS clicks FROM {$tblprefix}coclass WHERE {$cnsql}");
                    $db->query("UPDATE {$tblprefix}coclass SET archives='{$row['archives']}',clicks='{$row['clicks']}' WHERE ccid='{$k1}'", 'UNBUFFERED');
                }
            }
            updatecache('coclasses', $k);
        }
    }
    unset($coclasses);
    if (@($fp = fopen($cachetimefile, 'w'))) {
        fclose($fp);
    }
    return;
}
Example #5
0
     ${$k} != -1 && ($filterstr .= "&{$k}=" . ${$k});
 }
 foreach ($cotypes as $coid => $cotype) {
     ${"ccid{$coid}"} = isset(${"ccid{$coid}"}) ? max(0, intval(${"ccid{$coid}"})) : 0;
     $ccids = array();
     if (!empty(${"ccid{$coid}"})) {
         $coclasses = read_cache('coclasses', $coid);
         $ccids = cnsonids(${"ccid{$coid}"}, $coclasses);
         if (!empty(${'u_ccids' . $coid})) {
             $ccids = array_intersect($ccids, ${'u_ccids' . $coid});
         }
     } elseif (!empty(${'u_ccids' . $coid})) {
         $ccids = ${'u_ccids' . $coid};
     }
     if (!empty($ccids)) {
         if ($cnsql = cnsql($coid, $ccids, 'a.')) {
             $wheresql .= " AND {$cnsql}";
         }
     } elseif (!empty(${"ccid{$coid}"}) || !empty(${'u_ccids' . $coid})) {
         $no_list = true;
     }
     ${"ccid{$coid}"} && ($filterstr .= "&ccid{$coid}=" . ${"ccid{$coid}"});
 }
 $wheresql = "WHERE " . (empty($no_list) ? $wheresql : '1=0');
 if (!submitcheck('barcsedit')) {
     if (empty($u_tplname)) {
         echo form_str($actionid . 'arcsedit', "{$urlpre}action={$action}&page={$page}{$param_suffix}");
         //搜索区块
         tabheader_e();
         echo "<tr><td colspan=\"2\" class=\"txt txtleft\">";
         //关键词固定显示