datedir = $GLOBALS['config']['data']; if (($fp = @fopen ("{$this->datedir}news.txt", "r"))) { $news = unserialize (fread ($fp, filesize("{$this->datedir}news.txt")+1)); if (is_array($news['articles'])) { $this->articles = $news['articles']; } if (is_array($news['groups'])) { $this->groups = $news['groups']; } fclose($fp); } foreach ($this->articles as $id => $article) { $this->newest[$id] = $article[0]['date']; } } /** * Speichert eine Nachricht */ function set ($id, $date, $title, $article, $href) { // $title = preg_replace ("/.*?(.*?)<\/h.>.*|.*/is", "\\1", $article); $descript = html_entity_decode ($article, ENT_NOQUOTES, "UTF-8"); $descript = preg_replace ("/.*?.*?<\/h.>(.*)/is", "\\1", $descript); $descript = preg_replace ("/<\/p>\s*/is", " -- ", $descript); $descript = preg_replace ("/<.*?>|<\/.*?>/is", "", $descript); $this->articles[$id][] = array ('date' => $date, 'title' => $title, 'descript' => $descript, 'href' => $href); } /** * holt gespeicherte Nachrichten */ function get ($id, $count=0) { $return = array (); if ($this->articles[$id]) { if ($count) { $return = array_slice ($this->articles[$id], 0, $count); } else { $return = $this->articles[$id]; } } return $return; } /** * holt gespeicherte Nachrichten */ function getIds () { $ids = array (); foreach ($this->articles as $name => $article) { $groups[$name] = $name; } asort ($ids); return $ids; } /** * Setzt die Nachrichten f�r einen bereich zur�ck */ function reset ($id) { unset ($this->articles[$id]); } /** * Speichert die Nachrichten */ function save () { if ($fp = @fopen ("{$this->datedir}news.txt", "w")) { fwrite ($fp, serialize (array ('articles' => $this->articles, 'groups' => $this->groups))); } } } ?>