Ejemplo n.º 1
0
 /**
  * Berechtigungen für Zugriff auf Module prüfen
  * @param array $navigation
  * @return array
  */
 private function checkPermissions($navigation)
 {
     foreach ($navigation as $key => &$value) {
         if (isset($value['submenu']) && count($value['submenu'])) {
             $value['submenu'] = $this->checkPermissions($value['submenu']);
         }
         if (isset($value['permission']) && count($value['permission'])) {
             if (!$this->permissions->check($value['permission'])) {
                 unset($navigation[$key]);
             }
         }
     }
     return $navigation;
 }
Ejemplo n.º 2
0
 /**
  * Prüft ob spezielle Berechtigungen für Event nötig sind
  * @return boolean
  */
 public function checkPermissions()
 {
     if (!$this->permissions || !count($this->checkPermission)) {
         return true;
     }
     return $this->permissions->check($this->checkPermission);
 }
Ejemplo n.º 3
0
 /**
  * Controller-Processing
  * @return boolean
  */
 public function process()
 {
     $currentClass = get_class($this);
     if (strpos($currentClass, 'fpcm\\modules\\') !== false) {
         $modulename = explode('\\', $currentClass);
         $modulename = $modulename[2] . '/' . $modulename[3];
         if (!in_array($modulename, $this->enabledModules)) {
             trigger_error("Request for controller '{$currentClass}' of disabled module '{$modulename}'!");
             $view = new \fpcm\model\view\error();
             $view->setMessage("The controller '{$this->getRequestVar('module')}' is not enabled for execution!");
             $view->render();
             die;
         }
     }
     if (!$this->session->exists()) {
         $this->redirectNoSession();
         return false;
     }
     if ($this->permissions) {
         if (count($this->checkPermission) && !$this->permissions->check($this->checkPermission)) {
             $view = new \fpcm\model\view\error();
             $view->setMessage($this->lang->translate('PERMISSIONS_REQUIRED'));
             $view->render();
             die;
         }
         if ($this->session->getCurrentUser()->isAdmin() && $this->permissions->check(array('system' => 'update'))) {
             $this->checkUpdates();
         }
     }
     return true;
 }
Ejemplo n.º 4
0
 /**
  * Content rendern
  */
 private function renderContent()
 {
     $ownPermissions = $this->permissions->check(array('article' => 'edit'));
     $allPermissions = $this->permissions->check(array('article' => 'editall'));
     $articleList = new \fpcm\model\articles\articlelist();
     $userlist = new \fpcm\model\users\userList();
     $conditions = array('draft' => -1, 'approval' => -1, 'limit' => array(10, 0), 'orderby' => array('createtime DESC'));
     $articles = $articleList->getArticlesByCondition($conditions);
     $users = array_flip($userlist->getUsersNameList());
     $content = array();
     $content[] = '<table class="fpcm-ui-table fpcm-ui-articles fpcm-ui-large-td">';
     foreach ($articles as $article) {
         $createInfo = $this->language->translate('EDITOR_AUTHOREDIT', array('{{username}}' => isset($users[$article->getCreateuser()]) ? $users[$article->getCreateuser()] : $this->language->translate('GLOBAL_NOTFOUND'), '{{time}}' => date($this->config->system_dtmask, $article->getCreatetime())));
         $content[] = '<tr class="fpcm-small-text">';
         $content[] = '  <td class="fpcm-ui-articlelist-open">';
         $content[] = '  <a class="fpcm-ui-button fpcm-ui-button-blank fpcm-openlink-btn" href="' . $article->getArticleLink() . '" target="_blank" title="' . $this->language->translate('GLOBAL_FRONTEND_OPEN') . '">' . $this->language->translate('GLOBAL_FRONTEND_OPEN') . '</a>';
         if ($article->getEditPermission()) {
             $content[] = '  <a class="fpcm-ui-button fpcm-ui-button-blank fpcm-ui-button-edit fpcm-loader" href="' . $article->getEditLink() . '" title="' . $this->language->translate('GLOBAL_EDIT') . '">' . $this->language->translate('GLOBAL_EDIT') . '</a>';
         } else {
             $content[] = '  <span class="fpcm-ui-button fpcm-ui-button-blank fpcm-ui-button-edit fpcm-ui-readonly" title="' . $this->language->translate('GLOBAL_EDIT') . '">' . $this->language->translate('GLOBAL_EDIT') . '</span>';
         }
         $content[] = '  </td>';
         $content[] = '  <td>';
         $content[] = '  <strong>' . \fpcm\model\view\helper::escapeVal(strip_tags(substr(rtrim($article->getTitle(), '.!?'), 0, 64))) . '...</strong><br>';
         $content[] = '  <span>' . $createInfo . '</span>';
         $content[] = '  </td>';
         $content[] = '  <td class="fpcm-ui-dashboard-recentarticles-meta">';
         if ($article->getPinned()) {
             $content[] = '      <span class="fa-stack fa-fw fpcm-ui-status-1" title="' . $this->language->translate('EDITOR_STATUS_PINNED') . '"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-thumb-tack fa-rotate-90 fa-stack-1x fa-inverse"></span></span>';
         }
         if ($article->getDraft()) {
             $content[] = '      <span class="fa-stack fa-fw fpcm-ui-status-1" title="' . $this->language->translate('EDITOR_STATUS_DRAFT') . '"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-file-text-o fa-stack-1x fa-inverse"></span></span>';
         }
         if ($article->getPostponed()) {
             $content[] = '      <span class="fa-stack fa-fw fpcm-ui-status-1" title="' . $this->language->translate('EDITOR_STATUS_POSTPONETO') . '"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-clock-o fa-stack-1x fa-inverse"></span></span>';
         }
         if ($article->getApproval()) {
             $content[] = '      <span class="fa-stack fa-fw fpcm-ui-status-1" title="' . $this->language->translate('EDITOR_STATUS_APPROVAL') . '"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-thumbs-o-up fa-stack-1x fa-inverse"></span></span>';
         }
         $content[] = '  </td>';
         $content[] = '</tr>';
     }
     $content[] = '</table>';
     $this->content = implode(PHP_EOL, $content);
     $this->cache->write($this->content, $this->config->system_cache_timeout);
 }
