Get rid of unneeded data copying ( = = someFunction()). Minor spacing and formatting tweaks.

This commit is contained in:
paul 2006-11-23 07:16:40 +00:00
parent 49c4036a5a
commit 053f6df164
1 changed files with 25 additions and 16 deletions

View File

@ -3079,14 +3079,16 @@ class XR_LocStor extends LocStor {
*/ */
function xr_downloadFromHub($input) { function xr_downloadFromHub($input) {
list($ok, $par) = $this->_xr_getPars($input); list($ok, $par) = $this->_xr_getPars($input);
if(!$ok) return $par; if (!$ok) {
require_once '../Transport.php'; return $par;
}
require_once('../Transport.php');
$tr = new Transport($this); $tr = new Transport($this);
$uid = $r = $this->getSessUserId($par['sessid']); // ### $uid = $this->getSessUserId($par['sessid']); // ###
$res = $tr->downloadFromHub($uid, $par['gunid']); $res = $tr->downloadFromHub($uid, $par['gunid']);
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_downloadFromHub: ".$res->getMessage()." ".$res->getUserInfo() "xr_downloadFromHub: ".$res->getMessage()." ".$res->getUserInfo()
); );
@ -3129,15 +3131,18 @@ class XR_LocStor extends LocStor {
* @return XMLRPC struct * @return XMLRPC struct
* @see Transport::globalSearch * @see Transport::globalSearch
*/ */
function xr_globalSearch($input) { function xr_globalSearch($input)
{
list($ok, $r) = $this->_xr_getPars($input); list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r; if (!$ok) {
require_once '../Transport.php'; return $r;
}
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()
); );
@ -3193,13 +3198,15 @@ class XR_LocStor extends LocStor {
*/ */
function xr_getSearchResults($input) { function xr_getSearchResults($input) {
list($ok, $r) = $this->_xr_getPars($input); list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r; if (!$ok) {
require_once '../Transport.php'; return $r;
}
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,
@ -3245,8 +3252,10 @@ class XR_LocStor extends LocStor {
function xr_uploadToArchive($input) function xr_uploadToArchive($input)
{ {
list($ok, $r) = $this->_xr_getPars($input); list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r; if (!$ok) {
require_once dirname(__FILE__).'/../Transport.php'; return $r;
}
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)){