From 0cadc4e68340e02e6b51c29a672db7bb92386fa7 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 23 Dec 2000 15:13:34 +0000 Subject: - intermediate commit: some bugfixes, changes and some drastic changes to block and module support --- .htaccess | 1 + admin.php | 69 +++++++++++++++++++++++++++------------------- cron.php | 21 ++++++++++++-- includes/theme.inc | 1 + includes/widget.inc | 32 +++++++++++---------- module.php | 4 +-- themes/marvin/marvin.theme | 9 ++---- 7 files changed, 83 insertions(+), 54 deletions(-) diff --git a/.htaccess b/.htaccess index 9ba609af7..6a1c296c0 100644 --- a/.htaccess +++ b/.htaccess @@ -32,4 +32,5 @@ ErrorDocument 500 /error.php php_value session.cookie_lifetime 2000000 php_value session.gc_maxlifetime 2000000 php_value session.cache_expire 200000 + php_value session.save_path /tmp/dropsessions diff --git a/admin.php b/admin.php index b20e98efd..7fb758535 100644 --- a/admin.php +++ b/admin.php @@ -1,39 +1,50 @@ id || ($user->permissions != 1 && $user->id > 1)) exit(); -include "includes/admin.inc"; -include "includes/cron.inc"; - -// display admin header: -admin_header(); - -// generate administrator menu: -$handle = opendir("modules"); -while ($file = readdir($handle)) { - if ($filename = substr($file, 0, strpos($file, ".module"))) { - if ($filename == $mod) { - $output .= "$filename | "; - } - else { - include_once "modules/$filename.module"; - if ($module["cron"] && !cron_get($filename)) cron_set($filename, 172800); - if ($module["admin"]) $output .= "$filename | "; - } +include_once "includes/theme.inc"; +include_once "includes/cron.inc"; + +function admin_page($mod) { + global $repository, $menu, $modules; + + function module($name, $module) { + global $menu, $modules; + if ($module["admin"]) $output .= "$name | "; + $menu .= $output; } -} -closedir($handle); + + ?> + + + <? echo $site_name; ?> administration center + + +

Administration center

+ $output home
"; + module_iterate("module"); + + ?> +
home
+ + + + \ No newline at end of file +?> diff --git a/cron.php b/cron.php index 376792366..3cb6abfcb 100644 --- a/cron.php +++ b/cron.php @@ -1,7 +1,24 @@ scheduled"); + + while ($task = db_fetch_object($result)) { + if ($repository[$task->module]["cron"]) { + watchdog("message", "cron: executed '". $task->module ."_cron()'"); + $repository[$task->module]["cron"](); + } + } + + db_query("UPDATE crons SET timestamp = $time WHERE $time - timestamp > scheduled"); +} cron_run(); -?> +?> \ No newline at end of file diff --git a/includes/theme.inc b/includes/theme.inc index d1c3540e5..583bc0044 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -5,6 +5,7 @@ include_once "includes/database.inc"; include_once "includes/watchdog.inc"; include_once "includes/function.inc"; include_once "includes/droplet.inc"; +include_once "includes/module.inc"; include_once "includes/widget.inc"; include_once "includes/user.inc"; diff --git a/includes/widget.inc b/includes/widget.inc index 2ea57a246..96fe68ab4 100644 --- a/includes/widget.inc +++ b/includes/widget.inc @@ -1,5 +1,21 @@ $block) { + $theme->box($block["subject"], $block["content"]); + } + } + } + + module_iterate("display_block"); +} + function display_morelink($theme, $story) { return ($story->article) ? "[ id\">hlcolor2\">read more | ". strlen($story->article) ." bytes | id\">hlcolor2\">". format_plural($story->comments, "comment", "comments") ." ]" : "[ id\">hlcolor2\">". format_plural($story->comments, "comment", "comments") ." ]"; } @@ -72,20 +88,6 @@ function display_comment_moderation($id, $author, $score, $votes) { return $output; } -function display_new_diaries($theme, $num = 20) { - $result = db_query("SELECT u.userid, d.timestamp FROM diaries d LEFT JOIN users u ON d.author = u.id ORDER BY timestamp DESC LIMIT $num"); - - while ($diary = db_fetch_object($result)) { - if ($time != date("F jS", $diary->timestamp)) { - $content .= "

". date("l, M jS", $diary->timestamp) ."

\n"; - $time = date("F jS", $diary->timestamp); - } - $content .= "
  • userid\">$diary->userid
  • \n"; - } - $content .= "

    [ hlcolor2\">more ]

    "; - $theme->box("Recent diary entries", $content); -} - function display_new_headlines($theme, $num = 10) { global $user; @@ -115,7 +117,7 @@ function display_account($theme) { $content .= "

    \n"; $content .= "

  • edit your diary
  • \n"; $content .= "
  • edit your information
  • \n"; - $content .= "
  • edit your settings
  • \n"; + $content .= "
  • edit your settings
  • \n"; $content .= "

    \n"; $content .= "

  • view your diary
  • \n"; $content .= "
  • view your information
  • \n"; diff --git a/module.php b/module.php index c6ceacf06..f2246aae6 100644 --- a/module.php +++ b/module.php @@ -1,6 +1,6 @@ diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 076f0083a..b8e671083 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -256,14 +256,11 @@ ### Display account: display_account($this); - ### Display calendar: + ### Display old headlines: display_old_headlines($this); - ### Display calendar: - $this->box("Browse archives", droplet_get("calendar")); - - ### Display new diary entries: - display_new_diaries($this); + ### Display module blocks: + display_module_blocks(); } elseif (strstr($PHP_SELF, "account.php")) { ### Display account: -- cgit v1.2.3