Exemple #1
0
}
//This is a hidden mode. It is inteded to be used in Mill project.
if (!isset($_REQUEST['list'])) {
    $listMode = 'archives';
} elseif ($_REQUEST['list'] == 'archives') {
    $listMode = 'archives';
} elseif ($_REQUEST['list'] == 'tags') {
    $listMode = 'tags';
} elseif ($_REQUEST['list'] == 'category') {
    $listMode = 'category';
} else {
    exit;
}
$article = new bwArticle();
$view = new bwView();
$article->alterPerPage(50000);
$view->setActiveNav($listMode);
$groupedArticles = array();
if ($listMode == 'archives') {
    $article->getArticleList();
    $allStatURL = array();
    foreach ($article->articleList as $oneArticle) {
        $YYYY = substr($oneArticle['aTime'], 0, 4);
        $groupedArticles[$YYYY][] = $oneArticle;
        $columnName[$YYYY] = $YYYY;
        $columnID[$YYYY] = $YYYY;
        isset($columnCount[$YYYY]) ? $columnCount[$YYYY]++ : ($columnCount[$YYYY] = 1);
        $allStatURL[$oneArticle['aID']] = "{$conf['siteURL']}/{$conf['linkPrefixArticle']}/{$oneArticle['aID']}/";
    }
    file_put_contents(P . 'conf/allAIDs.php', "<?php\r\n\$lf=" . var_export($allStatURL, true) . ";");
    krsort($groupedArticles);
Exemple #2
0
     if ($canonical->currentArgs['subAction'] == 'validatecategory') {
         $view->setMaster('admincategorylist');
         $view->setPassData($smt);
         $view->setWorkFlow(array('admincategorylist'));
         $view->finalize();
     } else {
         $cates = new bwCategory();
         $cates->addCategories(array($smt['aCateURLName'] => $smt['aCateDispName']));
         $cates->endBufferCache();
         ajaxSuccess('');
     }
 } else {
     $admin->checkCSRFCode('navibar');
     $article->setCutTime(0);
     // Pagination
     $article->alterPerPage(20);
     $article->getArticleList();
     $canonical->calTotalPages($article->totalArticles);
     $canonical->paginableURL = bw::$conf['siteURL'] . '/' . bw::$conf['linkPrefixAdmin'] . '/articles/list/%d' . bw::$conf['linkConj'] . 'CSRFCode=' . $admin->getCSRFCode('navibar');
     $view->doPagination();
     $adminarticlelist = $article->articleList;
     $article->alterPerPage(10000000);
     $article->getTrashedList();
     $admindraftlist = $article->articleList;
     $article->getSinglePageList();
     $adminsinglepagelist = $article->articleList;
     $view->setMaster('admin');
     $view->setPassData(array('adminarticlelist' => $adminarticlelist, 'admindraftlist' => $admindraftlist, 'adminsinglepagelist' => $adminsinglepagelist, 'admincatelist' => bw::$cateList, 'themeList' => $view->scanForThemes(), 'newCSRFCode' => $admin->getCSRFCode('newarticle'), 'oldCSRFCode' => $admin->getCSRFCode('navibar'), 'cateCSRFCode' => $admin->getCSRFCode('category')));
     $view->setWorkFlow(array('adminarticlelist', 'admincategorylist', 'adminarticles', 'admin'));
     $view->finalize();
 }
