Exemplo n.º 1
0
 /**
  * Controller ausführen
  * @return boolean
  */
 public function process()
 {
     parent::process();
     $parsed = array();
     if ($this->cache->isExpired() || $this->session->exists()) {
         $this->users = array_flip($this->userList->getUsersNameList());
         $conditions = array('limit' => array($this->limit, 0), 'archived' => 0, 'postponed' => 0);
         if ($this->category !== 0) {
             $conditions['category'] = $this->category;
         }
         $articles = $this->articleList->getArticlesByCondition($conditions);
         foreach ($articles as $article) {
             $parsed[] = $this->assignData($article);
         }
         if (!$this->session->exists()) {
             $this->cache->write($parsed, $this->config->system_cache_timeout);
         }
     } else {
         $parsed = $this->cache->read();
     }
     $content = implode(PHP_EOL, $parsed);
     if (!$this->isUtf8) {
         $content = utf8_decode($content);
     }
     $this->view->assign('content', $content);
     $this->view->assign('systemMode', $this->config->system_mode);
     $this->view->render();
 }
Exemplo n.º 2
0
 /**
  * Artikel aus Papierkorb wiederherstellen
  * @param array $ids
  * @return boolean
  */
 protected function doRestore(array $ids)
 {
     if (!$this->deleteActions || !$this->config->articles_trash) {
         return false;
     }
     return $this->articleList->restoreArticles($ids);
 }
Exemplo n.º 3
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->initCommentPermissions();
     $this->view->assign('ownArticleIds', $this->articleList->getArticleIDsByUser($this->session->getUserId()));
     $this->view->assign('commentsMode', 1);
     $this->view->render();
 }
Exemplo n.º 4
0
 /**
  * Request-Handler
  * @return boolean
  */
 public function request()
 {
     parent::request();
     $this->mode = $this->getRequestVar('mode');
     $filter = $this->getRequestVar('filter');
     $sparams = array();
     if ($filter['text'] != '') {
         switch ($filter['searchtype']) {
             case 0:
                 $sparams['title'] = $filter['text'];
                 break;
             case 1:
                 $sparams['content'] = $filter['text'];
                 break;
             default:
                 $sparams['title'] = $filter['text'];
                 $sparams['content'] = $filter['text'];
                 break;
         }
     }
     if ($filter['userid'] > 0) {
         $sparams['user'] = (int) $filter['userid'];
     }
     if ($filter['categoryid'] > 0) {
         $sparams['category'] = (int) $filter['categoryid'];
     }
     if ($filter['datefrom']) {
         $sparams['datefrom'] = strtotime($filter['datefrom']);
     }
     if ($filter['dateto']) {
         $sparams['dateto'] = strtotime($filter['dateto']);
     }
     if ($filter['pinned'] > -1) {
         $sparams['pinned'] = (int) $filter['pinned'];
     }
     if ($filter['postponed'] > -1) {
         $sparams['postponed'] = (int) $filter['postponed'];
     }
     if ($filter['comments'] > -1) {
         $sparams['comments'] = (int) $filter['comments'];
     }
     if ($this->mode != -1) {
         $sparams['archived'] = (int) $this->mode;
     }
     $sparams['approval'] = (int) $filter['approval'];
     $sparams['combination'] = $filter['combination'] ? 'OR' : 'AND';
     $sparams = $this->events->runEvent('articlesPrepareSearch', $sparams);
     $this->articleItems = $this->articleList->getArticlesByCondition($sparams, true);
     $this->translateCategories();
     return true;
 }
Exemplo n.º 5
0
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $translatedRolls = $this->rollList->getUserRollsTranslated();
     $this->view->assign('currentUser', $this->session->getUserId());
     $this->view->assign('usersActive', $this->userList->getUsersActive(true));
     $this->view->assign('usersDisabled', $this->userList->getUsersDisabled(true));
     $this->view->assign('usersRollList', $translatedRolls);
     $this->view->assign('usersRolls', array_flip($translatedRolls));
     $this->view->assign('articleCounts', $this->articleList->countArticlesByUsers());
     $this->view->assign('rollPermissions', $this->permissions->check(array('system' => 'rolls')));
     $this->view->render();
 }
