Example #1
0
 /**
  * Controller-Processing
  * @return boolean
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $users = $this->userList->getUsersNameList();
     $this->view->assign('timesMode', true);
     $this->view->assign('users', array_flip($users));
     $this->view->assign('commentEnabledGlobal', $this->config->system_comments_enabled);
     $this->view->assign('showArchiveStatus', true);
     $this->view->assign('showDraftStatus', false);
     $this->view->assign('articleActions', $this->articleActions);
     $this->view->assign('showTrash', $this->config->articles_trash);
     $this->view->assign('deletePermissions', $this->deleteActions);
     $this->initSearchForm($users);
     if ($this->config->articles_trash) {
         $this->view->assign('trash', $this->articleList->getArticlesDeleted(true));
     }
     $this->view->assign('drafts', $this->articleList->getArticlesDraft(true));
     $commentCounts = $this->commentList->countComments($this->getArticleListIds());
     $this->view->assign('commentCount', $commentCounts);
     $this->view->assign('commentPrivateUnapproved', $this->commentList->countUnapprovedPrivateComments($this->getArticleListIds()));
     $this->view->assign('commentSum', $commentCounts && $this->articleCount ? array_sum($commentCounts) : 0);
     $this->view->setViewJsFiles(array(\fpcm\classes\baseconfig::$jsPath . 'articlelist.js'));
     $this->translateCategories();
     $this->view->assign('showDrafts', true);
     return true;
 }
Example #2
0
 /**
  * @see \fpcm\controller\abstracts\controller::process()
  * @return mixed
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->view->assign('editorAction', 'articles/edit&articleid=' . $this->article->getId());
     $this->view->assign('editorMode', 1);
     $this->view->assign('showRevisions', true);
     $this->view->assign('postponedTimer', $this->article->getCreatetime());
     $this->view->assign('users', $this->userList->getUsersByIds(array($this->article->getCreateuser(), $this->article->getChangeuser())));
     $this->view->assign('commentCount', array_sum($this->commentList->countComments(array($this->article->getId()))));
     $this->view->assign('comments', $this->commentList->getCommentsByCondition($this->article->getId(), -1, -1, -1));
     $this->view->assign('commentsMode', 2);
     $revisions = $this->article->getRevisions();
     $this->view->assign('revisions', $revisions);
     $this->view->assign('revisionCount', count($revisions));
     $this->view->assign('revisionPermission', $this->permissions->check(array('article' => 'revisions')));
     $this->view->addJsVars(array('fpcmEditorCommentLayerSave' => $this->lang->translate('GLOBAL_SAVE'), 'fpcmCanConnect' => \fpcm\classes\baseconfig::canConnect() ? 1 : 0, 'fpcmNavigationActiveItemId' => 'itemnav-id-editnews'));
     $this->view->addJsLangVars(array('editorCommentLayerHeader' => $this->lang->translate('COMMENTS_EDIT')));
     if (!$this->permissions->check(array('article' => 'approve')) && $this->article->getApproval()) {
         $this->view->addMessage('Um den Artikel freizugeben, speichere ihn einfach erneut ab.');
     }
     $this->initPermissions();
     $this->view->assign('isRevision', false);
     if ($this->showRevision) {
         $this->view->assign('currentArticle', $this->currentArticle);
         $this->view->assign('editorFile', \fpcm\classes\baseconfig::$viewsDir . 'articles/editors/revisiondiff.php');
         $this->view->assign('isRevision', true);
         $this->view->assign('showRevisions', false);
         $this->view->assign('showComments', false);
         $this->view->assign('editorAction', 'articles/edit&articleid=' . $this->article->getId() . '&rev=' . $this->getRequestVar('rev'));
     }
     $this->view->render();
 }
Example #3
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();
 }
Example #4
0
 /**
  * Controller ausführen
  * @return boolean
  */
 public function process()
 {
     parent::process();
     if ($this->cache->isExpired() || $this->session->exists()) {
         $this->users = array_flip($this->userList->getUsersNameList());
         $this->usersEmails = array_flip($this->userList->getUsersEmailList());
         $this->categories = $this->categoryList->getCategoriesAll();
         $this->commentCounts = $this->config->system_comments_enabled ? $this->commentList->countComments(array(), 0, 1) : array();
     }
 }
Example #5
0
 /**
  * Benutzer löschen
  * @param array $userId
  * @param bool $check
  * @return void
  */
 private function deleteUsers($userId, $check = true)
 {
     if ($check && $this->userList->countActiveUsers() == 1) {
         $this->view->addErrorMessage('DELETE_FAILED_USERS_LAST');
         return;
     }
     if ($check && $userId == $this->session->getUserId()) {
         $this->view->addErrorMessage('DELETE_FAILED_USERS_OWN');
         return;
     }
     $user = new \fpcm\model\users\author($userId);
     if ($user->delete()) {
         $this->view->addNoticeMessage('DELETE_SUCCESS_USERS');
     } else {
         $this->view->addErrorMessage('DELETE_FAILED_USERS');
     }
 }
