예제 #1
0
 /**
  * Zeigt die Einträge an
  *
  * @param int $max_entries_pp Anzahl Einträge pro Seite
  */
 private function _view($max_entries_pp)
 {
     //Daten definiere und initialisieren
     $this->_tplfile = 'news.tpl';
     $news_array = array();
     //Seite herausfinden
     if (isset($this->_gpc['GET']['page']) && is_numeric($this->_gpc['GET']['page']) && $this->_gpc['GET']['page'] > 0) {
         $page = $this->_gpc['GET']['page'];
     } else {
         $page = 1;
     }
     //Daten holen
     $news_array = $this->_msbox->getEntries($max_entries_pp, $page, 'DESC', 'ASC', $this->_timeformat);
     $this->_mysql->query('SELECT COUNT(*) as many FROM `news` WHERE `news_ref_ID` = \'0\'');
     $entries = $this->_mysql->fetcharray('num');
     $pagesnav_array = Page::get_static_pagesnav_array($entries[0], $max_entries_pp, $this->_gpc['GET']);
     $this->_smarty->assign('entrys', $entries[0]);
     foreach ($news_array as $key => $value) {
         //Nur news-Daten ohne $news_array['many'] abchecken
         $news_array[$key]['news_content'] = $this->_smilie->show_smilie(nl2br(htmlentities($value['news_content'])), $this->_mysql);
         foreach ($value['comments'] as $ckey => $cvalue) {
             $news_array[$key]['comments'][$ckey]['news_content'] = $this->_smilie->show_smilie(nl2br(htmlentities($cvalue['news_content'])), $this->_mysql);
         }
     }
     $this->_smarty->assign('newsarray', $news_array);
     $this->_smarty->assign('pages', $pagesnav_array);
 }
 /**
  * Erstellt das Eintragsformular für Beiträge im Gästebuch. Wenn nötig werden der vorhergehende
  * Einträg (und die Kommentare dazu) ermittelt.
  *
  * @param boolean $first_form 1. Aufruf des Formulars?
  * @param string|null $error Errortexte
  * @param boolean $comment Ist der Beitrag ein Kommentar?
  * @param boolean $mysql_data Werden die Daten vom Mysql geholt.
  */
 private function _send_entryform($first_form = true, $error = null, $comment = false, $mysql_data = false)
 {
     $data = array();
     /* Daten ermitteln */
     if ($first_form == false) {
         /* Daten aus Post-Array */
         if ($comment == false) {
             $data['entry_title'] = stripslashes($this->_gpc['POST']['title']);
         }
         $data += array('entry_content' => stripslashes($this->_gpc['POST']['content']), 'entry_name' => stripslashes($this->_gpc['POST']['name']), 'entry_email' => stripslashes($this->_gpc['POST']['email']), 'entry_hp' => stripslashes($this->_gpc['POST']['hp']));
     } elseif ($mysql_data == true) {
         //Daten aus dem msbox-Objekt holen
         $gbook_arr = $this->_msbox->getEntry($this->_gpc['GET']['ref_ID'], $this->_timeformat);
         $data += array('entry_title' => $gbook_arr['gbook_title'], 'entry_name' => $gbook_arr['gbook_name'], 'entry_content' => $gbook_arr['gbook_content'], 'entry_email' => $gbook_arr['gbook_email'], 'entry_hp' => $gbook_arr['gbook_hp'], 'entry_time' => $gbook_arr['gbook_time']);
     } else {
         /* Standard-Einträge */
         $gbook_vars = $this->_configvars['Gbook'];
         $data += array('entry_title' => $gbook_vars['entry_title'], 'entry_content' => $gbook_vars['entry_content'], 'entry_name' => $gbook_vars['entry_name'], 'entry_email' => $gbook_vars['entry_email'], 'entry_hp' => $gbook_vars['entry_hp']);
     }
     /* Bei Kommentaren ist der vorhergehende Eintrag zu ermitteln */
     if ($comment == true) {
         $this->_tplfile = "gbook_comment.tpl";
         $data['gbook'] = $this->_msbox->getEntry($this->_gpc['GET']['ref_ID'], $this->_timeformat, true);
         $data['gbook']['title'] = htmlentities($data['gbook']['gbook_title']);
         $data['gbook']['content'] = $this->_smilie->show_smilie(htmlentities($data['gbook']['gbook_content']), $this->_mysql);
         $data['gbook']['name'] = htmlentities($data['gbook']['gbook_name']);
         $data['gbook']['email'] = htmlentities($data['gbook']['gbook_email']);
         $data['gbook']['hp'] = htmlentities($data['gbook']['gbook_hp']);
         $data['gbook']['time'] = htmlentities($data['gbook']['gbook_time']);
         $data['gbook']['ID'] = $data['gbook']['gbook_ID'];
         /* HTML-Zeichen umwandeln */
         foreach ($data['gbook']['comments'] as $key => $value) {
             $data['gbook']['comments'][$key]['content'] = $this->_smilie->show_smilie(htmlentities($value['gbook_content']), $this->_mysql);
             $data['gbook']['comments'][$key]['email'] = htmlentities($value['gbook_email']);
             $data['gbook']['comments'][$key]['hp'] = htmlentities($value['gbook_hp']);
             $data['gbook']['comments'][$key]['name'] = htmlentities($value['gbook_name']);
             $data['gbook']['comments'][$key]['time'] = htmlentities($value['gbook_time']);
             $data['gbook']['comments'][$key]['ID'] = $value['gbook_ID'];
         }
         /*Anzeigetitle des Editors festlegen */
         $data['entry_title'] = 'RE: ' . htmlentities($data['gbook']['gbook_title']);
     } else {
         /* Keine Kommentareintrag -> Normaler Editor */
         $this->_tplfile = "msg_entry.tpl";
     }
     /* Error-Einträge */
     if (isset($error)) {
         $data['dump_errors'] = true;
         $data['error_title'] = $this->_configvars['Form_Error']['error_title'];
         $data['error_content'] = $error;
     }
     $data['smilies_list'] = $this->_smilie->create_smiliesarray($this->_mysql);
     $this->_smarty->assign($data);
 }