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

View File

@ -89,7 +89,13 @@ class M3uPlaylist {
* @return instance of Playlist object
*/
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;
require_once "Playlist.php";
$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){
$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(
$gb, "$aPath/$rPath", $gunids, $parr);
$gb, $path, $gunids, $parr);
if(PEAR::isError($r)) return $r;
require_once "Playlist.php";
$pl =& Playlist::create($gb, $plid, "imported_SMIL", $parid);
@ -200,7 +206,7 @@ class SmilPlaylistAudioElement{
$type = 'playlist';
$acId = $r = $gb->bsImportPlaylistRaw($parid, $gunid,
$aPath, $uri, $ext, $gunids, $subjid);
if(PEAR::isError($r)) break;
if(PEAR::isError($r)){ return $r; }
//break;
default:
$ac = $r = StoredFile::recallByGunid($gb, $gunid);