This commit is contained in:
tomash 2006-03-23 13:35:19 +00:00
parent 7ad687cae7
commit 9da79c937e
3 changed files with 28 additions and 10 deletions

View File

@ -82,10 +82,10 @@ class BasicStor extends Alib{
$this->filesTable = $config['tblNamePrefix'].'files'; $this->filesTable = $config['tblNamePrefix'].'files';
$this->mdataTable = $config['tblNamePrefix'].'mdata'; $this->mdataTable = $config['tblNamePrefix'].'mdata';
$this->accessTable= $config['tblNamePrefix'].'access'; $this->accessTable= $config['tblNamePrefix'].'access';
$this->storageDir = $config['storageDir']; $this->storageDir = realpath($config['storageDir']);
$this->bufferDir = $config['bufferDir']; $this->bufferDir = realpath($config['bufferDir']);
$this->transDir = $config['transDir']; $this->transDir = realpath($config['transDir']);
$this->accessDir = $config['accessDir']; $this->accessDir = realpath($config['accessDir']);
$this->dbc->setErrorHandling(PEAR_ERROR_RETURN); $this->dbc->setErrorHandling(PEAR_ERROR_RETURN);
$this->rootId = $this->getRootNode(); $this->rootId = $this->getRootNode();
$this->storId = $this->wd = $this->storId = $this->wd =
@ -932,12 +932,18 @@ class BasicStor extends Alib{
{ {
$id = $r = $this->_idFromGunid($plid); $id = $r = $this->_idFromGunid($plid);
if(!is_null($r)) return $r; if(!is_null($r)) return $r;
$path = realpath("$aPath/$rPath");
if(FALSE === $path){
return PEAR::raiseError(
"BasicStor::bsImportPlaylistRaw: file doesn't exist ($aPath/$rPath)"
);
}
switch($ext){ switch($ext){
case"xml": case"xml":
case"lspl": case"lspl":
$fname = $plid; $fname = $plid;
$res = $this->bsPutFile($parid, $fname, $res = $this->bsPutFile($parid, $fname,
NULL, "$aPath/$rPath", $plid, 'playlist' NULL, $path, $plid, 'playlist'
); );
break; break;
case"smil": case"smil":
@ -981,7 +987,7 @@ class BasicStor extends Alib{
mkdir($tmpd); mkdir($tmpd);
$res = `cd $tmpd; tar xf $fname`; $res = `cd $tmpd; tar xf $fname`;
// clips: // clips:
$d = dir($tmpdc); $entries=array(); $gunids=array(); $d = @dir($tmpdc); $entries=array(); $gunids=array();
if($d !== false){ if($d !== false){
while (false !== ($entry = $d->read())) { while (false !== ($entry = $d->read())) {
if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){ if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){
@ -1015,7 +1021,7 @@ class BasicStor extends Alib{
} }
// playlists: // playlists:
require_once"Playlist.php"; require_once"Playlist.php";
$d = dir($tmpdp); $d = @dir($tmpdp);
if($d !== false){ if($d !== false){
while ((!PEAR::isError($res)) && false !== ($entry = $d->read())) { while ((!PEAR::isError($res)) && false !== ($entry = $d->read())) {
if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){ if(preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)){

View File

@ -89,7 +89,13 @@ class M3uPlaylist {
* @return instance of Playlist object * @return instance of Playlist object
*/ */
function import(&$gb, $aPath, $rPath, &$gunids, $plid, $parid, $subjid=NULL){ function import(&$gb, $aPath, $rPath, &$gunids, $plid, $parid, $subjid=NULL){
$arr = $r = M3uPlaylist::parse("$aPath/$rPath"); $path = realpath("$aPath/$rPath");
if(FALSE === $path){
return PEAR::raiseError(
"M3uPlaylist::import: file doesn't exist ($aPath/$rPath)"
);
}
$arr = $r = M3uPlaylist::parse($path);
if(PEAR::isError($r)) return $r; if(PEAR::isError($r)) return $r;
require_once "Playlist.php"; require_once "Playlist.php";
$pl = $r =& Playlist::create($gb, $plid, "imported_M3U", $parid); $pl = $r =& Playlist::create($gb, $plid, "imported_M3U", $parid);

View File

@ -65,8 +65,14 @@ class SmilPlaylist {
*/ */
function &import(&$gb, $aPath, $rPath, &$gunids, $plid, $parid, $subjid=NULL){ function &import(&$gb, $aPath, $rPath, &$gunids, $plid, $parid, $subjid=NULL){
$parr = compact('parid', 'subjid', 'aPath', 'plid', 'rPath'); $parr = compact('parid', 'subjid', 'aPath', 'plid', 'rPath');
$path = realpath("$aPath/$rPath");
if(FALSE === $path){
return PEAR::raiseError(
"SmilPlaylist::import: file doesn't exist ($aPath/$rPath)"
);
}
$lspl = $r = SmilPlaylist::convert2lspl( $lspl = $r = SmilPlaylist::convert2lspl(
$gb, "$aPath/$rPath", $gunids, $parr); $gb, $path, $gunids, $parr);
if(PEAR::isError($r)) return $r; if(PEAR::isError($r)) return $r;
require_once "Playlist.php"; require_once "Playlist.php";
$pl =& Playlist::create($gb, $plid, "imported_SMIL", $parid); $pl =& Playlist::create($gb, $plid, "imported_SMIL", $parid);
@ -200,7 +206,7 @@ class SmilPlaylistAudioElement{
$type = 'playlist'; $type = 'playlist';
$acId = $r = $gb->bsImportPlaylistRaw($parid, $gunid, $acId = $r = $gb->bsImportPlaylistRaw($parid, $gunid,
$aPath, $uri, $ext, $gunids, $subjid); $aPath, $uri, $ext, $gunids, $subjid);
if(PEAR::isError($r)) break; if(PEAR::isError($r)){ return $r; }
//break; //break;
default: default:
$ac = $r = StoredFile::recallByGunid($gb, $gunid); $ac = $r = StoredFile::recallByGunid($gb, $gunid);