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