Exemple #3
0
 private function get_articles()
 {
     $this->check();
     if ($this->subAPI == 1) {
         //Get articles list
         $howmany = isset($this->partial['num']) ? max(1, floor($this->partial['num'])) : 5;
         $startTime = isset($this->partial['since']) ? strtotime($this->partial['since']) : false;
         $pageNum = isset($this->partial['p']) ? max(1, floor($this->partial['p'])) : 1;
         $article = new bwArticle();
         if ($startTime) {
             //Get articles later than this time
             $article->setSinceTime($startTime);
         }
         $article->alterPageNum($pageNum);
         $article->alterPerPage($howmany);
         $article->getArticleList();
         $outputs = array();
         $i = 0;
         $totalPages = ceil($article->totalArticles / $howmany);
         if ($pageNum > $totalPages) {
             $this->throwError(404, 'Page number does not exist.');
         }
         $extraHeader = "Link: <" . bw::$conf['siteURL'] . "/api.php/articles?num={$howmany}&p=1>; rel=\"first\", ";
         $extraHeader .= "<" . bw::$conf['siteURL'] . "/api.php/articles?num={$howmany}&p={$totalPages}>; rel=\"last\"";
         if ($pageNum + 1 <= $totalPages) {
             $extraHeader .= ",  <" . bw::$conf['siteURL'] . "/api.php/articles?num={$howmany}&p=" . ($pageNum + 1) . ">; rel=\"next\"";
         }
         if ($pageNum > 1) {
             $extraHeader .= ",  <" . bw::$conf['siteURL'] . "/api.php/articles?num={$howmany}&p=" . ($pageNum - 1) . ">; rel=\"prev\"";
         }
         foreach ($article->articleList as $item) {
             $outputs[$i]['ID'] = $item['aID'];
             $outputs[$i]['title'] = $item['aTitle'];
             $outputs[$i]['date'] = $item['aTime'];
             $outputs[$i]['content'] = bwView::textFormatter(str_replace('+++', '', $item['aContent']));
             $outputs[$i]['category'] = $item['aCateDispName'];
             $item['aTags'] && ($outputs[$i]['tags'] = @explode(',', $item['aTags']));
             $outputs[$i]['permal-link'] = bw::$conf['siteURL'] . '/' . bw::$conf['linkPrefixArticle'] . "/{$item['aID']}/";
             $outputs[$i]['author'] = bw::$conf['authorName'];
             $outputs[$i]['about'] = bw::$conf['authorIntro'];
             $outputs[$i]['homepage'] = bw::$conf['siteURL'];
             $i++;
         }
         $this->done(200, array("articles" => $outputs), $extraHeader);
     } else {
         $article = new bwArticle();
         $article->fetchArticle($this->subAPI);
         $item = $article->articleList[$this->subAPI];
         $outputs = array();
         $i = 0;
         $outputs[$i]['title'] = $item['aTitle'];
         $outputs[$i]['date'] = $item['aTime'];
         $outputs[$i]['content'] = bwView::textFormatter(str_replace('+++', '', $item['aContent']));
         $outputs[$i]['category'] = $item['aCateDispName'];
         $item['aTags'] && ($outputs[$i]['tags'] = @explode(',', $item['aTags']));
         $outputs[$i]['permal-link'] = bw::$conf['siteURL'] . '/' . bw::$conf['linkPrefixArticle'] . "/{$item['aID']}/";
         $outputs[$i]['author'] = bw::$conf['authorName'];
         $outputs[$i]['about'] = bw::$conf['authorIntro'];
         $outputs[$i]['homepage'] = bw::$conf['siteURL'];
         $this->done(200, array("articles" => $outputs));
     }
 }
Exemple #4
0
<?php

/**
* 
* @link http://bw.bo-blog.com
* @copyright (c) 2014 bW Development Team
* @license MIT
*/
define('P', './');
include_once P . 'inc/system.php';
$canonical = new bwCanonicalization();
$article = new bwArticle();
$article->alterPerPage(20);
$article->getArticleList();
$outputxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">\n<channel>\n<title>{$conf['siteName']}</title>\n<link>{$conf['siteURL']}</link>\n<description>{$conf['authorIntro']}</description>\n<image><url>{$conf['siteURL']}/conf/profile.png</url><title>{$conf['authorName']}</title><link>{$conf['siteURL']}</link></image>\n";
foreach ($article->articleList as $item) {
    $item['aContent'] = @explode('+++', $item['aContent']);
    $outputxml .= "<item>\n<title>{$item['aTitle']}</title>\n<link>{$conf['siteURL']}/{$conf['linkPrefixArticle']}/{$item['aID']}/</link>\n<author>{$conf['authorName']}</author><pubDate>" . date('c', strtotime($item['aTime'])) . "</pubDate>\n<guid isPermalLink=\"true\">{$conf['siteURL']}/{$conf['linkPrefixArticle']}/{$item['aID']}/</guid>\n<comment>{$conf['siteURL']}/{$conf['linkPrefixArticle']}/{$item['aID']}/#comment-{$item['aID']}</comment>\n<description><![CDATA[" . bwView::textFormatter($item['aContent'][0]) . "]]></description>\n</item>\n";
}
$outputxml .= "</channel></rss>";
@header("Content-Type: application/xml; charset=utf-8");
die($outputxml);