Example #6
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $users = $this->userList->getUsersNameList();
     $this->view->assign('timesMode', true);
     $this->view->assign('users', array_flip($users));
     $this->view->assign('commentEnabledGlobal', $this->config->system_comments_enabled);
     $this->view->assign('showArchiveStatus', $this->mode == -1 ? true : false);
     $this->view->assign('showDraftStatus', false);
     $this->view->assign('isSearch', true);
     $this->view->assign('showPager', false);
     $this->initEditPermisions();
     $commentCounts = $this->commentList->countComments($this->getArticleListIds());
     $this->view->assign('commentCount', $commentCounts);
     $this->view->assign('commentSum', $commentCounts && count($this->articleItems) ? array_sum($commentCounts) : 0);
     $this->view->assign('list', $this->articleItems);
     $this->view->render();
 }
Example #7
0
 /**
  * Artikel parsen
  * @return string
  */
 protected function assignArticleData()
 {
     $categoryTexts = array();
     $categoryIcons = array();
     $categories = $this->categoryList->getCategoriesAll();
     foreach ($this->article->getCategories() as $categoryId) {
         $category = isset($categories[$categoryId]) ? $categories[$categoryId] : false;
         if (!$category) {
             continue;
         }
         $categoryTexts[] = '<span class="fpcm-pub-category-text">' . $category->getName() . '</span>';
         if (!$category->getIconPath()) {
             continue;
         }
         $categoryIcons[] = '<img src="' . $category->getIconPath() . '" alt="' . $category->getName() . '" title="' . $category->getName() . '" class="fpcm-pub-category-icon">';
     }
     $shareButtonParser = new \fpcm\model\pubtemplates\sharebuttons($this->article->getArticleLink(), $this->article->getTitle());
     $users = $this->userList->getUsersByIds(array($this->article->getCreateuser(), $this->article->getChangeuser()));
     $commentCounts = $this->commentList->countComments(array($this->article->getId()), 0, 1, 0);
     $commentCount = $this->config->system_comments_enabled && $this->article->getComments() ? isset($commentCounts[$this->article->getId()]) ? (int) $commentCounts[$this->article->getId()] : 0 : '';
     $this->articleTemplate->setCommentsEnabled($this->config->system_comments_enabled && $this->article->getComments());
     if (isset($users[$this->article->getCreateuser()])) {
         $emailAddress = '<a href="mailto:' . $users[$this->article->getCreateuser()]->getEmail() . '">' . $users[$this->article->getCreateuser()]->getDisplayname() . '</a>';
     } else {
         $emailAddress = '';
     }
     $replacements = array('{{headline}}' => $this->article->getTitle(), '{{text}}' => $this->article->getContent(), '{{author}}' => isset($users[$this->article->getCreateuser()]) ? $users[$this->article->getCreateuser()]->getDisplayname() : $this->lang->translate('GLOBAL_NOTFOUND'), '{{authorEmail}}' => $emailAddress, '{{date}}' => date($this->config->system_dtmask, $this->article->getCreatetime()), '{{changeDate}}' => date($this->config->system_dtmask, $this->article->getChangetime()), '{{changeUser}}' => isset($users[$this->article->getChangeuser()]) ? $users[$this->article->getChangeuser()]->getDisplayname() : $this->lang->translate('GLOBAL_NOTFOUND'), '{{statusPinned}}' => $this->article->getPinned() ? $this->lang->translate('PUBLIC_ARTICLE_PINNED') : '', '{{shareButtons}}' => $shareButtonParser->parse(), '{{categoryIcons}}' => implode(PHP_EOL, $categoryIcons), '{{categoryTexts}}' => implode(PHP_EOL, $categoryTexts), '{{commentCount}}' => $commentCount, '{{permaLink}}:{{/permaLink}}' => $this->article->getArticleLink(), '{{commentLink}}:{{/commentLink}}' => $this->article->getArticleLink() . '#comments', '<readmore>:</readmore>' => $this->article->getMd5path(), '{{articleImage}}' => $this->article->getArticleImage(), '{{sources}}' => $this->article->getSources());
     $this->articleTemplate->setReplacementTags($replacements);
     $parsed = $this->articleTemplate->parse();
     if ($this->session->exists()) {
         $html = array();
         $html[] = '<div class="fpcm-pub-articletoolbar-article fpcm-pub-articletoolbar-article' . $this->articleId . '">';
         $html[] = '<a href="' . $this->article->getEditLink() . '">' . $this->lang->translate('HL_ARTICLE_EDIT') . '</a>';
         $html[] = '</div>';
         $parsed = implode(PHP_EOL, $html) . $parsed;
     }
     return $parsed;
 }
Example #8
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();
 }