summaryrefslogtreecommitdiff
path: root/utils/modules
diff options
context:
space:
mode:
authordeva <deva>2010-01-28 13:45:42 +0000
committerdeva <deva>2010-01-28 13:45:42 +0000
commit55b8d42b6422f24196078c8adb6a2a59861d0ef4 (patch)
tree922cb7c3ed395ac28279d5091d057b9f30bcdbfa /utils/modules
parent657b191f6b4ae00d714fffe6911d8999d0a99873 (diff)
Lazy load on modules.
Diffstat (limited to 'utils/modules')
-rw-r--r--utils/modules/discography.php2
-rw-r--r--utils/modules/events.php2
-rw-r--r--utils/modules/gallery.php2
-rw-r--r--utils/modules/guestbook.php3
-rw-r--r--utils/modules/icons.php3
-rw-r--r--utils/modules/members.php2
-rw-r--r--utils/modules/news.php35
-rw-r--r--utils/modules/pages.php14
8 files changed, 41 insertions, 22 deletions
diff --git a/utils/modules/discography.php b/utils/modules/discography.php
index 478fdc0..fe5a353 100644
--- a/utils/modules/discography.php
+++ b/utils/modules/discography.php
@@ -1,6 +1,8 @@
<?php
/* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+global $UTIL_DIR;
+
include_once($UTIL_DIR . "/convert.php");
include_once($UTIL_DIR . "/markdown.php");
diff --git a/utils/modules/events.php b/utils/modules/events.php
index 8be8f5e..d8631ec 100644
--- a/utils/modules/events.php
+++ b/utils/modules/events.php
@@ -1,6 +1,8 @@
<?php
/* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+global $UTIL_DIR;
+
include_once($UTIL_DIR . "/convert.php");
include_once($UTIL_DIR . "/markdown.php");
diff --git a/utils/modules/gallery.php b/utils/modules/gallery.php
index 308f10a..6b2f384 100644
--- a/utils/modules/gallery.php
+++ b/utils/modules/gallery.php
@@ -1,6 +1,8 @@
<?php
/* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+global $UTIL_DIR;
+
include_once($UTIL_DIR . "/convert.php");
function isJpeg($file)
diff --git a/utils/modules/guestbook.php b/utils/modules/guestbook.php
index 45fb4c5..2d5db8a 100644
--- a/utils/modules/guestbook.php
+++ b/utils/modules/guestbook.php
@@ -1,5 +1,8 @@
<?php
/* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+
+global $UTIL_DIR;
+
include_once($UTIL_DIR . "/forms.php");
include_once($UTIL_DIR . "/convert.php");
diff --git a/utils/modules/icons.php b/utils/modules/icons.php
index 3a9d716..d916ec4 100644
--- a/utils/modules/icons.php
+++ b/utils/modules/icons.php
@@ -1,5 +1,8 @@
<?php
/* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+
+global $UTIL_DIR;
+
include_once($UTIL_DIR . "/modules.php");
class Icon {
diff --git a/utils/modules/members.php b/utils/modules/members.php
index fcc627c..c1822d2 100644
--- a/utils/modules/members.php
+++ b/utils/modules/members.php
@@ -1,6 +1,8 @@
<?php
/* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+global $UTIL_DIR;
+
include_once($UTIL_DIR . "/convert.php");
include_once($UTIL_DIR . "/forms.php");
include_once($UTIL_DIR . "/markdown.php");
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();
diff --git a/utils/modules/pages.php b/utils/modules/pages.php
index 99c8142..d3ee0aa 100644
--- a/utils/modules/pages.php
+++ b/utils/modules/pages.php
@@ -1,6 +1,8 @@
<?php
/* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+global $UTIL_DIR;
+
include_once($UTIL_DIR . "/convert.php");
include_once($UTIL_DIR . "/markdown.php");
include_once($UTIL_DIR . "/modules.php");
@@ -26,17 +28,7 @@ class Page {
$modulecodes = array_unique($res[1]);
foreach($modulecodes as $modulecode) {
- $m = explode("?", $modulecode);
- $module = $m[0];
- $params = explode(",", $m[1]);
- if($modules[$module]) {
- $modulestr = $modules[$module]->run($params);
- } else {
- $modulestr = "<p><strong>CMS ERROR: Could not find module: [[" . $modulecode . "]]</strong></p>";
- }
-
- $str = str_replace("[[" . $modulecode . "]]", $modulestr, $str);
-
+ $str = str_replace("[[" . $modulecode . "]]", runModule($modulecode), $str);
}
}