"; } require_once("BasicStor.php"); if (isset($WHITE_SCREEN_OF_DEATH) && $WHITE_SCREEN_OF_DEATH) { echo __FILE__.':line '.__LINE__.": Loaded BasicStor
"; } require_once("Playlist.php"); require_once('Prefs.php'); require_once("Transport.php"); /** * GreenBox class * * File storage module. * * @package Airtime * @subpackage StorageServer * @copyright 2010 Sourcefabric O.P.S. * @license http://www.gnu.org/licenses/gpl.txt */ class GreenBox extends BasicStor { /* ====================================================== storage methods */ /* ------------------------------------------------------------- metadata */ /** * Search in local metadata database. * * @param array $criteria * with following structure:
* * @param string $sessid * session id * @return array of hashes, fields: * * @see BasicStor::bsLocalSearch */ public function localSearch($criteria, $sessid='') { $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); return $this->bsLocalSearch($criteria, $limit, $offset); } // fn localSearch /*====================================================== playlist methods */ /** * Close import-handle and import playlist * * @param string $token * import token obtained by importPlaylistOpen method * @return int * result file local id (or error object) */ public function importPlaylistClose($token) { $arr = $this->bsClosePut($token); if (PEAR::isError($arr)) { return $arr; } $fname = $arr['fname']; $owner = $arr['owner']; $res = $this->bsImportPlaylist($fname, $owner); if (file_exists($fname)) { @unlink($fname); } return $res; } // fn importPlaylistClose /* ========================================================= info methods */ /* ==================================================== redefined methods */ /** * Change user password. * * ('superuser mode'= superuser is changing some password without * knowledge of the old password) * * @param string $login * @param string $oldpass * old password * (should be null or empty for 'superuser mode') * @param string $pass * @param string $sessid * session id, required for 'superuser mode' * @return boolean/err */ public function passwd($login, $oldpass=null, $pass='', $sessid='') { if (is_null($oldpass) || ($oldpass == '') ) { if (($res = BasicStor::Authorize('subjects', $this->rootId, $sessid)) !== TRUE) { sleep(2); return $res; } else { $oldpass = null; } } else { if (FALSE === Subjects::Authenticate($login, $oldpass)) { sleep(2); return PEAR::raiseError( "GreenBox::passwd: access denied (oldpass)", GBERR_DENY); } } $res = Subjects::Passwd($login, $oldpass, $pass); if (PEAR::isError($res)) { return $res; } return TRUE; } // fn passwd } // class GreenBox