Fix for #2027
This commit is contained in:
parent
0fcaf7a168
commit
cb36413ecb
|
@ -14,7 +14,8 @@ require_once "../Archive.php";
|
|||
/**
|
||||
* XML-RPC interface for Archive.
|
||||
*
|
||||
* @author $Author$
|
||||
* @author Tomas Hlava <th@red2head.com>
|
||||
* @author Paul Baranowski <paul@paulbaranowski.org>
|
||||
* @version $Revision$
|
||||
* @package Campcaster
|
||||
* @subpackage ArchiveServer
|
||||
|
@ -27,11 +28,12 @@ class XR_Archive extends Archive {
|
|||
/**
|
||||
* Simple ping method - return strtouppered string
|
||||
*
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_ping($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -41,11 +43,12 @@ class XR_Archive extends Archive {
|
|||
|
||||
|
||||
/**
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_uploadOpen($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -62,11 +65,12 @@ class XR_Archive extends Archive {
|
|||
/**
|
||||
* Check state of file upload
|
||||
*
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_uploadCheck($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -81,11 +85,12 @@ class XR_Archive extends Archive {
|
|||
|
||||
|
||||
/**
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_uploadClose($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -101,10 +106,11 @@ class XR_Archive extends Archive {
|
|||
|
||||
/**
|
||||
* @param XMLRPC_strcut $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_downloadOpen($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -119,11 +125,12 @@ class XR_Archive extends Archive {
|
|||
|
||||
|
||||
/**
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_downloadClose($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -138,11 +145,12 @@ class XR_Archive extends Archive {
|
|||
|
||||
|
||||
/**
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_prepareHubInitiatedTransfer($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -163,11 +171,12 @@ class XR_Archive extends Archive {
|
|||
|
||||
|
||||
/**
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_listHubInitiatedTransfers($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
@ -188,11 +197,12 @@ class XR_Archive extends Archive {
|
|||
|
||||
|
||||
/**
|
||||
* @param XMLRPC_struct $input
|
||||
* @param XML_RPC_Message $input
|
||||
* @return XML_RPC_Response
|
||||
*/
|
||||
function xr_setHubInitiatedTransfer($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
list($ok, $r) = XR_LocStor::xr_getParams($input);
|
||||
if (!$ok) {
|
||||
return $r;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* @author $Author$
|
||||
* @version : $Revision$
|
||||
* @author Tomas Hlava <th@red2head.com>
|
||||
* @author Paul Baranowski <paul@paulbaranowski.org>
|
||||
* @version $Revision$
|
||||
* @package Campcaster
|
||||
* @subpackage ArchiveServer
|
||||
* @copyright 2006 MDLF, Inc.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @link http://www.campware.org
|
||||
*/
|
||||
|
||||
/* ====================================================== specific PHP config */
|
||||
|
@ -28,14 +34,15 @@ ini_set("error_append_string", "</string></value>
|
|||
header("Content-type: text/xml");
|
||||
|
||||
/* ================================================================= includes */
|
||||
require_once dirname(__FILE__).'/../conf.php';
|
||||
require_once 'DB.php';
|
||||
require_once "XML/RPC/Server.php";
|
||||
require_once 'XR_Archive.php';
|
||||
require_once(dirname(__FILE__).'/../conf.php');
|
||||
require_once('DB.php');
|
||||
require_once("XML/RPC/Server.php");
|
||||
require_once('XR_Archive.php');
|
||||
|
||||
/* ============================================ setting default error handler */
|
||||
function errHndl($errno, $errmsg, $filename, $linenum, $vars){
|
||||
switch($errno){
|
||||
function errHndl($errno, $errmsg, $filename, $linenum, $vars)
|
||||
{
|
||||
switch ($errno) {
|
||||
case E_WARNING:
|
||||
case E_NOTICE:
|
||||
case E_USER_WARNING:
|
||||
|
@ -54,9 +61,9 @@ $old_error_handler = set_error_handler("errHndl", E_ALL);
|
|||
|
||||
|
||||
/* ============================================================= runable code */
|
||||
$r = $dbc =& DB::connect($config['dsn'], TRUE);
|
||||
if (PEAR::isError($r)) {
|
||||
trigger_error("DB::connect: ".$r->getMessage()." ".$r->getUserInfo(),E_USER_ERROR);
|
||||
$dbc =& DB::connect($config['dsn'], TRUE);
|
||||
if (PEAR::isError($dbc)) {
|
||||
trigger_error("DB::connect: ".$dbc->getMessage()." ".$dbc->getUserInfo(),E_USER_ERROR);
|
||||
}
|
||||
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
|
||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
|
@ -116,7 +123,7 @@ $methods = array(
|
|||
);
|
||||
|
||||
$defs = array();
|
||||
foreach($methods as $method=>$description){
|
||||
foreach($methods as $method => $description){
|
||||
$defs["archive.$method"] = array(
|
||||
"function" => array(&$archive, "xr_$method"),
|
||||
# "function" => "\$GLOBALS['archive']->xr_$method",
|
||||
|
@ -126,6 +133,6 @@ foreach($methods as $method=>$description){
|
|||
"docstring" => $description
|
||||
);
|
||||
}
|
||||
$s = new XML_RPC_Server( $defs );
|
||||
$s = new XML_RPC_Server($defs);
|
||||
|
||||
?>
|
|
@ -3,9 +3,15 @@ require_once(dirname(__FILE__).'/../LocStor.php');
|
|||
|
||||
/**
|
||||
* XML-RPC interface for LocStor class
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*
|
||||
* @author Tomas Hlava <th@red2head.com>
|
||||
* @author Paul Baranowski <paul@paulbaranowski.org>
|
||||
* @version $Revision$
|
||||
* @package Campcaster
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2006 MDLF, Inc.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @link http://www.campware.org
|
||||
*/
|
||||
class XR_LocStor extends LocStor {
|
||||
|
||||
|
@ -3595,7 +3601,7 @@ class XR_LocStor extends LocStor {
|
|||
* On success, the second param is an array of values.
|
||||
* On failure, the second param is an XML_RPC_Response object.
|
||||
*/
|
||||
private static function xr_getParams($input)
|
||||
protected static function xr_getParams($input)
|
||||
{
|
||||
$p = $input->getParam(0);
|
||||
if (isset($p) && ($p->scalartyp()=="struct")) {
|
||||
|
|
Loading…
Reference in New Issue