Initial revision
This commit is contained in:
parent
510091e734
commit
081298ea89
|
@ -0,0 +1,155 @@
|
|||
#-------------------------------------------------------------------------------
|
||||
# ArchiveServer - central archive component
|
||||
# Copyright (c) 2004 Media Development Loan Fund
|
||||
#
|
||||
# This file is part of the LiveSupport project.
|
||||
#
|
||||
# LiveSupport 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.
|
||||
#
|
||||
# LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Author : $Author: tomas $
|
||||
# Version : $Revision: 1.1 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/Attic/Makefile,v $
|
||||
#
|
||||
# @configure_input@
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# General command definitions
|
||||
#-------------------------------------------------------------------------------
|
||||
MKDIR = mkdir -p
|
||||
RM = rm -f
|
||||
RMDIR = rm -rf
|
||||
DOXYGEN = doxygen
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Misc
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
MODULE_NAME = archiveServer
|
||||
TAR_C = tar -cj --exclude CVS --exclude '*~' -C ${BASE_DIR} -f
|
||||
DIST_EXT = .tgz
|
||||
DATE = `date +%y%m%d`
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Basic directory and file definitions
|
||||
#-------------------------------------------------------------------------------
|
||||
#BASE_DIR = @builddir@
|
||||
BASE_DIR = .
|
||||
DOC_DIR = ${BASE_DIR}/doc
|
||||
DOXYGEN_DIR = ${DOC_DIR}/doxygen
|
||||
ETC_DIR = ${BASE_DIR}/etc
|
||||
INCLUDE_DIR = ${BASE_DIR}/include
|
||||
LIB_DIR = ${BASE_DIR}/lib
|
||||
SRC_DIR = ${BASE_DIR}/src
|
||||
TMP_DIR = ${BASE_DIR}/tmp
|
||||
|
||||
USR_DIR = ${BASE_DIR}/../../usr
|
||||
USR_INCLUDE_DIR = ${USR_DIR}/include
|
||||
USR_LIB_DIR = ${USR_DIR}/lib
|
||||
|
||||
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
|
||||
|
||||
HTTP_GROUP = apache
|
||||
#HTTP_GROUP = nobody
|
||||
|
||||
PHP_DIR = ${BASE_DIR}/var
|
||||
INSTALL_DIR = ${PHP_DIR}/install
|
||||
STOR_DIR = ${PHP_DIR}/stor
|
||||
ACCESS_DIR = ${PHP_DIR}/access
|
||||
BUFF_DIR = ${STOR_DIR}/buffer
|
||||
TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Configuration parameters
|
||||
#-------------------------------------------------------------------------------
|
||||
#CPPFLAGS = @CPPFLAGS@
|
||||
#CXXFLAGS = @CXXFLAGS@ @DEFS@ -I${USR_INCLUDE_DIR} -I${INCLUDE_DIR} -I${TMP_DIR}\
|
||||
# -pedantic -Wall
|
||||
#LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} -L${LIB_DIR}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
#-------------------------------------------------------------------------------
|
||||
#HELLO_LIB_OBJS = ${TMP_DIR}/Hello.o
|
||||
#TEST_RUNNER_OBJS = ${TMP_DIR}/HelloTest.o ${TMP_DIR}/TestRunner.o
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Targets
|
||||
#-------------------------------------------------------------------------------
|
||||
.PHONY: all dir_setup doc clean docclean depclean distclean dist db_init db_clean
|
||||
|
||||
all: dir_setup db_init
|
||||
|
||||
dir_setup: ${DOXYGEN_DIR} ${STOR_DIR} ${ACCESS_DIR}
|
||||
|
||||
doc:
|
||||
${DOXYGEN} ${DOXYGEN_CONFIG}
|
||||
|
||||
clean: db_clean
|
||||
|
||||
docclean:
|
||||
${RMDIR} ${DOXYGEN_DIR}/html
|
||||
|
||||
depclean: clean
|
||||
|
||||
dist:
|
||||
${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} *
|
||||
|
||||
distclean: clean docclean
|
||||
|
||||
#check: all ${TEST_RUNNER}
|
||||
# ${TEST_RUNNER}
|
||||
check: all
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Specific targets
|
||||
#-------------------------------------------------------------------------------
|
||||
db_init:
|
||||
cd var/install; php -q install.php
|
||||
|
||||
db_clean:
|
||||
cd var/install; php -q uninstall.php
|
||||
|
||||
${TMP_DIR}:
|
||||
${MKDIR} ${TMP_DIR}
|
||||
|
||||
${DOXYGEN_DIR}:
|
||||
${MKDIR} ${DOXYGEN_DIR}
|
||||
|
||||
${STOR_DIR}:
|
||||
${MKDIR} ${STOR_DIR}
|
||||
chown .${HTTP_GROUP} ${STOR_DIR}
|
||||
chmod g+ws ${STOR_DIR}
|
||||
|
||||
${ACCESS_DIR}:
|
||||
${MKDIR} ${ACCESS_DIR}
|
||||
chown .${HTTP_GROUP} ${ACCESS_DIR}
|
||||
chmod g+ws ${ACCESS_DIR}
|
||||
|
||||
${BUFF_DIR}:
|
||||
${MKDIR} ${BUFF_DIR}
|
||||
chmod g+w ${BUFF_DIR}
|
||||
|
||||
${TEST_RUNNER}:
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Pattern rules
|
||||
#-------------------------------------------------------------------------------
|
||||
#${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
|
||||
# ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
The HTTP_GROUP variable in Makefile haveto be set to group running apache.
|
||||
|
||||
Install steps for file uploading (do it with appropriate changes):
|
||||
(PUT method for uploading from behind firewall with resume feature)
|
||||
|
||||
1) mkdir cgi-bin-put in apache2 dir
|
||||
2) move put.cgi there from var subdir
|
||||
3) add to apache2 config (i.g. commonapache2.conf):
|
||||
|
||||
<Location /livesupport/modules/archiveServer/var/access>
|
||||
Script PUT /cgi-bin-put/put.cgi
|
||||
</Location>
|
||||
ScriptAlias /cgi-bin-put/ "/usr/local/apache2/cgi-bin-put/"
|
||||
<Directory /usr/local/apache2/cgi-bin-put>
|
||||
AllowOverride All
|
||||
Options ExecCGI
|
||||
<IfModule mod_access.c>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
4) reload apache2
|
||||
|
||||
Tested with apache 2.0.49 and (without Directory tag) with apache 1.3.28.
|
||||
|
||||
TODO: check more put.cgi for security problems!
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/Archive.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once "../../../storageServer/var/LocStor.php";
|
||||
|
||||
$config['archiveUrlPath'] = '/livesupport/modules/archiveServer/var';
|
||||
$config['archiveXMLRPC'] = 'xmlrpc/xrArchive.php';
|
||||
$config['archiveUrlHost'] = 'localhost';
|
||||
$config['archiveUrlPort'] = 80;
|
||||
$config['archiveAccountLogin'] = 'root';
|
||||
$config['archiveAccountPass'] = 'q';
|
||||
|
||||
/**
|
||||
* Extension to StorageServer to act as ArchiveServer
|
||||
*/
|
||||
class Archive extends LocStor{
|
||||
|
||||
/**
|
||||
* Open download
|
||||
*/
|
||||
function downloadOpen($sessid, $gunid)
|
||||
{
|
||||
// access
|
||||
$lnk = $this->accessRawAudioData($sessid, $gunid);
|
||||
if(PEAR::isError($lnk)) return $lnk;
|
||||
// return tmpurl, fname, md5h
|
||||
$url = $this->_lnk2url($lnk);
|
||||
$md5h = $this->_md5sum($lnk);
|
||||
return array('url'=>$url, 'md5h'=>$md5h, 'fname'=>basename($lnk));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close download
|
||||
*/
|
||||
function downloadClose($sessid, $url)
|
||||
{
|
||||
// release
|
||||
$lnk = $this->_url2lnk($url);
|
||||
$res = $this->releaseRawAudioData($sessid, $lnk);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open upload
|
||||
*/
|
||||
function uploadOpen($sessid, $gunid)
|
||||
{
|
||||
$fname = "{$this->storageDir}/buffer/$gunid";
|
||||
if(!$fp = fopen($fname, 'w')) return PEAR::raiseError(
|
||||
"Archive::uploadOpen: unable to create blank file"
|
||||
);
|
||||
fclose($fp);
|
||||
$res = $this->storeAudioClip($sessid, $gunid, $fname, '');
|
||||
if(PEAR::isError($res)) return $res;
|
||||
$lnk = $this->accessRawAudioData($sessid, $gunid);
|
||||
if(PEAR::isError($lnk)) return $lnk;
|
||||
$url = $this->_lnk2url($lnk);
|
||||
return array('url'=>$url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Abort upload
|
||||
*/
|
||||
function uploadAbort($sessid, $url)
|
||||
{
|
||||
$lnk = $this->_url2lnk($url);
|
||||
$res = $this->releaseRawAudioData($sessid, $lnk);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check upload
|
||||
*/
|
||||
function uploadCheck($sessid, $url)
|
||||
{
|
||||
$lnk = $this->_url2lnk($url);
|
||||
$md5h = $this->_md5sum($lnk);
|
||||
$size = filesize($lnk);
|
||||
return array('md5h'=>$md5h, 'size'=>$size, 'url'=>$url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close upload
|
||||
*/
|
||||
function uploadClose($sessid, $url, $type='file')
|
||||
{
|
||||
switch($type){
|
||||
default: // case"file":
|
||||
// release
|
||||
$lnk = $this->_url2lnk($url);
|
||||
$res = $this->releaseRawAudioData($sessid, $lnk);
|
||||
return $res;
|
||||
break;
|
||||
case"search":
|
||||
// localSearch
|
||||
// return results
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate local symlink to URL
|
||||
*
|
||||
*/
|
||||
function _lnk2url($lnk)
|
||||
{
|
||||
return "http://{$this->config['archiveUrlHost']}:{$this->config['archiveUrlPort']}".
|
||||
"{$this->config['archiveUrlPath']}/access/".basename($lnk);
|
||||
}
|
||||
|
||||
/**
|
||||
* Traslate URL to local symlink
|
||||
*
|
||||
*/
|
||||
function _url2lnk($url)
|
||||
{
|
||||
return $this->accessDir."/".basename($url);
|
||||
}
|
||||
function _md5sum($fpath)
|
||||
{
|
||||
$md5h = `md5sum $fpath`;
|
||||
$arr = split(' ', $md5h);
|
||||
return $arr[0];
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,63 @@
|
|||
<?
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/conf.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
$config = array(
|
||||
'dsn' => array(
|
||||
'username' => 'test',
|
||||
'password' => 'test',
|
||||
'hostspec' => 'localhost',
|
||||
# 'hostspec' => '127.0.0.1', // for bad resolver
|
||||
'phptype' => 'pgsql',
|
||||
'database' => 'LiveSupport-test',
|
||||
),
|
||||
'tblNamePrefix' => 'as_',
|
||||
'authCookieName'=> 'assid',
|
||||
'RootNode' => 'RootNode',
|
||||
'tmpRootPass' => 'q',
|
||||
'objtypes' => array(
|
||||
'RootNode' => array('Folder'),
|
||||
'Storage' => array('Folder', 'File', 'Replica'),
|
||||
'Folder' => array('Folder', 'File', 'Replica'),
|
||||
'File' => array(),
|
||||
'Replica' => array(),
|
||||
),
|
||||
'allowedActions'=> array(
|
||||
'RootNode' => array('classes', 'subjects'),
|
||||
'Folder' => array('editPrivs', 'write', 'read'),
|
||||
'File' => array('editPrivs', 'write', 'read'),
|
||||
'Replica' => array('editPrivs', 'write', 'read'),
|
||||
'_class' => array('editPrivs', 'write', 'read'),
|
||||
),
|
||||
'allActions' => array(
|
||||
'editPrivs', 'write', 'read', 'classes', 'subjects'
|
||||
),
|
||||
'storageDir' => dirname(getcwd()).'/stor',
|
||||
'accessDir' => dirname(getcwd()).'/access',
|
||||
);
|
||||
?>
|
|
@ -0,0 +1,19 @@
|
|||
<!--
|
||||
/*body { font-family:'Arial CE', 'Helvetica CE', Arial, helvetica, sans-serif; background-color:#eee; }*/
|
||||
body { font-family:sans-serif; background-color:#eee; }
|
||||
h1 { border:0px solid black; margin-bottom:2px; font-size:x-large; }
|
||||
h2 { border:0px solid black; margin-bottom:2px; margin-top:2px; font-size:large; }
|
||||
h3 { border:0px solid black; margin-bottom:1ex; margin-top:2px; font-size:medium; font-weight:bold; }
|
||||
table { border-collapse:collapse; margin:1ex 0px; }
|
||||
tr.odd { background-color:#ccc; }
|
||||
tr.ev { background-color:#aaa; }
|
||||
td { border:0px solid black; padding:2px 1em; }
|
||||
pre { border:solid black; border-width:1px 0px; padding:1em 1px;}
|
||||
.b { font-weight:bold; }
|
||||
.slash { padding:0px 0px; }
|
||||
.lnkbutt { padding:0px 4px; font-weigt:bolder; }
|
||||
.hidden { display:none; }
|
||||
.button { border:1px outset; background-color:#eee; padding:0px 4px; }
|
||||
.button:hover { background-color:#fff; }
|
||||
.button:active { border:1px inset; }
|
||||
-->
|
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
#echo"<pre>\n"; print_r($_FILES); print_r($_REQUEST); print_r($_SERVER); exit;
|
||||
require_once"gbHtml_h.php";
|
||||
require_once"gbHtmlTestAuth.php";
|
||||
|
||||
$fldsname=array('author'=>'Author', 'title'=>'Title', 'creator'=>'Creator',
|
||||
'description'=>'Description', 'subject'=>'Subject', 'genre'=>'Genre');
|
||||
|
||||
$sessid = $_REQUEST[$config['authCookieName']];
|
||||
$userid = $gb->getSessUserId($sessid);
|
||||
$login = $gb->getSessLogin($sessid);
|
||||
|
||||
#$path = ($_REQUEST['path']=='' ? '/' : $_REQUEST['path']);
|
||||
$id = (!$_REQUEST['id'] ? $gb->storId : $_REQUEST['id']);
|
||||
|
||||
#echo"<pre>\nsessid=$sessid\nuserid=$userid\nlogin=$login\n"; exit;
|
||||
|
||||
$tpldata = array(
|
||||
'msg' => $_SESSION['alertMsg'],
|
||||
'loggedAs' => $login,
|
||||
'id' => $id,
|
||||
); unset($_SESSION['alertMsg']);
|
||||
|
||||
switch($_REQUEST['act']){
|
||||
case"getHomeDir":
|
||||
$id = $gb->getObjId($login, $gb->storId);
|
||||
$tpldata['id'] = $id;
|
||||
default:
|
||||
# echo"<pre>\n$path\n$upath<hr>\n"; print_r($_FILES); print_r($_REQUEST); exit;
|
||||
$tpldata=array_merge($tpldata, array(
|
||||
'pathdata' => $gb->getPath($id, $sessid),
|
||||
'listdata' => ($gb->getObjType($id)=='Folder'?
|
||||
$gb->listFolder($id, $sessid):array()
|
||||
),
|
||||
'tree' => ($_REQUEST['tree']=='Y'),
|
||||
'showPath' => true,
|
||||
'showTree' => true,
|
||||
));
|
||||
if($_REQUEST['tree']=='Y'){
|
||||
$tpldata['treedata'] = $gb->getSubTree($id, $sessid);
|
||||
}
|
||||
break;
|
||||
case"newfile":
|
||||
$tpldata=array(
|
||||
'pathdata' => $gb->getPath($id, $sessid),
|
||||
'showEdit' => true,
|
||||
'id' => $id,
|
||||
);
|
||||
break;
|
||||
case"sform":
|
||||
$tpldata=array(
|
||||
# 'pathdata' => $gb->getPath($path, $sessid),
|
||||
'showSForm' => true,
|
||||
'id' => $id,
|
||||
);
|
||||
break;
|
||||
case"search":
|
||||
$tpldata=array(
|
||||
# 'pathdata' => $gb->getPath($path, $sessid),
|
||||
'search' => $gb->localSearch($_REQUEST['srch'], $sessid),
|
||||
'showSRes' => true,
|
||||
'id' => $id,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
if(PEAR::isError($tpldata['listdata'])){
|
||||
$tpldata['msg'] = $tpldata['listdata']->getMessage();
|
||||
$tpldata['listdata'] = array();
|
||||
}
|
||||
#echo"<pre>\n$path<hr>\n"; print_r($tpldata['pathdata']); print_r($tpldata); exit;
|
||||
|
||||
$tpldata['showMenu']=true;
|
||||
|
||||
|
||||
// =================== template: ===================
|
||||
|
||||
?>
|
||||
<html><head>
|
||||
<title>Browser</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="default.css">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#rmenu { float:right; margin-right:1em; border:1px solid black; background-color:#ddd; padding:2px 1ex; }
|
||||
#parent, #parent a { background-color:#888; font-weight:bold; color:white; }
|
||||
#tree { width:50%; }
|
||||
-->
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function frename(name, id){
|
||||
var s=document.getElementById('ID'+id);
|
||||
s.innerHTML='<form action="gbHttp.php" method="post" style="display:inline">'+
|
||||
'<input type="text" name="newname" value="'+name+'" size="12">'+
|
||||
'<input type="hidden" name="id" value="'+id+'">'+
|
||||
'<input type="hidden" name="act" value="rename">'+
|
||||
'</form>';
|
||||
}
|
||||
function fmove(id, relPath){
|
||||
var newPath=prompt('Destination folder (relative path):', relPath);
|
||||
if(newPath==null) return;
|
||||
location.href='gbHttp.php?id='+id+'&act=move&newPath='+newPath;
|
||||
}
|
||||
function fcopy(id, relPath){
|
||||
var newPath=prompt('Destination folder (relative path):', relPath);
|
||||
if(newPath==null) return;
|
||||
location.href='gbHttp.php?id='+id+'&act=copy&newPath='+newPath;
|
||||
}
|
||||
function freplicate(name, id){
|
||||
var np=prompt('Destination folder (relative path):', id);
|
||||
if(np==null) return;
|
||||
location.href='gbHttp.php?id='+id+'&act=repl&newparid='+np;
|
||||
}
|
||||
function newFolder(){
|
||||
var nn=prompt('New folder name:');
|
||||
if(nn==null) return;
|
||||
location.href='gbHttp.php?id=<?php echo$tpldata['id']?>&act=newFolder&newname='+nn;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
</head><body>
|
||||
<div id="rmenu">
|
||||
Logged as: <span class="b"><?php echo$tpldata['loggedAs']?></span><br>
|
||||
<a href="gbHttp.php?act=logout">logout</a><br>
|
||||
<a href="gbHtmlPerms.php?id=<?php echo$tpldata['id']?>">Permission editor</a><br>
|
||||
<a href="gbHtmlSubj.php">User/Group editor</a><br>
|
||||
</div>
|
||||
|
||||
<?php if($tpldata['showMenu']){?>
|
||||
<h3>
|
||||
<a href="gbHtmlBrowse.php?act=getHomeDir" class="button">Home directory</a>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo$tpldata['id']?>&act=newfile" class="button"><span class="hidden">[</span>Upload new file<span class="hidden">]</span></a>
|
||||
<a href="javascript:newFolder()" class="button"><span class="hidden">[</span>Create new folder<span class="hidden">]</span></a>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo$tpldata['id']?>&act=sform" class="button"><span class="hidden">[</span>Search<span class="hidden">]</span></a>
|
||||
</h3>
|
||||
<?php }?>
|
||||
|
||||
<?php if($tpldata['showPath']){?>
|
||||
<h3>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo$tpldata['id']?>&tree=Y" class="button">Tree</a>
|
||||
<?php foreach($tpldata['pathdata'] as $o){?>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo urlencode($o['id'])?>"><?php echo$o['name']?></a>
|
||||
<?php if($o['type']=='Folder'){?><span class="slash b">/</span><?php }?>
|
||||
<?php }?>:
|
||||
<span style="padding-left:6em">
|
||||
<a href="gbHtmlPerms.php?id=<?php echo$id?>" class="button">permissions</a>
|
||||
</span>
|
||||
</h3>
|
||||
<?php }?>
|
||||
|
||||
<?php if($tpldata['showTree']) if($tpldata['tree']){?>
|
||||
<?php foreach($tpldata['treedata'] as $o){?>
|
||||
<?php echo str_repeat(' ', ($tpldata['tree']?intval($o['level']):3)*2)?>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo$o['id']?>"><?php echo$o['name']?></a>
|
||||
<br>
|
||||
<?php }?>
|
||||
<?php }else{?>
|
||||
<table border="0">
|
||||
<?php foreach($tpldata['listdata'] as $o){?>
|
||||
<tr><td valign="top">
|
||||
<?php echo str_repeat(' ', ($tpldata['tree']?intval($o['level']):3)*2)?><span id="ID<?php echo$o['id']?>"
|
||||
><a <?php if($o['type']=='Folder'){?>href="gbHtmlBrowse.php?id=<?php echo$o['id']?>"<?php }?>><?php echo$o['name']?></a
|
||||
></span>
|
||||
</td><td>
|
||||
<?php $a=array('Folder'=>'D', 'File'=>'F', 'Replica'=>'R'); echo$a[$o['type']]?>
|
||||
<a href="javascript:frename('<?php echo$o['name']?>', '<?php echo$o['id']?>')" class="button">rename</a>
|
||||
<a href="javascript:fmove('<?php echo$o['id']?>', '.')" class="button">move</a>
|
||||
<a href="javascript:fcopy('<?php echo$o['id']?>', '.')" class="button">copy</a>
|
||||
<?php /*?>
|
||||
<a href="javascript:freplicate('<?php echo$o['name']?>', '<?php echo$o['id']?>')" class="button">replicate</a>
|
||||
<?php */?>
|
||||
<a href="gbHtmlPerms.php?id=<?php echo$o['id']?>" class="button">permissions</a>
|
||||
<a href="gbHttp.php?act=delete&id=<?php echo$o['id']?>" class="button"
|
||||
onClick="return confirm('Delete object "<?php echo$o['name']?>"?')">DEL</a>
|
||||
<?php if($o['type']=='File'){?>
|
||||
<a href="gbHttp.php?act=getFile&id=<?php echo$o['id']?>" class="button">Access</a>
|
||||
<a href="gbHttp.php?act=getInfo&id=<?php echo$o['id']?>" class="button">Analyze</a>
|
||||
<a href="gbHttp.php?act=getMdata&id=<?php echo$o['id']?>" class="button">MetaData</a>
|
||||
<?php }?>
|
||||
<?php if($o['type']=='Replica'){?>
|
||||
(-><?php echo$o['target']?>)
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } if(count($tpldata['listdata'])==0){?>
|
||||
<tr><td>No objects</td></tr>
|
||||
<?php }?>
|
||||
</table>
|
||||
<?php }?>
|
||||
|
||||
<?php if($tpldata['showEdit']){?>
|
||||
<form method="post" enctype="multipart/form-data" action="gbHttp.php">
|
||||
<?php #<form method="post" enctype="multipart/form-data" action="http://localhost:8000">?>
|
||||
<table>
|
||||
<tr><td>File name:</td><td><input type="text" name="filename" value=""></td></tr>
|
||||
<tr><td>Media file:</td><td><input type="file" name="mediafile"></td></tr>
|
||||
<tr><td>Metadata file:</td><td><input type="file" name="mdatafile"></td></tr>
|
||||
<?php for($i=0; $i<0; $i++){?>
|
||||
<tr><td>
|
||||
<select name="elnames[<?php echo$i?>]">
|
||||
<?php $ii=0?>
|
||||
<?php foreach($fldsname as $fld=>$descr){?>
|
||||
<option value="<?php echo$fld?>"<?php echo($i==$ii++ ? ' selected' : '')?>><?php echo$descr?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</td><td><input type="text" name="elvals[<?php echo$i?>]" value=""></td></tr>
|
||||
<?php }?>
|
||||
<tr><td colspan="2"><input type="submit" value="Send!"></td></tr>
|
||||
</table>
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="1048576">
|
||||
<input type="hidden" name="act" value="upload">
|
||||
<input type="hidden" name="id" value="<?php echo$tpldata['id']?>">
|
||||
</form>
|
||||
<?php }?>
|
||||
|
||||
<?php if($tpldata['showSForm']){?>
|
||||
<form method="post" action="gbHtmlBrowse.php">
|
||||
<table>
|
||||
<tr><td>Search string:</td><td><input type="text" name="srch" value=""></td></tr>
|
||||
<tr><td colspan="2"><input type="submit" value="Send!"></td></tr>
|
||||
</table>
|
||||
<input type="hidden" name="act" value="search">
|
||||
<input type="hidden" name="id" value="<?php echo$tpldata['id']?>">
|
||||
</form>
|
||||
<?php }?>
|
||||
|
||||
<?php if($tpldata['showSRes']){?>
|
||||
<ul>
|
||||
<?php if(is_array($tpldata['search'])) foreach($tpldata['search'] as $k=>$v){?>
|
||||
<li><a href="gbHttp.php?act=getMdata&id=<?php echo$gb->_idFromGunid($v['gunid'])?>"><?php echo$v['gunid']?></a>
|
||||
<?php }else{?>
|
||||
No items found
|
||||
<?php }?>
|
||||
</ul>
|
||||
<?php }?>
|
||||
|
||||
<?php if($tpldata['msg']){?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
alert('<?php echo$tpldata['msg']?>');
|
||||
-->
|
||||
</script><noscript><?php echo$tpldata['msg']?></noscript>
|
||||
<?php }?>
|
||||
</body></html>
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
// $Id: gbHtmlLogin.php,v 1.1 2004/09/21 00:43:21 tomas Exp $
|
||||
require_once"gbHtml_h.php";
|
||||
|
||||
// prefill data structure for template
|
||||
$d = array(
|
||||
'users' => $gb->getSubjects(),
|
||||
'actions' => $gb->getAllActions(),
|
||||
'objects' => $gb->getAllObjects(),
|
||||
'msg' => $_SESSION['alertMsg']
|
||||
);
|
||||
unset($_SESSION['alertMsg']);
|
||||
|
||||
// forms prefill:
|
||||
if(is_array($_SESSION['lastPost'])) $d = array_merge($d, array(
|
||||
'lastSubj' => $_SESSION['lastPost']['subj'],
|
||||
'lastAction'=> $_SESSION['lastPost']['permAction'],
|
||||
'lastObj' => $_SESSION['lastPost']['obj']
|
||||
));
|
||||
unset($_SESSION['lastPost']);
|
||||
|
||||
#header("Content-type: text/plain"); print_r($d); exit;
|
||||
#require_once"gbHtml_f.php";
|
||||
// template follows:
|
||||
?>
|
||||
<html><head>
|
||||
<title>Storage - login</title>
|
||||
<link rel="stylesheet" type="text/css" href="default.css">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#help { float:right; margin-right:1em; border:1px solid black; background-color:#ddd; padding:2px 1ex; }
|
||||
-->
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function preloadLogin(u, p)
|
||||
{
|
||||
var f=document.getElementById('loginform');
|
||||
f.login.value=u;
|
||||
f.pass.value=p;
|
||||
f.submit();
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
</head><body>
|
||||
|
||||
<div id="help">
|
||||
Test accounts/pass:
|
||||
<ul style="margin:1px 0px">
|
||||
<li><a href="javascript:preloadLogin('root', 'q')">root/q</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h1>Storage - login</h1>
|
||||
|
||||
<form action="gbHttp.php" method="post" id="loginform">
|
||||
<table>
|
||||
<tr><td>Login:</td><td><input type="text" name="login"></td></tr>
|
||||
<tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
|
||||
<tr><td colspan="2"><input type="hidden" name="act" value="login">
|
||||
<input type="submit" value="Go!">
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php if($d['msg']){ //error message printing: ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
alert('<?php echo$d['msg']?>');
|
||||
-->
|
||||
</script>
|
||||
<?php }?>
|
||||
<body></html>
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
// $Id: gbHtmlPerms.php,v 1.1 2004/09/21 00:43:22 tomas Exp $
|
||||
require_once"gbHtml_h.php";
|
||||
require_once"gbHtmlTestAuth.php";
|
||||
|
||||
$userid = $gb->getSessUserId($_REQUEST[$config['authCookieName']]);
|
||||
$login = $gb->getSessLogin($_REQUEST[$config['authCookieName']]);
|
||||
|
||||
$id = (!$_REQUEST['id'] ? $gb->storId : $_REQUEST['id']);
|
||||
|
||||
#header("Content-type: text/plain"); print_r($_REQUEST); exit;
|
||||
#header("Content-type: text/plain"); echo $gb->dumpTree($id, ' ')."\n"; exit;
|
||||
|
||||
// prefill data structure for template
|
||||
$tpldata = array(
|
||||
'pathdata' => $gb->getPath($id),
|
||||
'perms' => $gb->getObjPerms($id),
|
||||
'actions' => $gb->getAllowedActions($gb->getObjType($id)),
|
||||
'subjects' => $gb->getSubjects(),
|
||||
'id' => $id,
|
||||
'loggedAs' => $login,
|
||||
);
|
||||
$tpldata['msg'] = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']);
|
||||
|
||||
#header("Content-type: text/plain"); print_r($tpldata); exit;
|
||||
|
||||
|
||||
#require_once"gbHtml_f.php";
|
||||
// template follows:
|
||||
?>
|
||||
<html><head>
|
||||
<title>Storage - permission editor</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="default.css">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#menu { float:right; margin-right:1em; border:1px solid black; background-color:#ddd; padding:2px 1ex; }
|
||||
#tbl { width:60%; }
|
||||
-->
|
||||
</style>
|
||||
</head><body>
|
||||
<div id="menu">
|
||||
Logged as: <span class="b"><?php echo$tpldata['loggedAs']?></span><br>
|
||||
<a href="gbHttp.php?act=logout">Logout</a><br>
|
||||
<?php if(is_array($tpldata['pathdata'])){?>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo$id?>">Browser</a><br>
|
||||
<?php }else{?>
|
||||
<a href="gbHtmlBrowse.php">Tree editor</a><br>
|
||||
<?php }?>
|
||||
<a href="gbHtmlSubj.php">User/Group editor</a><br>
|
||||
</div>
|
||||
|
||||
<h1>Permission editor</h1>
|
||||
<?php if(is_array($tpldata['pathdata'])){?>
|
||||
<h2><a href="gbHtmlBrowse.php?id=<?php echo$id?>" title="Tree editor">Path</a>:
|
||||
<?php foreach($tpldata['pathdata'] as $k=>$it) {?>
|
||||
<?php echo$it["name"]?></a><span class="slash">/</span>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</h2>
|
||||
|
||||
<table id="tbl" border="0" cellpadding="5">
|
||||
<tr><td>subject name</td><td>action</td><td>permission</td><td></td></tr>
|
||||
<?php if(is_array($tpldata['perms'])&&count($tpldata['perms'])>0) foreach($tpldata['perms'] as $k=>$row) {
|
||||
$da=($row['type']=='A' ? 'allow' : ($row['type']=='D' ? '<b>deny</b>' : $row['type']));?>
|
||||
<tr class="<?php echo(($o=1-$o) ? 'odd' : 'ev')?>">
|
||||
<td class="b"><a <?php #href="alibExPList.php?id=<?php echo$row['subj']? >"?>><?php echo$row['login']?></a></td>
|
||||
<td class="b"><?php echo$row['action']?></td>
|
||||
<td><?php echo$da?></td>
|
||||
<td>
|
||||
<a href="gbHttp.php?act=removePerm&permid=<?php echo$row['permid']?>&oid=<?php echo$tpldata['id']?>&id=<?php echo$id?>"
|
||||
class="lnkbutt" onClick="return confirm('Delete permission "<?php echo$da?> <?php echo$row['action']?>" for user <?php echo$row['login']?>?')">remove</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }else{?>
|
||||
<tr class="odd"><td colspan="4">none</td></tr>
|
||||
<?php }?>
|
||||
</table>
|
||||
|
||||
<form action="gbHttp.php" method="post">
|
||||
Add permission
|
||||
<select name="allowDeny">
|
||||
<option value="A">Allow</option>
|
||||
<option value="D">Deny</option>
|
||||
</select>
|
||||
for action
|
||||
<select name="permAction">
|
||||
<option value="_all">all</option>
|
||||
<?php if(is_array($tpldata['actions'])) foreach($tpldata['actions'] as $k=>$it) {?>
|
||||
<option value="<?php echo$it?>"><?php echo$it?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
to subject
|
||||
<select name="subj">
|
||||
<?php if(is_array($tpldata['subjects'])) foreach($tpldata['subjects'] as $k=>$it) {?>
|
||||
<option value="<?php echo$it['id']?>"><?php echo$it['login']?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
<input type="hidden" name="act" value="addPerm">
|
||||
<input type="hidden" name="id" value="<?php echo$tpldata['id']?>">
|
||||
<input type="submit" value="Do it!">
|
||||
</form>
|
||||
|
||||
<?php if($tpldata['msg']){?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
alert('<?php echo$tpldata['msg']?>');
|
||||
-->
|
||||
</script><noscript><hr><b><?php echo$tpldata['msg']?></b></hr></noscript>
|
||||
<?php }?>
|
||||
</body></html>
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
// $Id: gbHtmlSubj.php,v 1.1 2004/09/21 00:43:24 tomas Exp $
|
||||
require_once"gbHtml_h.php";
|
||||
require_once"gbHtmlTestAuth.php";
|
||||
|
||||
switch($_REQUEST['act']){
|
||||
case "passwd":
|
||||
$type='passwd';
|
||||
break;
|
||||
default:
|
||||
if(isset($_GET['id']) && is_numeric($_GET['id'])){
|
||||
$id = $_GET['id']; $type='group';
|
||||
}else $type='list';
|
||||
}
|
||||
|
||||
#header("Content-type: text/plain"); print_r($gb->listGroup($id)); exit;
|
||||
|
||||
// prefill data structure for template
|
||||
switch($type){
|
||||
case "list":
|
||||
$d = array(
|
||||
'subj' => $gb->getSubjectsWCnt(),
|
||||
'loggedAs' => $login
|
||||
);
|
||||
break;
|
||||
case "group":
|
||||
$d = array(
|
||||
'rows' => $gb->listGroup($id),
|
||||
'id' => $id,
|
||||
'loggedAs' => $login,
|
||||
'gname' => $gb->getSubjName($id),
|
||||
'subj' => $gb->getSubjects()
|
||||
);
|
||||
break;
|
||||
case "passwd":
|
||||
break;
|
||||
default:
|
||||
}
|
||||
$d['msg'] = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']);
|
||||
|
||||
#header("Content-type: text/plain"); print_r($d); echo($list ? 'Y' : 'N')."\n"; exit;
|
||||
#require_once"gbHtml_f.php";
|
||||
// template follows:
|
||||
?>
|
||||
<html><head>
|
||||
<title>Storage - user and roles editor</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="default.css">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#menu { float:right; margin-right:1em; border:1px solid black; background-color:#ddd; padding:2px 1ex; }
|
||||
#parent, #parent a { background-color:#888; font-weight:bold; color:white; }
|
||||
#tree { width:60%; }
|
||||
-->
|
||||
</style>
|
||||
</head><body>
|
||||
<div id="menu">
|
||||
Logged as: <span class="b"><?php echo$d['loggedAs']?></span><br>
|
||||
<a href="gbHttp.php?act=logout">logout</a><br>
|
||||
<a href="gbHtmlBrowse.php?act=getHomeDir">Browser</a><br>
|
||||
</div>
|
||||
|
||||
<h1>User/Group editor</h1>
|
||||
|
||||
<?php switch($type){ case "list":?>
|
||||
<h3>Subjects:</h3>
|
||||
<table id="tree" border="0" cellpadding="5">
|
||||
<tr><td>id</td><td>login</td><td>user/group</td><td></td></tr>
|
||||
<?php if(is_array($d['subj'])&&count($d['subj'])>0) foreach($d['subj'] as $k=>$c) {?>
|
||||
<tr class="<?php echo(($o=1-$o) ? 'odd' : 'ev')?>">
|
||||
<td><?php echo$c['id']?></td>
|
||||
<td class="b">
|
||||
<?php if($c['type']=='G'){?>
|
||||
<a href="gbHtmlSubj.php?id=<?php echo$c['id']?>"><?php echo$c['login']?></a>
|
||||
<?php }else{?><?php echo$c['login']?>
|
||||
<?php }?>
|
||||
</td
|
||||
<td><?php if($c['type']=='G'){?>(G:<?php echo$c['cnt']?>)<?php }else{?> (U)<?php }?></td>
|
||||
<td>
|
||||
<a class="lnkbutt" href="gbHttp.php?act=removeSubj&login=<?php echo urlencode($c['login'])?>">remove</a>
|
||||
<a class="lnkbutt" href="gbHtmlSubj.php?act=passwd&uid=<?php echo urlencode($c['id'])?>">change password</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }else{?>
|
||||
<tr class="odd"><td colspan="4">none</td></tr>
|
||||
<?php }?>
|
||||
</table>
|
||||
|
||||
<form action="gbHttp.php" method="post">
|
||||
Add subject with name: <input type="text" name="login" value="" size="10">
|
||||
[and password: <input type="password" name="pass" value="" size="10">]
|
||||
<input type="hidden" name="act" value="addSubj">
|
||||
<input type="submit" value="Do it!">
|
||||
</form>
|
||||
|
||||
<?php break; case "group":?>
|
||||
|
||||
<h2>Subjects in group <?php echo$d['gname']?>:</h2>
|
||||
|
||||
<table id="tree" border="0" cellpadding="5">
|
||||
<tr id="parent">
|
||||
<td colspan="5">
|
||||
<a href="gbHtmlSubj.php">All subjects</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if(is_array($d['rows'])&&count($d['rows'])>0) foreach($d['rows'] as $k=>$row) {?>
|
||||
<tr class="<?php echo(($o=1-$o) ? 'odd' : 'ev')?>">
|
||||
<td><?php echo$row['id']?></td>
|
||||
<td class="b">
|
||||
<?php if($row['type']=='G'){?>
|
||||
<a href="gbHtmlSubj.php?id=<?php echo$row['id']?>"><?php echo$row['login']?></a>
|
||||
<?php }else{?><?php echo$row['login']?>
|
||||
<?php }?>
|
||||
</td
|
||||
<td><?php if($row['type']=='G'){?> (G)<?php }else{?> (U)<?php }?></td>
|
||||
<td>
|
||||
<a class="lnkbutt"
|
||||
href="gbHttp.php?act=removeSubjFromGr&login=<?php echo urlencode($row['login'])?>&gname=<?php echo urlencode($d['gname'])?>&reid=<?php echo$d['id']?>">
|
||||
removeFromGroup
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }else{?>
|
||||
<tr class="odd"><td colspan="3">none</td></tr>
|
||||
<?php }?>
|
||||
</table>
|
||||
|
||||
<form action="gbHttp.php" method="post">
|
||||
Add subject
|
||||
<select name="login">
|
||||
<?php if(is_array($d['subj'])) foreach($d['subj'] as $k=>$row) {?>
|
||||
<option value="<?php echo$row['login']?>"><?php echo$row['login']?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
to group <?php echo$d['gname']?>
|
||||
<input type="hidden" name="act" value="addSubj2Gr">
|
||||
<input type="hidden" name="reid" value="<?php echo$d['id']?>">
|
||||
<input type="hidden" name="gname" value="<?php echo$d['gname']?>">
|
||||
<input type="submit" value="Do it!">
|
||||
</form>
|
||||
|
||||
<?php break; case "passwd":?>
|
||||
<form action="gbHttp.php" method="post">
|
||||
<table>
|
||||
<tr><td>Old password:</td><td><input type="password" name="oldpass" value=""></td></tr>
|
||||
<tr><td>New password:</td><td><input type="password" name="pass" value=""></td></tr>
|
||||
<tr><td>Retype:</td><td><input type="password" name="pass2" value=""></td></tr>
|
||||
<tr><td colspan="2"><input type="submit" value="Submit"></td></tr>
|
||||
</table>
|
||||
<input type="hidden" name="uid" value="<?php echo $_REQUEST['uid']?>">
|
||||
<input type="hidden" name="act" value="passwd">
|
||||
</form>
|
||||
<?php default: }?>
|
||||
|
||||
<?php if($d['msg']){?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
alert('<?php echo$d['msg']?>');
|
||||
-->
|
||||
</script>
|
||||
<?php }?>
|
||||
</body></html>
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
// $Id: gbHtmlTestAuth.php,v 1.1 2004/09/21 00:43:24 tomas Exp $
|
||||
$login = $gb->getSessLogin($_REQUEST[$config['authCookieName']]);
|
||||
if(!isset($login)||$login==''){
|
||||
$_SESSION['alertMsg'] = "Login required";
|
||||
header("Location: gbHtmlLogin.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
$gb->initDb();
|
||||
$gb->init();
|
||||
#system("rm -f {$config['storageDir']}/*.bin {$config['storageDir']}/*.xml");
|
||||
$d = $gb->testData();
|
||||
$gb->putFile('/folder1/folder1_2/folder1_2_1', 'fileA', "123\n345\n", "<xml/>", 'at');
|
||||
$gb->createReplica('/folder1/folder1_2/folder1_2_1/fileA', '/folder1/folder1_2/folder1_2_1', 'replFA', 'at');
|
||||
$gb->putFile('/folder1/folder1_2/folder1_2_1', 'fileB', "123\n345\n789\n", "<xml/>", 'at');
|
||||
$gb->ovewriteMetadata('/folder1/folder1_2/folder1_2_1/fileA', "<xml>\n</xml>", 'at');
|
||||
|
||||
$gb->deleteFile('/folder1/folder1_2/folder1_2_1/fileB', 'at');
|
||||
|
||||
?>
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
session_start();
|
||||
require_once '../conf.php';
|
||||
require_once 'DB.php';
|
||||
require_once '../../../storageServer/var/GreenBox.php';
|
||||
|
||||
#PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
|
||||
#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errCallBack');
|
||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
||||
#PEAR::setErrorHandling(PEAR_ERROR_PRINT);
|
||||
|
||||
function errCallBack($err)
|
||||
{
|
||||
echo "<pre>gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n";
|
||||
echo "<hr>BackTrace:\n";
|
||||
print_r($err->backtrace);
|
||||
echo "</pre>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$dbc = DB::connect($config['dsn'], TRUE);
|
||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$gb = &new GreenBox(&$dbc, $config);
|
||||
|
||||
?>
|
|
@ -0,0 +1,197 @@
|
|||
<?php
|
||||
require_once"gbHtml_h.php";
|
||||
#header("Content-type: text/plain"); echo"GET:\n"; print_r($_GET); echo"POST:\n"; print_r($_POST); echo"REQUEST:\n"; print_r($_REQUEST); echo"FILES:\n"; print_r($_FILES); exit;
|
||||
#echo"<pre>\n"; print_r($_SERVER); exit;
|
||||
|
||||
define('BROWSER', "gbHtmlBrowse.php");
|
||||
|
||||
|
||||
$sessid = $_REQUEST[$config['authCookieName']];
|
||||
$userid = $gb->getSessUserId($sessid);
|
||||
$login = $gb->getSessLogin($sessid);
|
||||
|
||||
#$path = ($_REQUEST['path']=='' ? '/' : $_REQUEST['path']);
|
||||
#$upath = urlencode($path);
|
||||
#$id = $gb->_idFromPath($path);
|
||||
$id = (!$_REQUEST['id'] ? $gb->storId : $_REQUEST['id']);
|
||||
|
||||
|
||||
#if(PEAR::isError($id)){ $_SESSION['msg'] = $id->getMessage(); header("Location: ".BROWSER."?id=$id"); exit; }
|
||||
$redirUrl="gbHtmlBrowse.php?id=$id";
|
||||
|
||||
switch($_REQUEST['act']){
|
||||
// --- authentication ---
|
||||
case"login";
|
||||
# echo"<pre>\n"; print_r($_REQUEST); exit;
|
||||
$sessid = $gb->login($_REQUEST['login'], $_REQUEST['pass']);
|
||||
if($sessid && !PEAR::isError($sessid)){
|
||||
# echo"<pre>$sessid\n"; print_r($_REQUEST); exit;
|
||||
setcookie($config['authCookieName'], $sessid);
|
||||
$redirUrl="gbHtmlBrowse.php";
|
||||
$fid = $gb->getObjId($_REQUEST['login'], $gb->storId);
|
||||
if(!PEAR::isError($fid)) $redirUrl.="?id=$fid";
|
||||
}else{ $redirUrl="gbHtmlLogin.php"; $_SESSION['alertMsg']='Login failed.'; }
|
||||
# echo"<pre>$redirUrl\n"; print_r($_REQUEST); exit;
|
||||
break;
|
||||
case"logout";
|
||||
$gb->logout($sessid);
|
||||
setcookie($config['authCookieName'], '');
|
||||
$redirUrl="gbHtmlLogin.php";
|
||||
break;
|
||||
|
||||
// --- files ---
|
||||
case"upload":
|
||||
$tmpgunid = md5(microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport");
|
||||
$ntmp = "{$gb->storageDir}/buffer/$tmpgunid";
|
||||
# $ntmp = tempnam(""{$gb->storageDir}/buffer", 'gbTmp_');
|
||||
$mdtmp = "";
|
||||
move_uploaded_file($_FILES['mediafile']['tmp_name'], $ntmp); chmod($ntmp, 0664);
|
||||
if($_FILES['mdatafile']['tmp_name']){
|
||||
$mdtmp = "$ntmp.xml";
|
||||
if(move_uploaded_file($_FILES['mdatafile']['tmp_name'], $mdtmp)){
|
||||
chmod($mdtmp, 0664);
|
||||
}
|
||||
}
|
||||
$r = $gb->putFile($id, $_REQUEST['filename'], $ntmp, $mdtmp, $sessid);
|
||||
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
||||
else{
|
||||
# $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid);
|
||||
@unlink($ntmp);
|
||||
@unlink($mdtmp);
|
||||
}
|
||||
$redirUrl = BROWSER."?id=$id";
|
||||
break;
|
||||
case"newFolder":
|
||||
$r = $gb->createFolder($id, $_REQUEST['newname'], $sessid);
|
||||
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
||||
$redirUrl = BROWSER."?id=$id";
|
||||
break;
|
||||
case"rename":
|
||||
$parid = $gb->getparent($id);
|
||||
$r = $gb->renameFile($id, $_REQUEST['newname'], $sessid);
|
||||
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
||||
$redirUrl = BROWSER."?id=$parid";
|
||||
break;
|
||||
case"move":
|
||||
$newPath = urlencode($_REQUEST['newPath']);
|
||||
$did = $gb->getObjIdFromRelPath($id, $newPath);
|
||||
$parid = $gb->getparent($id);
|
||||
$r = $gb->moveFile($id, $did, $sessid);
|
||||
if(PEAR::isError($r)){
|
||||
$_SESSION['alertMsg'] = $r->getMessage();
|
||||
$redirUrl = BROWSER."?id=$parid";
|
||||
}
|
||||
else $redirUrl = BROWSER."?id=$did";
|
||||
break;
|
||||
case"copy":
|
||||
$newPath = urldecode($_REQUEST['newPath']);
|
||||
$did = $gb->getObjIdFromRelPath($id, $newPath);
|
||||
$parid = $gb->getparent($id);
|
||||
# echo"<pre>\n$id\t$newPath\t$did\n"; print_r($did); exit;
|
||||
$r = $gb->copyFile($id, $did, $sessid);
|
||||
if(PEAR::isError($r)){
|
||||
$_SESSION['alertMsg'] = $r->getMessage();
|
||||
$redirUrl = BROWSER."?id=$parid";
|
||||
}
|
||||
else $redirUrl = BROWSER."?id=$did";
|
||||
break;
|
||||
/* NOT WORKING - sorry
|
||||
case"repl":
|
||||
$unewpath = urlencode($_REQUEST['newpath']);
|
||||
$r = $gb->createReplica($id, $_REQUEST['newpath'], '', $sessid);
|
||||
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
||||
$redirUrl = BROWSER."?id=$newparid";
|
||||
break;
|
||||
*/
|
||||
case"delete":
|
||||
$parid = $gb->getparent($id);
|
||||
$r = $gb->deleteFile($id, $sessid);
|
||||
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
||||
$redirUrl = BROWSER."?id=$parid";
|
||||
break;
|
||||
case"getFile":
|
||||
# echo"<pre>$t, $ctype\n"; exit;
|
||||
# $r = $gb->getFile($id, $sessid);
|
||||
$r = $gb->access($id, $sessid);
|
||||
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
||||
else echo $r;
|
||||
exit;
|
||||
break;
|
||||
case"getMdata":
|
||||
header("Content-type: text/xml");
|
||||
$r = $gb->getMdata($id, $sessid);
|
||||
print_r($r);
|
||||
exit;
|
||||
break;
|
||||
case"getInfo":
|
||||
header("Content-type: text/plain");
|
||||
$ia = $gb->analyzeFile($id, $sessid);
|
||||
echo"fileformat: {$ia['fileformat']}\n";
|
||||
echo"channels: {$ia['audio']['channels']}\n";
|
||||
echo"sample_rate: {$ia['audio']['sample_rate']}\n";
|
||||
echo"bits_per_sample: {$ia['audio']['bits_per_sample']}\n";
|
||||
echo"channelmode: {$ia['audio']['channelmode']}\n";
|
||||
echo"title: {$ia['id3v1']['title']}\n";
|
||||
echo"artist: {$ia['id3v1']['artist']}\n";
|
||||
echo"comment: {$ia['id3v1']['comment']}\n";
|
||||
# echo": {$ia['id3v1']['']}\n";
|
||||
# print_r($ia);
|
||||
exit;
|
||||
break;
|
||||
|
||||
// --- subjs ----
|
||||
case"addSubj";
|
||||
$redirUrl="gbHtmlSubj.php";
|
||||
if($gb->checkPerm($userid, 'subjects'))
|
||||
$res = $gb->addSubj($_REQUEST['login'], ($_REQUEST['pass']=='' ? NULL:$_REQUEST['pass'] ));
|
||||
else{ $_SESSION['alertMsg']='Access denied.'; break; }
|
||||
if(PEAR::isError($res)) $_SESSION['alertMsg'] = $res->getMessage();
|
||||
break;
|
||||
case"removeSubj";
|
||||
$redirUrl="gbHtmlSubj.php";
|
||||
if($gb->checkPerm($userid, 'subjects'))
|
||||
$res = $gb->removeSubj($_REQUEST['login']);
|
||||
else{ $_SESSION['alertMsg']='Access denied.'; break; }
|
||||
if(PEAR::isError($res)) $_SESSION['alertMsg'] = $res->getMessage();
|
||||
break;
|
||||
case"passwd";
|
||||
$redirUrl="gbHtmlSubj.php";
|
||||
$ulogin = $gb->getSubjName($_REQUEST['uid']);
|
||||
if($userid != $_REQUEST['uid'] &&
|
||||
! $gb->checkPerm($userid, 'subjects')){
|
||||
$_SESSION['alertMsg']='Access denied..';
|
||||
break;
|
||||
}
|
||||
if(FALSE === $gb->authenticate($ulogin, $_REQUEST['oldpass'])){
|
||||
$_SESSION['alertMsg']='Wrong old pasword.';
|
||||
break;
|
||||
}
|
||||
if($_REQUEST['pass'] !== $_REQUEST['pass2']){
|
||||
$_SESSION['alertMsg']="Passwords do not match. ({$_REQUEST['pass']}/{$_REQUEST['pass2']})";
|
||||
break;
|
||||
}
|
||||
$gb->passwd($ulogin, $_REQUEST['oldpass'], $_REQUEST['pass']);
|
||||
break;
|
||||
|
||||
// --- perms ---
|
||||
case"addPerm";
|
||||
if($gb->checkPerm($userid, 'editPerms', $_REQUEST['id']))
|
||||
$gb->addPerm($_REQUEST['subj'], $_REQUEST['permAction'], $_REQUEST['id'], $_REQUEST['allowDeny']);
|
||||
else $_SESSION['alertMsg']='Access denied.';
|
||||
$redirUrl="gbHtmlPerms.php?id=$id";
|
||||
break;
|
||||
case"removePerm";
|
||||
if($gb->checkPerm($userid, 'editPerms', $_REQUEST['oid']))
|
||||
$gb->removePerm($_GET['permid']);
|
||||
else $_SESSION['alertMsg']='Access denied.';
|
||||
$redirUrl="gbHtmlPerms.php?id=$id";
|
||||
break;
|
||||
|
||||
default:
|
||||
$_SESSION['alertMsg']="Unknown method: {$_REQUEST['act']}";
|
||||
$redirUrl="gbHtmlLogin.php";
|
||||
}
|
||||
|
||||
#echo"<pre>$redirUrl\n"; print_r($_REQUEST); exit;
|
||||
header("Location: $redirUrl");
|
||||
?>
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/html/Attic/index.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
header ("location: gbHtmlLogin.php");
|
||||
die;
|
||||
|
||||
?>
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/index.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
header ("location: html/gbHtmlLogin.php");
|
||||
exit;
|
||||
/*
|
||||
?>
|
||||
<html><head>
|
||||
<title>ArchiveServer module</title>
|
||||
</head><body>
|
||||
<h3>ArchiveServer module</h3>
|
||||
<br>
|
||||
<a href="../html/gbHtmlLogin.php" accesskey="H"><b>H</b>TML client</a><br>
|
||||
<a href="../xmlrpc/" accesskey="X"><b>X</b>mlRpc test</a><br>
|
||||
<a href="../tests/" accesskey="T"><b>T</b>est</a><br>
|
||||
</body></html>
|
||||
<?
|
||||
*/
|
||||
?>
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/index.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
header ("location: ../index.php");
|
||||
die;
|
||||
|
||||
?>
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/install.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once '../conf.php';
|
||||
require_once 'DB.php';
|
||||
require_once '../Archive.php';
|
||||
|
||||
function errCallback($err)
|
||||
{
|
||||
if(assert_options(ASSERT_ACTIVE)==1) return;
|
||||
echo "ERROR:\n";
|
||||
echo "request: "; print_r($_REQUEST);
|
||||
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
|
||||
$dbc = DB::connect($config['dsn'], TRUE);
|
||||
if(PEAR::isError($dbc)){
|
||||
echo "Database connection problem.\n";
|
||||
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n";
|
||||
echo "Database access is defined by 'dsn' values in conf.php.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$gb = &new GreenBox(&$dbc, $config);
|
||||
|
||||
echo "\nIMPORTANT settings:\n";
|
||||
echo " Makefile: HTTP_GROUP - group of running http daemon\n";
|
||||
echo " var/xmlrpc/testRunner.sh: XMLRPC - URL of XMLRPC server\n\n";
|
||||
|
||||
echo "Archive: Install ...\n";
|
||||
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
|
||||
$gb->uninstall();
|
||||
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
|
||||
$gb->install();
|
||||
|
||||
echo " Testing ...\n";
|
||||
$gb->test();
|
||||
$log = $gb->test_log;
|
||||
echo " TESTS:\n$log\n---\n";
|
||||
|
||||
#echo " Reinstall + testdata insert ...\n";
|
||||
#$gb->reinstall();
|
||||
#$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']);
|
||||
#$gb->testData();
|
||||
#$gb->logout($gb->sessid); unset($gb->sessid);
|
||||
|
||||
echo " TREE DUMP:\n";
|
||||
echo $gb->dumpTree();
|
||||
|
||||
echo " Delete test data ...\n";
|
||||
$gb->deleteData();
|
||||
|
||||
if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w')))
|
||||
echo "\n<b>!!! make {$config['storageDir']} dir webdaemon-writeable !!!</b>\nand run install again\n\n";
|
||||
else{
|
||||
fclose($fp); unlink($config['storageDir']."/_writeTest");
|
||||
echo "\nArchive is probably installed OK\n";
|
||||
}
|
||||
|
||||
$dbc->disconnect();
|
||||
?>
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/install/uninstall.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
require_once '../conf.php';
|
||||
require_once 'DB.php';
|
||||
require_once '../Archive.php';
|
||||
|
||||
function errCallback($err)
|
||||
{
|
||||
if(assert_options(ASSERT_ACTIVE)==1) return;
|
||||
echo "ERROR:\n";
|
||||
echo "request: "; print_r($_REQUEST);
|
||||
echo "gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n</pre>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
|
||||
$dbc = DB::connect($config['dsn'], TRUE);
|
||||
if(PEAR::isError($dbc)){
|
||||
echo "Database connection problem.\n";
|
||||
echo "Check if database '{$config['dsn']['database']}' exists with corresponding permissions.\n";
|
||||
echo "Database access is defined by 'dsn' values in conf.php.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$gb = &new GreenBox(&$dbc, $config);
|
||||
|
||||
# $dbc->setErrorHandling(PEAR_ERROR_RETURN);
|
||||
echo "Trying to uninstall Archive ...\n";
|
||||
$gb->uninstall();
|
||||
|
||||
$dbc->disconnect();
|
||||
?>
|
|
@ -0,0 +1,105 @@
|
|||
#!/bin/sh
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (c) 2004 Media Development Loan Fund
|
||||
#
|
||||
# This file is part of the LiveSupport project.
|
||||
# http://livesupport.campware.org/
|
||||
# To report bugs, send an e-mail to bugs@campware.org
|
||||
#
|
||||
# LiveSupport 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.
|
||||
#
|
||||
# LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Author : $Author: tomas $
|
||||
# Version : $Revision: 1.1 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/xmlrpc/testRunner.sh,v $
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
COMM=$1
|
||||
shift
|
||||
GUNID=$1
|
||||
|
||||
XMLRPC=http://localhost:80/livesupport/modules/archiveServer/var/xmlrpc/xrArchive.php
|
||||
echo "XMLRPC server URL (check it in troubles):"
|
||||
echo $XMLRPC
|
||||
|
||||
TESTDIR=`dirname $0`
|
||||
XR_CLI="$TESTDIR/xr_cli_test.py -s $XMLRPC"
|
||||
|
||||
login() {
|
||||
echo "login:"
|
||||
SESSID=`$XR_CLI login root q`
|
||||
echo "sessid: $SESSID"
|
||||
}
|
||||
|
||||
ping() {
|
||||
echo "ping:"
|
||||
$XR_CLI ping abcDef
|
||||
}
|
||||
|
||||
# existsAudioClip() {
|
||||
# echo "existsAudioClip:"
|
||||
# $XR_CLI existsAudioClip $SESSID $GUNID
|
||||
# }
|
||||
|
||||
downloadOpenClose() {
|
||||
echo "downloadOpen:"
|
||||
FURL=`$XR_CLI downloadOpen $SESSID $GUNID`
|
||||
FURL="<?echo urldecode(\"$FURL\")?>"
|
||||
FURL=`echo "$FURL" | php -q`
|
||||
echo $FURL
|
||||
# ls -l `dirname $FURL`
|
||||
echo "downloadClose:"
|
||||
$XR_CLI downloadClose $SESSID $FURL
|
||||
#$XR_CLI getAudioClip $SESSID $GUNID
|
||||
}
|
||||
|
||||
# storeAudioClip() {
|
||||
# echo "storeAudioClip:"
|
||||
# MEDIA=../tests/ex1.mp3
|
||||
# METADATA=../tests/testStorage.xml
|
||||
# RGUNID=`$XR_CLI storeAudioClip "$SESSID" 'X' "$MEDIA" "$METADATA"`
|
||||
# echo $RGUNID
|
||||
# }
|
||||
|
||||
# searchMetadata() {
|
||||
# echo "searchMetadata:"
|
||||
# # $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml'
|
||||
# $XR_CLI searchMetadata $SESSID 'John %'
|
||||
# }
|
||||
|
||||
logout() {
|
||||
echo "logout:"
|
||||
$XR_CLI logout $SESSID
|
||||
}
|
||||
|
||||
usage(){
|
||||
echo "Usage: $0 <command> [args]"
|
||||
echo -e "commands:\n test, ...\n"
|
||||
}
|
||||
|
||||
if [ "$COMM" == "ping" ]; then
|
||||
ping
|
||||
elif [ "x$COMM" == "x" ]; then
|
||||
# echo "No action"
|
||||
login
|
||||
downloadOpenClose
|
||||
logout
|
||||
elif [ "$COMM" == "help" ]; then
|
||||
usage
|
||||
else
|
||||
echo "Unknown command"
|
||||
usage
|
||||
fi
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,450 @@
|
|||
<?php
|
||||
// by Edd Dumbill (C) 1999-2002
|
||||
// <edd@usefulinc.com>
|
||||
// $Id: xmlrpcs.inc,v 1.1 2004/09/21 00:43:34 tomas Exp $
|
||||
|
||||
// Copyright (c) 1999,2000,2002 Edd Dumbill.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
//
|
||||
// * Neither the name of the "XML-RPC for PHP" nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
// OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// XML RPC Server class
|
||||
// requires: xmlrpc.inc
|
||||
|
||||
// listMethods: either a string, or nothing
|
||||
$_xmlrpcs_listMethods_sig=array(array($xmlrpcArray, $xmlrpcString), array($xmlrpcArray));
|
||||
$_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
|
||||
function _xmlrpcs_listMethods($server, $m)
|
||||
{
|
||||
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
|
||||
$v=new xmlrpcval();
|
||||
$dmap=$server->dmap;
|
||||
$outAr=array();
|
||||
for(reset($dmap); list($key, $val)=each($dmap); )
|
||||
{
|
||||
$outAr[]=new xmlrpcval($key, 'string');
|
||||
}
|
||||
$dmap=$_xmlrpcs_dmap;
|
||||
for(reset($dmap); list($key, $val)=each($dmap); )
|
||||
{
|
||||
$outAr[]=new xmlrpcval($key, 'string');
|
||||
}
|
||||
$v->addArray($outAr);
|
||||
return new xmlrpcresp($v);
|
||||
}
|
||||
|
||||
$_xmlrpcs_methodSignature_sig=array(array($xmlrpcArray, $xmlrpcString));
|
||||
$_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
|
||||
function _xmlrpcs_methodSignature($server, $m)
|
||||
{
|
||||
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
|
||||
|
||||
$methName=$m->getParam(0);
|
||||
$methName=$methName->scalarval();
|
||||
if (ereg("^system\.", $methName))
|
||||
{
|
||||
$dmap=$_xmlrpcs_dmap; $sysCall=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dmap=$server->dmap; $sysCall=0;
|
||||
}
|
||||
// print "<!-- ${methName} -->\n";
|
||||
if (isset($dmap[$methName]))
|
||||
{
|
||||
if ($dmap[$methName]['signature'])
|
||||
{
|
||||
$sigs=array();
|
||||
$thesigs=$dmap[$methName]['signature'];
|
||||
for($i=0; $i<sizeof($thesigs); $i++)
|
||||
{
|
||||
$cursig=array();
|
||||
$inSig=$thesigs[$i];
|
||||
for($j=0; $j<sizeof($inSig); $j++)
|
||||
{
|
||||
$cursig[]=new xmlrpcval($inSig[$j], 'string');
|
||||
}
|
||||
$sigs[]=new xmlrpcval($cursig, 'array');
|
||||
}
|
||||
$r=new xmlrpcresp(new xmlrpcval($sigs, 'array'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$r=new xmlrpcresp(new xmlrpcval('undef', 'string'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$r=new xmlrpcresp(0,$xmlrpcerr['introspect_unknown'], $xmlrpcstr['introspect_unknown']);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
$_xmlrpcs_methodHelp_sig=array(array($xmlrpcString, $xmlrpcString));
|
||||
$_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
|
||||
function _xmlrpcs_methodHelp($server, $m)
|
||||
{
|
||||
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
|
||||
|
||||
$methName=$m->getParam(0);
|
||||
$methName=$methName->scalarval();
|
||||
if (ereg("^system\.", $methName))
|
||||
{
|
||||
$dmap=$_xmlrpcs_dmap; $sysCall=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dmap=$server->dmap; $sysCall=0;
|
||||
}
|
||||
// print "<!-- ${methName} -->\n";
|
||||
if (isset($dmap[$methName]))
|
||||
{
|
||||
if ($dmap[$methName]['docstring'])
|
||||
{
|
||||
$r=new xmlrpcresp(new xmlrpcval($dmap[$methName]["docstring"]), 'string');
|
||||
}
|
||||
else
|
||||
{
|
||||
$r=new xmlrpcresp(new xmlrpcval('', 'string'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$r=new xmlrpcresp(0, $xmlrpcerr['introspect_unknown'], $xmlrpcstr['introspect_unknown']);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
$_xmlrpcs_multicall_sig = array(array($xmlrpcArray, $xmlrpcArray));
|
||||
$_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
|
||||
|
||||
function _xmlrpcs_multicall_error($err)
|
||||
{
|
||||
if (is_string($err))
|
||||
{
|
||||
global $xmlrpcerr, $xmlrpcstr;
|
||||
$str = $xmlrpcstr["multicall_${err}"];
|
||||
$code = $xmlrpcerr["multicall_${err}"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$code = $err->faultCode();
|
||||
$str = $err->faultString();
|
||||
}
|
||||
$struct['faultCode'] = new xmlrpcval($code, 'int');
|
||||
$struct['faultString'] = new xmlrpcval($str, 'string');
|
||||
return new xmlrpcval($struct, 'struct');
|
||||
}
|
||||
|
||||
function _xmlrpcs_multicall_do_call($server, $call)
|
||||
{
|
||||
if ($call->kindOf() != 'struct')
|
||||
return _xmlrpcs_multicall_error('notstruct');
|
||||
$methName = $call->structmem('methodName');
|
||||
if (!$methName)
|
||||
return _xmlrpcs_multicall_error('nomethod');
|
||||
if ($methName->kindOf() != 'scalar' || $methName->scalartyp() != 'string')
|
||||
return _xmlrpcs_multicall_error('notstring');
|
||||
if ($methName->scalarval() == 'system.multicall')
|
||||
return _xmlrpcs_multicall_error('recursion');
|
||||
|
||||
$params = $call->structmem('params');
|
||||
if (!$params)
|
||||
return _xmlrpcs_multicall_error('noparams');
|
||||
if ($params->kindOf() != 'array')
|
||||
return _xmlrpcs_multicall_error('notarray');
|
||||
$numParams = $params->arraysize();
|
||||
|
||||
$msg = new xmlrpcmsg($methName->scalarval());
|
||||
for ($i = 0; $i < $numParams; $i++)
|
||||
$msg->addParam($params->arraymem($i));
|
||||
|
||||
$result = $server->execute($msg);
|
||||
|
||||
if ($result->faultCode() != 0)
|
||||
return _xmlrpcs_multicall_error($result); // Method returned fault.
|
||||
|
||||
return new xmlrpcval(array($result->value()), "array");
|
||||
}
|
||||
|
||||
function _xmlrpcs_multicall($server, $m)
|
||||
{
|
||||
$calls = $m->getParam(0);
|
||||
$numCalls = $calls->arraysize();
|
||||
$result = array();
|
||||
|
||||
for ($i = 0; $i < $numCalls; $i++)
|
||||
{
|
||||
$call = $calls->arraymem($i);
|
||||
$result[$i] = _xmlrpcs_multicall_do_call($server, $call);
|
||||
}
|
||||
|
||||
return new xmlrpcresp(new xmlrpcval($result, 'array'));
|
||||
}
|
||||
|
||||
$_xmlrpcs_dmap=array(
|
||||
'system.listMethods' => array(
|
||||
'function' => '_xmlrpcs_listMethods',
|
||||
'signature' => $_xmlrpcs_listMethods_sig,
|
||||
'docstring' => $_xmlrpcs_listMethods_doc),
|
||||
'system.methodHelp' => array(
|
||||
'function' => '_xmlrpcs_methodHelp',
|
||||
'signature' => $_xmlrpcs_methodHelp_sig,
|
||||
'docstring' => $_xmlrpcs_methodHelp_doc),
|
||||
'system.methodSignature' => array(
|
||||
'function' => '_xmlrpcs_methodSignature',
|
||||
'signature' => $_xmlrpcs_methodSignature_sig,
|
||||
'docstring' => $_xmlrpcs_methodSignature_doc),
|
||||
'system.multicall' => array(
|
||||
'function' => '_xmlrpcs_multicall',
|
||||
'signature' => $_xmlrpcs_multicall_sig,
|
||||
'docstring' => $_xmlrpcs_multicall_doc
|
||||
)
|
||||
);
|
||||
|
||||
$_xmlrpc_debuginfo='';
|
||||
function xmlrpc_debugmsg($m)
|
||||
{
|
||||
global $_xmlrpc_debuginfo;
|
||||
$_xmlrpc_debuginfo=$_xmlrpc_debuginfo . $m . "\n";
|
||||
}
|
||||
|
||||
class xmlrpc_server
|
||||
{
|
||||
var $dmap=array();
|
||||
|
||||
function xmlrpc_server($dispMap='', $serviceNow=1)
|
||||
{
|
||||
global $HTTP_RAW_POST_DATA;
|
||||
// dispMap is a dispatch array of methods
|
||||
// mapped to function names and signatures
|
||||
// if a method
|
||||
// doesn't appear in the map then an unknown
|
||||
// method error is generated
|
||||
/* milosch - changed to make passing dispMap optional.
|
||||
* instead, you can use the class add_to_map() function
|
||||
* to add functions manually (borrowed from SOAPX4)
|
||||
*/
|
||||
if($dispMap)
|
||||
{
|
||||
$this->dmap = $dispMap;
|
||||
if($serviceNow)
|
||||
{
|
||||
$this->service();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function serializeDebug()
|
||||
{
|
||||
global $_xmlrpc_debuginfo;
|
||||
if ($_xmlrpc_debuginfo!='')
|
||||
{
|
||||
return "<!-- DEBUG INFO:\n\n" . $_xmlrpc_debuginfo . "\n-->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function service()
|
||||
{
|
||||
global $xmlrpc_defencoding;
|
||||
|
||||
$r=$this->parseRequest();
|
||||
$payload='<?xml version="1.0" encoding="' . $xmlrpc_defencoding . '"?>' . "\n"
|
||||
. $this->serializeDebug()
|
||||
. $r->serialize();
|
||||
Header("Content-type: text/xml\r\nContent-length: " .
|
||||
strlen($payload));
|
||||
print $payload;
|
||||
}
|
||||
|
||||
/*
|
||||
add a method to the dispatch map
|
||||
*/
|
||||
function add_to_map($methodname,$function,$sig,$doc)
|
||||
{
|
||||
$this->dmap[$methodname] = array(
|
||||
'function' => $function,
|
||||
'signature' => $sig,
|
||||
'docstring' => $doc
|
||||
);
|
||||
}
|
||||
|
||||
function verifySignature($in, $sig)
|
||||
{
|
||||
for($i=0; $i<sizeof($sig); $i++)
|
||||
{
|
||||
// check each possible signature in turn
|
||||
$cursig=$sig[$i];
|
||||
if (sizeof($cursig)==$in->getNumParams()+1)
|
||||
{
|
||||
$itsOK=1;
|
||||
for($n=0; $n<$in->getNumParams(); $n++)
|
||||
{
|
||||
$p=$in->getParam($n);
|
||||
// print "<!-- $p -->\n";
|
||||
if ($p->kindOf() == 'scalar')
|
||||
{
|
||||
$pt=$p->scalartyp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$pt=$p->kindOf();
|
||||
}
|
||||
// $n+1 as first type of sig is return type
|
||||
if ($pt != $cursig[$n+1])
|
||||
{
|
||||
$itsOK=0;
|
||||
$pno=$n+1; $wanted=$cursig[$n+1]; $got=$pt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($itsOK)
|
||||
{
|
||||
return array(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return array(0, "Wanted ${wanted}, got ${got} at param ${pno})");
|
||||
}
|
||||
|
||||
function parseRequest($data='')
|
||||
{
|
||||
global $_xh,$HTTP_RAW_POST_DATA;
|
||||
global $xmlrpcerr, $xmlrpcstr, $xmlrpcerrxml, $xmlrpc_defencoding,
|
||||
$_xmlrpcs_dmap;
|
||||
|
||||
if ($data=="")
|
||||
{
|
||||
$data=$HTTP_RAW_POST_DATA;
|
||||
}
|
||||
$parser = xml_parser_create($xmlrpc_defencoding);
|
||||
|
||||
$_xh[$parser]=array();
|
||||
$_xh[$parser]['st']='';
|
||||
$_xh[$parser]['cm']=0;
|
||||
$_xh[$parser]['isf']=0;
|
||||
$_xh[$parser]['params']=array();
|
||||
$_xh[$parser]['method']='';
|
||||
|
||||
// decompose incoming XML into request structure
|
||||
|
||||
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
|
||||
xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
|
||||
xml_set_character_data_handler($parser, 'xmlrpc_cd');
|
||||
xml_set_default_handler($parser, 'xmlrpc_dh');
|
||||
if (!xml_parse($parser, $data, 1))
|
||||
{
|
||||
// return XML error as a faultCode
|
||||
$r=new xmlrpcresp(0,
|
||||
$xmlrpcerrxml+xml_get_error_code($parser),
|
||||
sprintf("XML error: %s at line %d",
|
||||
xml_error_string(xml_get_error_code($parser)),
|
||||
xml_get_current_line_number($parser)));
|
||||
xml_parser_free($parser);
|
||||
}
|
||||
else
|
||||
{
|
||||
xml_parser_free($parser);
|
||||
$m=new xmlrpcmsg($_xh[$parser]['method']);
|
||||
// now add parameters in
|
||||
$plist="";
|
||||
for($i=0; $i<sizeof($_xh[$parser]['params']); $i++)
|
||||
{
|
||||
//print "<!-- " . $_xh[$parser]['params'][$i]. "-->\n";
|
||||
$plist.="$i - " . $_xh[$parser]['params'][$i]. " \n";
|
||||
eval('$m->addParam(' . $_xh[$parser]['params'][$i]. ");");
|
||||
}
|
||||
// uncomment this to really see what the server's getting!
|
||||
// xmlrpc_debugmsg($plist);
|
||||
|
||||
$r = $this->execute($m);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function execute ($m)
|
||||
{
|
||||
global $xmlrpcerr, $xmlrpcstr, $_xmlrpcs_dmap;
|
||||
// now to deal with the method
|
||||
$methName = $m->method();
|
||||
$sysCall = ereg("^system\.", $methName);
|
||||
$dmap = $sysCall ? $_xmlrpcs_dmap : $this->dmap;
|
||||
|
||||
if (!isset($dmap[$methName]['function']))
|
||||
{
|
||||
// No such method
|
||||
return new xmlrpcresp(0,
|
||||
$xmlrpcerr['unknown_method'],
|
||||
$xmlrpcstr['unknown_method']);
|
||||
}
|
||||
|
||||
// Check signature.
|
||||
if (isset($dmap[$methName]['signature']))
|
||||
{
|
||||
$sig = $dmap[$methName]['signature'];
|
||||
list ($ok, $errstr) = $this->verifySignature($m, $sig);
|
||||
if (!$ok)
|
||||
{
|
||||
// Didn't match.
|
||||
return new xmlrpcresp(0,
|
||||
$xmlrpcerr['incorrect_params'],
|
||||
$xmlrpcstr['incorrect_params'] . ": ${errstr}");
|
||||
}
|
||||
}
|
||||
|
||||
$func = $dmap[$methName]['function'];
|
||||
|
||||
if ($sysCall)
|
||||
{
|
||||
return call_user_func($func, $this, $m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return call_user_func($func, $m);
|
||||
}
|
||||
}
|
||||
|
||||
function echoInput()
|
||||
{
|
||||
global $HTTP_RAW_POST_DATA;
|
||||
|
||||
// a debugging routine: just echos back the input
|
||||
// packet as a string value
|
||||
|
||||
$r=new xmlrpcresp;
|
||||
$r->xv=new xmlrpcval( "'Aha said I: '" . $HTTP_RAW_POST_DATA, 'string');
|
||||
print $r->serialize();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,252 @@
|
|||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/xmlrpc/xrArchive.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
include_once "xmlrpc.inc";
|
||||
include_once "xmlrpcs.inc";
|
||||
require_once '../conf.php';
|
||||
require_once 'DB.php';
|
||||
require_once "../Archive.php";
|
||||
|
||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
||||
$dbc = DB::connect($config['dsn'], TRUE);
|
||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
|
||||
/**
|
||||
* XMLRPC layer for Archive module
|
||||
*/
|
||||
class XR_Archive extends Archive{
|
||||
/**
|
||||
* Simple ping method - return strtouppered string
|
||||
*/
|
||||
function xr_ping($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
return new xmlrpcresp(new xmlrpcval(strtoupper($r['par']), "string"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Open download
|
||||
*/
|
||||
function xr_downloadOpen($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->downloadOpen($r['sessid'], $r['gunid']);
|
||||
if(PEAR::isError($res))
|
||||
return new xmlrpcresp(0, 803,
|
||||
"xr_downloadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new xmlrpcresp(xmlrpc_encoder($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* Close download
|
||||
*/
|
||||
function xr_downloadClose($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->downloadClose($r['sessid'], $r['url']);
|
||||
if(PEAR::isError($res))
|
||||
return new xmlrpcresp(0, 803,
|
||||
"xr_downloadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new xmlrpcresp(xmlrpc_encoder($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* Open upload
|
||||
*/
|
||||
function xr_uploadOpen($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->uploadOpen($r['sessid'], $r['gunid']);
|
||||
if(PEAR::isError($res))
|
||||
return new xmlrpcresp(0, 803,
|
||||
"xr_downloadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new xmlrpcresp(xmlrpc_encoder($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* Abort upload
|
||||
*/
|
||||
function xr_uploadAbort($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->uploadAbort($r['sessid'], $r['url']);
|
||||
if(PEAR::isError($res))
|
||||
return new xmlrpcresp(0, 803,
|
||||
"xr_downloadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new xmlrpcresp(xmlrpc_encoder($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check upload
|
||||
*/
|
||||
function xr_uploadCheck($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->uploadCheck($r['sessid'], $r['url']);
|
||||
if(PEAR::isError($res))
|
||||
return new xmlrpcresp(0, 803,
|
||||
"xr_downloadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new xmlrpcresp(xmlrpc_encoder($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* Close upload
|
||||
*/
|
||||
function xr_uploadClose($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->uploadClose($r['sessid'], $r['url']);
|
||||
if(PEAR::isError($res))
|
||||
return new xmlrpcresp(0, 803,
|
||||
"xr_downloadOpen: ".$res->getMessage().
|
||||
" ".$res->getUserInfo()
|
||||
);
|
||||
return new xmlrpcresp(xmlrpc_encoder($res));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call Archive::login
|
||||
*
|
||||
* @param input XMLRPC struct
|
||||
*/
|
||||
function xr_login($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
if(!($res = $this->login($r['login'], $r['pass'])))
|
||||
return new xmlrpcresp(0, 802,
|
||||
"xr_login: login failed - incorrect username or password ({$r['login']}/{$r['pass']})."
|
||||
);
|
||||
else
|
||||
return new xmlrpcresp($this->_v2xr($res, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Call Archive::logout
|
||||
*
|
||||
* @param input XMLRPC struct
|
||||
*/
|
||||
function xr_logout($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->logout($r['sessid']);
|
||||
if(!PEAR::isError($res))
|
||||
return new xmlrpcresp($this->_v2xr('Bye', false));
|
||||
else
|
||||
return new xmlrpcresp(0, 803,
|
||||
"xr_logout: logout failed - not logged."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert PHP variables to XMLRPC objects
|
||||
*
|
||||
* @param var mixed - PHP variable
|
||||
* @param struct boolean - flag for using XMLRPC struct instead of array
|
||||
* @return XMLRPC object
|
||||
*/
|
||||
function _v2xr($var, $struct=true){
|
||||
if(is_array($var)){
|
||||
$r = array();
|
||||
foreach($var as $k=>$v){
|
||||
if($struct) $r[$k]=$this->_v2xr($v);
|
||||
else $r[]=$this->_v2xr($v);
|
||||
}
|
||||
return new xmlrpcval($r, ($struct ? "struct" : "array"));
|
||||
}else if(is_int($var)){
|
||||
return new xmlrpcval($var, "int");
|
||||
}else if(is_bool($var)){
|
||||
return new xmlrpcval($var, "boolean");
|
||||
}else{
|
||||
return new xmlrpcval($var, "string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert XMLRPC struct to PHP array
|
||||
*
|
||||
* @param input XMLRPC struct
|
||||
*/
|
||||
function _xr_getPars($input)
|
||||
{
|
||||
$p = $input->getParam(0);
|
||||
if(isset($p) && $p->scalartyp()=="struct"){
|
||||
$p->structreset(); $r = array();
|
||||
while(list($k,$v) = $p->structeach()){ $r[$k] = $v->scalarval(); }
|
||||
return array(TRUE, $r);
|
||||
}
|
||||
else return array(FALSE, new xmlrpcresp(0, 801,
|
||||
"xr_login: wrong 1st parameter, struct expected."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$archive = &new XR_Archive(&$dbc, $config);
|
||||
|
||||
$methods = array(
|
||||
'login' => 'Login to storage.',
|
||||
'logout' => 'Logout from storage.',
|
||||
'ping' =>'Echo request',
|
||||
'downloadOpen' =>'Open download channel',
|
||||
'downloadClose' =>'Close download channel',
|
||||
'uploadOpen' =>'Open upload channel',
|
||||
'uploadAbort' =>'Close upload channel',
|
||||
'uploadCheck' =>'Check size and checksum of uploaded file',
|
||||
'uploadClose' =>'Close upload channel'
|
||||
);
|
||||
|
||||
$defs = array();
|
||||
foreach($methods as $method=>$description){
|
||||
$defs["archive.$method"] = array(
|
||||
"function" => array(&$archive, "xr_$method"),
|
||||
"signature" => array(array($xmlrpcStruct, $xmlrpcStruct)),
|
||||
"docstring" => $description
|
||||
);
|
||||
}
|
||||
$s=new xmlrpc_server( $defs );
|
||||
?>
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2004 Media Development Loan Fund
|
||||
#
|
||||
# This file is part of the LiveSupport project.
|
||||
# http://livesupport.campware.org/
|
||||
# To report bugs, send an e-mail to bugs@campware.org
|
||||
#
|
||||
# LiveSupport 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.
|
||||
#
|
||||
# LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Author : $Author: tomas $
|
||||
# Version : $Revision: 1.1 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/archiveServer/var/xmlrpc/Attic/xr_cli_test.py,v $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
from xmlrpclib import *
|
||||
import sys
|
||||
|
||||
if len(sys.argv)<3:
|
||||
print """
|
||||
Usage: xr_cli_pok.py [-v] [-s http://<server>/<path>/xmlrpc/xrGreenBox.php] <command> <args>
|
||||
commands and args:
|
||||
listMethods
|
||||
methodHelp <method>
|
||||
methodSignature <method>
|
||||
ping <string>
|
||||
login <username> <password>
|
||||
logout <session_id>
|
||||
"""
|
||||
sys.exit(1)
|
||||
|
||||
pars = sys.argv
|
||||
verbose=0
|
||||
if pars[1]=="-v":
|
||||
pars.pop(1)
|
||||
verbose=1
|
||||
if pars[1]=="-s":
|
||||
pars.pop(1)
|
||||
serverPath = pars.pop(1)
|
||||
else:
|
||||
serverPath = 'http://localhost:80/storage/xmlrpc/xrLocStor.php'
|
||||
server = Server(serverPath)
|
||||
method = pars.pop(1)
|
||||
pars.pop(0)
|
||||
if verbose:
|
||||
print "method: "+method
|
||||
print "pars: "
|
||||
print pars
|
||||
print "result:"
|
||||
#sys.exit(0)
|
||||
|
||||
try:
|
||||
if method=="listMethods":
|
||||
print server.system.listMethods()
|
||||
elif method=="methodHelp":
|
||||
print server.system.methodHelp(pars[0])
|
||||
elif method=="methodSignature":
|
||||
print server.system.methodSignature(pars[0])
|
||||
elif method=="ping":
|
||||
print server.archive.ping({'par':pars[0]})
|
||||
elif method=="login":
|
||||
print server.archive.login({'login':pars[0], 'pass':pars[1]})
|
||||
elif method=="logout":
|
||||
print server.archive.logout({'sessid':pars[0]})
|
||||
elif method=="downloadOpen":
|
||||
print server.archive.downloadOpen({'sessid':pars[0], 'gunid':pars[1]})
|
||||
elif method=="downloadClose":
|
||||
print server.archive.downloadClose({'sessid':pars[0], 'url':pars[1]})
|
||||
else:
|
||||
print "Unknown command: "+method
|
||||
sys.exit(1)
|
||||
except Error, v:
|
||||
print "XML-RPC Error:",v
|
Loading…
Reference in New Issue