reverted the storageServer, archiveServer, storageAdmin and htmlUI modules to their branches/campcaster-1.2 (last known working) state
This commit is contained in:
parent
b3f1742c9e
commit
6efc50520c
|
@ -126,7 +126,7 @@ EVENT_SCHEDULER_DIR = ${MODULES_DIR}/eventScheduler
|
|||
SCHEDULER_CLIENT_DIR = ${MODULES_DIR}/schedulerClient
|
||||
WIDGETS_DIR = ${MODULES_DIR}/widgets
|
||||
ALIB_DIR = ${MODULES_DIR}/alib
|
||||
#ARCHIVE_SERVER_DIR = ${MODULES_DIR}/archiveServer
|
||||
ARCHIVE_SERVER_DIR = ${MODULES_DIR}/archiveServer
|
||||
GETID3_DIR = ${MODULES_DIR}/getid3
|
||||
HTML_UI_DIR = ${MODULES_DIR}/htmlUI
|
||||
STORAGE_ADMIN_DIR = ${MODULES_DIR}/storageAdmin
|
||||
|
@ -247,15 +247,15 @@ modules_setup: ${TMP_DIR}/modules_setup.stamp
|
|||
${TMP_DIR}/modules_setup.stamp:
|
||||
cd ${ALIB_DIR} && ./configure --prefix=${prefix} \
|
||||
PACKAGE_VERSION=${PACKAGE_VERSION}
|
||||
# cd ${ARCHIVE_SERVER_DIR} && \
|
||||
# ./configure --prefix=${prefix} \
|
||||
# --with-hostname=${HOSTNAME} \
|
||||
# --with-www-port=${WWW_PORT} \
|
||||
# --with-database-server=${DB_SERVER} \
|
||||
# --with-database=${DATABASE} \
|
||||
# --with-database-user=${DB_USER} \
|
||||
# --with-database-password=${DB_PASSWORD} \
|
||||
# PACKAGE_VERSION=${PACKAGE_VERSION}
|
||||
cd ${ARCHIVE_SERVER_DIR} && \
|
||||
./configure --prefix=${prefix} \
|
||||
--with-hostname=${HOSTNAME} \
|
||||
--with-www-port=${WWW_PORT} \
|
||||
--with-database-server=${DB_SERVER} \
|
||||
--with-database=${DATABASE} \
|
||||
--with-database-user=${DB_USER} \
|
||||
--with-database-password=${DB_PASSWORD} \
|
||||
PACKAGE_VERSION=${PACKAGE_VERSION}
|
||||
cd ${GETID3_DIR} && ./configure --prefix=${prefix} \
|
||||
PACKAGE_VERSION=${PACKAGE_VERSION}
|
||||
cd ${HTML_UI_DIR} && ./configure --prefix=${prefix} \
|
||||
|
@ -371,7 +371,7 @@ depclean:
|
|||
${MAKE} -C ${WIDGETS_DIR} depclean
|
||||
${MAKE} -C ${SCHEDULER_DIR} depclean
|
||||
${MAKE} -C ${GLIVESUPPORT_DIR} depclean
|
||||
# -${MAKE} -C ${ARCHIVE_SERVER_DIR} depclean
|
||||
-${MAKE} -C ${ARCHIVE_SERVER_DIR} depclean
|
||||
-${MAKE} -C ${STORAGE_SERVER_DIR} depclean
|
||||
|
||||
compile: ${TMP_DIR}/compile.stamp
|
||||
|
@ -449,7 +449,7 @@ setup_install_dirs:
|
|||
|
||||
install_modules:
|
||||
${MAKE} -C ${ALIB_DIR} install
|
||||
# ${MAKE} -C ${ARCHIVE_SERVER_DIR} install
|
||||
${MAKE} -C ${ARCHIVE_SERVER_DIR} install
|
||||
${MAKE} -C ${GETID3_DIR} install
|
||||
${MAKE} -C ${HTML_UI_DIR} install
|
||||
${MAKE} -C ${STORAGE_ADMIN_DIR} install
|
||||
|
@ -467,5 +467,5 @@ install_modules:
|
|||
install_products:
|
||||
${MAKE} -C ${SCHEDULER_DIR} install
|
||||
${MAKE} -C ${GLIVESUPPORT_DIR} install
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -132,25 +132,25 @@ REPLACE_SED_STRING="s/ls_lib_dir/${USR_LIB_DIR_S}/; \
|
|||
all:
|
||||
|
||||
doc:
|
||||
# ${DOXYGEN} ${DOXYGEN_CONFIG}
|
||||
${DOXYGEN} ${DOXYGEN_CONFIG}
|
||||
|
||||
clean: db_clean
|
||||
# ${RMDIR} ${STOR_DIR}
|
||||
# ${RMDIR} ${ACCESS_DIR}
|
||||
# ${RMDIR} ${TRANS_DIR}
|
||||
${RMDIR} ${STOR_DIR}
|
||||
${RMDIR} ${ACCESS_DIR}
|
||||
${RMDIR} ${TRANS_DIR}
|
||||
|
||||
docclean:
|
||||
# ${RMDIR} ${DOXYGEN_DIR}/html
|
||||
${RMDIR} ${DOXYGEN_DIR}/html
|
||||
|
||||
depclean: clean
|
||||
|
||||
dist:
|
||||
# ${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} *
|
||||
${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} *
|
||||
|
||||
distclean: clean docclean
|
||||
|
||||
testonly: ${TEST_RUNNER}
|
||||
# ${TEST_RUNNER}
|
||||
${TEST_RUNNER}
|
||||
|
||||
check: all
|
||||
#testonly
|
||||
|
@ -158,39 +158,39 @@ check: all
|
|||
recheck: clean check
|
||||
|
||||
install:
|
||||
# ${MKDIR} ${DEST_DIR}
|
||||
# ${MKDIR} ${DEST_DIR}/access
|
||||
# ${MKDIR} ${DEST_DIR}/install
|
||||
# ${MKDIR} ${DEST_DIR}/stor
|
||||
# ${MKDIR} ${DEST_DIR}/stor/buffer
|
||||
# ${MKDIR} ${DEST_DIR}/trans
|
||||
# ${MKDIR} ${DEST_DIR}/xmlrpc
|
||||
# ${CP} ${VAR_DIR}/*.{php,template} ${DEST_DIR}
|
||||
# ${CP} ${VAR_DIR}/install/*.php ${DEST_DIR}/install
|
||||
# ${CP} ${VAR_DIR}/xmlrpc/*.php ${DEST_DIR}/xmlrpc
|
||||
# ${CAT} ${VAR_DIR}/conf.php.template | ${SED} -e ${REPLACE_SED_STRING} \
|
||||
# > ${DEST_DIR}/conf.php
|
||||
|
||||
${MKDIR} ${DEST_DIR}
|
||||
${MKDIR} ${DEST_DIR}/access
|
||||
${MKDIR} ${DEST_DIR}/install
|
||||
${MKDIR} ${DEST_DIR}/stor
|
||||
${MKDIR} ${DEST_DIR}/stor/buffer
|
||||
${MKDIR} ${DEST_DIR}/trans
|
||||
${MKDIR} ${DEST_DIR}/xmlrpc
|
||||
${CP} ${VAR_DIR}/*.{php,template} ${DEST_DIR}
|
||||
${CP} ${VAR_DIR}/install/*.php ${DEST_DIR}/install
|
||||
${CP} ${VAR_DIR}/xmlrpc/*.php ${DEST_DIR}/xmlrpc
|
||||
${CAT} ${VAR_DIR}/conf.php.template | ${SED} -e ${REPLACE_SED_STRING} \
|
||||
> ${DEST_DIR}/conf.php
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Specific targets
|
||||
#-------------------------------------------------------------------------------
|
||||
storage: dir_setup db_init
|
||||
|
||||
dir_setup: ${DOXYGEN_DIR}
|
||||
# bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR}
|
||||
bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR}
|
||||
|
||||
db_init:
|
||||
# -cd var/install && php -q install.php
|
||||
-cd var/install && php -q install.php
|
||||
|
||||
db_clean:
|
||||
# -cd var/install && php -q uninstall.php
|
||||
-cd var/install && php -q uninstall.php
|
||||
|
||||
${TMP_DIR}:
|
||||
# ${MKDIR} ${TMP_DIR}
|
||||
${MKDIR} ${TMP_DIR}
|
||||
|
||||
${DOXYGEN_DIR}:
|
||||
# ${MKDIR} ${DOXYGEN_DIR}
|
||||
${MKDIR} ${DOXYGEN_DIR}
|
||||
|
||||
${TEST_RUNNER}:
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class Archive extends XR_LocStor {
|
|||
if (PEAR::isError($owner)) {
|
||||
return $owner;
|
||||
}
|
||||
$res = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
$res = $this->bsOpenPut($chsum, NULL, $owner);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class Archive extends XR_LocStor {
|
|||
*/
|
||||
function uploadCheck($token)
|
||||
{
|
||||
return BasicStor::bsCheckPut($token);
|
||||
return $this->bsCheckPut($token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Archive extends XR_LocStor {
|
|||
*/
|
||||
function uploadClose($token, $trtype, $pars=array())
|
||||
{
|
||||
$res = BasicStor::bsClosePut($token);
|
||||
$res = $this->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 = BasicStor::bsClosePut($mdtoken);
|
||||
$res = $this->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 = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
$res = $this->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 = BasicStor::bsExportPlaylistOpen($gunid);
|
||||
$res = $this->bsExportPlaylistOpen($gunid);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
|
||||
$plfpath = "$tmpn.lspl";
|
||||
copy($res['fname'], $plfpath);
|
||||
$res = BasicStor::bsExportPlaylistClose($res['token']);
|
||||
$res = $this->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 = BasicStor::bsGetTitle(NULL, $gunid);
|
||||
$title = $this->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.confirmUploadToHub':
|
||||
$uiBrowser->TRANSFERS->uploadToHub($_REQUEST['id']);
|
||||
case 'TR.confirmUpload2Hub':
|
||||
$uiBrowser->TRANSFERS->upload2Hub($_REQUEST['id']);
|
||||
$Smarty->display('popup/TR.confirmTransfer.tpl');
|
||||
break;
|
||||
|
||||
|
|
|
@ -202,10 +202,8 @@ switch ($_REQUEST['act']) {
|
|||
break;
|
||||
|
||||
case "HUBSEARCH.newSearch":
|
||||
$uiHandler->SEARCH->newSearch($_REQUEST, "remote");
|
||||
$uiHandler->HUBSEARCH->newSearch($_REQUEST);
|
||||
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.uploadToHub'
|
||||
, 'TR.upload2Hub'
|
||||
)"
|
||||
|
||||
|
|
|
@ -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.uploadToHub'
|
||||
|
||||
, 'TR.upload2Hub'
|
||||
)"
|
|
@ -1,6 +1,6 @@
|
|||
{literal}
|
||||
<script type="text/javascript">
|
||||
// www.jjam.de - Kontextmen<EFBFBD> mit JavaScript - Version 15.12.2002
|
||||
// www.jjam.de - Kontextmenü 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<EFBFBD>sslichen Linkrahmen in einigen Browsern zu vermeiden;
|
||||
var oF = "onfocus = 'if (this.blur) this.blur()'"; // Um hä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.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>";
|
||||
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>";
|
||||
break;
|
||||
|
||||
case "TR.downloadFromHub":
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{assign var="_gname" value=$Subjects->getSubjectName($_REQUEST.id)}
|
||||
{assign var="_gname" value=Subjects::GetSubjName($_REQUEST.id)}
|
||||
|
||||
<div class="container_elements" style="width: 607px;">
|
||||
<h1>{tra str='Manage Group: $1' 1=$_gname}</h1>
|
||||
|
|
|
@ -185,7 +185,7 @@ class uiHandler extends uiBase {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
$result = BasicStor::bsSetMetadataBatch($storedFile->getId(), $metadata);
|
||||
$result = $this->gb->bsSetMetadataBatch($storedFile->getId(), $metadata);
|
||||
|
||||
$this->redirUrl = UI_BROWSER."?act=addFileMData&id=".$storedFile->getId();
|
||||
if (UI_VERBOSE) {
|
||||
|
|
|
@ -117,20 +117,9 @@ class uiSearch
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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")
|
||||
function newSearch(&$formdata)
|
||||
{
|
||||
$this->results = NULL;
|
||||
$this->criteria['host'] = $p_host;
|
||||
$this->criteria['conditions'] = NULL;
|
||||
$this->criteria['offset'] = NULL;
|
||||
$this->criteria['form'] = NULL;
|
||||
|
@ -139,7 +128,7 @@ class uiSearch
|
|||
$this->criteria['limit'] = $formdata['limit'];
|
||||
$this->criteria['counter'] = 0;
|
||||
|
||||
// $criteria['form'] is used for retransfer of the form
|
||||
// $criteria['form'] is used for retransfer to 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 uploadToHub($id)
|
||||
function upload2Hub($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->uploadToHub($gunid);
|
||||
$r = $this->Base->gb->upload2Hub($gunid);
|
||||
break;
|
||||
case 'playlist':
|
||||
$this->Base->gb->uploadToHub($gunid);
|
||||
$this->Base->gb->upload2Hub($gunid);
|
||||
break;
|
||||
default:
|
||||
// TODO: it is not implemented in gb, and this way maybe impossible
|
||||
//$this->Base->gb->uploadFileAsync($gunid);
|
||||
//$this->Base->gb->uploadFile2Hub($gunid);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ $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='')
|
||||
{
|
||||
|
@ -45,7 +47,7 @@ function admDumpFolder(&$bs, $fid, $ind='')
|
|||
$pars['name'] = "$name";
|
||||
switch ($type) {
|
||||
case "Folder":
|
||||
$farr = BasicStor::bsListFolder($fid);
|
||||
$farr = $bs->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 = BasicStor::bsPutFile($parentId, $values, $doCopyFiles);
|
||||
$storedFile = $greenbox->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 = BasicStor::bsSetMetadataBatch($id, $metadata);
|
||||
$r = $greenbox->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 = BasicStor::bsPutFile($parid, $values);
|
||||
$r = $bs->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 static function bsPutFile($p_parentId, $p_values, $p_copyMedia=TRUE)
|
||||
public 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 static function bsRenameFile($id, $newName)
|
||||
public 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 static function bsMoveFile($id, $did)
|
||||
public 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 static function bsCopyFile($id, $did)
|
||||
public 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 static function bsReplaceFile($id, $localFilePath, $metadataFilePath, $mdataLoc='file')
|
||||
public 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 = BasicStor::bsMoveFile($id, $did);
|
||||
$res = $this->bsMoveFile($id, $did);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ class BasicStor {
|
|||
* array with strings:
|
||||
* downloadable URL, download token, chsum, size, filename
|
||||
*/
|
||||
public static function bsOpenDownload($id, $part='media', $parent='0')
|
||||
public 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 static function bsCloseDownload($token, $part='media')
|
||||
public 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 static function bsOpenPut($chsum, $gunid, $owner=NULL)
|
||||
public 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 static function bsClosePut($token)
|
||||
public 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 static function bsCheckPut($token)
|
||||
public 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 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);
|
||||
// }
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -804,7 +804,7 @@ class BasicStor {
|
|||
* Virtual file's local id
|
||||
* @return string|PEAR_Error
|
||||
*/
|
||||
public static function bsGetMetadata($id)
|
||||
public 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 static function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL)
|
||||
public 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 static function bsGetMetadataValue($id, $category = null)
|
||||
public 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 static function bsSetMetadataValue($id, $category, $value,
|
||||
public 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 static function bsSetMetadataBatch(
|
||||
public 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 = BasicStor::bsSetMetadataValue($storedFile, $category,
|
||||
$res = $this->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 static function bsLocalSearch($criteria, $limit=0, $offset=0)
|
||||
public function bsLocalSearch($criteria, $limit=0, $offset=0)
|
||||
{
|
||||
require_once("DataEngine.php");
|
||||
$de = new DataEngine();
|
||||
$de = new DataEngine($this);
|
||||
$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 static function bsBrowseCategory($category, $limit=0, $offset=0, $criteria=NULL)
|
||||
public function bsBrowseCategory($category, $limit=0, $offset=0, $criteria=NULL)
|
||||
{
|
||||
require_once("DataEngine.php");
|
||||
$de = new DataEngine();
|
||||
$de = new DataEngine($this);
|
||||
return $de->browseCategory($category, $limit, $offset, $criteria);
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1129,7 @@ class BasicStor {
|
|||
* fname string: readable fname,
|
||||
* token string: access token
|
||||
*/
|
||||
public static function bsExportPlaylistOpen($plids, $type='lspl', $withContent=TRUE)
|
||||
public 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 static function bsExportPlaylistClose($token)
|
||||
public function bsExportPlaylistClose($token)
|
||||
{
|
||||
$r = BasicStor::bsRelease($token, 'access');
|
||||
if (PEAR::isError($r)) {
|
||||
|
@ -1297,7 +1297,7 @@ class BasicStor {
|
|||
"gunid" => $plid,
|
||||
"filetype" => "playlist"
|
||||
);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
$storedFile = $this->bsPutFile($parid, $values);
|
||||
$res = $storedFile->getId();
|
||||
break;
|
||||
case "smil":
|
||||
|
@ -1331,7 +1331,7 @@ class BasicStor {
|
|||
|
||||
|
||||
/**
|
||||
* Import playlist in CC Archive format
|
||||
* Import playlist in LS Archive format
|
||||
*
|
||||
* @param int $parid
|
||||
* Destination folder local id
|
||||
|
@ -1384,7 +1384,7 @@ class BasicStor {
|
|||
if (!file_exists($metadata)) {
|
||||
$metadata = NULL;
|
||||
}
|
||||
$exists = BasicStor::bsExistsFile($gunid, NULL, TRUE);
|
||||
$exists = $this->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 = BasicStor::bsPutFile($parid, $values);
|
||||
$storedFile = $this->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 static function bsListFolder($id)
|
||||
public 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 static function bsAnalyzeFile($id)
|
||||
public 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 static function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
|
||||
public function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
|
||||
{
|
||||
if ($byGunid) {
|
||||
$storedFile = StoredFile::RecallByGunid($id);
|
||||
|
@ -1664,6 +1664,22 @@ 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;
|
||||
|
@ -1719,11 +1735,11 @@ class BasicStor {
|
|||
* @param string $pass
|
||||
* @return boolean|sessionId|PEAR_Error
|
||||
*/
|
||||
// public static function login($login, $pass)
|
||||
// {
|
||||
// $r = Alib::Login($login, $pass);
|
||||
// return $r;
|
||||
// }
|
||||
function login($login, $pass)
|
||||
{
|
||||
$r = Alib::Login($login, $pass);
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
/* ================================================== "protected" methods */
|
||||
|
@ -1893,6 +1909,26 @@ 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
|
||||
*
|
||||
|
@ -1907,7 +1943,7 @@ class BasicStor {
|
|||
* @return boolean
|
||||
* previous state
|
||||
*/
|
||||
public static function setEditFlag($p_playlistId, $p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL)
|
||||
public function setEditFlag($p_playlistId, $p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL)
|
||||
{
|
||||
if (!is_null($p_sessid)) {
|
||||
$p_subjid = Alib::GetSessUserId($p_sessid);
|
||||
|
@ -1940,7 +1976,7 @@ class BasicStor {
|
|||
* @return FALSE|int
|
||||
* ID of user editing it
|
||||
*/
|
||||
public static function isEdited($p_playlistId)
|
||||
public function isEdited($p_playlistId)
|
||||
{
|
||||
$storedFile = StoredFile::RecallByGunid($p_playlistId);
|
||||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
|
@ -2196,7 +2232,7 @@ class BasicStor {
|
|||
"gunid" => $gunid,
|
||||
"filetype" => $type
|
||||
);
|
||||
$r = BasicStor::bsPutFile($rootHD, $values);
|
||||
$r = $this->bsPutFile($rootHD, $values);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -2204,13 +2240,26 @@ class BasicStor {
|
|||
//$res['results'][] = array('gunid' => $gunid, 'type' => $type);
|
||||
//$res['cnt']++;
|
||||
}
|
||||
return BasicStor::bsLocalSearch(
|
||||
return $this->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);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
@ -2226,6 +2275,17 @@ class BasicStor {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function debug($va)
|
||||
{
|
||||
echo"<pre>\n";
|
||||
print_r($va);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deleteFiles
|
||||
*
|
||||
|
|
|
@ -54,18 +54,15 @@ 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()
|
||||
public function __construct(&$gb)
|
||||
{
|
||||
$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 static function createFolder($parid, $folderName, $sessid='')
|
||||
public 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 static function putFile($p_parentId, $p_values, $p_sessionId='')
|
||||
public function putFile($p_parentId, $p_values, $p_sessionId='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $p_parentId, $p_sessionId)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$storedFile = BasicStor::bsPutFile($p_parentId, $p_values);
|
||||
$storedFile = $this->bsPutFile($p_parentId, $p_values);
|
||||
return $storedFile;
|
||||
} // fn putFile
|
||||
|
||||
|
@ -90,7 +90,7 @@ class GreenBox extends BasicStor {
|
|||
* @return int
|
||||
* @exception PEAR::error
|
||||
*/
|
||||
public static function storeWebstream($parid, $fileName, $mdataFileLP, $sessid='',
|
||||
public 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 = BasicStor::bsPutFile($parid, $values);
|
||||
$storedFile = $this->bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$oid = $storedFile->getId();
|
||||
$r = BasicStor::bsSetMetadataValue(
|
||||
$r = $this->bsSetMetadataValue(
|
||||
$oid, 'ls:url', $url, NULL, NULL, 'metadata');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
@ -119,6 +119,49 @@ 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
|
||||
*
|
||||
|
@ -128,12 +171,12 @@ class GreenBox extends BasicStor {
|
|||
* Session id
|
||||
* @return array
|
||||
*/
|
||||
public static function analyzeFile($id, $sessid='')
|
||||
public function analyzeFile($id, $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsAnalyzeFile($id);
|
||||
return $this->bsAnalyzeFile($id);
|
||||
} // fn analyzeFile
|
||||
|
||||
|
||||
|
@ -147,13 +190,13 @@ class GreenBox extends BasicStor {
|
|||
* Session id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public static function renameFile($id, $newName, $sessid='')
|
||||
public function renameFile($id, $newName, $sessid='')
|
||||
{
|
||||
$parid = M2tree::GetParent($id);
|
||||
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsRenameFile($id, $newName);
|
||||
return $this->bsRenameFile($id, $newName);
|
||||
} // fn renameFile
|
||||
|
||||
|
||||
|
@ -168,13 +211,13 @@ class GreenBox extends BasicStor {
|
|||
* session id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public static function moveFile($id, $did, $sessid='')
|
||||
public function moveFile($id, $did, $sessid='')
|
||||
{
|
||||
$res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid);
|
||||
if ($res !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsMoveFile($id, $did);
|
||||
return $this->bsMoveFile($id, $did);
|
||||
} // fn moveFile
|
||||
|
||||
|
||||
|
@ -189,13 +232,13 @@ class GreenBox extends BasicStor {
|
|||
* session id
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public static function copyFile($id, $did, $sessid='')
|
||||
public function copyFile($id, $did, $sessid='')
|
||||
{
|
||||
$res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid);
|
||||
if ($res !== TRUE) {
|
||||
if($res !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsCopyFile($id, $did);
|
||||
return $this->bsCopyFile($id, $did);
|
||||
} // fn copyFile
|
||||
|
||||
|
||||
|
@ -212,12 +255,12 @@ class GreenBox extends BasicStor {
|
|||
* session id
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public static function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
|
||||
public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
|
||||
return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
|
||||
} // fn replaceFile
|
||||
|
||||
|
||||
|
@ -243,6 +286,28 @@ 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
|
||||
*
|
||||
|
@ -253,12 +318,12 @@ class GreenBox extends BasicStor {
|
|||
* @return string|PEAR_Error
|
||||
* @todo rename this function to "getMetadata"
|
||||
*/
|
||||
public static function getMetadata($id, $sessid='')
|
||||
public function getMetadata($id, $sessid='')
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsGetMetadata($id);
|
||||
return $this->bsGetMetadata($id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,7 +340,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return array
|
||||
*/
|
||||
public static function getMetadataArray($id, $sessid)
|
||||
public function getMetadataArray($id, $sessid)
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
|
@ -332,7 +397,7 @@ class GreenBox extends BasicStor {
|
|||
* qualified name (e.g. xml:lang)</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static function getMetadataValue($id, $category, $sessid='',
|
||||
public function getMetadataValue($id, $category, $sessid='',
|
||||
$lang=NULL, $deflang=NULL)
|
||||
{
|
||||
if (!is_numeric($id)) {
|
||||
|
@ -341,7 +406,7 @@ class GreenBox extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsGetMetadataValue($id, $category);
|
||||
return $this->bsGetMetadataValue($id, $category);
|
||||
} // fn getMetadataValue
|
||||
|
||||
|
||||
|
@ -362,12 +427,12 @@ class GreenBox extends BasicStor {
|
|||
* (optional on unique elements) Metadata record id
|
||||
* @return boolean
|
||||
*/
|
||||
public static function setMetadataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL)
|
||||
public function setMetadataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL)
|
||||
{
|
||||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsSetMetadataValue($id, $category, $value, $lang, $mid);
|
||||
return $this->bsSetMetadataValue($id, $category, $value, $lang, $mid);
|
||||
} // fn setMetadataValue
|
||||
|
||||
|
||||
|
@ -424,11 +489,11 @@ class GreenBox extends BasicStor {
|
|||
* </ul>
|
||||
* @see BasicStor::bsLocalSearch
|
||||
*/
|
||||
public static function localSearch($criteria, $sessid='')
|
||||
public function localSearch($criteria, $sessid='')
|
||||
{
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
return BasicStor::bsLocalSearch($criteria, $limit, $offset);
|
||||
return $this->bsLocalSearch($criteria, $limit, $offset);
|
||||
} // fn localSearch
|
||||
|
||||
|
||||
|
@ -446,7 +511,7 @@ class GreenBox extends BasicStor {
|
|||
* cnt : integer - number of matching values
|
||||
* @see BasicStor::bsBrowseCategory
|
||||
*/
|
||||
public static function browseCategory($category, $criteria = null, $sessid = '')
|
||||
public function browseCategory($category, $criteria = null, $sessid = '')
|
||||
{
|
||||
$limit = 0;
|
||||
$offset = 0;
|
||||
|
@ -454,7 +519,7 @@ class GreenBox extends BasicStor {
|
|||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
}
|
||||
$res = BasicStor::bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
return $res;
|
||||
} // fn browseCategory
|
||||
|
||||
|
@ -493,7 +558,7 @@ class GreenBox extends BasicStor {
|
|||
}
|
||||
// optionally move it to the destination folder:
|
||||
if($parid != $hdid && !is_null($parid)){
|
||||
$r = BasicStor::bsMoveFile($id, $parid);
|
||||
$r = $this->bsMoveFile($id, $parid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -502,6 +567,22 @@ 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
|
||||
*
|
||||
|
@ -511,7 +592,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return array
|
||||
*/
|
||||
public static function getPlaylistArray($id, $sessid)
|
||||
public function getPlaylistArray($id, $sessid)
|
||||
{
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
$pl = StoredFile::Recall($id);
|
||||
|
@ -533,7 +614,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* playlist access token
|
||||
*/
|
||||
public static function lockPlaylistForEdit($id, $sessid)
|
||||
public function lockPlaylistForEdit($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -557,7 +638,7 @@ class GreenBox extends BasicStor {
|
|||
*/
|
||||
public function releaseLockedPlaylist($token, $sessid)
|
||||
{
|
||||
$gunid = BasicStor::bsCloseDownload($token, 'metadata');
|
||||
$gunid = $this->bsCloseDownload($token, 'metadata');
|
||||
if (PEAR::isError($gunid)) {
|
||||
return $gunid;
|
||||
}
|
||||
|
@ -594,7 +675,7 @@ class GreenBox extends BasicStor {
|
|||
* pause between half-faded points in time format hh:mm:ss.ssssss
|
||||
* @return string, generated playlistElement gunid
|
||||
*/
|
||||
public static function addAudioClipToPlaylist($token, $acId, $sessid,
|
||||
public function addAudioClipToPlaylist($token, $acId, $sessid,
|
||||
$fadeIn=NULL, $fadeOut=NULL, $length=NULL, $pause=NULL)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
|
@ -609,11 +690,13 @@ 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;
|
||||
|
@ -634,7 +717,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* @todo rename this function to "deleteAudioClipFromPlaylist"
|
||||
*/
|
||||
public static function delAudioClipFromPlaylist($token, $plElGunid, $sessid)
|
||||
public function delAudioClipFromPlaylist($token, $plElGunid, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = StoredFile::RecallByToken($token);
|
||||
|
@ -669,7 +752,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public static function changeFadeInfo($token, $plElGunid, $fadeIn, $fadeOut, $sessid)
|
||||
public function changeFadeInfo($token, $plElGunid, $fadeIn, $fadeOut, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = StoredFile::RecallByToken($token);
|
||||
|
@ -705,7 +788,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public static function moveAudioClipInPlaylist($token, $plElGunid, $newPos, $sessid)
|
||||
public function moveAudioClipInPlaylist($token, $plElGunid, $newPos, $sessid)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
$pl = StoredFile::RecallByToken($token);
|
||||
|
@ -735,7 +818,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* gunid of playlist
|
||||
*/
|
||||
public static function revertEditedPlaylist($token, $sessid='')
|
||||
public function revertEditedPlaylist($token, $sessid='')
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$lc = new LocStor($CC_DBC, $CC_CONFIG);
|
||||
|
@ -752,7 +835,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public static function deletePlaylist($id, $sessid)
|
||||
public function deletePlaylist($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -784,7 +867,7 @@ class GreenBox extends BasicStor {
|
|||
* <li>duration string, total playlength of clip </li>
|
||||
* </ul>
|
||||
*/
|
||||
public static function displayPlaylistClipAtOffset($sessid, $plid, $offset, $distance=0,
|
||||
public function displayPlaylistClipAtOffset($sessid, $plid, $offset, $distance=0,
|
||||
$lang=NULL, $deflang=NULL)
|
||||
{
|
||||
require_once("Playlist.php");
|
||||
|
@ -802,7 +885,7 @@ class GreenBox extends BasicStor {
|
|||
return $id;
|
||||
}
|
||||
if (!is_null($id)) {
|
||||
$res['title'] = BasicStor::bsGetMetadataValue($id, "dc:title");
|
||||
$res['title'] = $this->bsGetMetadataValue($id, "dc:title");
|
||||
}
|
||||
return $res;
|
||||
} // fn displayPlaylistClipAtOffset
|
||||
|
@ -826,9 +909,9 @@ class GreenBox extends BasicStor {
|
|||
* fname string: readable fname,
|
||||
* token string: access token
|
||||
*/
|
||||
public static function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
public function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
{
|
||||
return BasicStor::bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
return $this->bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
} // fn exportPlaylistOpen
|
||||
|
||||
|
||||
|
@ -840,14 +923,14 @@ class GreenBox extends BasicStor {
|
|||
* method call
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public static function exportPlaylistClose($token)
|
||||
public function exportPlaylistClose($token)
|
||||
{
|
||||
return BasicStor::bsExportPlaylistClose($token);
|
||||
return $this->bsExportPlaylistClose($token);
|
||||
} // fn exportPlaylistClose
|
||||
|
||||
|
||||
/**
|
||||
* Open writable handle for import playlist in CC Archive format
|
||||
* Open writable handle for import playlist in LS Archive format
|
||||
*
|
||||
* @param string $sessid
|
||||
* session id
|
||||
|
@ -857,13 +940,13 @@ class GreenBox extends BasicStor {
|
|||
* fname string: writable local filename
|
||||
* token string: put token
|
||||
*/
|
||||
public static function importPlaylistOpen($sessid, $chsum='')
|
||||
public function importPlaylistOpen($sessid, $chsum='')
|
||||
{
|
||||
$userid = GreenBox::GetSessUserId($sessid);
|
||||
if (PEAR::isError($userid)) {
|
||||
return $userid;
|
||||
}
|
||||
$r = BasicStor::bsOpenPut($chsum, NULL, $userid);
|
||||
$r = $this->bsOpenPut($chsum, NULL, $userid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -881,7 +964,7 @@ class GreenBox extends BasicStor {
|
|||
*/
|
||||
public function importPlaylistClose($token)
|
||||
{
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
$arr = $this->bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
|
@ -911,7 +994,7 @@ class GreenBox extends BasicStor {
|
|||
* session ID
|
||||
* @return boolean
|
||||
*/
|
||||
public static function existsPlaylist($id, $sessid)
|
||||
public function existsPlaylist($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -932,7 +1015,7 @@ class GreenBox extends BasicStor {
|
|||
* @return TRUE|int
|
||||
* id of user editing it
|
||||
*/
|
||||
public static function playlistIsAvailable($id, $sessid)
|
||||
public function playlistIsAvailable($id, $sessid)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$gunid = BasicStor::GunidFromId($id);
|
||||
|
@ -941,6 +1024,37 @@ 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)
|
||||
|
@ -952,7 +1066,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string $token
|
||||
* render token
|
||||
*/
|
||||
public static function renderPlaylistToFileOpen($sessid, $plid)
|
||||
public function renderPlaylistToFileOpen($sessid, $plid)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2FileOpen($this, $plid);
|
||||
|
@ -972,7 +1086,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* tmpfile : string - filepath to result temporary file
|
||||
*/
|
||||
public static function renderPlaylistToFileCheck($token)
|
||||
public function renderPlaylistToFileCheck($token)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2FileCheck($this, $token);
|
||||
|
@ -993,7 +1107,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* tmpfile : string - filepath to result temporary file
|
||||
*/
|
||||
public static function renderPlaylistToFileList($status='')
|
||||
public function renderPlaylistToFileList($status='')
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
return Renderer::rnRender2FileList($this, $status);
|
||||
|
@ -1008,7 +1122,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
public static function renderPlaylistToFileClose($token)
|
||||
public function renderPlaylistToFileClose($token)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2FileClose($this, $token);
|
||||
|
@ -1029,7 +1143,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* render token
|
||||
*/
|
||||
public static function renderPlaylistToStorageOpen($sessid, $plid)
|
||||
public function renderPlaylistToStorageOpen($sessid, $plid)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$owner = GreenBox::getSessUserId($sessid);
|
||||
|
@ -1053,7 +1167,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* gunid : string - gunid of result file
|
||||
*/
|
||||
public static function renderPlaylistToStorageCheck($token)
|
||||
public function renderPlaylistToStorageCheck($token)
|
||||
{
|
||||
require_once("Renderer.php");
|
||||
$r = Renderer::rnRender2StorageCheck($this, $token);
|
||||
|
@ -1074,7 +1188,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* render token
|
||||
*/
|
||||
public static function renderPlaylistToRSSOpen($sessid, $plid)
|
||||
public function renderPlaylistToRSSOpen($sessid, $plid)
|
||||
{
|
||||
$token = '123456789abcdeff';
|
||||
$fakeFile = $CC_CONFIG['accessDir']."/$token.rss";
|
||||
|
@ -1092,7 +1206,7 @@ class GreenBox extends BasicStor {
|
|||
* status : string - susccess | working | fault
|
||||
* tmpfile : string - filepath to result temporary file
|
||||
*/
|
||||
public static function renderPlaylistToRSSCheck($token)
|
||||
public function renderPlaylistToRSSCheck($token)
|
||||
{
|
||||
$fakeFile = $CC_CONFIG['accessDir']."/$token.rss";
|
||||
if ($token != '123456789abcdeff' || !file_exists($fakeFile)){
|
||||
|
@ -1107,6 +1221,25 @@ 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)
|
||||
*
|
||||
|
@ -1115,7 +1248,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
public static function renderPlaylistToRSSClose($token)
|
||||
public function renderPlaylistToRSSClose($token)
|
||||
{
|
||||
if ($token != '123456789abcdeff'){
|
||||
return PEAR::raiseError(
|
||||
|
@ -1140,7 +1273,7 @@ class GreenBox extends BasicStor {
|
|||
* @return array
|
||||
* token : string - backup token
|
||||
*/
|
||||
public static function createBackupOpen($sessid, $criteria='')
|
||||
public function createBackupOpen($sessid, $criteria='')
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1162,7 +1295,7 @@ class GreenBox extends BasicStor {
|
|||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
*/
|
||||
public static function createBackupCheck($token)
|
||||
public function createBackupCheck($token)
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1185,7 +1318,7 @@ class GreenBox extends BasicStor {
|
|||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
*/
|
||||
public static function createBackupList($sessid, $stat='')
|
||||
public function createBackupList($sessid, $stat='')
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1204,7 +1337,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
public static function createBackupClose($token)
|
||||
public function createBackupClose($token)
|
||||
{
|
||||
require_once("Backup.php");
|
||||
$bu = new Backup($this);
|
||||
|
@ -1226,7 +1359,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* restore token
|
||||
*/
|
||||
public static function backupRestoreOpen($sessid, $filename)
|
||||
public function backupRestoreOpen($sessid, $filename)
|
||||
{
|
||||
require_once('Restore.php');
|
||||
$rs = new Restore($this);
|
||||
|
@ -1248,7 +1381,7 @@ class GreenBox extends BasicStor {
|
|||
* status: string - working | fault | success
|
||||
* faultString: string - description of fault
|
||||
*/
|
||||
public static function backupRestoreCheck($token)
|
||||
public function backupRestoreCheck($token)
|
||||
{
|
||||
require_once('Restore.php');
|
||||
$rs = new Restore($this);
|
||||
|
@ -1267,7 +1400,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* is success
|
||||
*/
|
||||
public static function backupRestoreClose($token) {
|
||||
public function backupRestoreClose($token) {
|
||||
require_once('Restore.php');
|
||||
$rs = new Restore($this);
|
||||
if (PEAR::isError($rs)) {
|
||||
|
@ -1288,9 +1421,9 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* preference value
|
||||
*/
|
||||
public static function loadPref($sessid, $key)
|
||||
public function loadPref($sessid, $key)
|
||||
{
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->loadPref($sessid, $key);
|
||||
return $res;
|
||||
} // fn loadPref
|
||||
|
@ -1307,9 +1440,9 @@ class GreenBox extends BasicStor {
|
|||
* preference value
|
||||
* @return boolean
|
||||
*/
|
||||
public static function savePref($sessid, $key, $value)
|
||||
public function savePref($sessid, $key, $value)
|
||||
{
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->savePref($sessid, $key, $value);
|
||||
return $res;
|
||||
} // fn savePref
|
||||
|
@ -1324,9 +1457,9 @@ class GreenBox extends BasicStor {
|
|||
* preference key
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delPref($sessid, $key)
|
||||
public function delPref($sessid, $key)
|
||||
{
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->delPref($sessid, $key);
|
||||
return $res;
|
||||
} // fn delPref
|
||||
|
@ -1344,9 +1477,9 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* preference value
|
||||
*/
|
||||
public static function loadGroupPref($sessid, $group, $key)
|
||||
public function loadGroupPref($sessid, $group, $key)
|
||||
{
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->loadGroupPref($sessid, $group, $key);
|
||||
return $res;
|
||||
} // fn loadGroupPref
|
||||
|
@ -1365,9 +1498,9 @@ class GreenBox extends BasicStor {
|
|||
* preference value
|
||||
* @return boolean
|
||||
*/
|
||||
public static function saveGroupPref($sessid, $group, $key, $value)
|
||||
public function saveGroupPref($sessid, $group, $key, $value)
|
||||
{
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->saveGroupPref($sessid, $group, $key, $value);
|
||||
return $res;
|
||||
} // fn saveGroupPref
|
||||
|
@ -1384,9 +1517,9 @@ class GreenBox extends BasicStor {
|
|||
* preference key
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delGroupPref($sessid, $group, $key)
|
||||
public function delGroupPref($sessid, $group, $key)
|
||||
{
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->delGroupPref($sessid, $group, $key);
|
||||
return $res;
|
||||
} // fn delGroupPref
|
||||
|
@ -1427,7 +1560,7 @@ class GreenBox extends BasicStor {
|
|||
* @return boolean
|
||||
* previous state
|
||||
*/
|
||||
public static function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
public function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1445,7 +1578,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* resulting transport state
|
||||
*/
|
||||
public static function doTransportAction($trtok, $action)
|
||||
public function doTransportAction($trtok, $action)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1464,12 +1597,12 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public static function uploadFileAsync($filePath)
|
||||
public function uploadFile2Hub($filePath)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
return $tr->uploadFileAsync($filePath);
|
||||
} // fn uploadFileAsync
|
||||
return $tr->uploadFile2Hub($filePath);
|
||||
} // fn uploadFile2Hub
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1479,7 +1612,7 @@ class GreenBox extends BasicStor {
|
|||
* trtok: string transport token
|
||||
* ... ?
|
||||
*/
|
||||
public static function getHubInitiatedTransfers()
|
||||
public function getHubInitiatedTransfers()
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1496,7 +1629,7 @@ class GreenBox extends BasicStor {
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public static function startHubInitiatedTransfer($trtok)
|
||||
public function startHubInitiatedTransfer($trtok)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
|
@ -1518,12 +1651,12 @@ class GreenBox extends BasicStor {
|
|||
* transport token
|
||||
* @todo rename this function "uploadToHub"
|
||||
*/
|
||||
public static function uploadToHub($gunid, $withContent=FALSE)
|
||||
public function upload2Hub($gunid, $withContent=FALSE)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
return $tr->uploadToHub($gunid, $withContent);
|
||||
} // fn uploadToHub
|
||||
return $tr->upload2Hub($gunid, $withContent);
|
||||
} // fn upload2Hub
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1600,7 +1733,7 @@ class GreenBox extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$listArr = BasicStor::bsListFolder($id);
|
||||
$listArr = $this->bsListFolder($id);
|
||||
return $listArr;
|
||||
} // fn listFolder
|
||||
|
||||
|
@ -1633,7 +1766,7 @@ class GreenBox extends BasicStor {
|
|||
public function existsFile($sessid, $gunid, $ftype=NULL)
|
||||
{
|
||||
$id = BasicStor::IdFromGunid($gunid);
|
||||
$ex = BasicStor::bsExistsFile($id, $ftype);
|
||||
$ex = $this->bsExistsFile($id, $ftype);
|
||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
require_once("BasicStor.php");
|
||||
require_once("Transport.php");
|
||||
|
||||
/**
|
||||
* LocStor class
|
||||
|
@ -115,11 +114,11 @@ class LocStor extends BasicStor {
|
|||
if ($fname == '') {
|
||||
$fname = "newFile";
|
||||
}
|
||||
$res = BasicStor::bsRenameFile($oid, $fname);
|
||||
$res = $this->bsRenameFile($oid, $fname);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsOpenPut($chsum, $storedFile->gunid);
|
||||
return $this->bsOpenPut($chsum, $storedFile->gunid);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +135,7 @@ class LocStor extends BasicStor {
|
|||
if (is_null($storedFile) || PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
$arr = $this->bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
$storedFile->delete();
|
||||
return $arr;
|
||||
|
@ -167,7 +166,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function uploadCheck($token)
|
||||
{
|
||||
return BasicStor::bsCheckPut($token);
|
||||
return $this->bsCheckPut($token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,7 +202,7 @@ class LocStor extends BasicStor {
|
|||
return $storedFile;
|
||||
}
|
||||
$oid = $storedFile->getId();
|
||||
$r = BasicStor::bsSetMetadataValue(
|
||||
$r = $this-> bsSetMetadataValue(
|
||||
$oid, 'ls:url', $url, NULL, NULL, 'metadata');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
|
@ -282,7 +281,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
return BasicStor::bsOpenDownload($id);
|
||||
return $this->bsOpenDownload($id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -296,7 +295,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function downloadRawAudioDataClose($token)
|
||||
{
|
||||
return BasicStor::bsCloseDownload($token);
|
||||
return $this->bsCloseDownload($token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,8 +323,8 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = BasicStor::bsOpenDownload($id, 'metadata');
|
||||
//unset($res['filename']);
|
||||
$res = $this->bsOpenDownload($id, 'metadata');
|
||||
#unset($res['filename']);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -340,7 +339,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function downloadMetadataClose($token)
|
||||
{
|
||||
return BasicStor::bsCloseDownload($token, 'metadata');
|
||||
return $this->bsCloseDownload($token, 'metadata');
|
||||
}
|
||||
|
||||
|
||||
|
@ -360,7 +359,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$md = BasicStor::bsGetMetadata($storedFile->getId());
|
||||
$md = $this->bsGetMetadata($storedFile->getId());
|
||||
if (PEAR::isError($md)) {
|
||||
return $md;
|
||||
}
|
||||
|
@ -373,9 +372,8 @@ class LocStor extends BasicStor {
|
|||
/**
|
||||
* Search in metadata database
|
||||
*
|
||||
* @param string $p_sessid
|
||||
* Session ID
|
||||
* @param array $p_criteria
|
||||
* @param string $sessid
|
||||
* @param array $criteria
|
||||
* with following structure:<br>
|
||||
* <ul>
|
||||
* <li>filetype - string, type of searched files,
|
||||
|
@ -407,11 +405,7 @@ class LocStor extends BasicStor {
|
|||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* @param boolean $p_searchRemote
|
||||
* Set this to true if you want to search the remote storage.
|
||||
*
|
||||
* @return array of hashes, fields:
|
||||
* @return array of hashes, fields:
|
||||
* <ul>
|
||||
* <li>cnt : integer - number of matching gunids
|
||||
* of files have been found</li>
|
||||
|
@ -428,37 +422,14 @@ class LocStor extends BasicStor {
|
|||
* </ul>
|
||||
* @see BasicStor::localSearch
|
||||
*/
|
||||
protected function searchMetadata($p_sessid, $p_criteria, $p_searchRemote = false)
|
||||
protected function searchMetadata($sessid, $criteria)
|
||||
{
|
||||
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);
|
||||
if (($res = BasicStor::Authorize('read', $this->storId, $sessid)) !== TRUE) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -472,7 +443,7 @@ class LocStor extends BasicStor {
|
|||
{
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
$res = BasicStor::bsLocalSearch($criteria, $limit, $offset);
|
||||
$res = $this->bsLocalSearch($criteria, $limit, $offset);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -496,7 +467,7 @@ class LocStor extends BasicStor {
|
|||
{
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
$res = BasicStor::bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -548,7 +519,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$ex = BasicStor::bsExistsFile($id, $ftype);
|
||||
$ex = $this->bsExistsFile($id, $ftype);
|
||||
return $ex;
|
||||
}
|
||||
|
||||
|
@ -656,7 +627,7 @@ class LocStor extends BasicStor {
|
|||
if ($fname == '') {
|
||||
$fname = "newFile.xml";
|
||||
}
|
||||
$res = BasicStor::bsRenameFile($oid, $fname);
|
||||
$res = $this->bsRenameFile($oid, $fname);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -707,7 +678,7 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = BasicStor::bsOpenDownload($id, 'metadata');
|
||||
$res = $this->bsOpenDownload($id, 'metadata');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -734,7 +705,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function savePlaylist($sessid, $playlistToken, $newPlaylist)
|
||||
{
|
||||
$playlistId = BasicStor::bsCloseDownload($playlistToken, 'metadata');
|
||||
$playlistId = $this->bsCloseDownload($playlistToken, 'metadata');
|
||||
if (PEAR::isError($playlistId)) {
|
||||
return $playlistId;
|
||||
}
|
||||
|
@ -766,7 +737,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
public function revertEditedPlaylist($playlistToken, $sessid='')
|
||||
{
|
||||
$gunid = BasicStor::bsCloseDownload($playlistToken, 'metadata');
|
||||
$gunid = $this->bsCloseDownload($playlistToken, 'metadata');
|
||||
if (PEAR::isError($gunid)) {
|
||||
return $gunid;
|
||||
}
|
||||
|
@ -872,7 +843,8 @@ class LocStor extends BasicStor {
|
|||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
}
|
||||
$res = BasicStor::bsOpenDownload($id, 'metadata', $parent);
|
||||
$res = $this->bsOpenDownload($id, 'metadata', $parent);
|
||||
#unset($res['filename']);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -892,14 +864,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 BasicStor::bsCloseDownload($playlistToken, 'metadata');
|
||||
return $this->bsCloseDownload($playlistToken, 'metadata');
|
||||
}
|
||||
|
||||
|
||||
|
@ -922,7 +894,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
{
|
||||
$res = BasicStor::bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
$res = $this->bsExportPlaylistOpen($plids, $type, !$standalone);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -946,12 +918,12 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function exportPlaylistClose($token)
|
||||
{
|
||||
return BasicStor::bsExportPlaylistClose($token);
|
||||
return $this->bsExportPlaylistClose($token);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open writable handle for import playlist in CC Archive format
|
||||
* Open writable handle for import playlist in LS Archive format
|
||||
*
|
||||
* @param string $sessid
|
||||
* session id
|
||||
|
@ -967,7 +939,7 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($userid)) {
|
||||
return $userid;
|
||||
}
|
||||
$r = BasicStor::bsOpenPut($chsum, NULL, $userid);
|
||||
$r = $this->bsOpenPut($chsum, NULL, $userid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -985,7 +957,7 @@ class LocStor extends BasicStor {
|
|||
*/
|
||||
protected function importPlaylistClose($token)
|
||||
{
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
$arr = $this->bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
|
@ -1348,7 +1320,7 @@ class LocStor extends BasicStor {
|
|||
if (PEAR::isError($userid)) {
|
||||
return $userid;
|
||||
}
|
||||
$r = BasicStor::bsOpenPut($chsum, NULL, $userid);
|
||||
$r = $this->bsOpenPut($chsum, NULL, $userid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -1367,7 +1339,7 @@ class LocStor extends BasicStor {
|
|||
* restore token
|
||||
*/
|
||||
protected function restoreBackupClosePut($sessid, $token) {
|
||||
$arr = BasicStor::bsClosePut($token);
|
||||
$arr = $this->bsClosePut($token);
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
|
@ -1434,384 +1406,5 @@ class LocStor extends BasicStor {
|
|||
return CAMPCASTER_VERSION;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open upload transport (from station to hub)
|
||||
*
|
||||
* @param string $sessid
|
||||
* session id
|
||||
* @param string $chsum
|
||||
* checksum
|
||||
* @return array
|
||||
* hasharray with:
|
||||
* url string: writable URL
|
||||
* token string: PUT token
|
||||
*/
|
||||
protected function uploadOpen($sessid, $chsum)
|
||||
{
|
||||
$owner = Alib::GetSessUserId($sessid);
|
||||
if (PEAR::isError($owner)) {
|
||||
return $owner;
|
||||
}
|
||||
$res = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
return array('url'=>$res['url'], 'token'=>$res['token']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close upload transport
|
||||
*
|
||||
* @param string $token
|
||||
* transport token
|
||||
* @param string $trtype
|
||||
* transport type
|
||||
* @param array $pars
|
||||
* transport parameters
|
||||
* @return mixed
|
||||
*/
|
||||
protected function uploadClose($token, $trtype, $pars=array())
|
||||
{
|
||||
$res = BasicStor::bsClosePut($token);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
extract($res); // fname, owner
|
||||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
$mdtoken = $pars['mdpdtoken'];
|
||||
$res = BasicStor::bsClosePut($mdtoken);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$mdfname = $res['fname'];
|
||||
if ($gunid == '') {
|
||||
$gunid = NULL;
|
||||
}
|
||||
$parid = $this->_getHomeDirId($owner);
|
||||
if (PEAR::isError($parid)) {
|
||||
return $parid;
|
||||
}
|
||||
$values = array(
|
||||
"filename" => $pars['name'],
|
||||
"filepath" => $fname,
|
||||
"metadata" => $mdfname,
|
||||
"gunid" => $pars['gunid'],
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$res = $storedFile->getId();
|
||||
@unlink($fname);
|
||||
@unlink($mdfname);
|
||||
break;
|
||||
case "playlist":
|
||||
if ($gunid == '') {
|
||||
$gunid = NULL;
|
||||
}
|
||||
$parid = $this->_getHomeDirId($owner);
|
||||
if (PEAR::isError($parid)) {
|
||||
return $parid;
|
||||
}
|
||||
$values = array(
|
||||
"filename" => $pars['name'],
|
||||
"metadata" => $fname,
|
||||
"gunid" => $pars['gunid'],
|
||||
"filetype" => "playlist"
|
||||
);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
$res = $storedFile->getId();
|
||||
@unlink($fname);
|
||||
break;
|
||||
case "playlistPkg":
|
||||
$chsum = md5_file($fname);
|
||||
// importPlaylistOpen:
|
||||
$res = BasicStor::bsOpenPut($chsum, NULL, $owner);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$dest = $res['fname'];
|
||||
$token = $res['token'];
|
||||
copy($fname, $dest);
|
||||
$r = $this->importPlaylistClose($token);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
@unlink($fname);
|
||||
return $r;
|
||||
break;
|
||||
case "searchjob":
|
||||
$crits = file_get_contents($fname);
|
||||
$criteria = unserialize($crits);
|
||||
@unlink($fname);
|
||||
$results = $this->localSearch($criteria);
|
||||
if (PEAR::isError($results)) {
|
||||
return $results;
|
||||
}
|
||||
$realfile = tempnam($this->accessDir, 'searchjob_');
|
||||
@chmod($realfile, 0660);
|
||||
$len = file_put_contents($realfile, serialize($results));
|
||||
$acc = BasicStor::bsAccess($realfile, '', NULL, 'download');
|
||||
if (PEAR::isError($acc)) {
|
||||
return $acc;
|
||||
}
|
||||
$url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
|
||||
$chsum = md5_file($realfile);
|
||||
$size = filesize($realfile);
|
||||
$res = array(
|
||||
'url'=>$url, 'token'=>$acc['token'],
|
||||
'chsum'=>$chsum, 'size'=>$size,
|
||||
'filename'=>$filename
|
||||
);
|
||||
return $res;
|
||||
break;
|
||||
case "metadata":
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open download transport
|
||||
*
|
||||
* @param string $sessid
|
||||
* session id
|
||||
* @param string $trtype
|
||||
* transport type
|
||||
* @param array $pars
|
||||
* transport parameters
|
||||
* @return hasharray with:
|
||||
* url string: writable URL
|
||||
* token string: PUT token
|
||||
*/
|
||||
protected function downloadOpen($sessid, $trtype, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
switch ($trtype) {
|
||||
case "unknown":
|
||||
case "audioclip":
|
||||
case "metadata":
|
||||
case "playlist":
|
||||
case "playlistPkg":
|
||||
if (!isset($pars['gunid'])) {
|
||||
return PEAR::raiseError("LocStor::downloadOpen: gunid not set");
|
||||
}
|
||||
break;
|
||||
}
|
||||
$gunid = $pars['gunid'];
|
||||
// resolve trtype by object type:
|
||||
if ( ($trtype == 'unknown') || ($trtype == 'playlistPkg') ) {
|
||||
$trtype2 = BasicStor::GetType($gunid);
|
||||
if (PEAR::isError($trtype2)) {
|
||||
return $trtype2;
|
||||
}
|
||||
// required with content:
|
||||
$trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ?
|
||||
'playlistPkg' : $trtype2);
|
||||
}
|
||||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
$res = $this->downloadRawAudioDataOpen($sessid, $gunid);
|
||||
break;
|
||||
case "metadata":
|
||||
$res = $this->downloadMetadataOpen($sessid, $gunid);
|
||||
break;
|
||||
case "playlist":
|
||||
$res = $this->accessPlaylist($sessid, $gunid);
|
||||
break;
|
||||
case "playlistPkg":
|
||||
$res = BasicStor::bsExportPlaylistOpen($gunid);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
|
||||
$plfpath = "$tmpn.lspl";
|
||||
copy($res['fname'], $plfpath);
|
||||
$res = BasicStor::bsExportPlaylistClose($res['token']);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$fname = "transported_playlist.lspl";
|
||||
$id = BasicStor::IdFromGunid($gunid);
|
||||
$acc = BasicStor::bsAccess($plfpath, 'lspl', NULL, 'download');
|
||||
if (PEAR::isError($acc)) {
|
||||
return $acc;
|
||||
}
|
||||
$url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
|
||||
$chsum = md5_file($plfpath);
|
||||
$size = filesize($plfpath);
|
||||
$res = array(
|
||||
'url'=>$url, 'token'=>$acc['token'],
|
||||
'chsum'=>$chsum, 'size'=>$size,
|
||||
'filename'=>$fname
|
||||
);
|
||||
break;
|
||||
case "searchjob":
|
||||
$res = $pars;
|
||||
break;
|
||||
case "file":
|
||||
$res = array();
|
||||
break;
|
||||
default:
|
||||
return PEAR::raiseError("LocStor::downloadOpen: NotImpl ($trtype)");
|
||||
}
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
case "metadata":
|
||||
case "playlist":
|
||||
case "playlistPkg":
|
||||
$title = BasicStor::bsGetTitle(NULL, $gunid);
|
||||
break;
|
||||
case "searchjob":
|
||||
$title = 'searchjob';
|
||||
break;
|
||||
case "file":
|
||||
$title = 'regular file';
|
||||
break;
|
||||
default:
|
||||
}
|
||||
$res['title'] = $title;
|
||||
$res['trtype'] = $trtype;
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close download transport
|
||||
*
|
||||
* @param string $token
|
||||
* transport token
|
||||
* @param string $trtype
|
||||
* transport type
|
||||
* @return array
|
||||
* hasharray with:
|
||||
* url string: writable URL
|
||||
* token string: PUT token
|
||||
*/
|
||||
protected function downloadClose($token, $trtype)
|
||||
{
|
||||
switch ($trtype) {
|
||||
case "audioclip":
|
||||
$res = $this->downloadRawAudioDataClose($token);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
return $res;
|
||||
case "metadata":
|
||||
$res = $this->downloadMetadataClose($token);
|
||||
return $res;
|
||||
case "playlist":
|
||||
$res = $this->releasePlaylist(NULL/*$sessid*/, $token);
|
||||
return $res;
|
||||
case "playlistPkg":
|
||||
$res = BasicStor::bsRelease($token, 'download');
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$realFname = $r['realFname'];
|
||||
@unlink($realFname);
|
||||
if (preg_match("|(plExport_[^\.]+)\.lspl$|", $realFname, $va)) {
|
||||
list(,$tmpn) = $va;
|
||||
$tmpn = $CC_CONFIG['transDir']."/$tmpn";
|
||||
if (file_exists($tmpn)) {
|
||||
@unlink($tmpn);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
case "searchjob":
|
||||
$res = BasicStor::bsRelease($token, 'download');
|
||||
return $res;
|
||||
case "file":
|
||||
return array();
|
||||
default:
|
||||
return PEAR::raiseError("LocStor::downloadClose: NotImpl ($trtype)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare hub initiated transport
|
||||
*
|
||||
* @param string $target
|
||||
* hostname of transport target
|
||||
* @param string $trtype
|
||||
* transport type
|
||||
* @param string $direction
|
||||
* 'up' | 'down'
|
||||
* @param array $pars
|
||||
* transport parameters
|
||||
* @return TransportRecord|PEAR_Error
|
||||
*/
|
||||
protected function prepareHubInitiatedTransfer(
|
||||
$target, $trtype='file', $direction='up',$pars=array())
|
||||
{
|
||||
$tr = new Transport($this);
|
||||
$trec = TransportRecord::create($tr, $trtype, $direction,
|
||||
array_merge($pars, array('target'=>$target)));
|
||||
if (PEAR::isError($trec)) {
|
||||
return $trec;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List hub initiated transports
|
||||
*
|
||||
* @param string $target
|
||||
* hostname of transport target
|
||||
* @param string $direction
|
||||
* 'up' | 'down'
|
||||
* @param string $trtok
|
||||
* transport token
|
||||
* @return array|PEAR_Error
|
||||
* array of transportRecords as hasharrays
|
||||
*/
|
||||
protected function listHubInitiatedTransfers(
|
||||
$target=NULL, $direction=NULL, $trtok=NULL)
|
||||
{
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->getTransports($direction, $target, $trtok);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set state of hub initiated transport
|
||||
*
|
||||
* @param string $target
|
||||
* hostname of transport target
|
||||
* @param string $trtok
|
||||
* transport token
|
||||
* @param string $state
|
||||
* transport state
|
||||
* @return TransportRecord|PEAR_Error
|
||||
*/
|
||||
protected function setHubInitiatedTransfer($target, $trtok, $state)
|
||||
{
|
||||
$tr = new Transport($this);
|
||||
$trec = TransportRecord::recall($tr, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
return $trec;
|
||||
}
|
||||
$r = $trec->setState($state);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return $trec;
|
||||
}
|
||||
|
||||
} // class LocStor
|
||||
?>
|
|
@ -54,7 +54,7 @@ class Playlist extends StoredFile {
|
|||
return $pl;
|
||||
}
|
||||
$fname = ($fname == '' || is_null($fname) ? "newFile.xml" : $fname );
|
||||
$res = BasicStor::bsRenameFile($oid, $fname);
|
||||
$res = $gb->bsRenameFile($oid, $fname);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -1606,8 +1606,8 @@ class PlaylistAudioClipExport
|
|||
if (PEAR::isError($RADext)) {
|
||||
return $RADext;
|
||||
}
|
||||
$title = BasicStor::bsGetMetadataValue($ac->getId(), 'dc:title');
|
||||
$desc = BasicStor::bsGetMetadataValue($ac->getId(), 'dc:description');
|
||||
$title = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:title');
|
||||
$desc = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:description');
|
||||
return array(
|
||||
'type' => 'audioclip',
|
||||
'gunid' => $gunid,
|
||||
|
|
|
@ -18,11 +18,17 @@ require_once("GreenBox.php");
|
|||
/* ================== Prefs ================== */
|
||||
class Prefs {
|
||||
|
||||
public $gb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param GreenBox $gb
|
||||
* GreenBox object reference
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(&$gb)
|
||||
{
|
||||
$this->gb =& $gb;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ class Renderer
|
|||
}
|
||||
$mdata = '';
|
||||
foreach (array('dc:title', 'dcterms:extent', 'dc:creator', 'dc:description') as $item) {
|
||||
$val = BasicStor::bsGetMetadataValue($id, $item);
|
||||
$val = $gb->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 = BasicStor::bsPutFile($parid, $values);
|
||||
$storedFile = $gb->bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
|
|
|
@ -186,6 +186,13 @@ 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
|
||||
* ... ?
|
||||
*/
|
||||
public function getTransportInfo($trtok)
|
||||
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'] = md5_file($trec->row['localfile']);
|
||||
$res['realsum'] = $this->_chsum($trec->row['localfile']);
|
||||
}
|
||||
if ( ($trec->row['direction'] == 'up') ){
|
||||
$check = $this->uploadCheck($trec->row['pdtoken']);
|
||||
|
@ -199,10 +199,10 @@ class Transport
|
|||
* @return boolea
|
||||
* previous state
|
||||
*/
|
||||
public function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
function turnOnOffTransports($sessid, $onOff=NULL)
|
||||
{
|
||||
require_once('Prefs.php');
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this->gb);
|
||||
$group = 'StationPrefs';
|
||||
$key = 'TransportsDenied';
|
||||
$res = $pr->loadGroupPref($sessid, $group, $key);
|
||||
|
@ -235,7 +235,7 @@ class Transport
|
|||
* @return string
|
||||
* resulting transport state
|
||||
*/
|
||||
public function doTransportAction($trtok, $action)
|
||||
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 storage
|
||||
* to remote storage.
|
||||
* Start upload of audioClip/webstream/playlist from local storageServer
|
||||
* to hub.
|
||||
*
|
||||
* @param string $gunid
|
||||
* global unique id of object being transported
|
||||
|
@ -287,10 +287,10 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function uploadToHub($gunid, $withContent=TRUE, $pars=array())
|
||||
function upload2Hub($gunid, $withContent=TRUE, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$this->trLog("uploadToHub start: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("upload2Hub 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("uploadToHub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S"));
|
||||
$res = BasicStor::bsExportPlaylistOpen($plid);
|
||||
$this->trLog("uploadToHub exportPlaylistOpen END: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("upload2Hub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S"));
|
||||
$res = $this->gb->bsExportPlaylistOpen($plid);
|
||||
$this->trLog("upload2Hub exportPlaylistOpen END: ".strftime("%H:%M:%S"));
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
|
||||
$plfpath = "$tmpn.lspl";
|
||||
$this->trLog("uploadToHub begin copy: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("upload2Hub begin copy: ".strftime("%H:%M:%S"));
|
||||
copy($res['fname'], $plfpath);
|
||||
$this->trLog("uploadToHub end copy: ".strftime("%H:%M:%S"));
|
||||
$res = BasicStor::bsExportPlaylistClose($res['token']);
|
||||
$this->trLog("upload2Hub end copy: ".strftime("%H:%M:%S"));
|
||||
$res = $this->gb->bsExportPlaylistClose($res['token']);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
@ -372,10 +372,10 @@ class Transport
|
|||
}
|
||||
break;
|
||||
default:
|
||||
return PEAR::raiseError("Transport::uploadToHub: ftype not supported ($ftype)");
|
||||
return PEAR::raiseError("Transport::upload2Hub: ftype not supported ($ftype)");
|
||||
}
|
||||
$this->startCronJobProcess($trec->trtok);
|
||||
$this->trLog("uploadToHub end: ".strftime("%H:%M:%S"));
|
||||
$this->trLog("upload2Hub end: ".strftime("%H:%M:%S"));
|
||||
return $trec->trtok;
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array())
|
||||
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
|
||||
* CC criteria format (see localSearch)
|
||||
* LS criteria format (see localSearch)
|
||||
* @param string $resultMode
|
||||
* 'php' | 'xmlrpc'
|
||||
* @param array $pars
|
||||
|
@ -422,7 +422,7 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function globalSearch($criteria, $resultMode='php', $pars=array())
|
||||
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
|
||||
* CC search result format (see localSearch)
|
||||
* LS search result format (see localSearch)
|
||||
*/
|
||||
public function getSearchResults($trtok, $andClose=TRUE)
|
||||
function getSearchResults($trtok, $andClose=TRUE)
|
||||
{
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
|
@ -491,7 +491,7 @@ class Transport
|
|||
$res = file_get_contents($row['localfile']);
|
||||
$results = unserialize($res);
|
||||
if ($andClose) {
|
||||
$ret = $this->xmlrpcCall('locstor.downloadClose',
|
||||
$ret = $this->xmlrpcCall('archive.downloadClose',
|
||||
array(
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'] ,
|
||||
|
@ -517,10 +517,10 @@ class Transport
|
|||
}
|
||||
|
||||
|
||||
/* ------------------------ methods for cc-archive-format file transports */
|
||||
/* ------------------------ methods for ls-archive-format file transports */
|
||||
/**
|
||||
* Open async file transfer from local storageServer to network hub,
|
||||
* file should be cc-archive-format file.
|
||||
* file should be ls-archive-format file.
|
||||
*
|
||||
* @param string $filePath
|
||||
* local path to uploaded file
|
||||
|
@ -529,11 +529,11 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function uploadFileAsync($filePath, $pars=array())
|
||||
function uploadFile2Hub($filePath, $pars=array())
|
||||
{
|
||||
if (!file_exists($filePath)) {
|
||||
return PEAR::raiseError(
|
||||
"Transport::uploadFileAsync: file not found ($filePath)"
|
||||
"Transport::uploadFile2Hub: 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 cc-archive-format file.
|
||||
* file should be ls-archive-format file.
|
||||
*
|
||||
* @param string $url
|
||||
* readable url
|
||||
|
@ -561,7 +561,7 @@ class Transport
|
|||
* trtok: string - transport token
|
||||
* localfile: string - filepath of downloaded file
|
||||
*/
|
||||
public function downloadFileFromHub($url, $chsum=NULL, $size=NULL, $pars=array())
|
||||
function downloadFileFromHub($url, $chsum=NULL, $size=NULL, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$tmpn = tempnam($CC_CONFIG['transDir'], 'HITrans_');
|
||||
|
@ -588,9 +588,9 @@ class Transport
|
|||
* array of structs/hasharrays with fields:
|
||||
* trtok: string transport token
|
||||
*/
|
||||
public function getHubInitiatedTransfers()
|
||||
function getHubInitiatedTransfers()
|
||||
{
|
||||
$ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers',
|
||||
$ret = $this->xmlrpcCall('archive.listHubInitiatedTransfers',
|
||||
array('target' => HOSTNAME));
|
||||
if (PEAR::isError($ret)) {
|
||||
return $ret;
|
||||
|
@ -614,9 +614,9 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function startHubInitiatedTransfer($uid, $rtrtok)
|
||||
function startHubInitiatedTransfer($uid, $rtrtok)
|
||||
{
|
||||
$ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers',
|
||||
$ret = $this->xmlrpcCall('archive.listHubInitiatedTransfers',
|
||||
array(
|
||||
'target' => HOSTNAME,
|
||||
'trtok' => $rtrtok,
|
||||
|
@ -640,7 +640,7 @@ class Transport
|
|||
case "audioclip":
|
||||
case "playlist":
|
||||
case "playlistPkg":
|
||||
$trtok = $this->uploadToHub($gunid, TRUE,
|
||||
$trtok = $this->upload2Hub($gunid, TRUE,
|
||||
array('rtrtok'=>$rtrtok));
|
||||
if (PEAR::isError($trtok)) {
|
||||
return $trtok;
|
||||
|
@ -690,7 +690,7 @@ class Transport
|
|||
"Transport::startHubInitiatedTransfer: ???"
|
||||
);
|
||||
}
|
||||
$ret = $this->xmlrpcCall('locstor.setHubInitiatedTransfer',
|
||||
$ret = $this->xmlrpcCall('archive.setHubInitiatedTransfer',
|
||||
array(
|
||||
'target' => HOSTNAME,
|
||||
'trtok' => $rtrtok,
|
||||
|
@ -713,10 +713,10 @@ class Transport
|
|||
* @return string
|
||||
* sessid or error
|
||||
*/
|
||||
public function loginToArchive()
|
||||
function loginToArchive()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$res = $this->xmlrpcCall('locstor.login',
|
||||
$res = $this->xmlrpcCall('archive.login',
|
||||
array(
|
||||
'login' => $CC_CONFIG['archiveAccountLogin'],
|
||||
'pass' => $CC_CONFIG['archiveAccountPass']
|
||||
|
@ -736,9 +736,9 @@ class Transport
|
|||
* @return string
|
||||
* Bye or error
|
||||
*/
|
||||
public function logoutFromArchive($sessid)
|
||||
function logoutFromArchive($sessid)
|
||||
{
|
||||
$res = $this->xmlrpcCall('locstor.logout',
|
||||
$res = $this->xmlrpcCall('archive.logout',
|
||||
array('sessid'=>$sessid));
|
||||
return $res;
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ class Transport
|
|||
* @return boolean
|
||||
* TRUE
|
||||
*/
|
||||
public function cronMain($direction=NULL)
|
||||
function cronMain($direction=NULL)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
if (is_null($direction)) {
|
||||
|
@ -799,7 +799,7 @@ class Transport
|
|||
* @return boolean
|
||||
* status
|
||||
*/
|
||||
public function startCronJobProcess($trtok)
|
||||
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
|
||||
*/
|
||||
public function cronCallMethod($trtok)
|
||||
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:
|
||||
$methodName = "cron";
|
||||
$mname = "cron";
|
||||
if (isset($directions[$row['direction']])) {
|
||||
$methodName .= ucfirst($directions[$row['direction']]);
|
||||
$mname .= ucfirst($directions[$row['direction']]);
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
"Transport::cronCallMethod: invalid direction ({$row['direction']})"
|
||||
);
|
||||
}
|
||||
if (isset($states[$state])) {
|
||||
$methodName .= ucfirst($states[$state]);
|
||||
$mname .= 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();
|
||||
$pr = new Prefs($this->gb);
|
||||
$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, $methodName)) {
|
||||
if (method_exists($this, $mname)) {
|
||||
// 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): $methodName($trtok) >");
|
||||
$this->trLog("cronCallMethod($pid): $mname($trtok) >");
|
||||
}
|
||||
$ret = call_user_func(array($this, $methodName), $row, $asessid);
|
||||
$ret = call_user_func(array($this, $mname), $row, $asessid);
|
||||
if (PEAR::isError($ret)) {
|
||||
$trec->setLock(FALSE);
|
||||
return $this->_failFatal($ret, $trec);
|
||||
}
|
||||
if (TR_LOG_LEVEL > 2) {
|
||||
$this->trLog("cronCallMethod($pid): $methodName($trtok) <");
|
||||
$this->trLog("cronCallMethod($pid): $mname($trtok) <");
|
||||
}
|
||||
// unlock the job:
|
||||
$r = $trec->setLock(FALSE);
|
||||
|
@ -938,7 +938,7 @@ class Transport
|
|||
return $ret;
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
"Transport::cronCallMethod: unknown method ($methodName)"
|
||||
"Transport::cronCallMethod: unknown method ($mname)"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -955,14 +955,14 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
public function cronUploadInit($row, $asessid)
|
||||
function cronUploadInit($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
return $trec;
|
||||
}
|
||||
$ret = $this->xmlrpcCall('locstor.uploadOpen',
|
||||
$ret = $this->xmlrpcCall('archive.uploadOpen',
|
||||
array(
|
||||
'sessid' => $asessid ,
|
||||
'chsum' => $row['expectedsum'],
|
||||
|
@ -989,7 +989,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
public function cronDownloadInit($row, $asessid)
|
||||
function cronDownloadInit($row, $asessid)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$trtok = $row['trtok'];
|
||||
|
@ -997,7 +997,7 @@ class Transport
|
|||
if (PEAR::isError($trec)) {
|
||||
return $trec;
|
||||
}
|
||||
$ret = $this->xmlrpcCall('locstor.downloadOpen',
|
||||
$ret = $this->xmlrpcCall('archive.downloadOpen',
|
||||
array(
|
||||
'sessid'=> $asessid,
|
||||
'trtype'=> $row['trtype'],
|
||||
|
@ -1061,7 +1061,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
public function cronUploadWaiting($row, $asessid)
|
||||
function cronUploadWaiting($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
$check = $this->uploadCheck($row['pdtoken']);
|
||||
|
@ -1137,7 +1137,7 @@ class Transport
|
|||
}
|
||||
} else {
|
||||
// wrong md5 at finish - TODO: start again
|
||||
// $this->xmlrpcCall('locstor.uploadReset', array());
|
||||
// $this->xmlrpcCall('archive.uploadReset', array());
|
||||
$trec->fail('file uploaded with bad md5');
|
||||
return PEAR::raiseError("Transport::cronUploadWaiting:".
|
||||
" file uploaded with bad md5 ".
|
||||
|
@ -1165,7 +1165,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
public function cronDownloadWaiting($row, $asessid)
|
||||
function cronDownloadWaiting($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
// wget the file
|
||||
|
@ -1212,7 +1212,7 @@ class Transport
|
|||
return $r;
|
||||
}
|
||||
} elseif ($size >= $row['expectedsize']) {
|
||||
$chsum = md5_file($row['localfile']);
|
||||
$chsum = $this->_chsum($row['localfile']);
|
||||
if ($chsum == $row['expectedsum']) {
|
||||
// mark download as finished
|
||||
$r = $trec->setState('finished',
|
||||
|
@ -1240,10 +1240,11 @@ class Transport
|
|||
* @param array $row
|
||||
* row from getTransport results
|
||||
* @param string $asessid
|
||||
* session id from remote storage
|
||||
* @return TRUE|PEAR_Error
|
||||
* session id (from network hub)
|
||||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
public function cronUploadFinished($row, $asessid)
|
||||
function cronUploadFinished($row, $asessid)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$trtok = $row['trtok'];
|
||||
|
@ -1281,13 +1282,13 @@ class Transport
|
|||
} else {
|
||||
$mdpdtoken = NULL;
|
||||
}
|
||||
$ret = $this->xmlrpcCall('locstor.uploadClose',
|
||||
$ret = $this->xmlrpcCall('archive.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,
|
||||
),
|
||||
));
|
||||
|
@ -1301,12 +1302,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 {
|
||||
|
@ -1352,7 +1353,7 @@ class Transport
|
|||
* @return mixed
|
||||
* boolean TRUE or error object
|
||||
*/
|
||||
public function cronDownloadFinished($row, $asessid)
|
||||
function cronDownloadFinished($row, $asessid)
|
||||
{
|
||||
$trtok = $row['trtok'];
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
|
@ -1395,13 +1396,13 @@ class Transport
|
|||
"gunid" => $row['gunid'],
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
$storedFile = $this->gb->bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
$mdtrec->setLock(FALSE);
|
||||
return $storedFile;
|
||||
}
|
||||
$res = $storedFile->getId();
|
||||
$ret = $this->xmlrpcCall('locstor.downloadClose',
|
||||
$ret = $this->xmlrpcCall('archive.downloadClose',
|
||||
array(
|
||||
'token' => $mdtrec->row['pdtoken'] ,
|
||||
'trtype' => 'metadata' ,
|
||||
|
@ -1432,13 +1433,13 @@ class Transport
|
|||
break;
|
||||
case "metadata":
|
||||
case "searchjob":
|
||||
// don't close - getSearchResults should close it
|
||||
return TRUE;
|
||||
return TRUE; // don't close - getSearchResults should close it
|
||||
break;
|
||||
}
|
||||
$ret = $this->xmlrpcCall('locstor.downloadClose',
|
||||
$ret = $this->xmlrpcCall('archive.downloadClose',
|
||||
array(
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'] ,
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'] ,
|
||||
));
|
||||
if (PEAR::isError($ret)) {
|
||||
return $ret;
|
||||
|
@ -1455,7 +1456,7 @@ class Transport
|
|||
"gunid" => $row['gunid'],
|
||||
"filetype" => "playlist"
|
||||
);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
$storedFile = $this->gb->bsPutFile($parid, $values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
return $storedFile;
|
||||
}
|
||||
|
@ -1484,11 +1485,11 @@ class Transport
|
|||
return PEAR::raiseError("DEBUG: NotImpl ".var_export($row,TRUE));
|
||||
}
|
||||
if (!is_null($rtrtok = $trec->row['rtrtok'])) {
|
||||
$ret = $this->xmlrpcCall('locstor.setHubInitiatedTransfer',
|
||||
$ret = $this->xmlrpcCall('archive.setHubInitiatedTransfer',
|
||||
array(
|
||||
'target' => HOSTNAME,
|
||||
'trtok' => $rtrtok,
|
||||
'state' => 'closed',
|
||||
'target' => HOSTNAME,
|
||||
'trtok' => $rtrtok,
|
||||
'state' => 'closed',
|
||||
));
|
||||
if (PEAR::isError($ret)) {
|
||||
return $ret;
|
||||
|
@ -1512,11 +1513,11 @@ class Transport
|
|||
* transport type
|
||||
* @param array $pars
|
||||
* default parameters (optional, internal use)
|
||||
* @return TransportRecord
|
||||
* @return object - transportRecord instance
|
||||
*/
|
||||
private function _uploadGeneralFileToHub($fpath, $trtype, $pars=array())
|
||||
function _uploadGeneralFileToHub($fpath, $trtype, $pars=array())
|
||||
{
|
||||
$chsum = md5_file($fpath);
|
||||
$chsum = $this->_chsum($fpath);
|
||||
$size = filesize($fpath);
|
||||
$trec = TransportRecord::create($this, $trtype, 'up',
|
||||
array_merge(array(
|
||||
|
@ -1537,7 +1538,7 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
public function _createTransportToken()
|
||||
function _createTransportToken()
|
||||
{
|
||||
$ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '');
|
||||
$initString = microtime().$ip.rand()."org.mdlf.campcaster";
|
||||
|
@ -1559,7 +1560,7 @@ class Transport
|
|||
* @return array
|
||||
* array of transportRecords (as hasharrays)
|
||||
*/
|
||||
public function getTransports($direction=NULL, $target=NULL, $trtok=NULL)
|
||||
function getTransports($direction=NULL, $target=NULL, $trtok=NULL)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
switch ($direction) {
|
||||
|
@ -1613,9 +1614,9 @@ class Transport
|
|||
* @return array
|
||||
* hash: chsum, size, url
|
||||
*/
|
||||
public function uploadCheck($pdtoken)
|
||||
function uploadCheck($pdtoken)
|
||||
{
|
||||
$ret = $this->xmlrpcCall('locstor.uploadCheck',
|
||||
$ret = $this->xmlrpcCall('archive.uploadCheck',
|
||||
array('token'=>$pdtoken));
|
||||
return $ret;
|
||||
}
|
||||
|
@ -1627,9 +1628,9 @@ class Transport
|
|||
* @return string
|
||||
* network hub response or error object
|
||||
*/
|
||||
public function pingToArchive()
|
||||
function pingToArchive()
|
||||
{
|
||||
$res = $this->xmlrpcCall('locstor.ping',
|
||||
$res = $this->xmlrpcCall('archive.ping',
|
||||
array('par'=>'ping_'.date('H:i:s')));
|
||||
return $res;
|
||||
}
|
||||
|
@ -1645,7 +1646,7 @@ class Transport
|
|||
* @return mixed
|
||||
* response
|
||||
*/
|
||||
public function xmlrpcCall($method, $pars=array())
|
||||
function xmlrpcCall($method, $pars=array())
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$xrp = XML_RPC_encode($pars);
|
||||
|
@ -1654,11 +1655,13 @@ class Transport
|
|||
$CC_CONFIG['archiveUrlHost'], $CC_CONFIG['archiveUrlPort']
|
||||
);
|
||||
$f = new XML_RPC_Message($method, array($xrp));
|
||||
$r = $c->send($f, 30);
|
||||
$r = $c->send($f);
|
||||
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);
|
||||
|
@ -1666,6 +1669,20 @@ 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
|
||||
*
|
||||
|
@ -1675,7 +1692,7 @@ class Transport
|
|||
* transport record object
|
||||
* @return unknown
|
||||
*/
|
||||
private function _failFatal($res, $trec)
|
||||
function _failFatal($res, $trec)
|
||||
{
|
||||
if (PEAR::isError($res)) {
|
||||
switch ($res->getCode()) {
|
||||
|
@ -1700,7 +1717,7 @@ class Transport
|
|||
* if true, delete non-closed jobs too
|
||||
* @return boolean true or error
|
||||
*/
|
||||
public function _cleanUp($interval='1 minute'/*'1 hour'*/, $forced=FALSE)
|
||||
function _cleanUp($interval='1 minute'/*'1 hour'*/, $forced=FALSE)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$cond = ($forced ? '' : " AND state='closed' AND lock = 'N'");
|
||||
|
@ -1726,7 +1743,7 @@ class Transport
|
|||
* @return mixed
|
||||
* void or error object
|
||||
*/
|
||||
public function trLogPear($txt, $eo, $row=NULL)
|
||||
function trLogPear($txt, $eo, $row=NULL)
|
||||
{
|
||||
$msg = $txt.$eo->getMessage()." ".$eo->getUserInfo().
|
||||
" [".$eo->getCode()."]";
|
||||
|
@ -1749,7 +1766,7 @@ class Transport
|
|||
* @return mixed
|
||||
* void or error object
|
||||
*/
|
||||
public function trLog($msg)
|
||||
function trLog($msg)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$logfile = $CC_CONFIG['transDir']."/activity.log";
|
||||
|
@ -1772,12 +1789,93 @@ class Transport
|
|||
* @return mixed
|
||||
* void or error object
|
||||
*/
|
||||
public function resetData()
|
||||
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");
|
||||
// }
|
||||
}
|
||||
|
||||
?>
|
|
@ -70,7 +70,7 @@ class TransportRecord
|
|||
* default parameters (optional, internal use)
|
||||
* @return TransportRecord
|
||||
*/
|
||||
public static function create(&$tr, $trtype, $direction='up', $defaults=array())
|
||||
function create(&$tr, $trtype, $direction='up', $defaults=array())
|
||||
{
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
$trec = new TransportRecord($tr);
|
||||
|
@ -394,7 +394,7 @@ class TransportRecord
|
|||
case "playlist":
|
||||
case "playlistPkg":
|
||||
case "metadata":
|
||||
$title = BasicStor::bsGetTitle(NULL, $this->row['gunid']);
|
||||
$title = $this->gb->bsGetTitle(NULL, $this->row['gunid']);
|
||||
if (is_null($title)) {
|
||||
$title = $defStr;
|
||||
}
|
||||
|
|
|
@ -69,8 +69,8 @@ $CC_CONFIG = array(
|
|||
'storageUrlPort' => 80,
|
||||
|
||||
/* ================================================ archive configuration */
|
||||
'archiveUrlPath' => '/campcasterStorageServer',
|
||||
'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
|
||||
'archiveUrlPath' => '/campcasterArchiveServer',
|
||||
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
|
||||
'archiveUrlHost' => 'localhost',
|
||||
'archiveUrlPort' => 80,
|
||||
'archiveAccountLogin' => 'root',
|
||||
|
|
|
@ -70,8 +70,8 @@ $CC_CONFIG = array(
|
|||
'storageUrlPort' => ls_php_port,
|
||||
|
||||
/* ================================================ archive configuration */
|
||||
'archiveUrlPath' => 'ls_storageUrlPath',
|
||||
'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
|
||||
'archiveUrlPath' => 'ls_archiveUrlPath',
|
||||
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
|
||||
'archiveUrlHost' => 'ls_php_host',
|
||||
'archiveUrlPort' => ls_php_port,
|
||||
'archiveAccountLogin' => 'root',
|
||||
|
|
|
@ -43,8 +43,8 @@ $CC_CONFIG = array(
|
|||
'storageUrlPort' => ls_php_port,
|
||||
|
||||
/* ================================================ archive configuration */
|
||||
'archiveUrlPath' => 'ls_storageUrlPath',
|
||||
'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
|
||||
'archiveUrlPath' => 'ls_archiveUrlPath',
|
||||
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
|
||||
'archiveUrlHost' => 'ls_php_host',
|
||||
'archiveUrlPort' => ls_php_port,
|
||||
'archiveAccountLogin' => 'root',
|
||||
|
|
|
@ -26,13 +26,16 @@ 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);
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Paul Baranowski <paul@paulbaranowski.org>
|
||||
* @version $Revision: 2834 $
|
||||
* @package Campcaster
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2006 MDLF, Inc.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @link http://www.campware.org
|
||||
*
|
||||
*/
|
||||
|
||||
// Do not allow remote execution
|
||||
$arr = array_diff_assoc($_SERVER, $_ENV);
|
||||
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
||||
header("HTTP/1.1 400");
|
||||
header("Content-type: text/plain; charset=UTF-8");
|
||||
echo "400 Not executable\r\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "*********************************************\n";
|
||||
echo "* StorageServer Upgrade from 1.2.X to 1.3.0 *\n";
|
||||
echo "*********************************************\n";
|
||||
|
||||
require_once(dirname(__FILE__).'/../../conf.php');
|
||||
require_once(dirname(__FILE__)."/../installInit.php");
|
||||
campcaster_db_connect();
|
||||
require_once(dirname(__FILE__)."/../../StoredFile.php");
|
||||
|
||||
// Move audio clips from the archive to the local storage
|
||||
|
||||
echo "*******************************************\n";
|
||||
echo "* StorageServer Upgrade to 1.3.0 Complete *\n";
|
||||
echo "*******************************************\n";
|
||||
|
||||
?>
|
|
@ -47,7 +47,7 @@ $values = array(
|
|||
"gunid" => $gunid,
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = BasicStor::bsPutFile($parid, $values);
|
||||
$storedFile = $gb->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->uploadToHub($gunid);
|
||||
$r = $gb->upload2Hub($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 CC Archive format
|
||||
* Open writable URL for import playlist in LS 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 CC Archive format
|
||||
* Open writable URL for import playlist in LS Archive format
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.importPlaylistClose".
|
||||
*
|
||||
|
@ -2455,10 +2455,11 @@ class XR_LocStor extends LocStor {
|
|||
" ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
$xv = new XML_RPC_Value();
|
||||
# return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
$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'])
|
||||
|
@ -2569,7 +2570,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->loadPref($r['sessid'], $r['key']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2622,7 +2623,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->savePref($r['sessid'], $r['key'], $r['value']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2674,7 +2675,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->delPref($r['sessid'], $r['key']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2728,7 +2729,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->loadGroupPref($r['sessid'], $r['group'], $r['key']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2786,7 +2787,7 @@ class XR_LocStor extends LocStor {
|
|||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Prefs.php');
|
||||
$pr = new Prefs();
|
||||
$pr = new Prefs($this);
|
||||
$res = $pr->saveGroupPref($r['sessid'], $r['group'], $r['key'], $r['value']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
|
@ -2965,12 +2966,12 @@ class XR_LocStor extends LocStor {
|
|||
return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res)));
|
||||
}
|
||||
|
||||
/* ------------------------ methods for cc-archive-format file transports */
|
||||
/* ------------------------ methods for ls-archive-format file transports */
|
||||
/**
|
||||
* Open async file transfer from local storageServer to network hub,
|
||||
* file should be cc-archive-format file.
|
||||
* file should be ls-archive-format file.
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.uploadFileAsync".
|
||||
* The XML-RPC name of this method is "locstor.uploadFile2Hub".
|
||||
*
|
||||
* The input parameters are an XML-RPC struct with the following
|
||||
* fields:
|
||||
|
@ -2990,7 +2991,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_uploadFileAsync:
|
||||
* <li> 805 - xr_uploadFile2Hub:
|
||||
* <message from lower layer> </li>
|
||||
* <li> 848 - invalid session id.</li>
|
||||
* <li> 872 - invalid tranport token.</li>
|
||||
|
@ -2998,9 +2999,9 @@ class XR_LocStor extends LocStor {
|
|||
*
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
* @see Transport::uploadFileAsync
|
||||
* @see Transport::uploadFile2Hub
|
||||
*/
|
||||
public function xr_uploadFileAsync($input)
|
||||
public function xr_uploadFile2Hub($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
|
@ -3008,12 +3009,13 @@ class XR_LocStor extends LocStor {
|
|||
}
|
||||
require_once('../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->uploadFileAsync($r['filePath']);
|
||||
$res = $tr->uploadFile2Hub($r['filePath']); // local files on XML-RPC :(
|
||||
// there should be something as uploadFile2storageServer
|
||||
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_uploadFileAsync: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
"xr_uploadFile2Hub: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
|
@ -3132,7 +3134,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.uploadToHub".
|
||||
* The XML-RPC name of this method is "locstor.upload2Hub".
|
||||
*
|
||||
* The input parameters are an XML-RPC struct with the following
|
||||
* fields:
|
||||
|
@ -3153,7 +3155,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_uploadToHub:
|
||||
* <li> 805 - xr_upload2Hub:
|
||||
* <message from lower layer> </li>
|
||||
* <li> 848 - invalid session id.</li>
|
||||
* <li> 872 - invalid tranport token.</li>
|
||||
|
@ -3161,9 +3163,9 @@ class XR_LocStor extends LocStor {
|
|||
*
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
* @see Transport::uploadToHub
|
||||
* @see Transport::upload2Hub
|
||||
*/
|
||||
public function xr_uploadToHub($input)
|
||||
public function xr_upload2Hub($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
|
@ -3171,12 +3173,12 @@ class XR_LocStor extends LocStor {
|
|||
}
|
||||
require_once('../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->uploadToHub($r['gunid']);
|
||||
$res = $tr->upload2Hub($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_uploadToHub: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
"xr_upload2Hub: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
|
@ -3246,7 +3248,7 @@ class XR_LocStor extends LocStor {
|
|||
* fields:
|
||||
* <ul>
|
||||
* <li> sessid : string - session id </li>
|
||||
* <li> criteria : hash, CC criteria format - see searchMetadata method
|
||||
* <li> criteria : hash, LS criteria format - see searchMetadata method
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
|
@ -3560,7 +3562,7 @@ class XR_LocStor extends LocStor {
|
|||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = BasicStor::bsOpenPut();
|
||||
$res = $this->bsOpenPut();
|
||||
if (PEAR::isError($res)) {
|
||||
return new XML_RPC_Response(0, 805,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
|
@ -3582,7 +3584,7 @@ class XR_LocStor extends LocStor {
|
|||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = BasicStor::bsClosePut($r['token'], $r['chsum']);
|
||||
$res = $this->bsClosePut($r['token'], $r['chsum']);
|
||||
if (PEAR::isError($res)) {
|
||||
return new XML_RPC_Response(0, 805,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
|
@ -3594,204 +3596,6 @@ class XR_LocStor extends LocStor {
|
|||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple ping method - return strtouppered string
|
||||
*
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_ping($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = date("Ymd-H:i:s")." Network hub answer: {$r['par']}";
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_uploadOpen($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->uploadOpen($r['sessid'], $r['chsum']);
|
||||
if (PEAR::isError($res))
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_uploadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check state of file upload
|
||||
*
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_uploadCheck($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->uploadCheck($r['token']);
|
||||
if (PEAR::isError($res))
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_uploadCheck: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_uploadClose($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->uploadClose($r['token'], $r['trtype'], $r['pars']);
|
||||
if (PEAR::isError($res)) {
|
||||
$code = 803;
|
||||
// Special case for duplicate file - give back
|
||||
// different error code so we can display nice user message.
|
||||
if ($res->getCode() == GBERR_GUNID) {
|
||||
$code = 888;
|
||||
}
|
||||
return new XML_RPC_Response(0, $code,
|
||||
"xr_uploadClose: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_downloadOpen($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->downloadOpen($r['sessid'], $r['trtype'], $r['pars']);
|
||||
if (PEAR::isError($res))
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_downloadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_downloadClose($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->downloadClose($r['token'], $r['trtype']);
|
||||
if (PEAR::isError($res))
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_downloadClose: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_prepareHubInitiatedTransfer($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
foreach (array('trtype'=>NULL, 'direction'=>'up', 'pars'=>array()) as $k => $dv) {
|
||||
if (!isset($r[$k])) {
|
||||
$r[$k] = $dv;
|
||||
}
|
||||
}
|
||||
$res = $this->prepareHubInitiatedTransfer(
|
||||
$r['target'], $r['trtype'], $r['direction'], $r['pars']);
|
||||
if (PEAR::isError($res))
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_prepareHubInitiatedTransfer: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_listHubInitiatedTransfers($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
foreach (array('target'=>NULL, 'direction'=>NULL, 'trtok'=>NULL) as $k=>$dv) {
|
||||
if (!isset($r[$k])) {
|
||||
$r[$k] = $dv;
|
||||
}
|
||||
}
|
||||
$res = $this->listHubInitiatedTransfers(
|
||||
$r['target'], $r['direction'], $r['trtok']);
|
||||
if (PEAR::isError($res))
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_listHubInitiatedTransfers: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_setHubInitiatedTransfer($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = $this->setHubInitiatedTransfer(
|
||||
$r['target'], $r['trtok'], $r['state']);
|
||||
if (PEAR::isError($res))
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_setHubInitiatedTransfer: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
/* ==================================================== "private" methods */
|
||||
/**
|
||||
* Check and convert struct of parameters
|
||||
|
|
|
@ -90,7 +90,7 @@ switch ($ftype) {
|
|||
readfile($realFname);
|
||||
break;
|
||||
case "webstream":
|
||||
$url = BasicStor::bsGetMetadataValue($lid, 'ls:url');
|
||||
$url = $locStor->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 = BasicStor::bsGetMetadata($ac->getId(), $sessid);
|
||||
// $md = $locStor->bsGetMetadata($ac->getId(), $sessid);
|
||||
$md = $locStor->getAudioClip($sessid, $gunid);
|
||||
// header("Content-type: text/xml");
|
||||
header("Content-type: application/smil");
|
||||
|
|
|
@ -64,118 +64,97 @@ $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|||
$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.',
|
||||
'storeWebstream' => 'Store audio stream identified by URL',
|
||||
'openPut' => 'openPut',
|
||||
'closePut' => 'closePut',
|
||||
|
||||
// Modify files in local storage
|
||||
'deleteAudioClip' => 'Delete an existing Audio clip.',
|
||||
'test' => 'Tests toupper and checks sessid, params: '.
|
||||
'teststring, sessid.',
|
||||
'getVersion' => 'Dummy function for connection testing.',
|
||||
'authenticate' => 'Checks authentication.',
|
||||
'login' => 'Login to storage.',
|
||||
'logout' => 'Logout from storage.',
|
||||
'existsAudioClip' => 'Checks if an Audio clip with the specified '.
|
||||
'id is stored in 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',
|
||||
'openPut' => 'openPut',
|
||||
'closePut' => 'closePut',
|
||||
'deleteAudioClip' => 'Delete an existing Audio clip.',
|
||||
'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '.
|
||||
'stored in Local storage.',
|
||||
'resetStorage' => 'Reset storageServer for debugging.',
|
||||
'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',
|
||||
'createPlaylist' => 'Create a new Playlist metafile.',
|
||||
'editPlaylist' => 'Open a Playlist metafile for editing.',
|
||||
'savePlaylist' => 'Save a Playlist metafile.',
|
||||
'revertEditedPlaylist' => 'RollBack playlist changes to the locked state.',
|
||||
'deletePlaylist' => 'Delete a Playlist metafile.',
|
||||
'accessPlaylist' => 'Open readable URL to a Playlist metafile.',
|
||||
'releasePlaylist' => 'Release readable URL from accessPlaylist.',
|
||||
'existsPlaylist' => 'Check whether a Playlist exists.',
|
||||
'playlistIsAvailable' => 'Check whether a Playlist is available '.
|
||||
'for editing.',
|
||||
'exportPlaylistOpen' => 'Create a tarfile with playlist export.',
|
||||
'exportPlaylistClose' => 'Close playlist export.',
|
||||
'importPlaylistOpen' => 'Open writable handle for playlist import.',
|
||||
'importPlaylistClose' => 'Close import-handle and import playlist.',
|
||||
|
||||
// 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.',
|
||||
'revertEditedPlaylist' => 'RollBack playlist changes to the locked state.',
|
||||
'deletePlaylist' => 'Delete a Playlist metafile.',
|
||||
'accessPlaylist' => 'Open readable URL to a Playlist metafile.',
|
||||
'releasePlaylist' => 'Release readable URL from accessPlaylist.',
|
||||
'existsPlaylist' => 'Check whether a Playlist exists.',
|
||||
'playlistIsAvailable' => 'Check whether a Playlist is available '.
|
||||
'for editing.',
|
||||
'exportPlaylistOpen' => 'Create a tarfile with playlist export.',
|
||||
'exportPlaylistClose' => 'Close playlist export.',
|
||||
'importPlaylistOpen' => 'Open writable handle for playlist import.',
|
||||
'importPlaylistClose' => 'Close import-handle and import playlist.',
|
||||
|
||||
'renderPlaylistToFileOpen' => 'Render playlist to ogg file (open handle)',
|
||||
'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)',
|
||||
'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)',
|
||||
|
||||
'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)',
|
||||
'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.',
|
||||
'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',
|
||||
|
||||
);
|
||||
|
||||
$defs = array();
|
||||
foreach ($methods as $method => $description) {
|
||||
$defs["locstor.$method"] = array(
|
||||
"function" => array(&$locStor, "xr_$method"),
|
||||
# "function" => "\$GLOBALS['locStor']->xr_$method",
|
||||
"signature" => array(
|
||||
array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct'])
|
||||
),
|
||||
|
|
|
@ -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')),
|
||||
"uploadFileAsync" => array('m'=>"locstor.uploadFileAsync",
|
||||
"uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub",
|
||||
'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()),
|
||||
"uploadToHub" => array('m'=>"locstor.uploadToHub",
|
||||
"upload2Hub" => array('m'=>"locstor.upload2Hub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"downloadFromHub" => array('m'=>"locstor.downloadFromHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
|
@ -221,10 +221,8 @@ $infos = array(
|
|||
'p'=>array('sessid', 'gunid'), 'r'=>'trtok'),
|
||||
*/
|
||||
|
||||
"openPut" => array('m'=>"locstor.openPut", 'p'=>array()),
|
||||
"closePut" => array('m'=>"locstor.closePut", 'p'=>array()),
|
||||
"ping" => array('m'=>"locstor.ping", 'p'=>array('par')),
|
||||
|
||||
"openPut" => array('m'=>"locstor.openPut", 'p'=>array()),
|
||||
"closePut" => array('m'=>"locstor.closePut", 'p'=>array()),
|
||||
);
|
||||
|
||||
|
||||
|
@ -276,12 +274,9 @@ switch ($method) {
|
|||
} elseif(count($pinfo) == 0) {
|
||||
$parr = (object)array();
|
||||
} else {
|
||||
$parr = array();
|
||||
$i = 0;
|
||||
foreach($pinfo as $it) {
|
||||
if (isset($pars[$i])) {
|
||||
$parr[$it] = $pars[$i];
|
||||
}
|
||||
$parr = array(); $i=0;
|
||||
foreach($pinfo as $it){
|
||||
if(isset($pars[$i])) $parr[$it] = $pars[$i];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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')),
|
||||
"uploadFileAsync" => array('m'=>"locstor.uploadFileAsync",
|
||||
"uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub",
|
||||
'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()),
|
||||
"uploadToHub" => array('m'=>"locstor.uploadToHub",
|
||||
"upload2Hub" => array('m'=>"locstor.upload2Hub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"downloadFromHub" => array('m'=>"locstor.downloadFromHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
|
@ -213,23 +213,8 @@ if (isset($_REQUEST['go_button'])) {
|
|||
$methodParams = $methodDefs[$f_selectedMethod]['p'];
|
||||
foreach ($methodParams as $methodParamName) {
|
||||
$inputParamName = "param_".$methodParamName;
|
||||
if ($methodParamName == "criteria") {
|
||||
$catInputName = $inputParamName."_condition_cat";
|
||||
$valInputName = $inputParamName."_condition_val";
|
||||
$conditions = array();
|
||||
$conditions[0]["cat"] = $_REQUEST[$catInputName];
|
||||
$conditions[0]["op"] = "=";
|
||||
$conditions[0]["val"] = $_REQUEST[$valInputName];
|
||||
$criteriaArray = array(
|
||||
"filetype" => "audioclip",
|
||||
"conditions" => $conditions);
|
||||
$xmlParameters[$methodParamName] = $criteriaArray;
|
||||
$_SESSION[$catInputName] = $_REQUEST[$catInputName];
|
||||
$_SESSION[$valInputName] = $_REQUEST[$valInputName];
|
||||
} else {
|
||||
$xmlParameters[$methodParamName] = $_REQUEST[$inputParamName];
|
||||
$_SESSION[$inputParamName] = $_REQUEST[$inputParamName];
|
||||
}
|
||||
$xmlParameters[$methodParamName] = $_REQUEST[$inputParamName];
|
||||
$_SESSION[$inputParamName] = $_REQUEST[$inputParamName];
|
||||
}
|
||||
|
||||
// Create the XML-RPC message
|
||||
|
@ -245,11 +230,6 @@ if (isset($_REQUEST['go_button'])) {
|
|||
// If successful
|
||||
$xmlResponse = XML_RPC_decode($sendResult->value());
|
||||
|
||||
if (isset($xmlResponse['token'])) {
|
||||
$_SESSION['xmlrpc_token'] = $xmlResponse['token'];
|
||||
$errorMsg .= "<br>*** Token saved<br>";
|
||||
}
|
||||
|
||||
// Special case state handling
|
||||
switch ($f_selectedMethod) {
|
||||
case "login":
|
||||
|
@ -262,6 +242,7 @@ if (isset($_REQUEST['go_button'])) {
|
|||
unset($_SESSION['xmlrpc_session_id']);
|
||||
break;
|
||||
case "storeAudioClipOpen":
|
||||
$_SESSION['xmlrpc_token'] = $xmlResponse['token'];
|
||||
$_SESSION['xmlrpc_put_url'] = $xmlResponse['url'];
|
||||
break;
|
||||
}
|
||||
|
@ -341,46 +322,17 @@ if (!is_array($methodParams) || count($methodParams) == 0) {
|
|||
} else {
|
||||
echo "<table cellpadding=3>";
|
||||
foreach ($methodParams as $methodParamName) {
|
||||
// Get the value for the field
|
||||
$value = "";
|
||||
if ($methodParamName == "sessid" && isset($_SESSION['xmlrpc_session_id'])) {
|
||||
$value = $_SESSION['xmlrpc_session_id'];
|
||||
} elseif ($methodParamName == "token" && isset($_SESSION['xmlrpc_token'])) {
|
||||
$value = $_SESSION['xmlrpc_token'];
|
||||
} elseif ($methodParamName == "criteria") {
|
||||
$value_cond_cat = $_SESSION["param_".$methodParamName."_condition_cat"];
|
||||
$value_cond_val = $_SESSION["param_".$methodParamName."_condition_val"];
|
||||
} elseif (isset($_SESSION["param_".$methodParamName])) {
|
||||
$value = $_SESSION["param_".$methodParamName];
|
||||
}
|
||||
|
||||
// Display the input boxes for the given field
|
||||
echo "<tr>";
|
||||
if ($methodParamName == "criteria") {
|
||||
?>
|
||||
<td><?php echo $methodParamName; ?></td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<select name="param_<?php echo $methodParamName; ?>_condition_cat">
|
||||
<option value="dc:creator" <?php if ($value_cond_cat == "dc:creator") { ?>selected<?php } ?>>artist</option>
|
||||
<option value="dc:source"<?php if ($value_cond_cat == "dc:source") { ?>selected<?php } ?>>album</option>
|
||||
<option value="dc:title" <?php if ($value_cond_cat == "dc:title") { ?>selected<?php } ?>>title</option>
|
||||
</select>
|
||||
<td>=</td>
|
||||
<td><INPUT type="text" name="param_<?php echo $methodParamName; ?>_condition_val" value="<?php echo $value_cond_val; ?>"><td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<td><?php echo $methodParamName; ?></td>
|
||||
<td><INPUT type="text" name="param_<?php echo $methodParamName; ?>" value="<?php echo $value; ?>"><td>
|
||||
<?php
|
||||
}
|
||||
echo "</tr>";
|
||||
echo "<td>$methodParamName</td>"; ?> <td><INPUT type="text" name="param_<?php echo $methodParamName; ?>" value="<?php echo $value; ?>"><td></tr>
|
||||
<?php
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue