In BasicStor.php, converted many functions to STATIC because thats what they were. This in turn converted many other functions to STATIC in other files. Commented out functions that were not in use. Removed code that was already commented out. The Prefs class no longer requires the greenbox in its constructor. Changed the poorly named "upload2Hub" to "uploadToHub". Changed "uploadFileToHub" to "uploadFileAsync" (partly because the idea of a Hub no longer exists). Added public/private keywords to functions in Transport.php. Converted some comments mentioning LS to CC. DataEngine class no longer needs a Greenbox object to initialize it. Expanded LocStor::searchMetadata() to handle remote searches as well as local searches.
This commit is contained in:
parent
2a8f05a748
commit
0cd289c48b
|
@ -34,7 +34,7 @@ class Archive extends XR_LocStor {
|
|||
if (PEAR::isError($owner)) {
|
||||
return $owner;
|
||||
}
|
||||
$res = $this->bsOpenPut($chsum, NULL, $owner);
|
||||
$res = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class Archive extends XR_LocStor {
|
|||
*/
|
||||
function uploadCheck($token)
|
||||
{
|
||||
return $this->bsCheckPut($token);
|
||||
return BasicStor::bsCheckPut($token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Archive extends XR_LocStor {
|
|||
*/
|
||||
function uploadClose($token, $trtype, $pars=array())
|
||||
{
|
||||
$res = $this->bsClosePut($token);
|
||||
$res = BasicStor::bsClosePut($token);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class Archive extends XR_LocStor {
|
|||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
$mdtoken = $pars['mdpdtoken'];
|
||||
$res = $this->bsClosePut($mdtoken);
|
||||
$res = BasicStor::bsClosePut($mdtoken);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class Archive extends XR_LocStor {
|
|||
case "playlistPkg":
|
||||
$chsum = md5_file($fname);
|
||||
// importPlaylistOpen:
|
||||
$res = $this->bsOpenPut($chsum, NULL, $owner);
|
||||
$res = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -225,14 +225,14 @@ class Archive extends XR_LocStor {
|
|||
$res = $this->accessPlaylist($sessid, $gunid);
|
||||
break;
|
||||
case "playlistPkg":
|
||||
$res = $this->bsExportPlaylistOpen($gunid);
|
||||
$res = BasicStor::bsExportPlaylistOpen($gunid);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
|
||||
$plfpath = "$tmpn.lspl";
|
||||
copy($res['fname'], $plfpath);
|
||||
$res = $this->bsExportPlaylistClose($res['token']);
|
||||
$res = BasicStor::bsExportPlaylistClose($res['token']);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ class Archive extends XR_LocStor {
|
|||
case "metadata":
|
||||
case "playlist":
|
||||
case "playlistPkg":
|
||||
$title = $this->bsGetTitle(NULL, $gunid);
|
||||
$title = BasicStor::bsGetTitle(NULL, $gunid);
|
||||
break;
|
||||
case "searchjob":
|
||||
$title = 'searchjob';
|
||||
|
|
|
@ -193,8 +193,8 @@ if (isset($_REQUEST['popup']) && is_array($_REQUEST['popup'])){
|
|||
$uiBrowser->EXCHANGE->createBackupDownload();
|
||||
break;
|
||||
|
||||
case 'TR.confirmUpload2Hub':
|
||||
$uiBrowser->TRANSFERS->upload2Hub($_REQUEST['id']);
|
||||
case 'TR.confirmUploadToHub':
|
||||
$uiBrowser->TRANSFERS->uploadToHub($_REQUEST['id']);
|
||||
$Smarty->display('popup/TR.confirmTransfer.tpl');
|
||||
break;
|
||||
|
||||
|
|
|
@ -202,8 +202,10 @@ switch ($_REQUEST['act']) {
|
|||
break;
|
||||
|
||||
case "HUBSEARCH.newSearch":
|
||||
$uiHandler->HUBSEARCH->newSearch($_REQUEST);
|
||||
$uiHandler->SEARCH->newSearch($_REQUEST, "remote");
|
||||
break;
|
||||
// $uiHandler->HUBSEARCH->newSearch($_REQUEST);
|
||||
// break;
|
||||
|
||||
case "HUBSEARCH.reorder":
|
||||
$uiHandler->HUBSEARCH->reorder($_REQUEST['by']);
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
onClick="return contextmenu('{$i.id}'
|
||||
, 'SP.addItem'
|
||||
|
||||
|
||||
{if $i.type|lower == 'audioclip'}
|
||||
, 'listen', '{$i.gunid}'
|
||||
|
||||
|
||||
{if $_PL_activeId}
|
||||
, 'PL.addItem'
|
||||
{else}
|
||||
, 'PL.create'
|
||||
{/if}
|
||||
|
||||
|
||||
, 'edit'
|
||||
, 'delete'
|
||||
{/if}
|
||||
|
||||
{if $i.type|lower == 'webstream'}
|
||||
, 'listen', '{$i.gunid}'
|
||||
|
||||
|
||||
{if $_PL_activeId}
|
||||
, 'PL.addStream'
|
||||
{else}
|
||||
, 'PL.create'
|
||||
{/if}
|
||||
|
||||
|
||||
, 'edit'
|
||||
, 'delete'
|
||||
{/if}
|
||||
|
@ -45,6 +45,6 @@ onClick="return contextmenu('{$i.id}'
|
|||
{/if}
|
||||
{/if}
|
||||
|
||||
, 'TR.upload2Hub'
|
||||
, 'TR.uploadToHub'
|
||||
)"
|
||||
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
onClick="return contextmenu('{$i.id}'
|
||||
, 'SP.removeItem'
|
||||
|
||||
|
||||
{if $i.type|lower == 'audioclip'}
|
||||
, 'listen', '{$i.gunid}'
|
||||
|
||||
|
||||
{if $_PL_activeId}
|
||||
, 'PL.addItem'
|
||||
{else}
|
||||
, 'PL.create'
|
||||
, 'PL.create'
|
||||
{/if}
|
||||
|
||||
|
||||
, 'edit'
|
||||
, 'delete'
|
||||
{/if}
|
||||
|
||||
{if $i.type|lower == 'webstream'}
|
||||
, 'listen', '{$i.gunid}'
|
||||
|
||||
|
||||
{if $_PL_activeId}
|
||||
{if $i.duration == '00:00:00.000000'}
|
||||
, 'PL.addStream'
|
||||
{else}
|
||||
, 'PL.addItem'
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
, 'PL.create'
|
||||
{/if}
|
||||
|
||||
|
||||
, 'edit'
|
||||
, 'delete'
|
||||
{/if}
|
||||
|
@ -49,6 +49,6 @@ onClick="return contextmenu('{$i.id}'
|
|||
, 'PL.export'
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
, 'TR.upload2Hub'
|
||||
|
||||
, 'TR.uploadToHub'
|
||||
)"
|
|
@ -1,6 +1,6 @@
|
|||
{literal}
|
||||
<script type="text/javascript">
|
||||
// www.jjam.de - Kontextmenü mit JavaScript - Version 15.12.2002
|
||||
// www.jjam.de - Kontextmen<EFBFBD> mit JavaScript - Version 15.12.2002
|
||||
|
||||
// Browser detection
|
||||
ie5 = (document.getElementById && document.all && document.styleSheets) ? 1 : 0;
|
||||
|
@ -19,7 +19,7 @@ function contextmenu(param) {
|
|||
|
||||
var sp2 = " ";
|
||||
var sp5 = sp2 + sp2 + " "; // Leerzeichen als Abstandshalter (flexibler und code-sparender als eine aufwendige Tabellenkonstruktion) ;
|
||||
var oF = "onfocus = 'if (this.blur) this.blur()'"; // Um hässlichen Linkrahmen in einigen Browsern zu vermeiden;
|
||||
var oF = "onfocus = 'if (this.blur) this.blur()'"; // Um h<EFBFBD>sslichen Linkrahmen in einigen Browsern zu vermeiden;
|
||||
var entry = new Array();
|
||||
//contextmenuStatus = 0;
|
||||
|
||||
|
@ -33,11 +33,11 @@ function contextmenu(param) {
|
|||
case "PL.addItem":
|
||||
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: hpopup('{$UI_HANDLER}?act=PL.addItem&id="+param+"')\" "+oF+"> ##Add to playlist## </a></li>";
|
||||
break;
|
||||
|
||||
|
||||
case "PL.addStream":
|
||||
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=PL.setItemPlaylengthForm&id="+param+"', 'PL.setStreamPlaylength', 400, 50)\" "+oF+"> ##Add to playlist## </a></li>";
|
||||
break;
|
||||
|
||||
|
||||
case "PL.changeItemPlaylength":
|
||||
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=PL.setItemPlaylengthForm&elemId="+param+"', 'PL.setItemPlaylength', 400, 50)\" "+oF+"> ##Change playlegth## </a></li>";
|
||||
break;
|
||||
|
@ -130,8 +130,8 @@ function contextmenu(param) {
|
|||
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=SUBJECTS.confirmRemoveSubj&"+param+"', 'confirmRemoveSubj', 400, 50)\" "+oF+"> ##Delete## </a></li>";
|
||||
break;
|
||||
|
||||
case "TR.upload2Hub":
|
||||
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=TR.confirmUpload2Hub&id="+param+"', 'confirmUpload2Hub', 400, 50)\" "+oF+"> ##Transfer to the hub## </a></li>";
|
||||
case "TR.uploadToHub":
|
||||
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=TR.confirmUploadToHub&id="+param+"', 'confirmUploadToHub', 400, 50)\" "+oF+"> ##Transfer to the hub## </a></li>";
|
||||
break;
|
||||
|
||||
case "TR.downloadFromHub":
|
||||
|
|
|
@ -185,7 +185,7 @@ class uiHandler extends uiBase {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
$result = $this->gb->bsSetMetadataBatch($storedFile->getId(), $metadata);
|
||||
$result = BasicStor::bsSetMetadataBatch($storedFile->getId(), $metadata);
|
||||
|
||||
$this->redirUrl = UI_BROWSER."?act=addFileMData&id=".$storedFile->getId();
|
||||
if (UI_VERBOSE) {
|
||||
|
|
|
@ -117,9 +117,20 @@ class uiSearch
|
|||
}
|
||||
|
||||
|
||||
function newSearch(&$formdata)
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param array $formdata
|
||||
* The $_REQUEST array.
|
||||
* @param string $p_host
|
||||
* Can be "local" or "remote" depending on which
|
||||
* storage server you want to search.
|
||||
* @return void
|
||||
*/
|
||||
function newSearch(&$formdata, $p_host = "local")
|
||||
{
|
||||
$this->results = NULL;
|
||||
$this->criteria['host'] = $p_host;
|
||||
$this->criteria['conditions'] = NULL;
|
||||
$this->criteria['offset'] = NULL;
|
||||
$this->criteria['form'] = NULL;
|
||||
|
@ -128,7 +139,7 @@ class uiSearch
|
|||
$this->criteria['limit'] = $formdata['limit'];
|
||||
$this->criteria['counter'] = 0;
|
||||
|
||||
// $criteria['form'] is used for retransfer to form
|
||||
// $criteria['form'] is used for retransfer of the form
|
||||
$this->criteria['form']['operator'] = $formdata['operator'];
|
||||
$this->criteria['form']['filetype'] = $formdata['filetype'];
|
||||
$this->criteria['form']['limit'] = $formdata['limit'];
|
||||
|
|
|
@ -153,7 +153,7 @@ class uiTransfers
|
|||
}
|
||||
|
||||
|
||||
function upload2Hub($id)
|
||||
function uploadToHub($id)
|
||||
{
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
$type = BasicStor::GetType($gunid);
|
||||
|
@ -161,14 +161,14 @@ class uiTransfers
|
|||
switch ($type) {
|
||||
case 'audioClip':
|
||||
case 'audioclip':
|
||||
$r = $this->Base->gb->upload2Hub($gunid);
|
||||
$r = $this->Base->gb->uploadToHub($gunid);
|
||||
break;
|
||||
case 'playlist':
|
||||
$this->Base->gb->upload2Hub($gunid);
|
||||
$this->Base->gb->uploadToHub($gunid);
|
||||
break;
|
||||
default:
|
||||
// TODO: it is not implemented in gb, and this way maybe impossible
|
||||
//$this->Base->gb->uploadFile2Hub($gunid);
|
||||
//$this->Base->gb->uploadFileAsync($gunid);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|||
$bs = new BasicStor();
|
||||
|
||||
$stid = $bs->storId;
|
||||
#var_dump($stid); exit;
|
||||
#$farr = $bs->bsListFolder($stid); var_dump($farr); exit;
|
||||
|
||||
function admDumpFolder(&$bs, $fid, $ind='')
|
||||
{
|
||||
|
@ -47,7 +45,7 @@ function admDumpFolder(&$bs, $fid, $ind='')
|
|||
$pars['name'] = "$name";
|
||||
switch ($type) {
|
||||
case "Folder":
|
||||
$farr = $bs->bsListFolder($fid);
|
||||
$farr = BasicStor::bsListFolder($fid);
|
||||
if (PEAR::isError($farr)) {
|
||||
echo $farr->getMessage();
|
||||
exit;
|
||||
|
|
|
@ -226,7 +226,7 @@ function camp_import_audio_file($p_filepath, $p_importMode = null, $p_testOnly =
|
|||
"mime" => $metadata['dc:format']
|
||||
);
|
||||
// $timeBegin = microtime(true);
|
||||
$storedFile = $greenbox->bsPutFile($parentId, $values, $doCopyFiles);
|
||||
$storedFile = BasicStor::bsPutFile($parentId, $values, $doCopyFiles);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
import_err($storedFile, "Error in bsPutFile()");
|
||||
echo var_export($metadata)."\n";
|
||||
|
@ -239,7 +239,7 @@ function camp_import_audio_file($p_filepath, $p_importMode = null, $p_testOnly =
|
|||
// Note: the bsSetMetadataBatch() takes up .25 of a second
|
||||
// on my 3Ghz computer. We should try to speed this up.
|
||||
// $timeBegin = microtime(true);
|
||||
$r = $greenbox->bsSetMetadataBatch($id, $metadata);
|
||||
$r = BasicStor::bsSetMetadataBatch($id, $metadata);
|
||||
if (PEAR::isError($r)) {
|
||||
import_err($r, "Error in bsSetMetadataBatch()");
|
||||
echo var_export($metadata)."\n";
|
||||
|
|
|
@ -91,7 +91,7 @@ function ls_restore_restoreObject($obj, $parid, $reallyInsert=TRUE){
|
|||
"gunid" => $obj['gunid'],
|
||||
"filetype" => strtolower($obj['type'])
|
||||
);
|
||||
$r = $bs->bsPutFile($parid, $values);
|
||||
$r = BasicStor::bsPutFile($parid, $values);
|
||||
ls_restore_checkErr($r, __LINE__);
|
||||
}
|
||||
break;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -75,7 +75,7 @@ class BasicStor {
|
|||
* @return int|PEAR_Error
|
||||
* ID of the StoredFile that was created.
|
||||
*/
|
||||
public function bsPutFile($p_parentId, $p_values, $p_copyMedia=TRUE)
|
||||
public static function bsPutFile($p_parentId, $p_values, $p_copyMedia=TRUE)
|
||||
{
|
||||
if (!isset($p_values['filetype']) || !isset($p_values['filename'])) {
|
||||
return NULL;
|
||||
|
@ -111,7 +111,7 @@ class BasicStor {
|
|||
* @param string $newName
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function bsRenameFile($id, $newName)
|
||||
public static function bsRenameFile($id, $newName)
|
||||
{
|
||||
$parid = M2tree::GetParent($id);
|
||||
switch (BasicStor::GetObjType($id)) {
|
||||
|
@ -145,7 +145,7 @@ class BasicStor {
|
|||
* Destination folder local id
|
||||
* @return boolean/PEAR_Error
|
||||
*/
|
||||
public function bsMoveFile($id, $did)
|
||||
public static function bsMoveFile($id, $did)
|
||||
{
|
||||
$parid = M2tree::GetParent($id);
|
||||
if (BasicStor::GetObjType($did) !== 'Folder') {
|
||||
|
@ -180,7 +180,7 @@ class BasicStor {
|
|||
* Destination folder local id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function bsCopyFile($id, $did)
|
||||
public static function bsCopyFile($id, $did)
|
||||
{
|
||||
$parid = M2tree::GetParent($id);
|
||||
if (BasicStor::GetObjType($did) !== 'Folder') {
|
||||
|
@ -220,7 +220,7 @@ class BasicStor {
|
|||
* @return true|PEAR_Error
|
||||
* @exception PEAR::error
|
||||
*/
|
||||
public function bsReplaceFile($id, $localFilePath, $metadataFilePath, $mdataLoc='file')
|
||||
public static function bsReplaceFile($id, $localFilePath, $metadataFilePath, $mdataLoc='file')
|
||||
{
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
|
@ -284,7 +284,7 @@ class BasicStor {
|
|||
break;
|
||||
default:
|
||||
}
|
||||
$res = $this->bsMoveFile($id, $did);
|
||||
$res = BasicStor::bsMoveFile($id, $did);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ class BasicStor {
|
|||
* array with strings:
|
||||
* downloadable URL, download token, chsum, size, filename
|
||||
*/
|
||||
public function bsOpenDownload($id, $part='media', $parent='0')
|
||||
public static function bsOpenDownload($id, $part='media', $parent='0')
|
||||
{
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
|
@ -549,7 +549,7 @@ class BasicStor {
|
|||
* @return string
|
||||
* gunid
|
||||
*/
|
||||
public function bsCloseDownload($token, $part='media')
|
||||
public static function bsCloseDownload($token, $part='media')
|
||||
{
|
||||
if (!BasicStor::bsCheckToken($token, 'download')) {
|
||||
return PEAR::raiseError(
|
||||
|
@ -580,7 +580,7 @@ class BasicStor {
|
|||
* fname string: writable local filename
|
||||
* token string: PUT token
|
||||
*/
|
||||
public function bsOpenPut($chsum, $gunid, $owner=NULL)
|
||||
public static function bsOpenPut($chsum, $gunid, $owner=NULL)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (!is_null($gunid)) {
|
||||
|
@ -622,7 +622,7 @@ class BasicStor {
|
|||
* fname string, local path of the file having been put
|
||||
* owner int, local subject id - owner of token
|
||||
*/
|
||||
public function bsClosePut($token)
|
||||
public static function bsClosePut($token)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$token = StoredFile::NormalizeGunid($token);
|
||||
|
@ -689,7 +689,7 @@ class BasicStor {
|
|||
* realsum: string - checksum of uploaded file
|
||||
* )
|
||||
*/
|
||||
public function bsCheckPut($token)
|
||||
public static function bsCheckPut($token)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (!BasicStor::bsCheckToken($token, 'put')) {
|
||||
|
@ -787,14 +787,14 @@ class BasicStor {
|
|||
* 'file'|'string'
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function bsReplaceMetadata($id, $mdata, $mdataLoc='file')
|
||||
{
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
return $storedFile->setMetadata($mdata, $mdataLoc);
|
||||
}
|
||||
// public static function bsReplaceMetadata($id, $mdata, $mdataLoc='file')
|
||||
// {
|
||||
// $storedFile = StoredFile::Recall($id);
|
||||
// if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
// return $storedFile;
|
||||
// }
|
||||
// return $storedFile->setMetadata($mdata, $mdataLoc);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -804,7 +804,7 @@ class BasicStor {
|
|||
* Virtual file's local id
|
||||
* @return string|PEAR_Error
|
||||
*/
|
||||
public function bsGetMetadata($id)
|
||||
public static function bsGetMetadata($id)
|
||||
{
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
|
@ -828,7 +828,7 @@ class BasicStor {
|
|||
* xml:lang for default language
|
||||
* @return string|PEAR_Error
|
||||
*/
|
||||
public function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL)
|
||||
public static function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL)
|
||||
{
|
||||
if (is_null($gunid)) {
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
|
@ -886,7 +886,7 @@ class BasicStor {
|
|||
* if an array is passed, an array is returned.
|
||||
* @see Metadata::getMetadataValue
|
||||
*/
|
||||
public function bsGetMetadataValue($id, $category = null)
|
||||
public static function bsGetMetadataValue($id, $category = null)
|
||||
{
|
||||
if (!is_numeric($id)) {
|
||||
return null;
|
||||
|
@ -928,7 +928,7 @@ class BasicStor {
|
|||
* flag, if true, regenerate XML file
|
||||
* @return boolean
|
||||
*/
|
||||
public function bsSetMetadataValue($id, $category, $value,
|
||||
public static function bsSetMetadataValue($id, $category, $value,
|
||||
$lang=NULL, $mid=NULL, $container='metadata', $regen=TRUE)
|
||||
{
|
||||
if (!is_string($category) || is_array($value)) {
|
||||
|
@ -994,7 +994,7 @@ class BasicStor {
|
|||
* flag, if true, regenerate XML file
|
||||
* @return boolean
|
||||
*/
|
||||
public function bsSetMetadataBatch(
|
||||
public static function bsSetMetadataBatch(
|
||||
$id, $values, $lang=NULL, $container='metadata', $regen=TRUE)
|
||||
{
|
||||
if (!is_array($values)) {
|
||||
|
@ -1005,7 +1005,7 @@ class BasicStor {
|
|||
return $storedFile;
|
||||
}
|
||||
foreach ($values as $category => $oneValue) {
|
||||
$res = $this->bsSetMetadataValue($storedFile, $category,
|
||||
$res = BasicStor::bsSetMetadataValue($storedFile, $category,
|
||||
$oneValue, $lang, NULL, $container, FALSE);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
|
@ -1075,10 +1075,10 @@ class BasicStor {
|
|||
* length: string - dcterms:extent in extent format
|
||||
* @see DataEngine
|
||||
*/
|
||||
public function bsLocalSearch($criteria, $limit=0, $offset=0)
|
||||
public static function bsLocalSearch($criteria, $limit=0, $offset=0)
|
||||
{
|
||||
require_once("DataEngine.php");
|
||||
$de = new DataEngine($this);
|
||||
$de = new DataEngine();
|
||||
$res = $de->localSearch($criteria, $limit, $offset);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
|
@ -1104,10 +1104,10 @@ class BasicStor {
|
|||
* cnt : integer - number of matching values
|
||||
* @see DataEngine
|
||||
*/
|
||||
public function bsBrowseCategory($category, $limit=0, $offset=0, $criteria=NULL)
|
||||
public static function bsBrowseCategory($category, $limit=0, $offset=0, $criteria=NULL)
|
||||
{
|
||||
require_once("DataEngine.php");
|
||||
$de = new DataEngine($this);
|
||||
$de = new DataEngine();
|
||||
return $de->browseCategory($category, $limit, $offset, $criteria);
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1129,7 @@ class BasicStor {
|
|||
* fname string: readable fname,
|
||||
* token string: access token
|
||||
*/
|
||||
public function bsExportPlaylistOpen($plids, $type='lspl', $withContent=TRUE)
|
||||
public static function bsExportPlaylistOpen($plids, $type='lspl', $withContent=TRUE)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
require_once("Playlist.php");
|
||||
|
@ -1237,7 +1237,7 @@ class BasicStor {
|
|||
* Access token obtained from bsExportPlaylistOpen method call.
|
||||
* @return true/PEAR_Error
|
||||
*/
|
||||
public function bsExportPlaylistClose($token)
|
||||
public static function bsExportPlaylistClose($token)
|
||||
{
|
||||
$r = BasicStor::bsRelease($token, 'access');
|
||||
if (PEAR::isError($r)) {
|
||||
|
@ -1297,7 +1297,7 @@ class BasicStor {
|
|||
"gunid" => $plid,
|
||||
"filetype" => "playlist"
|
||||
);
|
||||
$storedFile = $this->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
$res = $storedFile->getId();
|
||||
break;
|
||||
case "smil":
|
||||
|
@ -1331,7 +1331,7 @@ class BasicStor {
|
|||
|
||||
|
||||
/**
|
||||
* Import playlist in LS Archive format
|
||||
* Import playlist in CC Archive format
|
||||
*
|
||||
* @param int $parid
|
||||
* Destination folder local id
|
||||
|
@ -1384,7 +1384,7 @@ class BasicStor {
|
|||
if (!file_exists($metadata)) {
|
||||
$metadata = NULL;
|
||||
}
|
||||
$exists = $this->bsExistsFile($gunid, NULL, TRUE);
|
||||
$exists = BasicStor::bsExistsFile($gunid, NULL, TRUE);
|
||||
if( $exists ) {
|
||||
$res = BasicStor::IdFromGunid($gunid);
|
||||
if (!PEAR::isError($res)) {
|
||||
|
@ -1399,7 +1399,7 @@ class BasicStor {
|
|||
"gunid" => $gunid,
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = $this->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
$res = $storedFile->getId();
|
||||
}
|
||||
@unlink("$tmpdc/{$it['rawMedia']}");
|
||||
|
@ -1444,7 +1444,7 @@ class BasicStor {
|
|||
* @return array
|
||||
* @todo THERE IS A BUG IN THIS FUNCTION
|
||||
*/
|
||||
public function bsListFolder($id)
|
||||
public static function bsListFolder($id)
|
||||
{
|
||||
if (BasicStor::GetObjType($id) !== 'Folder') {
|
||||
return PEAR::raiseError(
|
||||
|
@ -1489,7 +1489,7 @@ class BasicStor {
|
|||
* Virtual file's local id
|
||||
* @return array
|
||||
*/
|
||||
public function bsAnalyzeFile($id)
|
||||
public static function bsAnalyzeFile($id)
|
||||
{
|
||||
$storedFile = StoredFile::Recall($id);
|
||||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
|
@ -1569,7 +1569,7 @@ class BasicStor {
|
|||
* select file by gunid (id is then ignored)
|
||||
* @return boolean
|
||||
*/
|
||||
public function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
|
||||
public static function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
|
||||
{
|
||||
if ($byGunid) {
|
||||
$storedFile = StoredFile::RecallByGunid($id);
|
||||
|
@ -1664,22 +1664,6 @@ class BasicStor {
|
|||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
//$pfid = BasicStor::bsCreateFolder($fid, 'public');
|
||||
//if (PEAR::isError($pfid)) {
|
||||
// return $pfid;
|
||||
//}
|
||||
//$res = Alib::AddPerm($uid, '_all', $pfid, 'A');
|
||||
//if (PEAR::isError($res)) {
|
||||
// return $res;
|
||||
//}
|
||||
//$allGrId = Subjects::GetSubjId($CC_CONFIG['AllGr']);
|
||||
//if (PEAR::isError($allGrId)) {
|
||||
// return $allGrId;
|
||||
//}
|
||||
//$res = Alib::AddPerm($allGrId, 'read', $pfid, 'A');
|
||||
//if (PEAR::isError($res)) {
|
||||
// return $res;
|
||||
//}
|
||||
}
|
||||
}
|
||||
return $uid;
|
||||
|
@ -1735,11 +1719,11 @@ class BasicStor {
|
|||
* @param string $pass
|
||||
* @return boolean|sessionId|PEAR_Error
|
||||
*/
|
||||
function login($login, $pass)
|
||||
{
|
||||
$r = Alib::Login($login, $pass);
|
||||
return $r;
|
||||
}
|
||||
// public static function login($login, $pass)
|
||||
// {
|
||||
// $r = Alib::Login($login, $pass);
|
||||
// return $r;
|
||||
// }
|
||||
|
||||
|
||||
/* ================================================== "protected" methods */
|
||||
|
@ -1909,26 +1893,6 @@ class BasicStor {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns TRUE if gunid is free
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
// function _gunidIsFree($gunid)
|
||||
// {
|
||||
// $cnt = $CC_DBC->getOne("
|
||||
// SELECT count(*) FROM {$this->filesTable}
|
||||
// WHERE gunid=x'{$this->gunid}'::bigint
|
||||
// ");
|
||||
// if (PEAR::isError($cnt)) {
|
||||
// return $cnt;
|
||||
// }
|
||||
// if ($cnt > 0) {
|
||||
// return FALSE;
|
||||
// }
|
||||
// return TRUE;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Set playlist edit flag
|
||||
*
|
||||
|
@ -1943,7 +1907,7 @@ class BasicStor {
|
|||
* @return boolean
|
||||
* previous state
|
||||
*/
|
||||
public function setEditFlag($p_playlistId, $p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL)
|
||||
public static function setEditFlag($p_playlistId, $p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL)
|
||||
{
|
||||
if (!is_null($p_sessid)) {
|
||||
$p_subjid = Alib::GetSessUserId($p_sessid);
|
||||
|
@ -1976,7 +1940,7 @@ class BasicStor {
|
|||
* @return FALSE|int
|
||||
* ID of user editing it
|
||||
*/
|
||||
public function isEdited($p_playlistId)
|
||||
public static function isEdited($p_playlistId)
|
||||
{
|
||||
$storedFile = StoredFile::RecallByGunid($p_playlistId);
|
||||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
|
@ -2232,7 +2196,7 @@ class BasicStor {
|
|||
"gunid" => $gunid,
|
||||
"filetype" => $type
|
||||
);
|
||||
$r = $this->bsPutFile($rootHD, $values);
|
||||
$r = BasicStor::bsPutFile($rootHD, $values);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -2240,26 +2204,13 @@ class BasicStor {
|
|||
//$res['results'][] = array('gunid' => $gunid, 'type' => $type);
|
||||
//$res['cnt']++;
|
||||
}
|
||||
return $this->bsLocalSearch(
|
||||
return BasicStor::bsLocalSearch(
|
||||
array('filetype'=>'all', 'conditions'=>array())
|
||||
);
|
||||
//return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* dump
|
||||
*
|
||||
*/
|
||||
// public function dump($id='', $indch=' ', $ind='', $format='{name}')
|
||||
// {
|
||||
// if ($id=='') {
|
||||
// $id = $this->storId;
|
||||
// }
|
||||
// return parent::dump($id, $indch, $ind, $format);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
@ -2275,17 +2226,6 @@ class BasicStor {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function debug($va)
|
||||
{
|
||||
echo"<pre>\n";
|
||||
print_r($va);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deleteFiles
|
||||
*
|
||||
|
|
|
@ -54,15 +54,18 @@ require_once("XML/Util.php");
|
|||
* @see StoredFile
|
||||
*/
|
||||
class DataEngine {
|
||||
/**
|
||||
* Array of allowed "file types".
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $filetypes;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param BasicStor $gb
|
||||
*/
|
||||
public function __construct(&$gb)
|
||||
public function __construct()
|
||||
{
|
||||
$this->gb =& $gb;
|
||||
$this->filetypes = array(
|
||||
'all'=>NULL,
|
||||
'audioclip'=>'audioclip',
|
||||
|
|
|
@ -34,7 +34,7 @@ class GreenBox extends BasicStor {
|
|||
* ID of new folder
|
||||
* @exception PEAR::error
|
||||
*/
|
||||
public function createFolder($parid, $folderName, $sessid='')
|
||||
public static function createFolder($parid, $folderName, $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
|
@ -62,12 +62,12 @@ class GreenBox extends BasicStor {
|
|||
* @return int
|
||||
* ID of the StoredFile that was created.
|
||||
*/
|
||||
public function putFile($p_parentId, $p_values, $p_sessionId='')
|
||||
public static function putFile($p_parentId, $p_values, $p_sessionId='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $p_parentId, $p_sessionId)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$storedFile = $this->bsPutFile($p_parentId, $p_values);
|
||||
$storedFile = BasicStor::bsPutFile($p_parentId, $p_values);
|
||||
return $storedFile;
|
||||
} // fn putFile
|
||||
|
||||
|
@ -90,7 +90,7 @@ class GreenBox extends BasicStor {
|
|||
* @return int
|
||||
* @exception PEAR::error
|
||||
*/
|
||||
public function storeWebstream($parid, $fileName, $mdataFileLP, $sessid='',
|
||||
public static function storeWebstream($parid, $fileName, $mdataFileLP, $sessid='',
|
||||
$gunid=NULL, $url)
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
|
||||
|
@ -105,12 +105,12 @@ class GreenBox extends BasicStor {
|
|||
"gunid" => $gunid,
|
||||
"filetype" => "webstream"
|
||||
);
|
||||
$storedFile = $this->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$oid = $storedFile->getId();
|
||||
$r = $this->bsSetMetadataValue(
|
||||
$r = BasicStor::bsSetMetadataValue(
|
||||
$oid, 'ls:url', $url, NULL, NULL, 'metadata');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
@ -119,49 +119,6 @@ class GreenBox extends BasicStor {
|
|||
} // fn storeWebstream
|
||||
|
||||
|
||||
/**
|
||||
* Access stored file - increase access counter
|
||||
*
|
||||
* @param int $id
|
||||
* virt.file's local id
|
||||
* @param string $sessid
|
||||
* session id
|
||||
* @return string access token
|
||||
*/
|
||||
// function accessFile($id, $sessid='')
|
||||
// {
|
||||
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
// return $res;
|
||||
// }
|
||||
// $gunid = BasicStor::GunidFromId($id);
|
||||
// $r = BasicStor::bsAccess(NULL, '', $gunid, 'access');
|
||||
// if (PEAR::isError($r)) {
|
||||
// return $r;
|
||||
// }
|
||||
// $token = $r['token'];
|
||||
// return $token;
|
||||
// } // fn accessFile
|
||||
|
||||
|
||||
/**
|
||||
* Release stored file - decrease access counter
|
||||
*
|
||||
* @param string $token
|
||||
* access token
|
||||
* @param string $sessid
|
||||
* session id
|
||||
* @return boolean
|
||||
*/
|
||||
// function releaseFile($token, $sessid='')
|
||||
// {
|
||||
// $r = BasicStor::bsRelease($token, 'access');
|
||||
// if (PEAR::isError($r)) {
|
||||
// return $r;
|
||||
// }
|
||||
// return FALSE;
|
||||
// } // fn releaseFile
|
||||
|
||||
|
||||
/**
|
||||
* Analyze media file for internal metadata information
|
||||
*
|
||||
|
@ -171,12 +128,12 @@ class GreenBox extends BasicStor {
|
|||
* Session id
|
||||
* @return array
|
||||
*/
|
||||
public function analyzeFile($id, $sessid='')
|
||||
public static function analyzeFile($id, $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsAnalyzeFile($id);
|
||||
return BasicStor::bsAnalyzeFile($id);
|
||||
} // fn analyzeFile
|
||||
|
||||
|
||||
|
@ -190,13 +147,13 @@ class GreenBox extends BasicStor {
|
|||
* Session id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function renameFile($id, $newName, $sessid='')
|
||||
public static function renameFile($id, $newName, $sessid='')
|
||||
{
|
||||
$parid = M2tree::GetParent($id);
|
||||
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsRenameFile($id, $newName);
|
||||
return BasicStor::bsRenameFile($id, $newName);
|
||||
} // fn renameFile
|
||||
|
||||
|
||||
|
@ -211,13 +168,13 @@ class GreenBox extends BasicStor {
|
|||
* session id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function moveFile($id, $did, $sessid='')
|
||||
public static function moveFile($id, $did, $sessid='')
|
||||
{
|
||||
$res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid);
|
||||
if ($res !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsMoveFile($id, $did);
|
||||
return BasicStor::bsMoveFile($id, $did);
|
||||
} // fn moveFile
|
||||
|
||||
|
||||
|
@ -232,13 +189,13 @@ class GreenBox extends BasicStor {
|
|||
* session id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function copyFile($id, $did, $sessid='')
|
||||
public static function copyFile($id, $did, $sessid='')
|
||||
{
|
||||
$res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid);
|
||||
if($res !== TRUE) {
|
||||
if ($res !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsCopyFile($id, $did);
|
||||
return BasicStor::bsCopyFile($id, $did);
|
||||
} // fn copyFile
|
||||
|
||||
|
||||
|
@ -255,12 +212,12 @@ class GreenBox extends BasicStor {
|
|||
* session id
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
|
||||
public static function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
|
||||
return BasicStor::bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
|
||||
} // fn replaceFile
|
||||
|
||||
|
||||
|
@ -286,28 +243,6 @@ class GreenBox extends BasicStor {
|
|||
|
||||
/* ------------------------------------------------------------- metadata */
|
||||
|
||||
/**
|
||||
* Replace metadata with new XML file or string
|
||||
*
|
||||
* @param int $id
|
||||
* Virtual file's local id
|
||||
* @param string $mdata
|
||||
* XML string or local path of metadata XML file
|
||||
* @param string $mdataLoc
|
||||
* metadata location: 'file'|'string'
|
||||
* @param string $sessid
|
||||
* 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
|
||||
|
||||
|
||||
/**
|
||||
* Get metadata XML tree as string
|
||||
*
|
||||
|
@ -318,12 +253,12 @@ class GreenBox extends BasicStor {
|
|||
* @return string|PEAR_Error
|
||||
* @todo rename this function to "getMetadata"
|
||||
*/
|
||||
public function getMetadata($id, $sessid='')
|
||||
public static function getMetadata($id, $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsGetMetadata($id);
|
||||
return BasicStor::bsGetMetadata($id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -340,7 +275,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadataArray($id, $sessid)
|
||||
public static function getMetadataArray($id, $sessid)
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
|
@ -397,7 +332,7 @@ class GreenBox extends BasicStor {
|
|||
* qualified name (e.g. xml:lang)</li>
|
||||
* </ul>
|
||||
*/
|
||||
public function getMetadataValue($id, $category, $sessid='',
|
||||
public static function getMetadataValue($id, $category, $sessid='',
|
||||
$lang=NULL, $deflang=NULL)
|
||||
{
|
||||
if (!is_numeric($id)) {
|
||||
|
@ -406,7 +341,7 @@ class GreenBox extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsGetMetadataValue($id, $category);
|
||||
return BasicStor::bsGetMetadataValue($id, $category);
|
||||
} // fn getMetadataValue
|
||||
|
||||
|
||||
|
@ -427,12 +362,12 @@ class GreenBox extends BasicStor {
|
|||
* (optional on unique elements) Metadata record id
|
||||
* @return boolean
|
||||
*/
|
||||
public function setMetadataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL)
|
||||
public static function setMetadataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL)
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsSetMetadataValue($id, $category, $value, $lang, $mid);
|
||||
return BasicStor::bsSetMetadataValue($id, $category, $value, $lang, $mid);
|
||||
} // fn setMetadataValue
|
||||
|
||||
|
||||
|
@ -489,11 +424,11 @@ class GreenBox extends BasicStor {
|
|||
* </ul>
|
||||
* @see BasicStor::bsLocalSearch
|
||||
*/
|
||||
public function localSearch($criteria, $sessid='')
|
||||
public static 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);
|
||||
return BasicStor::bsLocalSearch($criteria, $limit, $offset);
|
||||
} // fn localSearch
|
||||
|
||||
|
||||
|
@ -511,7 +446,7 @@ class GreenBox extends BasicStor {
|
|||
* cnt : integer - number of matching values
|
||||
* @see BasicStor::bsBrowseCategory
|
||||
*/
|
||||
public function browseCategory($category, $criteria = null, $sessid = '')
|
||||
public static function browseCategory($category, $criteria = null, $sessid = '')
|
||||
{
|
||||
$limit = 0;
|
||||
$offset = 0;
|
||||
|
@ -519,7 +454,7 @@ class GreenBox extends BasicStor {
|
|||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
}
|
||||
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
$res = BasicStor::bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
return $res;
|
||||
} // fn browseCategory
|
||||
|
||||
|
@ -558,7 +493,7 @@ class GreenBox extends BasicStor {
|
|||
}
|
||||
// optionally move it to the destination folder:
|
||||
if($parid != $hdid && !is_null($parid)){
|
||||
$r = $this->bsMoveFile($id, $parid);
|
||||
$r = BasicStor::bsMoveFile($id, $parid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -567,22 +502,6 @@ class GreenBox extends BasicStor {
|
|||
} // fn createPlaylist
|
||||
|
||||
|
||||
/**
|
||||
* Return playlist as XML string
|
||||
*
|
||||
* @param int $id
|
||||
* local object id
|
||||
* @param string $sessid
|
||||
* session ID
|
||||
* @return string
|
||||
* XML
|
||||
*/
|
||||
// function getPlaylistXml($id, $sessid)
|
||||
// {
|
||||
// return $this->getMetadata($id, $sessid);
|
||||
// } // fn getPlaylistXml
|
||||
|
||||
|
||||
/**
|
||||
* Return playlist as hierarchical PHP hash-array
|
||||
*
|
||||
|
@ -592,7 +511,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return array
|
||||
*/
|
||||
public function getPlaylistArray($id, $sessid)
|
||||
public static function getPlaylistArray($id, $sessid)
|
||||
{
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
$pl = StoredFile::Recall($id);
|
||||
|
@ -614,7 +533,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* playlist access token
|
||||
*/
|
||||
public function lockPlaylistForEdit($id, $sessid)
|
||||
public static function lockPlaylistForEdit($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -638,7 +557,7 @@ class GreenBox extends BasicStor {
|
|||
*/
|
||||
public function releaseLockedPlaylist($token, $sessid)
|
||||
{
|
||||
$gunid = $this->bsCloseDownload($token, 'metadata');
|
||||
$gunid = BasicStor::bsCloseDownload($token, 'metadata');
|
||||
if (PEAR::isError($gunid)) {
|
||||
return $gunid;
|
||||
}
|
||||
|
@ -675,7 +594,7 @@ class GreenBox extends BasicStor {
|
|||
* pause between half-faded points in time format hh:mm:ss.ssssss
|
||||
* @return string, generated playlistElement gunid
|
||||
*/
|
||||
public function addAudioClipToPlaylist($token, $acId, $sessid,
|
||||
public static function addAudioClipToPlaylist($token, $acId, $sessid,
|
||||
$fadeIn=NULL, $fadeOut=NULL, $length=NULL, $pause=NULL)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
|
@ -690,13 +609,11 @@ class GreenBox extends BasicStor {
|
|||
" ($type)"
|
||||
);
|
||||
}
|
||||
// $res = $pl->addAudioClip($acId, $fadeIn, $fadeOut, NULL, $pause);
|
||||
$res = $pl->addAudioClip($acId, $fadeIn, $fadeOut, NULL, $length);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
// recalculate offsets and total length:
|
||||
// $r = $pl->recalculateTimes($pause);
|
||||
$r = $pl->recalculateTimes();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
@ -717,7 +634,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* @todo rename this function to "deleteAudioClipFromPlaylist"
|
||||
*/
|
||||
public function delAudioClipFromPlaylist($token, $plElGunid, $sessid)
|
||||
public static function delAudioClipFromPlaylist($token, $plElGunid, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = StoredFile::RecallByToken($token);
|
||||
|
@ -752,7 +669,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public function changeFadeInfo($token, $plElGunid, $fadeIn, $fadeOut, $sessid)
|
||||
public static function changeFadeInfo($token, $plElGunid, $fadeIn, $fadeOut, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = StoredFile::RecallByToken($token);
|
||||
|
@ -788,7 +705,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public function moveAudioClipInPlaylist($token, $plElGunid, $newPos, $sessid)
|
||||
public static function moveAudioClipInPlaylist($token, $plElGunid, $newPos, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = StoredFile::RecallByToken($token);
|
||||
|
@ -818,7 +735,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* gunid of playlist
|
||||
*/
|
||||
public function revertEditedPlaylist($token, $sessid='')
|
||||
public static function revertEditedPlaylist($token, $sessid='')
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$lc = new LocStor($CC_DBC, $CC_CONFIG);
|
||||
|
@ -835,7 +752,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public function deletePlaylist($id, $sessid)
|
||||
public static function deletePlaylist($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -867,7 +784,7 @@ class GreenBox extends BasicStor {
|
|||
* <li>duration string, total playlength of clip </li>
|
||||
* </ul>
|
||||
*/
|
||||
public function displayPlaylistClipAtOffset($sessid, $plid, $offset, $distance=0,
|
||||
public static function displayPlaylistClipAtOffset($sessid, $plid, $offset, $distance=0,
|
||||
$lang=NULL, $deflang=NULL)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
|
@ -885,7 +802,7 @@ class GreenBox extends BasicStor {
|
|||
return $id;
|
||||
}
|
||||
if (!is_null($id)) {
|
||||
$res['title'] = $this->bsGetMetadataValue($id, "dc:title");
|
||||
$res['title'] = BasicStor::bsGetMetadataValue($id, "dc:title");
|
||||
}
|
||||
return $res;
|
||||
} // fn displayPlaylistClipAtOffset
|
||||
|
@ -909,9 +826,9 @@ class GreenBox extends BasicStor {
|
|||
* fname string: readable fname,
|
||||
* token string: access token
|
||||
*/
|
||||
public function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
public static function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
{
|
||||
return $this->bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
return BasicStor::bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
} // fn exportPlaylistOpen
|
||||
|
||||
|
||||
|
@ -923,14 +840,14 @@ class GreenBox extends BasicStor {
|
|||
* method call
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function exportPlaylistClose($token)
|
||||
public static function exportPlaylistClose($token)
|
||||
{
|
||||
return $this->bsExportPlaylistClose($token);
|
||||
return BasicStor::bsExportPlaylistClose($token);
|
||||
} // fn exportPlaylistClose
|
||||
|
||||
|
||||
/**
|
||||
* Open writable handle for import playlist in LS Archive format
|
||||
* Open writable handle for import playlist in CC Archive format
|
||||
*
|
||||
* @param string $sessid
|
||||
* session id
|
||||
|
@ -940,13 +857,13 @@ class GreenBox extends BasicStor {
|
|||
* fname string: writable local filename
|
||||
* token string: put token
|
||||
*/
|
||||
public function importPlaylistOpen($sessid, $chsum='')
|
||||
public static function importPlaylistOpen($sessid, $chsum='')
|
||||
{
|
||||
$userid = GreenBox::GetSessUserId($sessid);
|
||||
if (PEAR::isError($userid)) {
|
||||
return $userid;
|
||||
}
|
||||
$r = $this->bsOpenPut($chsum, NULL, $userid);
|
||||
$r = BasicStor::bsOpenPut($chsum, NULL, $userid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -964,7 +881,7 @@ class GreenBox extends BasicStor {
|
|||
*/
|
||||
public function importPlaylistClose($token)
|
||||
{
|
||||
$arr = $this->bsClosePut($token);
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
|
@ -994,7 +911,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public function existsPlaylist($id, $sessid)
|
||||
public static function existsPlaylist($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -1015,7 +932,7 @@ class GreenBox extends BasicStor {
|
|||
* @return TRUE|int
|
||||
* id of user editing it
|
||||
*/
|
||||
public function playlistIsAvailable($id, $sessid)
|
||||
public static function playlistIsAvailable($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -1024,37 +941,6 @@ class GreenBox extends BasicStor {
|
|||
} // fn playlistIsAvailable
|
||||
|
||||
|
||||
/* ---------------------------------------------- time conversion methods */
|
||||
/**
|
||||
* Convert playlist time value to float seconds
|
||||
*
|
||||
* @param string $plt
|
||||
* playlist time value (HH:mm:ss.dddddd)
|
||||
* @return int
|
||||
* seconds
|
||||
*/
|
||||
// public function playlistTimeToSeconds($plt)
|
||||
// {
|
||||
// require_once("Playlist.php");
|
||||
// return Playlist::playlistTimeToSeconds($plt);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Convert float seconds value to playlist time format
|
||||
*
|
||||
* @param int $s0
|
||||
* seconds
|
||||
* @return string
|
||||
* time in playlist time format (HH:mm:ss.dddddd)
|
||||
*/
|
||||
// public static function secondsToPlaylistTime($s0)
|
||||
// {
|
||||
// require_once("Playlist.php");
|
||||
// return Playlist::secondsToPlaylistTime($s0);
|
||||
// } // fn secondsToPlaylistTime
|
||||
|
||||
|
||||
/* ------------------------------------------------------- render methods */
|
||||
/**
|
||||
* Render playlist to ogg file (open handle)
|
||||
|
@ -1066,7 +952,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string $token
|
||||
* render token
|
||||
*/
|
||||
public function renderPlaylistToFileOpen($sessid, $plid)
|
||||
public static function renderPlaylistToFileOpen($sessid, $plid)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2FileOpen($this, $plid);
|
||||
|
@ -1086,7 +972,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* tmpfile : string - filepath to result temporary file
|
||||
*/
|
||||
public function renderPlaylistToFileCheck($token)
|
||||
public static function renderPlaylistToFileCheck($token)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2FileCheck($this, $token);
|
||||
|
@ -1107,7 +993,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* tmpfile : string - filepath to result temporary file
|
||||
*/
|
||||
public function renderPlaylistToFileList($status='')
|
||||
public static function renderPlaylistToFileList($status='')
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
return Renderer::rnRender2FileList($this, $status);
|
||||
|
@ -1122,7 +1008,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
public function renderPlaylistToFileClose($token)
|
||||
public static function renderPlaylistToFileClose($token)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2FileClose($this, $token);
|
||||
|
@ -1143,7 +1029,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* render token
|
||||
*/
|
||||
public function renderPlaylistToStorageOpen($sessid, $plid)
|
||||
public static function renderPlaylistToStorageOpen($sessid, $plid)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$owner = GreenBox::getSessUserId($sessid);
|
||||
|
@ -1167,7 +1053,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* gunid : string - gunid of result file
|
||||
*/
|
||||
public function renderPlaylistToStorageCheck($token)
|
||||
public static function renderPlaylistToStorageCheck($token)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2StorageCheck($this, $token);
|
||||
|
@ -1188,7 +1074,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* render token
|
||||
*/
|
||||
public function renderPlaylistToRSSOpen($sessid, $plid)
|
||||
public static function renderPlaylistToRSSOpen($sessid, $plid)
|
||||
{
|
||||
$token = '123456789abcdeff';
|
||||
$fakeFile = $CC_CONFIG['accessDir']."/$token.rss";
|
||||
|
@ -1206,7 +1092,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* tmpfile : string - filepath to result temporary file
|
||||
*/
|
||||
public function renderPlaylistToRSSCheck($token)
|
||||
public static function renderPlaylistToRSSCheck($token)
|
||||
{
|
||||
$fakeFile = $CC_CONFIG['accessDir']."/$token.rss";
|
||||
if ($token != '123456789abcdeff' || !file_exists($fakeFile)){
|
||||
|
@ -1221,25 +1107,6 @@ class GreenBox extends BasicStor {
|
|||
} // fn renderPlaylistToRSSCheck
|
||||
|
||||
|
||||
/**
|
||||
* Render playlist to RSS file (list results)
|
||||
*
|
||||
* @param string $status
|
||||
* success | working | fault
|
||||
* @return array of hasharray:
|
||||
* status : string - susccess | working | fault
|
||||
* tmpfile : string - filepath to result temporary file
|
||||
*/
|
||||
// function renderPlaylistToRSSList($status='')
|
||||
// {
|
||||
// $dummytokens = array ('123456789abcdeff');
|
||||
// foreach ($dummytokens as $token) {
|
||||
// $r[] = $this->renderPlaylistToRSSCheck($token);
|
||||
// }
|
||||
// return $r;
|
||||
// } // fn renderPlaylistToRSSList
|
||||
|
||||
|
||||
/**
|
||||
* Render playlist to RSS file (close handle)
|
||||
*
|
||||
|
@ -1248,7 +1115,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
public function renderPlaylistToRSSClose($token)
|
||||
public static function renderPlaylistToRSSClose($token)
|
||||
{
|
||||
if ($token != '123456789abcdeff'){
|
||||
return PEAR::raiseError(
|
||||
|
@ -1273,7 +1140,7 @@ class GreenBox extends BasicStor {
|
|||
* @return array
|
||||
* token : string - backup token
|
||||
*/
|
||||
public function createBackupOpen($sessid, $criteria='')
|
||||
public static function createBackupOpen($sessid, $criteria='')
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1295,7 +1162,7 @@ class GreenBox extends BasicStor {
|
|||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
*/
|
||||
public function createBackupCheck($token)
|
||||
public static function createBackupCheck($token)
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1318,7 +1185,7 @@ class GreenBox extends BasicStor {
|
|||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
*/
|
||||
public function createBackupList($sessid, $stat='')
|
||||
public static function createBackupList($sessid, $stat='')
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1337,7 +1204,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
public function createBackupClose($token)
|
||||
public static function createBackupClose($token)
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1359,7 +1226,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* restore token
|
||||
*/
|
||||
public function backupRestoreOpen($sessid, $filename)
|
||||
public static function backupRestoreOpen($sessid, $filename)
|
||||
{
|
||||
require_once('Restore.php');
|
||||
$rs = new Restore($this);
|
||||
|
@ -1381,7 +1248,7 @@ class GreenBox extends BasicStor {
|
|||
* status: string - working | fault | success
|
||||
* faultString: string - description of fault
|
||||
*/
|
||||
public function backupRestoreCheck($token)
|
||||
public static function backupRestoreCheck($token)
|
||||
{
|
||||
require_once('Restore.php');
|
||||
$rs = new Restore($this);
|
||||
|
@ -1400,7 +1267,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* is success
|
||||
*/
|
||||
public function backupRestoreClose($token) {
|
||||
public static function backupRestoreClose($token) {
|
||||
require_once('Restore.php');
|
||||
$rs = new Restore($this);
|
||||
if (PEAR::isError($rs)) {
|
||||
|
@ -1421,9 +1288,9 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* preference value
|
||||
*/
|
||||
public function loadPref($sessid, $key)
|
||||
public static function loadPref($sessid, $key)
|
||||
{
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->loadPref($sessid, $key);
|
||||
return $res;
|
||||
} // fn loadPref
|
||||
|
@ -1440,9 +1307,9 @@ class GreenBox extends BasicStor {
|
|||
* preference value
|
||||
* @return boolean
|
||||
*/
|
||||
public function savePref($sessid, $key, $value)
|
||||
public static function savePref($sessid, $key, $value)
|
||||
{
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->savePref($sessid, $key, $value);
|
||||
return $res;
|
||||
} // fn savePref
|
||||
|
@ -1457,9 +1324,9 @@ class GreenBox extends BasicStor {
|
|||
* preference key
|
||||
* @return boolean
|
||||
*/
|
||||
public function delPref($sessid, $key)
|
||||
public static function delPref($sessid, $key)
|
||||
{
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->delPref($sessid, $key);
|
||||
return $res;
|
||||
} // fn delPref
|
||||
|
@ -1477,9 +1344,9 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* preference value
|
||||
*/
|
||||
public function loadGroupPref($sessid, $group, $key)
|
||||
public static function loadGroupPref($sessid, $group, $key)
|
||||
{
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->loadGroupPref($sessid, $group, $key);
|
||||
return $res;
|
||||
} // fn loadGroupPref
|
||||
|
@ -1498,9 +1365,9 @@ class GreenBox extends BasicStor {
|
|||
* preference value
|
||||
* @return boolean
|
||||
*/
|
||||
public function saveGroupPref($sessid, $group, $key, $value)
|
||||
public static function saveGroupPref($sessid, $group, $key, $value)
|
||||
{
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->saveGroupPref($sessid, $group, $key, $value);
|
||||
return $res;
|
||||
} // fn saveGroupPref
|
||||
|
@ -1517,9 +1384,9 @@ class GreenBox extends BasicStor {
|
|||
* preference key
|
||||
* @return boolean
|
||||
*/
|
||||
public function delGroupPref($sessid, $group, $key)
|
||||
public static function delGroupPref($sessid, $group, $key)
|
||||
{
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->delGroupPref($sessid, $group, $key);
|
||||
return $res;
|
||||
} // fn delGroupPref
|
||||
|
@ -1560,7 +1427,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* previous state
|
||||
*/
|
||||
public function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
public static function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1578,7 +1445,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* resulting transport state
|
||||
*/
|
||||
public function doTransportAction($trtok, $action)
|
||||
public static function doTransportAction($trtok, $action)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1597,12 +1464,12 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function uploadFile2Hub($filePath)
|
||||
public static function uploadFileAsync($filePath)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
return $tr->uploadFile2Hub($filePath);
|
||||
} // fn uploadFile2Hub
|
||||
return $tr->uploadFileAsync($filePath);
|
||||
} // fn uploadFileAsync
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1612,7 +1479,7 @@ class GreenBox extends BasicStor {
|
|||
* trtok: string transport token
|
||||
* ... ?
|
||||
*/
|
||||
public function getHubInitiatedTransfers()
|
||||
public static function getHubInitiatedTransfers()
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1629,7 +1496,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function startHubInitiatedTransfer($trtok)
|
||||
public static function startHubInitiatedTransfer($trtok)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1651,12 +1518,12 @@ class GreenBox extends BasicStor {
|
|||
* transport token
|
||||
* @todo rename this function "uploadToHub"
|
||||
*/
|
||||
public function upload2Hub($gunid, $withContent=FALSE)
|
||||
public static function uploadToHub($gunid, $withContent=FALSE)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
return $tr->upload2Hub($gunid, $withContent);
|
||||
} // fn upload2Hub
|
||||
return $tr->uploadToHub($gunid, $withContent);
|
||||
} // fn uploadToHub
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1733,7 +1600,7 @@ class GreenBox extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$listArr = $this->bsListFolder($id);
|
||||
$listArr = BasicStor::bsListFolder($id);
|
||||
return $listArr;
|
||||
} // fn listFolder
|
||||
|
||||
|
@ -1766,7 +1633,7 @@ class GreenBox extends BasicStor {
|
|||
public function existsFile($sessid, $gunid, $ftype=NULL)
|
||||
{
|
||||
$id = BasicStor::IdFromGunid($gunid);
|
||||
$ex = $this->bsExistsFile($id, $ftype);
|
||||
$ex = BasicStor::bsExistsFile($id, $ftype);
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require_once("BasicStor.php");
|
||||
require_once("Transport.php");
|
||||
|
||||
/**
|
||||
* LocStor class
|
||||
|
@ -114,11 +115,11 @@ class LocStor extends BasicStor {
|
|||
if ($fname == '') {
|
||||
$fname = "newFile";
|
||||
}
|
||||
$res = $this->bsRenameFile($oid, $fname);
|
||||
$res = BasicStor::bsRenameFile($oid, $fname);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsOpenPut($chsum, $storedFile->gunid);
|
||||
return BasicStor::bsOpenPut($chsum, $storedFile->gunid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -135,7 +136,7 @@ class LocStor extends BasicStor {
|
|||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$arr = $this->bsClosePut($token);
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
$storedFile->delete();
|
||||
return $arr;
|
||||
|
@ -166,7 +167,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function uploadCheck($token)
|
||||
{
|
||||
return $this->bsCheckPut($token);
|
||||
return BasicStor::bsCheckPut($token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,7 +203,7 @@ class LocStor extends BasicStor {
|
|||
return $storedFile;
|
||||
}
|
||||
$oid = $storedFile->getId();
|
||||
$r = $this-> bsSetMetadataValue(
|
||||
$r = BasicStor::bsSetMetadataValue(
|
||||
$oid, 'ls:url', $url, NULL, NULL, 'metadata');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
@ -281,7 +282,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return $this->bsOpenDownload($id);
|
||||
return BasicStor::bsOpenDownload($id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -295,7 +296,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function downloadRawAudioDataClose($token)
|
||||
{
|
||||
return $this->bsCloseDownload($token);
|
||||
return BasicStor::bsCloseDownload($token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,8 +324,8 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = $this->bsOpenDownload($id, 'metadata');
|
||||
#unset($res['filename']);
|
||||
$res = BasicStor::bsOpenDownload($id, 'metadata');
|
||||
//unset($res['filename']);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -339,7 +340,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function downloadMetadataClose($token)
|
||||
{
|
||||
return $this->bsCloseDownload($token, 'metadata');
|
||||
return BasicStor::bsCloseDownload($token, 'metadata');
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,7 +360,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$md = $this->bsGetMetadata($storedFile->getId());
|
||||
$md = BasicStor::bsGetMetadata($storedFile->getId());
|
||||
if (PEAR::isError($md)) {
|
||||
return $md;
|
||||
}
|
||||
|
@ -372,8 +373,9 @@ class LocStor extends BasicStor {
|
|||
/**
|
||||
* Search in metadata database
|
||||
*
|
||||
* @param string $sessid
|
||||
* @param array $criteria
|
||||
* @param string $p_sessid
|
||||
* Session ID
|
||||
* @param array $p_criteria
|
||||
* with following structure:<br>
|
||||
* <ul>
|
||||
* <li>filetype - string, type of searched files,
|
||||
|
@ -405,7 +407,11 @@ class LocStor extends BasicStor {
|
|||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* @return array of hashes, fields:
|
||||
*
|
||||
* @param boolean $p_searchRemote
|
||||
* Set this to true if you want to search the remote storage.
|
||||
*
|
||||
* @return array of hashes, fields:
|
||||
* <ul>
|
||||
* <li>cnt : integer - number of matching gunids
|
||||
* of files have been found</li>
|
||||
|
@ -422,14 +428,37 @@ class LocStor extends BasicStor {
|
|||
* </ul>
|
||||
* @see BasicStor::localSearch
|
||||
*/
|
||||
protected function searchMetadata($sessid, $criteria)
|
||||
protected function searchMetadata($p_sessid, $p_criteria, $p_searchRemote = false)
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $this->storId, $sessid)) !== TRUE) {
|
||||
if (!$p_searchRemote) {
|
||||
// Local search
|
||||
$res = BasicStor::Authorize('read', $this->storId, $p_sessid);
|
||||
if ($res !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$p_criteria['resultMode'] = 'xmlrpc';
|
||||
$res = $this->localSearch($p_criteria, $p_sessid);
|
||||
return $res;
|
||||
} else {
|
||||
// Remote search
|
||||
$p_criteria['resultMode'] = 'php';
|
||||
$transport = new Transport($this);
|
||||
$loginSessionId = $transport->loginToArchive();
|
||||
if (PEAR::isError($loginSessionId)) {
|
||||
switch (intval($loginSessionId->getCode())) {
|
||||
case 802:
|
||||
return PEAR::raiseError("Can't login to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
|
||||
case TRERR_XR_FAIL:
|
||||
return PEAR::raiseError("Can't connect to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
|
||||
}
|
||||
return $loginSessionId;
|
||||
}
|
||||
$results = $transport->xmlrpcCall("locstor.searchMetadata",
|
||||
array("sessid" => $loginSessionId,
|
||||
"criteria" => $p_criteria));
|
||||
$transport->logoutFromArchive($loginSessionId);
|
||||
return $results;
|
||||
}
|
||||
$criteria['resultMode'] = 'xmlrpc';
|
||||
$res = $this->localSearch($criteria, $sessid);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
@ -443,7 +472,7 @@ class LocStor extends BasicStor {
|
|||
{
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
$res = $this->bsLocalSearch($criteria, $limit, $offset);
|
||||
$res = BasicStor::bsLocalSearch($criteria, $limit, $offset);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -467,7 +496,7 @@ class LocStor extends BasicStor {
|
|||
{
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
$res = BasicStor::bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -519,7 +548,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$ex = $this->bsExistsFile($id, $ftype);
|
||||
$ex = BasicStor::bsExistsFile($id, $ftype);
|
||||
return $ex;
|
||||
}
|
||||
|
||||
|
@ -627,7 +656,7 @@ class LocStor extends BasicStor {
|
|||
if ($fname == '') {
|
||||
$fname = "newFile.xml";
|
||||
}
|
||||
$res = $this->bsRenameFile($oid, $fname);
|
||||
$res = BasicStor::bsRenameFile($oid, $fname);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -678,7 +707,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = $this->bsOpenDownload($id, 'metadata');
|
||||
$res = BasicStor::bsOpenDownload($id, 'metadata');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -705,7 +734,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function savePlaylist($sessid, $playlistToken, $newPlaylist)
|
||||
{
|
||||
$playlistId = $this->bsCloseDownload($playlistToken, 'metadata');
|
||||
$playlistId = BasicStor::bsCloseDownload($playlistToken, 'metadata');
|
||||
if (PEAR::isError($playlistId)) {
|
||||
return $playlistId;
|
||||
}
|
||||
|
@ -737,7 +766,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
public function revertEditedPlaylist($playlistToken, $sessid='')
|
||||
{
|
||||
$gunid = $this->bsCloseDownload($playlistToken, 'metadata');
|
||||
$gunid = BasicStor::bsCloseDownload($playlistToken, 'metadata');
|
||||
if (PEAR::isError($gunid)) {
|
||||
return $gunid;
|
||||
}
|
||||
|
@ -843,8 +872,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = $this->bsOpenDownload($id, 'metadata', $parent);
|
||||
#unset($res['filename']);
|
||||
$res = BasicStor::bsOpenDownload($id, 'metadata', $parent);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -864,14 +892,14 @@ class LocStor extends BasicStor {
|
|||
public function releasePlaylist($sessid, $playlistToken, $recursive=FALSE)
|
||||
{
|
||||
if ($recursive) {
|
||||
require_once"AccessRecur.php";
|
||||
require_once("AccessRecur.php");
|
||||
$r = AccessRecur::releasePlaylist($this, $sessid, $playlistToken);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
return $this->bsCloseDownload($playlistToken, 'metadata');
|
||||
return BasicStor::bsCloseDownload($playlistToken, 'metadata');
|
||||
}
|
||||
|
||||
|
||||
|
@ -894,7 +922,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
{
|
||||
$res = $this->bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
$res = BasicStor::bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -918,12 +946,12 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function exportPlaylistClose($token)
|
||||
{
|
||||
return $this->bsExportPlaylistClose($token);
|
||||
return BasicStor::bsExportPlaylistClose($token);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open writable handle for import playlist in LS Archive format
|
||||
* Open writable handle for import playlist in CC Archive format
|
||||
*
|
||||
* @param string $sessid
|
||||
* session id
|
||||
|
@ -939,7 +967,7 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($userid)) {
|
||||
return $userid;
|
||||
}
|
||||
$r = $this->bsOpenPut($chsum, NULL, $userid);
|
||||
$r = BasicStor::bsOpenPut($chsum, NULL, $userid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -957,7 +985,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function importPlaylistClose($token)
|
||||
{
|
||||
$arr = $this->bsClosePut($token);
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
|
@ -1320,7 +1348,7 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($userid)) {
|
||||
return $userid;
|
||||
}
|
||||
$r = $this->bsOpenPut($chsum, NULL, $userid);
|
||||
$r = BasicStor::bsOpenPut($chsum, NULL, $userid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -1339,7 +1367,7 @@ class LocStor extends BasicStor {
|
|||
* restore token
|
||||
*/
|
||||
protected function restoreBackupClosePut($sessid, $token) {
|
||||
$arr = $this->bsClosePut($token);
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
|
@ -1419,13 +1447,13 @@ class LocStor extends BasicStor {
|
|||
* url string: writable URL
|
||||
* token string: PUT token
|
||||
*/
|
||||
function uploadOpen($sessid, $chsum)
|
||||
protected function uploadOpen($sessid, $chsum)
|
||||
{
|
||||
$owner = Alib::GetSessUserId($sessid);
|
||||
if (PEAR::isError($owner)) {
|
||||
return $owner;
|
||||
}
|
||||
$res = $this->bsOpenPut($chsum, NULL, $owner);
|
||||
$res = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -1444,9 +1472,9 @@ class LocStor extends BasicStor {
|
|||
* transport parameters
|
||||
* @return mixed
|
||||
*/
|
||||
function uploadClose($token, $trtype, $pars=array())
|
||||
protected function uploadClose($token, $trtype, $pars=array())
|
||||
{
|
||||
$res = $this->bsClosePut($token);
|
||||
$res = BasicStor::bsClosePut($token);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -1454,7 +1482,7 @@ class LocStor extends BasicStor {
|
|||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
$mdtoken = $pars['mdpdtoken'];
|
||||
$res = $this->bsClosePut($mdtoken);
|
||||
$res = BasicStor::bsClosePut($mdtoken);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -1473,7 +1501,7 @@ class LocStor extends BasicStor {
|
|||
"gunid" => $pars['gunid'],
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = $this->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
|
@ -1495,7 +1523,7 @@ class LocStor extends BasicStor {
|
|||
"gunid" => $pars['gunid'],
|
||||
"filetype" => "playlist"
|
||||
);
|
||||
$storedFile = $this->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
|
@ -1505,7 +1533,7 @@ class LocStor extends BasicStor {
|
|||
case "playlistPkg":
|
||||
$chsum = md5_file($fname);
|
||||
// importPlaylistOpen:
|
||||
$res = $this->bsOpenPut($chsum, NULL, $owner);
|
||||
$res = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -1565,7 +1593,7 @@ class LocStor extends BasicStor {
|
|||
* url string: writable URL
|
||||
* token string: PUT token
|
||||
*/
|
||||
function downloadOpen($sessid, $trtype, $pars=array())
|
||||
protected function downloadOpen($sessid, $trtype, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
switch ($trtype) {
|
||||
|
@ -1575,7 +1603,7 @@ class LocStor extends BasicStor {
|
|||
case "playlist":
|
||||
case "playlistPkg":
|
||||
if (!isset($pars['gunid'])) {
|
||||
return PEAR::raiseError("Archive::downloadOpen: gunid not set");
|
||||
return PEAR::raiseError("LocStor::downloadOpen: gunid not set");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1589,7 +1617,6 @@ class LocStor extends BasicStor {
|
|||
// required with content:
|
||||
$trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ?
|
||||
'playlistPkg' : $trtype2);
|
||||
//return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid");
|
||||
}
|
||||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
|
@ -1602,14 +1629,14 @@ class LocStor extends BasicStor {
|
|||
$res = $this->accessPlaylist($sessid, $gunid);
|
||||
break;
|
||||
case "playlistPkg":
|
||||
$res = $this->bsExportPlaylistOpen($gunid);
|
||||
$res = BasicStor::bsExportPlaylistOpen($gunid);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
|
||||
$plfpath = "$tmpn.lspl";
|
||||
copy($res['fname'], $plfpath);
|
||||
$res = $this->bsExportPlaylistClose($res['token']);
|
||||
$res = BasicStor::bsExportPlaylistClose($res['token']);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -1635,7 +1662,7 @@ class LocStor extends BasicStor {
|
|||
$res = array();
|
||||
break;
|
||||
default:
|
||||
return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)");
|
||||
return PEAR::raiseError("LocStor::downloadOpen: NotImpl ($trtype)");
|
||||
}
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
|
@ -1645,7 +1672,7 @@ class LocStor extends BasicStor {
|
|||
case "metadata":
|
||||
case "playlist":
|
||||
case "playlistPkg":
|
||||
$title = $this->bsGetTitle(NULL, $gunid);
|
||||
$title = BasicStor::bsGetTitle(NULL, $gunid);
|
||||
break;
|
||||
case "searchjob":
|
||||
$title = 'searchjob';
|
||||
|
@ -1673,7 +1700,7 @@ class LocStor extends BasicStor {
|
|||
* url string: writable URL
|
||||
* token string: PUT token
|
||||
*/
|
||||
function downloadClose($token, $trtype)
|
||||
protected function downloadClose($token, $trtype)
|
||||
{
|
||||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
|
@ -1709,7 +1736,7 @@ class LocStor extends BasicStor {
|
|||
case "file":
|
||||
return array();
|
||||
default:
|
||||
return PEAR::raiseError("Archive::downloadClose: NotImpl ($trtype)");
|
||||
return PEAR::raiseError("LocStor::downloadClose: NotImpl ($trtype)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1725,9 +1752,9 @@ class LocStor extends BasicStor {
|
|||
* 'up' | 'down'
|
||||
* @param array $pars
|
||||
* transport parameters
|
||||
* @return mixed
|
||||
* @return TransportRecord|PEAR_Error
|
||||
*/
|
||||
function prepareHubInitiatedTransfer(
|
||||
protected function prepareHubInitiatedTransfer(
|
||||
$target, $trtype='file', $direction='up',$pars=array())
|
||||
{
|
||||
$tr = new Transport($this);
|
||||
|
@ -1749,9 +1776,10 @@ class LocStor extends BasicStor {
|
|||
* 'up' | 'down'
|
||||
* @param string $trtok
|
||||
* transport token
|
||||
* @return mixed
|
||||
* @return array|PEAR_Error
|
||||
* array of transportRecords as hasharrays
|
||||
*/
|
||||
function listHubInitiatedTransfers(
|
||||
protected function listHubInitiatedTransfers(
|
||||
$target=NULL, $direction=NULL, $trtok=NULL)
|
||||
{
|
||||
$tr = new Transport($this);
|
||||
|
@ -1771,7 +1799,7 @@ class LocStor extends BasicStor {
|
|||
* transport state
|
||||
* @return TransportRecord|PEAR_Error
|
||||
*/
|
||||
function setHubInitiatedTransfer($target, $trtok, $state)
|
||||
protected function setHubInitiatedTransfer($target, $trtok, $state)
|
||||
{
|
||||
$tr = new Transport($this);
|
||||
$trec = TransportRecord::recall($tr, $trtok);
|
||||
|
|
|
@ -54,7 +54,7 @@ class Playlist extends StoredFile {
|
|||
return $pl;
|
||||
}
|
||||
$fname = ($fname == '' || is_null($fname) ? "newFile.xml" : $fname );
|
||||
$res = $gb->bsRenameFile($oid, $fname);
|
||||
$res = BasicStor::bsRenameFile($oid, $fname);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -1606,8 +1606,8 @@ class PlaylistAudioClipExport
|
|||
if (PEAR::isError($RADext)) {
|
||||
return $RADext;
|
||||
}
|
||||
$title = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:title');
|
||||
$desc = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:description');
|
||||
$title = BasicStor::bsGetMetadataValue($ac->getId(), 'dc:title');
|
||||
$desc = BasicStor::bsGetMetadataValue($ac->getId(), 'dc:description');
|
||||
return array(
|
||||
'type' => 'audioclip',
|
||||
'gunid' => $gunid,
|
||||
|
|
|
@ -18,17 +18,11 @@ require_once("GreenBox.php");
|
|||
/* ================== Prefs ================== */
|
||||
class Prefs {
|
||||
|
||||
public $gb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param GreenBox $gb
|
||||
* GreenBox object reference
|
||||
*/
|
||||
public function __construct(&$gb)
|
||||
public function __construct()
|
||||
{
|
||||
$this->gb =& $gb;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ class Renderer
|
|||
}
|
||||
$mdata = '';
|
||||
foreach (array('dc:title', 'dcterms:extent', 'dc:creator', 'dc:description') as $item) {
|
||||
$val = $gb->bsGetMetadataValue($id, $item);
|
||||
$val = BasicStor::bsGetMetadataValue($id, $item);
|
||||
$mdata .= " <$item>$val</$item>\n";
|
||||
}
|
||||
$mdata = "<audioClip>\n <metadata>\n$mdata </metadata>\n</audioClip>\n";
|
||||
|
@ -238,7 +238,7 @@ class Renderer
|
|||
"metadata" => $mdata,
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = $gb->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
|
|
|
@ -186,13 +186,6 @@ function camp_get_audio_metadata($p_filename, $p_testonly = false)
|
|||
array('path'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
|
||||
array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
|
||||
),
|
||||
// 'ls:genre' => array(
|
||||
// array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
|
||||
// array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
|
||||
// array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
|
||||
// array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
|
||||
// array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
|
||||
// ),
|
||||
'ls:channels' => array(
|
||||
array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE),
|
||||
),
|
||||
|
|
|
@ -155,7 +155,7 @@ class Transport
|
|||
* errmsg: string - error message for failed transports
|
||||
* ... ?
|
||||
*/
|
||||
function getTransportInfo($trtok)
|
||||
public function getTransportInfo($trtok)
|
||||
{
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
|
@ -170,7 +170,7 @@ class Transport
|
|||
}
|
||||
if ( ($trec->row['direction'] == 'down') && file_exists($trec->row['localfile']) ){
|
||||
$res['realsize'] = filesize($trec->row['localfile']);
|
||||
$res['realsum'] = $this->_chsum($trec->row['localfile']);
|
||||
$res['realsum'] = md5_file($trec->row['localfile']);
|
||||
}
|
||||
if ( ($trec->row['direction'] == 'up') ){
|
||||
$check = $this->uploadCheck($trec->row['pdtoken']);
|
||||
|
@ -199,10 +199,10 @@ class Transport
|
|||
* @return boolea
|
||||
* previous state
|
||||
*/
|
||||
function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
public function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
{
|
||||
require_once('Prefs.php');
|
||||
$pr = new Prefs($this->gb);
|
||||
$pr = new Prefs();
|
||||
$group = 'StationPrefs';
|
||||
$key = 'TransportsDenied';
|
||||
$res = $pr->loadGroupPref($sessid, $group, $key);
|
||||
|
@ -235,7 +235,7 @@ class Transport
|
|||
* @return string
|
||||
* resulting transport state
|
||||
*/
|
||||
function doTransportAction($trtok, $action)
|
||||
public function doTransportAction($trtok, $action)
|
||||
{
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
|
@ -275,8 +275,8 @@ class Transport
|
|||
/* ------------- special methods for audioClip/webstream object transport */
|
||||
|
||||
/**
|
||||
* Start upload of audioClip/webstream/playlist from local storageServer
|
||||
* to hub.
|
||||
* Start upload of audioClip/webstream/playlist from local storage
|
||||
* to remote storage.
|
||||
*
|
||||
* @param string $gunid
|
||||
* global unique id of object being transported
|
||||
|
@ -287,10 +287,10 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function upload2Hub($gunid, $withContent=TRUE, $pars=array())
|
||||
public function uploadToHub($gunid, $withContent=TRUE, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$this->trLog("upload2Hub start: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("uploadToHub start: ".strftime("%H:%M:%S"));
|
||||
switch ($ftype = BasicStor::GetType($gunid)) {
|
||||
case "audioclip":
|
||||
case "webstream":
|
||||
|
@ -341,18 +341,18 @@ class Transport
|
|||
return $fname;
|
||||
}
|
||||
if ($withContent) {
|
||||
$this->trLog("upload2Hub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S"));
|
||||
$res = $this->gb->bsExportPlaylistOpen($plid);
|
||||
$this->trLog("upload2Hub exportPlaylistOpen END: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("uploadToHub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S"));
|
||||
$res = BasicStor::bsExportPlaylistOpen($plid);
|
||||
$this->trLog("uploadToHub exportPlaylistOpen END: ".strftime("%H:%M:%S"));
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
|
||||
$plfpath = "$tmpn.lspl";
|
||||
$this->trLog("upload2Hub begin copy: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("uploadToHub begin copy: ".strftime("%H:%M:%S"));
|
||||
copy($res['fname'], $plfpath);
|
||||
$this->trLog("upload2Hub end copy: ".strftime("%H:%M:%S"));
|
||||
$res = $this->gb->bsExportPlaylistClose($res['token']);
|
||||
$this->trLog("uploadToHub end copy: ".strftime("%H:%M:%S"));
|
||||
$res = BasicStor::bsExportPlaylistClose($res['token']);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -372,10 +372,10 @@ class Transport
|
|||
}
|
||||
break;
|
||||
default:
|
||||
return PEAR::raiseError("Transport::upload2Hub: ftype not supported ($ftype)");
|
||||
return PEAR::raiseError("Transport::uploadToHub: ftype not supported ($ftype)");
|
||||
}
|
||||
$this->startCronJobProcess($trec->trtok);
|
||||
$this->trLog("upload2Hub end: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("uploadToHub end: ".strftime("%H:%M:%S"));
|
||||
return $trec->trtok;
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array())
|
||||
public function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array())
|
||||
{
|
||||
$trtype = ($withContent ? 'playlistPkg' : 'unknown' );
|
||||
$trec = TransportRecord::create($this, $trtype, 'down',
|
||||
|
@ -414,7 +414,7 @@ class Transport
|
|||
* Start search job on network hub
|
||||
*
|
||||
* @param array $criteria
|
||||
* LS criteria format (see localSearch)
|
||||
* CC criteria format (see localSearch)
|
||||
* @param string $resultMode
|
||||
* 'php' | 'xmlrpc'
|
||||
* @param array $pars
|
||||
|
@ -422,7 +422,7 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function globalSearch($criteria, $resultMode='php', $pars=array())
|
||||
public function globalSearch($criteria, $resultMode='php', $pars=array())
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
// testing of hub availability and hub account configuration.
|
||||
|
@ -459,9 +459,9 @@ class Transport
|
|||
* @param boolean $andClose
|
||||
* if TRUE, close transport token
|
||||
* @return array
|
||||
* LS search result format (see localSearch)
|
||||
* CC search result format (see localSearch)
|
||||
*/
|
||||
function getSearchResults($trtok, $andClose=TRUE)
|
||||
public function getSearchResults($trtok, $andClose=TRUE)
|
||||
{
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
|
@ -517,10 +517,10 @@ class Transport
|
|||
}
|
||||
|
||||
|
||||
/* ------------------------ methods for ls-archive-format file transports */
|
||||
/* ------------------------ methods for cc-archive-format file transports */
|
||||
/**
|
||||
* Open async file transfer from local storageServer to network hub,
|
||||
* file should be ls-archive-format file.
|
||||
* file should be cc-archive-format file.
|
||||
*
|
||||
* @param string $filePath
|
||||
* local path to uploaded file
|
||||
|
@ -529,11 +529,11 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function uploadFile2Hub($filePath, $pars=array())
|
||||
public function uploadFileAsync($filePath, $pars=array())
|
||||
{
|
||||
if (!file_exists($filePath)) {
|
||||
return PEAR::raiseError(
|
||||
"Transport::uploadFile2Hub: file not found ($filePath)"
|
||||
"Transport::uploadFileAsync: file not found ($filePath)"
|
||||
);
|
||||
}
|
||||
$trec = $this->_uploadGeneralFileToHub($filePath, 'file', $pars);
|
||||
|
@ -547,7 +547,7 @@ class Transport
|
|||
|
||||
/**
|
||||
* Open async file transfer from network hub to local storageServer,
|
||||
* file should be ls-archive-format file.
|
||||
* file should be cc-archive-format file.
|
||||
*
|
||||
* @param string $url
|
||||
* readable url
|
||||
|
@ -561,7 +561,7 @@ class Transport
|
|||
* trtok: string - transport token
|
||||
* localfile: string - filepath of downloaded file
|
||||
*/
|
||||
function downloadFileFromHub($url, $chsum=NULL, $size=NULL, $pars=array())
|
||||
public function downloadFileFromHub($url, $chsum=NULL, $size=NULL, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'HITrans_');
|
||||
|
@ -588,7 +588,7 @@ class Transport
|
|||
* array of structs/hasharrays with fields:
|
||||
* trtok: string transport token
|
||||
*/
|
||||
function getHubInitiatedTransfers()
|
||||
public function getHubInitiatedTransfers()
|
||||
{
|
||||
$ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers',
|
||||
array('target' => HOSTNAME));
|
||||
|
@ -614,7 +614,7 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function startHubInitiatedTransfer($uid, $rtrtok)
|
||||
public function startHubInitiatedTransfer($uid, $rtrtok)
|
||||
{
|
||||
$ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers',
|
||||
array(
|
||||
|
@ -640,7 +640,7 @@ class Transport
|
|||
case "audioclip":
|
||||
case "playlist":
|
||||
case "playlistPkg":
|
||||
$trtok = $this->upload2Hub($gunid, TRUE,
|
||||
$trtok = $this->uploadToHub($gunid, TRUE,
|
||||
array('rtrtok'=>$rtrtok));
|
||||
if (PEAR::isError($trtok)) {
|
||||
return $trtok;
|
||||
|
@ -713,7 +713,7 @@ class Transport
|
|||
* @return string
|
||||
* sessid or error
|
||||
*/
|
||||
function loginToArchive()
|
||||
public function loginToArchive()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$res = $this->xmlrpcCall('locstor.login',
|
||||
|
@ -736,7 +736,7 @@ class Transport
|
|||
* @return string
|
||||
* Bye or error
|
||||
*/
|
||||
function logoutFromArchive($sessid)
|
||||
public function logoutFromArchive($sessid)
|
||||
{
|
||||
$res = $this->xmlrpcCall('locstor.logout',
|
||||
array('sessid'=>$sessid));
|
||||
|
@ -754,7 +754,7 @@ class Transport
|
|||
* @return boolean
|
||||
* TRUE
|
||||
*/
|
||||
function cronMain($direction=NULL)
|
||||
public function cronMain($direction=NULL)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
if (is_null($direction)) {
|
||||
|
@ -799,7 +799,7 @@ class Transport
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
function startCronJobProcess($trtok)
|
||||
public function startCronJobProcess($trtok)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (TR_LOG_LEVEL > 2) {
|
||||
|
@ -830,7 +830,7 @@ class Transport
|
|||
* @return mixed
|
||||
* inherited from called method
|
||||
*/
|
||||
function cronCallMethod($trtok)
|
||||
public function cronCallMethod($trtok)
|
||||
{
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
|
@ -847,16 +847,16 @@ class Transport
|
|||
'closed'=>'closed');
|
||||
$directions = array('up'=>'upload', 'down'=>'download');
|
||||
// method name construction:
|
||||
$mname = "cron";
|
||||
$methodName = "cron";
|
||||
if (isset($directions[$row['direction']])) {
|
||||
$mname .= ucfirst($directions[$row['direction']]);
|
||||
$methodName .= ucfirst($directions[$row['direction']]);
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
"Transport::cronCallMethod: invalid direction ({$row['direction']})"
|
||||
);
|
||||
}
|
||||
if (isset($states[$state])) {
|
||||
$mname .= ucfirst($states[$state]);
|
||||
$methodName .= ucfirst($states[$state]);
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
"Transport::cronCallMethod: invalid state ({$state})"
|
||||
|
@ -871,7 +871,7 @@ class Transport
|
|||
return TRUE;
|
||||
case 'waiting':
|
||||
require_once('Prefs.php');
|
||||
$pr = new Prefs($this->gb);
|
||||
$pr = new Prefs();
|
||||
$group = 'StationPrefs';
|
||||
$key = 'TransportsDenied';
|
||||
$res = $pr->loadGroupPref(NULL/*sessid*/, $group, $key);
|
||||
|
@ -891,7 +891,7 @@ class Transport
|
|||
}
|
||||
// NO break here!
|
||||
default:
|
||||
if (method_exists($this, $mname)) {
|
||||
if (method_exists($this, $methodName)) {
|
||||
// lock the job:
|
||||
$pid = getmypid();
|
||||
$r = $trec->setLock(TRUE, $pid);
|
||||
|
@ -915,15 +915,15 @@ class Transport
|
|||
$asessid = $r;
|
||||
// method call:
|
||||
if (TR_LOG_LEVEL > 2) {
|
||||
$this->trLog("cronCallMethod($pid): $mname($trtok) >");
|
||||
$this->trLog("cronCallMethod($pid): $methodName($trtok) >");
|
||||
}
|
||||
$ret = call_user_func(array($this, $mname), $row, $asessid);
|
||||
$ret = call_user_func(array($this, $methodName), $row, $asessid);
|
||||
if (PEAR::isError($ret)) {
|
||||
$trec->setLock(FALSE);
|
||||
return $this->_failFatal($ret, $trec);
|
||||
}
|
||||
if (TR_LOG_LEVEL > 2) {
|
||||
$this->trLog("cronCallMethod($pid): $mname($trtok) <");
|
||||
$this->trLog("cronCallMethod($pid): $methodName($trtok) <");
|
||||
}
|
||||
// unlock the job:
|
||||
$r = $trec->setLock(FALSE);
|
||||
|
@ -938,7 +938,7 @@ class Transport
|
|||
return $ret;
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
"Transport::cronCallMethod: unknown method ($mname)"
|
||||
"Transport::cronCallMethod: unknown method ($methodName)"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -955,7 +955,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
function cronUploadInit($row, $asessid)
|
||||
public function cronUploadInit($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
|
@ -989,7 +989,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
function cronDownloadInit($row, $asessid)
|
||||
public function cronDownloadInit($row, $asessid)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$trtok = $row['trtok'];
|
||||
|
@ -1061,7 +1061,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
function cronUploadWaiting($row, $asessid)
|
||||
public function cronUploadWaiting($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
$check = $this->uploadCheck($row['pdtoken']);
|
||||
|
@ -1165,7 +1165,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
function cronDownloadWaiting($row, $asessid)
|
||||
public function cronDownloadWaiting($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
// wget the file
|
||||
|
@ -1212,7 +1212,7 @@ class Transport
|
|||
return $r;
|
||||
}
|
||||
} elseif ($size >= $row['expectedsize']) {
|
||||
$chsum = $this->_chsum($row['localfile']);
|
||||
$chsum = md5_file($row['localfile']);
|
||||
if ($chsum == $row['expectedsum']) {
|
||||
// mark download as finished
|
||||
$r = $trec->setState('finished',
|
||||
|
@ -1240,11 +1240,10 @@ class Transport
|
|||
* @param array $row
|
||||
* row from getTransport results
|
||||
* @param string $asessid
|
||||
* session id (from network hub)
|
||||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
* session id from remote storage
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
function cronUploadFinished($row, $asessid)
|
||||
public function cronUploadFinished($row, $asessid)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$trtok = $row['trtok'];
|
||||
|
@ -1284,11 +1283,11 @@ class Transport
|
|||
}
|
||||
$ret = $this->xmlrpcCall('locstor.uploadClose',
|
||||
array(
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'],
|
||||
'pars' => array(
|
||||
'gunid' => $row['gunid'],
|
||||
'name' => $row['fname'],
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'],
|
||||
'pars' => array(
|
||||
'gunid' => $row['gunid'],
|
||||
'name' => $row['fname'],
|
||||
'mdpdtoken' => $mdpdtoken,
|
||||
),
|
||||
));
|
||||
|
@ -1302,12 +1301,12 @@ class Transport
|
|||
if ($row['trtype'] == 'searchjob') {
|
||||
@unlink($row['localfile']);
|
||||
$r = $trec->setState('init', array(
|
||||
'direction' => 'down',
|
||||
'pdtoken' => $ret['token'],
|
||||
'expectedsum' => $ret['chsum'],
|
||||
'expectedsize' => $ret['size'],
|
||||
'url' => $ret['url'],
|
||||
'realsize' => 0,
|
||||
'direction' => 'down',
|
||||
'pdtoken' => $ret['token'],
|
||||
'expectedsum' => $ret['chsum'],
|
||||
'expectedsize' => $ret['size'],
|
||||
'url' => $ret['url'],
|
||||
'realsize' => 0,
|
||||
));
|
||||
$this->startCronJobProcess($trec->trtok);
|
||||
} else {
|
||||
|
@ -1353,7 +1352,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
function cronDownloadFinished($row, $asessid)
|
||||
public function cronDownloadFinished($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
|
@ -1396,7 +1395,7 @@ class Transport
|
|||
"gunid" => $row['gunid'],
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = $this->gb->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
$mdtrec->setLock(FALSE);
|
||||
return $storedFile;
|
||||
|
@ -1433,13 +1432,13 @@ class Transport
|
|||
break;
|
||||
case "metadata":
|
||||
case "searchjob":
|
||||
return TRUE; // don't close - getSearchResults should close it
|
||||
break;
|
||||
// don't close - getSearchResults should close it
|
||||
return TRUE;
|
||||
}
|
||||
$ret = $this->xmlrpcCall('locstor.downloadClose',
|
||||
array(
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'] ,
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'] ,
|
||||
));
|
||||
if (PEAR::isError($ret)) {
|
||||
return $ret;
|
||||
|
@ -1456,7 +1455,7 @@ class Transport
|
|||
"gunid" => $row['gunid'],
|
||||
"filetype" => "playlist"
|
||||
);
|
||||
$storedFile = $this->gb->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
|
@ -1487,9 +1486,9 @@ class Transport
|
|||
if (!is_null($rtrtok = $trec->row['rtrtok'])) {
|
||||
$ret = $this->xmlrpcCall('locstor.setHubInitiatedTransfer',
|
||||
array(
|
||||
'target' => HOSTNAME,
|
||||
'trtok' => $rtrtok,
|
||||
'state' => 'closed',
|
||||
'target' => HOSTNAME,
|
||||
'trtok' => $rtrtok,
|
||||
'state' => 'closed',
|
||||
));
|
||||
if (PEAR::isError($ret)) {
|
||||
return $ret;
|
||||
|
@ -1513,11 +1512,11 @@ class Transport
|
|||
* transport type
|
||||
* @param array $pars
|
||||
* default parameters (optional, internal use)
|
||||
* @return object - transportRecord instance
|
||||
* @return TransportRecord
|
||||
*/
|
||||
function _uploadGeneralFileToHub($fpath, $trtype, $pars=array())
|
||||
private function _uploadGeneralFileToHub($fpath, $trtype, $pars=array())
|
||||
{
|
||||
$chsum = $this->_chsum($fpath);
|
||||
$chsum = md5_file($fpath);
|
||||
$size = filesize($fpath);
|
||||
$trec = TransportRecord::create($this, $trtype, 'up',
|
||||
array_merge(array(
|
||||
|
@ -1538,7 +1537,7 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function _createTransportToken()
|
||||
public function _createTransportToken()
|
||||
{
|
||||
$ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '');
|
||||
$initString = microtime().$ip.rand()."org.mdlf.campcaster";
|
||||
|
@ -1560,7 +1559,7 @@ class Transport
|
|||
* @return array
|
||||
* array of transportRecords (as hasharrays)
|
||||
*/
|
||||
function getTransports($direction=NULL, $target=NULL, $trtok=NULL)
|
||||
public function getTransports($direction=NULL, $target=NULL, $trtok=NULL)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
switch ($direction) {
|
||||
|
@ -1614,7 +1613,7 @@ class Transport
|
|||
* @return array
|
||||
* hash: chsum, size, url
|
||||
*/
|
||||
function uploadCheck($pdtoken)
|
||||
public function uploadCheck($pdtoken)
|
||||
{
|
||||
$ret = $this->xmlrpcCall('locstor.uploadCheck',
|
||||
array('token'=>$pdtoken));
|
||||
|
@ -1628,7 +1627,7 @@ class Transport
|
|||
* @return string
|
||||
* network hub response or error object
|
||||
*/
|
||||
function pingToArchive()
|
||||
public function pingToArchive()
|
||||
{
|
||||
$res = $this->xmlrpcCall('locstor.ping',
|
||||
array('par'=>'ping_'.date('H:i:s')));
|
||||
|
@ -1646,7 +1645,7 @@ class Transport
|
|||
* @return mixed
|
||||
* response
|
||||
*/
|
||||
function xmlrpcCall($method, $pars=array())
|
||||
public function xmlrpcCall($method, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$xrp = XML_RPC_encode($pars);
|
||||
|
@ -1655,13 +1654,11 @@ class Transport
|
|||
$CC_CONFIG['archiveUrlHost'], $CC_CONFIG['archiveUrlPort']
|
||||
);
|
||||
$f = new XML_RPC_Message($method, array($xrp));
|
||||
$r = $c->send($f);
|
||||
$r = $c->send($f, 30);
|
||||
if (!$r) {
|
||||
return PEAR::raiseError("XML-RPC request failed", TRERR_XR_FAIL);
|
||||
} elseif ($r->faultCode() > 0) {
|
||||
return PEAR::raiseError($r->faultString(), $r->faultCode());
|
||||
// return PEAR::raiseError($r->faultString().
|
||||
// " (code ".$r->faultCode().")", TRERR_XR_FAIL);
|
||||
} else {
|
||||
$v = $r->value();
|
||||
return XML_RPC_decode($v);
|
||||
|
@ -1669,20 +1666,6 @@ class Transport
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checksum of local file
|
||||
*
|
||||
* @param string $fpath
|
||||
* local filepath
|
||||
* @return string
|
||||
* checksum
|
||||
*/
|
||||
function _chsum($fpath)
|
||||
{
|
||||
return md5_file($fpath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check exception and eventually mark transport as failed
|
||||
*
|
||||
|
@ -1692,7 +1675,7 @@ class Transport
|
|||
* transport record object
|
||||
* @return unknown
|
||||
*/
|
||||
function _failFatal($res, $trec)
|
||||
private function _failFatal($res, $trec)
|
||||
{
|
||||
if (PEAR::isError($res)) {
|
||||
switch ($res->getCode()) {
|
||||
|
@ -1717,7 +1700,7 @@ class Transport
|
|||
* if true, delete non-closed jobs too
|
||||
* @return boolean true or error
|
||||
*/
|
||||
function _cleanUp($interval='1 minute'/*'1 hour'*/, $forced=FALSE)
|
||||
public function _cleanUp($interval='1 minute'/*'1 hour'*/, $forced=FALSE)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$cond = ($forced ? '' : " AND state='closed' AND lock = 'N'");
|
||||
|
@ -1743,7 +1726,7 @@ class Transport
|
|||
* @return mixed
|
||||
* void or error object
|
||||
*/
|
||||
function trLogPear($txt, $eo, $row=NULL)
|
||||
public function trLogPear($txt, $eo, $row=NULL)
|
||||
{
|
||||
$msg = $txt.$eo->getMessage()." ".$eo->getUserInfo().
|
||||
" [".$eo->getCode()."]";
|
||||
|
@ -1766,7 +1749,7 @@ class Transport
|
|||
* @return mixed
|
||||
* void or error object
|
||||
*/
|
||||
function trLog($msg)
|
||||
public function trLog($msg)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$logfile = $CC_CONFIG['transDir']."/activity.log";
|
||||
|
@ -1789,93 +1772,12 @@ class Transport
|
|||
* @return mixed
|
||||
* void or error object
|
||||
*/
|
||||
function resetData()
|
||||
public function resetData()
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
return $CC_DBC->query("DELETE FROM ".$CC_CONFIG['transTable']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Install method<br>
|
||||
*
|
||||
* direction: up | down
|
||||
* state: init | pending | waiting | finished | closed | failed | paused
|
||||
* trtype: audioclip | playlist | playlistPkg | searchjob | metadata | file
|
||||
*
|
||||
*/
|
||||
// function install()
|
||||
// {
|
||||
// global $CC_CONFIG, $CC_DBC;
|
||||
// $r = $CC_DBC->query("CREATE TABLE {$this->transTable} (
|
||||
// id int not null, -- primary key
|
||||
// trtok char(16) not null, -- transport token
|
||||
// direction varchar(128) not null, -- direction: up|down
|
||||
// state varchar(128) not null, -- state
|
||||
// trtype varchar(128) not null, -- transport type
|
||||
// lock char(1) not null default 'N',-- running lock
|
||||
// target varchar(255) default NULL, -- target system,
|
||||
// -- if NULL => predefined set
|
||||
// rtrtok char(16) default NULL, -- remote hub's transport token
|
||||
// mdtrtok char(16), -- metadata transport token
|
||||
// gunid bigint, -- global unique id
|
||||
// pdtoken bigint, -- put/download token from archive
|
||||
// url varchar(255), -- url on remote side
|
||||
// localfile varchar(255), -- pathname of local part
|
||||
// fname varchar(255), -- mnemonic filename
|
||||
// title varchar(255), -- dc:title mdata value (or filename ...)
|
||||
// expectedsum char(32), -- expected file checksum
|
||||
// realsum char(32), -- checksum of transported part
|
||||
// expectedsize int, -- expected filesize in bytes
|
||||
// realsize int, -- filesize of transported part
|
||||
// uid int, -- local user id of transport owner
|
||||
// errmsg varchar(255), -- error message string for failed tr.
|
||||
// start timestamp, -- starttime
|
||||
// ts timestamp -- mtime
|
||||
// )");
|
||||
// if (PEAR::isError($r)) {
|
||||
// echo $r->getMessage()." ".$r->getUserInfo();
|
||||
// }
|
||||
// $r = $CC_DBC->createSequence("{$this->transTable}_id_seq");
|
||||
// if (PEAR::isError($r)) {
|
||||
// echo $r->getMessage()." ".$r->getUserInfo();
|
||||
// }
|
||||
// $r = $CC_DBC->query("CREATE UNIQUE INDEX {$this->transTable}_id_idx
|
||||
// ON {$this->transTable} (id)");
|
||||
// if (PEAR::isError($r)) {
|
||||
// echo $r->getMessage()." ".$r->getUserInfo();
|
||||
// }
|
||||
// $r = $CC_DBC->query("CREATE UNIQUE INDEX {$this->transTable}_trtok_idx
|
||||
// ON {$this->transTable} (trtok)");
|
||||
// if (PEAR::isError($r)) {
|
||||
// echo $r->getMessage()." ".$r->getUserInfo();
|
||||
// }
|
||||
// $r = $CC_DBC->query("CREATE UNIQUE INDEX {$this->transTable}_token_idx
|
||||
// ON {$this->transTable} (pdtoken)");
|
||||
// if (PEAR::isError($r)) {
|
||||
// echo $r->getMessage()." ".$r->getUserInfo();
|
||||
// }
|
||||
// $r = $CC_DBC->query("CREATE INDEX {$this->transTable}_gunid_idx
|
||||
// ON {$this->transTable} (gunid)");
|
||||
// if (PEAR::isError($r)) {
|
||||
// echo $r->getMessage()." ".$r->getUserInfo();
|
||||
// }
|
||||
// $r = $CC_DBC->query("CREATE INDEX {$this->transTable}_state_idx
|
||||
// ON {$this->transTable} (state)");
|
||||
// if (PEAR::isError($r)) {
|
||||
// echo $r->getMessage()." ".$r->getUserInfo();
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Uninstall method
|
||||
*/
|
||||
// function uninstall()
|
||||
// {
|
||||
// global $CC_CONFIG, $CC_DBC;
|
||||
// $CC_DBC->query("DROP TABLE {$this->transTable}");
|
||||
// $CC_DBC->dropSequence("{$this->transTable}_id_seq");
|
||||
// }
|
||||
}
|
||||
|
||||
?>
|
|
@ -394,7 +394,7 @@ class TransportRecord
|
|||
case "playlist":
|
||||
case "playlistPkg":
|
||||
case "metadata":
|
||||
$title = $this->gb->bsGetTitle(NULL, $this->row['gunid']);
|
||||
$title = BasicStor::bsGetTitle(NULL, $this->row['gunid']);
|
||||
if (is_null($title)) {
|
||||
$title = $defStr;
|
||||
}
|
||||
|
|
|
@ -26,16 +26,13 @@ for ($i = 0; $i < $cnt; $i++, sleep(1)) {
|
|||
if (PEAR::isError($r)) {
|
||||
$tr->trLogPear("transportCronJob($pid): ($trtok): ", $r);
|
||||
} else {
|
||||
# $tr->trLog("X transportCronJob: ".var_export($r, TRUE));
|
||||
if ($r !== TRUE) {
|
||||
$tr->trLog("transportCronJob($pid): ($trtok): nonTRUE returned");
|
||||
}
|
||||
}
|
||||
#if(!$r) exit(1);
|
||||
#sleep(2);
|
||||
}
|
||||
|
||||
if (TR_LOG_LEVEL>1) {
|
||||
if (TR_LOG_LEVEL > 1) {
|
||||
$tr->trLog("transportCronJob($pid) end ($trtok)");
|
||||
}
|
||||
exit(0);
|
||||
|
|
|
@ -47,7 +47,7 @@ $values = array(
|
|||
"gunid" => $gunid,
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = $gb->bsPutFile($parid, $values);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
if ($storedFile->getCode()!=GBERR_GUNID) {
|
||||
echo "ERROR: ".$storedFile->getMessage()."\n";
|
||||
|
@ -84,7 +84,7 @@ var_export($r); echo"\n";
|
|||
/* ========== UPLOAD ========== */
|
||||
echo "# UPLOAD test:\n";
|
||||
echo"# uploadAudioClip2Hub: ";
|
||||
$r = $gb->upload2Hub($gunid);
|
||||
$r = $gb->uploadToHub($gunid);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
|
||||
var_export($r); echo"\n";
|
||||
$trtok = $r;
|
||||
|
|
|
@ -1319,7 +1319,7 @@ class XR_LocStor extends LocStor {
|
|||
|
||||
/* ------------------------------------------------------ import playlist */
|
||||
/**
|
||||
* Open writable URL for import playlist in LS Archive format
|
||||
* Open writable URL for import playlist in CC Archive format
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.importPlaylistOpen".
|
||||
*
|
||||
|
@ -1370,7 +1370,7 @@ class XR_LocStor extends LocStor {
|
|||
}
|
||||
|
||||
/**
|
||||
* Open writable URL for import playlist in LS Archive format
|
||||
* Open writable URL for import playlist in CC Archive format
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.importPlaylistClose".
|
||||
*
|
||||
|
@ -2455,11 +2455,10 @@ class XR_LocStor extends LocStor {
|
|||
" ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
# return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
$xv = new XML_RPC_Value;
|
||||
$xv = new XML_RPC_Value();
|
||||
$xv->addStruct(array(
|
||||
'cnt' => XML_RPC_encode($res['cnt']),
|
||||
'results' =>
|
||||
'cnt' => XML_RPC_encode($res['cnt']),
|
||||
'results' =>
|
||||
(count($res['results'])==0
|
||||
? new XML_RPC_Value(array(), 'array')
|
||||
: XML_RPC_encode($res['results'])
|
||||
|
@ -2570,7 +2569,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->loadPref($r['sessid'], $r['key']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2623,7 +2622,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->savePref($r['sessid'], $r['key'], $r['value']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2675,7 +2674,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->delPref($r['sessid'], $r['key']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2729,7 +2728,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->loadGroupPref($r['sessid'], $r['group'], $r['key']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2787,7 +2786,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs($this);
|
||||
$pr = new Prefs();
|
||||
$res = $pr->saveGroupPref($r['sessid'], $r['group'], $r['key'], $r['value']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2966,12 +2965,12 @@ class XR_LocStor extends LocStor {
|
|||
return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res)));
|
||||
}
|
||||
|
||||
/* ------------------------ methods for ls-archive-format file transports */
|
||||
/* ------------------------ methods for cc-archive-format file transports */
|
||||
/**
|
||||
* Open async file transfer from local storageServer to network hub,
|
||||
* file should be ls-archive-format file.
|
||||
* file should be cc-archive-format file.
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.uploadFile2Hub".
|
||||
* The XML-RPC name of this method is "locstor.uploadFileAsync".
|
||||
*
|
||||
* The input parameters are an XML-RPC struct with the following
|
||||
* fields:
|
||||
|
@ -2991,7 +2990,7 @@ class XR_LocStor extends LocStor {
|
|||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_uploadFile2Hub:
|
||||
* <li> 805 - xr_uploadFileAsync:
|
||||
* <message from lower layer> </li>
|
||||
* <li> 848 - invalid session id.</li>
|
||||
* <li> 872 - invalid tranport token.</li>
|
||||
|
@ -2999,9 +2998,9 @@ class XR_LocStor extends LocStor {
|
|||
*
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
* @see Transport::uploadFile2Hub
|
||||
* @see Transport::uploadFileAsync
|
||||
*/
|
||||
public function xr_uploadFile2Hub($input)
|
||||
public function xr_uploadFileAsync($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
|
@ -3009,13 +3008,12 @@ class XR_LocStor extends LocStor {
|
|||
}
|
||||
require_once('../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->uploadFile2Hub($r['filePath']); // local files on XML-RPC :(
|
||||
// there should be something as uploadFile2storageServer
|
||||
$res = $tr->uploadFileAsync($r['filePath']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
$ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 );
|
||||
return new XML_RPC_Response(0, $ec,
|
||||
"xr_uploadFile2Hub: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
"xr_uploadFileAsync: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
|
@ -3134,7 +3132,7 @@ class XR_LocStor extends LocStor {
|
|||
/**
|
||||
* Start upload of audioclip or playlist from local storageServer to hub
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.upload2Hub".
|
||||
* The XML-RPC name of this method is "locstor.uploadToHub".
|
||||
*
|
||||
* The input parameters are an XML-RPC struct with the following
|
||||
* fields:
|
||||
|
@ -3155,7 +3153,7 @@ class XR_LocStor extends LocStor {
|
|||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_upload2Hub:
|
||||
* <li> 805 - xr_uploadToHub:
|
||||
* <message from lower layer> </li>
|
||||
* <li> 848 - invalid session id.</li>
|
||||
* <li> 872 - invalid tranport token.</li>
|
||||
|
@ -3163,9 +3161,9 @@ class XR_LocStor extends LocStor {
|
|||
*
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
* @see Transport::upload2Hub
|
||||
* @see Transport::uploadToHub
|
||||
*/
|
||||
public function xr_upload2Hub($input)
|
||||
public function xr_uploadToHub($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
|
@ -3173,12 +3171,12 @@ class XR_LocStor extends LocStor {
|
|||
}
|
||||
require_once('../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->upload2Hub($r['gunid']);
|
||||
$res = $tr->uploadToHub($r['gunid']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
$ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 );
|
||||
return new XML_RPC_Response(0, $ec,
|
||||
"xr_upload2Hub: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
"xr_uploadToHub: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
|
@ -3248,7 +3246,7 @@ class XR_LocStor extends LocStor {
|
|||
* fields:
|
||||
* <ul>
|
||||
* <li> sessid : string - session id </li>
|
||||
* <li> criteria : hash, LS criteria format - see searchMetadata method
|
||||
* <li> criteria : hash, CC criteria format - see searchMetadata method
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
|
@ -3562,7 +3560,7 @@ class XR_LocStor extends LocStor {
|
|||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->bsOpenPut();
|
||||
$res = BasicStor::bsOpenPut();
|
||||
if (PEAR::isError($res)) {
|
||||
return new XML_RPC_Response(0, 805,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
|
@ -3584,7 +3582,7 @@ class XR_LocStor extends LocStor {
|
|||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->bsClosePut($r['token'], $r['chsum']);
|
||||
$res = BasicStor::bsClosePut($r['token'], $r['chsum']);
|
||||
if (PEAR::isError($res)) {
|
||||
return new XML_RPC_Response(0, 805,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
|
|
|
@ -90,7 +90,7 @@ switch ($ftype) {
|
|||
readfile($realFname);
|
||||
break;
|
||||
case "webstream":
|
||||
$url = $locStor->bsGetMetadataValue($lid, 'ls:url');
|
||||
$url = BasicStor::bsGetMetadataValue($lid, 'ls:url');
|
||||
if (empty($url)) {
|
||||
http_error(500, "Unable to get ls:url value");
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ switch ($ftype) {
|
|||
// echo "$txt\n";
|
||||
break;
|
||||
case "playlist";
|
||||
// $md = $locStor->bsGetMetadata($ac->getId(), $sessid);
|
||||
// $md = BasicStor::bsGetMetadata($ac->getId(), $sessid);
|
||||
$md = $locStor->getAudioClip($sessid, $gunid);
|
||||
// header("Content-type: text/xml");
|
||||
header("Content-type: application/smil");
|
||||
|
|
|
@ -65,36 +65,70 @@ $locStor = new XR_LocStor();
|
|||
|
||||
$methods = array(
|
||||
'test' => 'Tests toupper and checks sessid, params: teststring, sessid.',
|
||||
'ping' => 'Echo request',
|
||||
'getVersion' => 'Dummy function for connection testing.',
|
||||
|
||||
'authenticate' => 'Checks authentication.',
|
||||
'login' => 'Login to storage.',
|
||||
'logout' => 'Logout from storage.',
|
||||
|
||||
// Search functions
|
||||
'searchMetadata' => 'Search through the metadata of stored'.
|
||||
' files, return all matching audio clip ids.',
|
||||
'browseCategory' => 'Return values of specified metadata category.',
|
||||
'globalSearch' => 'Start search job on remote storage',
|
||||
'getSearchResults' => 'Get results from search job on remote storage',
|
||||
|
||||
// Get files from local storage
|
||||
'existsAudioClip' => 'Checks if an Audio clip with the specified '.
|
||||
'id is stored in local storage.',
|
||||
'downloadRawAudioDataOpen' => 'Create and return downloadable URL for audio file',
|
||||
'downloadRawAudioDataClose' => 'Discard downloadable URL for audio file',
|
||||
'downloadMetadataOpen' => 'Create and return downloadable URL for metadata',
|
||||
'downloadMetadataClose' => 'Discard downloadable URL for metadata',
|
||||
'accessRawAudioData' => 'Get access to raw audio data.',
|
||||
'releaseRawAudioData' => 'Release access to raw audio data.',
|
||||
'getAudioClip' => 'Return the contents of an Audio clip.',
|
||||
|
||||
// Put files into local storage
|
||||
'storeAudioClipOpen' => 'Open channel to store a new audio clip '.
|
||||
'or replace an existing one.',
|
||||
'storeAudioClipClose' => 'Close channel to store a new audio clip'.
|
||||
' or replace an existing one.',
|
||||
'downloadRawAudioDataOpen'=> 'Create and return downloadable URL'.
|
||||
'for audio file',
|
||||
'downloadRawAudioDataClose'=>'Discard downloadable URL for audio file',
|
||||
'downloadMetadataOpen' => 'Create and return downloadable URL'.
|
||||
'for metadata',
|
||||
'downloadMetadataClose' => 'Discard downloadable URL for metadata',
|
||||
'storeWebstream' => 'Store audio stream identified by URL',
|
||||
'openPut' => 'openPut',
|
||||
'closePut' => 'closePut',
|
||||
|
||||
// Modify files in local storage
|
||||
'deleteAudioClip' => 'Delete an existing Audio clip.',
|
||||
'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '.
|
||||
'stored in Local storage.',
|
||||
'searchMetadata' => 'Search through the metadata of stored '.
|
||||
'files, return all matching clip ids.',
|
||||
'browseCategory' =>'Return values of specified metadata category.',
|
||||
'accessRawAudioData' => 'Get access to raw audio data.',
|
||||
'releaseRawAudioData' => 'Release access to raw audio data.',
|
||||
'getAudioClip' => 'Return the contents of an Audio clip.',
|
||||
'resetStorage' => 'Reset storageServer for debugging.',
|
||||
'storeWebstream' => 'Store audio stream identified by URL',
|
||||
|
||||
// Functions to get/set status of transfers
|
||||
'getTransportInfo' => 'Common "check" method and info getter for transports',
|
||||
'turnOnOffTransports' => 'Turn transports on/off, optionaly return current state',
|
||||
'doTransportAction' => 'Pause, resume or cancel transport',
|
||||
'getHubInitiatedTransfers' => 'Get list of prepared transfers initiated by hub',
|
||||
'listHubInitiatedTransfers' => 'List hub initiated transfers',
|
||||
'setHubInitiatedTransfer' => 'Set state of hub initiated transfers',
|
||||
|
||||
// Send files to remote storage server
|
||||
'uploadFileAsync' => 'Open async file transfer from local storage to remote storage',
|
||||
'uploadToHub' => 'Start upload of audioclip or playlist from local storage to remote storage',
|
||||
|
||||
'uploadOpen' => 'Open file-layer upload',
|
||||
'uploadCheck' => 'Check the checksum of uploaded file',
|
||||
'uploadClose' => 'Close file-layer upload',
|
||||
|
||||
// Get files from a remote storage server and put them into local storage
|
||||
'startHubInitiatedTransfer' => 'Start of download initiated by remote storage',
|
||||
'downloadFromHub' => 'Start download of audioclip or playlist from remote to local storage',
|
||||
'downloadOpen' => 'Open file-layer download',
|
||||
'downloadClose' => 'Close file-layer download',
|
||||
'prepareHubInitiatedTransfer' => 'Prepare remote initiated transfer',
|
||||
|
||||
// Playlist functions
|
||||
'createPlaylist' => 'Create a new Playlist metafile.',
|
||||
'editPlaylist' => 'Open a Playlist metafile for editing.',
|
||||
'savePlaylist' => 'Save a Playlist metafile.',
|
||||
|
@ -113,50 +147,29 @@ $methods = array(
|
|||
'renderPlaylistToFileOpen' => 'Render playlist to ogg file (open handle)',
|
||||
'renderPlaylistToFileCheck' => 'Render playlist to ogg file (check results)',
|
||||
'renderPlaylistToFileClose' => 'Render playlist to ogg file (close handle)',
|
||||
|
||||
'renderPlaylistToStorageOpen' => 'Render playlist to storage media clip (open handle)',
|
||||
'renderPlaylistToStorageCheck' => 'Render playlist to storage media clip (check results)',
|
||||
|
||||
'renderPlaylistToRSSOpen' => 'Render playlist to RSS file (open handle)',
|
||||
'renderPlaylistToRSSCheck' => 'Render playlist to RSS file (check results)',
|
||||
'renderPlaylistToRSSClose' => 'Render playlist to RSS file (close handle)',
|
||||
|
||||
// Backup functions
|
||||
'createBackupOpen' => 'Create backup of storage (open handle)',
|
||||
'createBackupCheck' => 'Create backup of storage (check results)',
|
||||
'createBackupClose' => 'Create backup of storage (close handle)',
|
||||
|
||||
// Restore functions
|
||||
'restoreBackupOpen' => 'Restore a backup file (open handle)',
|
||||
'restoreBackupClosePut' => 'Restore a backup file (close PUT handle)',
|
||||
'restoreBackupCheck' => 'Restore a backup file (check results)',
|
||||
'restoreBackupClose' => 'Restore a backup file (close handle)',
|
||||
|
||||
// Preferences functions
|
||||
'loadPref' => 'Load user preference value.',
|
||||
'savePref' => 'Save user preference value.',
|
||||
'delPref' => 'Delete user preference record.',
|
||||
'loadGroupPref' => 'Read group preference record.',
|
||||
'saveGroupPref' => 'Delete user preference record.',
|
||||
|
||||
'getTransportInfo' => 'Common "check" method and info getter for transports',
|
||||
'turnOnOffTransports' => 'Turn transports on/off, optionaly return current state',
|
||||
'doTransportAction' => 'Pause, resume or cancel transport',
|
||||
'uploadFile2Hub' => 'Open async file transfer from local storageServer to network hub',
|
||||
'getHubInitiatedTransfers' => 'Get list of prepared transfers initiated by hub',
|
||||
'startHubInitiatedTransfer' => 'Start of download initiated by hub',
|
||||
'upload2Hub' => 'Start upload of audioclip or playlist from local storageServer to hub',
|
||||
'downloadFromHub' => 'Start download of audioclip or playlist from hub to local storageServer',
|
||||
'globalSearch' => 'Start search job on network hub',
|
||||
'getSearchResults' => 'Get results from search job on network hub',
|
||||
|
||||
'uploadOpen' => 'Open file-layer upload',
|
||||
'uploadCheck' => 'Check the checksum of uploaded file',
|
||||
'uploadClose' => 'Close file-layer upload',
|
||||
'downloadOpen' => 'Open file-layer download',
|
||||
// 'downloadCheck' => 'Check the checksum of downloaded file',
|
||||
'downloadClose' => 'Close file-layer download',
|
||||
'prepareHubInitiatedTransfer' => 'Prepare hub initiated transfer',
|
||||
'listHubInitiatedTransfers' => 'List hub initiated transfers',
|
||||
'setHubInitiatedTransfer' => 'Set state of hub initiated transfers',
|
||||
'ping' => 'Echo request',
|
||||
);
|
||||
|
||||
$defs = array();
|
||||
|
|
|
@ -183,13 +183,13 @@ $infos = array(
|
|||
'p'=>array('sessid', 'onOff'), 'r'=>array('state')),
|
||||
"doTransportAction" => array('m'=>"locstor.doTransportAction",
|
||||
'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')),
|
||||
"uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub",
|
||||
"uploadFileAsync" => array('m'=>"locstor.uploadFileAsync",
|
||||
'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')),
|
||||
"getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers",
|
||||
'p'=>array('sessid'), 'r'=>array()),
|
||||
"startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer",
|
||||
'p'=>array('trtok'), 'r'=>array()),
|
||||
"upload2Hub" => array('m'=>"locstor.upload2Hub",
|
||||
"uploadToHub" => array('m'=>"locstor.uploadToHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"downloadFromHub" => array('m'=>"locstor.downloadFromHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
|
|
|
@ -174,13 +174,13 @@ $methodDefs = array(
|
|||
'p'=>array('sessid', 'onOff'), 'r'=>array('state')),
|
||||
"doTransportAction" => array('m'=>"locstor.doTransportAction",
|
||||
'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')),
|
||||
"uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub",
|
||||
"uploadFileAsync" => array('m'=>"locstor.uploadFileAsync",
|
||||
'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')),
|
||||
"getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers",
|
||||
'p'=>array('sessid'), 'r'=>array()),
|
||||
"startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer",
|
||||
'p'=>array('trtok'), 'r'=>array()),
|
||||
"upload2Hub" => array('m'=>"locstor.upload2Hub",
|
||||
"uploadToHub" => array('m'=>"locstor.uploadToHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"downloadFromHub" => array('m'=>"locstor.downloadFromHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
|
|
Loading…
Reference in New Issue