Ejemplo n.º 5
0
 /**
  * Content rendern
  */
 private function renderContent()
 {
     $ownPermissions = $this->permissions->check(array('article' => 'edit'), array('comment' => 'edit'));
     $allPermissions = $this->permissions->check(array('article' => 'editall'), array('comment' => 'editall'));
     $commenList = new \fpcm\model\comments\commentList();
     $userlist = new \fpcm\model\users\userList();
     $comments = $commenList->getCommentsByLimit(10, 0);
     $users = array_flip($userlist->getUsersNameList());
     $content = array();
     $content[] = '<table class="fpcm-ui-table fpcm-ui-articles fpcm-ui-large-td">';
     foreach ($comments as $comment) {
         $createInfo = $this->language->translate('COMMMENT_LASTCHANGE', array('{{username}}' => isset($users[$comment->getChangeuser()]) ? $users[$comment->getChangeuser()] : $this->language->translate('GLOBAL_NOTFOUND'), '{{time}}' => date($this->config->system_dtmask, $comment->getChangetime())));
         if (!$comment->getChangeuser() && !$comment->getChangetime()) {
             $createInfo = '';
         }
         $content[] = '<tr class="fpcm-small-text">';
         $content[] = '  <td class="fpcm-ui-articlelist-open">';
         $content[] = '  <a class="fpcm-ui-button fpcm-ui-button-blank fpcm-openlink-btn" href="' . $comment->getArticleLink() . '" target="_blank" title="' . $this->language->translate('GLOBAL_FRONTEND_OPEN') . '">' . $this->language->translate('GLOBAL_FRONTEND_OPEN') . '</a>';
         if ($comment->getEditPermission()) {
             $content[] = '  <a class="fpcm-ui-button fpcm-ui-button-blank fpcm-ui-button-edit fpcm-loader" href="' . $comment->getEditLink() . '&amp;mode=1" title="' . $this->language->translate('GLOBAL_EDIT') . '">' . $this->language->translate('GLOBAL_EDIT') . '</a>';
         } else {
             $content[] = '  <span class="fpcm-ui-button fpcm-ui-button-blank fpcm-ui-button-edit fpcm-ui-readonly" title="' . $this->language->translate('GLOBAL_EDIT') . '">' . $this->language->translate('GLOBAL_EDIT') . '</span>';
         }
         $content[] = '  </td>';
         $content[] = '  <td>';
         $content[] = '  <strong>' . \fpcm\model\view\helper::escapeVal(strip_tags($comment->getName())) . '</strong> @ ' . date($this->config->system_dtmask, $comment->getCreatetime()) . '<br>';
         $content[] = '  <span>' . $createInfo . '</span>';
         $content[] = '  </td>';
         $content[] = '  <td class="fpcm-ui-dashboard-recentarticles-meta">';
         if ($comment->getSpammer()) {
             $content[] = '      <span class="fa-stack fa-fw fpcm-ui-status-1" title="' . $this->language->translate('COMMMENT_SPAM') . '"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-flag fa-stack-1x fa-inverse"></span></span>';
         }
         if ($comment->getApproved()) {
             $content[] = '      <span class="fa-stack fa-fw fpcm-ui-status-1" title="' . $this->language->translate('COMMMENT_APPROVE') . '"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-check-circle-o fa-rotate-90 fa-stack-1x fa-inverse"></span></span>';
         }
         if ($comment->getPrivate()) {
             $content[] = '      <span class="fa-stack fa-fw fpcm-ui-status-1" title="' . $this->language->translate('COMMMENT_PRIVATE') . '"><span class="fa fa-square fa-stack-2x"></span><span class="fa fa-eye-slash fa-stack-1x fa-inverse"></span></span>';
         }
         $content[] = '  </td>';
         $content[] = '</tr>';
     }
     $content[] = '</table>';
     $this->content = implode(PHP_EOL, $content);
     $this->cache->write($this->content, $this->config->system_cache_timeout);
 }
Ejemplo 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;
 }