Esempio n. 1
0
 /**
  * Kommentar-Statistiken berechnen
  */
 protected function getCommentStats()
 {
     $commentList = new \fpcm\model\comments\commentList();
     $this->tableContent[] = '<tr><td><strong>' . $this->language->translate('SYSTEM_STATS_COMMENTS_ALL') . ':</strong></td><td class="fpcm-ui-center">' . $commentList->countCommentsByCondition() . '</td></tr>';
     $count = $commentList->countCommentsByCondition(array('unapproved' => true));
     $this->tableContent[] = '<tr class="' . ($count > 0 ? 'fpcm-ui-important-text' : 'fpcm-ui-text') . '"><td><strong>' . $this->language->translate('SYSTEM_STATS_COMMENTS_UNAPPR') . ':</strong></td><td class="fpcm-ui-center">' . $count . '</td></tr>';
     $count = $commentList->countCommentsByCondition(array('private' => true));
     $this->tableContent[] = '<tr class="' . ($count > 0 ? 'fpcm-ui-important-text' : 'fpcm-ui-text') . '"><td><strong>' . $this->language->translate('SYSTEM_STATS_COMMENTS_PRIVATE') . ':</strong></td><td class="fpcm-ui-center">' . $count . '</td></tr>';
     $count = $commentList->countCommentsByCondition(array('spam' => true));
     $this->tableContent[] = '<tr class="' . ($count > 0 ? 'fpcm-ui-important-text' : 'fpcm-ui-text') . '"><td><strong>' . $this->language->translate('SYSTEM_STATS_COMMENTS_SPAM') . ':</strong></td><td class="fpcm-ui-center">' . $count . '</td></tr>';
 }
Esempio n. 2
0
 /**
  * zusätzliche Prüfungen durchführen
  * @return bool
  */
 public function checkExtras()
 {
     $cdata = \fpcm\classes\http::get('newcomment');
     if ($this->maxCommentTextLinks <= preg_match_all("#(https?)://\\S+[^\\s.,>)\\];'\"!?]#", $cdata['text'])) {
         return true;
     }
     $comment = new \fpcm\model\comments\comment();
     $commentList = new \fpcm\model\comments\commentList();
     $comment->setEmail($cdata['email']);
     $comment->setName($cdata['name']);
     $comment->setWebsite($cdata['website']);
     $comment->setIpaddress(\fpcm\classes\http::getIp());
     if ($commentList->spamExistsbyCommentData($comment)) {
         return true;
     }
     return false;
 }
Esempio n. 3
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);
 }
Esempio n. 4
0
 /**
  * Auszuführender Cron-Code
  */
 public function run()
 {
     $to = time() - $this->getIntervalTime() * 2;
     $commentList = new \fpcm\model\comments\commentList();
     $commentIds = $commentList->getCommentsByDate(0, $to);
     if (!count($commentIds)) {
         return true;
     }
     foreach ($commentIds as $comment) {
         $ipaddress = $comment->getIpaddress();
         if (strpos($ipaddress, '*') !== false) {
             continue;
         }
         $delim = strpos($ipaddress, ':') !== false ? ':' : '.';
         $ipaddress = explode($delim, $ipaddress);
         $ipaddress[count($ipaddress) - 1] = '*';
         $ipaddress[count($ipaddress) - 2] = '*';
         $comment->setIpaddress(implode($delim, $ipaddress));
         $comment->update();
     }
     return true;
 }
Esempio n. 5
0
 /**
  * Löscht Artikel oder verschiebt sie in Papierkorb
  * @param array $ids
  * @return bool
  */
 public function deleteArticles(array $ids)
 {
     if (!count($ids)) {
         return false;
     }
     $where = 'id IN (' . implode(', ', $ids) . ')';
     if ($this->config->articles_trash) {
         $res = $this->dbcon->update($this->table, array('deleted', 'pinned'), array(1, 0), $where);
     } else {
         $res = $this->dbcon->delete($this->table, $where);
     }
     if ($res && !$this->config->articles_trash) {
         $commentList = new \fpcm\model\comments\commentList();
         $commentList->deleteCommentsByArticle($ids);
     }
     $this->cache->cleanup();
     return $res;
 }
Esempio n. 6
0
 /**
  * Löscht News in der Datenbank
  * @return bool
  */
 public function delete()
 {
     if ($this->config->articles_trash && !$this->forceDelete) {
         $this->cache->cleanup(false, \fpcm\model\articles\article::CACHE_ARTICLE_MODULE);
         $this->deleted = 1;
         return $this->update();
     }
     $this->deleteRevisions();
     $commentList = new \fpcm\model\comments\commentList();
     $commentList->deleteCommentsByArticle($this->id);
     return parent::delete();
 }