From bff9e37fa5fa41111b5b06ce6cdcb0eb8e5c21f9 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Wed, 12 Sep 2007 07:30:55 +0000 Subject: more work on the localplay stuff, most details ironed out, just needs some code to back it up, also tweaked plugins and threw in some extra goodies in the preference class, also pimped out the error class --- lib/class/error.class.php | 64 +++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 30 deletions(-) (limited to 'lib/class/error.class.php') diff --git a/lib/class/error.class.php b/lib/class/error.class.php index 29c1c885..61202532 100644 --- a/lib/class/error.class.php +++ b/lib/class/error.class.php @@ -1,27 +1,5 @@ $error) { + $_SESSION['errors'][$key] = $error; + } + + } // __destruct + /** * add * This is a public static function it adds a new error message to the array @@ -70,24 +62,21 @@ class Error { if (!isset(Error::$errors[$name])) { Error::$errors[$name] = $message; Error::$state = 1; - return true; + $_SESSION['errors'][$key] = $message; } - // They want us to clobber it - if ($clobber) { + elseif ($clobber) { Error::$state = 1; Error::$errors[$name] = $message; - return true; + $_SESSION['errors'][$key] = $message; } - // They want us to append the error, add a BR\n and then the message else { Error::$state = 1; Error::$errors[$name] .= "
\n" . $message; - return true; + $_SESSION['errors'][$key] .= "
\n" . $message; } - } // add /** @@ -116,5 +105,20 @@ class Error { } // display + /** + * auto_init + * This loads the errors from the session back into Ampache + */ + public static function auto_init() { + + if (!is_array($_SESSION['errors'])) { return false; } + + // Re-insert them + foreach ($_SESSION['errors'] as $key=>$error) { + self::add($key,$error); + } + + } // auto_init + } // Error -- cgit