Exemplo n.º 6
0
 /**
  * Führt Prüfung durch, ob Artikel bearbeitet werden kann
  * @param \fpcm\model\comments\comment $comment
  * @return boolean
  */
 public function checkEditPermissions(comment &$comment)
 {
     if ($this->permissions === false) {
         return true;
     }
     if (!is_array($this->ownArticleIds)) {
         $this->articleList = new \fpcm\model\articles\articlelist();
         $this->ownArticleIds = $this->articleList->getArticleIDsByUser(\fpcm\classes\baseconfig::$fpcmSession->getUserId());
     }
     $isAdmin = \fpcm\classes\baseconfig::$fpcmSession->getCurrentUser()->isAdmin();
     $permEditAll = $this->permissions->check(array('comment' => 'editall'));
     $permEditOwn = $this->permissions->check(array('comment' => 'edit'));
     if ($isAdmin || $permEditAll) {
         $comment->setEditPermission(true);
         return true;
     }
     if (!$isAdmin && !$permEditAll && $permEditOwn && in_array($comment->getArticleid(), $this->ownArticleIds)) {
         $comment->setEditPermission(true);
         return true;
     }
     $comment->setEditPermission(false);
     return true;
 }
Exemplo n.º 7
0
 /**
  * Controller ausführen
  * @return boolean
  */
 public function process()
 {
     parent::process();
     header('Content-type: text/html; charset=utf-8');
     $content = '';
     if ($this->cache->isExpired() || $this->session->exists()) {
         $this->users = array_flip($this->userList->getUsersNameList());
         $this->emails = array_flip($this->userList->getUsersEmailList());
         /**
          * Feed-Basis mittel \DOMDocument-Klasse
          */
         $dom = new \DOMDocument('1.0', 'utf-8');
         $rss = $dom->createElement('rss');
         $rss->setAttribute('version', '2.0');
         $channel = $dom->createElement('channel');
         $rss->appendChild($channel);
         $title = $dom->createElement('title', 'FanPress CM RSS Feed');
         $channel->appendChild($title);
         $link = $dom->createElement('link', \fpcm\classes\baseconfig::$rootPath . 'index.php?module=fpcm/feed');
         $channel->appendChild($link);
         $date = $dom->createElement('lastBuildDate', date(DATE_RSS, time()));
         $channel->appendChild($date);
         $gnrt = $dom->createElement('generator', 'FanPress CM News System ' . $this->config->system_version);
         $channel->appendChild($gnrt);
         $descr = $dom->createElement('description', 'FanPress CM News System RSS Feed');
         $channel->appendChild($descr);
         $conditions = array('limit' => array($this->limit, 0), 'archived' => 0, 'postponed' => 0);
         if ($this->category !== 0) {
             $conditions['category'] = $this->category;
         }
         $articles = $this->articleList->getArticlesByCondition($conditions);
         foreach ($articles as $article) {
             $item = $dom->createElement('item');
             $guid = $dom->createElement('guid', htmlspecialchars($article->getArticleLink()));
             $item->appendChild($guid);
             $atitle = $dom->createElement('title', htmlspecialchars($article->getTitle()));
             $item->appendChild($atitle);
             $alink = $dom->createElement('link', htmlspecialchars($article->getArticleLink()));
             $item->appendChild($alink);
             $adescr = $dom->createElement('description');
             $acont = $dom->createCDATASection($article->getContent());
             $adescr->appendChild($acont);
             $item->appendChild($adescr);
             $adate = $dom->createElement('pubDate', date(DATE_RSS, $article->getCreatetime()));
             $item->appendChild($adate);
             if (isset($this->users[$article->getCreateuser()])) {
                 $usremail = $this->emails[$article->getCreateuser()] . ' (' . $this->users[$article->getCreateuser()] . ')';
                 $aauthr = $dom->createElement('author', $usremail);
                 $item->appendChild($aauthr);
             }
             $channel->appendChild($item);
         }
         $dom->appendChild($rss);
         $dom = $this->events->runEvent('prepareRssFeed', $dom);
         $content .= $dom->saveXML();
         if (!$this->session->exists()) {
             $this->cache->write($content, $this->config->system_cache_timeout);
         }
     } else {
         $content .= $this->cache->read();
     }
     $this->view->assign('content', $content);
     $this->view->setHideMessages(true);
     $this->view->render();
 }