Fix for the bug where you could not upload files (the first part of bug #2114). Converted StoredFile into a real class that mapped the database table properly. Renamed some functions to be consistent with each other and with coding standards.
This commit is contained in:
parent
c59a73f506
commit
623be37d8a
|
@ -33,7 +33,7 @@ class AccessRecur {
|
|||
return $r;
|
||||
}
|
||||
$plRes = $r;
|
||||
$r = StoredFile::recallByGunid($plid);
|
||||
$r = StoredFile::RecallByGunid($plid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ class Backup
|
|||
foreach ($this->ids as $i=>$item) {
|
||||
$gunid = $item['gunid'];
|
||||
// get a stored file object of this gunid
|
||||
$sf = StoredFile::recallByGunid($gunid);
|
||||
$sf = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($sf)) {
|
||||
return $sf;
|
||||
}
|
||||
|
|
|
@ -93,22 +93,22 @@ class BasicStor {
|
|||
if (PEAR::isError($id)) {
|
||||
return $id;
|
||||
}
|
||||
$ac = StoredFile::insert($id, $fileName,
|
||||
$storedFile = StoredFile::insert($id, $fileName,
|
||||
$localFilePath, $metadataFilePath, $mdataLoc, $gunid, $ftype, 'StoredFile', $copyMedia);
|
||||
if (PEAR::isError($ac)) {
|
||||
if (PEAR::isError($storedFile)) {
|
||||
$res = BasicStor::RemoveObj($id);
|
||||
// catch constraint violations
|
||||
switch ($ac->getCode()) {
|
||||
switch ($storedFile->getCode()) {
|
||||
case -3:
|
||||
return PEAR::raiseError(
|
||||
"BasicStor::bsPutFile: gunid duplication",
|
||||
GBERR_GUNID);
|
||||
default:
|
||||
return $ac;
|
||||
return $storedFile;
|
||||
}
|
||||
}
|
||||
if ($ftype == 'playlist') {
|
||||
$ac->setMime('application/smil');
|
||||
$storedFile->setMime('application/smil');
|
||||
}
|
||||
return $id;
|
||||
} // fn bsPutFile
|
||||
|
@ -129,13 +129,13 @@ class BasicStor {
|
|||
case "audioclip":
|
||||
case "playlist":
|
||||
case "webstream":
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
// catch nonerror exception:
|
||||
//if($ac->getCode() != GBERR_FOBJNEX)
|
||||
return $ac;
|
||||
//if($storedFile->getCode() != GBERR_FOBJNEX)
|
||||
return $storedFile;
|
||||
}
|
||||
$res = $ac->rename($newName);
|
||||
$res = $storedFile->setName($newName);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -233,19 +233,19 @@ class BasicStor {
|
|||
*/
|
||||
public function bsReplaceFile($id, $localFilePath, $metadataFilePath, $mdataLoc='file')
|
||||
{
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (!empty($metadataFilePath) &&
|
||||
($mdataLoc!='file' || file_exists($metadataFilePath))) {
|
||||
$r = $ac->replaceMetadata($metadataFilePath, $mdataLoc);
|
||||
$r = $storedFile->setMetadata($metadataFilePath, $mdataLoc);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
if (!empty($localFilePath) && file_exists($localFilePath)) {
|
||||
$r = $ac->replaceRawMediaData($localFilePath);
|
||||
$r = $storedFile->setRawMediaData($localFilePath);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -280,15 +280,15 @@ class BasicStor {
|
|||
case "audioclip":
|
||||
case "playlist":
|
||||
case "webstream":
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (is_null($did)) {
|
||||
return PEAR::raiseError("BasicStor::bsDeleteFile: ".
|
||||
"trash not found", GBERR_NOTF);
|
||||
}
|
||||
$res = $ac->setState('deleted');
|
||||
$res = $storedFile->setState('deleted');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -514,21 +514,21 @@ class BasicStor {
|
|||
*/
|
||||
public function bsOpenDownload($id, $part='media', $parent='0')
|
||||
{
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$gunid = $ac->gunid;
|
||||
$gunid = $storedFile->gunid;
|
||||
switch ($part) {
|
||||
case "media":
|
||||
$realfile = $ac->getRealFileName();
|
||||
$ext = $ac->getFileExtension();
|
||||
$filename = $ac->getFileName();
|
||||
$realfile = $storedFile->getRealFileName();
|
||||
$ext = $storedFile->getFileExtension();
|
||||
$filename = $storedFile->getName();
|
||||
break;
|
||||
case "metadata":
|
||||
$realfile = $ac->getRealMetadataFileName();
|
||||
$realfile = $storedFile->getRealMetadataFileName();
|
||||
$ext = "xml";
|
||||
$filename = $ac->getFileName();
|
||||
$filename = $storedFile->getName();
|
||||
break;
|
||||
default:
|
||||
return PEAR::raiseError(
|
||||
|
@ -666,7 +666,7 @@ class BasicStor {
|
|||
GBERR_PUT);
|
||||
} else {
|
||||
// Remember the MD5 sum
|
||||
$storedFile = StoredFile::recallByToken($token);
|
||||
$storedFile = StoredFile::RecallByToken($token);
|
||||
if (!PEAR::isError($storedFile)) {
|
||||
$storedFile->setMd5($md5sum);
|
||||
} else {
|
||||
|
@ -800,11 +800,11 @@ class BasicStor {
|
|||
*/
|
||||
public function bsReplaceMetadata($id, $mdata, $mdataLoc='file')
|
||||
{
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
return $ac->replaceMetadata($mdata, $mdataLoc);
|
||||
return $storedFile->setMetadata($mdata, $mdataLoc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -817,11 +817,11 @@ class BasicStor {
|
|||
*/
|
||||
public function bsGetMetadata($id)
|
||||
{
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
return $ac->getMetadata();
|
||||
return $storedFile->getMetadata();
|
||||
}
|
||||
|
||||
|
||||
|
@ -842,14 +842,14 @@ class BasicStor {
|
|||
public function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL)
|
||||
{
|
||||
if (is_null($gunid)) {
|
||||
$ac = StoredFile::recall($id);
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
} else {
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
$storedFile = StoredFile::RecallByGunid($gunid);
|
||||
}
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$r = $ac->md->getMetadataValue('dc:title', $lang, $deflang);
|
||||
$r = $storedFile->md->getMetadataValue('dc:title', $lang, $deflang);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -875,11 +875,11 @@ class BasicStor {
|
|||
*/
|
||||
// public function bsGetMetadataValue($id, $category, $lang=NULL, $deflang=NULL)
|
||||
// {
|
||||
// $ac = StoredFile::recall($id);
|
||||
// if (PEAR::isError($ac)) {
|
||||
// return $ac;
|
||||
// $storedFile = StoredFile::Recall($id);
|
||||
// if (PEAR::isError($storedFile)) {
|
||||
// return $storedFile;
|
||||
// }
|
||||
// return $ac->md->getMetadataValue($category, $lang, $deflang);
|
||||
// return $storedFile->md->getMetadataValue($category, $lang, $deflang);
|
||||
// }
|
||||
|
||||
|
||||
|
@ -899,20 +899,20 @@ class BasicStor {
|
|||
*/
|
||||
public function bsGetMetadataValue($id, $category = null)
|
||||
{
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (is_null($category)) {
|
||||
return $ac->md->getAllMetadata();
|
||||
return $storedFile->md->getAllMetadata();
|
||||
} elseif (is_array($category)) {
|
||||
$values = array();
|
||||
foreach ($category as $tmpCat) {
|
||||
$values[$tmpCat] = $ac->md->getMetadataValue($tmpCat);
|
||||
$values[$tmpCat] = $storedFile->md->getMetadataValue($tmpCat);
|
||||
}
|
||||
return $values;
|
||||
} else {
|
||||
return $ac->md->getMetadataValue($category);
|
||||
return $storedFile->md->getMetadataValue($category);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -939,19 +939,19 @@ class BasicStor {
|
|||
public function bsSetMetadataValue($id, $category, $value,
|
||||
$lang=NULL, $mid=NULL, $container='metadata', $regen=TRUE)
|
||||
{
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if ($category == 'dcterms:extent') {
|
||||
$value = BasicStor::NormalizeExtent($value);
|
||||
}
|
||||
$res = $ac->md->setMetadataValue($category, $value, $lang, $mid, $container);
|
||||
$res = $storedFile->md->setMetadataValue($category, $value, $lang, $mid, $container);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
if ($regen) {
|
||||
$r = $ac->md->regenerateXmlFile();
|
||||
$r = $storedFile->md->regenerateXmlFile();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -1009,11 +1009,11 @@ class BasicStor {
|
|||
}
|
||||
}
|
||||
if ($regen) {
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$r = $ac->md->regenerateXmlFile();
|
||||
$r = $storedFile->md->regenerateXmlFile();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ class BasicStor {
|
|||
}
|
||||
$gunids = array();
|
||||
foreach ($plids as $plid) {
|
||||
$pl = Playlist::recallByGunid($plid);
|
||||
$pl = Playlist::RecallByGunid($plid);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -1164,11 +1164,11 @@ class BasicStor {
|
|||
mkdir($tmpdc);
|
||||
}
|
||||
foreach ($gunids as $i => $it) {
|
||||
$ac = StoredFile::recallByGunid($it['gunid']);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::RecallByGunid($it['gunid']);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$MDfname = $ac->md->getFileName();
|
||||
$MDfname = $storedFile->md->getName();
|
||||
if (PEAR::isError($MDfname)) {
|
||||
return $MDfname;
|
||||
}
|
||||
|
@ -1176,16 +1176,16 @@ class BasicStor {
|
|||
switch ($it['type']) {
|
||||
case "playlist":
|
||||
require_once("LsPlaylist.php");
|
||||
$ac = $r = LsPlaylist::recallByGunid($it['gunid']);
|
||||
$storedFile = $r = LsPlaylist::RecallByGunid($it['gunid']);
|
||||
switch ($type) {
|
||||
case "smil":
|
||||
$string = $r = $ac->outputToSmil();
|
||||
$string = $r = $storedFile->outputToSmil();
|
||||
break;
|
||||
case "m3u":
|
||||
$string = $r = $ac->outputToM3u();
|
||||
$string = $r = $storedFile->outputToM3u();
|
||||
break;
|
||||
default:
|
||||
$string = $r = $ac->md->genXmlDoc();
|
||||
$string = $r = $storedFile->md->genXmlDoc();
|
||||
}
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
@ -1199,11 +1199,11 @@ class BasicStor {
|
|||
copy($MDfname, "$tmpdc/{$it['gunid']}.xml"); break;
|
||||
} // switch
|
||||
} // if file_exists()
|
||||
$RADfname = $ac->getRealFileName();
|
||||
$RADfname = $storedFile->getRealFileName();
|
||||
if (PEAR::isError($RADfname)) {
|
||||
return $RADfname;
|
||||
}
|
||||
$RADext = $ac->getFileExtension();
|
||||
$RADext = $storedFile->getFileExtension();
|
||||
if (PEAR::isError($RADext)) {
|
||||
return $RADext;
|
||||
}
|
||||
|
@ -1475,11 +1475,11 @@ class BasicStor {
|
|||
*/
|
||||
public function bsAnalyzeFile($id)
|
||||
{
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$ia = $ac->analyzeFile();
|
||||
$ia = $storedFile->analyzeFile();
|
||||
return $ia;
|
||||
}
|
||||
|
||||
|
@ -1556,22 +1556,22 @@ class BasicStor {
|
|||
public function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
|
||||
{
|
||||
if ($byGunid) {
|
||||
$ac = StoredFile::recallByGunid($id);
|
||||
$storedFile = StoredFile::RecallByGunid($id);
|
||||
} else {
|
||||
$ac = StoredFile::recall($id);
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
}
|
||||
if (PEAR::isError($ac)) {
|
||||
if (PEAR::isError($storedFile)) {
|
||||
// catch some exceptions
|
||||
switch ($ac->getCode()) {
|
||||
switch ($storedFile->getCode()) {
|
||||
case GBERR_FILENEX:
|
||||
case GBERR_FOBJNEX:
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
return $ac;
|
||||
return $storedFile;
|
||||
}
|
||||
}
|
||||
$realFtype = BasicStor::GetType($ac->gunid);
|
||||
$realFtype = BasicStor::GetType($storedFile->gunid);
|
||||
if (!is_null($ftype) && (
|
||||
($realFtype != $ftype)
|
||||
// webstreams are subset of audioclips
|
||||
|
@ -1932,15 +1932,15 @@ class BasicStor {
|
|||
return $p_subjid;
|
||||
}
|
||||
}
|
||||
$ac = StoredFile::recallByGunid($p_playlistId);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::RecallByGunid($p_playlistId);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$state = $ac->getState();
|
||||
$state = $storedFile->getState();
|
||||
if ($p_val) {
|
||||
$r = $ac->setState('edited', $p_subjid);
|
||||
$r = $storedFile->setState('edited', $p_subjid);
|
||||
} else {
|
||||
$r = $ac->setState('ready', 'NULL');
|
||||
$r = $storedFile->setState('ready', 'NULL');
|
||||
}
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
@ -1959,14 +1959,14 @@ class BasicStor {
|
|||
*/
|
||||
public function isEdited($p_playlistId)
|
||||
{
|
||||
$ac = StoredFile::recallByGunid($p_playlistId);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::RecallByGunid($p_playlistId);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (!$ac->isEdited($p_playlistId)) {
|
||||
if (!$storedFile->isEdited($p_playlistId)) {
|
||||
return FALSE;
|
||||
}
|
||||
return $ac->isEditedBy($p_playlistId);
|
||||
return $storedFile->isEditedBy($p_playlistId);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1989,12 +1989,12 @@ class BasicStor {
|
|||
case "audioclip":
|
||||
case "playlist":
|
||||
case "webstream":
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$ac2 = StoredFile::CopyOf($ac, $nid);
|
||||
$ac2->rename(M2tree::GetObjName($nid));
|
||||
$ac2 = StoredFile::CopyOf($storedFile, $nid);
|
||||
$ac2->setName(M2tree::GetObjName($nid));
|
||||
break;
|
||||
case "File":
|
||||
default:
|
||||
|
@ -2016,15 +2016,15 @@ class BasicStor {
|
|||
case "audioclip":
|
||||
case "playlist":
|
||||
case "webstream":
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if ($ac->isEdited()) {
|
||||
if ($storedFile->isEdited()) {
|
||||
return PEAR::raiseError(
|
||||
'BasicStor::MoveObj: file is currently being edited, it cannot be moved.');
|
||||
}
|
||||
if ($ac->isAccessed()) {
|
||||
if ($storedFile->isAccessed()) {
|
||||
return PEAR::raiseError(
|
||||
'BasicStor::MoveObj: file is currently in use, it cannot be moved.');
|
||||
}
|
||||
|
@ -2082,21 +2082,21 @@ class BasicStor {
|
|||
case "audioclip":
|
||||
case "playlist":
|
||||
case "webstream":
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if ($ac->isEdited() && !$forced) {
|
||||
if ($storedFile->isEdited() && !$forced) {
|
||||
return PEAR::raiseError(
|
||||
'BasicStor::RemoveObj(): is edited'
|
||||
);
|
||||
}
|
||||
if ($ac->isAccessed() && !$forced) {
|
||||
if ($storedFile->isAccessed() && !$forced) {
|
||||
return PEAR::raiseError(
|
||||
'BasicStor::RemoveObj(): is accessed'
|
||||
);
|
||||
}
|
||||
$ac->delete();
|
||||
$storedFile->delete();
|
||||
break;
|
||||
case "File":
|
||||
case "Folder":
|
||||
|
|
|
@ -294,13 +294,13 @@ class GreenBox extends BasicStor {
|
|||
* session id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsReplaceMetadata($id, $mdata, $mdataLoc);
|
||||
} // fn replaceMetadata
|
||||
// public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='')
|
||||
// {
|
||||
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
// return $res;
|
||||
// }
|
||||
// return $this->bsReplaceMetadata($id, $mdata, $mdataLoc);
|
||||
// } // fn replaceMetadata
|
||||
|
||||
|
||||
/**
|
||||
|
@ -341,11 +341,11 @@ class GreenBox extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$ac = StoredFile::recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$arr = $ac->md->genPhpArray();
|
||||
$arr = $storedFile->md->genPhpArray();
|
||||
$md = FALSE;
|
||||
foreach ($arr['children'] as $i=>$a) {
|
||||
if ($a['elementname'] == 'metadata'){
|
||||
|
@ -588,7 +588,7 @@ class GreenBox extends BasicStor {
|
|||
public function getPlaylistArray($id, $sessid)
|
||||
{
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
$pl = StoredFile::recall($id);
|
||||
$pl = StoredFile::Recall($id);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -635,11 +635,11 @@ class GreenBox extends BasicStor {
|
|||
if (PEAR::isError($gunid)) {
|
||||
return $gunid;
|
||||
}
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$r = $ac->md->regenerateXmlFile();
|
||||
$r = $storedFile->md->regenerateXmlFile();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ class GreenBox extends BasicStor {
|
|||
$fadeIn=NULL, $fadeOut=NULL, $length=NULL, $pause=NULL)
|
||||
{
|
||||
require_once"Playlist.php";
|
||||
$pl = Playlist::recallByToken($token);
|
||||
$pl = Playlist::RecallByToken($token);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ class GreenBox extends BasicStor {
|
|||
public function delAudioClipFromPlaylist($token, $plElGunid, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = Playlist::recallByToken($token);
|
||||
$pl = Playlist::RecallByToken($token);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ class GreenBox extends BasicStor {
|
|||
public function changeFadeInfo($token, $plElGunid, $fadeIn, $fadeOut, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = Playlist::recallByToken($token);
|
||||
$pl = Playlist::RecallByToken($token);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -784,7 +784,7 @@ class GreenBox extends BasicStor {
|
|||
public function moveAudioClipInPlaylist($token, $plElGunid, $newPos, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = Playlist::recallByToken($token);
|
||||
$pl = Playlist::RecallByToken($token);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ class GreenBox extends BasicStor {
|
|||
$lang=NULL, $deflang=NULL)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = Playlist::recallByGunid($plid);
|
||||
$pl = Playlist::RecallByGunid($plid);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,12 @@ class LocStor extends BasicStor {
|
|||
/* ---------------------------------------------------------------- store */
|
||||
|
||||
/**
|
||||
* Store or replace existing audio clip
|
||||
* Store or replace existing audio clip.
|
||||
*
|
||||
* Sending a file to the storage server is a 3 step process:
|
||||
* 1) Call storeAudioClipOpen
|
||||
* 2) Upload the file to the URL specified
|
||||
* 3) Call storeAudioClipClose
|
||||
*
|
||||
* @param string $sessid
|
||||
* session id
|
||||
|
@ -49,27 +54,28 @@ class LocStor extends BasicStor {
|
|||
}
|
||||
|
||||
// Check if we already have this file.
|
||||
if ($duplicate = StoredFile::RecallByMd5($chsum)) {
|
||||
$duplicate = StoredFile::RecallByMd5($chsum);
|
||||
if (!empty($chsum) && $duplicate) {
|
||||
return PEAR::raiseError(
|
||||
"LocStor::storeAudioClipOpen: Duplicate file"
|
||||
." - Matched MD5 against '".$duplicate->getFileName()."'",
|
||||
." - Matched MD5 ($chsum) against '".$duplicate->getName()."'",
|
||||
888);
|
||||
}
|
||||
|
||||
// Check if specified gunid exists.
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (!PEAR::isError($ac)) {
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (!PEAR::isError($storedFile)) {
|
||||
// gunid exists - do replace
|
||||
$oid = $ac->getId();
|
||||
$oid = $storedFile->getId();
|
||||
if (($res = BasicStor::Authorize('write', $oid, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
if ($ac->isAccessed()) {
|
||||
if ($storedFile->isAccessed()) {
|
||||
return PEAR::raiseError(
|
||||
'LocStor::storeAudioClipOpen: is accessed'
|
||||
);
|
||||
}
|
||||
$res = $ac->replace($oid, $ac->name, '', $metadata, 'string');
|
||||
$res = $storedFile->replace($oid, $storedFile->name, '', $metadata, 'string');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -87,17 +93,17 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($oid)) {
|
||||
return $oid;
|
||||
}
|
||||
$ac =& StoredFile::insert($oid, '', '', $metadata,
|
||||
$storedFile =& StoredFile::insert($oid, '', '', $metadata,
|
||||
'string', $gunid, $ftype);
|
||||
if (PEAR::isError($ac)) {
|
||||
if (PEAR::isError($storedFile)) {
|
||||
$res = BasicStor::RemoveObj($oid);
|
||||
return $ac;
|
||||
return $storedFile;
|
||||
}
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
$res = $ac->setState('incomplete');
|
||||
$res = $storedFile->setState('incomplete');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -108,7 +114,7 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsOpenPut($chsum, $ac->gunid);
|
||||
return $this->bsOpenPut($chsum, $storedFile->gunid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,29 +127,28 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function storeAudioClipClose($sessid, $token)
|
||||
{
|
||||
$ac =& StoredFile::recallByToken($token);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByToken($token);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$arr = $this->bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
$ac->delete();
|
||||
$storedFile->delete();
|
||||
return $arr;
|
||||
}
|
||||
$fname = $arr['fname'];
|
||||
//$owner = $arr['owner'];
|
||||
$res = $ac->replaceRawMediaData($fname);
|
||||
$res = $storedFile->setRawMediaData($fname);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
if (file_exists($fname)) {
|
||||
@unlink($fname);
|
||||
}
|
||||
$res = $ac->setState('ready');
|
||||
$res = $storedFile->setState('ready');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
return $ac->gunid;
|
||||
return $storedFile->gunid;
|
||||
}
|
||||
|
||||
|
||||
|
@ -188,11 +193,11 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($gunid)) {
|
||||
return $gunid;
|
||||
}
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$oid = $ac->getId();
|
||||
$oid = $storedFile->getId();
|
||||
$r = $this-> bsSetMetadataValue(
|
||||
$oid, 'ls:url', $url, NULL, NULL, 'metadata');
|
||||
if (PEAR::isError($r)) {
|
||||
|
@ -215,14 +220,14 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
public function accessRawAudioData($sessid, $gunid, $parent='0')
|
||||
{
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (($res = BasicStor::Authorize('read', $ac->getId(), $sessid)) !== TRUE) {
|
||||
if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $ac->accessRawMediaData($parent);
|
||||
return $storedFile->accessRawMediaData($parent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -236,11 +241,11 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
public function releaseRawAudioData($sessid, $token)
|
||||
{
|
||||
$ac =& StoredFile::recallByToken($token);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByToken($token);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
return $ac->releaseRawMediaData($token);
|
||||
return $storedFile->releaseRawMediaData($token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -343,14 +348,14 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function getAudioClip($sessid, $gunid)
|
||||
{
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (($res = BasicStor::Authorize('read', $ac->getId(), $sessid)) !== TRUE) {
|
||||
if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$md = $this->bsGetMetadata($ac->getId());
|
||||
$md = $this->bsGetMetadata($storedFile->getId());
|
||||
if (PEAR::isError($md)) {
|
||||
return $md;
|
||||
}
|
||||
|
@ -483,11 +488,11 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($ex)) {
|
||||
return $ex;
|
||||
}
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
return $ac->exists();
|
||||
return $storedFile->exists();
|
||||
}
|
||||
|
||||
|
||||
|
@ -525,17 +530,17 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function deleteAudioClip($sessid, $gunid, $forced=FALSE)
|
||||
{
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
if ($ac->getCode()==GBERR_FOBJNEX && $forced) {
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
if ($storedFile->getCode()==GBERR_FOBJNEX && $forced) {
|
||||
return TRUE;
|
||||
}
|
||||
return $ac;
|
||||
return $storedFile;
|
||||
}
|
||||
if (($res = BasicStor::Authorize('write', $ac->getId(), $sessid)) !== TRUE) {
|
||||
if (($res = BasicStor::Authorize('write', $storedFile->getId(), $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = $this->bsDeleteFile($ac->getId(), $forced);
|
||||
$res = $this->bsDeleteFile($storedFile->getId(), $forced);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -554,14 +559,14 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function updateAudioClipMetadata($sessid, $gunid, $metadata)
|
||||
{
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (($res = BasicStor::Authorize('write', $ac->getId(), $sessid)) !== TRUE) {
|
||||
if (($res = BasicStor::Authorize('write', $storedFile->getId(), $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $ac->replaceMetadata($metadata, 'string');
|
||||
return $storedFile->setMetadata($metadata, 'string');
|
||||
}
|
||||
|
||||
|
||||
|
@ -601,13 +606,13 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($oid)) {
|
||||
return $oid;
|
||||
}
|
||||
$ac =& StoredFile::insert($oid, '', '',
|
||||
$storedFile =& StoredFile::insert($oid, '', '',
|
||||
dirname(__FILE__).'/emptyPlaylist.xml',
|
||||
'file', $playlistId, 'playlist'
|
||||
);
|
||||
if (PEAR::isError($ac)) {
|
||||
if (PEAR::isError($storedFile)) {
|
||||
$res = BasicStor::RemoveObj($oid);
|
||||
return $ac;
|
||||
return $storedFile;
|
||||
}
|
||||
if ($fname == '') {
|
||||
$fname = "newFile.xml";
|
||||
|
@ -616,15 +621,15 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$res = $ac->setState('ready');
|
||||
$res = $storedFile->setState('ready');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$res = $ac->setMime('application/smil');
|
||||
$res = $storedFile->setMime('application/smil');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
return $ac->gunid;
|
||||
return $storedFile->gunid;
|
||||
}
|
||||
|
||||
|
||||
|
@ -655,11 +660,11 @@ class LocStor extends BasicStor {
|
|||
'LocStor::editPlaylist: playlist already edited'
|
||||
);
|
||||
}
|
||||
$ac =& StoredFile::recallByGunid($playlistId);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($playlistId);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$id = $ac->getId();
|
||||
$id = $storedFile->getId();
|
||||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -694,11 +699,11 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($playlistId)) {
|
||||
return $playlistId;
|
||||
}
|
||||
$ac =& StoredFile::recallByGunid($playlistId);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($playlistId);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$res = $ac->replaceMetadata($newPlaylist, 'string', 'playlist');
|
||||
$res = $storedFile->setMetadata($newPlaylist, 'string', 'playlist');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -726,16 +731,16 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($gunid)) {
|
||||
return $gunid;
|
||||
}
|
||||
$ac =& StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$id = $ac->getId();
|
||||
$mdata = $ac->getMetadata();
|
||||
$id = $storedFile->getId();
|
||||
$mdata = $storedFile->getMetadata();
|
||||
if (PEAR::isError($mdata)) {
|
||||
return $mdata;
|
||||
}
|
||||
$res = $ac->replaceMetadata($mdata, 'string');
|
||||
$res = $storedFile->setMetadata($mdata, 'string');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -770,14 +775,14 @@ class LocStor extends BasicStor {
|
|||
GBERR_FILENEX
|
||||
);
|
||||
}
|
||||
$ac =& StoredFile::recallByGunid($playlistId);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile =& StoredFile::RecallByGunid($playlistId);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
if (($res = BasicStor::Authorize('write', $ac->getId(), $sessid)) !== TRUE) {
|
||||
if (($res = BasicStor::Authorize('write', $storedFile->getId(), $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = $this->bsDeleteFile($ac->getId(), $forced);
|
||||
$res = $this->bsDeleteFile($storedFile->getId(), $forced);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ class LsPlaylist extends Playlist
|
|||
* optional classname to recall
|
||||
* @return LsPlaylist
|
||||
*/
|
||||
public static function &recallByGunid($gunid, $className='LsPlaylist')
|
||||
public static function RecallByGunid($gunid, $className='LsPlaylist')
|
||||
{
|
||||
return parent::recallByGunid($gunid, $className);
|
||||
return parent::RecallByGunid($gunid, $className);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,9 +46,9 @@ class LsPlaylist extends Playlist
|
|||
* optional classname to recall
|
||||
* @return LsPlaylist
|
||||
*/
|
||||
public static function &recallByToken($token, $className='LsPlaylist')
|
||||
public static function RecallByToken($token, $className='LsPlaylist')
|
||||
{
|
||||
return parent::recallByToken($token, $className);
|
||||
return parent::RecallByToken($token, $className);
|
||||
}
|
||||
|
||||
|
||||
|
@ -301,7 +301,7 @@ class LsPlaylistElement {
|
|||
break;
|
||||
case "playlist":
|
||||
$gunid = $ac['attrs']['id'];
|
||||
$pl2 = LsPlaylist::recallByGunid($gunid);
|
||||
$pl2 = LsPlaylist::RecallByGunid($gunid);
|
||||
if (PEAR::isError($pl2)) {
|
||||
return $pl2;
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ class LsPlaylistElement {
|
|||
break;
|
||||
case "playlist":
|
||||
$gunid = $ac['attrs']['id'];
|
||||
$pl2 = LsPlaylist::recallByGunid($gunid);
|
||||
$pl2 = LsPlaylist::RecallByGunid($gunid);
|
||||
if (PEAR::isError($pl2)) {
|
||||
return $pl2;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ class LsPlaylistElement {
|
|||
break;
|
||||
case "playlist":
|
||||
$gunid = $ac['attrs']['id'];
|
||||
$pl2 = LsPlaylist::recallByGunid($gunid);
|
||||
$pl2 = LsPlaylist::RecallByGunid($gunid);
|
||||
if (PEAR::isError($pl2)) {
|
||||
return $pl2;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ class LsPlaylistAudioClip
|
|||
public function outputToSmil(&$pl, $plac, $ind='')
|
||||
{
|
||||
$gunid = $plac['attrs']['id'];
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
$ac = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ class LsPlaylistAudioClip
|
|||
public function outputToM3u(&$pl, $plac, $ind='')
|
||||
{
|
||||
$gunid = $plac['attrs']['id'];
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
$ac = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ class LsPlaylistAudioClip
|
|||
public function outputToRss(&$pl, $plac, $ind='')
|
||||
{
|
||||
$gunid = $plac['attrs']['id'];
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
$ac = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ class Playlist extends StoredFile {
|
|||
* @return Playlist
|
||||
* instance of Playlist object
|
||||
*/
|
||||
public static function &recallByGunid($gunid, $className='Playlist')
|
||||
public static function RecallByGunid($gunid, $className='Playlist')
|
||||
{
|
||||
return parent::recallByGunid($gunid, $className);
|
||||
return parent::RecallByGunid($gunid, $className);
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,9 +45,9 @@ class Playlist extends StoredFile {
|
|||
* @return Playlist
|
||||
* instance of Playlist object
|
||||
*/
|
||||
public static function &recallByToken($token, $className='Playlist')
|
||||
public static function RecallByToken($token, $className='Playlist')
|
||||
{
|
||||
return parent::recallByToken($token, $className);
|
||||
return parent::RecallByToken($token, $className);
|
||||
}
|
||||
|
||||
|
||||
|
@ -221,7 +221,7 @@ class Playlist extends StoredFile {
|
|||
*/
|
||||
private function getAudioClipInfo($acId)
|
||||
{
|
||||
$ac = StoredFile::recall($acId);
|
||||
$ac = StoredFile::Recall($acId);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
@ -956,7 +956,7 @@ class Playlist extends StoredFile {
|
|||
if ($found) { // we've found offset
|
||||
switch ($el['type']) {
|
||||
case "playlist":
|
||||
$pl = Playlist::recallByGunid($acGunid);
|
||||
$pl = Playlist::RecallByGunid($acGunid);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -1033,7 +1033,7 @@ class Playlist extends StoredFile {
|
|||
extract($el); // acLen, elOffset, acGunid, fadeIn, fadeOut, playlist
|
||||
switch ($el['type']) {
|
||||
case "playlist":
|
||||
$pl = Playlist::recallByGunid($acGunid);
|
||||
$pl = Playlist::RecallByGunid($acGunid);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -1105,7 +1105,7 @@ class Playlist extends StoredFile {
|
|||
if ($this->gunid == $insGunid) {
|
||||
return TRUE;
|
||||
}
|
||||
$pl = Playlist::recallByGunid($insGunid);
|
||||
$pl = Playlist::RecallByGunid($insGunid);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class Renderer
|
|||
{
|
||||
global $CC_CONFIG;
|
||||
// recall playlist:
|
||||
$pl = LsPlaylist::recallByGunid($plid);
|
||||
$pl = LsPlaylist::RecallByGunid($plid);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ class Renderer
|
|||
if (PEAR::isError($id)) {
|
||||
return $id;
|
||||
}
|
||||
$ac = StoredFile::recall($id);
|
||||
$ac = StoredFile::Recall($id);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ class Restore {
|
|||
return $put;
|
||||
}
|
||||
}
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
$ac = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class SmilPlaylist {
|
|||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$r = $pl->replaceMetadata($lspl, 'string', 'playlist');
|
||||
$r = $pl->setMetadata($lspl, 'string', 'playlist');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ class SmilPlaylistAudioElement {
|
|||
}
|
||||
//break;
|
||||
default:
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
$ac = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
|
|
@ -232,6 +232,14 @@ function camp_get_audio_metadata($p_filename, $p_testonly = false)
|
|||
* @see MetaData
|
||||
*/
|
||||
class StoredFile {
|
||||
|
||||
// *** Variable stored in the database ***
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Unique ID for the file. This is stored in HEX format. It is
|
||||
* converted to a bigint whenever it is used in a database call.
|
||||
|
@ -240,6 +248,58 @@ class StoredFile {
|
|||
*/
|
||||
public $gunid;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $mime;
|
||||
|
||||
/**
|
||||
* Can be 'playlist' or 'audioclip'.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $ftype;
|
||||
|
||||
/**
|
||||
* Can be 'ready', 'edited', 'incomplete'.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $state;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $currentlyaccessing;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $editedby;
|
||||
|
||||
/**
|
||||
* @var timestamp
|
||||
*/
|
||||
private $mtime;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $md5;
|
||||
|
||||
|
||||
// *** Variables NOT stored in the database ***
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $filepath;
|
||||
|
||||
/**
|
||||
* Directory where the file is located.
|
||||
*
|
||||
|
@ -247,11 +307,6 @@ class StoredFile {
|
|||
*/
|
||||
private $resDir;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $fname;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
|
@ -278,8 +333,8 @@ class StoredFile {
|
|||
$this->gunid = StoredFile::CreateGunid();
|
||||
}
|
||||
$this->resDir = $this->_getResDir($this->gunid);
|
||||
$this->fname = $this->makeFileName();
|
||||
$this->exists = is_file($this->fname) && is_readable($this->fname);
|
||||
$this->filepath = $this->makeFileName();
|
||||
$this->exists = is_file($this->filepath) && is_readable($this->filepath);
|
||||
$this->md = new MetaData($this->gunid, $this->resDir);
|
||||
}
|
||||
|
||||
|
@ -314,12 +369,12 @@ class StoredFile {
|
|||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$storedFile->fname = $filename;
|
||||
$storedFile->name = $filename;
|
||||
$storedFile->id = $oid;
|
||||
$storedFile->mime = "unknown";
|
||||
$emptyState = TRUE;
|
||||
if ($storedFile->fname == '') {
|
||||
$storedFile->fname = $storedFile->gunid;
|
||||
if ($storedFile->name == '') {
|
||||
$storedFile->name = $storedFile->gunid;
|
||||
}
|
||||
$storedFile->exists = FALSE;
|
||||
if (file_exists($localFilePath)) {
|
||||
|
@ -401,7 +456,7 @@ class StoredFile {
|
|||
* global unique id of file
|
||||
* @return StoredFile
|
||||
*/
|
||||
public static function recall($oid='', $gunid='')
|
||||
public static function Recall($oid='', $gunid='')
|
||||
{
|
||||
global $CC_DBC;
|
||||
global $CC_CONFIG;
|
||||
|
@ -410,9 +465,8 @@ class StoredFile {
|
|||
: "gunid=x'$gunid'::bigint"
|
||||
);
|
||||
$row = $CC_DBC->getRow("
|
||||
SELECT id, to_hex(gunid)as gunid, mime, name, ftype
|
||||
FROM ".$CC_CONFIG['filesTable']." WHERE $cond
|
||||
");
|
||||
SELECT id, to_hex(gunid)as gunid, name, mime, ftype, state, currentlyaccessing, editedby, mtime, md5
|
||||
FROM ".$CC_CONFIG['filesTable']." WHERE $cond");
|
||||
if (PEAR::isError($row)) {
|
||||
return $row;
|
||||
}
|
||||
|
@ -425,10 +479,16 @@ class StoredFile {
|
|||
}
|
||||
$gunid = StoredFile::NormalizeGunid($row['gunid']);
|
||||
$storedFile = new StoredFile($gunid);
|
||||
$storedFile->mime = $row['mime'];
|
||||
$storedFile->fname = $row['name'];
|
||||
$storedFile->exists = TRUE;
|
||||
$storedFile->id = $row['id'];
|
||||
$storedFile->name = $row['name'];
|
||||
$storedFile->mime = $row['mime'];
|
||||
$storedFile->ftype = $row['ftype'];
|
||||
$storedFile->state = $row['state'];
|
||||
$storedFile->currentlyaccessing = $row['currentlyaccessing'];
|
||||
$storedFile->editedby = $row['editedby'];
|
||||
$storedFile->mtime = $row['mtime'];
|
||||
$storedFile->md5 = $row['md5'];
|
||||
$storedFile->exists = TRUE;
|
||||
$storedFile->md->setFormat($row['ftype']);
|
||||
return $storedFile;
|
||||
}
|
||||
|
@ -442,9 +502,9 @@ class StoredFile {
|
|||
* global unique id of file
|
||||
* @return StoredFile
|
||||
*/
|
||||
public static function recallByGunid($gunid='')
|
||||
public static function RecallByGunid($gunid='')
|
||||
{
|
||||
return StoredFile::recall('', $gunid);
|
||||
return StoredFile::Recall('', $gunid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -456,7 +516,7 @@ class StoredFile {
|
|||
* access token
|
||||
* @return StoredFile
|
||||
*/
|
||||
public static function recallByToken($token)
|
||||
public static function RecallByToken($token)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = $CC_DBC->getOne("
|
||||
|
@ -468,10 +528,10 @@ class StoredFile {
|
|||
}
|
||||
if (is_null($gunid)) {
|
||||
return PEAR::raiseError(
|
||||
"StoredFile::recallByToken: invalid token ($token)", GBERR_AOBJNEX);
|
||||
"StoredFile::RecallByToken: invalid token ($token)", GBERR_AOBJNEX);
|
||||
}
|
||||
$gunid = StoredFile::NormalizeGunid($gunid);
|
||||
return StoredFile::recall('', $gunid);
|
||||
return StoredFile::Recall('', $gunid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -493,7 +553,7 @@ class StoredFile {
|
|||
}
|
||||
if ($gunid) {
|
||||
$gunid = StoredFile::NormalizeGunid($gunid);
|
||||
return StoredFile::recall('', $gunid);
|
||||
return StoredFile::Recall('', $gunid);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -509,21 +569,21 @@ class StoredFile {
|
|||
* copy the media file if true, make symlink if false
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
function addFile($localFilePath, $copyMedia=TRUE)
|
||||
public function addFile($localFilePath, $copyMedia=TRUE)
|
||||
{
|
||||
if ($this->exists) {
|
||||
return FALSE;
|
||||
}
|
||||
// for files downloaded from archive:
|
||||
if ($localFilePath == $this->fname) {
|
||||
if ($localFilePath == $this->filepath) {
|
||||
$this->exists = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
umask(0002);
|
||||
if ($copyMedia) {
|
||||
$r = @copy($localFilePath, $this->fname);
|
||||
$r = @copy($localFilePath, $this->filepath);
|
||||
} else {
|
||||
$r = @symlink($localFilePath, $this->fname);
|
||||
$r = @symlink($localFilePath, $this->filepath);
|
||||
}
|
||||
if ( $r ) {
|
||||
$this->exists = TRUE;
|
||||
|
@ -533,7 +593,7 @@ class StoredFile {
|
|||
$this->exists = FALSE;
|
||||
return PEAR::raiseError(
|
||||
"StoredFile::addFile: file save failed".
|
||||
" ($localFilePath, {$this->fname})",GBERR_FILEIO
|
||||
" ($localFilePath, {$this->filepath})",GBERR_FILEIO
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -546,15 +606,19 @@ class StoredFile {
|
|||
* local path
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
function replaceFile($localFilePath)
|
||||
public function replaceFile($localFilePath)
|
||||
{
|
||||
if ($this->exists) {
|
||||
$r = $this->delete();
|
||||
} else {
|
||||
$r = NULL;
|
||||
// Dont do anything if the source and destination files are
|
||||
// the same.
|
||||
if ($this->name == $localFilePath) {
|
||||
return TRUE;
|
||||
}
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
||||
if ($this->exists) {
|
||||
$r = $this->deleteFile();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
return $this->addFile($localFilePath);
|
||||
}
|
||||
|
@ -565,7 +629,7 @@ class StoredFile {
|
|||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function existsFile()
|
||||
public function existsFile()
|
||||
{
|
||||
return $this->exists;
|
||||
}
|
||||
|
@ -576,17 +640,17 @@ class StoredFile {
|
|||
*
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
function deleteFile()
|
||||
public function deleteFile()
|
||||
{
|
||||
if (!$this->exists) {
|
||||
return FALSE;
|
||||
}
|
||||
if (@unlink($this->fname)) {
|
||||
if (!file_exists($this->filepath) || @unlink($this->filepath)) {
|
||||
$this->exists = FALSE;
|
||||
return TRUE;
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
"StoredFile::deleteFile: unlink failed ({$this->fname})",
|
||||
"StoredFile::deleteFile: unlink failed ({$this->filepath})",
|
||||
GBERR_FILEIO
|
||||
);
|
||||
}
|
||||
|
@ -602,16 +666,12 @@ class StoredFile {
|
|||
* @return array
|
||||
* hierarchical hasharray with information about media file
|
||||
*/
|
||||
function analyzeFile()
|
||||
public function analyzeFile()
|
||||
{
|
||||
if (!$this->exists) {
|
||||
return FALSE;
|
||||
}
|
||||
$ia = camp_get_audio_metadata($this->fname);
|
||||
// echo "<pre>";
|
||||
// $ia = camp_get_audio_metadata($this->fname, true);
|
||||
// print_r($ia);
|
||||
// exit;
|
||||
$ia = camp_get_audio_metadata($this->filepath);
|
||||
return $ia;
|
||||
}
|
||||
|
||||
|
@ -621,7 +681,7 @@ class StoredFile {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function makeFileName()
|
||||
public function makeFileName()
|
||||
{
|
||||
return "{$this->resDir}/{$this->gunid}";
|
||||
}
|
||||
|
@ -638,7 +698,7 @@ class StoredFile {
|
|||
*/
|
||||
public static function CopyOf(&$src, $nid)
|
||||
{
|
||||
$storedFile = StoredFile::insert($nid, $src->fname, $src->getRealFileName(),
|
||||
$storedFile = StoredFile::insert($nid, $src->name, $src->getRealFileName(),
|
||||
'', '', NULL, BasicStor::GetType($src->gunid));
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
|
@ -668,13 +728,13 @@ class StoredFile {
|
|||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$CC_DBC->query("BEGIN");
|
||||
$res = $this->rename($name);
|
||||
$res = $this->setName($name);
|
||||
if (PEAR::isError($res)) {
|
||||
$CC_DBC->query("ROLLBACK");
|
||||
return $res;
|
||||
}
|
||||
if ($localFilePath != '') {
|
||||
$res = $this->replaceRawMediaData($localFilePath);
|
||||
$res = $this->setRawMediaData($localFilePath);
|
||||
} else {
|
||||
$res = $this->deleteFile();
|
||||
}
|
||||
|
@ -683,7 +743,7 @@ class StoredFile {
|
|||
return $res;
|
||||
}
|
||||
if ($metadata != '') {
|
||||
$res = $this->replaceMetadata($metadata, $mdataLoc);
|
||||
$res = $this->setMetadata($metadata, $mdataLoc);
|
||||
} else {
|
||||
$res = $this->md->delete();
|
||||
}
|
||||
|
@ -744,9 +804,9 @@ class StoredFile {
|
|||
*
|
||||
* @param string $localFilePath
|
||||
* local path to media file
|
||||
* @return void|PEAR_Error
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function replaceRawMediaData($localFilePath)
|
||||
public function setRawMediaData($localFilePath)
|
||||
{
|
||||
$res = $this->replaceFile($localFilePath);
|
||||
if (PEAR::isError($res)) {
|
||||
|
@ -763,6 +823,7 @@ class StoredFile {
|
|||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -779,7 +840,7 @@ class StoredFile {
|
|||
* (NULL = no validation)
|
||||
* @return boolean
|
||||
*/
|
||||
public function replaceMetadata($metadata, $mdataLoc='file', $format=NULL)
|
||||
public function setMetadata($metadata, $mdataLoc='file', $format=NULL)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$CC_DBC->query("BEGIN");
|
||||
|
@ -819,17 +880,17 @@ class StoredFile {
|
|||
* @param string $newname
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function rename($newname)
|
||||
public function setName($p_newname)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$escapedName = pg_escape_string($newname);
|
||||
$escapedName = pg_escape_string($p_newname);
|
||||
$res = $CC_DBC->query("
|
||||
UPDATE ".$CC_CONFIG['filesTable']." SET name='$escapedName', mtime=now()
|
||||
WHERE gunid=x'{$this->gunid}'::bigint
|
||||
");
|
||||
WHERE gunid=x'{$this->gunid}'::bigint");
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$this->name = $p_newname;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -843,19 +904,20 @@ class StoredFile {
|
|||
* user id | 'NULL' for clear editedBy field
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function setState($state, $editedby=NULL)
|
||||
public function setState($p_state, $p_editedby=NULL)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$escapedState = pg_escape_string($state);
|
||||
$eb = (!is_null($editedby) ? ", editedBy=$editedby" : '');
|
||||
$escapedState = pg_escape_string($p_state);
|
||||
$eb = (!is_null($p_editedby) ? ", editedBy=$p_editedby" : '');
|
||||
$res = $CC_DBC->query("
|
||||
UPDATE ".$CC_CONFIG['filesTable']."
|
||||
SET state='$escapedState'$eb, mtime=now()
|
||||
WHERE gunid=x'{$this->gunid}'::bigint
|
||||
");
|
||||
WHERE gunid=x'{$this->gunid}'::bigint");
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$this->state = $p_state;
|
||||
$this->editedby = $p_editedby;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -867,19 +929,20 @@ class StoredFile {
|
|||
* mime-type
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function setMime($mime)
|
||||
public function setMime($p_mime)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (!is_string($mime)) {
|
||||
$mime = 'application/octet-stream';
|
||||
if (!is_string($p_mime)) {
|
||||
$p_mime = 'application/octet-stream';
|
||||
}
|
||||
$escapedMime = pg_escape_string($mime);
|
||||
$escapedMime = pg_escape_string($p_mime);
|
||||
$res = $CC_DBC->query(
|
||||
"UPDATE ".$CC_CONFIG['filesTable']." SET mime='$escapedMime', mtime=now()
|
||||
WHERE gunid=x'{$this->gunid}'::bigint");
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$this->mime = $p_mime;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -900,6 +963,7 @@ class StoredFile {
|
|||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$this->md5 = $p_md5sum;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -910,12 +974,14 @@ class StoredFile {
|
|||
* @see MetaData
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function delete()
|
||||
public function delete($p_deleteFile = true)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$res = $this->deleteFile();
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
if ($p_deleteFile) {
|
||||
$res = $this->deleteFile();
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
$res = $this->md->delete();
|
||||
if (PEAR::isError($res)) {
|
||||
|
@ -960,12 +1026,11 @@ class StoredFile {
|
|||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (is_null($gunid)) {
|
||||
$gunid = $this->gunid;
|
||||
return ($this->currentlyaccessing > 0);
|
||||
}
|
||||
$ca = $CC_DBC->getOne("
|
||||
SELECT currentlyAccessing FROM ".$CC_CONFIG['filesTable']."
|
||||
WHERE gunid=x'$gunid'::bigint
|
||||
");
|
||||
WHERE gunid=x'$gunid'::bigint");
|
||||
if (is_null($ca)) {
|
||||
return PEAR::raiseError(
|
||||
"StoredFile::isAccessed: invalid gunid ($gunid)",
|
||||
|
@ -986,7 +1051,7 @@ class StoredFile {
|
|||
public function isEdited($playlistId=NULL)
|
||||
{
|
||||
if (is_null($playlistId)) {
|
||||
$playlistId = $this->gunid;
|
||||
return ($this->state == 'edited');
|
||||
}
|
||||
$state = $this->getState($playlistId);
|
||||
if ($state != 'edited') {
|
||||
|
@ -1094,7 +1159,7 @@ class StoredFile {
|
|||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
$fname = $this->getFileName();
|
||||
$fname = $this->getName();
|
||||
$pos = strrpos($fname, '.');
|
||||
if ($pos !== FALSE) {
|
||||
$ext = substr($fname, $pos+1);
|
||||
|
@ -1153,7 +1218,7 @@ class StoredFile {
|
|||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (is_null($gunid)) {
|
||||
$gunid = $this->gunid;
|
||||
return $this->state;
|
||||
}
|
||||
return $CC_DBC->getOne("
|
||||
SELECT state FROM ".$CC_CONFIG['filesTable']."
|
||||
|
@ -1169,11 +1234,11 @@ class StoredFile {
|
|||
* global unique id of file
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName($gunid=NULL)
|
||||
public function getName($gunid=NULL)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (is_null($gunid)) {
|
||||
$gunid = $this->gunid;
|
||||
return $this->name;
|
||||
}
|
||||
return $CC_DBC->getOne("
|
||||
SELECT name FROM ".$CC_CONFIG['filesTable']."
|
||||
|
@ -1209,7 +1274,7 @@ class StoredFile {
|
|||
*/
|
||||
public function getRealFileName()
|
||||
{
|
||||
return $this->fname;
|
||||
return $this->filepath;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -287,12 +287,12 @@ class Transport
|
|||
switch ($ftype = BasicStor::GetType($gunid)) {
|
||||
case "audioclip":
|
||||
case "webstream":
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
$storedFile = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
// handle metadata:
|
||||
$mdfpath = $ac->getRealMetadataFileName();
|
||||
$mdfpath = $storedFile->getRealMetadataFileName();
|
||||
if (PEAR::isError($mdfpath)) {
|
||||
return $mdfpath;
|
||||
}
|
||||
|
@ -303,11 +303,11 @@ class Transport
|
|||
return $mdtrec;
|
||||
}
|
||||
// handle raw media file:
|
||||
$fpath = $ac->getRealFileName();
|
||||
$fpath = $storedFile->getRealFileName();
|
||||
if (PEAR::isError($fpath)) {
|
||||
return $fpath;
|
||||
}
|
||||
$fname = $ac->getFileName();
|
||||
$fname = $storedFile->getName();
|
||||
if (PEAR::isError($fname)) {
|
||||
return $fname;
|
||||
}
|
||||
|
@ -325,11 +325,11 @@ class Transport
|
|||
case "playlist":
|
||||
$plid = $gunid;
|
||||
require_once("Playlist.php");
|
||||
$pl = Playlist::recallByGunid($plid);
|
||||
$pl = Playlist::RecallByGunid($plid);
|
||||
if (PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
$fname = $pl->getFileName();
|
||||
$fname = $pl->getName();
|
||||
if (PEAR::isError($fname)) {
|
||||
return $fname;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ if (preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['id'])) {
|
|||
}
|
||||
|
||||
// stored file recall:
|
||||
$ac = StoredFile::recallByGunid($gunid);
|
||||
$ac = StoredFile::RecallByGunid($gunid);
|
||||
if (PEAR::isError($ac)) {
|
||||
switch ($ac->getCode()) {
|
||||
case GBERR_DENY:
|
||||
|
|
Loading…
Reference in New Issue