Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
51436f76b8
|
@ -229,42 +229,42 @@ if (isset($_REQUEST['popup']) && is_array($_REQUEST['popup'])){
|
|||
case 'HUBBROWSE.getResults':
|
||||
//$HUBBROWSE = new uiHubBrowse($uiBrowser);
|
||||
|
||||
if (isset($_REQUEST['trtokid'])) {
|
||||
$Smarty->assign('trtokid', $_REQUEST['trtokid']);
|
||||
//if ($HUBBROWSE->getSearchResults($_REQUEST['trtokid'])) {
|
||||
if ($uiBrowser->HUBBROWSE->getSearchResults($_REQUEST['trtokid'])) {
|
||||
$Smarty->assign('results', true);
|
||||
} else {
|
||||
$Smarty->assign('results', false);
|
||||
}
|
||||
} else {
|
||||
//$Smarty->assign('trtokid', $HUBBROWSE->searchDB());
|
||||
$Smarty->assign('trtokid', $uiBrowser->HUBBROWSE->searchDB());
|
||||
$Smarty->assign('results', false);
|
||||
}
|
||||
$Smarty->assign('polling_frequency', UI_HUB_POLLING_FREQUENCY);
|
||||
$Smarty->assign('_prefix', 'HUBBROWSE');
|
||||
$Smarty->display('popup/HUB.getResults.tpl');
|
||||
// if (isset($_REQUEST['trtokid'])) {
|
||||
// $Smarty->assign('trtokid', $_REQUEST['trtokid']);
|
||||
// //if ($HUBBROWSE->getSearchResults($_REQUEST['trtokid'])) {
|
||||
// if ($uiBrowser->HUBBROWSE->getSearchResults($_REQUEST['trtokid'])) {
|
||||
// $Smarty->assign('results', true);
|
||||
// } else {
|
||||
// $Smarty->assign('results', false);
|
||||
// }
|
||||
// } else {
|
||||
// //$Smarty->assign('trtokid', $HUBBROWSE->searchDB());
|
||||
// $Smarty->assign('trtokid', $uiBrowser->HUBBROWSE->searchDB());
|
||||
// $Smarty->assign('results', false);
|
||||
// }
|
||||
// $Smarty->assign('polling_frequency', UI_HUB_POLLING_FREQUENCY);
|
||||
// $Smarty->assign('_prefix', 'HUBBROWSE');
|
||||
// $Smarty->display('popup/HUB.getResults.tpl');
|
||||
break;
|
||||
|
||||
case 'HUBSEARCH.getResults':
|
||||
if (isset($_REQUEST['trtokid']) && $_REQUEST['trtokid']) {
|
||||
$Smarty->assign('trtokid',$_REQUEST['trtokid']);
|
||||
$r = $uiBrowser->HUBSEARCH->getSearchResults($_REQUEST['trtokid'], FALSE);
|
||||
if ( PEAR::isError($r) && ($r->getCode() != TRERR_NOTFIN) ) {
|
||||
break;
|
||||
}
|
||||
if ($r) {
|
||||
$Smarty->assign('results',true);
|
||||
} else {
|
||||
$Smarty->assign('results',false);
|
||||
}
|
||||
} else {
|
||||
$Smarty->assign('trtok',true);
|
||||
}
|
||||
$Smarty->assign('polling_frequency',UI_HUB_POLLING_FREQUENCY);
|
||||
$Smarty->assign('_prefix','HUBSEARCH');
|
||||
$Smarty->display('popup/HUB.getResults.tpl');
|
||||
// if (isset($_REQUEST['trtokid']) && $_REQUEST['trtokid']) {
|
||||
// $Smarty->assign('trtokid',$_REQUEST['trtokid']);
|
||||
// $r = $uiBrowser->HUBSEARCH->getSearchResults($_REQUEST['trtokid'], FALSE);
|
||||
// if ( PEAR::isError($r) && ($r->getCode() != TRERR_NOTFIN) ) {
|
||||
// break;
|
||||
// }
|
||||
// if ($r) {
|
||||
// $Smarty->assign('results',true);
|
||||
// } else {
|
||||
// $Smarty->assign('results',false);
|
||||
// }
|
||||
// } else {
|
||||
// $Smarty->assign('trtok',true);
|
||||
// }
|
||||
// $Smarty->assign('polling_frequency',UI_HUB_POLLING_FREQUENCY);
|
||||
// $Smarty->assign('_prefix','HUBSEARCH');
|
||||
// $Smarty->display('popup/HUB.getResults.tpl');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -311,13 +311,11 @@ if ($uiBrowser->userid) {
|
|||
|
||||
case "addWebstreamData":
|
||||
case "addWebstreamMData":
|
||||
// $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
|
||||
$Smarty->assign('editItem', array('type' => 'webstream', 'id' => $_REQUEST['id'], 'folderId' => $uiBrowser->fid, 'curr_langid' => $_REQUEST['curr_langid']));
|
||||
break;
|
||||
|
||||
case "editItem":
|
||||
$uiBrowser->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
// $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
|
||||
$Smarty->assign('editItem', array('type' => $uiBrowser->type, 'id' => $_REQUEST['id'], 'folderId' => $uiBrowser->fid, 'curr_langid' => $_REQUEST['curr_langid']));
|
||||
break;
|
||||
|
||||
|
@ -327,22 +325,18 @@ if ($uiBrowser->userid) {
|
|||
break;
|
||||
|
||||
case "BROWSE":
|
||||
#echo '<XMP>uiBrowser->BROWSE->getResult():'; print_r($uiBrowser->BROWSE->getResult()); echo "</XMP>\n";
|
||||
$Smarty->assign('browseForm', $uiBrowser->BROWSE->browseForm($uiBrowser->id, $ui_fmask));
|
||||
$Smarty->assign('showLibrary', TRUE);
|
||||
break;
|
||||
|
||||
case "HUBSEARCH":
|
||||
#echo '<XMP>_REQUEST:'; print_r($_REQUEST); echo "</XMP>\n";
|
||||
#$Smarty->assign('searchForm', $uiBrowser->HUBSEARCH->searchForm($uiBrowser->id, $ui_fmask));
|
||||
$Smarty->assign('hubSearchForm', $uiBrowser->HUBSEARCH->searchForm($uiBrowser->id, $ui_fmask));
|
||||
$Smarty->assign('showLibrary', TRUE);
|
||||
$Smarty->assign('isHub', TRUE);
|
||||
$Smarty->assign('results', true);
|
||||
break;
|
||||
|
||||
case "HUBBROWSE":
|
||||
//$HUBBROWSE = new uiHubBrowse($uiBrowser);
|
||||
//$Smarty->assign('hubBrowseForm', $HUBBROWSE->browseForm($uiBrowser->id, $ui_fmask));
|
||||
$Smarty->assign('hubBrowseForm', $uiBrowser->HUBBROWSE->browseForm($uiBrowser->id, $ui_fmask));
|
||||
$Smarty->assign('showLibrary', TRUE);
|
||||
$Smarty->assign('isHub', TRUE);
|
||||
|
|
|
@ -1,15 +1,30 @@
|
|||
<?php
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
session_start();
|
||||
|
||||
// CC classes/functions #############################################
|
||||
require_once(dirname(__FILE__).'/ui_conf.php');
|
||||
require_once(dirname(__FILE__).'/ui_browser.class.php');
|
||||
|
||||
require_once(dirname(__FILE__).'/ui_handler.class.php');
|
||||
|
||||
// often used classes ###############################################
|
||||
require_once(dirname(__FILE__).'/Smarty/libs/Smarty.class.php');
|
||||
require_once('HTML/QuickForm/Renderer/ArraySmarty.php');
|
||||
require_once(dirname(__FILE__).'/ui_scratchpad.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_search.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_browse.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_hubBrowse.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_hubSearch.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_playlist.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_scheduler.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_subjects.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_exchange.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_transfers.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_calendar.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_jscom.php');
|
||||
require_once(dirname(__FILE__).'/ui_twitter.class.php');
|
||||
|
||||
# NOTE: You have to load all classes that use session variables BEFORE you make a call to session_start()!!!
|
||||
session_start();
|
||||
|
||||
// initialize objects ###############################################
|
||||
$Smarty = new Smarty;
|
||||
|
|
|
@ -1,9 +1,25 @@
|
|||
<?php
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
session_start();
|
||||
|
||||
require_once(dirname(__FILE__).'/ui_conf.php');
|
||||
require_once(dirname(__FILE__).'/ui_handler.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_scratchpad.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_search.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_browse.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_hubBrowse.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_hubSearch.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_playlist.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_scheduler.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_subjects.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_exchange.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_transfers.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_calendar.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_jscom.php');
|
||||
require_once(dirname(__FILE__).'/ui_twitter.class.php');
|
||||
require_once(dirname(__FILE__).'/ui_twitter.class.php');
|
||||
|
||||
# NOTE: You have to load all classes that use session variables BEFORE you make a call to session_start()!!!
|
||||
session_start();
|
||||
|
||||
$uiHandler = new uiHandler($CC_CONFIG);
|
||||
$uiHandler->init();
|
||||
|
|
|
@ -14,7 +14,7 @@ class uiHubBrowse extends uiBrowse
|
|||
$this->prefix = 'HUBBROWSE';
|
||||
$this->col =& $_SESSION[UI_HUBBROWSE_SESSNAME]['col'];
|
||||
$this->criteria =& $_SESSION[UI_HUBBROWSE_SESSNAME]['criteria'];
|
||||
//$this->results =& $_SESSION[UI_HUBBROWSE_SESSNAME]['results'];
|
||||
$this->results =& $_SESSION[UI_HUBBROWSE_SESSNAME]['results'];
|
||||
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
|
||||
if (empty($this->criteria['limit'])) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @package Campcaster
|
||||
* @subpackage htmlUI
|
||||
|
||||
*/
|
||||
class uiHubSearch extends uiSearch {
|
||||
|
||||
|
@ -10,27 +10,26 @@ class uiHubSearch extends uiSearch {
|
|||
{
|
||||
$this->Base =& $uiBase;
|
||||
$this->prefix = 'HUBSEARCH';
|
||||
#$this->results =& $_SESSION[UI_HUBSEARCH_SESSNAME]['results'];
|
||||
$this->results =& $_SESSION[UI_HUBSEARCH_SESSNAME]['results'];
|
||||
$this->criteria =& $_SESSION[UI_HUBSEARCH_SESSNAME]['criteria'];
|
||||
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||
|
||||
if (empty($this->criteria['limit'])) {
|
||||
$this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT;
|
||||
$this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT;
|
||||
}
|
||||
} // constructor
|
||||
|
||||
|
||||
function getResult()
|
||||
{
|
||||
//$this->searchDB();
|
||||
if (isset($_REQUEST['trtokid'])) {
|
||||
$this->getSearchResults($_REQUEST['trtokid']);
|
||||
return $this->results;
|
||||
}
|
||||
return false;
|
||||
return $this->results;
|
||||
} // fn getResult
|
||||
|
||||
|
||||
/**
|
||||
* This gets called when the user first fills in the search form.
|
||||
*
|
||||
*/
|
||||
function newSearch(&$formdata)
|
||||
{
|
||||
$this->results = NULL;
|
||||
|
@ -61,70 +60,57 @@ class uiHubSearch extends uiSearch {
|
|||
}
|
||||
}
|
||||
|
||||
//echo '<XMP>this->criteria:'; print_r($this->criteria); echo "</XMP>\n";
|
||||
$trtokid = $this->Base->gb->globalSearch($this->criteria);
|
||||
if (PEAR::isError($trtokid)) {
|
||||
// don't know how to display error message in htmlUi- should be improved:
|
||||
echo "ERROR: {$trtokid->getMessage()} {$trtokid->getUserInfo()}".
|
||||
($trtokid->getCode() ? " ({$trtokid->getCode()})" : "")."\n";
|
||||
echo "<br/>\n<a href=\"javascript:history.go(-1)\">Back</a>\n";
|
||||
exit;
|
||||
//$this->Base->_retMsg("ERROR_3: {$trtokid->getMessage()} {$trtokid->getUserInfo()}\n");
|
||||
//$this->Base->redirUrl = UI_BROWSER.'?popup[]=';
|
||||
return $trtokid;
|
||||
}
|
||||
|
||||
$this->Base->redirUrl = UI_BROWSER.'?popup[]='.$this->prefix.'.getResults&trtokid='.$trtokid;
|
||||
$results = $this->Base->gb->globalSearch($this->criteria);
|
||||
$this->results["cnt"] = $results["cnt"];
|
||||
$this->results["items"] = $results["results"];
|
||||
$this->pagination();
|
||||
$this->Base->redirUrl = UI_BROWSER."?act=HUBSEARCH";
|
||||
} // fn newSearch
|
||||
|
||||
|
||||
/**
|
||||
* This gets called when the user is paginating.
|
||||
*
|
||||
*/
|
||||
function searchDB()
|
||||
{
|
||||
if (count($this->criteria) === 0) {
|
||||
return FALSE;
|
||||
}
|
||||
$this->results = array('page' => $this->criteria['offset'] / $this->criteria['limit']);
|
||||
|
||||
$results = $this->Base->gb->localSearch($this->criteria, $this->Base->sessid);
|
||||
if (PEAR::isError($results)) {
|
||||
return FALSE;
|
||||
}
|
||||
foreach ($results['results'] as $rec) {
|
||||
$tmpId = BasicStor::IdFromGunid($rec["gunid"]);
|
||||
$this->results['items'][] = $this->Base->getMetaInfo($tmpId);
|
||||
}
|
||||
$this->results['cnt'] = $results['cnt'];
|
||||
|
||||
$this->pagination($results);
|
||||
$this->results = array('page' => ($this->criteria['offset'] / $this->criteria['limit']));
|
||||
$results = $this->Base->gb->globalSearch($this->criteria);
|
||||
$this->results["cnt"] = $results["cnt"];
|
||||
$this->results["items"] = $results["results"];
|
||||
$this->pagination();
|
||||
|
||||
return TRUE;
|
||||
} // fn searchDB
|
||||
|
||||
|
||||
function getSearchResults($trtokid, $andClose=TRUE)
|
||||
{
|
||||
$this->results = array('page' => $this->criteria['offset']/$this->criteria['limit']);
|
||||
$results = $this->Base->gb->getSearchResults($trtokid, $andClose);
|
||||
if ( PEAR::isError($results) && ($results->getCode() != TRERR_NOTFIN) ) {
|
||||
echo "ERROR: {$results->getMessage()} {$results->getUserInfo()}\n";
|
||||
return $results;
|
||||
}
|
||||
if (!is_array($results) || !count($results)) {
|
||||
return false;
|
||||
}
|
||||
$this->results['cnt'] = $results['cnt'];
|
||||
/*
|
||||
foreach ($results['results'] as $rec) {
|
||||
// TODO: maybe this getMetaInfo is not correct for the remote results
|
||||
// yes, right :)
|
||||
// $this->results['items'][] = $this->Base->getMetaInfo(BasicStor::IdFromGunid($rec));
|
||||
$this->results['items'][] = $rec;
|
||||
}
|
||||
*/
|
||||
$this->results['items'] = $results['results'];
|
||||
$this->pagination($results);
|
||||
return is_array($results);
|
||||
} // fn getSearchResults
|
||||
// function getSearchResults($trtokid, $andClose=TRUE)
|
||||
// {
|
||||
// $this->results = array('page' => $this->criteria['offset']/$this->criteria['limit']);
|
||||
// $results = $this->Base->gb->getSearchResults($trtokid, $andClose);
|
||||
// if ( PEAR::isError($results) && ($results->getCode() != TRERR_NOTFIN) ) {
|
||||
// echo "ERROR: {$results->getMessage()} {$results->getUserInfo()}\n";
|
||||
// return $results;
|
||||
// }
|
||||
// if (!is_array($results) || !count($results)) {
|
||||
// return false;
|
||||
// }
|
||||
// $this->results['cnt'] = $results['cnt'];
|
||||
///*
|
||||
// foreach ($results['results'] as $rec) {
|
||||
// // TODO: maybe this getMetaInfo is not correct for the remote results
|
||||
// // yes, right :)
|
||||
// // $this->results['items'][] = $this->Base->getMetaInfo(BasicStor::IdFromGunid($rec));
|
||||
// $this->results['items'][] = $rec;
|
||||
// }
|
||||
//*/
|
||||
// $this->results['items'] = $results['results'];
|
||||
// $this->pagination($results);
|
||||
// return is_array($results);
|
||||
// } // fn getSearchResults
|
||||
|
||||
} // class uiHubSearch
|
||||
?>
|
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
require_once("ui_base.inc.php");
|
||||
|
||||
/**
|
||||
* @package Campcaster
|
||||
* @subpackage htmlUI
|
||||
|
||||
*/
|
||||
class uiSearch
|
||||
{
|
||||
private $Base;
|
||||
private $prefix;
|
||||
private $criteria;
|
||||
private $reloadUrl;
|
||||
private $results;
|
||||
protected $Base;
|
||||
protected $prefix;
|
||||
protected $criteria;
|
||||
protected $reloadUrl;
|
||||
protected $results;
|
||||
|
||||
public function __construct(&$uiBase)
|
||||
{
|
||||
|
@ -226,10 +227,10 @@ class uiSearch
|
|||
$maxNumPaginationButtons = $deltaLower + $deltaUpper + 1;
|
||||
|
||||
$start = 1;
|
||||
$end = $maxPage;
|
||||
$end = $maxPage;
|
||||
|
||||
// If there are enough pages to warrant "next" and "previous"
|
||||
// buttons...
|
||||
// If there are enough pages to warrant "next" and "previous"
|
||||
// buttons...
|
||||
if ($maxPage > $maxNumPaginationButtons) {
|
||||
// When currentPage goes past deltaLower
|
||||
if ($currentPage <= $deltaLower) {
|
||||
|
@ -300,7 +301,7 @@ class uiSearch
|
|||
$o = $l * ($page-1);
|
||||
}
|
||||
$this->setReload();
|
||||
//$this->searchDB();
|
||||
$this->searchDB();
|
||||
}
|
||||
|
||||
} // class uiSearch
|
||||
|
|
|
@ -1651,8 +1651,9 @@ class GreenBox extends BasicStor {
|
|||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
return $tr->globalSearch($criteria);
|
||||
} // fn globalSearch
|
||||
//return $tr->globalSearch($criteria);
|
||||
return $tr->remoteSearch($criteria);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1665,12 +1666,12 @@ class GreenBox extends BasicStor {
|
|||
* @return array
|
||||
* search result format (see localSearch)
|
||||
*/
|
||||
public function getSearchResults($trtok, $andClose=TRUE)
|
||||
{
|
||||
require_once("Transport.php");
|
||||
$tr = new Transport($this);
|
||||
return $tr->getSearchResults($trtok, $andClose);
|
||||
} // fn getSearchResults
|
||||
// public function getSearchResults($trtok, $andClose=TRUE)
|
||||
// {
|
||||
// require_once("Transport.php");
|
||||
// $tr = new Transport($this);
|
||||
// return $tr->getSearchResults($trtok, $andClose);
|
||||
// } // fn getSearchResults
|
||||
|
||||
|
||||
/* ========================================================= info methods */
|
||||
|
|
|
@ -415,7 +415,7 @@ class LocStor extends BasicStor {
|
|||
* </ul>
|
||||
* @see BasicStor::localSearch
|
||||
*/
|
||||
protected function searchMetadata($sessid, $criteria)
|
||||
public function searchMetadata($sessid, $criteria)
|
||||
{
|
||||
if (($res = BasicStor::Authorize('read', $this->storId, $sessid)) !== TRUE) {
|
||||
return $res;
|
||||
|
@ -1378,7 +1378,7 @@ class LocStor extends BasicStor {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getVersion()
|
||||
public static function getVersion()
|
||||
{
|
||||
return CAMPCASTER_VERSION;
|
||||
}
|
||||
|
|
|
@ -405,7 +405,42 @@ class Transport
|
|||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------ global-search methods */
|
||||
/* ------------------------------------------------ remote-search methods */
|
||||
/**
|
||||
* Start search job on remote Campcaster instance.
|
||||
*
|
||||
* @param array $criteria
|
||||
* LS criteria format (see localSearch)
|
||||
* @param string $resultMode
|
||||
* 'php' | 'xmlrpc'
|
||||
* @param array $pars
|
||||
* default parameters (optional, internal use)
|
||||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function remoteSearch($criteria, $resultMode='php')
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$criteria['resultMode'] = $resultMode;
|
||||
|
||||
// testing of hub availability and hub account configuration.
|
||||
$sessid = $this->loginToArchive();
|
||||
if (PEAR::isError($sessid)) {
|
||||
switch(intval($sessid->getCode())) {
|
||||
case 802:
|
||||
return PEAR::raiseError("Can't login to Hub ({$sessid->getMessage()})", TRERR_XR_FAIL);
|
||||
case TRERR_XR_FAIL:
|
||||
return PEAR::raiseError("Can't connect to Hub ({$sessid->getMessage()})", TRERR_XR_FAIL);
|
||||
}
|
||||
return $sessid;
|
||||
}
|
||||
$params = array("sessid" => $sessid, "criteria" => $criteria);
|
||||
$result = $this->xmlrpcCall("locstor.searchMetadata", $params);
|
||||
//$result = $this->xmlrpcCall("locstor.ping", array("par" => "foo"));
|
||||
$this->logoutFromArchive($sessid);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start search job on network hub
|
||||
*
|
||||
|
@ -418,33 +453,33 @@ class Transport
|
|||
* @return string
|
||||
* transport token
|
||||
*/
|
||||
function globalSearch($criteria, $resultMode='php', $pars=array())
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
// testing of hub availability and hub account configuration.
|
||||
// it makes searchjob not async - should be removed for real async
|
||||
$r = $this->loginToArchive();
|
||||
if (PEAR::isError($r)) {
|
||||
switch(intval($r->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 $r;
|
||||
}
|
||||
$this->logoutFromArchive($r);
|
||||
$criteria['resultMode'] = $resultMode;
|
||||
$localfile = tempnam($CC_CONFIG['transDir'], 'searchjob_');
|
||||
@chmod($localfile, 0660);
|
||||
$len = file_put_contents($localfile, serialize($criteria));
|
||||
$trec = $this->_uploadGeneralFileToHub($localfile, 'searchjob', $pars);
|
||||
if (PEAR::isError($trec)) {
|
||||
return $trec;
|
||||
}
|
||||
$this->startCronJobProcess($trec->trtok);
|
||||
return $trec->trtok;
|
||||
}
|
||||
// function globalSearch($criteria, $resultMode='php', $pars=array())
|
||||
// {
|
||||
// global $CC_CONFIG, $CC_DBC;
|
||||
// // testing of hub availability and hub account configuration.
|
||||
// // it makes searchjob not async - should be removed for real async
|
||||
// $r = $this->loginToArchive();
|
||||
// if (PEAR::isError($r)) {
|
||||
// switch(intval($r->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 $r;
|
||||
// }
|
||||
// $this->logoutFromArchive($r);
|
||||
// $criteria['resultMode'] = $resultMode;
|
||||
// $localfile = tempnam($CC_CONFIG['transDir'], 'searchjob_');
|
||||
// @chmod($localfile, 0660);
|
||||
// $len = file_put_contents($localfile, serialize($criteria));
|
||||
// $trec = $this->_uploadGeneralFileToHub($localfile, 'searchjob', $pars);
|
||||
// if (PEAR::isError($trec)) {
|
||||
// return $trec;
|
||||
// }
|
||||
// $this->startCronJobProcess($trec->trtok);
|
||||
// return $trec->trtok;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -457,60 +492,60 @@ class Transport
|
|||
* @return array
|
||||
* LS search result format (see localSearch)
|
||||
*/
|
||||
function getSearchResults($trtok, $andClose=TRUE)
|
||||
{
|
||||
$trec = TransportRecord::recall($this, $trtok);
|
||||
if (PEAR::isError($trec)) {
|
||||
return $trec;
|
||||
}
|
||||
$row = $trec->row;
|
||||
switch ($st = $trec->getState()) {
|
||||
case "failed":
|
||||
return PEAR::raiseError(
|
||||
"Transport::getSearchResults:".
|
||||
" global search or results transport failed".
|
||||
" ({$trec->row['errmsg']})"
|
||||
);
|
||||
case "closed":
|
||||
/*
|
||||
$res = file_get_contents($row['localfile']);
|
||||
$results = unserialize($res);
|
||||
return $results;
|
||||
*/
|
||||
return PEAR::raiseError(
|
||||
"Transport::getSearchResults:".
|
||||
" closed transport token ($trtok)", TRERR_TOK
|
||||
);
|
||||
case "finished":
|
||||
if ($row['direction'] == 'down') {
|
||||
// really finished
|
||||
$res = file_get_contents($row['localfile']);
|
||||
$results = unserialize($res);
|
||||
if ($andClose) {
|
||||
$ret = $this->xmlrpcCall('archive.downloadClose',
|
||||
array(
|
||||
'token' => $row['pdtoken'] ,
|
||||
'trtype' => $row['trtype'] ,
|
||||
));
|
||||
if (PEAR::isError($ret)) {
|
||||
return $ret;
|
||||
}
|
||||
@unlink($row['localfile']);
|
||||
$r = $trec->close();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
// otherwise not really finished - only request upload finished
|
||||
default:
|
||||
return PEAR::raiseError(
|
||||
"Transport::getSearchResults: not finished ($st)",
|
||||
TRERR_NOTFIN
|
||||
);
|
||||
}
|
||||
}
|
||||
// function getSearchResults($trtok, $andClose=TRUE)
|
||||
// {
|
||||
// $trec = TransportRecord::recall($this, $trtok);
|
||||
// if (PEAR::isError($trec)) {
|
||||
// return $trec;
|
||||
// }
|
||||
// $row = $trec->row;
|
||||
// switch ($st = $trec->getState()) {
|
||||
// case "failed":
|
||||
// return PEAR::raiseError(
|
||||
// "Transport::getSearchResults:".
|
||||
// " global search or results transport failed".
|
||||
// " ({$trec->row['errmsg']})"
|
||||
// );
|
||||
// case "closed":
|
||||
///*
|
||||
// $res = file_get_contents($row['localfile']);
|
||||
// $results = unserialize($res);
|
||||
// return $results;
|
||||
//*/
|
||||
// return PEAR::raiseError(
|
||||
// "Transport::getSearchResults:".
|
||||
// " closed transport token ($trtok)", TRERR_TOK
|
||||
// );
|
||||
// case "finished":
|
||||
// if ($row['direction'] == 'down') {
|
||||
// // really finished
|
||||
// $res = file_get_contents($row['localfile']);
|
||||
// $results = unserialize($res);
|
||||
// if ($andClose) {
|
||||
// $ret = $this->xmlrpcCall('archive.downloadClose',
|
||||
// array(
|
||||
// 'token' => $row['pdtoken'] ,
|
||||
// 'trtype' => $row['trtype'] ,
|
||||
// ));
|
||||
// if (PEAR::isError($ret)) {
|
||||
// return $ret;
|
||||
// }
|
||||
// @unlink($row['localfile']);
|
||||
// $r = $trec->close();
|
||||
// if (PEAR::isError($r)) {
|
||||
// return $r;
|
||||
// }
|
||||
// }
|
||||
// return $results;
|
||||
// }
|
||||
// // otherwise not really finished - only request upload finished
|
||||
// default:
|
||||
// return PEAR::raiseError(
|
||||
// "Transport::getSearchResults: not finished ($st)",
|
||||
// TRERR_NOTFIN
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/* ------------------------ methods for ls-archive-format file transports */
|
||||
|
@ -712,7 +747,7 @@ class Transport
|
|||
function loginToArchive()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$res = $this->xmlrpcCall('archive.login',
|
||||
$res = $this->xmlrpcCall('locstor.login',
|
||||
array(
|
||||
'login' => $CC_CONFIG['archiveAccountLogin'],
|
||||
'pass' => $CC_CONFIG['archiveAccountPass']
|
||||
|
@ -734,7 +769,7 @@ class Transport
|
|||
*/
|
||||
function logoutFromArchive($sessid)
|
||||
{
|
||||
$res = $this->xmlrpcCall('archive.logout',
|
||||
$res = $this->xmlrpcCall('locstor.logout',
|
||||
array('sessid'=>$sessid));
|
||||
return $res;
|
||||
}
|
||||
|
@ -777,7 +812,7 @@ class Transport
|
|||
return TRUE;
|
||||
}
|
||||
// ping to archive server:
|
||||
$r = $this->pingToArchive();
|
||||
$r = $this->ping();
|
||||
chdir($CC_CONFIG['transDir']);
|
||||
// for all opened transports:
|
||||
foreach ($transports as $i => $row) {
|
||||
|
@ -1423,7 +1458,7 @@ class Transport
|
|||
}
|
||||
break;
|
||||
case "metadata":
|
||||
case "searchjob":
|
||||
// case "searchjob":
|
||||
return TRUE; // don't close - getSearchResults should close it
|
||||
break;
|
||||
}
|
||||
|
@ -1606,14 +1641,14 @@ class Transport
|
|||
|
||||
|
||||
/**
|
||||
* Ping to archive server
|
||||
* Ping to remote Campcaster server
|
||||
*
|
||||
* @return string
|
||||
* network hub response or error object
|
||||
*/
|
||||
function pingToArchive()
|
||||
function ping()
|
||||
{
|
||||
$res = $this->xmlrpcCall('archive.ping',
|
||||
$res = $this->xmlrpcCall('ping',
|
||||
array('par'=>'ping_'.date('H:i:s')));
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
$WHITE_SCREEN_OF_DEATH = false;
|
||||
|
||||
header("Content-type: text/plain");
|
||||
echo "\n# Transport test:\n";
|
||||
|
||||
require_once('../conf.php');
|
||||
require_once('DB.php');
|
||||
|
@ -22,24 +23,24 @@ $gunid = 'a23456789abcdefb';
|
|||
$mediaFile = '../tests/ex1.mp3';
|
||||
$mdataFile = '../tests/mdata1.xml';
|
||||
|
||||
/* ========== PING ========== */
|
||||
/*
|
||||
echo"# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
|
||||
// Test remote search
|
||||
$result = $tr->remoteSearch("");
|
||||
if (PEAR::isError($result)) {
|
||||
echo $result->message."\n";
|
||||
} else {
|
||||
var_dump($result);
|
||||
}
|
||||
//$client = XML_RPC2_Client::create('http://localhost/~paul/campcaster/storageServer/var/xmlrpc/xrLocStor2.php', array('backend'=>'php', 'prefix' => "Campcaster_Remote."));
|
||||
////var_dump($client);
|
||||
//$result = $client->System_Ping("woo");
|
||||
//var_dump($result);
|
||||
exit;
|
||||
|
||||
echo"# Ping: ";
|
||||
$r = $tr->pingToArchive();
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
var_export($r); echo"\n";
|
||||
|
||||
echo"# logout: "; $r = Alib::Logout($sessid);
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
echo "$r\n";
|
||||
*/
|
||||
/* ========== STORE ========== */
|
||||
echo"# Login: ".($sessid = Alib::Login('root', 'q'))."\n";
|
||||
|
||||
echo"# Store: ";
|
||||
$parid = $gb->_getHomeDirIdFromSess($sessid);
|
||||
//$parid = $gb->_getHomeDirIdFromSess($sessid);
|
||||
$values = array(
|
||||
"filename" => "xx1.mp3",
|
||||
"filepath" => $mediaFile,
|
||||
|
@ -47,7 +48,7 @@ $values = array(
|
|||
"gunid" => $gunid,
|
||||
"filetype" => "audioclip"
|
||||
);
|
||||
$storedFile = $gb->bsPutFile($parid, $values);
|
||||
$storedFile = $gb->bsPutFile($values);
|
||||
if (PEAR::isError($storedFile)) {
|
||||
if ($storedFile->getCode()!=GBERR_GUNID) {
|
||||
echo "ERROR: ".$storedFile->getMessage()."\n";
|
||||
|
@ -185,7 +186,7 @@ if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
|||
var_export($r['status']); echo"\n";
|
||||
|
||||
echo"# Ping: ";
|
||||
$r = $tr->pingToArchive();
|
||||
$r = $tr->ping();
|
||||
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); }
|
||||
var_export($r); echo"\n";
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ require_once(dirname(__FILE__).'/../LocStor.php');
|
|||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class XR_LocStor extends LocStor {
|
||||
|
||||
/* ----------------------------------------------------------- getVersion */
|
||||
/**
|
||||
* Dummy method - only returns Campcaster version
|
||||
|
@ -38,19 +37,36 @@ class XR_LocStor extends LocStor {
|
|||
* @return XML_RPC_Response
|
||||
* @see Subjects::getVersion
|
||||
*/
|
||||
public function xr_getVersion($input)
|
||||
// public function xr_getVersion($input)
|
||||
// {
|
||||
// list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
// if (!$ok) {
|
||||
// return $r;
|
||||
// }
|
||||
// $res = $this->getVersion();
|
||||
// if (PEAR::isError($res)) {
|
||||
// return new XML_RPC_Response(0, 805,
|
||||
// "xr_getVersion: ".$res->getMessage().
|
||||
// " ".$res->getUserInfo()
|
||||
// );
|
||||
// }
|
||||
// return new XML_RPC_Response(
|
||||
// XML_RPC_encode(array('version'=>$res))
|
||||
// );
|
||||
// }
|
||||
public function xr_getVersion()
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
// list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
// if (!$ok) {
|
||||
// return $r;
|
||||
// }
|
||||
$res = $this->getVersion();
|
||||
if (PEAR::isError($res)) {
|
||||
return new XML_RPC_Response(0, 805,
|
||||
"xr_getVersion: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
// if (PEAR::isError($res)) {
|
||||
// return new XML_RPC_Response(0, 805,
|
||||
// "xr_getVersion: ".$res->getMessage().
|
||||
// " ".$res->getUserInfo()
|
||||
// );
|
||||
// }
|
||||
return new XML_RPC_Response(
|
||||
XML_RPC_encode(array('version'=>$res))
|
||||
);
|
||||
|
@ -3270,24 +3286,24 @@ class XR_LocStor extends LocStor {
|
|||
* @return XML_RPC_Response
|
||||
* @see Transport::globalSearch
|
||||
*/
|
||||
public function xr_globalSearch($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
require_once('../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->globalSearch($r['criteria']);
|
||||
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_globalSearch: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
}
|
||||
// public function xr_globalSearch($input)
|
||||
// {
|
||||
// list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
// if (!$ok) {
|
||||
// return $r;
|
||||
// }
|
||||
// require_once('../Transport.php');
|
||||
// $tr = new Transport($this);
|
||||
// $res = $tr->globalSearch($r['criteria']);
|
||||
// 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_globalSearch: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
// );
|
||||
// }
|
||||
// return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get results from search job on network hub.
|
||||
|
@ -3335,26 +3351,26 @@ class XR_LocStor extends LocStor {
|
|||
* @return XML_RPC_Response
|
||||
* @see Transport::getSearchResults
|
||||
*/
|
||||
public function xr_getSearchResults($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
require_once('../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->getSearchResults($r['trtok']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
$ec = (
|
||||
$ec0 == GBERR_SESS || $ec0 == TRERR_TOK || $ec0 == TRERR_NOTFIN
|
||||
? 800+$ec0 : 805 );
|
||||
return new XML_RPC_Response(0, $ec,
|
||||
"xr_getSearchResults: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
// public function xr_getSearchResults($input)
|
||||
// {
|
||||
// list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
// if (!$ok) {
|
||||
// return $r;
|
||||
// }
|
||||
// require_once('../Transport.php');
|
||||
// $tr = new Transport($this);
|
||||
// $res = $tr->getSearchResults($r['trtok']);
|
||||
// if (PEAR::isError($res)) {
|
||||
// $ec0 = intval($res->getCode());
|
||||
// $ec = (
|
||||
// $ec0 == GBERR_SESS || $ec0 == TRERR_TOK || $ec0 == TRERR_NOTFIN
|
||||
// ? 800+$ec0 : 805 );
|
||||
// return new XML_RPC_Response(0, $ec,
|
||||
// "xr_getSearchResults: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
// );
|
||||
// }
|
||||
// return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
// }
|
||||
|
||||
/**
|
||||
* OBSOLETE
|
||||
|
@ -3389,24 +3405,24 @@ class XR_LocStor extends LocStor {
|
|||
* @return XML_RPC_Response
|
||||
* @see Transport::uploadToArchive
|
||||
*/
|
||||
public function xr_uploadToArchive($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->uploadToArchive($r['gunid'], $r['sessid']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
$ec = ($ec0 == GBERR_SESS ? 800+$ec0 : 805 );
|
||||
return new XML_RPC_Response(0, $ec,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
}
|
||||
// public function xr_uploadToArchive($input)
|
||||
// {
|
||||
// list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
// if (!$ok) {
|
||||
// return $r;
|
||||
// }
|
||||
// require_once(dirname(__FILE__).'/../Transport.php');
|
||||
// $tr = new Transport($this);
|
||||
// $res = $tr->uploadToArchive($r['gunid'], $r['sessid']);
|
||||
// if (PEAR::isError($res)) {
|
||||
// $ec0 = intval($res->getCode());
|
||||
// $ec = ($ec0 == GBERR_SESS ? 800+$ec0 : 805 );
|
||||
// return new XML_RPC_Response(0, $ec,
|
||||
// "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
// );
|
||||
// }
|
||||
// return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
// }
|
||||
|
||||
/**
|
||||
* OBSOLETE
|
||||
|
@ -3441,24 +3457,24 @@ class XR_LocStor extends LocStor {
|
|||
* @return XML_RPC_Response
|
||||
* @see Transport::downloadFromArchive
|
||||
*/
|
||||
public function xr_downloadFromArchive($input)
|
||||
{
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../Transport.php');
|
||||
$tr = new Transport($this);
|
||||
$res = $tr->downloadFromArchive($r['gunid'], $r['sessid']);
|
||||
if (PEAR::isError($res)) {
|
||||
$ec0 = intval($res->getCode());
|
||||
$ec = ($ec0 == GBERR_SESS ? 800+$ec0 : 805 );
|
||||
return new XML_RPC_Response(0, $ec,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
}
|
||||
// public function xr_downloadFromArchive($input)
|
||||
// {
|
||||
// list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
// if (!$ok) {
|
||||
// return $r;
|
||||
// }
|
||||
// require_once(dirname(__FILE__).'/../Transport.php');
|
||||
// $tr = new Transport($this);
|
||||
// $res = $tr->downloadFromArchive($r['gunid'], $r['sessid']);
|
||||
// if (PEAR::isError($res)) {
|
||||
// $ec0 = intval($res->getCode());
|
||||
// $ec = ($ec0 == GBERR_SESS ? 800+$ec0 : 805 );
|
||||
// return new XML_RPC_Response(0, $ec,
|
||||
// "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
// );
|
||||
// }
|
||||
// return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
|
||||
// }
|
||||
|
||||
/* ================================================ methods for debugging */
|
||||
/**
|
||||
|
@ -3593,7 +3609,7 @@ class XR_LocStor extends LocStor {
|
|||
}
|
||||
|
||||
/**
|
||||
* Simple ping method - return strtouppered string
|
||||
* Simple ping method - return string
|
||||
*
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
|
@ -3604,7 +3620,7 @@ class XR_LocStor extends LocStor {
|
|||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
$res = date("Ymd-H:i:s")." Network hub answer: {$r['par']}";
|
||||
$res = date("Ymd-H:i:s")." -- reply from remote node: {$r['par']}";
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
}
|
||||
|
||||
|
|
|
@ -61,11 +61,11 @@ $locStor = new XR_LocStor();
|
|||
$methods = array(
|
||||
'test' => 'Tests toupper and checks sessid, params: '.
|
||||
'teststring, sessid.',
|
||||
'getVersion' => 'Dummy function for connection testing.',
|
||||
'authenticate' => 'Checks authentication.',
|
||||
'getVersion' => 'Get version of Campcaster.',
|
||||
// 'authenticate' => 'Checks authentication.',
|
||||
'login' => 'Login to storage.',
|
||||
'logout' => 'Logout from storage.',
|
||||
'existsAudioClip' => 'Checks if an Audio clip with the specified '.
|
||||
'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.',
|
||||
|
@ -140,26 +140,26 @@ $methods = array(
|
|||
'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',
|
||||
// 'globalSearch' => 'Start search job on network hub',
|
||||
// 'getSearchResults' => 'Get results from search job on network hub',
|
||||
|
||||
'uploadOpen' => 'Open file-layer upload',
|
||||
'uploadCheck' => 'Check the checksum of uploaded file',
|
||||
'uploadClose' => 'Close file-layer upload',
|
||||
'downloadOpen' => 'Open file-layer download',
|
||||
'uploadOpen' => 'Open file-layer upload',
|
||||
'uploadCheck' => 'Check the checksum of uploaded file',
|
||||
'uploadClose' => 'Close file-layer upload',
|
||||
'downloadOpen' => 'Open file-layer download',
|
||||
// 'downloadCheck' => 'Check the checksum of downloaded file',
|
||||
'downloadClose' => 'Close file-layer download',
|
||||
'downloadClose' => 'Close file-layer download',
|
||||
'prepareHubInitiatedTransfer' => 'Prepare hub initiated transfer',
|
||||
'listHubInitiatedTransfers' => 'List hub initiated transfers',
|
||||
'setHubInitiatedTransfer' => 'Set state of hub initiated transfers',
|
||||
'ping' => 'Echo request',
|
||||
'ping' => 'Echo request',
|
||||
);
|
||||
|
||||
$defs = array();
|
||||
foreach ($methods as $method => $description) {
|
||||
$defs["locstor.$method"] = array(
|
||||
"function" => array(&$locStor, "xr_$method"),
|
||||
# "function" => "\$GLOBALS['locStor']->xr_$method",
|
||||
// NOTE: the way this signature is set up, every function must take at least one parameter!
|
||||
"signature" => array(
|
||||
array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct'])
|
||||
),
|
||||
|
|
|
@ -72,7 +72,8 @@ $infos = array(
|
|||
"methodHelp" => array('m'=>"system.methodHelp", 'p'=>0),
|
||||
"methodSignature" => array('m'=>"system.methodSignature", 'p'=>0),
|
||||
"test" => array('m'=>"locstor.test", 'p'=>array('sessid', 'teststring')),
|
||||
"getVersion" => array('m'=>"locstor.getVersion", 'p'=>array(), 'r'=>'version'),
|
||||
"ping" => array('m'=>"locstor.ping", 'p'=>array("par")),
|
||||
"getVersion" => array('m'=>"locstor.getVersion", 'p'=>array("str"), 'r'=>'version'),
|
||||
"authenticate" => array('m'=>"locstor.authenticate", 'p'=>array('login', 'pass'), 'r'=>'authenticate'),
|
||||
"login" => array('m'=>"locstor.login", 'p'=>array('login', 'pass'), 'r'=>'sessid'),
|
||||
"logout" => array('m'=>"locstor.logout", 'p'=>array('sessid'), 'r'=>'status'),
|
||||
|
@ -193,10 +194,10 @@ $infos = array(
|
|||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"downloadFromHub" => array('m'=>"locstor.downloadFromHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"globalSearch" => array('m'=>"locstor.globalSearch",
|
||||
'p'=>array('sessid', 'criteria'), 'r'=>array('trtok')),
|
||||
"getSearchResults" => array('m'=>"locstor.getSearchResults",
|
||||
'p'=>array('trtok')),
|
||||
// "globalSearch" => array('m'=>"locstor.globalSearch",
|
||||
// 'p'=>array('sessid', 'criteria'), 'r'=>array('trtok')),
|
||||
// "getSearchResults" => array('m'=>"locstor.getSearchResults",
|
||||
// 'p'=>array('trtok')),
|
||||
|
||||
"createBackupOpen" => array('m'=>"locstor.createBackupOpen",
|
||||
'p'=>array('sessid', 'criteria'), 'r'=>array('token')),
|
||||
|
@ -228,7 +229,7 @@ $infos = array(
|
|||
|
||||
switch ($method) {
|
||||
case "searchMetadata":
|
||||
case "globalSearch":
|
||||
// case "globalSearch":
|
||||
case "createBackupOpen":
|
||||
$parr = array(
|
||||
'sessid'=>$pars[0],
|
||||
|
@ -283,7 +284,12 @@ switch ($method) {
|
|||
} // switch
|
||||
|
||||
$fullmethod = $infos[$method]['m'];
|
||||
$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($options)));
|
||||
if (is_array($options)) {
|
||||
$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($options)));
|
||||
} else {
|
||||
$msg = new XML_RPC_Message($fullmethod);
|
||||
}
|
||||
//$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr)));
|
||||
|
||||
if ($verbose) {
|
||||
echo "parr:\n";
|
||||
|
@ -326,7 +332,7 @@ if (isset($infos[$method]['r'])) {
|
|||
} else {
|
||||
switch ($method) {
|
||||
case "searchMetadata":
|
||||
case "getSearchResults":
|
||||
// case "getSearchResults":
|
||||
$acCnt = 0;
|
||||
$acGunids = array();
|
||||
$plCnt = 0;
|
||||
|
@ -355,6 +361,7 @@ if (isset($infos[$method]['r'])) {
|
|||
break;
|
||||
default:
|
||||
print_r($resp);
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,10 +184,10 @@ $methodDefs = array(
|
|||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"downloadFromHub" => array('m'=>"locstor.downloadFromHub",
|
||||
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
|
||||
"globalSearch" => array('m'=>"locstor.globalSearch",
|
||||
'p'=>array('sessid', 'criteria'), 'r'=>array('trtok')),
|
||||
"getSearchResults" => array('m'=>"locstor.getSearchResults",
|
||||
'p'=>array('trtok')),
|
||||
// "globalSearch" => array('m'=>"locstor.globalSearch",
|
||||
// 'p'=>array('sessid', 'criteria'), 'r'=>array('trtok')),
|
||||
// "getSearchResults" => array('m'=>"locstor.getSearchResults",
|
||||
// 'p'=>array('trtok')),
|
||||
|
||||
"createBackupOpen" => array('m'=>"locstor.createBackupOpen",
|
||||
'p'=>array('sessid', 'criteria'), 'r'=>array('token')),
|
||||
|
@ -267,7 +267,7 @@ if (isset($_REQUEST['go_button'])) {
|
|||
} else {
|
||||
switch ($method) {
|
||||
case "searchMetadata":
|
||||
case "getSearchResults":
|
||||
// case "getSearchResults":
|
||||
$acCnt = 0;
|
||||
$acGunids = array();
|
||||
$plCnt = 0;
|
||||
|
|
Loading…
Reference in New Issue