diff options
Diffstat (limited to 'utils/modules/news.php')
-rw-r--r-- | utils/modules/news.php | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/utils/modules/news.php b/utils/modules/news.php index d4eee3e..75cb748 100644 --- a/utils/modules/news.php +++ b/utils/modules/news.php @@ -1,6 +1,8 @@ <?php /* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +global $UTIL_DIR, $MODULES_DIR; + include_once($UTIL_DIR . "/convert.php"); include_once($UTIL_DIR . "/forms.php"); include_once($UTIL_DIR . "/user.php"); @@ -28,10 +30,13 @@ class NewsEntry { $str = "<div class=\"news_entry\">\n"; $str .= " <div class=\"news_title\">" . 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_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\">\n"; - if($this->icon) $str .= " <img alt=\"icon\" class=\"news_icon\" src=\"" . $icon->prefix.$icon->file . "\"/>\n"; + if($this->icon) $str .= " <img alt=\"icon\" class=\"news_icon\" src=\"" . + $icon->prefix.$icon->file . "\"/>\n"; $str .= " ".$content. "\n"; $str .= " </div>\n"; $str .= "</div>\n"; @@ -56,7 +61,8 @@ class NewsEntry { return $this->title; } - public function NewsEntry($title, $time, $category, $description, $userid, $icon) + public function NewsEntry($title, $time, $category, + $description, $userid, $icon) { $this->title = $title; $this->time = $time; @@ -84,16 +90,20 @@ class News { switch($action) { case "add": - $n = new NewsEntry($vars["title"], DateTimeEdit::toTimestamp($vars, "time"), - $vars["category"], $vars["description"], $UID, $vars["icon"]); + $n = new NewsEntry($vars["title"], + DateTimeEdit::toTimestamp($vars, "time"), + $vars["category"], $vars["description"], + $UID, $vars["icon"]); echo "\"" .$n->title . "\" has now been added."; $this->add($n); $this->write(); break; case "preview": - $n = new NewsEntry($vars["title"], DateTimeEdit::toTimestamp($vars, "time"), - $vars["category"], $vars["description"], $UID, $vars["icon"]); + $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(); @@ -120,9 +130,11 @@ class News { $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 ComboBox("Category", "category", $category, + array("Main" => "main", "Site" => "site"))); $form->addWidget(new TextEdit("Description", "description", $description)); - $form->addWidget(new ImageComboBox("Icon", "icon", $icon, new Icons($ICONS_DIR."/"))); + $form->addWidget(new ImageComboBox("Icon", "icon", $icon, + new Icons($ICONS_DIR."/"))); $form->addWidget(new Button("Post news")); $form->render(); break; @@ -146,7 +158,8 @@ class News { break; case "preview": - $n = new NewsEntry($vars["title"], DatetimeEdit::toTimestamp($vars, "time"), $vars["category"], $vars["description"], $UID, $vars["icon"]); + $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(); |