Renamed LiveSupport to Campcaster. 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-14 15:34:00 +00:00
parent 56d250f21e
commit f4c68079d4
46 changed files with 3805 additions and 3252 deletions

View File

@ -1,103 +1,108 @@
<?
/*------------------------------------------------------------------------------
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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* AccessRecur class
*
* Hadles recursive accessPlaylist/releasePlaylist.
* Should be &quot;required_once&quot; from LocStor.php only.
* Handles recursive accessPlaylist/releasePlaylist.
* Should be 'required_once' from LocStor.php only.
*
* It's not documeted yet - excuse me, please - not enough time :(
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
*/
class AccessRecur {
function AccessRecur(&$ls, $sessid){
function AccessRecur(&$ls, $sessid)
{
$this->ls =& $ls;
$this->dbc =& $ls->dbc;
$this->sessid = $sessid;
}
function accessPlaylist(&$ls, $sessid, $plid, $parent='0'){
function accessPlaylist(&$ls, $sessid, $plid, $parent='0')
{
$ppa =& new AccessRecur($ls, $sessid);
$r = $ls->accessPlaylist($sessid, $plid, FALSE, $parent);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$plRes = $r;
$r = StoredFile::recallByGunid($ppa->ls, $plid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$ac = $r;
$r = $ac->md->genPhpArray();
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$pla = $r;
$r = $ppa->processPlaylist($pla, $plRes['token']);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$plRes['content'] = $r;
return $plRes;
}
function releasePlaylist(&$ls, $sessid, $token){
function releasePlaylist(&$ls, $sessid, $token)
{
$ppa =& new AccessRecur($ls, $sessid);
$r = $ppa->dbc->getAll("
SELECT to_hex(token)as token2, to_hex(gunid)as gunid
FROM {$ppa->ls->accessTable}
WHERE parent=x'{$token}'::bigint
");
if($ppa->dbc->isError($r)){ return $r; }
if ($ppa->dbc->isError($r)) {
return $r;
}
$arr = $r;
foreach ($arr as $i => $item) {
extract($item); // token2, gunid
$r = $ppa->ls->_getType($gunid);
if($ppa->dbc->isError($r)){ return $r; }
if ($ppa->dbc->isError($r)) {
return $r;
}
$ftype = $r;
# echo "$ftype/$token2\n";
switch (strtolower($ftype)) {
case"audioclip":
$r = $ppa->ls->releaseRawAudioData($ppa->sessid, $token2);
if($ppa->dbc->isError($r)){ return $r; }
if ($ppa->dbc->isError($r)) {
return $r;
}
# var_dump($r);
break;
case"playlist":
$r = $ppa->releasePlaylist($ppa->ls, $ppa->sessid, $token2);
if($ppa->dbc->isError($r)){ return $r; }
if ($ppa->dbc->isError($r)) {
return $r;
}
# var_dump($r);
break;
default:
}
}
$r = $ppa->ls->releasePlaylist($ppa->sessid, $token, FALSE);
if($ppa->dbc->isError($r)){ return $r; }
if ($ppa->dbc->isError($r)) {
return $r;
}
function processPlaylist($pla, $parent){
return $r;
}
function processPlaylist($pla, $parent)
{
$res = array();
foreach ($pla['children'] as $ple) {
switch ($ple['elementname']) {
case"playlistElement":
$r = $this->processPlEl($ple, $parent);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
// $res = array_merge($res, $r);
$res[] = $r;
break;
@ -106,17 +111,27 @@ class AccessRecur{
}
return $res;
}
function processAc($gunid, $parent){
function processAc($gunid, $parent)
{
$r = $this->ls->accessRawAudioData($this->sessid, $gunid, $parent);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
function processPlEl($ple, $parent='0'){
return $r;
}
function processPlEl($ple, $parent='0')
{
foreach ($ple['children'] as $ac) {
switch ($ac['elementname']) {
case"audioClip":
$r = $this->processAc($ac['attrs']['id'], $parent);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
return $r;
break;
case"playlist":
@ -124,10 +139,13 @@ class AccessRecur{
$r = $this->accessPlaylist($this->ls, $this->sessid,
$ac['attrs']['id'], $parent);
if (PEAR::isError($r)) {
if($r->getCode() != GBERR_NOTF) return $r;
else{
if ($r->getCode() != GBERR_NOTF) {
return $r;
} else {
$r = $this->processPlaylist($ac, $parent);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$r = array(
'content' => $r,
'url' => NULL,
@ -160,5 +178,6 @@ class AccessRecur{
}
return array();
}
}
} // class AccessRecur
?>

View File

@ -2,6 +2,12 @@
define('BACKUP_EXT', 'tar');
define('ACCESS_TYPE', 'backup');
/**
* @author $Author: $
* @version $Revision: $
* @package Campcaster
* @subpackage StorageServer
*/
class Backup
{
/**
@ -83,6 +89,7 @@ class Backup
$this->addLogItem("-I- ".date("Ymd-H:i:s")." construct\n");
}
/**
* Open a backup
* Create a backup file (tarball)
@ -102,7 +109,9 @@ class Backup
# get ids (and real filenames) which files match with criteria
$srch = $r = $this->gb->localSearch($this->criteria,$this->sessid);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
$this->setIDs($srch);
#echo '<XMP>this->ids:'; print_r($this->ids); echo '</XMP>';
@ -137,14 +146,17 @@ class Backup
$this->doIt();
return array('token'=>$this->token);
} else return false;
} else {
return false;
}
}
/**
* check the status of backup
* Check the status of backup.
*
* @param token : token
* @return hasharray with field:
* @param unknown $token
* @return array
* status : string - susccess | working | fault
* faultString: string - description of fault
* token : stirng - backup token
@ -176,11 +188,12 @@ class Backup
return $r;
}
/**
* Close a backup
*
* @param token : token
* @return status : boolean
* @param unknown $token
* @return boolean
*/
function closeBackup($token)
{
@ -194,14 +207,17 @@ class Backup
Backup::rRmDir($this->tmpDir);
unlink($this->statusFile);
unlink($this->tmpFile);
if (is_file($this->tmpName)) unlink($this->tmpName);
if (is_file($this->tmpName)) {
unlink($this->tmpName);
}
return !is_file($this->tmpFile);
}
/**
* list of unclosed backups
*
* @param stat : status (optional)
* @param string $stat (optional)
* if this parameter is not set, then return with all unclosed backups
* @return array of hasharray with field:
* status : string - susccess | working | fault
@ -225,10 +241,11 @@ class Backup
return $r;
}
/**
* set the ids from searchResult
* Aet the ids from searchResult
*
* @param searchResult : array of gunids
* @param array $searchResult : array of gunids
*/
function setIDs($searchResult)
{
@ -243,8 +260,9 @@ class Backup
}
}
/**
* set the filenames from ids
* Set the filenames from ids.
*
*/
function setFilenames()
@ -257,7 +275,9 @@ class Backup
$gunid = $item['gunid'];
# get a stored file object of this gunid
$sf = $r = StoredFile::recallByGunid($this->gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$lid = $this->gb->_idFromGunid($gunid);
if (($res = $this->gb->_authorize('read', $lid, $this->sessid)) !== TRUE) {
$this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - authorize gunid:$gunid\n");
@ -285,6 +305,7 @@ class Backup
}
}
/**
* Create the tarball - call the shell script
*
@ -306,6 +327,7 @@ class Backup
}
}
/**
* Copy the real files into the tmp dirs to tar they.
*
@ -334,6 +356,7 @@ class Backup
}
}
/**
* Figure out the enviroment to the backup
*
@ -384,21 +407,25 @@ class Backup
}
}
/**
* generate a new token.
*
* Generate a new token.
* @return void
*/
function genToken()
{
$acc = $this->gb->bsAccess($this->tmpFile, BACKUP_EXT, null, ACCESS_TYPE);
if($this->gb->dbc->isError($acc)){ return $acc; }
if ($this->gb->dbc->isError($acc)) {
return $acc;
}
$this->token = $acc['token'];
}
/**
* Add a line to the logfile.
*
* @param item : string - the new row of log file
* @param string $item - the new row of log file
*/
function addLogItem($item)
{
@ -408,26 +435,30 @@ class Backup
//echo file_get_contents($this->logFile)."<BR><BR>\n\n";
}
/**
* Delete a directory recursive
*
* @param dirname : string - path of dir.
* @param string $dirname - path of dir.
*/
function rRmDir($dirname)
{
if(is_dir($dirname))
if (is_dir($dirname)) {
$dir_handle = opendir($dirname);
}
while ($file = readdir($dir_handle)) {
if($file!="." && $file!="..") {
if(!is_dir($dirname."/".$file))
if ( ($file != ".") && ($file != "..") ) {
if (!is_dir($dirname."/".$file)) {
unlink ($dirname."/".$file);
else
} else {
Backup::rRmDir($dirname."/".$file);
}
}
}
closedir($dir_handle);
rmdir($dirname);
return true;
}
}
} // classs Backup
?>

View File

@ -1,32 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
define('GBERR_DENY', 40);
define('GBERR_FILEIO', 41);
define('GBERR_FILENEX', 42);
@ -52,10 +24,12 @@ require_once "Transport.php";
/**
* BasicStor class
*
* Core of LiveSupport file storage module
* Core of Campcaster file storage module
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
* @see Alib
*/
class BasicStor extends Alib {
@ -1173,7 +1147,7 @@ class BasicStor extends Alib {
* @param int $parid, destination folder local id
* @param string $plid, playlist gunid
* @param string $aPath, absolute path part of imported file
* (e.g. /home/user/livesupport)
* (e.g. /home/user/campcaster)
* @param string $rPath, relative path/filename part of imported file
* (e.g. playlists/playlist_1.smil)
* @param string $ext, playlist extension (determines type of import)

View File

@ -1,32 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
define('USE_INTERSECT', TRUE);
require_once "XML/Util.php";
@ -63,6 +35,10 @@ require_once "XML/Util.php";
* <li>cnt : integer - number of matching items</li>
* </ul>
*
* @Author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
* @see MetaData
* @see StoredFile
*/

View File

@ -1,41 +1,15 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
require_once "BasicStor.php";
/**
* GreenBox class
*
* LiveSupport file storage module
* File storage module.
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
* @see BasicStor
*/
class GreenBox extends BasicStor {

View File

@ -1,39 +1,15 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
require_once "BasicStor.php";
/**
* LocStor class
*
* Livesupport local storage interface
* Local storage interface
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
*/
class LocStor extends BasicStor {
@ -1270,7 +1246,7 @@ class LocStor extends BasicStor {
/*===================================================== auxiliary methods */
/**
* Dummy method - only returns livesupport version
* Dummy method - only returns Campcaster version
*
* @return string
*/

View File

@ -1,33 +1,4 @@
<?
/*------------------------------------------------------------------------------
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: tomash $
Version : $Revision: 1848 $
Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/storageServer/var/AccessRecur.php $
------------------------------------------------------------------------------*/
require_once "Playlist.php";
define('INDCH', ' ');
@ -37,7 +8,13 @@ define('PL_URL_RELPATH', '../playlist/');
/**
* LsPlaylist class
*
* Livesupport internal playlist format helper
* Internal playlist format helper.
*
* @author $Author: tomash $
* @version $Revision: 1848 $
* @package Campcaster
* @subpackage StorageServer
* @todo Rename this class
*/
class LsPlaylist extends Playlist
{
@ -45,9 +22,9 @@ class LsPlaylist extends Playlist
* Create instance of LsPlaylist object and recall existing file
* by gunid.<br/>
*
* @param gb reference to GreenBox object
* @param gunid string, global unique id
* @param className string, optional classname to recall
* @param Greenbox $gb, reference to GreenBox object
* @param string $gunid, global unique id
* @param string $className, optional classname to recall
* @return instance of LsPlaylist object
*/
function &recallByGunid(&$gb, $gunid, $className='LsPlaylist')
@ -55,13 +32,14 @@ class LsPlaylist extends Playlist
return parent::recallByGunid($gb, $gunid, $className);
}
/**
* Create instance of LsPlaylist object and recall existing file
* by access token.<br/>
*
* @param gb reference to GreenBox object
* @param token string, access token
* @param className string, optional classname to recall
* @param GreenBox $gb, reference to GreenBox object
* @param string $token, access token
* @param string $className, optional classname to recall
* @return instance of LsPlaylist object
*/
function &recallByToken(&$gb, $token, $className='LsPlaylist')
@ -69,21 +47,28 @@ class LsPlaylist extends Playlist
return parent::recallByToken($gb, $token, $className);
}
/**
* Export playlist as simplified SMIL XML file
*
* @param toString boolean, if false don't real export,
* @param boolean $toString
* if false don't real export,
* return misc info about playlist only
* @return XML string or hasharray with misc info
* @return string
* XML string or hasharray with misc info
*/
function output2Smil($toString=TRUE)
{
$plGunid = $this->gunid;
$arr = $r = $this->md->genPhpArray();
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
if ($toString) {
$r = LsPlaylistTag::output2Smil($this, $arr);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return $r;
} else {
return array(
@ -95,6 +80,7 @@ class LsPlaylist extends Playlist
}
}
/**
* Export playlist as M3U file
*
@ -106,10 +92,14 @@ class LsPlaylist extends Playlist
{
$plGunid = $this->gunid;
$arr = $r = $this->md->genPhpArray();
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
if ($toString) {
$r = LsPlaylistTag::output2m3u($this, $arr);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return $r;
} else {
return array(
@ -122,21 +112,28 @@ class LsPlaylist extends Playlist
}
}
/**
* Export playlist as RSS XML file
*
* @param toString boolean, if false don't real export,
* @param boolean $toString
* if false don't really export,
* return misc info about playlist only
* @return XML string or hasharray with misc info
* @return mixed
* XML string or hasharray with misc info
*/
function output2RSS($toString=TRUE)
{
$plGunid = $this->gunid;
$arr = $r = $this->md->genPhpArray();
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
if ($toString) {
$r = LsPlaylistTag::output2RSS($this, $arr);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return $r;
} else {
return array(
@ -147,28 +144,43 @@ class LsPlaylist extends Playlist
);
}
}
}
} // class LsPlaylist
/**
* Several auxiliary classes follows
* @package Campcaster
* @subpackage StorageServer
* @todo Rename this class PlaylistTag
*/
class LsPlaylistTag
{
function output2Smil(&$pl, $plt, $ind='')
{
$ind2 = $ind.INDCH; $ind3 = $ind2.INDCH; $ind4 = $ind3.INDCH;
$ind2 = $ind.INDCH;
$ind3 = $ind2.INDCH;
$ind4 = $ind3.INDCH;
$res = "";
foreach ($plt['children'] as $ple) {
switch ($ple['elementname']) {
case"playlistElement":
$r = LsPlaylistElement::output2Smil($pl, $ple, $ind4);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $res .= $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$res .= $r;
}
break;
case"metadata":
$r = LsPlaylistMetadata::output2Smil($pl, $ple, $ind4);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $res .= $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$res .= $r;
}
break;
default:
}
@ -183,6 +195,8 @@ class LsPlaylistTag
"$ind</smil>\n";
return $res;
}
function output2m3u(&$pl, $plt, $ind='')
{
$res = "";
@ -190,29 +204,44 @@ class LsPlaylistTag
switch ($ple['elementname']) {
case"playlistElement":
$r = LsPlaylistElement::output2m3u($pl, $ple);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $res .= $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$res .= $r;
}
break;
}
}
$res = "#EXTM3U\n$res";
return $res;
}
function output2RSS(&$pl, $plt, $ind='')
{
$ind2 = $ind.INDCH; $ind3 = $ind2.INDCH;
$ind2 = $ind.INDCH;
$ind3 = $ind2.INDCH;
$res = "";
foreach ($plt['children'] as $ple) {
switch ($ple['elementname']) {
case"playlistElement":
$r = LsPlaylistElement::output2RSS($pl, $ple, $ind3);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $res .= $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$res .= $r;
}
break;
case"metadata":
$r = LsPlaylistMetadata::output2RSS($pl, $ple, $ind3);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $res .= $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$res .= $r;
}
break;
default:
}
@ -225,32 +254,57 @@ class LsPlaylistTag
"$ind</rss>\n";
return $res;
}
}
} // class LsPlaylistTag
/**
* @package Campcaster
* @subpackage StorageServer
* @todo Rename this class "PlaylistElement"
*/
class LsPlaylistElement {
function output2Smil(&$pl, $ple, $ind='')
{
$acOrPl = NULL; $finfo = array('fi'=>0, 'fo'=>0);
$ind2 = $ind.INDCH; $ind3 = $ind2.INDCH;
$acOrPl = NULL;
$finfo = array('fi'=>0, 'fo'=>0);
$ind2 = $ind.INDCH;
$ind3 = $ind2.INDCH;
$anim = '';
foreach ($ple['children'] as $ac) {
switch ($ac['elementname']) {
case "audioClip":
$r = LsPlaylistAudioClip::output2Smil($pl, $ac, $ind2);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $acOrPl = $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$acOrPl = $r;
}
break;
case "playlist":
$gunid = $ac['attrs']['id'];
$pl2 = $r = LsPlaylist::recallByGunid($pl->gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$r = $pl2->output2Smil(FALSE);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $acOrPl = $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$acOrPl = $r;
}
break;
case"fadeInfo":
$r = LsPlaylistFadeInfo::output2Smil($pl, $ac, $ind2);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $finfo = $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$finfo = $r;
}
break;
default:
return PEAR::raiseError(
@ -277,7 +331,6 @@ class LsPlaylistElement{
"{$ind3}fill = \"freeze\"\n".
"{$ind2}/>\n"
;
}else{
}
}
$src = $acOrPl['src'];
@ -287,6 +340,8 @@ class LsPlaylistElement{
"\n";
return $str;
}
function output2m3u(&$pl, $ple, $ind='')
{
$acOrPl = NULL;
@ -294,20 +349,32 @@ class LsPlaylistElement{
switch ($ac['elementname']) {
case "audioClip":
$r = LsPlaylistAudioClip::output2m3u($pl, $ac);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $acOrPl = $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$acOrPl = $r;
}
break;
case "playlist":
$gunid = $ac['attrs']['id'];
$pl2 = $r = LsPlaylist::recallByGunid($pl->gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$r = $pl2->output2m3u(FALSE);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $acOrPl = $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$acOrPl = $r;
}
break;
}
}
if(is_null($acOrPl)) return '';
if (is_null($acOrPl)) {
return '';
}
$playlength = ceil($pl->_plTimeToSecs($acOrPl['playlength']));
$title = $acOrPl['title'];
$uri = (isset($acOrPl['uri']) ? $acOrPl['uri'] : '???' );
@ -315,6 +382,8 @@ class LsPlaylistElement{
$res .= "$uri\n";
return $res;
}
function output2RSS(&$pl, $ple, $ind='')
{
$acOrPl = NULL;
@ -324,16 +393,26 @@ class LsPlaylistElement{
switch ($ac['elementname']) {
case "audioClip":
$r = LsPlaylistAudioClip::output2RSS($pl, $ac, $ind2);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $acOrPl = $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$acOrPl = $r;
}
break;
case"playlist":
$gunid = $ac['attrs']['id'];
$pl2 = $r = LsPlaylist::recallByGunid($pl->gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$r = $pl2->output2RSS(FALSE);
if(PEAR::isError($r)) return $r;
if(!is_null($r)) $acOrPl = $r;
if (PEAR::isError($r)) {
return $r;
}
if (!is_null($r)) {
$acOrPl = $r;
}
break;
case"fadeInfo":
break;
@ -356,15 +435,27 @@ class LsPlaylistElement{
return $str;
}
}
/**
* @package Campcaster
* @subpackage StorageServer
* @todo Rename this class to PlaylistAudioClip (notice the caps)
*/
class LsPLaylistAudioClip
{
function output2Smil(&$pl, $plac, $ind='')
{
$gunid = $plac['attrs']['id'];
$ac = $r = StoredFile::recallByGunid($pl->gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$RADext = $r =$ac->_getExt();
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
return array(
'type' => 'audioclip',
'gunid' => $gunid,
@ -372,31 +463,47 @@ class LsPLaylistAudioClip
'playlength' => $plac['attrs']['playlength'],
);
}
function output2m3u(&$pl, $plac, $ind='')
{
$gunid = $plac['attrs']['id'];
$ac = $r = StoredFile::recallByGunid($pl->gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$RADext = $r =$ac->_getExt();
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
return array(
'playlength' => $plac['attrs']['playlength'],
'title' => $plac['attrs']['title'],
'uri' => AC_URL_RELPATH."$gunid.$RADext",
);
}
function output2RSS(&$pl, $plac, $ind='')
{
$gunid = $plac['attrs']['id'];
$ac = $r = StoredFile::recallByGunid($pl->gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$RADext = $r =$ac->_getExt();
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$r = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:title');
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$title = ( isset($r[0]) ? $r[0]['value'] : '' );
$r = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:description');
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$desc = ( isset($r[0]) ? $r[0]['value'] : '' );
return array(
'type' => 'audioclip',
@ -407,10 +514,17 @@ class LsPLaylistAudioClip
'desc' => $desc,
);
}
}
} // class LsPlaylistAudioClip
/**
* @package Campcaster
* @subpackage StorageServer
* @todo Rename this class "PlaylistFadeInfo" (notive the caps)
*/
class LsPLaylistFadeInfo
{
function output2Smil(&$pl, $plfi, $ind='')
{
$r = array(
@ -419,14 +533,44 @@ class LsPLaylistFadeInfo
);
return $r;
}
function output2m3u(&$pl, $plfa, $ind=''){ return ''; }
function output2RSS(&$pl, $plfa, $ind=''){ return ''; }
function output2m3u(&$pl, $plfa, $ind='')
{
return '';
}
function output2RSS(&$pl, $plfa, $ind='')
{
return '';
}
} // class LsPlaylistFadeInfo
/**
* @package Campcaster
* @subpackage StorageServer
* @todo Rename this class to PlaylistMetadata (notive the caps)
*/
class LsPLaylistMetadata
{
function output2Smil(&$pl, $md, $ind=''){ return NULL; }
function output2m3u(&$pl, $md, $ind=''){ return NULL; }
function output2RSS(&$pl, $md, $ind=''){ return NULL; }
function output2Smil(&$pl, $md, $ind='')
{
return NULL;
}
function output2m3u(&$pl, $md, $ind='')
{
return NULL;
}
function output2RSS(&$pl, $md, $ind='')
{
return NULL;
}
} // class PlaylistMetadata
?>

View File

@ -1,38 +1,13 @@
<?
/*------------------------------------------------------------------------------
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: tomash $
Version : $Revision: 1848 $
Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/storageServer/var/AccessRecur.php $
------------------------------------------------------------------------------*/
define('INDCH', ' ');
/**
* M3uPlaylist class
*
* @author $Author: tomash $
* @version : $Revision: 1848 $
* @package Campcaster
* @subpackage StorageServer
*/
class M3uPlaylist {
/**
@ -79,7 +54,7 @@ class M3uPlaylist {
*
* @param gb reference to GreenBox object
* @param aPath string, absolute path part of imported file
* (e.g. /home/user/livesupport)
* (e.g. /home/user/campcaster)
* @param rPath string, relative path/filename part of imported file
* (e.g. playlists/playlist_1.smil)
* @param gunids hasharray, hash relation from filenames to gunids
@ -141,7 +116,7 @@ class M3uPlaylist {
*
* @param gb reference to GreenBox object
* @param data string, local path to M3U file
* @return XML string - playlist in Livesupport playlist format
* @return XML string - playlist in Campcaster playlist format
*/
function convert2lspl(&$gb, $data){
$arr = $r = M3uPlaylist::parse($data);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +1,22 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* Prefs class
*
* LiveSupport preference storage class
* Preference storage class.
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
* @see StoredFile
*/
/* ================== Prefs ================== */
class Prefs {
/**
* Constructor
*
* @param gb object, GreenBox object reference
* @param GreenBox $gb
* GreenBox object reference
*/
function Prefs(&$gb)
{
@ -51,25 +25,33 @@ class Prefs{
$this->prefTable = $gb->config['tblNamePrefix'].'pref';
}
/* ======================================================= public methods */
/* ----------------------------------------------------- user preferences */
/**
* Read preference record by session id
*
* @param sessid string, session id
* @param key string, preference key
* @return string, preference value
* @param string $sessid
* session id
* @param string $key
* preference key
* @return string
* preference value
*/
function loadPref($sessid, $key)
{
$subjid = $this->gb->getSessUserId($sessid);
if(PEAR::isError($subjid)) return $subjid;
if (PEAR::isError($subjid)) {
return $subjid;
}
if (is_null($subjid)) {
return PEAR::raiseError("Prefs::loadPref: invalid session id",
GBERR_SESS);
}
$val = $this->readVal($subjid, $key);
if(PEAR::isError($val)) return $val;
if (PEAR::isError($val)) {
return $val;
}
if ($val === FALSE) {
return PEAR::raiseError("Prefs::loadPref: invalid preference key",
GBERR_PREF);
@ -77,48 +59,65 @@ class Prefs{
return $val;
}
/**
* Save preference record by session id
*
* @param sessid string, session id
* @param key string, preference key
* @param value string, preference value
* @param string $sessid
* session id
* @param string $key
* preference key
* @param string $value
* preference value
* @return boolean
*/
function savePref($sessid, $key, $value)
{
$subjid = $this->gb->getSessUserId($sessid);
if(PEAR::isError($subjid)) return $subjid;
if (PEAR::isError($subjid)) {
return $subjid;
}
if (is_null($subjid)) {
return PEAR::raiseError("Prefs::savePref: invalid session id",
GBERR_SESS);
}
$r = $this->update($subjid, $key, $value);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
if ($r === FALSE) {
$r = $this->insert($subjid, $key, $value);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
}
return TRUE;
}
/**
* Delete preference record by session id
*
* @param sessid string, session id
* @param key string, preference key
* @param string $sessid
* session id
* @param string $key
* preference key
* @return boolean
*/
function delPref($sessid, $key)
{
$subjid = $this->gb->getSessUserId($sessid);
if(PEAR::isError($subjid)) return $subjid;
if (PEAR::isError($subjid)) {
return $subjid;
}
if (is_null($subjid)) {
return PEAR::raiseError("Prefs::delPref: invalid session id",
GBERR_SESS);
}
$r = $this->delete($subjid, $key);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
if ($r === FALSE) {
return PEAR::raiseError("Prefs::delPref: invalid preference key",
GBERR_PREF);
@ -126,26 +125,35 @@ class Prefs{
return TRUE;
}
/* ---------------------------------------------------- group preferences */
/**
* Read group preference record
*
* @param sessid string, session id
* @param group string, group name
* @param key string, preference key
* @return string, preference value
* @param string $sessid
* session id
* @param string $group
* group name
* @param string $key
* preference key
* @return string
* preference value
*/
function loadGroupPref($sessid, $group, $key)
{
// if sessid is would be used here fix Transport::cronCallMethod !
$subjid = $this->gb->getSubjId($group);
if(PEAR::isError($subjid)) return $subjid;
if (PEAR::isError($subjid)) {
return $subjid;
}
if (is_null($subjid)) {
return PEAR::raiseError(
"Prefs::loadGroupPref: invalid group name", ALIBERR_NOTGR);
}
$val = $this->readVal($subjid, $key);
if(PEAR::isError($val)) return $val;
if (PEAR::isError($val)) {
return $val;
}
if ($val === FALSE) {
return PEAR::raiseError(
"Prefs::loadGroupPref: invalid preference key", GBERR_PREF);
@ -153,40 +161,55 @@ class Prefs{
return $val;
}
/**
* Save group preference record
*
* @param sessid string, session id
* @param group string, group name
* @param key string, preference key
* @param value string, preference value
* @param string $sessid
* session id
* @param string $group
* group name
* @param string $key
* preference key
* @param string $value
* preference value
* @return boolean
*/
function saveGroupPref($sessid, $group, $key, $value)
{
$uid = $this->gb->getSessUserId($sessid);
if(PEAR::isError($uid)) return $uid;
if (PEAR::isError($uid)) {
return $uid;
}
if (is_null($uid)) {
return PEAR::raiseError(
"Prefs::saveGroupPref: invalid session id", GBERR_SESS);
}
$gid = $this->gb->getSubjId($group);
if(PEAR::isError($gid)) return $gid;
if (PEAR::isError($gid)) {
return $gid;
}
if (is_null($gid)) {
return PEAR::raiseError(
"Prefs::saveGroupPref: invalid group name", GBERR_SESS);
}
$memb = $this->gb->isMemberOf($uid, $gid);
if(PEAR::isError($memb)) return $memb;
if (PEAR::isError($memb)) {
return $memb;
}
if (!$memb) {
return PEAR::raiseError(
"Prefs::saveGroupPref: access denied", GBERR_DENY);
}
$r = $this->update($gid, $key, $value);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
if ($r === FALSE) {
$r = $this->insert($gid, $key, $value);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
}
return TRUE;
}
@ -194,68 +217,93 @@ class Prefs{
/**
* Delete group preference record
*
* @param sessid string, session id
* @param group string, group name
* @param key string, preference key
* @param string $sessid
* session id
* @param string $group
* group name
* @param string $key
* preference key
* @return boolean
*/
function delGroupPref($sessid, $group, $key)
{
$uid = $this->gb->getSessUserId($sessid);
if(PEAR::isError($uid)) return $uid;
if (PEAR::isError($uid)) {
return $uid;
}
if (is_null($uid)) {
return PEAR::raiseError(
"Prefs::delGroupPref: invalid session id", GBERR_SESS);
}
$gid = $this->gb->getSubjId($group);
if(PEAR::isError($gid)) return $gid;
if (PEAR::isError($gid)) {
return $gid;
}
if (is_null($gid)) {
return PEAR::raiseError(
"Prefs::delGroupPref: invalid group name", GBERR_SESS);
}
$memb = $this->gb->isMemberOf($uid, $gid);
if(PEAR::isError($memb)) return $memb;
if (PEAR::isError($memb)) {
return $memb;
}
if (!$memb) {
return PEAR::raiseError(
"Prefs::delGroupPref: access denied", GBERR_DENY);
}
$r = $this->delete($gid, $key);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
if ($r === FALSE) {
return PEAR::raiseError(
"Prefs::delGroupPref: invalid preference key", GBERR_PREF);
}
return TRUE;
}
/* ==================================================== low level methods */
/**
* Insert of new preference record
*
* @param subjid int, local user/group id
* @param keystr string, preference key
* @param valstr string, preference value
* @return int, local user id
* @param int $subjid
* local user/group id
* @param string $keystr
* preference key
* @param string $valstr
* preference value
* @return int
* local user id
*/
function insert($subjid, $keystr, $valstr='')
{
$id = $this->dbc->nextId("{$this->prefTable}_id_seq");
if(PEAR::isError($id)) return $id;
if (PEAR::isError($id)) {
return $id;
}
$r = $this->dbc->query("
INSERT INTO {$this->prefTable}
(id, subjid, keystr, valstr)
VALUES
($id, $subjid, '$keystr', '$valstr')
");
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
return $id;
}
/**
* Read value of preference record
*
* @param subjid int, local user/group id
* @param keystr string, preference key
* @return string, preference value
* @param int $subjid
* local user/group id
* @param string $keystr
* preference key
* @return string
* preference value
*/
function readVal($subjid, $keystr)
{
@ -263,16 +311,23 @@ class Prefs{
SELECT valstr FROM {$this->prefTable}
WHERE subjid=$subjid AND keystr='$keystr'
");
if(PEAR::isError($val)) return $val;
if(is_null($val)) return FALSE;
if (PEAR::isError($val)) {
return $val;
}
if (is_null($val)) {
return FALSE;
}
return $val;
}
/**
* Read all keys of subject's preferences
*
* @param subjid int, local user/group id
* @return array, preference keys
* @param int $subjid
* local user/group id
* @return array
* preference keys
*/
function readKeys($subjid)
{
@ -280,17 +335,25 @@ class Prefs{
SELECT keystr FROM {$this->prefTable}
WHERE subjid=$subjid
");
if(PEAR::isError($res)) return $res;
if(is_null($res)) return FALSE;
if (PEAR::isError($res)) {
return $res;
}
if (is_null($res)) {
return FALSE;
}
return $res;
}
/**
* Update value of preference record
*
* @param subjid int, local user/group id
* @param keystr string, preference key
* @param newvalstr string, new preference value
* @param int $subjid
* local user/group id
* @param string $keystr
* preference key
* @param string $newvalstr
* new preference value
* @return boolean
*/
function update($subjid, $keystr, $newvalstr='')
@ -300,16 +363,23 @@ class Prefs{
valstr='$newvalstr'
WHERE subjid=$subjid AND keystr='$keystr'
");
if(PEAR::isError($r)) return $r;
if($this->dbc->affectedRows()<1) return FALSE;
if (PEAR::isError($r)) {
return $r;
}
if ($this->dbc->affectedRows() < 1) {
return FALSE;
}
return TRUE;
}
/**
* Delete preference record
*
* @param subjid int, local user/group id
* @param keystr string, preference key
* @param int $subjid
* local user/group id
* @param string $keystr
* preference key
* @return boolean
*/
function delete($subjid, $keystr)
@ -318,11 +388,16 @@ class Prefs{
DELETE FROM {$this->prefTable}
WHERE subjid=$subjid AND keystr='$keystr'
");
if(PEAR::isError($r)) return $r;
if($this->dbc->affectedRows()<1) return FALSE;
if (PEAR::isError($r)) {
return $r;
}
if ($this->dbc->affectedRows() < 1) {
return FALSE;
}
return TRUE;
}
/* ==================================================== auxiliary methods */
/**
* Test method
@ -334,14 +409,18 @@ class Prefs{
$testkey = 'testKey';
$testVal = 'abcDef 0123 ěščřžýáíé ĚŠČŘŽÝÁÍÉ';
$r = savePref($sessid, $testKey, $testVal);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$val = loadPref($sessid, $testKey);
if ($val != $testVal) {
echo "ERROR: preference storage test failed.\n ($testVal / $val)\n";
return FALSE;
}
$r = savePref($sessid, $testKey, '');
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$val = loadPref($sessid, $testKey);
if ($val != $testVal) {
echo "ERROR: preference storage test failed.\n ('' / '$val')\n";
@ -350,6 +429,7 @@ class Prefs{
return TRUE;
}
/**
* Install database table for preference storage
*
@ -364,7 +444,9 @@ class Prefs{
keystr varchar(255),
valstr text
)");
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$this->dbc->query("CREATE UNIQUE INDEX {$this->prefTable}_id_idx
ON {$this->prefTable} (id)");
$this->dbc->query("CREATE UNIQUE INDEX {$this->prefTable}_subj_key_idx
@ -372,15 +454,22 @@ class Prefs{
$this->dbc->query("CREATE INDEX {$this->prefTable}_subjid_idx
ON {$this->prefTable} (subjid)");
$stPrefGr = $this->gb->getSubjId($this->gb->config['StationPrefsGr']);
if(PEAR::isError($stPrefGr)) echo $stPrefGr->getMessage()."\n";
if (PEAR::isError($stPrefGr)) {
echo $stPrefGr->getMessage()."\n";
}
$r = $this->insert($stPrefGr, 'stationName', "Radio Station 1");
if(PEAR::isError($r)) echo $r->getMessage()."\n";
if (PEAR::isError($r)) {
echo $r->getMessage()."\n";
}
$genres = file_get_contents( dirname(__FILE__).'/genres.xml');
$r = $this->insert($stPrefGr, 'genres', $genres);
if(PEAR::isError($r)) echo $r->getMessage()."\n";
if (PEAR::isError($r)) {
echo $r->getMessage()."\n";
}
return TRUE;
}
/**
* Uninstall database table for preference storage
*
@ -392,12 +481,5 @@ class Prefs{
$this->dbc->dropSequence("{$this->prefTable}_id_seq");
}
/**
*
* /
function ()
{
}*/
}
} // class Prefs
?>

View File

@ -1,50 +1,25 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* RawMediaData class
*
* LiveSupport file storage support class
* File storage support class
* Store media files in real filesystem and handle access to them.<br>
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
* @see StoredFile
*/
class RawMediaData{
/**
* Constructor
*
* @param gunid string, global unique id
* @param resDir string, resource directory
* @return this
* @param string $gunid
* global unique id
* @param string $resDir
* resource directory
*/
function RawMediaData($gunid, $resDir)
{
@ -57,15 +32,20 @@ class RawMediaData{
;
}
/**
* Insert media file to filesystem
*
* @param mediaFileLP string, local path
* @return true or PEAR::error
* @param string $mediaFileLP
* local path
* @return mixed
* true or PEAR::error
*/
function insert($mediaFileLP)
{
if($this->exists) return FALSE;
if ($this->exists) {
return FALSE;
}
// for files downloaded from archive:
if ($mediaFileLP == $this->fname) {
$this->exists = TRUE;
@ -85,20 +65,28 @@ class RawMediaData{
}
}
/**
* Delete and insert media file
*
* @param mediaFileLP string, local path
* @return true or PEAR::error
* @param string $mediaFileLP, local path
* @return mixed
* true or PEAR::error
*/
function replace($mediaFileLP)
{
if($this->exists){ $r = $this->delete(); }
else{ $r = NULL; }
if(PEAR::isError($r)) return $r;
if ($this->exists) {
$r = $this->delete();
} else {
$r = NULL;
}
if (PEAR::isError($r)) {
return $r;
}
return $this->insert($mediaFileLP);
}
/**
* Return true if file corresponding to the object exists
*
@ -109,6 +97,7 @@ class RawMediaData{
return $this->exists;
}
/**
* Return filename
*
@ -119,14 +108,18 @@ class RawMediaData{
return $this->fname;
}
/**
* Delete media file from filesystem
*
* @return boolean or PEAR::error
* @return mixed
* boolean or PEAR::error
*/
function delete()
{
if(!$this->exists) return FALSE;
if (!$this->exists) {
return FALSE;
}
if (@unlink($this->fname)) {
$this->exists = FALSE;
return TRUE;
@ -139,14 +132,18 @@ class RawMediaData{
return $this->exists;
}
/**
* Analyze media file with getid3 module
*
* @return hierarchical hasharray with information about media file
* @return array
* hierarchical hasharray with information about media file
*/
function analyze()
{
if(!$this->exists) return FALSE;
if (!$this->exists) {
return FALSE;
}
//$ia = @GetAllFileinfo($this->fname, 'mp3');
//prepared for getid3 upgrade:
$getID3 = new getID3;
@ -154,6 +151,7 @@ class RawMediaData{
return $ia;
}
/**
* Get mime-type returned by getid3 module
*
@ -162,11 +160,16 @@ class RawMediaData{
function getMime()
{
$a = $this->analyze();
if($a === FALSE) return $a;
if(isset($a['mime_type'])) return $a['mime_type'];
if ($a === FALSE) {
return $a;
}
if (isset($a['mime_type'])) {
return $a['mime_type'];
}
return '';
}
/**
* Contruct filepath of media file
*
@ -177,47 +180,61 @@ class RawMediaData{
return "{$this->resDir}/{$this->gunid}";
}
/**
* Test method
*
* @param testFname1 string
* @param testFname2 string
* @param accLinkFname string
* @param string $testFname1
* @param string $testFname2
* @param string $accLinkFname
* @return string
*/
function test($testFname1, $testFname2, $accLinkFname)
{
$log = '';
if($this->exists())
if ($this->exists()) {
$log .= "---: exists: YES\n";
else
} else {
$log .= "---: exists: NO\n";
if(!($r = $this->delete()))
}
if (!($r = $this->delete())) {
$log .= "---: delete: nothing to delete\n";
if(PEAR::isError($r))
}
if (PEAR::isError($r)) {
$log .= "ERR: ".$r->getMessage()."\n";
if($r = $this->insert($testFname1))
}
if ($r = $this->insert($testFname1)) {
$log .= "---: insert: already exists\n";
if(PEAR::isError($r))
}
if (PEAR::isError($r)) {
$log .= "ERR: ".$r->getMessage()."\n";
if($r = $this->replace($testFname2))
}
if ($r = $this->replace($testFname2)) {
$log .= "---: replace: already exists\n";
if(PEAR::isError($r))
}
if (PEAR::isError($r)) {
$log .= "ERR: ".$r->getMessage()."\n";
if($this->exists())
}
if ($this->exists()) {
$log .= "---: exists: YES\n";
else
} else {
$log .= "---: exists: NO\n";
if(!$this->access($accLinkFname))
}
if (!$this->access($accLinkFname)) {
$log .= "---: access: not exists\n";
}
if (($ft = filetype($accLinkFname)) == 'link') {
if(($rl = readlink($accLinkFname)) != $this->fname)
if (($rl = readlink($accLinkFname)) != $this->fname) {
$log .= "ERR: wrong target ($rl)\n";
}else
}
} else {
$log .= "ERR: wrong file type ($ft)\n";
if(!$this->release($accLinkFname))
}
if (!$this->release($accLinkFname)) {
$log .= "---: access: not exists\n";
}
return $log;
}
}
} // class RawMediaData
?>

View File

@ -1,33 +1,4 @@
<?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: tomash $
Version : $Revision: 1949 $
Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/storageServer/var/BasicStor.php $
------------------------------------------------------------------------------*/
define('RENDER_EXT', 'ogg');
require_once "LsPlaylist.php";
@ -39,29 +10,37 @@ require_once "LsPlaylist.php";
*
* @author $Author: tomash $
* @version $Revision: 1949 $
* @package Campcaster
* @subpackage StorageServer
* @see LocStor
*/
class Renderer
{
/**
* Render playlist to ogg file (open handle)
*
* @param gb: greenbox object reference
* @param plid : string - playlist gunid
* @param owner: int - local subject id, owner of token
* @return hasharray:
* @param GreenBox $gb
* greenbox object reference
* @param string $plid
* playlist gunid
* @param int $owner
* local subject id, owner of token
* @return array
* token: string - render token
*/
function rnRender2FileOpen(&$gb, $plid, $owner=NULL)
{
// recall playlist:
$pl = $r = LsPlaylist::recallByGunid($gb, $plid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
// smil export:
$smil = $r = $pl->output2Smil();
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
// temporary file for smil:
$tmpn = tempnam($gb->bufferDir, 'plRender_');
$smilf = "$tmpn.smil";
@ -75,7 +54,9 @@ class Renderer
file_put_contents($logf, "--- ".date("Ymd-H:i:s")."\n", FILE_APPEND);
// open access to output file: /*gunid*/ /*parent*/
$acc = $gb->bsAccess($outf, RENDER_EXT, $plid, 'render', 0, $owner);
if($gb->dbc->isError($acc)){ return $acc; }
if ($gb->dbc->isError($acc)) {
return $acc;
}
extract($acc);
$statf = Renderer::getStatusFile($gb, $token);
file_put_contents($statf, "working");
@ -93,12 +74,15 @@ class Renderer
return array('token'=>$token);
}
/**
* Render playlist to ogg file (check results)
*
* @param gb: greenbox object reference
* @param token : string - render token
* @return hasharray:
* @param GreenBox $gb
* GreenBox object reference
* @param string $token
* render token
* @return array
* status : string - success | working | fault
* url : string - readable url
*/
@ -116,13 +100,16 @@ class Renderer
return array('status'=>$status, 'url'=>$url, 'tmpfile'=>$tmpfile);
}
/**
* Render playlist to ogg file (list results)
*
* @param gb: greenbox object reference
* @param stat : status (optional)
* if this parameter is not set, then return with all unclosed backups
* @return array of hasharray:
* @param GreenBox $gb
* greenbox object reference
* @param string $stat
* status (optional) if this parameter is not set, then return with all unclosed backups
* @return array
* array of hasharray:
* status : string - success | working | fault
* url : string - readable url
*/
@ -131,24 +118,30 @@ class Renderer
$tokens = $gb->getTokensByType('render');
foreach ($tokens as $token) {
$st = Renderer::rnRender2FileCheck($gb, $token);
if ($stat=='' || $st['status']==$stat) {
if ( ($stat=='') || ($st['status']==$stat) ) {
$r[] = $st;
}
}
return $r;
}
/**
* Render playlist to ogg file (close handle)
*
* @param gb: greenbox object reference
* @param token : string - render token
* @return status : boolean
* @param GreenBox $gb
* greenbox object reference
* @param string $token
* render token
* @return mixed
* TRUE or PEAR_Error
*/
function rnRender2FileClose(&$gb, $token)
{
$r = $gb->bsRelease($token, 'render');
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$realOgg = $r['realFname'];
$tmpn = "{$gb->bufferDir}/".basename($realOgg, '.'.RENDER_EXT);
$smilf = "$tmpn.smil";
@ -160,19 +153,24 @@ class Renderer
return TRUE;
}
/**
* Render playlist to storage as audioClip (check results)
*
* @param gb: greenbox object reference
* @param token: string - render token
* @return hasharray:
* @param GreenBox $gb
* greenbox object reference
* @param string $token
* render token
* @return array
* status : string - success | working | fault
* gunid: string - global unique id of result file
*/
function rnRender2StorageCheck(&$gb, $token)
{
$r = Renderer::rnRender2FileCheck($gb, $token);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$status = $r['status'];
$res = array('status' => $status, 'gunid'=>'NULL');
switch ($status) {
@ -181,7 +179,9 @@ class Renderer
break;
case "success":
$r = Renderer::rnRender2StorageCore($gb, $token);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$res['gunid'] = $r['gunid'];
break;
default:
@ -190,33 +190,44 @@ class Renderer
return $res;
}
/**
* Render playlist to storage as audioClip (core method)
*
* @param gb: greenbox object reference
* @param token: string - render token
* @return hasharray:
* @param GreenBox $gb
* greenbox object reference
* @param string $token
* render token
* @return array:
* gunid: string - global unique id of result file
*/
function rnRender2StorageCore(&$gb, $token)
{
$r = $gb->bsRelease($token, 'render');
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$realOgg = $r['realFname'];
$owner = $r['owner'];
$gunid = $r['gunid'];
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$parid = $r = $gb->_getHomeDirId($owner);
if (PEAR::isError($r)) return $r;
$fileName = 'rendered_playlist';
$id = $r = $gb->_idFromGunid($gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$mdata = '';
foreach (array(
'dc:title', 'dcterms:extent', 'dc:creator', 'dc:description'
) as $item) {
$md = $r = $gb->bsGetMetadataValue($id, $item);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$val = ( isset($md[0]) ? ( isset($md[0]['value']) ? $md[0]['value'] : '') : '');
$mdata .= " <$item>$val</$item>\n";
}
@ -224,18 +235,25 @@ class Renderer
//$mdata = "<audioClip>\n <metadata>\n$mdata<dcterms:extent>0</dcterms:extent>\n</metadata>\n</audioClip>\n";
$id = $r = $gb->bsPutFile($parid, $fileName, $realOgg, $mdata,
NULL, 'audioclip', 'string');
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$ac = $r = StoredFile::recall($gb, $id);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
return array('gunid' => $ac->gunid);
}
/**
* Return local filepath of rendered file
*
* @param gb: greenbox object reference
* @param token: string - render token
* @return hasharray:
* @param Greenbox $gb
* greenbox object reference
* @param string $token
* render token
* @return array
*/
function getLocalFile(&$gb, $token)
{
@ -243,30 +261,37 @@ class Renderer
return "{$gb->accessDir}/$token.".RENDER_EXT;
}
/**
* Return filepath of render status file
*
* @param gb: greenbox object reference
* @param token: string - render token
* @return hasharray:
* @param GreenBox $gb
* greenbox object reference
* @param string $token
* render token
* @return array
*/
function getStatusFile(&$gb, $token)
{
return Renderer::getLocalFile($gb, $token).".status";
}
/**
* Return remote accessible URL for rendered file
*
* @param gb: greenbox object reference
* @param token: string - render token
* @return hasharray:
* @param GreenBox $gb
* greenbox object reference
* @param string $token
* render token
* @return array
*/
function getUrl(&$gb, $token)
{
$token = StoredFile::_normalizeGunid($token);
return $gb->getUrlPart()."access/$token.".RENDER_EXT;
}
}
} // class Renderer
?>

View File

@ -1,6 +1,12 @@
<?php
define('ACCESS_TYPE', 'restore');
/**
* @author $Author: $
* @version $Revision: $
* @package Campcaster
* @subpackage StorageServer
*/
class Restore {
/**
* string - name of logfile
@ -39,7 +45,8 @@ class Restore {
/**
* Constructor
*
* @param gb: greenbox object reference
* @param GreenBox $gb
* greenbox object reference
*/
function Restore (&$gb) {
$this->gb =& $gb;
@ -50,13 +57,16 @@ class Restore {
}
}
/**
* Call asyncronly the restore procedure
* Restore from backup.
* Call asyncronously the restore procedure. Restore from backup.
*
* @param sessid : string - session id
* @param backup_file : path of the backup file
* @return hasharray with field:
* @param string $sessid
* session id
* @param string $backup_file
* path of the backup file
* @return array
* hasharray with field:
* token string: backup token
*/
function openRestore($sessid, $backup_file) {
@ -81,11 +91,13 @@ class Restore {
return array('token'=>$this->token);
}
/**
* check the status of restore
* Check the status of restore
*
* @param token : token
* @return hasharray with field:
* @param string $token
* @return array
* hasharray with field:
* status : string - susccess | working | fault
* faultString : string - description of fault
* token : stirng - backup token
@ -104,7 +116,9 @@ class Restore {
list($stat,$message) = explode('|',$stat);
}
$r['status'] = $stat;
if ($stat=='fault') $r['faultString'] = $message;
if ($stat=='fault') {
$r['faultString'] = $message;
}
$r['token'] = $token;
return $r;
} else {
@ -112,11 +126,13 @@ class Restore {
}
}
/**
* check the status of restore
* Check the status of restore.
*
* @param token : token
* @return hasharray with field:
* @param string $token
* @return array
* hasharray with field:
* status : boolean - is susccess
*/
function closeRestore($token) {
@ -130,15 +146,19 @@ class Restore {
return !is_file($this->statusFile);
}
/**
* Do restore in background
*
* this function is called from the asyncron commandline script
* ../bin/restore.php
*
* @param backupfile : string - path of backupfile
* @param token : string - restore token
* @param sessid : string - session id
* @param string $backupfile
* path of backupfile
* @param string $token
* restore token
* @param string $sessid
* session id
*/
function startRestore($backupfile, $token, $sessid) {
if ($this->loglevel=='debug') {
@ -181,10 +201,12 @@ class Restore {
file_put_contents($this->statusFile, 'success');
}
/**
* get the metafiles
* Get the metafiles.
*
* @return array of hasharray with field:
* @return array
* array of hasharray with field:
* file : string - metafile path
* type : stirng - audioClip | playlist
* id : string - the backuped gunid
@ -210,14 +232,19 @@ class Restore {
return $r;
}
/**
* Add the file to the storage server
* Add the file to the storage server.
*
* @param file : string - path of metafile
* @param type : string - restore token
* @param sessid : string - session id
* @param string $file
* path of metafile
* @param string $type
* restore token
* @param string $sessid
* session id
*
* @return true if succes or PEAR error
* @return mixed
* true if success or PEAR_error
*/
function addFileToStorage($file,$type,$gunid) {
if ($this->loglevel=='debug') {
@ -256,8 +283,12 @@ class Restore {
$parid = $this->gb->_getHomeDirIdFromSess($this->sessid);
#$this->addLogItem("Parid:$parid\n");
$name = $tree->children[0]->children[0]->content;
if(empty($name)) $name = $tree->attrs['title']->val;
if(empty($name)) $name = '???';
if (empty($name)) {
$name = $tree->attrs['title']->val;
}
if (empty($name)) {
$name = '???';
}
if ($this->loglevel=='debug') {
$this->addLogItem("-I- ".date("Ymd-H:i:s")." putFile\n".
"$parid, $name, $mediaFileLP, $file, {$this->sessid}, $gunid, $type \n"
@ -285,21 +316,25 @@ class Restore {
}
}
$ac = $r = StoredFile::recallByGunid($this->gb, $gunid);
if (PEAR::isError($r)) { return $r; }
if (PEAR::isError($r)) {
return $r;
}
$res = $r = $ac->setState('ready');
if (PEAR::isError($r)) { return $r; }
if (PEAR::isError($r)) {
return $r;
}
return true;
}
/**
* Figure out the enviroment to the backup
* Figure out the environment to the backup.
*
*/
function setEnviroment() {
if ($this->loglevel=='debug') {
$this->addLogItem("-I- ".date("Ymd-H:i:s")." setEnviroment\n");
}
$this->statusFile = $this->gb->accessDir.'/'.$this->token.'.status';
$this->tmpDir = '/tmp/ls_restore/'.$this->token.'/';
$this->rMkDir($this->tmpDir);
@ -309,7 +344,8 @@ class Restore {
/**
* Add a line to the logfile.
*
* @param item : string - the new row of log file
* @param string $item
* the new row of log file
*/
function addLogItem($item) {
$f = fopen ($this->logFile,'a');
@ -320,35 +356,44 @@ class Restore {
//echo file_get_contents($this->logFile)."<BR><BR>\n\n";
}
/**
* Delete a directory recursive
*
* @param dirname : string - path of dir.
* @param string $dirname
* path of dir
*
* @return boolean : is success
* @return boolean
* is success
*/
function rRmDir($dirname) {
if(is_dir($dirname))
if (is_dir($dirname)) {
$dir_handle = opendir($dirname);
}
while ($file = readdir($dir_handle)) {
if ($file!="." && $file!="..") {
if(!is_dir($dirname."/".$file))
if (!is_dir($dirname."/".$file)) {
unlink ($dirname."/".$file);
else
} else {
Restore::rRmDir($dirname."/".$file);
}
}
}
closedir($dir_handle);
rmdir($dirname);
return true;
}
/**
* Create a directory recursive
*
* @param dirname : string - path of dir.
* @param mode : octal - rights of dir.
* @param recursive : boolean - do it recursive.
* @param string $dirname
* path of dir.
* @param int $mode
* octal - rights of dir.
* @param boolean $recursive
* do it recursive.
*
* @return boolean
*/
@ -364,5 +409,6 @@ class Restore {
}
return false;
}
}
} // class Restore
?>

View File

@ -1,33 +1,4 @@
<?
/*------------------------------------------------------------------------------
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: tomash $
Version : $Revision: 1848 $
Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/storageServer/var/AccessRecur.php $
------------------------------------------------------------------------------*/
define('INDCH', ' ');
require_once "XmlParser.php";
@ -35,35 +6,51 @@ require_once "XmlParser.php";
/**
* SmilPlaylist class
*
* @author $Author: tomash $
* @version $Revision: 1848 $
* @package Campcaster
* @subpackage StorageServer
*/
class SmilPlaylist {
/**
* Parse SMIL file or string
*
* @param data string, local path to SMIL file or SMIL string
* @param loc string, location: 'file'|'string'
* @return array reference, parse result tree (or PEAR::error)
* @param string $data
* local path to SMIL file or SMIL string
* @param string $loc
* location: 'file'|'string'
* @return array
* reference, parse result tree (or PEAR::error)
*/
function &parse($data='', $loc='file')
{
return XmlParser::parse($data, $loc);
}
/**
* Import SMIL file to storage
*
* @param gb reference to GreenBox object
* @param aPath string, absolute path part of imported file
* (e.g. /home/user/livesupport)
* @param rPath string, relative path/filename part of imported file
* @param GreenBox $gb
* reference to GreenBox object
* @param string $aPath
* absolute path part of imported file (e.g. /home/user/campcaster)
* @param string $rPath
* relative path/filename part of imported file
* (e.g. playlists/playlist_1.smil)
* @param gunids hasharray, hash relation from filenames to gunids
* @param plid string, playlist gunid
* @param parid int, destination folder local id
* @param subjid int, local subject (user) id (id of user doing the import)
* @return instance of Playlist object
* @param array $gunids
* hash relation from filenames to gunids
* @param string $plid
* playlist gunid
* @param int $parid
* destination folder local id
* @param int $subjid
* local subject (user) id (id of user doing the import)
* @return Playlist
*/
function &import(&$gb, $aPath, $rPath, &$gunids, $plid, $parid, $subjid=NULL){
function &import(&$gb, $aPath, $rPath, &$gunids, $plid, $parid, $subjid=NULL)
{
$parr = compact('parid', 'subjid', 'aPath', 'plid', 'rPath');
$path = realpath("$aPath/$rPath");
if (FALSE === $path) {
@ -73,32 +60,50 @@ class SmilPlaylist {
}
$lspl = $r = SmilPlaylist::convert2lspl(
$gb, $path, $gunids, $parr);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
require_once "Playlist.php";
$pl =& Playlist::create($gb, $plid, "imported_SMIL", $parid);
if(PEAR::isError($pl)) return $pl;
$r = $pl->lock($gb, $subjid);
if(PEAR::isError($r)) return $r;
$r = $pl->replaceMetaData($lspl, 'string', 'playlist');
if(PEAR::isError($r)){ return $r; }
$r = $pl->unLock($gb);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($pl)) {
return $pl;
}
$r = $pl->lock($gb, $subjid);
if (PEAR::isError($r)) {
return $r;
}
$r = $pl->replaceMetaData($lspl, 'string', 'playlist');
if (PEAR::isError($r)) {
return $r;
}
$r = $pl->unLock($gb);
if (PEAR::isError($r)) {
return $r;
}
return $pl;
}
/**
* Import SMIL file to storage
*
* @param gb reference to GreenBox object
* @param data string, local path to SMIL file
* @param gunids hasharray, hash relation from filenames to gunids
* @param parr hasharray, of parid, subjid, aPath, plid, rPath
* @return XML string - playlist in Livesupport playlist format
* @param GreenBox $gb
* @param string $data
* local path to SMIL file
* @param hasharray $gunids
* hash relation from filenames to gunids
* @param array $parr
* array of parid, subjid, aPath, plid, rPath
* @return string
* XML of playlist in Campcaster playlist format
*/
function convert2lspl(&$gb, $data, &$gunids, $parr){
function convert2lspl(&$gb, $data, &$gunids, $parr)
{
extract($parr);
$tree = $r = SmilPlaylist::parse($data);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
if ($tree->name != 'smil') {
return PEAR::raiseError("SmilPlaylist::parse: smil tag expected");
}
@ -112,13 +117,17 @@ class SmilPlaylist {
$gb, $tree->children[0], &$gunids, $parr);
return $res;
}
}
} // SmilPlaylist
/**
* Several auxiliary classes follows
*/
class SmilPlaylistBodyElement {
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind=''){
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
$ind2 = $ind.INDCH;
if ($tree->name != 'body') {
@ -132,7 +141,9 @@ class SmilPlaylistBodyElement{
}
$res = $r = SmilPlaylistParElement::convert2lspl(
$gb, $tree->children[0], &$gunids, $parr, $ind2);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$title = basename($rPath);
$playlength = '0';
$res = "$ind<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n".
@ -142,10 +153,14 @@ class SmilPlaylistBodyElement{
"$ind</playlist>\n";
return $res;
}
}
} // class SmilPlaylistBodyElement
class SmilPlaylistParElement {
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind=''){
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
if ($tree->name != 'par') {
return PEAR::raiseError("SmilPlaylist::parse: par tag expected");
@ -155,7 +170,9 @@ class SmilPlaylistParElement{
$ch =& $tree->children[$i];
$r = SmilPlaylistAudioElement::convert2lspl(
$gb, $ch, &$gunids, $parr, $ind.INDCH);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$res .= $r;
}
return $res;
@ -163,7 +180,8 @@ class SmilPlaylistParElement{
}
class SmilPlaylistAudioElement {
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind=''){
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
$uri = $tree->attrs['src']->val;
$gunid = ( isset($gunids[basename($uri)]) ? $gunids[basename($uri)] : NULL);
@ -182,7 +200,9 @@ class SmilPlaylistAudioElement{
$ch =& $tree->children[$i];
$r = SmilPlaylistAnimateElement::convert2lspl(
$gb, $ch, &$gunids, $parr, $ind2);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
switch ($r['type']) {
case "fadeIn": $fadeIn = $r['val']; break;
case "fadeOut": $fadeOut = $r['val']; break;
@ -193,7 +213,9 @@ class SmilPlaylistAudioElement{
$fadeIn = Playlist::_secsToPlTime($fadeIn);
$fadeOut = Playlist::_secsToPlTime($fadeOut);
$fInfo = "$ind2<fadeInfo id=\"$fiGunid\" fadeIn=\"$fadeIn\" fadeOut=\"$fadeOut\"/>\n";
}else $fInfo = '';
} else {
$fInfo = '';
}
$plElGunid = StoredFile::_createGunid();
$acGunid = $gunid;
$type = 'audioClip';
@ -206,19 +228,23 @@ class SmilPlaylistAudioElement{
$type = 'playlist';
$acId = $r = $gb->bsImportPlaylistRaw($parid, $gunid,
$aPath, $uri, $ext, $gunids, $subjid);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
//break;
default:
$ac = $r = StoredFile::recallByGunid($gb, $gunid);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$r = $ac->md->getMetadataEl('dcterms:extent');
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
$playlength = $r[0]['value'];
}
}
$title = basename($tree->attrs['src']->val);
$offset = Playlist::_secsToPlTime($tree->attrs['begin']->val);
$res = "$ind<playlistElement id=\"$plElGunid\" relativeOffset=\"$offset\">\n".
@ -227,10 +253,13 @@ class SmilPlaylistAudioElement{
"$ind</playlistElement>\n";
return $res;
}
}
} // class SmilPlaylistAudioElement
class SmilPlaylistAnimateElement {
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind=''){
function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
if ($tree->name != 'animate') {
return PEAR::raiseError("SmilPlaylist::parse: animate tag expected");
@ -259,6 +288,6 @@ class SmilPlaylistAnimateElement{
"SmilPlaylistAnimateElement::convert2lspl: animate parameters too general"
);
}
}
} // class SmilPlaylistAnimateElement
?>

View File

@ -1,32 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
require_once "RawMediaData.php";
require_once "MetaData.php";
require_once dirname(__FILE__)."/../../getid3/var/getid3.php";
@ -34,13 +6,18 @@ require_once dirname(__FILE__)."/../../getid3/var/getid3.php";
/**
* StoredFile class
*
* LiveSupport file storage support class.<br>
* Campcaster file storage support class.<br>
* Represents one virtual file in storage. Virtual file has up to two parts:
* <ul>
* <li>metada in database - represented by MetaData class</li>
* <li>binary media data in real file
* - represented by RawMediaData class</li>
* </ul>
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
* @see GreenBox
* @see MetaData
* @see RawMediaData
@ -50,8 +27,9 @@ class StoredFile {
/**
* Constructor, but shouldn't be externally called
*
* @param reference $gb to GreenBox object
* @param string $gunid, optional, globally unique id of file
* @param GreenBox $gb
* @param string $gunid
* optional, globally unique id of file
* @return this
*/
function StoredFile(&$gb, $gunid=NULL)
@ -76,16 +54,24 @@ class StoredFile {
/**
* Create instance of StoredFile object and insert new file
*
* @param reference $gb to GreenBox object
* @param int $oid, local object id in the tree
* @param string $name, name of new file
* @param string $mediaFileLP, local path to media file
* @param string $metadata, local path to metadata XML file or XML string
* @param string $mdataLoc 'file'|'string' (optional)
* @param global $gunid unique id (optional) - for insert file with gunid
* @param string $ftype, internal file type
* @param string $className, class to be constructed (opt.)
* @return instance of StoredFile object
* @param GreenBox $gb
* @param int $oid
* local object id in the tree
* @param string $name
* name of new file
* @param string $mediaFileLP
* local path to media file
* @param string $metadata
* local path to metadata XML file or XML string
* @param string $mdataLoc
* 'file'|'string' (optional)
* @param global $gunid
* unique id (optional) - for insert file with gunid
* @param string $ftype
* internal file type
* @param string $className
* class to be constructed (opt.)
* @return StoredFile
*/
function &insert(&$gb, $oid, $name,
$mediaFileLP='', $metadata='', $mdataLoc='file',
@ -174,11 +160,14 @@ class StoredFile {
* Create instance of StoreFile object and recall existing file.<br>
* Should be supplied oid XOR gunid - not both ;)
*
* @param reference $gb to GreenBox object
* @param int $oid, optional, local object id in the tree
* @param string $gunid, optional, global unique id of file
* @param string $className, optional classname to recall
* @return instance of StoredFile object
* @param GreenBox $gb
* @param int $oid
* optional, local object id in the tree
* @param string $gunid
* optional, global unique id of file
* @param string $className
* optional classname to recall
* @return StoredFile
*/
function &recall(&$gb, $oid='', $gunid='', $className='StoredFile')
{
@ -211,12 +200,14 @@ class StoredFile {
/**
* Create instance of StoreFile object and recall existing file
* by gunid.<br/>
* by gunid.
*
* @param reference $gb to GreenBox object
* @param string $gunid, optional, global unique id of file
* @param string $className, optional classname to recall
* @return instance of StoredFile object
* @param GreenBox $gb
* @param string $gunid
* optional, global unique id of file
* @param string $className
* optional classname to recall
* @return StoredFile
*/
function &recallByGunid(&$gb, $gunid='', $className='StoredFile')
{
@ -226,12 +217,14 @@ class StoredFile {
/**
* Create instance of StoreFile object and recall existing file
* by access token.<br/>
* by access token.
*
* @param reference $gb to GreenBox object
* @param string $token, access token
* @param string $className, optional classname to recall
* @return instance of StoredFile object
* @param GreenBox $gb
* @param string $token
* access token
* @param string $className
* optional classname to recall
* @return StoredFile
*/
function recallByToken(&$gb, $token, $className='StoredFile')
{
@ -256,7 +249,9 @@ class StoredFile {
* Create instance of StoredFile object and make copy of existing file
*
* @param reference $src to source object
* @param int $nid, new local id
* @param int $nid
* new local id
* @return unknown
*/
function &copyOf(&$src, $nid)
{
@ -276,11 +271,16 @@ class StoredFile {
/**
* Replace existing file with new data
*
* @param int $oid, local id
* @param string $name, name of file
* @param string $mediaFileLP, local path to media file
* @param string $metadata, local path to metadata XML file or XML string
* @param string $mdataLoc 'file'|'string'
* @param int $oid
* local id
* @param string $name
* name of file
* @param string $mediaFileLP
* local path to media file
* @param string $metadata
* local path to metadata XML file or XML string
* @param string $mdataLoc
* 'file'|'string'
*/
function replace($oid, $name, $mediaFileLP='', $metadata='',
$mdataLoc='file')
@ -322,8 +322,10 @@ class StoredFile {
* Increase access counter, create access token, insert access record,
* call access method of RawMediaData
*
* @param int $parent parent token
* @return array with: access URL, access token
* @param int $parent
* parent token
* @return array
* array with: access URL, access token
*/
function accessRawMediaData($parent='0')
{
@ -343,7 +345,8 @@ class StoredFile {
* Decrease access couter, delete access record,
* call release method of RawMediaData
*
* @param string $token, access token
* @param string $token
* access token
* @return boolean
*/
function releaseRawMediaData($token)
@ -359,7 +362,8 @@ class StoredFile {
/**
* Replace media file only with new binary file
*
* @param string $mediaFileLP, local path to media file
* @param string $mediaFileLP
* local path to media file
*/
function replaceRawMediaData($mediaFileLP)
{
@ -384,9 +388,12 @@ class StoredFile {
/**
* Replace metadata with new XML file
*
* @param string $metadata, local path to metadata XML file or XML string
* @param string $mdataLoc 'file'|'string'
* @param string $format, metadata format for validation
* @param string $metadata
* local path to metadata XML file or XML string
* @param string $mdataLoc
* 'file'|'string'
* @param string $format
* metadata format for validation
* ('audioclip' | 'playlist' | 'webstream' | NULL)
* (NULL = no validation)
* @return boolean
@ -443,7 +450,8 @@ class StoredFile {
* Rename stored virtual file
*
* @param string $newname
* @return true or PEAR::error
* @return mixed
* true or PEAR::error
*/
function rename($newname)
{
@ -462,8 +470,10 @@ class StoredFile {
/**
* Set state of virtual file
*
* @param string $state, 'empty'|'incomplete'|'ready'|'edited'
* @param int $editedby, user id | 'NULL' for clear editedBy field
* @param string $state
* 'empty'|'incomplete'|'ready'|'edited'
* @param int $editedby
* user id | 'NULL' for clear editedBy field
* (optional)
* @return boolean or error
*/
@ -486,7 +496,8 @@ class StoredFile {
/**
* Set mime-type of virtual file
*
* @param string $mime, mime-type
* @param string $mime
* mime-type
* @return boolean or error
*/
function setMime($mime)
@ -553,7 +564,8 @@ class StoredFile {
* Returns true if virtual file is accessed.<br>
* Static or dynamic call is possible.
*
* @param string $gunid, optional (for static call), global unique id
* @param string $gunid
* optional (for static call), global unique id
*/
function isAccessed($gunid=NULL)
{
@ -577,7 +589,8 @@ class StoredFile {
/**
* Returns true if virtual file is edited
*
* @param string $playlistId, playlist global unique ID
* @param string $playlistId
* playlist global unique ID
* @return boolean
*/
function isEdited($playlistId=NULL)
@ -596,8 +609,10 @@ class StoredFile {
/**
* Returns id of user editing playlist
*
* @param string $playlistId, playlist global unique ID
* @return null or int, id of user editing it
* @param string $playlistId
* playlist global unique ID
* @return null or int
* id of user editing it
*/
function isEditedBy($playlistId=NULL)
{
@ -660,7 +675,7 @@ class StoredFile {
{
$ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '');
$initString =
microtime().$ip.rand()."org.mdlf.livesupport";
microtime().$ip.rand()."org.mdlf.campcaster";
$hash = md5($initString);
// non-negative int8
$hsd = substr($hash, 0, 1);
@ -683,8 +698,8 @@ class StoredFile {
* Get local id from global id.
* Static or dynamic call is possible.
*
* @param string $gunid, optional (for static call),
* global unique id of file
* @param string $gunid
* optional (for static call), global unique id of file
*/
function _idFromGunid($gunid=NULL)
{
@ -705,10 +720,12 @@ class StoredFile {
/**
* Return suitable extension.<br>
* <b>TODO: make it general - is any tool for it?</b>
* Return suitable extension.
*
* @return string file extension without a dot
* @todo make it general - is any tool for it?
*
* @return string
* file extension without a dot
*/
function _getExt()
{
@ -743,8 +760,10 @@ class StoredFile {
/**
* Get mime-type from global id
*
* @param string $gunid, optional, global unique id of file
* @return string, mime-type
* @param string $gunid
* optional, global unique id of file
* @return string
* mime-type
*/
function _getMime($gunid=NULL)
{
@ -761,8 +780,10 @@ class StoredFile {
/**
* Get storage-internal file state
*
* @param string $gunid, optional, global unique id of file
* @return string, see install()
* @param string $gunid
* optional, global unique id of file
* @return string
* see install()
*/
function _getState($gunid=NULL)
{
@ -779,8 +800,10 @@ class StoredFile {
/**
* Get mnemonic file name
*
* @param string $gunid, optional, global unique id of file
* @return string, see install()
* @param string $gunid
* optional, global unique id of file
* @return string
* see install()
*/
function _getFileName($gunid=NULL)
{
@ -835,9 +858,9 @@ class StoredFile {
/**
* Create and return name for temporary symlink.<br>
* <b>TODO: Should be more unique</b>
* Create and return name for temporary symlink.
*
* @todo Should be more unique
*/
function _getAccessFname($token, $ext='EXT')
{

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +1,15 @@
<?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: tomash $
Version : $Revision: 1946 $
Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/src/modules/storageServer/var/Transport.php $
------------------------------------------------------------------------------*/
define('TR_LEAVE_CLOSED', TRUE);
/**
* Auxiliary class for ransport records
* Auxiliary class for transport records
*
**/
* @author $Author: tomash $
* @version $Revision: 1946 $
* @package Campcaster
* @subpackage StorageServer
*/
class TransportRecord
{
var $dbc;
@ -42,7 +19,7 @@ class TransportRecord
/**
* Constructor
*
* @param tr Transport object reference
* @param Transport $tr object reference
* @return TransportRecord object instance
*/
function TransportRecord(&$tr)
@ -54,14 +31,18 @@ class TransportRecord
$this->transTable = $tr->gb->config['tblNamePrefix'].'trans';
}
/**
* Factory method
*
* @param tr: Transport object reference
* @param trtype: string transport type (see Transport::install)
* @param direction: string - 'up' | 'down'
* @param defaults: array - default parameters (optional, internal use)
* @return TransportRecord instance
* @param Transport $tr
* @param string $trtype
* transport type (see Transport::install)
* @param string $direction
* 'up' | 'down'
* @param array $defaults
* default parameters (optional, internal use)
* @return TransportRecord
*/
function create(&$tr, $trtype, $direction='up', $defaults=array())
{
@ -72,7 +53,9 @@ class TransportRecord
$trec->recalled = TRUE;
if (!isset($defaults['title'])) {
$defaults['title'] = $r = $trec->getTitle();
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
}
$id = $trec->dbc->nextId("{$trec->transTable}_id_seq");
$names = "id, trtok, direction, state, trtype, start, ts";
@ -88,16 +71,20 @@ class TransportRecord
VALUES
($values)
");
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
return $trec;
}
/**
* Recall transport record from DB
*
* @param tr: Transport object reference
* @param trtok: string - transport token
* @return TransportRecord instance
* @param Transport $tr
* @param string $trtok
* transport token
* @return TransportRecord
*/
function recall(&$tr, $trtok)
{
@ -113,7 +100,9 @@ class TransportRecord
FROM {$trec->transTable}
WHERE trtok='$trtok'
");
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
if (is_null($row)) {
return PEAR::raiseError("TransportRecord::recall:".
" invalid transport token ($trtok)", TRERR_TOK
@ -126,13 +115,17 @@ class TransportRecord
return $trec;
}
/**
* Set state of transport record
*
* @param newState: string
* @param data: array - other data fields to set
* @param oldState: string, (opt.) check old state and do nothing if differ
* @param lock: boolean, (opt.) check lock and do nothing if differ
* @param string $newState
* @param array $data
* other data fields to set
* @param string $oldState
* (opt.) check old state and do nothing if differ
* @param boolean $lock
* (opt.) check lock and do nothing if differ
* @return boolean success
*/
function setState($newState, $data=array(), $oldState=NULL, $lock=NULL)
@ -154,17 +147,23 @@ class TransportRecord
(is_null($oldState) ? '' : " AND state='$oldState'").
(is_null($lock) ? '' : " AND lock = '$slock'")
);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
// return TRUE;
$affRows = $r = $this->dbc->affectedRows();
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return ($affRows == 1);
}
/**
* Return state of transport record
*
* @return string - state
* @return string
* state
*/
function getState()
{
@ -176,15 +175,20 @@ class TransportRecord
return $this->row['state'];
}
/**
* Set lock on transport record
*
* @param lock: boolean - lock if true, release lock if false
* @return boolean true or error
* @param boolean $lock
* lock if true, release lock if false
* @return mixed
* true or error
*/
function setLock($lock)
{
if($this->dropped) return TRUE;
if ($this->dropped) {
return TRUE;
}
$slock = ($lock ? 'Y' : 'N');
$nlock = (!$lock);
$snlock = ($nlock ? 'Y' : 'N');
@ -193,9 +197,13 @@ class TransportRecord
SET lock='$slock', ts=now()
WHERE trtok='{$this->trtok}' AND lock = '$snlock'"
);
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
$affRows = $r = $this->dbc->affectedRows();
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
if ($affRows != 1) {
$ltxt = ($lock ? 'lock' : 'unlock' );
return PEAR::raiseError(
@ -205,10 +213,12 @@ class TransportRecord
return TRUE;
}
/**
* Return type of transport
*
* @return string - trtype
* @return string
* Transport type
*/
function getTransportType()
{
@ -220,12 +230,16 @@ class TransportRecord
return $this->row['trtype'];
}
/**
* Set state to failed and set error message in transport record
*
* @param txt: string - base part of error message
* @param eo: PEAR error object - (opt.) error msg can be construct from it
* @return boolean true or error
* @param string $txt
* base part of error message
* @param PEAR_Error $eo
* (opt.) error msg can be construct from it
* @return mixed
* boolean true or error
*/
function fail($txt='', $eo=NULL)
{
@ -240,14 +254,18 @@ class TransportRecord
" [".$eo->getCode()."]";
}
$r = $this->setState('failed', array('errmsg'=>$msg));
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
return TRUE;
}
/**
* Close transport record
*
* @return boolean true or error
* @return mixed
* boolean true or error
*/
function close()
{
@ -258,24 +276,31 @@ class TransportRecord
}
if (TR_LEAVE_CLOSED) {
$r = $this->setState('closed');
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
} else {
$r = $this->dbc->query("
DELETE FROM {$this->transTable}
WHERE trtok='{$this->trtok}'
");
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
$this->recalled = FALSE;
$this->dropped = TRUE;
}
return TRUE;
}
/**
* Add field specific envelopes to values (e.g. ' around strings)
*
* @param fldName: string - field name
* @param fldVal: mixed - field value
* @param string $fldName
* field name
* @param mixed $fldVal
* field value
* @return string
*/
function _getSqlVal($fldName, $fldVal)
@ -296,16 +321,20 @@ class TransportRecord
}
}
/**
* Get title from transported object's metadata (if exists)
*
* @return string - the title or descriptive string
* @return string
* the title or descriptive string
*/
function getTitle()
{
$defStr = 'unknown';
$trtype = $r = $this->getTransportType(); //contains recall check
if(PEAR::isError($r)){ return $r; }
if (PEAR::isError($r)) {
return $r;
}
switch ($trtype) {
case "audioclip":
case "playlist":
@ -313,8 +342,11 @@ class TransportRecord
case "metadata":
$title = $r = $this->gb->bsGetTitle(NULL, $this->row['gunid']);
if (PEAR::isError($r)) {
if($r->getCode()==GBERR_FOBJNEX) $title = $defStr;
else return $r;
if ($r->getCode()==GBERR_FOBJNEX) {
$title = $defStr;
} else {
return $r;
}
}
break;
case "searchjob":
@ -324,10 +356,11 @@ class TransportRecord
$title = ( isset($this->row['localfile']) ?
basename($this->row['localfile']) : 'regular file');
break;
default: $title = $defStr;
default:
$title = $defStr;
}
return $title;
}
}
} // class TransportRecord
?>

View File

@ -1,32 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
define('VAL_ROOT', 110);
define('VAL_NOREQE', 111);
define('VAL_NOONEOF', 112);
@ -50,6 +22,11 @@ define('VAL_PREDXML', 121);
* <li>playlistFormat.php</li>
* </ul>
* It probably should be replaced by XML schema validation in the future.
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
*/
class Validator {
/**
@ -64,12 +41,15 @@ class Validator{
* string - gunid of validated file for identification in mass input
*/
var $gunid = NULL;
/**
* Constructor
*
* @param format string - format type of validated document
* @param gunid string - gunid of validated file for identification
* in mass input
* @param string $format
* format type of validated document
* @param string $gunid
* gunid of validated file for identification in mass input
*/
function Validator($format, $gunid)
{
@ -81,19 +61,26 @@ class Validator{
'playlist' => "playlistFormat",
'webstream' => "webstreamFormat",
);
if(!isset($formats[$format])) return $this->_err(VAL_FORMAT);
if (!isset($formats[$format])) {
return $this->_err(VAL_FORMAT);
}
$formatName = $formats[$format];
$formatFile = dirname(__FILE__)."/$formatName.php";
if(!file_exists($formatFile)) return $this->_err(VAL_FORMAT);
if (!file_exists($formatFile)) {
return $this->_err(VAL_FORMAT);
}
require $formatFile;
$this->formTree = $$formatName;
}
/**
* Validate document - only wrapper for validateNode method
*
* @param data object, validated object tree
* @return TRUE or PEAR::error
* @param object $data
* validated object tree
* @return mixed
* TRUE or PEAR::error
*/
function validate(&$data)
{
@ -101,26 +88,34 @@ class Validator{
return $r;
}
/**
* Validate one metadata value (on insert/update)
*
* @param fname string - parent element name
* @param category string - qualif.category name
* @param predxml string - 'A' | 'T' (attr or tag)
* @param value string - validated element value
* @return TRUE or PEAR::error
* @param string $fname
* parent element name
* @param string $category
* qualif.category name
* @param string $predxml
* 'A' | 'T' (attr or tag)
* @param string $value
* validated element value
* @return mixed
* TRUE or PEAR::error
*/
function validateOneValue($fname, $category, $predxml, $value)
{
$formTree =& $this->formTree;
switch ($predxml) {
case 'T':
if(!$this->isChildInFormat($fname, $category))
if (!$this->isChildInFormat($fname, $category)) {
return $this->_err(VAL_UNKNOWNE, "$category in $fname");
}
break;
case 'A':
if(!$this->isAttrInFormat($fname, $category))
if (!$this->isAttrInFormat($fname, $category)) {
return $this->_err(VAL_UNKNOWNA, "$category in $fname");
}
break;
case 'N':
return TRUE;
@ -130,49 +125,68 @@ class Validator{
}
if (isset($formTree[$category]['regexp'])) {
// echo "XXX {$formTree[$fname]['regexp']} / ".$node->content."\n";
if(!preg_match("|{$formTree[$category]['regexp']}|", $value))
if (!preg_match("|{$formTree[$category]['regexp']}|", $value)) {
return $this->_err(VAL_CONTENT, "$category/$value");
}
}
}
/**
* Validation of one element node from object tree
*
* @param node object - validated node
* @param fname string - aktual name in format structure
* @return TRUE or PEAR::error
* @param object $node
* validated node
* @param string $fname
* actual name in format structure
* @return mixed
* TRUE or PEAR::error
*/
function validateNode(&$node, $fname)
{
$dname = (($node->ns? $node->ns.":" : '').$node->name);
$formTree =& $this->formTree;
if(DEBUG) echo"\nVAL::validateNode: 1 $dname/$fname\n";
if (DEBUG) {
echo"\nVAL::validateNode: 1 $dname/$fname\n";
}
// check root node name:
if($dname != $fname) return $this->_err(VAL_ROOT, $fname);
if ($dname != $fname) {
return $this->_err(VAL_ROOT, $fname);
}
// check if this element is defined in format:
if(!isset($formTree[$fname])) return $this->_err(VAL_NOTDEF, $fname);
if (!isset($formTree[$fname])) {
return $this->_err(VAL_NOTDEF, $fname);
}
// check element content
if (isset($formTree[$fname]['regexp'])) {
// echo "XXX {$formTree[$fname]['regexp']} / ".$node->content."\n";
if(!preg_match("|{$formTree[$fname]['regexp']}|", $node->content))
if (!preg_match("|{$formTree[$fname]['regexp']}|", $node->content)) {
return $this->_err(VAL_CONTENT, "$fname/{$node->content}");
}
}
// validate attributes:
$ra = $this->validateAttributes($node, $fname);
if(PEAR::isError($ra)) return $ra;
if (PEAR::isError($ra)) {
return $ra;
}
// validate children:
$r = $this->validateChildren($node, $fname);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
return TRUE;
}
/**
* Validation of attributes
*
* @param node object - validated node
* @param fname string - aktual name in format structure
* @return TRUE or PEAR::error
* @param object $node
* validated node
* @param string $fname
* actual name in format structure
* @return mixed
* TRUE or PEAR::error
*/
function validateAttributes(&$node, $fname)
{
@ -182,35 +196,42 @@ class Validator{
foreach ($node->attrs as $i => $attr) {
$aname = (($attr->ns? $attr->ns.":" : '').$attr->name);
$attrs[$aname] =& $node->attrs[$i];
if(!$this->isAttrInFormat($fname, $aname))
if (!$this->isAttrInFormat($fname, $aname)) {
return $this->_err(VAL_UNKNOWNA, $aname);
}
// check attribute format
// echo "XXA $aname\n";
if (isset($formTree[$aname]['regexp'])) {
// echo "XAR {$formTree[$fname]['regexp']} / ".$node->content."\n";
if(!preg_match("|{$formTree[$aname]['regexp']}|", $attr->val))
if (!preg_match("|{$formTree[$aname]['regexp']}|", $attr->val)) {
return $this->_err(VAL_ATTRIB, "$aname [".var_export($attr->val,TRUE)."]");
}
}
}
// check if all required attrs are here:
if (isset($formTree[$fname]['attrs'])) {
$fattrs =& $formTree[$fname]['attrs'];
if (isset($fattrs['required'])) {
foreach ($fattrs['required'] as $i => $attr) {
if(!isset($attrs[$attr]))
if (!isset($attrs[$attr])) {
return $this->_err(VAL_NOREQA, $attr);
}
}
}
}
return TRUE;
}
/**
* Validation children nodes
*
* @param node object - validated node
* @param fname string - aktual name in format structure
* @return TRUE or PEAR::error
* @param object $node
* validated node
* @param string $fname
* actual name in format structure
* @return mixed
* TRUE or PEAR::error
*/
function validateChildren(&$node, $fname)
{
@ -220,11 +241,14 @@ class Validator{
foreach ($node->children as $i => $ch) {
$chname = (($ch->ns? $ch->ns.":" : '').$ch->name);
// echo "XXE $chname\n";
if(!$this->isChildInFormat($fname, $chname))
if (!$this->isChildInFormat($fname, $chname)) {
return $this->_err(VAL_UNKNOWNE, $chname);
}
// call children recursive:
$r = $this->validateNode($node->children[$i], $chname);
if(PEAR::isError($r)) return $r;
if (PEAR::isError($r)) {
return $r;
}
$childs[$chname] = TRUE;
}
// check if all required children are here:
@ -240,22 +264,28 @@ class Validator{
$one = FALSE;
foreach ($fchilds['oneof'] as $i => $ch) {
if (isset($childs[$ch])) {
if($one) return $this->_err(
VAL_UNEXPONEOF, "$ch in $fname");
if ($one) {
return $this->_err(VAL_UNEXPONEOF, "$ch in $fname");
}
$one = TRUE;
}
}
if(!$one) return $this->_err(VAL_NOONEOF);
if (!$one) {
return $this->_err(VAL_NOONEOF);
}
}
}
return TRUE;
}
/**
* Test if child is presented in format structure
*
* @param fname string - node name in format structure
* @param chname string - child node name
* @param string $fname
* node name in format structure
* @param string $chname
* child node name
* @return boolean
*/
function isChildInFormat($fname, $chname)
@ -266,11 +296,14 @@ class Validator{
return ($listo!==FALSE || $listr!==FALSE || $list1!==FALSE);
}
/**
* Test if attribute is presented in format structure
*
* @param fname string - node name in format structure
* @param aname string - attribute name
* @param string $fname
* node name in format structure
* @param string $aname
* attribute name
* @return boolean
*/
function isAttrInFormat($fname, $aname)
@ -281,17 +314,23 @@ class Validator{
return ($listr!==FALSE || $listi!==FALSE || $listn!==FALSE);
}
/**
* Check if node/attribute is presented in format structure
*
* @param fname string - node name in format structure
* @param chname string - node/attribute name
* @param nType string - 'childs' | 'attrs'
* @param reqType string - <ul>
* @param string $fname
* node name in format structure
* @param string $chname
* node/attribute name
* @param string $nType
* 'childs' | 'attrs'
* @param string $reqType
* <ul>
* <li>for elements: 'required' | 'optional' | 'oneof'</li>
* <li>for attributes: 'required' | 'implied' | 'normal'</li>
* </ul>
* @return boolean/int (index int format array returned if found)
* @return mixed
* boolean/int (index int format array returned if found)
*/
function isInFormatAs($fname, $chname, $nType='childs', $reqType='required')
{
@ -304,12 +343,15 @@ class Validator{
return $listed;
}
/**
* Error exception generator
*
* @param errno int - erron code
* @param par string - optional string for more descriptive error messages
* @return PEAR::error
* @param int $errno
* erron code
* @param string $par
* optional string for more descriptive error messages
* @return PEAR_Error
*/
function _err($errno, $par='')
{
@ -333,16 +375,7 @@ class Validator{
);
}
/**
*
*
* @param
* @return
* /
function ()
{
}
*/
}
} // class Validator
?>

View File

@ -1,38 +1,21 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
*/
require_once "XML/Util.php";
/* ================================================================== Element */
/**
* Object representation of one XML element
*
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
* @see MetaData
*/
class XmlElement {
@ -64,10 +47,14 @@ class XmlElement {
/**
* Constructor
*
* @param fullname string, fully qualified name of element
* @param attrs hash of attributes
* @param nSpaces hash of namespace definitions
* @param children hash of child nodes
* @param string $fullname
* Fully qualified name of element
* @param array $attrs
* hash of attributes
* @param array $nSpaces
* hash of namespace definitions
* @param array $children
* hash of child nodes
* @return this
*/
function XmlElement($fullname, $attrs, $nSpaces=array(), $children=array())
@ -79,12 +66,15 @@ class XmlElement {
$this->nSpaces = $nSpaces;
$this->children = $children;
}
}
} // class XmlElement
/* ================================================================ Attribute */
/**
* Object representation of one XML attribute
*
* @package Campcaster
* @subpackage StorageServer
* @see MetaData
*/
class XmlAttrib {
@ -103,9 +93,12 @@ class XmlAttrib {
/**
* Constructor
*
* @param atns string, namespace prefix
* @param atnm string, attribute name
* @param atv string, attribute value
* @param string $atns
* namespace prefix
* @param string $atnm
* attribute name
* @param string $atv
* attribute value
* @return this
*/
function XmlAttrib($atns, $atnm, $atv)
@ -114,12 +107,15 @@ class XmlAttrib {
$this->name = $atnm;
$this->val = $atv;
}
}
} // fn XmlAttrib
/* =================================================================== Parser */
/**
* XML parser object encapsulation
*
* @package Campcaster
* @subpackage StorageServer
* @see MetaData
*/
class XmlParser {
@ -135,10 +131,12 @@ class XmlParser {
* Error structure
*/
var $err = array(FALSE, '');
/**
* Constructor
*
* @param data string, XML string to be parsed
* @param string $data
* XML string to be parsed
* @return this
*/
function XmlParser($data){
@ -160,12 +158,16 @@ class XmlParser {
xml_parser_free($xml_parser);
}
/**
* Parse XML file or string
*
* @param data string, local path to XML file or XML string
* @param loc string, location: 'file'|'string'
* @return array reference, parse result tree (or PEAR::error)
* @param string $data
* local path to XML file or XML string
* @param string $loc
* location: 'file'|'string'
* @return array
* reference, parse result tree (or PEAR::error)
*/
function &parse($data='', $loc='file')
{
@ -203,9 +205,12 @@ class XmlParser {
/**
* Start tag handler
*
* @param parser resource, reference to parser resource
* @param fullname string element name
* @param attrs array of attributes
* @param resource $parser
* reference to parser resource
* @param string $fullname
* element name
* @param array $attrs
* array of attributes
* @return none
*/
function startTag($parser, $fullname, $attrs) {
@ -215,8 +220,9 @@ class XmlParser {
$atns = $a['namespace'];
$atnm = $a['localPart'];
unset($attrs[$atn]);
if($atns == 'xmlns') $nSpaces[$atnm] = $atv;
else if ($atns == NULL && $atnm == 'xmlns'){
if ($atns == 'xmlns') {
$nSpaces[$atnm] = $atv;
} else if ($atns == NULL && $atnm == 'xmlns') {
$nSpaces[''] = $atv;
} else {
$attrs[$atn] = new XmlAttrib($atns, $atnm, $atv);
@ -226,11 +232,14 @@ class XmlParser {
array_push($this->stack, $el);
}
/**
* End tag handler
*
* @param parser resource, reference to parser resource
* @param fullname string element name
* @param resource $parser
* reference to parser resource
* @param string $fullname
* element name
* @return none
*/
function endTag($parser, $fullname) {
@ -243,23 +252,29 @@ class XmlParser {
}
}
/**
* Character data handler
*
* @param parser resource, reference to parser resource
* @param data string
* @param resource $parser
* reference to parser resource
* @param string $data
* @return none
*/
function characterData($parser, $data) {
$cnt = count($this->stack);
if(trim($data)!=''){ $this->stack[$cnt-1]->content .= $data; }
if (trim($data)!='') {
$this->stack[$cnt-1]->content .= $data;
}
}
/**
* Default handler
*
* @param parser resource, reference to parser resource
* @param data string
* @param resource $parser
* reference to parser resource
* @param string $data
* @return none
*/
function defaultHandler($parser, $data)
@ -272,46 +287,58 @@ class XmlParser {
//}
}
/**
* Return result tree
*
* @return hash, tree structure
* @return array
* tree structure
*/
function getTree(){
function getTree()
{
return $this->tree;
}
/**
* Return error string
*
* @return boolean if error occured
*/
function isError(){
return $this->err[0];
}
/**
* Return error string
*
* @return string, error message
* @return boolean
* whether error occured
*/
function getError(){
function isError()
{
return $this->err[0];
}
/**
* Return error string
*
* @return string
* error message
*/
function getError()
{
return $this->err[1];
}
/* ----------------------------------- auxiliary methos for serialization */
/**
* Serialize metadata of one file
*
* @return string, serialized XML
*/
function serialize(){
function serialize()
{
$res = '<?xml version="1.0" encoding="utf-8"?>';
$res .= $this->serializeEl($this->tree);
$res .= "\n";
return $res;
}
/**
* Serialize one metadata element
*
@ -319,7 +346,8 @@ class XmlParser {
* @param lvl int, level for indentation
* @return string, serialized XML
*/
function serializeEl($el, $lvl=0){
function serializeEl($el, $lvl=0)
{
$ind = str_repeat(" ", $lvl);
$elNs = $el->ns;
$elName = $el->name;
@ -331,18 +359,22 @@ class XmlParser {
$res .= $this->serializeEl($ch, $lvl+1);
}
$res .= XML_Util::replaceEntities("{$el->content}");
if($haveCh) $res .= "\n{$ind}";
if ($haveCh) {
$res .= "\n{$ind}";
}
$res .= "</{$fullName}>";
return $res;
}
/* -------------------------------------------------------- debug methods */
/**
* Debug dump of tree
*
* @return hash, tree structure
*/
function dump(){
function dump()
{
var_dump($this->tree);
}

View File

@ -1,32 +1,9 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*
*/
$audioClipFormat = array(
'_root'=>'audioClip',

View File

@ -1,38 +1,12 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* \file conf.php
* storageServer configuration file
* StorageServer configuration file
*
* @author $Author$
* @version $Revision$
*/
define('LS_VERSION', '1.1');
define('PHP5', version_compare( phpversion(), "5.0.0", ">=" ));
@ -75,7 +49,7 @@ $config = array(
'password' => 'test',
'hostspec' => 'localhost',
'phptype' => 'pgsql',
'database' => 'LiveSupport-test',
'database' => 'Campcaster-test',
),
'tblNamePrefix' => 'ls_',
@ -96,13 +70,13 @@ $config = array(
'useTrash' => TRUE,
/* ==================================================== URL configuration */
'storageUrlPath' => '/livesupportStorageServer',
'storageUrlPath' => '/campcasterStorageServer',
'storageXMLRPC' => 'xmlrpc/xrLocStor.php',
'storageUrlHost' => 'localhost',
'storageUrlPort' => 80,
/* ================================================ archive configuration */
'archiveUrlPath' => '/livesupportArchiveServer',
'archiveUrlPath' => '/campcasterArchiveServer',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
'archiveUrlHost' => 'localhost',
'archiveUrlPort' => 80,
@ -154,7 +128,7 @@ $config['sysSubjs'] = array(
$old_ip = get_include_path();
set_include_path('.'.PATH_SEPARATOR.$config['pearPath'].PATH_SEPARATOR.$old_ip);
// see if a ~/.livesupport/storageServer.conf.php exists, and
// see if a ~/.campcaster/storageServer.conf.php exists, and
// overwrite the settings from there if any
$this_file = null;
@ -168,7 +142,7 @@ if(!is_null($this_file)){
$fileowner_array = posix_getpwuid($fileowner_id);
$fileowner_homedir = $fileowner_array['dir'];
$fileowner_name = $fileowner_array['name'];
$home_conf = $fileowner_homedir . '/.livesupport/storageServer.conf.php';
$home_conf = $fileowner_homedir . '/.campcaster/storageServer.conf.php';
if (file_exists($home_conf)) {
$default_config = $config;
$developer_name = $fileowner_name;

View File

@ -3,8 +3,8 @@ require_once (dirname(__FILE__).'/Crontab.php');
require_once (dirname(__FILE__).'/../conf.php');
/**
* This class can call a PHP function from crontab.
*
* Example:
* <pre>
* $cron = new Cron();
* $access = $cron->openCrontab('write');
* if ($access != 'write') {
@ -17,7 +17,9 @@ require_once (dirname(__FILE__).'/../conf.php');
* array('first','secound','third')
* );
* $cron->closeCrontab();
*
* </pre>
* @package Campcaster
* @subpackage StorageServer.Cron
*/
class Cron {
/**

View File

@ -1,8 +1,12 @@
<?php
/**
* Cron jobs handling abstract class
*
* @author $Author: $
* @version $Revision: $
* @package Campcaster
* @subpackage StorageServer.Cron
*/
class CronJob
{
/**
@ -13,10 +17,3 @@ class CronJob
}
}
?>

View File

@ -1,18 +1,19 @@
<?php
/**
* A class that interfaces with the crontab. (cjpa@audiophile.com)
*
* This class lets you manipulate the crontab. It lets you add delete update entries easily.
**/
define('CRON_COMMENT', 0);
define('CRON_ASSIGN', 1);
define('CRON_CMD', 2);
define('CRON_SPECIAL', 3);
define('CRON_EMPTY', 4);
/**
* A class that interfaces with the crontab. (cjpa@audiophile.com)
*
* This class lets you manipulate the crontab. It lets you add delete update entries easily.
* @author $Author: $
* @version $Revision: $
* @package Campcaster
* @subpackage StorageServer.Cron
*/
class Crontab
{
// {{{ properties

View File

@ -13,7 +13,9 @@ $gb =& new LocStor($dbc, $config);
$tr =& new Transport($gb);
list(, $trtok) = $_SERVER['argv'];
if(TR_LOG_LEVEL>1){ $tr->trLog("transportCronJob start ($trtok)"); }
if (TR_LOG_LEVEL>1) {
$tr->trLog("transportCronJob start ($trtok)");
}
// 4-pass on job:
$cnt = 4;
@ -30,6 +32,8 @@ for($i=0; $i<$cnt; $i++, sleep(1)){
#sleep(2);
}
if(TR_LOG_LEVEL>1){ $tr->trLog("transportCronJob end ($trtok)"); }
if (TR_LOG_LEVEL>1) {
$tr->trLog("transportCronJob end ($trtok)");
}
exit(0);
?>

View File

@ -1,32 +1,8 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*/
header ("location: html/");
exit;
/*

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This (web-callable) script returns group running httpd
*----------------------------------------------------------------------------*/

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns real dir of php scipts for debugging purposes
*----------------------------------------------------------------------------*/

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage root URL
*----------------------------------------------------------------------------*/

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* This script returns storage XMLRPC root URL
*----------------------------------------------------------------------------*/

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
header ("location: ../");
exit;
?>

View File

@ -1,32 +1,9 @@
<?php
/*------------------------------------------------------------------------------
/**
* @author $Author$
* @version $Revision$
*/
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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
// no remote execution
$arr = array_diff_assoc($_SERVER, $_ENV);
if(isset($arr["DOCUMENT_ROOT"]) && $arr["DOCUMENT_ROOT"] != ""){

View File

@ -1,32 +1,9 @@
<?php
/*------------------------------------------------------------------------------
/**
* @author $Author$
* @version $Revision$
*/
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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
// no remote execution
$arr = array_diff_assoc($_SERVER, $_ENV);
if(isset($arr["DOCUMENT_ROOT"]) && $arr["DOCUMENT_ROOT"] != ""){

View File

@ -1,32 +1,11 @@
<?php
/*------------------------------------------------------------------------------
/**
* @author $Author$
* @version $Revision$
* @package Campcaster
* @subpackage StorageServer
*/
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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
$playlistFormat = array(
'_root'=>'playlist',

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
header ("location: ../");
exit;
?>

View File

@ -1,32 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
header("Content-type: text/plain");
echo "\n# Transport test:\n";

View File

@ -1,32 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
header("Content-type: text/plain");
echo "\n#StorageServer storeWebstream test:\n";

View File

@ -1,32 +1,8 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*/
$webstreamFormat = array(
'_root'=>'audioClip',

View File

@ -1,44 +1,17 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
require_once dirname(__FILE__).'/../LocStor.php';
/**
* XML-RPC interface for LocStor class
* @author $Author$
* @version $Revision$
*
*/
class XR_LocStor extends LocStor{
/* ----------------------------------------------------------- getVersion */
/**
* Dummy method - only returns livesupport version
* Dummy method - only returns Campcaster version
*
* The XML-RPC name of this method is "locstor.getVersion".
*
@ -240,7 +213,7 @@ class XR_LocStor extends LocStor{
* (returned by subsequent storeAudioClipClose call)
* </li>
* <li> metadata : string - metadata XML string
* (as defined in LiveSupport::Core::AudioClip Class Reference,
* (as defined in Campcaster::Core::AudioClip Class Reference,
* examples are in storageServer/var/tests/*.xml)
* </li>
* <li> fname : string - human readable mnemonic file name

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
header ("location: xrLocStor.php");
exit;
?>

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* \file put.php
* Store PUT data as temporary file.
@ -53,6 +24,8 @@
* </ul>
*
* @see XR_LocStor
* @author : $Author$
* @version : $Revision$
*/
require_once dirname(__FILE__).'/../conf.php';

View File

@ -1,32 +1,8 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version $Revision$
*/
/* ================================================================= includes */
include_once dirname(__FILE__)."/../conf.php";
@ -405,7 +381,7 @@ class SchedulerPhpClient{
$serverPath =
"http://{$config["{$confPrefix}UrlHost"]}:{$config["{$confPrefix}UrlPort"]}".
"{$config["{$confPrefix}UrlPath"]}/{$config["{$confPrefix}XMLRPC"]}";
#$serverPath = "http://localhost:80/livesupportStorageServerCVS/xmlrpc/xrLocStor.php";
#$serverPath = "http://localhost:80/campcasterStorageServerCVS/xmlrpc/xrLocStor.php";
if($this->verbose) echo "serverPath: $serverPath\n";
$url = parse_url($serverPath);
$this->client = new XML_RPC_Client($url['path'], $url['host'], $url['port']);

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* \file simpleGet.php
* Returns stored media file identified by global unique ID.
@ -51,6 +22,8 @@
* <li> 404 - File not found</li>
* <li> 500 - Application error</li>
* </ul>
* @author $Author$
* @version $Revision$
*
*/

View File

@ -1,32 +1,8 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/**
* @author $Author$
* @version : $Revision$
*/
/* ====================================================== specific PHP config */
ini_set("mbstring.internal_encoding", 'UTF-8');

View File

@ -1,33 +1,4 @@
<?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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
require_once dirname(__FILE__).'/../conf.php';
include_once "XML/RPC.php";
include_once dirname(__FILE__)."/../conf.php";
@ -46,7 +17,7 @@ if($pars[0] == '-s'){
"{$config['storageUrlPath']}/{$config['storageXMLRPC']}";
}
#$serverPath = "http://localhost:80/livesupportStorageServerCVS/xmlrpc/xrLocStor.php";
#$serverPath = "http://localhost:80/campcasterStorageServerCVS/xmlrpc/xrLocStor.php";
$url = parse_url($serverPath);
$client = new XML_RPC_Client($url['path'], $url['host']);