* Fix close_notice().

* Add print_notice_box.
* get_notices(): Return false if $notices is null.
This commit is contained in:
Colin Smith 2005-07-10 04:52:37 +00:00
parent 8e13319b8f
commit 20d4d05e86

View File

@ -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;
}
?>