From 20d4d05e86e2f9f9c06bf0ed61c2f7df2e622342 Mon Sep 17 00:00:00 2001 From: Colin Smith Date: Sun, 10 Jul 2005 04:52:37 +0000 Subject: * Fix close_notice(). * Add print_notice_box. * get_notices(): Return false if $notices is null. --- etc/inc/notices.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 755d4ef..4dff7c2 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -44,7 +44,7 @@ $notice_path = $g['tmp_path'] . '/notices'; * $priority - A notice's priority. Higher numbers indicate greater severity. * 0 = informational, 1 = warning, 2 = error, etc. This may also be arbitrary, */ -function file_notice($id, $notice, $category = "General", $url = "", $priority = 1) { +function file_notice($id, $notice, $category = "General", $url, $priority = 1) { global $notice_path; if(!$queue = get_notices()) $queue = array(); $queuekey = time(); @@ -66,6 +66,7 @@ function get_notices($category = "all") { global $notice_path; if(file_exists($notice_path)) { $queue = unserialize(file_get_contents($notice_path)); + if(!$queue) return false; if($category != 'all') { foreach($queue as $time => $notice) { if(strtolower($notice['category']) == strtolower($category)) @@ -103,10 +104,9 @@ function close_notice($id) { break; } } - /* XXX: what's $queue? This does nothing right now so I commented it out --Bill */ -/* $queueout = fopen($notice_path, "w"); + $queueout = fopen($notice_path, "w"); fwrite($queueout, serialize($queue)); - fclose($queueout);*/ + fclose($queueout); return; } @@ -151,4 +151,10 @@ function print_notices($notices, $category = "all") { return $toreturn; } +function print_notice_box($category = "all") { + $notices = get_notices(); + if(!$notices) return; + print_info_box_np(print_notices($notices, $category)); + return; +} ?> -- cgit v1.1