Got rid of copyright notice in files, we will just have one that covers all files at the root of the package. Converted comments to Phpdocumentor format. Added @author, @version, @package, and @subpackage doc tags. Reformatted code to Campware PHP coding conventions.

This commit is contained in:
paul 2006-10-16 18:10:35 +00:00
parent 10e551f1da
commit a181a9991a
16 changed files with 389 additions and 647 deletions

View File

@ -1,134 +1,150 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
require_once dirname(__FILE__)."/../../storageServer/var/xmlrpc/XR_LocStor.php";
require_once dirname(__FILE__)."/../../storageServer/var/Transport.php";
/**
* Extension to StorageServer to act as ArchiveServer
* Extension to StorageServer to act as ArchiveServer.
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*/
class Archive extends XR_LocStor{
/**
* Open upload transport (from station to hub)
* Open upload transport (from station to hub)
*
* @param sessid: string - session id
* @param chsum: string - checksum
* @return hasharray with:
* @param string $sessid
* session id
* @param string $chsum
* checksum
* @return array
* hasharray with:
* url string: writable URL
* token string: PUT token
*/
function uploadOpen($sessid, $chsum)
{
$owner = $r = $this->getSessUserId($sessid);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$res = $r = $this->bsOpenPut($chsum, NULL, $owner);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
return array('url'=>$res['url'], 'token'=>$res['token']);
}
/**
* Check uploaded file
* Check uploaded file
*
* @param token: string - transport token
* @return array(md5h string, size int, url string)
* @param string $token
* transport token
* @return array
* (md5h string, size int, url string)
*/
function uploadCheck($token)
{
return $this->bsCheckPut($token);
}
/**
* Close upload transport
* Close upload transport
*
* @param token: string - transport token
* @param trtype: string - transport type
* @param pars: array - transport parameters
* @return mixed
* @param string $token
* transport token
* @param string $trtype
* transport type
* @param array $pars
* transport parameters
* @return mixed
*/
function uploadClose($token, $trtype, $pars=array())
{
$res = $r = $this->bsClosePut($token);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
extract($res); // fname, owner
switch($trtype){
case"audioclip":
switch ($trtype) {
case "audioclip":
$mdtoken = $pars['mdpdtoken'];
$res = $r = $this->bsClosePut($mdtoken);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$mdfname = $res['fname'];
if($gunid=='') $gunid=NULL;
if ($gunid == '') {
$gunid=NULL;
}
$parid = $r = $this->_getHomeDirId($owner);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$res = $r = $this->bsPutFile($parid, $pars['name'],
$fname, $mdfname,
$pars['gunid'], 'audioclip', 'file');
if($this->dbc->isError($r)) return $r;
@unlink($fname); @unlink($mdfname);
if ($this->dbc->isError($r)) {
return $r;
}
@unlink($fname);
@unlink($mdfname);
break;
case"playlist":
if($gunid=='') $gunid=NULL;
case "playlist":
if ($gunid == '') {
$gunid = NULL;
}
$parid = $r = $this->_getHomeDirId($owner);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$res = $r = $this->bsPutFile($parid, $pars['name'],
'', $fname,
$pars['gunid'], 'playlist', 'file');
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
@unlink($fname);
break;
case"playlistPkg":
case "playlistPkg":
$chsum = md5_file($fname);
// importPlaylistOpen:
$res = $r = $this->bsOpenPut($chsum, NULL, $owner);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$dest = $res['fname'];
$token = $res['token'];
copy($fname, $dest);
$r = $this->importPlaylistClose($token);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
@unlink($fname);
return $r;
break;
case"searchjob":
case "searchjob":
$crits = file_get_contents($fname);
$criteria = unserialize($crits);
@unlink($fname);
$results = $r =$this->localSearch($criteria);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$realfile = tempnam($this->accessDir, 'searchjob_');
@chmod($realfile, 0660);
$len = $r = file_put_contents($realfile, serialize($results));
$acc = $r = $this->bsAccess($realfile, '', NULL, 'download');
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$url = $this->getUrlPart()."access/".basename($acc['fname']);
$chsum = md5_file($realfile);
$size = filesize($realfile);
$size = filesize($realfile);
$res = array(
'url'=>$url, 'token'=>$acc['token'],
'chsum'=>$chsum, 'size'=>$size,
@ -136,67 +152,77 @@ class Archive extends XR_LocStor{
);
return $res;
break;
case"metadata":
case "metadata":
break;
default:
}
return $res;
}
/**
* Open download transport
* Open download transport
*
* @param sessid: string - session id
* @param trtype: string - transport type
* @param pars: array - transport parameters
* @return hasharray with:
* @param string $sessid - session id
* @param string $trtype - transport type
* @param array $pars - transport parameters
* @return hasharray with:
* url string: writable URL
* token string: PUT token
*/
function downloadOpen($sessid, $trtype, $pars=array())
{
switch($trtype){
case"unknown":
case"audioclip":
case"metadata":
case"playlist":
case"playlistPkg":
if(!isset($pars['gunid']))
switch ($trtype) {
case "unknown":
case "audioclip":
case "metadata":
case "playlist":
case "playlistPkg":
if (!isset($pars['gunid'])) {
return PEAR::raiseError("Archive::downloadOpen: gunid not set");
}
break;
}
$gunid = $pars['gunid'];
// resolve trtype by object type:
if($trtype == 'unknown' || $trtype == 'playlistPkg'){
if ( ($trtype == 'unknown') || ($trtype == 'playlistPkg') ) {
$trtype2 = $r = $this->_getType($gunid);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
// required with content:
$trtype = ($trtype2 == 'playlist' && $trtype == 'playlistPkg'?
'playlistPkg' : $trtype2);
# return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid");
}
switch($trtype){
case"audioclip":
switch ($trtype) {
case "audioclip":
$res = $r = $this->downloadRawAudioDataOpen($sessid, $gunid);
break;
case"metadata":
case "metadata":
$res = $r = $this->downloadMetadataOpen($sessid, $gunid);
break;
case"playlist":
case "playlist":
$res = $r = $this->accessPlaylist($sessid, $gunid);
break;
case"playlistPkg":
case "playlistPkg":
$res = $r = $this->bsExportPlaylistOpen($gunid);
if($this->dbc->isError($r)) return $r;
if ($this->dbc->isError($r)) {
return $r;
}
$tmpn = tempnam($this->transDir, 'plExport_');
$plfpath = "$tmpn.lspl";
copy($res['fname'], $plfpath);
$res = $r = $this->bsExportPlaylistClose($res['token']);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$fname = "transported_playlist.lspl";
$id = $this->_idFromGunid($gunid);
$acc = $this->bsAccess($plfpath, 'lspl', NULL, 'download');
if($this->dbc->isError($acc)){ return $acc; }
if ($this->dbc->isError($acc)) {
return $acc;
}
$url = $this->getUrlPart()."access/".basename($acc['fname']);
$chsum = md5_file($plfpath);
$size = filesize($plfpath);
@ -206,25 +232,27 @@ class Archive extends XR_LocStor{
'filename'=>$fname
);
break;
case"searchjob":
case "searchjob":
$res = $pars;
break;
case"file":
case "file":
$res = $r = array();
break;
default:
return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)");
}
if($this->dbc->isError($r)) return $r;
switch($trtype){
case"audioclip":
case"metadata":
case"playlist":
case"playlistPkg":
if ($this->dbc->isError($r)) {
return $r;
}
switch ($trtype) {
case "audioclip":
case "metadata":
case "playlist":
case "playlistPkg":
$title = $r = $this->bsGetTitle(NULL, $gunid);
break;
case"searchjob": $title = 'searchjob'; break;
case"file": $title = 'regular file'; break;
case "searchjob": $title = 'searchjob'; break;
case "file": $title = 'regular file'; break;
default:
}
$res['title'] = $title;
@ -232,50 +260,67 @@ class Archive extends XR_LocStor{
return $res;
}
/**
* Close download transport
* Close download transport
*
* @param token: string - transport token
* @param trtype: string - transport type
* @return hasharray with:
* @param string $token
* transport token
* @param string $trtype
* transport type
* @return array
* hasharray with:
* url string: writable URL
* token string: PUT token
*/
function downloadClose($token, $trtype)
{
switch($trtype){
case"audioclip":
switch ($trtype) {
case "audioclip":
$res = $r = $this->downloadRawAudioDataClose($token);
if($this->dbc->isError($r)) return $r;
return $res;
break;
case"metadata":
$res = $r = $this->downloadMetadataClose($token);
if($this->dbc->isError($r)) return $r;
return $res;
break;
case"playlist":
$res = $r = $this->releasePlaylist(NULL/*$sessid*/, $token);
if($this->dbc->isError($r)) return $r;
return $res;
break;
case"playlistPkg":
$res = $r = $this->bsRelease($token, 'download');
if($this->dbc->isError($r)) return $r;
$realFname = $r['realFname'];
@unlink($realFname);
if(preg_match("|(plExport_[^\.]+)\.lspl$|", $realFname, $va)){
list(,$tmpn) = $va; $tmpn = "{$this->transDir}/$tmpn";
if(file_exists($tmpn)) @unlink($tmpn);
if ($this->dbc->isError($r)) {
return $r;
}
return $res;
break;
case"searchjob":
$res = $r = $this->bsRelease($token, 'download');
if($this->dbc->isError($r)) return $r;
case "metadata":
$res = $r = $this->downloadMetadataClose($token);
if ($this->dbc->isError($r)) {
return $r;
}
return $res;
break;
case"file":
case "playlist":
$res = $r = $this->releasePlaylist(NULL/*$sessid*/, $token);
if ($this->dbc->isError($r)) {
return $r;
}
return $res;
break;
case "playlistPkg":
$res = $r = $this->bsRelease($token, 'download');
if ($this->dbc->isError($r)) {
return $r;
}
$realFname = $r['realFname'];
@unlink($realFname);
if (preg_match("|(plExport_[^\.]+)\.lspl$|", $realFname, $va)) {
list(,$tmpn) = $va;
$tmpn = "{$this->transDir}/$tmpn";
if (file_exists($tmpn)) {
@unlink($tmpn);
}
}
return $res;
break;
case "searchjob":
$res = $r = $this->bsRelease($token, 'download');
if ($this->dbc->isError($r)) {
return $r;
}
return $res;
break;
case "file":
return array();
break;
default:
@ -283,14 +328,19 @@ class Archive extends XR_LocStor{
}
}
/**
* Prepare hub initiated transport
* Prepare hub initiated transport
*
* @param target: string - hostname of transport target
* @param trtype: string - transport type
* @param direction: string - 'up' | 'down'
* @param pars: array - transport parameters
* @return
* @param string $target
* hostname of transport target
* @param string $trtype
* transport type
* @param string $direction
* 'up' | 'down'
* @param array $pars
* transport parameters
* @return mixed
*/
function prepareHubInitiatedTransfer(
$target, $trtype='file', $direction='up',$pars=array())
@ -299,46 +349,62 @@ class Archive extends XR_LocStor{
$trec = $r = TransportRecord::create($tr, $trtype, $direction,
array_merge($pars, array('target'=>$target))
);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return TRUE;
}
/**
* List hub initiated transports
* List hub initiated transports
*
* @param target: string - hostname of transport target
* @param direction: string - 'up' | 'down'
* @param trtok: string - transport token
* @return
* @param string $target
* hostname of transport target
* @param string $direction
* 'up' | 'down'
* @param string $trtok
* transport token
* @return mixed
*/
function listHubInitiatedTransfers(
$target=NULL, $direction=NULL, $trtok=NULL)
{
$tr =& new Transport($this);
$res = $r = $tr->getTransports($direction, $target, $trtok);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return $res;
}
/**
* Set state of hub initiated transport
* Set state of hub initiated transport
*
* @param target: string - hostname of transport target
* @param trtok: string - transport token
* @param state: string - transport state
* @return
* @param string $target
* hostname of transport target
* @param string $trtok
* transport token
* @param string $state
* transport state
* @return
*/
function setHubInitiatedTransfer($target, $trtok, $state)
{
$tr =& new Transport($this);
$trec = $r = TransportRecord::recall($tr, $trtok);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
$r = $trec->setState($state);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return $res;
}
/* ==================================================== auxiliary methods */
}
} // class Archive
?>

View File

@ -1,36 +1,11 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* \file conf.php
* archiveServer configuration file
* ArchiveServer configuration file
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*/
define('LS_VERSION', '1.0');

View File

@ -1,36 +1,11 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* \file conf.php
* archiveServer configuration file
* ArchiveServer configuration file
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*/
define('LS_VERSION', '1.0');

View File

@ -1,36 +1,11 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* \file conf.php
* archiveServer configuration file
* ArchiveServer configuration file
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*/
/**

View File

@ -1,32 +1,10 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*/
header ("location: html/gbHtmlLogin.php");
exit;
/*

View File

@ -1,32 +1,8 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version : $Revision$
*/
/*------------------------------------------------------------------------------
* This (web-callable) script returns group running httpd

View File

@ -1,32 +1,8 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*/
/*------------------------------------------------------------------------------
* This script returns storage root URL

View File

@ -1,32 +1,8 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*/
/*------------------------------------------------------------------------------
* This script returns storage XMLRPC root URL

View File

@ -1,34 +1,10 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*/
header ("location: ../index.php");
die;
?>
?>

View File

@ -1,35 +1,12 @@
<?php
/*------------------------------------------------------------------------------
/**
* @author $Author$
* @version $Revision$
*/
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
// no remote execution
$arr = array_diff_assoc($_SERVER, $_ENV);
if(isset($arr["DOCUMENT_ROOT"]) && $arr["DOCUMENT_ROOT"] != ""){
if (isset($arr["DOCUMENT_ROOT"]) && $arr["DOCUMENT_ROOT"] != "") {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
@ -42,7 +19,9 @@ require_once '../Archive.php';
function errCallback($err)
{
if(assert_options(ASSERT_ACTIVE)==1) return;
if (assert_options(ASSERT_ACTIVE) == 1) {
return;
}
echo "ERROR:\n";
echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
@ -50,14 +29,14 @@ function errCallback($err)
exit(1);
}
if(!function_exists('pg_connect')){
if (!function_exists('pg_connect')) {
trigger_error("PostgreSQL PHP extension required and not found.", E_USER_ERROR);
exit(2);
}
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){
if (PEAR::isError($dbc)) {
echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
@ -78,13 +57,21 @@ echo "# Install ...\n";
#PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s<hr>\n");
$r = $gb->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit(1); }
if (PEAR::isError($r)) {
echo $r->getUserInfo()."\n";
exit(1);
}
echo "# Testing ...\n";
$r = $gb->test();
if(PEAR::isError($r)){ echo $r->getMessage()."\n"; exit(1); }
if (PEAR::isError($r)) {
echo $r->getMessage()."\n";
exit(1);
}
$log = $gb->test_log;
if($log) echo "# testlog:\n{$log}";
if ($log) {
echo "# testlog:\n{$log}";
}
#echo "# Reinstall + testdata insert ...\n";
#$gb->reinstall();
@ -98,20 +85,24 @@ if($log) echo "# testlog:\n{$log}";
echo "# Delete test data ...\n";
$gb->deleteData();
if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w'))){
if (!($fp = @fopen($config['storageDir']."/_writeTest", 'w'))) {
echo "\n<b>make {$config['storageDir']} dir webdaemon-writeable</b>".
"\nand run install again\n\n";
exit(1);
}else{
} else {
fclose($fp); unlink($config['storageDir']."/_writeTest");
echo "#archiveServer install: OK\n\n";
}
echo "# Install Transport submodule ...";
$r = $tr->install();
if(PEAR::isError($r)){ echo $r->getMessage()."\n"; echo $r->getUserInfo()."\n"; exit(1); }
if (PEAR::isError($r)) {
echo $r->getMessage()."\n";
echo $r->getUserInfo()."\n";
exit(1);
}
echo "# OK\n";
$dbc->disconnect();
?>
?>

View File

@ -1,39 +1,17 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*/
require_once '../conf.php';
require_once 'DB.php';
require_once '../Archive.php';
function errCallback($err)
{
if(assert_options(ASSERT_ACTIVE)==1) return;
if (assert_options(ASSERT_ACTIVE) == 1) {
return;
}
echo "ERROR:\n";
echo "request: "; print_r($_REQUEST);
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo().
@ -44,7 +22,7 @@ function errCallback($err)
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){
if (PEAR::isError($dbc)) {
echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
@ -60,7 +38,10 @@ $tr = &new Transport($gb);
echo "# Uninstall Transport submodule ...";
$r = $tr->uninstall();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
if (PEAR::isError($r)) {
echo $r->getUserInfo()."\n";
exit;
}
echo "\n";
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
@ -68,4 +49,4 @@ $gb->uninstall();
echo "#ArchiveServer uninstall: OK\n";
$dbc->disconnect();
?>
?>

View File

@ -1,64 +1,51 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*/
require_once "../Archive.php";
/**
* XML-RPC interface for Archive
*
* XML-RPC interface for Archive.
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*
*/
class XR_Archive extends Archive{
class XR_Archive extends Archive {
/**
* Simple ping method - return strtouppered string
* Simple ping method - return strtouppered string
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_ping($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
if (!$ok) {
return $r;
}
$res = date("Ymd-H:i:s")." Network hub answer: {$r['par']}";
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
*
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_uploadOpen($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
if (!$ok) {
return $r;
}
$res = $this->uploadOpen($r['sessid'], $r['chsum']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_uploadOpen: ".$res->getMessage().
" ".$res->getUserInfo()
@ -66,17 +53,20 @@ class XR_Archive extends Archive{
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
* Check state of file upload
* Check state of file upload
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_uploadCheck($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
if (!$ok) {
return $r;
}
$res = $this->uploadCheck($r['token']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_uploadCheck: ".$res->getMessage().
" ".$res->getUserInfo()
@ -84,17 +74,18 @@ class XR_Archive extends Archive{
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
*
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_uploadClose($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
if (!$ok) {
return $r;
}
$res = $this->uploadClose($r['token'], $r['trtype'], $r['pars']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_uploadClose: ".$res->getMessage().
" ".$res->getUserInfo()
@ -102,17 +93,18 @@ class XR_Archive extends Archive{
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
*
*
* @param input XMLRPC struct
* @param XMLRPC_strcut $input
*/
function xr_downloadOpen($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
if (!$ok) {
return $r;
}
$res = $this->downloadOpen($r['sessid'], $r['trtype'], $r['pars']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_downloadOpen: ".$res->getMessage().
" ".$res->getUserInfo()
@ -120,17 +112,18 @@ class XR_Archive extends Archive{
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
*
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_downloadClose($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
if (!$ok) {
return $r;
}
$res = $this->downloadClose($r['token'], $r['trtype']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_downloadClose: ".$res->getMessage().
" ".$res->getUserInfo()
@ -138,22 +131,24 @@ class XR_Archive extends Archive{
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
*
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_prepareHubInitiatedTransfer($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
foreach(
array('trtype'=>NULL, 'direction'=>'up', 'pars'=>array())
as $k=>$dv)
{ if(!isset($r[$k])) $r[$k]=$dv; }
if (!$ok) {
return $r;
}
foreach (array('trtype'=>NULL, 'direction'=>'up', 'pars'=>array()) as $k => $dv) {
if (!isset($r[$k])) {
$r[$k] = $dv;
}
}
$res = $this->prepareHubInitiatedTransfer(
$r['target'], $r['trtype'], $r['direction'], $r['pars']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_prepareHubInitiatedTransfer: ".$res->getMessage().
" ".$res->getUserInfo()
@ -161,22 +156,24 @@ class XR_Archive extends Archive{
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
*
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_listHubInitiatedTransfers($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
foreach(
array('target'=>NULL, 'direction'=>NULL, 'trtok'=>NULL)
as $k=>$dv)
{ if(!isset($r[$k])) $r[$k]=$dv; }
if (!$ok) {
return $r;
}
foreach (array('target'=>NULL, 'direction'=>NULL, 'trtok'=>NULL) as $k=>$dv) {
if (!isset($r[$k])) {
$r[$k] = $dv;
}
}
$res = $this->listHubInitiatedTransfers(
$r['target'], $r['direction'], $r['trtok']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_listHubInitiatedTransfers: ".$res->getMessage().
" ".$res->getUserInfo()
@ -184,18 +181,19 @@ class XR_Archive extends Archive{
return new XML_RPC_Response(XML_RPC_encode($res));
}
/**
*
*
* @param input XMLRPC struct
* @param XMLRPC_struct $input
*/
function xr_setHubInitiatedTransfer($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
if (!$ok) {
return $r;
}
$res = $this->setHubInitiatedTransfer(
$r['target'], $r['trtok'], $r['state']);
if(PEAR::isError($res))
if (PEAR::isError($res))
return new XML_RPC_Response(0, 803,
"xr_setHubInitiatedTransfer: ".$res->getMessage().
" ".$res->getUserInfo()
@ -206,4 +204,4 @@ class XR_Archive extends Archive{
}
?>
?>

View File

@ -1,35 +1,5 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* \file put.php
* Store PUT data as temporary file.
*
* put.php is remote callable script through HTTP PUT method.
@ -52,7 +22,11 @@
* <li> 500 - Application error</li>
* </ul>
*
* @see XR_LocStor
* @see XR_LocStor
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage ArchiveServer
*/
require_once dirname(__FILE__).'/../conf.php';

View File

@ -1,30 +1,7 @@
#!/bin/sh
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the Campcaster project.
# http://campcaster.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author$
# Version : $Revision$
# Location : $URL$
#-------------------------------------------------------------------------------
#DEBUG=yes

View File

@ -1,32 +1,9 @@
<?php
/*------------------------------------------------------------------------------
/**
* @author $Author$
* @version : $Revision$
*/
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
define('PHP5', version_compare( phpversion(), "5.0.0", ">=" ));
/* ====================================================== specific PHP config */
@ -62,12 +39,12 @@ require_once 'XR_Archive.php';
function errHndl($errno, $errmsg, $filename, $linenum, $vars){
switch($errno){
case E_WARNING:
case E_NOTICE:
case E_NOTICE:
case E_USER_WARNING:
case E_USER_NOTICE:
case E_USER_NOTICE:
return;
break;
default:
break;
default:
$xr =& new XML_RPC_Response(0, 805,
htmlspecialchars("ERROR:xrLocStor: $errno $errmsg ($filename:$linenum)"));
header("Content-type: text/xml");

View File

@ -1,33 +1,4 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the Campcaster project.
http://campcaster.campware.org/
To report bugs, send an e-mail to bugs@campware.org
Campcaster is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Campcaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Campcaster; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
include_once "XML/RPC.php";
$pars = $argv;