}
if (@ini_get('file_uploads')) {
    $fileupload = '允许 ' . ini_get('upload_max_filesize');
} else {
    $fileupload = '<font color="red">禁止</font>';
}
$globals = getphpcfg('register_globals');
$safemode = getphpcfg('safe_mode');
$gd_version = gd_version();
$gd_version = $gd_version ? '版本:' . $gd_version : '不支持';
//查询数据信息
$hiddenarttotal = $DB->result($DB->query("SELECT COUNT(articleid) FROM {$db_prefix}articles WHERE visible='0'"), 0);
$hiddencomtotal = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments WHERE visible='0'"), 0);
$tagtotal = $DB->result($DB->query("SELECT COUNT(mid) FROM {$db_prefix}metas WHERE type='tag'"), 0);
$linktotal = $DB->result($DB->query("SELECT COUNT(linkid) FROM {$db_prefix}links"), 0);
$server['datetime'] = sadate('Y-m-d H:i:s');
$server['software'] = $_SERVER['SERVER_SOFTWARE'];
if (function_exists('memory_get_usage')) {
    $server['memory_info'] = get_real_size(memory_get_usage());
}
$mysql_version = mysql_get_server_info();
$mysql_runtime = '';
$query = $DB->query("SHOW STATUS");
while ($r = $DB->fetch_array($query)) {
    if (eregi("^uptime", $r['Variable_name'])) {
        $mysql_runtime = $r['Value'];
    }
}
$mysql_runtime = format_timespan($mysql_runtime);
require_once SABLOG_ROOT . 'include/func/attachment.func.php';
$attachdir = SABLOG_ROOT . $options['attachments_dir'];
// --------------------------------------------------------------//
// 本程序主页:http://www.sablog.net
// ==============================================================//
require_once 'global.php';
if (!$options['sitemap']) {
    exit('Sitemap is not available.');
}
//读取缓存文件
$cachefile = SABLOG_ROOT . 'data/cache/cache_sitemap.php';
//如果读取失败或缓存过期则从新读取数据库
if (@(!(include $cachefile)) || $expiration < $timestamp) {
    $mapdb = array();
    $query = $DB->query("SELECT articleid,dateline,alias FROM {$db_prefix}articles WHERE visible='1' ORDER BY dateline DESC LIMIT 1000");
    while ($article = $DB->fetch_array($query)) {
        $article['url'] = getpermalink($article['articleid'], $article['alias']);
        $article['dateline'] = sadate('Y-m-d\\TH:i:s\\Z', $article['dateline']);
        $mapdb[$article['articleid']] = $article;
    }
    //end while
    unset($article);
    $DB->free_result($query);
    $cachedata = "<?php\r\nif(!defined('SABLOG_ROOT')) exit('Access Denied');\r\n\$expiration='" . ($timestamp + 86400) . "';\r\n\$mapdb = unserialize('" . addcslashes(serialize($mapdb), '\\\'') . "');\r\n?>";
    if (!writefile($cachefile, $cachedata)) {
        exit('Can not write to cache files, please check directory ./data/cache/ .');
    }
}
header("Content-Type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
if (is_array($mapdb)) {
    foreach ($mapdb as $article) {
        echo "\t<url>\n";
    $pagenum = 15;
    if ($page) {
        $start_limit = ($page - 1) * $pagenum;
    } else {
        $start_limit = 0;
        $page = 1;
    }
    $total = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments c {$sql_query}"), 0);
    if ($total) {
        $multipage = multi($total, $pagenum, $page, 'cp.php?job=comment&amp;action=list' . $pagelink);
        $query = $DB->query("SELECT c.*,a.title\r\n\t\t\tFROM {$db_prefix}comments c\r\n\t\t\tLEFT JOIN {$db_prefix}articles a ON a.articleid = c.articleid\r\n\t\t\t{$sql_query}\r\n\t\t\tORDER BY c.commentid DESC LIMIT {$start_limit}, {$pagenum}");
        $commentdb = array();
        while ($comment = $DB->fetch_array($query)) {
            $comment['content'] = preg_replace("/\\[quote=(.*?)\\]\\s*(.+?)\\s*\\[\\/quote\\]/is", "", $comment['content']);
            if (empty($comment['content'])) {
                $comment['content'] = '......';
            }
            $comment['content'] = str_replace(array("\r\n\r\n", "\n\n", "\r\r"), array("\r\n", "\n", "\r"), $comment['content']);
            $comment['avatardb'] = get_avatar($comment['email'], 32);
            $comment['dateline'] = sadate('Y-m-d H:i', $comment['dateline'], 1);
            $comment['content'] = html_clean($comment['content']);
            $commentdb[$comment['commentid']] = $comment;
        }
        unset($comment);
        $DB->free_result($query);
    }
}
//end list
$navlink_L = $subnav ? ' &raquo; <span>' . $subnav . '</span>' : '';
cpheader($subnav);
include template('comment');
function writetocache($cachename, $cachedata = '')
{
    $cachedb = array('allarticleids', 'archives', 'categories', 'stick', 'hottags', 'links', 'newarticles', 'newcomments', 'settings', 'statistics', 'stylevars', 'autosave');
    if (in_array($cachename, $cachedb)) {
        $cachedir = SABLOG_ROOT . 'data/cache/';
        $cachefile = $cachedir . 'cache_' . $cachename . '.php';
        if (!is_dir($cachedir)) {
            @mkdir($cachedir, 0777);
        }
        $cachedata = "<?php\r\n//Sablog-X cache file\r\n//Created on " . sadate('Y-m-d H:i:s') . "\r\n\r\nif(!defined('SABLOG_ROOT')) exit('Access Denied');\r\n\r\n" . $cachedata . "\r\n\r\n?>";
        if (!writefile($cachefile, $cachedata)) {
            exit('Can not write to ' . $cachename . ' cache files, please check directory ./data/cache/ .');
        }
    }
}
if ($_POST['action'] == 'autosave') {
    if ($_POST['title'] || $_POST['description'] || $_POST['content']) {
        autosave_recache($_POST['title'], $_POST['description'], $_POST['content']);
    }
}
if ($_GET['action'] == 'switchtodraft') {
    if (@(include_once SABLOG_ROOT . 'data/cache/cache_autosave.php')) {
        $autosavedb = sax_stripslashes($autosavedb);
        $title = $autosavedb[$sax_uid]['title'];
        $description = $autosavedb[$sax_uid]['description'];
        $content = $autosavedb[$sax_uid]['content'];
        $content = str_replace(array("\r", "\n"), '', $content);
        $description = str_replace(array("\r", "\n"), '', $description);
        ?>
var timestamp = '<?php 
        echo sadate('m月d日,H:i:s');
        ?>
';
$('#title').val('<?php 
        echo $title;
        ?>
');
oEditor.html('<?php 
        echo $content;
        ?>
');
if ($('#description').length) {
	oEditor2.html('<?php 
        echo $description;
        ?>
');
// --------------------------------------------------------------//
// 本程序作者:angel
// --------------------------------------------------------------//
// 本程序版本:SaBlog-X Ver 2.0
// --------------------------------------------------------------//
// 本程序主页:http://www.sablog.net
// ==============================================================//
if (!defined('SABLOG_ROOT')) {
    exit('Access Denied');
}
if ($stats['article_count']) {
    $articledb = array();
    $query = $DB->query("SELECT articleid,title,dateline,comments,readpassword,alias FROM {$db_prefix}articles WHERE visible='1' ORDER BY dateline DESC");
    while ($article = $DB->fetch_array($query)) {
        $date = sadate('Y-m', $article['dateline']);
        $article['dateline'] = sadate('m/d', $article['dateline']);
        $article['url'] = getpermalink($article['articleid'], $article['alias']);
        $articledb[$date][] = $article;
    }
}
if (!$options['meta_keywords']) {
    $tmp = $comma = '';
    if (is_array($catecache) && count($catecache)) {
        foreach ($catecache as $data) {
            $tmp .= $comma . $data['name'];
            $comma = ',';
        }
        $options['meta_keywords'] = $tmp;
    }
}
$options['meta_keywords'] = '文章归档,' . $options['meta_keywords'];
            $orderid = 0;
            $start_limit = 0;
            $page = 1;
        }
        $multipage = multi($total, $pagenum, $page, 'index.php?action=auditcm');
        $sqladd = '';
        if ($sax_group == '2') {
            $sqladd = " AND a.uid='{$sax_uid}'";
        }
        $query = $DB->query("SELECT c.articleid, c.author, c.commentid, c.dateline, c.content, a.title FROM {$db_prefix}comments c LEFT JOIN {$db_prefix}articles a ON (a.articleid=c.articleid) WHERE a.visible='1' AND c.visible='0' {$sqladd} ORDER BY commentid DESC LIMIT {$start_limit}, {$pagenum}");
        echo "<ul>\n";
        while ($comment = $DB->fetch_array($query)) {
            $orderid++;
            echo "<li>\n";
            echo "<p><strong>{$orderid}.</strong>文章:<a href=\"index.php?action=show&amp;id=" . $comment['articleid'] . "\">" . $comment['title'] . "</a></p>\n";
            echo "<p>" . $comment['author'] . " : " . sadate('Y-m-d H:i', $comment['dateline'], 1) . " [<a href=\"index.php?action=auditcm_ok&amp;commentid=" . $comment['commentid'] . "\">显示</a>]</p>\n";
            echo "<p>" . wap_html_clean($comment['content']) . "</p>\n";
            echo "<br />\n";
            echo "</li>\n";
        }
        echo "</ul>\n";
        unset($comment);
        echo "<p>共有" . $total . "条隐藏评论</p>\n";
        echo $multipage;
        $DB->free_result($query);
    } else {
        echo "<p>没有需要审核的评论</p>\n";
    }
    wap_footer();
}
// 审核评论操作
            }
            if ($action == 'adminlog') {
                foreach ($logs as $logrow) {
                    $logrow = explode("\t", $logrow);
                    $logrow[1] = sadate('Y-m-d H:i:s', $logrow[1], 1);
                    $logdb[] = $logrow;
                }
            } elseif ($action == 'loginlog') {
                foreach ($logs as $logrow) {
                    $logrow = explode("\t", $logrow);
                    $logrow[1] = $logrow[1] ? htmlspecialchars($logrow[1]) : '<span class="no">Null</span>';
                    $logrow[2] = sadate('Y-m-d H:i:s', $logrow[2], 1);
                    $logrow[4] = trim($logrow[4]) == 'Succeed' ? '<span class="yes">Succeed</span>' : '<span class="no">Failed</span>';
                    $logdb[] = $logrow;
                }
            } else {
                foreach ($logs as $logrow) {
                    $logrow = explode("\t", $logrow);
                    $logrow[1] = sadate('Y-m-d H:i:s', $logrow[1], 1);
                    $logdb[] = $logrow;
                }
            }
        }
        $subnav = $opname;
        unset($logrow);
    }
    //end
}
$navlink_L = $subnav ? ' &raquo; <span>' . $subnav . '</span>' : '';
cpheader($subnav);
include template('tools');
         $articledb[$meta['cid']]['content'] = highlight_tag($articledb[$meta['cid']]['content'], $meta['name']);
     } else {
         $meta['url'] = getcatelink($meta['mid'], $meta['slug']);
     }
     $metadb[$meta['cid']][$meta['type']][] = $meta;
 }
 unset($meta);
 $DB->free_result($query);
 if ($haveattach) {
     require_once SABLOG_ROOT . 'include/func/attachment.func.php';
     $attachdb = array();
     $query = $DB->query("SELECT attachmentid, articleid, dateline, filename, filetype, filesize, downloads, filepath, thumb_filepath, thumb_width, thumb_height, isimage FROM {$db_prefix}attachments WHERE articleid IN ({$aids}) ORDER BY attachmentid");
     $size = explode('x', strtolower($options['attachments_thumbs_size']));
     while ($attach = $DB->fetch_array($query)) {
         $attach['filesize'] = sizecount($attach['filesize']);
         $attach['dateline'] = sadate('Y-m-d H:i', $attach['dateline']);
         $attach['filepath'] = $options['attachments_dir'] . $attach['filepath'];
         $attach['thumbs'] = 0;
         if ($attach['isimage']) {
             if ($attach['thumb_filepath'] && $options['attachments_thumbs'] && file_exists(SABLOG_ROOT . $options['attachments_dir'] . $attach['thumb_filepath'])) {
                 $attach['thumbs'] = 1;
                 $attach['thumb_filepath'] = $options['attachments_dir'] . $attach['thumb_filepath'];
             } else {
                 $imagesize = @getimagesize(SABLOG_ROOT . $attach['filepath']);
                 $im = scale_image(array('max_width' => $size[0], 'max_height' => $size[1], 'cur_width' => $imagesize[0], 'cur_height' => $imagesize[1]));
                 $attach['thumb_width'] = $im['img_width'];
                 $attach['thumb_height'] = $im['img_height'];
             }
             $articledb[$attach['articleid']]['image'][$attach['attachmentid']] = $attach;
         } else {
             $articledb[$attach['articleid']]['file'][$attach['attachmentid']] = $attach;
    if ($page) {
        $start_limit = ($page - 1) * $pagenum;
    } else {
        $start_limit = 0;
        $page = 1;
    }
    $total = $DB->result($DB->query("SELECT count(articleid) FROM {$db_prefix}articles a WHERE 1 {$addquery} {$uquery}"), 0);
    if ($total) {
        $multipage = multi($total, $pagenum, $page, 'cp.php?job=article&amp;action=list' . $pagelink);
        $query = $DB->query("SELECT a.dateline,a.articleid,a.title,a.uid,a.comments,a.attachments,a.visible,a.readpassword,a.stick,u.username\r\n\t\t\tFROM {$db_prefix}articles a\r\n\t\t\tLEFT JOIN {$db_prefix}users u ON u.userid=a.uid\r\n\t\t\tWHERE 1 {$addquery} {$uquery} ORDER BY dateline DESC LIMIT {$start_limit}, {$pagenum}");
        $aids = $comma = '';
        $articledb = array();
        while ($article = $DB->fetch_array($query)) {
            $aids .= $comma . $article['articleid'];
            $comma = ',';
            $article['dateline'] = sadate('Y-m-d H:i', $article['dateline'], 1);
            $articledb[$article['articleid']] = $article;
        }
        unset($article);
        $DB->free_result($query);
        $metadb = array();
        if ($aids) {
            $query = $DB->query("SELECT m.mid, m.name, r.cid FROM {$db_prefix}metas m\r\n\t\t\t\tINNER JOIN {$db_prefix}relationships r ON r.mid = m.mid\r\n\t\t\t\tWHERE m.type IN ('category') AND r.cid IN ({$aids})\r\n\t\t\t\tORDER BY m.displayorder ASC, m.mid DESC");
            while ($meta = $DB->fetch_array($query)) {
                $metadb[$meta['cid']][] = $meta;
            }
            unset($meta);
            $DB->free_result($query);
        }
    }
}
Example #11
0
        $pagelink .= '&groupid=' . $groupid;
        $subnav = $groupdb[$groupid];
    }
    //搜索用户
    $srhname = char_cv($srhname);
    if ($srhname) {
        $sqladd .= " AND (BINARY username LIKE '%" . str_replace('_', '\\_', $srhname) . "%' OR username='******')";
        $pagelink .= '&srhname=' . $srhname;
    }
    $usertotal = $DB->result($DB->query("SELECT COUNT(userid) FROM {$db_prefix}users"), 0);
    $admintotal = $DB->result($DB->query("SELECT COUNT(userid) FROM {$db_prefix}users WHERE groupid='1'"), 0);
    $editortotal = $DB->result($DB->query("SELECT COUNT(userid) FROM {$db_prefix}users WHERE groupid='2'"), 0);
    $publictotal = $usertotal - $admintotal - $editortotal;
    $total = $DB->result($DB->query("SELECT COUNT(userid) FROM {$db_prefix}users " . $sqladd), 0);
    $multipage = multi($total, $pagenum, $page, 'cp.php?job=user&amp;action=list' . $pagelink);
    $query = $DB->query("SELECT userid,email,username,url,regdateline,groupid,lastvisit FROM {$db_prefix}users {$sqladd} ORDER BY userid DESC LIMIT {$start_limit}, {$pagenum}");
    $userdb = array();
    while ($user = $DB->fetch_array($query)) {
        $user['regdateline'] = sadate('Y-m-d H:i', $user['regdateline'], 1);
        $user['lastvisit'] = $user['lastvisit'] ? sadate('Y-m-d H:i', $user['lastvisit'], 1) : '从未';
        $user['group'] = $groupdb[$user['groupid']];
        $user['disabled'] = $user['groupid'] == 1 || $user['userid'] == 1 ? 'disabled' : '';
        $userdb[$user['userid']] = $user;
    }
    unset($user);
    $DB->free_result($query);
}
//end list
$navlink_L = $subnav ? ' &raquo; <span>' . $subnav . '</span>' : '';
cpheader($subnav);
include template('user');
function calendar($y, $m)
{
    global $DB, $db_prefix, $options, $timestamp, $timeoffset;
    !$y && ($y = sadate('Y'));
    !$m && ($m = sadate('m'));
    //当前月等于1
    if ($m == 1) {
        $lastyear = $y - 1;
        $lastmonth = 12;
        $nextmonth = $m + 1;
        $nextyear = $y;
    } elseif ($m == 12) {
        $lastyear = $y;
        $lastmonth = $m - 1;
        $nextyear = $y + 1;
        $nextmonth = 1;
    } else {
        $lastmonth = $m - 1;
        $nextmonth = $m + 1;
        $lastyear = $nextyear = $y;
    }
    if ($nextmonth < 10) {
        $nextmonth = '0' . $nextmonth;
    }
    if ($lastmonth < 10) {
        $lastmonth = '0' . $lastmonth;
    }
    $weekday = sadate('w', mktime(0, 0, 0, $m, 1, $y));
    $totalday = sadate('t', mktime(0, 0, 0, $m, 1, $y));
    list($start, $end) = explode('-', gettimestamp($y, $m));
    // 动态缓存
    $expiration = 0;
    $cachefile = SABLOG_ROOT . 'data/cache/cache_calendar.php';
    if ($m != sadate('m') || $y != sadate('Y') || !@(include $cachefile) || $expiration < $timestamp) {
        $query = $DB->query("SELECT dateline FROM {$db_prefix}articles WHERE visible='1' AND dateline >= '" . correcttime($start) . "' AND dateline < '" . correcttime($end) . "'");
        $datelines = array();
        $articledb = array();
        while ($article = $DB->fetch_array($query)) {
            $datelines[] = sadate('Y-m-j', $article['dateline']);
            $day = sadate('j', $article['dateline']);
            if (!isset($articledb[$day])) {
                $articledb[$day]['num'] = 1;
            } else {
                $articledb[$day]['num']++;
            }
        }
        $br = 0;
        $ret['html'] = "<tr>\n";
        for ($i = 1; $i <= $weekday; $i++) {
            $ret['html'] .= "<td class=\"cal_day1\"></td>\n";
            $br++;
        }
        for ($i = 1; $i <= $totalday; $i++) {
            $br++;
            if (in_array($y . '-' . $m . '-' . $i, $datelines)) {
                $td = '<a title="' . $i . '日内发表了' . $articledb[$i]['num'] . '篇文章" href="' . getdaylink($y . $m, $i) . '">' . $i . '</a>';
            } else {
                $td = $i;
            }
            if ($i == sadate('d') && $m == sadate('m') && $y == sadate('Y')) {
                $class = 'cal_day2';
            } else {
                $class = 'cal_day1';
            }
            $ret['html'] .= "<td class=\"" . $class . "\">" . $td . "</td>\n";
            if ($br >= 7) {
                $ret['html'] .= "</tr>\n<tr>\n";
                $br = 0;
            }
        }
        if ($br != 0) {
            for ($i = $br; $i < 7; $i++) {
                $ret['html'] .= "<td class=\"cal_day1\"></td>\n";
            }
        }
        $ret['html'] .= "</tr>\n";
        if ($y . $m == sadate('Ym')) {
            $cachedata = "<?php\r\nif(!defined('SABLOG_ROOT')) exit('Access Denied');\r\n\$expiration='" . ($timestamp + 300) . "';\r\n\$ret = unserialize('" . addcslashes(serialize($ret), '\\\'') . "');\r\n?>";
            if (!writefile($cachefile, $cachedata)) {
                exit('Can not write to calendar cache files, please check directory ./data/cache/ .');
            }
        }
    }
    $ret['prevmonth'] = $lastyear . $lastmonth;
    $ret['nextmonth'] = $nextyear . $nextmonth;
    $ret['cur_month'] = $m;
    $e_month = $m < 10 ? str_replace('0', '', $m) : $m;
    $ret['cur_date'] = $y . '年' . $m . '月';
    return $ret;
}
Example #13
0
 		$start_limit = 0;
 		$page = 1;
 	}
 	$multipage = multi($article['comments'], $article_comment_num, $page, $article['url']);
 	//$commentsql = " LIMIT $start_limit, $article_comment_num";
 }
 */
 $cmtorderid = 0;
 $cmtorder = $options['comment_order'] ? 'ASC' : 'DESC';
 $query = $DB->query("SELECT commentid,comment_parent, author,email,url,dateline,content FROM {$db_prefix}comments WHERE articleid='" . $article['articleid'] . "' AND visible='1' ORDER BY dateline {$cmtorder} {$commentsql}");
 $commentdb = array();
 while ($comment = $DB->fetch_array($query)) {
     $comment['quoteuser'] = $comment['author'];
     $comment['avatardb'] = get_avatar($comment['email']);
     $comment['content'] = html_clean($comment['content']);
     $comment['dateline'] = sadate($options['comment_timeformat'], $comment['dateline'], 1);
     $comment['children'] = array();
     $comment['level'] = isset($commentdb[$comment['comment_parent']]) ? $commentdb[$comment['comment_parent']]['level'] + 1 : 0;
     if (!$comment['comment_parent']) {
         $cmtorderid++;
     }
     $comment['cmtorderid'] = $cmtorderid;
     $commentdb[$comment['commentid']] = $comment;
 }
 unset($comment);
 $DB->free_result($query);
 $commentStacks = array();
 $multipage = '';
 foreach ($commentdb as $commentid => $comment) {
     $comment_parent = $comment['comment_parent'];
     if ($comment_parent == 0) {
}
permission(array(1, 2));
$max_upload_size = max_upload_size();
$max_upload_size_unit = sizecount($max_upload_size);
$attachments = $attach_data = array();
if ($uploadmode == 'swf') {
    if (isset($_FILES["Filedata"]) && is_array($_FILES["Filedata"])) {
        $attach = $_FILES["Filedata"];
    }
    $gd_version = gd_version();
    if (disuploadedfile($attach['tmp_name']) || !($attach['tmp_name'] != 'none' && $attach['tmp_name'] && $attach['name'])) {
        $attach['name'] = strtolower($attach['name']);
        $attach['ext'] = getextension($attach['name']);
        $attach['type'] = mime_content_type($attach['name']);
        $fnamehash = md5(uniqid(microtime()));
        $attachsubdir = '/date_' . sadate('Ym') . '/';
        // 取得附件目录的绝对路径
        $attach_dir = SABLOG_ROOT . $options['attachments_dir'] . $attachsubdir;
        if (!is_dir($attach_dir)) {
            mkdir($attach_dir, 0777);
            @chmod($attach_dir, 0777);
            fclose(fopen($attach_dir . 'index.htm', 'w'));
        }
        // 判断上传的类型
        // path变量为管理目录相对路径,后台操作用
        // filepath变量为跟目录相对路径,前台读取用
        // fnamehash变量为当前时间的MD5散列,重命名附件名
        if (!in_array($attach['ext'], array('gif', 'jpg', 'jpeg', 'png'))) {
            $path = $attach_dir . $fnamehash . '.file';
            $filepath = $attachsubdir . $fnamehash . '.file';
        } else {
}
// 获取时间,假如是WIN系统,一定要做范围的限制。否则.....
$setdate = (int) $_GET['setdate'];
if ($setdate && getstrlen($setdate) == 6) {
    $setyear = substr($setdate, 0, 4);
    if ($setyear >= 2038 || $setyear <= 1970) {
        $setyear = sadate('Y');
        $setmonth = sadate('m');
        $start = $end = 0;
    } else {
        $setmonth = substr($setdate, -2);
        list($start, $end) = explode('-', gettimestamp($setyear, $setmonth));
    }
} else {
    $setyear = sadate('Y');
    $setmonth = sadate('m');
    $start = $end = 0;
}
// 查询按月归档
//$monthname = array('','January','February','March','April','May','June','July','August','September','October','November','December');
// 查询并生成日历
if ($options['show_calendar']) {
    $calendar = calendar($setyear, $setmonth);
    $prevmonth = getdatelink($calendar['prevmonth']);
    $nextmonth = getdatelink($calendar['nextmonth']);
}
// 查询随机文章
if ($options['randarticle_num']) {
    $rand_article = get_rand_article();
}
/***
Example #16
0
    if (!writefile($cachefile, $cachedata)) {
        exit('Can not write to cache files, please check directory ./data/cache/ .');
    }
}
//pr($articledb);
//exit;
header("Content-Type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<rss version=\"2.0\">\n";
echo "\t<channel>\n";
echo "\t\t<title>" . htmlspecialchars($rss_title) . "</title>\n";
echo "\t\t<link>" . $rss_url . "</link>\n";
echo "\t\t<description>" . htmlspecialchars($options['description']) . "</description>\n";
echo "\t\t<copyright>Powered by SaBlog-X. Copyright (C) 2003-2012.</copyright>\n";
echo "\t\t<generator>SaBlog-X Version {$SABLOG_VERSION} Build {$SABLOG_RELEASE}</generator>\n";
echo "\t\t<lastBuildDate>" . sadate('r', $timestamp) . "</lastBuildDate>\n";
echo "\t\t<ttl>" . $options['rss_ttl'] . "</ttl>\n";
if ($articledb && is_array($articledb)) {
    foreach ($articledb as $article) {
        echo "\t\t<item>\n";
        echo "\t\t\t<link>" . $article['url'] . "</link>\n";
        echo "\t\t\t<guid>" . $article['url'] . "</guid>\n";
        echo "\t\t\t<title>" . $article['title'] . "</title>\n";
        echo "\t\t\t<author>" . $article['email'] . "(" . $article['username'] . ")</author>\n";
        if ($article['readpassword']) {
            echo "\t\t\t<description>文章需要输入密码才能浏览.</description>\n";
        } else {
            echo "\t\t\t<description><![CDATA[" . $article['content'] . "]]></description>\n";
        }
        echo "\t\t\t<link>" . $article['url'] . "</link>\n";
        if ($metadb[$article['articleid']]['category'] && is_array($metadb[$article['articleid']]['category'])) {