Exemple #1
0
 public function feedAction()
 {
     $data = $this->getRequest();
     $book = AdminBookManage::instance();
     print_r($book->getCategoryForId(array('cid' => '1')));
     // $rss = Feed::loadRss('http://blog.sina.com.cn/rss/twocold.xml');
     // $dom = DOMHtml::loadHtml('http://blog.sina.com.cn/twocold');
     // echo "<pre>";
     // // foreach ($rss->item as $key => $value) {
     // //     if (isset($value->{'content:encoded'})){
     // //         echo $value->{'content:encoded'};
     // //     }
     // //     else
     // //     {
     // //         echo htmlSpecialChars($value->description);
     // //     }
     // // }
     // $elements = $dom->query("//link[@title='RSS']");
     // foreach ($elements as $key => $value) {
     //     $value->getAttribute('href') and $uid = basename($value->getAttribute('href'),".xml");
     //     print_r($uid);
     // }
     //
     // BlogManage::loadSinaBlog("http://blog.sina.com.cn/gaoweiweiusa");
     exit;
 }
Exemple #2
0
 public function collectionBlogAction($ctid = false)
 {
     $views = $this->getView();
     $data = $this->getRequest();
     $members = MembersManage::instance();
     $app = $members->getCurrentSession();
     if (!$app) {
         exit;
     }
     $collectionControl = new AdminCollectionManage();
     $bookControl = AdminBookManage::instance();
     $categories = $bookControl->getCategory();
     $collection = $collectionControl->getCollectionList(array('collection.ctid' => intval($ctid)), 1, 1);
     $views->assign('collection', $collection[0]);
     $views->assign('categories', $categories);
     $views->display('admin/collection/collection-modal.html.twig');
 }
 public function createBookFromBlog($ctid, $uid, $cid, $year = 2014, $page = 1)
 {
     $collection = $this->getCollectionList(array('ctid' => $ctid), 1, 1);
     if (!$collection) {
         return false;
     }
     set_time_limit(300);
     $datas = self::loadSinaBlog($collection[0]['url'], $year, $page);
     if (!$datas) {
         return false;
     }
     $book = array();
     $book['title'] = $collection[0]['title'] . " " . $year;
     $book['cid'] = $cid;
     $book['author'] = $collection[0]['author'];
     $bookControl = AdminBookManage::instance();
     if ($bid = $bookControl->createBook($uid, $book)) {
         foreach ($datas as $key => $value) {
             $value['type'] = 1;
             $value['sort'] = $key + 1;
             $bookControl->createArticle($bid, $value);
         }
     }
     set_time_limit(60);
 }
Exemple #4
0
 public function bookArticleDeleteAction($bid = false, $mid = false)
 {
     $views = $this->getView();
     $data = $this->getRequest();
     $members = MembersManage::instance();
     $app = $members->getCurrentSession();
     if (!$app) {
         exit;
     }
     $bookControl = new AdminBookManage();
     $bookControl->deleteArticle($mid);
     exit;
 }