Fixed whitespace to standard coding conventions.

This commit is contained in:
paul.baranowski 2010-11-18 14:39:03 -05:00
parent 52fe579ce4
commit 8014f94c58
35 changed files with 6072 additions and 6070 deletions

View File

@ -136,7 +136,7 @@ class AccessRecur {
}
return $r;
case "playlist":
// if(empty($ac['children'])){
// if(empty($ac['children'])){
$r = $this->accessPlaylist($this->ls, $this->sessid,
$ac['attrs']['id'], $parent);
if (PEAR::isError($r)) {
@ -158,7 +158,7 @@ class AccessRecur {
}
}
return $r;
/*
/*
}else{
$r = $this->processPlaylist($ac, $parent);
if(PEAR::isError($r)) return $r;
@ -172,7 +172,7 @@ class AccessRecur {
);
return $res;
}
*/
*/
break;
default:
}

View File

@ -97,18 +97,18 @@ class Alib {
* @param string $sessid
* @return TRUE|PEAR_Error
*/
// public function setAuthToken($sessid)
// {
// $r = $this->checkAuthToken($sessid);
// if (PEAR::isError($r)) {
// return $r;
// }
// if (!$r) {
// return PEAR::raiseError("ALib::setAuthToken: invalid token ($sessid)");
// }
// //$this->sessid = $sessid;
// return TRUE;
// } // fn setAuthToken
// public function setAuthToken($sessid)
// {
// $r = $this->checkAuthToken($sessid);
// if (PEAR::isError($r)) {
// return $r;
// }
// if (!$r) {
// return PEAR::raiseError("ALib::setAuthToken: invalid token ($sessid)");
// }
// //$this->sessid = $sessid;
// return TRUE;
// } // fn setAuthToken
/* -------------------------------------------------------- authorization */
@ -214,84 +214,84 @@ class Alib {
public static function CheckPerm($sid, $action, $oid=NULL)
{
return TRUE;
// global $CC_DBC;
// global $CC_CONFIG;
// if (!is_numeric($sid)) {
// return FALSE;
// }
//// if (is_null($oid) or $oid=='') {
//// $oid = M2tree::GetRootNode();
//// }
//// if (PEAR::isError($oid)) {
//// return $oid;
//// }
// if (!is_numeric($oid)) {
// return FALSE;
// }
// // query construction
// // shortcuts:
// // p: permTable,
// // s: subjTable, m smembTable,
// // t: treeTable ts: structTable,
// // c: classTable, cm: cmembTable
// // main query elements:
// $q_flds = "m.level , p.subj, s.login, action, p.type, p.obj";
// $q_from = $CC_CONFIG['permTable']." p ";
// // joins for solving users/groups:
// $q_join = "LEFT JOIN ".$CC_CONFIG['subjTable']." s ON s.id=p.subj ";
// $q_join .= "LEFT JOIN ".$CC_CONFIG['smembTable']." m ON m.gid=p.subj ";
// $q_cond = "p.action in('_all', '$action') AND
// (s.id=$sid OR m.uid=$sid) ";
// // coalesce -1 for higher priority of nongroup rows:
// // action DESC order for lower priority of '_all':
// $q_ordb = "ORDER BY coalesce(m.level,-1), action DESC, p.type DESC";
// $q_flds0 = $q_flds;
// $q_from0 = $q_from;
// $q_join0 = $q_join;
// $q_cond0 = $q_cond;
// $q_ordb0 = $q_ordb;
// // joins for solving object tree:
// $q_flds .= ", t.name, ts.level as tlevel";
// //$q_join .= "LEFT JOIN ".$CC_CONFIG['treeTable']." t ON t.id=p.obj ";
// //$q_join .= "LEFT JOIN ".$CC_CONFIG['structTable']." ts ON ts.parid=p.obj ";
// //$q_cond .= " AND (t.id=$oid OR ts.objid=$oid)";
// // action DESC order is hack for lower priority of '_all':
// $q_ordb = "ORDER BY coalesce(ts.level,0), m.level, action DESC, p.type DESC";
// // query by tree:
// $query1 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb";
// $r1 = $CC_DBC->getAll($query1);
// if (PEAR::isError($r1)) {
// return($r1);
// }
// // if there is row with type='A' on the top => permit
// //$AllowedByTree =
// // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='A');
// //$DeniedByTree =
// // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='D');
//
// if (!USE_ALIB_CLASSES) {
// return $AllowedbyTree;
// }
//
// // joins for solving object classes:
// $q_flds = $q_flds0.", c.cname ";
// $q_join = $q_join0."LEFT JOIN ".$CC_CONFIG['classTable']." c ON c.id=p.obj ";
// $q_join .= "LEFT JOIN ".$CC_CONFIG['cmembTable']." cm ON cm.cid=p.obj ";
// $q_cond = $q_cond0." AND (c.id=$oid OR cm.objid=$oid)";
// $q_ordb = $q_ordb0;
// // query by class:
// $query2 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb";
// $r2 = $CC_DBC->getAll($query2);
// if (PEAR::isError($r2)) {
// return $r2;
// }
// $AllowedByClass =
// (is_array($r2) && count($r2)>0 && $r2[0]['type']=='A');
// // not used now:
// // $DeniedByClass =
// // (is_array($r2) && count($r2)>0 && $r2[0]['type']=='D');
// $res = ($AllowedByTree || (!$DeniedByTree && $AllowedByClass));
// return $res;
// global $CC_DBC;
// global $CC_CONFIG;
// if (!is_numeric($sid)) {
// return FALSE;
// }
//// if (is_null($oid) or $oid=='') {
//// $oid = M2tree::GetRootNode();
//// }
//// if (PEAR::isError($oid)) {
//// return $oid;
//// }
// if (!is_numeric($oid)) {
// return FALSE;
// }
// // query construction
// // shortcuts:
// // p: permTable,
// // s: subjTable, m smembTable,
// // t: treeTable ts: structTable,
// // c: classTable, cm: cmembTable
// // main query elements:
// $q_flds = "m.level , p.subj, s.login, action, p.type, p.obj";
// $q_from = $CC_CONFIG['permTable']." p ";
// // joins for solving users/groups:
// $q_join = "LEFT JOIN ".$CC_CONFIG['subjTable']." s ON s.id=p.subj ";
// $q_join .= "LEFT JOIN ".$CC_CONFIG['smembTable']." m ON m.gid=p.subj ";
// $q_cond = "p.action in('_all', '$action') AND
// (s.id=$sid OR m.uid=$sid) ";
// // coalesce -1 for higher priority of nongroup rows:
// // action DESC order for lower priority of '_all':
// $q_ordb = "ORDER BY coalesce(m.level,-1), action DESC, p.type DESC";
// $q_flds0 = $q_flds;
// $q_from0 = $q_from;
// $q_join0 = $q_join;
// $q_cond0 = $q_cond;
// $q_ordb0 = $q_ordb;
// // joins for solving object tree:
// $q_flds .= ", t.name, ts.level as tlevel";
// //$q_join .= "LEFT JOIN ".$CC_CONFIG['treeTable']." t ON t.id=p.obj ";
// //$q_join .= "LEFT JOIN ".$CC_CONFIG['structTable']." ts ON ts.parid=p.obj ";
// //$q_cond .= " AND (t.id=$oid OR ts.objid=$oid)";
// // action DESC order is hack for lower priority of '_all':
// $q_ordb = "ORDER BY coalesce(ts.level,0), m.level, action DESC, p.type DESC";
// // query by tree:
// $query1 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb";
// $r1 = $CC_DBC->getAll($query1);
// if (PEAR::isError($r1)) {
// return($r1);
// }
// // if there is row with type='A' on the top => permit
// //$AllowedByTree =
// // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='A');
// //$DeniedByTree =
// // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='D');
//
// if (!USE_ALIB_CLASSES) {
// return $AllowedbyTree;
// }
//
// // joins for solving object classes:
// $q_flds = $q_flds0.", c.cname ";
// $q_join = $q_join0."LEFT JOIN ".$CC_CONFIG['classTable']." c ON c.id=p.obj ";
// $q_join .= "LEFT JOIN ".$CC_CONFIG['cmembTable']." cm ON cm.cid=p.obj ";
// $q_cond = $q_cond0." AND (c.id=$oid OR cm.objid=$oid)";
// $q_ordb = $q_ordb0;
// // query by class:
// $query2 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb";
// $r2 = $CC_DBC->getAll($query2);
// if (PEAR::isError($r2)) {
// return $r2;
// }
// $AllowedByClass =
// (is_array($r2) && count($r2)>0 && $r2[0]['type']=='A');
// // not used now:
// // $DeniedByClass =
// // (is_array($r2) && count($r2)>0 && $r2[0]['type']=='D');
// $res = ($AllowedByTree || (!$DeniedByTree && $AllowedByClass));
// return $res;
} // fn CheckPerm
@ -411,9 +411,9 @@ class Alib {
$sql = "SELECT *"
." FROM ".$CC_CONFIG['permTable']
." WHERE p.subj=$sid";
// $sql = "SELECT t.name, t.type as otype , p.*"
// ." FROM ".$CC_CONFIG['permTable']." p, ".$CC_CONFIG['treeTable']." t"
// ." WHERE t.id=p.obj AND p.subj=$sid";
// $sql = "SELECT t.name, t.type as otype , p.*"
// ." FROM ".$CC_CONFIG['permTable']." p, ".$CC_CONFIG['treeTable']." t"
// ." WHERE t.id=p.obj AND p.subj=$sid";
$a1 = $CC_DBC->getAll($sql);
return $a1;
} // fn GetSubjPerms

View File

@ -288,42 +288,42 @@ class Backup
*/
private function setFilenames()
{
// if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames\n");
// }
// if (is_array($this->ids)) {
// foreach ($this->ids as $i => $item) {
// $gunid = $item['gunid'];
// // get a stored file object of this gunid
// $sf = StoredFile::RecallByGunid($gunid);
// if (is_null($sf) || PEAR::isError($sf)) {
// return $sf;
// }
// $lid = BasicStor::IdFromGunid($gunid);
// if (($res = BasicStor::Authorize('read', $lid, $this->sessid)) !== TRUE) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - authorize gunid:$gunid\n");
// return PEAR::raiseError('Backup::setFilenames : Authorize ... error.');
// }
// // if the file is a playlist then it has only a meta file
// if (strtolower($sf->md->format) != 'playlist') {
// $this->filenames[] = array(
// 'filename' => $sf->getRealFileName(),
// 'format' => $sf->md->format
// );
// }
// $this->filenames[] = array(
// 'filename' => $sf->getRealMetadataFileName(),
// 'format' => $sf->md->format
// );
// if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames - add file: {$sf->md->format}|".$sf->getRealMetadataFileName()."\n");
// }
// }
// return $this->filenames;
// } else {
// $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - The IDs variable isn't array.\n");
// return PEAR::raiseError('Backup::setFilenames : The IDs variable isn\'t array.');
// }
// if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames\n");
// }
// if (is_array($this->ids)) {
// foreach ($this->ids as $i => $item) {
// $gunid = $item['gunid'];
// // get a stored file object of this gunid
// $sf = StoredFile::RecallByGunid($gunid);
// if (is_null($sf) || PEAR::isError($sf)) {
// return $sf;
// }
// $lid = BasicStor::IdFromGunid($gunid);
// if (($res = BasicStor::Authorize('read', $lid, $this->sessid)) !== TRUE) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - authorize gunid:$gunid\n");
// return PEAR::raiseError('Backup::setFilenames : Authorize ... error.');
// }
// // if the file is a playlist then it has only a meta file
// if (strtolower($sf->md->format) != 'playlist') {
// $this->filenames[] = array(
// 'filename' => $sf->getRealFileName(),
// 'format' => $sf->md->format
// );
// }
// $this->filenames[] = array(
// 'filename' => $sf->getRealMetadataFileName(),
// 'format' => $sf->md->format
// );
// if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames - add file: {$sf->md->format}|".$sf->getRealMetadataFileName()."\n");
// }
// }
// return $this->filenames;
// } else {
// $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - The IDs variable isn't array.\n");
// return PEAR::raiseError('Backup::setFilenames : The IDs variable isn\'t array.');
// }
}

File diff suppressed because it is too large Load Diff

View File

@ -107,19 +107,19 @@ class GreenBox extends BasicStor {
* session id
* @return string access token
*/
// function accessFile($id, $sessid='')
// {
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res;
// }
// $gunid = BasicStor::GunidFromId($id);
// $r = BasicStor::bsAccess(NULL, '', $gunid, 'access');
// if (PEAR::isError($r)) {
// return $r;
// }
// $token = $r['token'];
// return $token;
// } // fn accessFile
// function accessFile($id, $sessid='')
// {
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res;
// }
// $gunid = BasicStor::GunidFromId($id);
// $r = BasicStor::bsAccess(NULL, '', $gunid, 'access');
// if (PEAR::isError($r)) {
// return $r;
// }
// $token = $r['token'];
// return $token;
// } // fn accessFile
/**
@ -131,14 +131,14 @@ class GreenBox extends BasicStor {
* session id
* @return boolean
*/
// function releaseFile($token, $sessid='')
// {
// $r = BasicStor::bsRelease($token, 'access');
// if (PEAR::isError($r)) {
// return $r;
// }
// return FALSE;
// } // fn releaseFile
// function releaseFile($token, $sessid='')
// {
// $r = BasicStor::bsRelease($token, 'access');
// if (PEAR::isError($r)) {
// return $r;
// }
// return FALSE;
// } // fn releaseFile
/**
@ -150,13 +150,13 @@ class GreenBox extends BasicStor {
* Session id
* @return array
*/
// public function analyzeFile($id, $sessid='')
// {
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsAnalyzeFile($id);
// }
// public function analyzeFile($id, $sessid='')
// {
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsAnalyzeFile($id);
// }
/**
@ -169,13 +169,13 @@ class GreenBox extends BasicStor {
* Session id
* @return boolean|PEAR_Error
*/
// public function renameFile($id, $newName, $sessid='')
// {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsRenameFile($id, $newName);
// }
// public function renameFile($id, $newName, $sessid='')
// {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsRenameFile($id, $newName);
// }
/**
@ -191,13 +191,13 @@ class GreenBox extends BasicStor {
* session id
* @return TRUE|PEAR_Error
*/
// public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
// {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
// }
// public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
// {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
// }
/**
@ -235,13 +235,13 @@ class GreenBox extends BasicStor {
* session id
* @return boolean|PEAR_Error
*/
// public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='')
// {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsReplaceMetadata($id, $mdata, $mdataLoc);
// } // fn replaceMetadata
// public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='')
// {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsReplaceMetadata($id, $mdata, $mdataLoc);
// } // fn replaceMetadata
/**
@ -288,7 +288,7 @@ class GreenBox extends BasicStor {
}
return $storedFile->md;
// $arr = $storedFile->md->genPhpArray();
// $arr = $storedFile->md->genPhpArray();
$md = FALSE;
foreach ($arr['children'] as $i=>$a) {
if ($a['elementname'] == 'metadata'){
@ -514,10 +514,10 @@ class GreenBox extends BasicStor {
* @return string
* XML
*/
// function getPlaylistXml($id, $sessid)
// {
// return $this->getMetadata($id, $sessid);
// } // fn getPlaylistXml
// function getPlaylistXml($id, $sessid)
// {
// return $this->getMetadata($id, $sessid);
// } // fn getPlaylistXml
/**
@ -1110,14 +1110,14 @@ class GreenBox extends BasicStor {
* status : string - susccess | working | fault
* tmpfile : string - filepath to result temporary file
*/
// function renderPlaylistToRSSList($status='')
// {
// $dummytokens = array ('123456789abcdeff');
// foreach ($dummytokens as $token) {
// $r[] = $this->renderPlaylistToRSSCheck($token);
// }
// return $r;
// } // fn renderPlaylistToRSSList
// function renderPlaylistToRSSList($status='')
// {
// $dummytokens = array ('123456789abcdeff');
// foreach ($dummytokens as $token) {
// $r[] = $this->renderPlaylistToRSSCheck($token);
// }
// return $r;
// } // fn renderPlaylistToRSSList
/**
@ -1575,11 +1575,11 @@ class GreenBox extends BasicStor {
* @return array
* search result format (see localSearch)
*/
// public function getSearchResults($trtok, $andClose=TRUE)
// {
// $tr = new Transport($this);
// return $tr->getSearchResults($trtok, $andClose);
// } // fn getSearchResults
// public function getSearchResults($trtok, $andClose=TRUE)
// {
// $tr = new Transport($this);
// return $tr->getSearchResults($trtok, $andClose);
// } // fn getSearchResults
/* ========================================================= info methods */
@ -1722,5 +1722,5 @@ class GreenBox extends BasicStor {
return $res;
} // fn removePerm
} // class GreenBox
?>
} // class GreenBox
?>

View File

@ -304,8 +304,8 @@ class LocStor extends BasicStor {
*/
protected function downloadMetadataOpen($sessid, $gunid)
{
// $res = $this->existsAudioClip($sessid, $gunid);
// if(PEAR::isError($res)) return $res;
// $res = $this->existsAudioClip($sessid, $gunid);
// if(PEAR::isError($res)) return $res;
$media = StoredFile::RecallByGunid($gunid)
$id = $media->getGunid();
if (is_null($id)) {
@ -791,32 +791,32 @@ class LocStor extends BasicStor {
* }
*/
public function accessPlaylist($sessid, $playlistId, $recursive=FALSE, $parent='0')
// {
// if ($recursive) {
// require_once("AccessRecur.php");
// $r = AccessRecur::accessPlaylist($this, $sessid, $playlistId);
// if (PEAR::isError($r)) {
// return $r;
// }
// return $r;
// }
// $ex = $this->existsPlaylist($sessid, $playlistId);
// if (PEAR::isError($ex)) {
// return $ex;
// }
// if (!$ex) {
// return PEAR::raiseError(
// "LocStor::accessPlaylist: playlist not found ($playlistId)",
// GBERR_NOTF
// );
// }
// $id = BasicStor::IdFromGunid($playlistId);
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res;
// }
// $res = $this->bsOpenDownload($id, 'metadata', $parent);
// #unset($res['filename']);
// return $res;
// {
// if ($recursive) {
// require_once("AccessRecur.php");
// $r = AccessRecur::accessPlaylist($this, $sessid, $playlistId);
// if (PEAR::isError($r)) {
// return $r;
// }
// return $r;
// }
// $ex = $this->existsPlaylist($sessid, $playlistId);
// if (PEAR::isError($ex)) {
// return $ex;
// }
// if (!$ex) {
// return PEAR::raiseError(
// "LocStor::accessPlaylist: playlist not found ($playlistId)",
// GBERR_NOTF
// );
// }
// $id = BasicStor::IdFromGunid($playlistId);
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res;
// }
// $res = $this->bsOpenDownload($id, 'metadata', $parent);
// #unset($res['filename']);
// return $res;
}
@ -1523,99 +1523,99 @@ class LocStor extends BasicStor {
*/
function downloadOpen($sessid, $trtype, $pars=array())
{
// global $CC_CONFIG;
// switch ($trtype) {
// case "unknown":
// case "audioclip":
// case "metadata":
// case "playlist":
// case "playlistPkg":
// if (!isset($pars['gunid'])) {
// return PEAR::raiseError("Archive::downloadOpen: gunid not set");
// }
// break;
// }
// $gunid = $pars['gunid'];
// // resolve trtype by object type:
// if ( ($trtype == 'unknown') || ($trtype == 'playlistPkg') ) {
// $media = StoredFile::RecallByGunid($gunid);
// $trtype2 = $media->getType();
// if (PEAR::isError($trtype2)) {
// return $trtype2;
// }
// // required with content:
// $trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ?
// 'playlistPkg' : $trtype2);
// //return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid");
// }
// switch ($trtype) {
// case "audioclip":
// $res = $this->downloadRawAudioDataOpen($sessid, $gunid);
// break;
// case "metadata":
// $res = $this->downloadMetadataOpen($sessid, $gunid);
// break;
// case "playlist":
// $res = $this->accessPlaylist($sessid, $gunid);
// break;
// case "playlistPkg":
// $res = $this->bsExportPlaylistOpen($gunid);
// if (PEAR::isError($res)) {
// return $res;
// }
// $tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
// $plfpath = "$tmpn.lspl";
// copy($res['fname'], $plfpath);
// $res = $this->bsExportPlaylistClose($res['token']);
// if (PEAR::isError($res)) {
// return $res;
// }
// $fname = "transported_playlist.lspl";
// $id = BasicStor::IdFromGunid($gunid);
// $acc = BasicStor::bsAccess($plfpath, 'lspl', NULL, 'download');
// if (PEAR::isError($acc)) {
// return $acc;
// }
// $url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
// $chsum = md5_file($plfpath);
// $size = filesize($plfpath);
// $res = array(
// 'url'=>$url, 'token'=>$acc['token'],
// 'chsum'=>$chsum, 'size'=>$size,
// 'filename'=>$fname
// );
// break;
// case "searchjob":
// $res = $pars;
// break;
// case "file":
// $res = array();
// break;
// default:
// return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)");
// }
// if (PEAR::isError($res)) {
// return $res;
// }
// switch ($trtype) {
// case "audioclip":
// case "metadata":
// case "playlist":
// case "playlistPkg":
// $f = StoredFile::RecallByGunid($gunid);
// $title = $f->getTitle();
// break;
// case "searchjob":
// $title = 'searchjob';
// break;
// case "file":
// $title = 'regular file';
// break;
// default:
// }
// $res['title'] = $title;
// $res['trtype'] = $trtype;
// return $res;
// global $CC_CONFIG;
// switch ($trtype) {
// case "unknown":
// case "audioclip":
// case "metadata":
// case "playlist":
// case "playlistPkg":
// if (!isset($pars['gunid'])) {
// return PEAR::raiseError("Archive::downloadOpen: gunid not set");
// }
// break;
// }
// $gunid = $pars['gunid'];
// // resolve trtype by object type:
// if ( ($trtype == 'unknown') || ($trtype == 'playlistPkg') ) {
// $media = StoredFile::RecallByGunid($gunid);
// $trtype2 = $media->getType();
// if (PEAR::isError($trtype2)) {
// return $trtype2;
// }
// // required with content:
// $trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ?
// 'playlistPkg' : $trtype2);
// //return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid");
// }
// switch ($trtype) {
// case "audioclip":
// $res = $this->downloadRawAudioDataOpen($sessid, $gunid);
// break;
// case "metadata":
// $res = $this->downloadMetadataOpen($sessid, $gunid);
// break;
// case "playlist":
// $res = $this->accessPlaylist($sessid, $gunid);
// break;
// case "playlistPkg":
// $res = $this->bsExportPlaylistOpen($gunid);
// if (PEAR::isError($res)) {
// return $res;
// }
// $tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
// $plfpath = "$tmpn.lspl";
// copy($res['fname'], $plfpath);
// $res = $this->bsExportPlaylistClose($res['token']);
// if (PEAR::isError($res)) {
// return $res;
// }
// $fname = "transported_playlist.lspl";
// $id = BasicStor::IdFromGunid($gunid);
// $acc = BasicStor::bsAccess($plfpath, 'lspl', NULL, 'download');
// if (PEAR::isError($acc)) {
// return $acc;
// }
// $url = BasicStor::GetUrlPart()."access/".basename($acc['fname']);
// $chsum = md5_file($plfpath);
// $size = filesize($plfpath);
// $res = array(
// 'url'=>$url, 'token'=>$acc['token'],
// 'chsum'=>$chsum, 'size'=>$size,
// 'filename'=>$fname
// );
// break;
// case "searchjob":
// $res = $pars;
// break;
// case "file":
// $res = array();
// break;
// default:
// return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)");
// }
// if (PEAR::isError($res)) {
// return $res;
// }
// switch ($trtype) {
// case "audioclip":
// case "metadata":
// case "playlist":
// case "playlistPkg":
// $f = StoredFile::RecallByGunid($gunid);
// $title = $f->getTitle();
// break;
// case "searchjob":
// $title = 'searchjob';
// break;
// case "file":
// $title = 'regular file';
// break;
// default:
// }
// $res['title'] = $title;
// $res['trtype'] = $trtype;
// return $res;
}

View File

@ -274,7 +274,8 @@ class Playlist {
return FALSE;
}
/**
/**
* Set playlist edit flag
*
* @param string $p_playlistId
@ -441,11 +442,11 @@ class Playlist {
return $media;
}
// get information about audioClip
// $acInfo = $this->getAudioClipInfo($ac);
// if (PEAR::isError($acInfo)) {
// return $acInfo;
// }
// extract($acInfo); // 'acGunid', 'acLen', 'acTit', 'elType'
// $acInfo = $this->getAudioClipInfo($ac);
// if (PEAR::isError($acInfo)) {
// return $acInfo;
// }
// extract($acInfo); // 'acGunid', 'acLen', 'acTit', 'elType'
$metadata = $media->getMetadata();
$length = $metadata["length"];
@ -865,29 +866,29 @@ class Playlist {
* <li>elType string - audioClip | playlist</li>
* </ul>
*/
// private function getAudioClipInfo($p_media)
// {
// $ac_id = $p_media->getId();
//
// $r = $p_media->getMetadataValue('dcterms:extent');
// if (isset($r)) {
// $acLen = $r;
// } else {
// $acLen = '00:00:00.000000';
// }
//
// $r = $p_media->getMetadataValue('dc:title');
// if (isset($r)) {
// $acTit = $r;
// } else {
// $acTit = $acGunid;
// }
// $elType = $p_media->getType();
// $trTbl = array('audioclip'=>'audioClip', 'webstream'=>'audioClip','playlist'=>'playlist');
// $elType = $trTbl[$elType];
//
// return compact('acGunid', 'acLen', 'acTit', 'elType');
// }
// private function getAudioClipInfo($p_media)
// {
// $ac_id = $p_media->getId();
//
// $r = $p_media->getMetadataValue('dcterms:extent');
// if (isset($r)) {
// $acLen = $r;
// } else {
// $acLen = '00:00:00.000000';
// }
//
// $r = $p_media->getMetadataValue('dc:title');
// if (isset($r)) {
// $acTit = $r;
// } else {
// $acTit = $acGunid;
// }
// $elType = $p_media->getType();
// $trTbl = array('audioclip'=>'audioClip', 'webstream'=>'audioClip','playlist'=>'playlist');
// $elType = $trTbl[$elType];
//
// return compact('acGunid', 'acLen', 'acTit', 'elType');
// }
/**
@ -1339,18 +1340,18 @@ class PlaylistElementExport {
"$ind</item>\n";
return $str;
}
}
}
/**
/**
* @package Campcaster
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
* @todo Rename this class to PlaylistAudioClip (notice the caps)
*/
class PlaylistAudioClipExport
{
class PlaylistAudioClipExport
{
public static function OutputToSmil(&$pl, $plac, $ind='')
{
@ -1413,18 +1414,18 @@ class PlaylistAudioClipExport
'desc' => $desc,
);
}
}
}
/**
/**
* @package Campcaster
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
* @todo Rename this class "PlaylistFadeInfo" (notive the caps)
*/
class PlaylistFadeInfoExport
{
class PlaylistFadeInfoExport
{
public static function OutputToSmil(&$pl, $plfi, $ind='')
{
@ -1447,18 +1448,18 @@ class PlaylistFadeInfoExport
return '';
}
}
}
/**
/**
* @package Campcaster
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
* @todo Rename this class to PlaylistMetadata (notice the caps)
*/
class PlaylistMetadataExport
{
class PlaylistMetadataExport
{
public static function OutputToSmil(&$pl, $md, $ind='')
{
return NULL;
@ -1475,6 +1476,6 @@ class PlaylistMetadataExport
{
return NULL;
}
}
}
?>
?>

View File

@ -80,8 +80,7 @@ class Prefs {
return $subjid;
}
if (is_null($subjid)) {
return PEAR::raiseError("Prefs::savePref: invalid session id",
GBERR_SESS);
return PEAR::raiseError("Prefs::savePref: invalid session id", GBERR_SESS);
}
$r = $this->update($subjid, $key, $value);
if (PEAR::isError($r)) {
@ -113,16 +112,14 @@ class Prefs {
return $subjid;
}
if (is_null($subjid)) {
return PEAR::raiseError("Prefs::delPref: invalid session id",
GBERR_SESS);
return PEAR::raiseError("Prefs::delPref: invalid session id", GBERR_SESS);
}
$r = $this->delete($subjid, $key);
if (PEAR::isError($r)) {
return $r;
}
if ($r === FALSE) {
return PEAR::raiseError("Prefs::delPref: invalid preference key",
GBERR_PREF);
return PEAR::raiseError("Prefs::delPref: invalid preference key", GBERR_PREF);
}
return TRUE;
}

View File

@ -205,36 +205,36 @@ class Renderer
*/
function rnRender2StorageCore(&$gb, $token)
{
// $r = BasicStor::bsRelease($token, 'render');
// if (PEAR::isError($r)) {
// return $r;
// }
// $realOgg = $r['realFname'];
// $owner = $r['owner'];
// $gunid = $r['gunid'];
// $fileName = 'rendered_playlist';
// $id = BasicStor::IdFromGunid($gunid);
// if (PEAR::isError($id)) {
// return $id;
// }
// $mdata = '';
// foreach (array('dc:title', 'dcterms:extent', 'dc:creator', 'dc:description') as $item) {
// $val = $gb->bsGetMetadataValue($id, $item);
// $mdata .= " <$item>$val</$item>\n";
// }
// $mdata = "<audioClip>\n <metadata>\n$mdata </metadata>\n</audioClip>\n";
// //$mdata = "<audioClip>\n <metadata>\n$mdata<dcterms:extent>0</dcterms:extent>\n</metadata>\n</audioClip>\n";
// $values = array(
// "filename" => $fileName,
// "filepath" => $realOgg,
// "metadata" => $mdata,
// "filetype" => "audioclip"
// );
// $storedFile = $gb->bsPutFile($values);
// if (PEAR::isError($storedFile)) {
// return $storedFile;
// }
// return array('gunid' => $storedFile->getGunid());
// $r = BasicStor::bsRelease($token, 'render');
// if (PEAR::isError($r)) {
// return $r;
// }
// $realOgg = $r['realFname'];
// $owner = $r['owner'];
// $gunid = $r['gunid'];
// $fileName = 'rendered_playlist';
// $id = BasicStor::IdFromGunid($gunid);
// if (PEAR::isError($id)) {
// return $id;
// }
// $mdata = '';
// foreach (array('dc:title', 'dcterms:extent', 'dc:creator', 'dc:description') as $item) {
// $val = $gb->bsGetMetadataValue($id, $item);
// $mdata .= " <$item>$val</$item>\n";
// }
// $mdata = "<audioClip>\n <metadata>\n$mdata </metadata>\n</audioClip>\n";
// //$mdata = "<audioClip>\n <metadata>\n$mdata<dcterms:extent>0</dcterms:extent>\n</metadata>\n</audioClip>\n";
// $values = array(
// "filename" => $fileName,
// "filepath" => $realOgg,
// "metadata" => $mdata,
// "filetype" => "audioclip"
// );
// $storedFile = $gb->bsPutFile($values);
// if (PEAR::isError($storedFile)) {
// return $storedFile;
// }
// return array('gunid' => $storedFile->getGunid());
}

View File

@ -265,83 +265,83 @@ class Restore {
* @return mixed
* true if success or PEAR_error
*/
// function addFileToStorage($file,$type,$gunid)
// {
// if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." addFileToStorage - file:$file | type:$type | id:$gunid\n");
// }
// require_once("XmlParser.php");
// $tree = XmlParser::parse($file);
// $mediaFileLP = str_replace('.xml','',$file);
// $mediaFileLP = ($type=='audioClip' && is_file($mediaFileLP))?$mediaFileLP:'';
// $ex = $this->gb->existsFile($this->sessid,$gunid);
// if (PEAR::isError($ex)) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s").
// " addFileToStorage - existsFile($gunid) ".
// "(".$ex->getMessage()."/".$ex->getUserInfo().")\n"
// );
// }
// if (!PEAR::isError($ex) && $ex) { // file is exists in storage server
// //replace it
// $id = BasicStor::IdFromGunid($gunid);
// $replace = $this->gb->replaceFile(
// $id, # id int, virt.file's local id
// $mediaFileLP, # mediaFileLP string, local path of media file
// $file, # mdataFileLP string, local path of metadata file
// $this->sessid); # sessid string, session id
// if (PEAR::isError($replace)) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s").
// " addFileToStorage - replaceFile Error ".
// "(".$replace->getMessage()."/".$replace->getUserInfo().")\n"
// );
// file_put_contents($this->statusFile, 'fault|'.$replace->getMessage()."/".$replace->getUserInfo());
// return $replace;
// }
// #$this->addLogItem("replace it \n");
// } else {
// // add as new
// $name = $tree->children[0]->children[0]->content;
// 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".
// "$name, $mediaFileLP, $file, {$this->sessid}, $gunid, $type \n"
// );
// }
// $values = array(
// "filename" => $name,
// "filepath" => $mediaFileLP,
// "metadata" => $file,
// "gunid" => $gunid,
// "filetype" => $type
// );
// $put = $this->gb->putFile($values, $this->sessid);
// //$this->addLogItem("add as new \n");
// if (PEAR::isError($put)) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s").
// " addFileToStorage - putFile Error ".
// "(".$put->getMessage()."/".$put->getUserInfo().")\n"
// ."\n---\n".file_get_contents($file)."\n---\n"
// );
// file_put_contents($this->statusFile, 'fault|'.$put->getMessage()."/".$put->getUserInfo());
// //$this->addLogItem("Error Object: ".print_r($put,true)."\n");
// return $put;
// }
// }
// $ac = StoredFile::RecallByGunid($gunid);
// if (is_null($ac) || PEAR::isError($ac)) {
// return $ac;
// }
// $res = $ac->setState('ready');
// if (PEAR::isError($res)) {
// return $res;
// }
// return true;
// }
// function addFileToStorage($file,$type,$gunid)
// {
// if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." addFileToStorage - file:$file | type:$type | id:$gunid\n");
// }
// require_once("XmlParser.php");
// $tree = XmlParser::parse($file);
// $mediaFileLP = str_replace('.xml','',$file);
// $mediaFileLP = ($type=='audioClip' && is_file($mediaFileLP))?$mediaFileLP:'';
// $ex = $this->gb->existsFile($this->sessid,$gunid);
// if (PEAR::isError($ex)) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s").
// " addFileToStorage - existsFile($gunid) ".
// "(".$ex->getMessage()."/".$ex->getUserInfo().")\n"
// );
// }
// if (!PEAR::isError($ex) && $ex) { // file is exists in storage server
// //replace it
// $id = BasicStor::IdFromGunid($gunid);
// $replace = $this->gb->replaceFile(
// $id, # id int, virt.file's local id
// $mediaFileLP, # mediaFileLP string, local path of media file
// $file, # mdataFileLP string, local path of metadata file
// $this->sessid); # sessid string, session id
// if (PEAR::isError($replace)) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s").
// " addFileToStorage - replaceFile Error ".
// "(".$replace->getMessage()."/".$replace->getUserInfo().")\n"
// );
// file_put_contents($this->statusFile, 'fault|'.$replace->getMessage()."/".$replace->getUserInfo());
// return $replace;
// }
// #$this->addLogItem("replace it \n");
// } else {
// // add as new
// $name = $tree->children[0]->children[0]->content;
// 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".
// "$name, $mediaFileLP, $file, {$this->sessid}, $gunid, $type \n"
// );
// }
// $values = array(
// "filename" => $name,
// "filepath" => $mediaFileLP,
// "metadata" => $file,
// "gunid" => $gunid,
// "filetype" => $type
// );
// $put = $this->gb->putFile($values, $this->sessid);
// //$this->addLogItem("add as new \n");
// if (PEAR::isError($put)) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s").
// " addFileToStorage - putFile Error ".
// "(".$put->getMessage()."/".$put->getUserInfo().")\n"
// ."\n---\n".file_get_contents($file)."\n---\n"
// );
// file_put_contents($this->statusFile, 'fault|'.$put->getMessage()."/".$put->getUserInfo());
// //$this->addLogItem("Error Object: ".print_r($put,true)."\n");
// return $put;
// }
// }
// $ac = StoredFile::RecallByGunid($gunid);
// if (is_null($ac) || PEAR::isError($ac)) {
// return $ac;
// }
// $res = $ac->setState('ready');
// if (PEAR::isError($res)) {
// return $res;
// }
// return true;
// }
/**

View File

@ -38,12 +38,12 @@ class ScheduleGroup {
* @return string
* The end time, to the nearest second.
*/
// protected function calculateEndTime($p_startTime, $p_trackTime) {
// $p_trackTime = substr($p_startTime, 0, );
// $start = new DateTime();
// $interval = new DateInterval()
//
// }
// protected function calculateEndTime($p_startTime, $p_trackTime) {
// $p_trackTime = substr($p_startTime, 0, );
// $start = new DateTime();
// $interval = new DateInterval()
//
// }
/**
* Add a music clip or playlist to the schedule.
@ -109,6 +109,7 @@ class ScheduleGroup {
// Check if there are any conflicts with existing entries
$length = trim($playlist->getLength());
var_dump($length);
if (empty($length)) {
return new PEAR_Error("Length is empty.");
}
@ -122,8 +123,10 @@ class ScheduleGroup {
$itemStartTime = $p_datetime;
$plItems = $playlist->getContents();
var_dump($plItems);
foreach ($plItems as $row) {
$trackLength = $row["cliplength"];
var_dump($trackLength);
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
." (id, playlist_id, starts, ends, group_id, file_id,"
." clip_length, cue_in, cue_out, fade_in, fade_out)"
@ -198,7 +201,7 @@ class ScheduleGroup {
public function reschedule($toDateTime) {
global $CC_CONFIG, $CC_DBC;
// $sql = "UPDATE ".$CC_CONFIG["scheduleTable"]. " SET id=, starts=,ends="
// $sql = "UPDATE ".$CC_CONFIG["scheduleTable"]. " SET id=, starts=,ends="
}
}
@ -226,17 +229,19 @@ class Schedule {
." WHERE (starts >= '$p_datetime') "
." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))";
//$_SESSION["debug"] = $sql;
var_dump($sql);
$count = $CC_DBC->GetOne($sql);
var_dump($count);
return ($count == '0');
}
// public function onAddTrackToPlaylist($playlistId, $audioTrackId) {
//
// }
//
// public function onRemoveTrackFromPlaylist($playlistId, $audioTrackId) {
//
// }
// public function onAddTrackToPlaylist($playlistId, $audioTrackId) {
//
// }
//
// public function onRemoveTrackFromPlaylist($playlistId, $audioTrackId) {
//
// }
/**
* Return TRUE if file is going to be played in the future.

View File

@ -233,13 +233,13 @@ function camp_get_audio_metadata($p_filename, $p_testonly = false)
array('path'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
),
// 'ls:genre' => array(
// array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
// array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// ),
// 'ls:genre' => array(
// array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
// array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// ),
'ls:channels' => array(
array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE),
),
@ -980,42 +980,42 @@ class StoredFile {
* 'file'|'string'
* @return TRUE|PEAR_Error
*/
// public function replace($p_oid, $p_name, $p_localFilePath='', $p_metadata='',
// $p_mdataLoc='file')
// {
// global $CC_CONFIG, $CC_DBC;
// $CC_DBC->query("BEGIN");
// $res = $this->setName($p_name);
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// if ($p_localFilePath != '') {
// $res = $this->setRawMediaData($p_localFilePath);
// } else {
// $res = $this->deleteFile();
// }
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// if ($p_metadata != '') {
// $res = $this->setMetadata($p_metadata, $p_mdataLoc);
// } else {
//// $res = $this->md->delete();
// $res = $this->clearMetadata();
// }
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// $res = $CC_DBC->query("COMMIT");
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// return TRUE;
// }
// public function replace($p_oid, $p_name, $p_localFilePath='', $p_metadata='',
// $p_mdataLoc='file')
// {
// global $CC_CONFIG, $CC_DBC;
// $CC_DBC->query("BEGIN");
// $res = $this->setName($p_name);
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// if ($p_localFilePath != '') {
// $res = $this->setRawMediaData($p_localFilePath);
// } else {
// $res = $this->deleteFile();
// }
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// if ($p_metadata != '') {
// $res = $this->setMetadata($p_metadata, $p_mdataLoc);
// } else {
//// $res = $this->md->delete();
// $res = $this->clearMetadata();
// }
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// $res = $CC_DBC->query("COMMIT");
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// return TRUE;
// }
/**
@ -1077,10 +1077,10 @@ class StoredFile {
return $res;
}
}
// $r = $this->md->regenerateXmlFile();
// if (PEAR::isError($r)) {
// return $r;
// }
// $r = $this->md->regenerateXmlFile();
// if (PEAR::isError($r)) {
// return $r;
// }
return TRUE;
}
@ -1109,21 +1109,21 @@ class StoredFile {
* (NULL = no validation)
* @return boolean
*/
// public function setMetadata($p_metadata, $p_mdataLoc='file', $p_format=NULL)
// {
// global $CC_CONFIG, $CC_DBC;
// $CC_DBC->query("BEGIN");
// $res = $this->md->replace($p_metadata, $p_mdataLoc, $p_format);
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// $res = $CC_DBC->query("COMMIT");
// if (PEAR::isError($res)) {
// return $res;
// }
// return TRUE;
// }
// public function setMetadata($p_metadata, $p_mdataLoc='file', $p_format=NULL)
// {
// global $CC_CONFIG, $CC_DBC;
// $CC_DBC->query("BEGIN");
// $res = $this->md->replace($p_metadata, $p_mdataLoc, $p_format);
// if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK");
// return $res;
// }
// $res = $CC_DBC->query("COMMIT");
// if (PEAR::isError($res)) {
// return $res;
// }
// return TRUE;
// }
/**
* Set metadata element value
@ -1529,13 +1529,13 @@ class StoredFile {
{
return md5(uniqid("", true));
// $ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '');
// $initString = microtime().$ip.rand();
// $hash = md5($initString);
// // non-negative int8
// $hsd = substr($hash, 0, 1);
// $res = dechex(hexdec($hsd)>>1).substr($hash, 1, 15);
// return StoredFile::NormalizeGunid($res);
// $ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '');
// $initString = microtime().$ip.rand();
// $hash = md5($initString);
// // non-negative int8
// $hsd = substr($hash, 0, 1);
// $res = dechex(hexdec($hsd)>>1).substr($hash, 1, 15);
// return StoredFile::NormalizeGunid($res);
}
@ -1544,10 +1544,10 @@ class StoredFile {
*
* @return string
*/
// public static function NormalizeGunid($p_gunid)
// {
// return str_pad($p_gunid, 16, "0", STR_PAD_LEFT);
// }
// public static function NormalizeGunid($p_gunid)
// {
// return str_pad($p_gunid, 16, "0", STR_PAD_LEFT);
// }
/**
@ -1666,18 +1666,18 @@ class StoredFile {
*
* @return string
*/
// private function _getResDir()
// {
// global $CC_CONFIG, $CC_DBC;
// $resDir = $CC_CONFIG['storageDir']."/".substr($this->gunid, 0, 3);
// //$this->gb->debugLog("$resDir");
// // see Transport::_getResDir too for resDir name create code
// if (!is_dir($resDir)) {
// mkdir($resDir, 02775);
// chmod($resDir, 02775);
// }
// return $resDir;
// }
// private function _getResDir()
// {
// global $CC_CONFIG, $CC_DBC;
// $resDir = $CC_CONFIG['storageDir']."/".substr($this->gunid, 0, 3);
// //$this->gb->debugLog("$resDir");
// // see Transport::_getResDir too for resDir name create code
// if (!is_dir($resDir)) {
// mkdir($resDir, 02775);
// chmod($resDir, 02775);
// }
// return $resDir;
// }
/**
@ -1725,5 +1725,5 @@ class StoredFile {
return $CC_CONFIG['accessDir']."/$p_token.$p_ext";
}
} // class StoredFile
?>
} // class StoredFile
?>

View File

@ -72,7 +72,7 @@ class Transport
* wget --limit-rate parameter
*/
private $downLimitRate = NULL;
# private $downLimitRate = 500;
# private $downLimitRate = 500;
/**
* wget -t parameter
@ -109,7 +109,7 @@ class Transport
* @var int
*/
private $upLimitRate = NULL;
# private $upLimitRate = 500;
# private $upLimitRate = 500;
/**
@ -447,33 +447,33 @@ class Transport
* @return string
* transport token
*/
// function globalSearch($criteria, $resultMode='php', $pars=array())
// {
// global $CC_CONFIG, $CC_DBC;
// // testing of hub availability and hub account configuration.
// // it makes searchjob not async - should be removed for real async
// $r = $this->loginToArchive();
// if (PEAR::isError($r)) {
// switch(intval($r->getCode())) {
// case 802:
// return PEAR::raiseError("Can't login to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
// case TRERR_XR_FAIL:
// return PEAR::raiseError("Can't connect to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
// }
// return $r;
// }
// $this->logoutFromArchive($r);
// $criteria['resultMode'] = $resultMode;
// $localfile = tempnam($CC_CONFIG['transDir'], 'searchjob_');
// @chmod($localfile, 0660);
// $len = file_put_contents($localfile, serialize($criteria));
// $trec = $this->_uploadGeneralFileToHub($localfile, 'searchjob', $pars);
// if (PEAR::isError($trec)) {
// return $trec;
// }
// $this->startCronJobProcess($trec->trtok);
// return $trec->trtok;
// }
// function globalSearch($criteria, $resultMode='php', $pars=array())
// {
// global $CC_CONFIG, $CC_DBC;
// // testing of hub availability and hub account configuration.
// // it makes searchjob not async - should be removed for real async
// $r = $this->loginToArchive();
// if (PEAR::isError($r)) {
// switch(intval($r->getCode())) {
// case 802:
// return PEAR::raiseError("Can't login to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
// case TRERR_XR_FAIL:
// return PEAR::raiseError("Can't connect to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
// }
// return $r;
// }
// $this->logoutFromArchive($r);
// $criteria['resultMode'] = $resultMode;
// $localfile = tempnam($CC_CONFIG['transDir'], 'searchjob_');
// @chmod($localfile, 0660);
// $len = file_put_contents($localfile, serialize($criteria));
// $trec = $this->_uploadGeneralFileToHub($localfile, 'searchjob', $pars);
// if (PEAR::isError($trec)) {
// return $trec;
// }
// $this->startCronJobProcess($trec->trtok);
// return $trec->trtok;
// }
/**
@ -486,60 +486,60 @@ class Transport
* @return array
* LS search result format (see localSearch)
*/
// function getSearchResults($trtok, $andClose=TRUE)
// {
// $trec = TransportRecord::recall($this, $trtok);
// if (PEAR::isError($trec)) {
// return $trec;
// }
// $row = $trec->row;
// switch ($st = $trec->getState()) {
// case "failed":
// return PEAR::raiseError(
// "Transport::getSearchResults:".
// " global search or results transport failed".
// " ({$trec->row['errmsg']})"
// );
// case "closed":
///*
// $res = file_get_contents($row['localfile']);
// $results = unserialize($res);
// return $results;
//*/
// return PEAR::raiseError(
// "Transport::getSearchResults:".
// " closed transport token ($trtok)", TRERR_TOK
// );
// case "finished":
// if ($row['direction'] == 'down') {
// // really finished
// $res = file_get_contents($row['localfile']);
// $results = unserialize($res);
// if ($andClose) {
// $ret = $this->xmlrpcCall('archive.downloadClose',
// array(
// 'token' => $row['pdtoken'] ,
// 'trtype' => $row['trtype'] ,
// ));
// if (PEAR::isError($ret)) {
// return $ret;
// }
// @unlink($row['localfile']);
// $r = $trec->close();
// if (PEAR::isError($r)) {
// return $r;
// }
// }
// return $results;
// }
// // otherwise not really finished - only request upload finished
// default:
// return PEAR::raiseError(
// "Transport::getSearchResults: not finished ($st)",
// TRERR_NOTFIN
// );
// }
// }
// function getSearchResults($trtok, $andClose=TRUE)
// {
// $trec = TransportRecord::recall($this, $trtok);
// if (PEAR::isError($trec)) {
// return $trec;
// }
// $row = $trec->row;
// switch ($st = $trec->getState()) {
// case "failed":
// return PEAR::raiseError(
// "Transport::getSearchResults:".
// " global search or results transport failed".
// " ({$trec->row['errmsg']})"
// );
// case "closed":
///*
// $res = file_get_contents($row['localfile']);
// $results = unserialize($res);
// return $results;
//*/
// return PEAR::raiseError(
// "Transport::getSearchResults:".
// " closed transport token ($trtok)", TRERR_TOK
// );
// case "finished":
// if ($row['direction'] == 'down') {
// // really finished
// $res = file_get_contents($row['localfile']);
// $results = unserialize($res);
// if ($andClose) {
// $ret = $this->xmlrpcCall('archive.downloadClose',
// array(
// 'token' => $row['pdtoken'] ,
// 'trtype' => $row['trtype'] ,
// ));
// if (PEAR::isError($ret)) {
// return $ret;
// }
// @unlink($row['localfile']);
// $r = $trec->close();
// if (PEAR::isError($r)) {
// return $r;
// }
// }
// return $results;
// }
// // otherwise not really finished - only request upload finished
// default:
// return PEAR::raiseError(
// "Transport::getSearchResults: not finished ($st)",
// TRERR_NOTFIN
// );
// }
// }
/* ------------------------ methods for ls-archive-format file transports */
@ -1039,9 +1039,9 @@ class Transport
$title = $ret['title'];
$pars = array();
switch ($trtype) {
// case "searchjob":
// $r = $trec->setState('waiting', $pars);
// break;
// case "searchjob":
// $r = $trec->setState('waiting', $pars);
// break;
case "file":
$r = $trec->setState('waiting',array_merge($pars, array(
'trtype'=>$trtype,
@ -1325,20 +1325,20 @@ class Transport
return $ret;
}
// if ($row['trtype'] == 'searchjob') {
// @unlink($row['localfile']);
// $r = $trec->setState('init', array(
// 'direction' => 'down',
// 'pdtoken' => $ret['token'],
// 'expectedsum' => $ret['chsum'],
// 'expectedsize' => $ret['size'],
// 'url' => $ret['url'],
// 'realsize' => 0,
// ));
// $this->startCronJobProcess($trec->trtok);
// } else {
// if ($row['trtype'] == 'searchjob') {
// @unlink($row['localfile']);
// $r = $trec->setState('init', array(
// 'direction' => 'down',
// 'pdtoken' => $ret['token'],
// 'expectedsum' => $ret['chsum'],
// 'expectedsize' => $ret['size'],
// 'url' => $ret['url'],
// 'realsize' => 0,
// ));
// $this->startCronJobProcess($trec->trtok);
// } else {
$r = $trec->close();
// }
// }
if (PEAR::isError($r)) {
return $r;
}
@ -1453,7 +1453,7 @@ class Transport
}
break;
case "metadata":
// case "searchjob":
// case "searchjob":
return TRUE; // don't close - getSearchResults should close it
break;
}
@ -1491,7 +1491,7 @@ class Transport
break;
case "audioclip":
case "metadata":
// case "searchjob":
// case "searchjob":
case "file":
break;
default:

View File

@ -169,7 +169,7 @@ class XmlParser {
xml_get_current_line_number($xml_parser)
)
);
// var_dump($data);
// var_dump($data);
}
xml_parser_free($xml_parser);
}

View File

@ -75,7 +75,4 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
return Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}
} // CcPlaylistcontents

View File

@ -142,12 +142,12 @@ class Input {
$newArray = array();
$newArray[] = $_REQUEST[$p_varName];
return $newArray;
// if (!$p_errorsOk) {
// $g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
// .', but received type '.gettype($_REQUEST[$p_varName]).'.'
// .' Value is "'.$_REQUEST[$p_varName].'".';
// }
// return $p_defaultValue;
// if (!$p_errorsOk) {
// $g_inputErrors[$p_varName] = 'Incorrect type. Expected type '.$p_type
// .', but received type '.gettype($_REQUEST[$p_varName]).'.'
// .' Value is "'.$_REQUEST[$p_varName].'".';
// }
// return $p_defaultValue;
}
}
return $_REQUEST[$p_varName];

