diff options
Diffstat (limited to 'utils/modules')
-rw-r--r-- | utils/modules/news.php | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/utils/modules/news.php b/utils/modules/news.php index 52b8112..9667e44 100644 --- a/utils/modules/news.php +++ b/utils/modules/news.php @@ -10,6 +10,7 @@ class NewsEntry { public $description; public $category; public $userid; + public $icon; public function show() { @@ -21,8 +22,10 @@ class NewsEntry { htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n"; $str .= " <div class=\"news_time\">" . date("D M jS Y G:i", $this->time) . "</div>\n"; $str .= " <div class=\"news_user\">By: " . $users->findUser($this->userid)->userid . "</div>\n"; - $str .= " <div class=\"news_description\">" . - htmlspecialchars_decode($this->description, ENT_QUOTES) . "</div>\n"; + $str .= " <div class=\"news_description\">\n"; + if($this->icon) $str .= " <img alt=\"icon\" class=\"news_icon\" src=\"" . $this->icon . "\"/>\n"; + $str .= " ".htmlspecialchars_decode($this->description, ENT_QUOTES) . "\n"; + $str .= " </div>\n"; $str .= "</div>\n"; return $str; } @@ -34,6 +37,7 @@ class NewsEntry { fwrite($fp, " time=\"" . $this->time . "\"\n"); fwrite($fp, " category=\"" . $this->category . "\"\n"); fwrite($fp, " userid=\"" . $this->userid . "\"\n"); + fwrite($fp, " icon=\"" . $this->icon . "\"\n"); fwrite($fp, " description=\"" . htmlspecialchars($this->description, ENT_QUOTES, "UTF-8") . "\">\n"); fwrite($fp, " </newsentry>\n"); @@ -44,13 +48,14 @@ class NewsEntry { return $this->title; } - public function NewsEntry($title, $time, $category, $description, $userid) + public function NewsEntry($title, $time, $category, $description, $userid, $icon) { $this->title = $title; $this->time = $time; $this->category = $category; $this->description = $description; $this->userid = $userid; + $this->icon = $icon; } } @@ -72,7 +77,7 @@ class News { switch($action) { case "add": $n = new NewsEntry($vars["title"], DateTimeEdit::toTimestamp($vars, "time"), - $vars["category"], $vars["description"], $UID); + $vars["category"], $vars["description"], $UID, $vars["icon"]); echo "\"" .$n->title . "\" has now been added."; $this->add($n); $this->write(); @@ -80,7 +85,7 @@ class News { case "preview": $n = new NewsEntry($vars["title"], DateTimeEdit::toTimestamp($vars, "time"), - $vars["category"], $vars["description"], $UID); + $vars["category"], $vars["description"], $UID, $vars["icon"]); echo "<div class=\"preview\">\n"; echo "<div class=\"content\">\n"; echo $n->show(); @@ -104,18 +109,19 @@ class News { $category = $vars["category"]; $description = $vars["description"]; default: + $icons = array("http://www.executionroom.com/gfx/logos/die_logo_black_thumb.png", + "http://www.executionroom.com/gfx/logos/die_logo_bloody_thumb.png", + "http://www.executionroom.com/gfx/logos/die_logo_red_thumb_.png", + "http://www.executionroom.com/gfx/logos/die_logo_white_thumb.png", + "http://www.executionroom.com/gfx/die_group_2008_thumb.jpg", + "http://www.executionroom.com/gfx/die_group_thumb.jpg"); + $form = new Form("preview"); $form->addWidget(new LineEdit("Title", "title", $title)); $form->addWidget(new DateTimeEdit("Time", "time", $time)); $form->addWidget(new ComboBox("Category", "category", $category, array("Main" => "main", "Site" => "site"))); $form->addWidget(new TextEdit("Description", "description", $description)); - $form->addWidget(new ImageComboBox("Icon", "icon", $icon, - array("Logo1" => "http://www.executionroom.com/gfx/logos/die_logo_black_thumb.png", - "Logo2" => "http://www.executionroom.com/gfx/logos/die_logo_bloody_thumb.png", - "Logo3" => "http://www.executionroom.com/gfx/logos/die_logo_red_thumb_.png", - "Logo4" => "http://www.executionroom.com/gfx/logos/die_logo_white_thumb.png", - "Logo5" => "http://www.executionroom.com/gfx/die_group_2008_thumb.jpg", - "Logo6" => "http://www.executionroom.com/gfx/die_group_thumb.jpg"))); + $form->addWidget(new ImageComboBox("Icon", "icon", $icon, $icons)); $form->addWidget(new Button("Post news")); $form->render(); break; @@ -133,12 +139,13 @@ class News { $this->news[$vars["newsid"]]->time = DateTimeEdit::toTimestamp($vars, "time"); $this->news[$vars["newsid"]]->category = $vars["category"]; $this->news[$vars["newsid"]]->description = $vars["description"]; + $this->news[$vars["newsid"]]->icon = $vars["icon"]; $this->write(); echo "\"" . $this->news[$vars["newsid"]]->title . "\" has now been edited."; break; case "preview": - $n = new NewsEntry($vars["title"], DatetimeEdit::toTimestamp($vars, "time"), $vars["category"], $vars["description"], $UID); + $n = new NewsEntry($vars["title"], DatetimeEdit::toTimestamp($vars, "time"), $vars["category"], $vars["description"], $UID, $vars["icon"]); echo "<div class=\"preview\">\n"; echo "<div class=\"content\">\n"; echo $n->show(); @@ -158,6 +165,13 @@ class News { case "edit": case "retry": + $icons = array("http://www.executionroom.com/gfx/logos/die_logo_black_thumb.png", + "http://www.executionroom.com/gfx/logos/die_logo_bloody_thumb.png", + "http://www.executionroom.com/gfx/logos/die_logo_red_thumb_.png", + "http://www.executionroom.com/gfx/logos/die_logo_white_thumb.png", + "http://www.executionroom.com/gfx/die_group_2008_thumb.jpg", + "http://www.executionroom.com/gfx/die_group_thumb.jpg"); + if(isset($vars["title"])) $title = $vars["title"]; else $title = $this->news[$vars["newsid"]]->title; if(isset($vars["time_year"])) $time = DateTimeEdit::toTimestamp($vars, "time"); @@ -166,6 +180,8 @@ class News { else $category = $this->news[$vars["newsid"]]->category; if(isset($vars["description"])) $description = $vars["description"]; else $description = $this->news[$vars["newsid"]]->description; + if(isset($vars["icon"])) $icon = $vars["icon"]; + else $icon = $this->news[$vars["newsid"]]->icon; $form = new Form("preview"); $form->addWidget(new Hidden($vars)); @@ -174,6 +190,7 @@ class News { $form->addWidget(new ComboBox("Category", "category", $category, array("Main" => "main", "Site" => "site"))); $form->addWidget(new TextEdit("Description", "description", $description)); + $form->addWidget(new ImageComboBox("Icon", "icon", $icon, $icons)); $form->addWidget(new Button("Post news")); $form->render(); break; @@ -306,7 +323,8 @@ class News { $param->getAttribute('time'), $param->getAttribute('category'), $param->getAttribute('description'), - $param->getAttribute('userid')); + $param->getAttribute('userid'), + $param->getAttribute('icon')); $this->add($newsentry); } |