1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 10:49:37 +02:00

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

This commit is contained in:
Karl 'vollmerk' Vollmer 2007-09-12 07:30:55 +00:00
parent c99ad11ee0
commit bff9e37fa5
15 changed files with 308 additions and 85 deletions

View file

@ -1,27 +1,5 @@
<?php
/*
Copyright (c) 2001 - 2007 Ampache.org
All Rights Reserved
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
Copyright (c) 2001 - 2007 Ampache.org
All Rights Reserved
@ -38,8 +16,9 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
/**
* Error class
* This is the baic error class, its better now that we can use php5
* hello static functions and variables
@ -59,6 +38,19 @@ class Error {
} // __construct
/**
* __destruct
* This saves all of the errors that are left into the session
*/
public function __destruct() {
foreach (self::$errors as $key=>$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] .= "<br />\n" . $message;
return true;
$_SESSION['errors'][$key] .= "<br />\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