View File

@ -114,8 +114,9 @@ class twitter{
//
function publicTimeline($sinceid=false){
$qs='';
if($sinceid!==false)
if($sinceid!==false) {
$qs='?since_id='.intval($sinceid);
}
$request = 'http://twitter.com/statuses/public_timeline.xml'.$qs;
return $this->process($request);
}
@ -132,14 +133,15 @@ class twitter{
//
function friendsTimeline($id=false,$since=false){
$qs='';
if($since!==false)
if($since!==false) {
$qs='?since='.urlencode($since);
}
if($id===false)
if($id===false) {
$request = 'http://twitter.com/statuses/friends_timeline.xml'.$qs;
else
} else {
$request = 'http://twitter.com/statuses/friends_timeline/'.urlencode($id).'.xml'.$qs;
}
return $this->process($request);
}
@ -159,10 +161,11 @@ class twitter{
if($since!==false)
$qs .= '&since='.urlencode($since);
if($id===false)
if($id===false) {
$request = 'http://twitter.com/statuses/user_timeline.xml'.$qs;
else
} else {
$request = 'http://twitter.com/statuses/user_timeline/'.urlencode($id).'.xml'.$qs;
}
return $this->process($request);
}
@ -221,8 +224,9 @@ class twitter{
//
function directMessages($since=false){
$qs='';
if($since!==false)
if($since!==false) {
$qs='?since='.urlencode($since);
}
$request = 'http://twitter.com/direct_messages.xml'.$qs;
return $this->process($request);
}
@ -256,8 +260,9 @@ class twitter{
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);
}
if($this->username !== false && $this->password !== false)
if($this->username !== false && $this->password !== false) {
curl_setopt($ch, CURLOPT_USERPWD, $this->username.':'.$this->password);
}
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_NOBODY, 0);

View File

@ -253,8 +253,7 @@ class uiBase
global $CC_DBC, $CC_CONFIG;
$this->gb = new GreenBox();
$CC_CONFIG['accessRawAudioUrl'] = $CC_CONFIG['storageUrlPath'].'/xmlrpc/simpleGet.php';
$this->sessid = isset($_REQUEST[$CC_CONFIG['authCookieName']]) ?
$_REQUEST[$CC_CONFIG['authCookieName']] : null;
$this->sessid = isset($_REQUEST[$CC_CONFIG['authCookieName']]) ? $_REQUEST[$CC_CONFIG['authCookieName']] : null;
$this->userid = GreenBox::GetSessUserId($this->sessid);
$this->login = Alib::GetSessLogin($this->sessid);
if (PEAR::isError($this->login)) {
@ -458,21 +457,21 @@ class uiBase
* @param array $input
* array of form-elements
*/
// function _dateArr2Str(&$input)
// {
// foreach ($input as $k => $v){
// if (is_array($v)) {
// if ( ( isset($v['d']) ) && ( isset($v['M']) || isset($v['m']) ) && ( isset($v['Y']) || isset($v['y']) ) ) {
// $input[$k] = $v['Y'].$v['y'].'-'.sprintf('%02d', $v['M'].$v['m']).'-'.sprintf('%02d', $v['d']);
// }
// if ( ( isset($v['H']) ) || isset($v['h'] ) && ( isset($v['i']) ) && ( isset($v['s']) ) ) {
// $input[$k] = sprintf('%02d', $v['H'].$v['h']).':'.sprintf('%02d', $v['i']).':'.sprintf('%02d', $v['s']);
// }
// }
// }
//
// return $input;
// } // fn _dateArr2Str
// function _dateArr2Str(&$input)
// {
// foreach ($input as $k => $v){
// if (is_array($v)) {
// if ( ( isset($v['d']) ) && ( isset($v['M']) || isset($v['m']) ) && ( isset($v['Y']) || isset($v['y']) ) ) {
// $input[$k] = $v['Y'].$v['y'].'-'.sprintf('%02d', $v['M'].$v['m']).'-'.sprintf('%02d', $v['d']);
// }
// if ( ( isset($v['H']) ) || isset($v['h'] ) && ( isset($v['i']) ) && ( isset($v['s']) ) ) {
// $input[$k] = sprintf('%02d', $v['H'].$v['h']).':'.sprintf('%02d', $v['i']).':'.sprintf('%02d', $v['s']);
// }
// }
// }
//
// return $input;
// } // fn _dateArr2Str
/**
@ -482,35 +481,35 @@ class uiBase
* local ID of file
* @param string $format
*/
// public function analyzeFile($id, $format)
// {
// $ia = $this->gb->analyzeFile($id, $this->sessid);
// $s = $ia['playtime_seconds'];
// $extent = date('H:i:s', floor($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.'));
//
// if ($format=='text') {
// return "<div align='left'><pre>".var_export($ia, TRUE)."</pre></div>";
// }
// return FALSE;
// }
// public function analyzeFile($id, $format)
// {
// $ia = $this->gb->analyzeFile($id, $this->sessid);
// $s = $ia['playtime_seconds'];
// $extent = date('H:i:s', floor($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.'));
//
// if ($format=='text') {
// return "<div align='left'><pre>".var_export($ia, TRUE)."</pre></div>";
// }
// return FALSE;
// }
// public function toHex($gunid)
// {
// global $CC_DBC;
// $res = $CC_DBC->query("SELECT to_hex($gunid)");
// $row = $res->fetchRow();
// return $row['to_hex'];
// }
// public function toHex($gunid)
// {
// global $CC_DBC;
// $res = $CC_DBC->query("SELECT to_hex($gunid)");
// $row = $res->fetchRow();
// return $row['to_hex'];
// }
// public function toInt8($gunid)
// {
// global $CC_DBC;
// $res = $CC_DBC->query("SELECT x'$gunid'::bigint");
// $row = $res->fetchRow();
// return $row['int8'];
// }
// public function toInt8($gunid)
// {
// global $CC_DBC;
// $res = $CC_DBC->query("SELECT x'$gunid'::bigint");
// $row = $res->fetchRow();
// return $row['int8'];
// }
/**
@ -594,5 +593,5 @@ class uiBase
return $str;
}
} // class uiBase
?>
} // class uiBase
?>

View File

@ -347,45 +347,45 @@ class uiHandler extends uiBase {
* @param unknown_type $langid
* @return void
*/
// function translateMetadata($id, $langid=UI_DEFAULT_LANGID)
// {
// include(dirname(__FILE__).'/formmask/metadata.inc.php');
//
// $ia = $this->gb->analyzeFile($id, $this->sessid);
// if (PEAR::isError($ia)) {
// $this->_retMsg($ia->getMessage());
// return;
// }
// // This is really confusing: the import script does not do it
// // this way. Which way is the right way?
// $this->setMetadataValue($id, UI_MDATA_KEY_DURATION, Playlist::secondsToPlaylistTime($ia['playtime_seconds']));
//// $this->setMetadataValue($id, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_FILE);
//
// // some data from raw audio
//// if (isset($ia['audio']['channels'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_CHANNELS, $ia['audio']['channels']);
//// }
//// if (isset($ia['audio']['sample_rate'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_SAMPLERATE, $ia['audio']['sample_rate']);
//// }
//// if (isset($ia['audio']['bitrate'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_BITRATE, $ia['audio']['bitrate']);
//// }
//// if (isset($ia['audio']['codec'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']);
//// }
//
// // from id3 Tags
// // loop main, music, talk
// foreach ($mask['pages'] as $key => $val) {
// // loop through elements
// foreach ($mask['pages'][$key] as $k => $v) {
// if (isset($v['element']) && isset($ia[$v['element']])) {
// $this->setMetadataValue($id, $v['element'], $ia[$v['element']], $langid);
// }
// }
// }
// }
// function translateMetadata($id, $langid=UI_DEFAULT_LANGID)
// {
// include(dirname(__FILE__).'/formmask/metadata.inc.php');
//
// $ia = $this->gb->analyzeFile($id, $this->sessid);
// if (PEAR::isError($ia)) {
// $this->_retMsg($ia->getMessage());
// return;
// }
// // This is really confusing: the import script does not do it
// // this way. Which way is the right way?
// $this->setMetadataValue($id, UI_MDATA_KEY_DURATION, Playlist::secondsToPlaylistTime($ia['playtime_seconds']));
//// $this->setMetadataValue($id, UI_MDATA_KEY_FORMAT, UI_MDATA_VALUE_FORMAT_FILE);
//
// // some data from raw audio
//// if (isset($ia['audio']['channels'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_CHANNELS, $ia['audio']['channels']);
//// }
//// if (isset($ia['audio']['sample_rate'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_SAMPLERATE, $ia['audio']['sample_rate']);
//// }
//// if (isset($ia['audio']['bitrate'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_BITRATE, $ia['audio']['bitrate']);
//// }
//// if (isset($ia['audio']['codec'])) {
//// $this->setMetadataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']);
//// }
//
// // from id3 Tags
// // loop main, music, talk
// foreach ($mask['pages'] as $key => $val) {
// // loop through elements
// foreach ($mask['pages'][$key] as $k => $v) {
// if (isset($v['element']) && isset($ia[$v['element']])) {
// $this->setMetadataValue($id, $v['element'], $ia[$v['element']], $langid);
// }
// }
// }
// }
/**
@ -491,15 +491,15 @@ class uiHandler extends uiBase {
* @param int $id
* destination folder id
*/
// function rename($newname, $id)
// {
// $r = $this->gb->renameFile($id, $newname, $this->sessid);
// if (PEAR::isError($r)) {
// $this->_retMsg($r->getMessage());
// }
// //$this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
// $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
// } // fn rename
// function rename($newname, $id)
// {
// $r = $this->gb->renameFile($id, $newname, $this->sessid);
// if (PEAR::isError($r)) {
// $this->_retMsg($r->getMessage());
// }
// //$this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
// $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid;
// } // fn rename
/**
@ -731,7 +731,7 @@ class uiHandler extends uiBase {
}
return TRUE;
} // fn changeStationPrefs
}
} // class uiHandler
}
?>

View File

@ -32,11 +32,11 @@ class uiPlaylist
public function setReload($url=NULL)
{
if($url)
if($url) {
$this->Base->redirUrl = $url;
else
} else {
$this->Base->redirUrl = $this->reloadUrl;
}
} // fn setReload

View File

@ -1,13 +1,9 @@
<?php
/**
* @package Campcaster
* @subpackage htmlUI
* @copyright 2010 Sourcefabric O.P.S.
*/
* @package Campcaster
* @subpackage htmlUI
* @copyright 2010 Sourcefabric O.P.S.
*/
class uiScratchPad
{
/**
@ -150,10 +146,11 @@ class uiScratchPad
$scratchpad = $this->get();
foreach ($ids as $id) {
if($type === 'playlist')
if($type === 'playlist') {
$item = $this->Base->getPLMetaInfo($id);
else
} else {
$item = $this->Base->getMetaInfo($id);
}
foreach ($scratchpad as $key => $val) {
if ($val['id'] == $item['id']) {
@ -259,12 +256,13 @@ class uiScratchPad
public function reloadMetadata()
{
foreach ($this->items as $key => $val) {
if($val['type'] === 'playlist')
if ($val['type'] === 'playlist') {
$this->items[$key] = $this->Base->getPLMetaInfo($val['id']);
else
} else {
$this->items[$key] = $this->Base->getMetaInfo($val['id']);
}
}
}
public function reloadActivePLMetadata($id)
{

View File

@ -32,7 +32,7 @@ echo " *** Database Installation ***\n";
// Create the database user
$command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} "
." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null";
." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null";
//echo $command."\n";
@exec($command, $output, $results);
if ($results == 0) {
@ -249,9 +249,9 @@ if (!camp_db_table_exists($CC_CONFIG['filesTable'])) {
camp_install_query($sql, false);
// $sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['filesTable']."_id_idx
// ON ".$CC_CONFIG['filesTable']." (id)";
// camp_install_query($sql, false);
// $sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['filesTable']."_id_idx
// ON ".$CC_CONFIG['filesTable']." (id)";
// camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['filesTable']."_gunid_idx
ON ".$CC_CONFIG['filesTable']." (gunid)";
@ -524,8 +524,8 @@ if (!camp_db_table_exists($CC_CONFIG['prefTable'])) {
echo " * Inserting starting data into table ".$CC_CONFIG['prefTable']."...";
$stPrefGr = Subjects::GetSubjId($CC_CONFIG['StationPrefsGr']);
Prefs::Insert($CC_CONFIG["systemPrefId"], 'stationName', "Radio Station 1");
// $genres = file_get_contents( dirname(__FILE__).'/../genres.xml');
// Prefs::Insert($CC_CONFIG["systemPrefId"], 'genres', $genres);
// $genres = file_get_contents( dirname(__FILE__).'/../genres.xml');
// Prefs::Insert($CC_CONFIG["systemPrefId"], 'genres', $genres);
echo "done.\n";
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['prefTable']."\n";

View File

@ -21,11 +21,11 @@ $stid = $bs->storId;
function admDumpFolder(&$bs, $fid, $ind='')
{
// NOTE: need to fix this, removed due to tree removal
// $name = M2tree::GetObjName($fid);
// if (PEAR::isError($name)) {
// echo $name->getMessage();
// exit;
// }
// $name = M2tree::GetObjName($fid);
// if (PEAR::isError($name)) {
// echo $name->getMessage();
// exit;
// }
$media = StoredFile::Recall($fid);
$type = $media->getType();
$gunid = $media->getGunid();
@ -105,19 +105,19 @@ function admDumpGroup(&$bs, $gid, $ind='')
$tagarr['content'] = $res;
}
return XML_Util::createTagFromArray($tagarr, $res === '');
// if (!$res) {
// } else {
// return XML_Util::createTagFromArray(array(
// 'namespace' => NSPACE,
// 'localPart' => 'group',
// 'attributes'=> $pars,
// 'content' => $res,
// ), FALSE);
// }
// if (!$res) {
// } else {
// return XML_Util::createTagFromArray(array(
// 'namespace' => NSPACE,
// 'localPart' => 'group',
// 'attributes'=> $pars,
// 'content' => $res,
// ), FALSE);
// }
}
function admDumpSubjects(&$bs, $ind='')
{
}
function admDumpSubjects(&$bs, $ind='')
{
$res ='';
$subjs = Subjects::GetSubjects('id, login, pass, type');
foreach ($subjs as $i => $member) {
@ -141,20 +141,20 @@ function admDumpSubjects(&$bs, $ind='')
break;
}
}
# return "$ind<subjects>\n$res$ind</subjects>\n";
# return "$ind<subjects>\n$res$ind</subjects>\n";
return XML_Util::createTagFromArray(array(
'namespace' => NSPACE,
'localPart' => 'subjects',
'content'=> $res,
), FALSE);
}
}
function admDumpPrefs(&$bs, $subjid)
{
function admDumpPrefs(&$bs, $subjid)
{
$res ='';
$pr = new Prefs($bs);
$prefkeys = $pr->readKeys($subjid);
# var_dump($subjid); var_dump($prefkeys); #exit;
# var_dump($subjid); var_dump($prefkeys); #exit;
foreach ($prefkeys as $i => $prefk) {
$keystr = $prefk['keystr'];
$prefval = $pr->readVal($subjid, $keystr);
@ -173,24 +173,24 @@ function admDumpPrefs(&$bs, $subjid)
'localPart' => 'preferences',
'content'=> $res,
), FALSE);
}
}
$subjects = admDumpSubjects($bs, ' ');
$tree = admDumpFolder($bs, $stid, ' ');
$subjects = admDumpSubjects($bs, ' ');
$tree = admDumpFolder($bs, $stid, ' ');
$res = XML_Util::getXMLDeclaration("1.0", "UTF-8")."\n";
$node = XML_Util::createTagFromArray(array(
$res = XML_Util::getXMLDeclaration("1.0", "UTF-8")."\n";
$node = XML_Util::createTagFromArray(array(
'namespace' => NSPACE,
'localPart' => 'storageServer',
'content' => "$subjects$tree",
), FALSE);
$res .= $node;
), FALSE);
$res .= $node;
$fmt = new XML_Beautifier();
$res = $fmt->formatString($res);
$fmt = new XML_Beautifier();
$res = $fmt->formatString($res);
#var_export($res);
#var_dump($res);
echo "$res";
#var_export($res);
#var_dump($res);
echo "$res";
?>
?>

View File

@ -184,10 +184,10 @@ function camp_import_audio_file($p_filepath, $p_importMode = null, $p_testOnly =
}
}
// $timeBegin = microtime(true);
// $timeBegin = microtime(true);
$md5sum = md5_file($p_filepath);
// $timeEnd = microtime(true);
// echo " * MD5 time: ".($timeEnd-$timeBegin)."\n";
// $timeEnd = microtime(true);
// echo " * MD5 time: ".($timeEnd-$timeBegin)."\n";
// Look up md5sum in database
$duplicate = StoredFile::RecallByMd5($md5sum);