diff options
-rw-r--r-- | utils/admin.php | 7 | ||||
-rw-r--r-- | utils/modules.php | 22 | ||||
-rw-r--r-- | utils/modules/config.php | 2 | ||||
-rw-r--r-- | utils/modules/discography.php | 3 | ||||
-rw-r--r-- | utils/modules/events.php | 2 | ||||
-rw-r--r-- | utils/modules/gallery.php | 10 | ||||
-rw-r--r-- | utils/modules/guestbook.php | 2 | ||||
-rw-r--r-- | utils/modules/links.php | 2 | ||||
-rw-r--r-- | utils/modules/news.php | 32 | ||||
-rw-r--r-- | utils/modules/pages.php | 2 |
10 files changed, 66 insertions, 18 deletions
diff --git a/utils/admin.php b/utils/admin.php index 03f56bc..d0303c9 100644 --- a/utils/admin.php +++ b/utils/admin.php @@ -1,9 +1,12 @@ <div class="admin"> <div class="header">Admin</div> <?php +global $loggedin; + if($loggedin == true) { ?> -<?php +<?php +global $DATA_DIR; $users = new Users($DATA_DIR . "/users.xml"); if($userid) $UID = $userid; else $UID = $HTTP_COOKIE_VARS["UserID"]; @@ -15,6 +18,8 @@ if($loggedin == true) { <?php include_once($UTIL_DIR . "/modules.php"); +loadAllModules(); + foreach($modules as $modulename => $module) { if($m == $modulename) $admin_module = $module; echo "<a class=\"entry\" href=\"?page=admin&m=$modulename\">$module->admin_title</a>\n"; diff --git a/utils/modules.php b/utils/modules.php index 54682a4..b77beb8 100644 --- a/utils/modules.php +++ b/utils/modules.php @@ -19,9 +19,29 @@ function loadModule($modulename) } } +function loadAllModules() +{ + loadModule("config"); + loadModule("discography"); + loadModule("events"); + loadModule("gallery"); + loadModule("guestbook"); + loadModule("icons"); + loadModule("links"); + loadModule("members"); + loadModule("news"); + loadModule("pages"); +} + function getModuleParams($code) { - return explode(",", $code); + $params = array(); + $ps = explode(",", $code); + foreach($ps as $p) { + $v = explode("=", $p); + $params[$v[0]] = $v[1]; + } + return $params; } function runModule($code) diff --git a/utils/modules/config.php b/utils/modules/config.php index 4afb264..d25961a 100644 --- a/utils/modules/config.php +++ b/utils/modules/config.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"); class Config { diff --git a/utils/modules/discography.php b/utils/modules/discography.php index fe5a353..4781eda 100644 --- a/utils/modules/discography.php +++ b/utils/modules/discography.php @@ -213,11 +213,14 @@ class Discography { { global $GLOBALS; + $str = "<div class=\"discography\">\n"; $lyrics = $GLOBALS["lyrics"]; $number = $GLOBALS["track"]; + //foreach($params as $param => $value) {} + if($lyrics && $number) { if($this->discs) { foreach($this->discs as $disc) { diff --git a/utils/modules/events.php b/utils/modules/events.php index d8631ec..9fdf0b8 100644 --- a/utils/modules/events.php +++ b/utils/modules/events.php @@ -237,7 +237,7 @@ class Events { public function run($params) { - foreach($params as $param) { + foreach($params as $param => $value) { switch($param) { case "coming": return $this->showcoming(-1); diff --git a/utils/modules/gallery.php b/utils/modules/gallery.php index 6b2f384..4c7edc5 100644 --- a/utils/modules/gallery.php +++ b/utils/modules/gallery.php @@ -378,18 +378,18 @@ class Gallery { $str = ""; $str .= "\n<span class=\"gallery\">\n"; - foreach($params as $param) { + foreach($params as $param => $value) { switch($param) { + case "random": + $str .= $this->showRandomPhoto(); + break; + default: if($p != "" && $a != "") $str .= $this->showPhoto($a, $p); else if($a != "" && $this->albums[$a] && $p == "") $str .= $this->albums[$a]->show(" ", $this->maxwidth_icon, $this->maxheight_icon); else $str .= $this->showAlbums(); break; - - case "random": - $str .= $this->showRandomPhoto(); - break; } } $str .= "</span>\n"; diff --git a/utils/modules/guestbook.php b/utils/modules/guestbook.php index 2d5db8a..200322d 100644 --- a/utils/modules/guestbook.php +++ b/utils/modules/guestbook.php @@ -328,7 +328,7 @@ class Guestbook { $showeditor = false; $showposts = 0; - foreach($params as $param) { + foreach($params as $param => $value) { switch($param) { case "editor": $showeditor = true; diff --git a/utils/modules/links.php b/utils/modules/links.php index cf0cfed..ba68122 100644 --- a/utils/modules/links.php +++ b/utils/modules/links.php @@ -96,7 +96,7 @@ class Links { $groupid = "all"; - foreach($params as $param) { + foreach($params as $param => $value) { if(!$param) continue; switch($param) { case "all": diff --git a/utils/modules/news.php b/utils/modules/news.php index 75cb748..4d00b24 100644 --- a/utils/modules/news.php +++ b/utils/modules/news.php @@ -272,14 +272,32 @@ class News { public function run($params) { - global $show; + $str = ""; + + $module = "all"; + $number = -1; + + foreach($params as $param => $value) { + switch($param) { + case "show": + $module = $value; + break; + + case "number": + $number = $value; + break; + + case "all": + default: + $module = "all"; + $number = -1; + break; + } + } - switch($params) { - default: - if($show == "all") return $this->show(-1, "all"); - else return $this->show(3, "main"); - break; - } + $str .= $this->show($number, $module); + + return $str; } public function show($number, $category) diff --git a/utils/modules/pages.php b/utils/modules/pages.php index d3ee0aa..16d6759 100644 --- a/utils/modules/pages.php +++ b/utils/modules/pages.php @@ -24,7 +24,7 @@ class Page { $str = Markdown($this->content); - if(preg_match_all("/\[\[([\?,a-zA-Z0-9_]+)\]\]/", $str, $res)) { + if(preg_match_all("/\[\[([\?,a-zA-Z0-9_=]+)\]\]/", $str, $res)) { $modulecodes = array_unique($res[1]); foreach($modulecodes as $modulecode) { |