コード例 #1
0
ファイル: RssReader.php プロジェクト: jaakkop/site
 public function read($id, $type)
 {
     $rssModel = new Default_Model_RssFeeds();
     $pageTypeModel = new Default_Model_PageTypes();
     $type = $pageTypeModel->getId($type);
     $urls = $rssModel->getUrls($id, $type);
     $feeds = array();
     foreach ($urls as $url) {
         try {
             $feed = Zend_Feed_Reader::import($url['url_rss']);
             //echo $feed->getEncoding();
             $feeds[] = $feed;
         } catch (Exception $e) {
             echo "Error with feed";
         }
     }
     if (count($feeds) != 0) {
         $data = $this->sortFeed($feeds);
     } else {
         return false;
     }
     return $data;
 }
コード例 #2
0
ファイル: RssReader.php プロジェクト: jannev/site
 public function addUrls($urls)
 {
     $rssModel = new Default_Model_RssFeeds();
     $rssModel->addUrls($urls, $this->id, $this->typename);
     $this->resetCache();
 }
コード例 #3
0
ファイル: RssController.php プロジェクト: jannev/site
 public function editfeedsAction()
 {
     $params = $this->getRequest()->getParams();
     if (!isset($params['type']) || !isset($params['id'])) {
         return false;
     }
     $reader = new Oibs_Controller_Plugin_RssReader($params['id'], $params['type']);
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         return false;
     }
     $userId = $auth->getIdentity()->user_id;
     $admin = false;
     if (!($admin = $reader->isAdmin($userId))) {
         return false;
     }
     $rssModel = new Default_Model_RssFeeds();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $urls = array();
         if (isset($params['feeds'])) {
             $urls = $params['feeds'];
         }
         $reader->addUrls($urls, $params['id'], $params['type']);
         $this->_redirect($reader->getLinkBack());
     }
     $urls = $rssModel->getUrls($params['id'], $params['type']);
     $this->view->title = "Massidea.org";
     $this->view->pageTitle = $reader->getTitle();
     $this->view->linkback = $reader->getLinkBack();
     $this->view->admin = $admin;
     $this->view->count = count($urls) != 0 ? count($urls) : 1;
     $this->view->urls = $urls;
 }