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

View file

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

View file

@ -288,42 +288,42 @@ class Backup
*/ */
private function setFilenames() private function setFilenames()
{ {
// if ($this->loglevel=='debug') { // if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames\n"); // $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames\n");
// } // }
// if (is_array($this->ids)) { // if (is_array($this->ids)) {
// foreach ($this->ids as $i => $item) { // foreach ($this->ids as $i => $item) {
// $gunid = $item['gunid']; // $gunid = $item['gunid'];
// // get a stored file object of this gunid // // get a stored file object of this gunid
// $sf = StoredFile::RecallByGunid($gunid); // $sf = StoredFile::RecallByGunid($gunid);
// if (is_null($sf) || PEAR::isError($sf)) { // if (is_null($sf) || PEAR::isError($sf)) {
// return $sf; // return $sf;
// } // }
// $lid = BasicStor::IdFromGunid($gunid); // $lid = BasicStor::IdFromGunid($gunid);
// if (($res = BasicStor::Authorize('read', $lid, $this->sessid)) !== TRUE) { // if (($res = BasicStor::Authorize('read', $lid, $this->sessid)) !== TRUE) {
// $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - authorize gunid:$gunid\n"); // $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - authorize gunid:$gunid\n");
// return PEAR::raiseError('Backup::setFilenames : Authorize ... error.'); // return PEAR::raiseError('Backup::setFilenames : Authorize ... error.');
// } // }
// // if the file is a playlist then it has only a meta file // // if the file is a playlist then it has only a meta file
// if (strtolower($sf->md->format) != 'playlist') { // if (strtolower($sf->md->format) != 'playlist') {
// $this->filenames[] = array( // $this->filenames[] = array(
// 'filename' => $sf->getRealFileName(), // 'filename' => $sf->getRealFileName(),
// 'format' => $sf->md->format // 'format' => $sf->md->format
// ); // );
// } // }
// $this->filenames[] = array( // $this->filenames[] = array(
// 'filename' => $sf->getRealMetadataFileName(), // 'filename' => $sf->getRealMetadataFileName(),
// 'format' => $sf->md->format // 'format' => $sf->md->format
// ); // );
// if ($this->loglevel=='debug') { // if ($this->loglevel=='debug') {
// $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames - add file: {$sf->md->format}|".$sf->getRealMetadataFileName()."\n"); // $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames - add file: {$sf->md->format}|".$sf->getRealMetadataFileName()."\n");
// } // }
// } // }
// return $this->filenames; // return $this->filenames;
// } else { // } else {
// $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - The IDs variable isn't array.\n"); // $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.'); // 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 * session id
* @return string access token * @return string access token
*/ */
// function accessFile($id, $sessid='') // function accessFile($id, $sessid='')
// { // {
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { // if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res; // return $res;
// } // }
// $gunid = BasicStor::GunidFromId($id); // $gunid = BasicStor::GunidFromId($id);
// $r = BasicStor::bsAccess(NULL, '', $gunid, 'access'); // $r = BasicStor::bsAccess(NULL, '', $gunid, 'access');
// if (PEAR::isError($r)) { // if (PEAR::isError($r)) {
// return $r; // return $r;
// } // }
// $token = $r['token']; // $token = $r['token'];
// return $token; // return $token;
// } // fn accessFile // } // fn accessFile
/** /**
@ -131,14 +131,14 @@ class GreenBox extends BasicStor {
* session id * session id
* @return boolean * @return boolean
*/ */
// function releaseFile($token, $sessid='') // function releaseFile($token, $sessid='')
// { // {
// $r = BasicStor::bsRelease($token, 'access'); // $r = BasicStor::bsRelease($token, 'access');
// if (PEAR::isError($r)) { // if (PEAR::isError($r)) {
// return $r; // return $r;
// } // }
// return FALSE; // return FALSE;
// } // fn releaseFile // } // fn releaseFile
/** /**
@ -150,13 +150,13 @@ class GreenBox extends BasicStor {
* Session id * Session id
* @return array * @return array
*/ */
// public function analyzeFile($id, $sessid='') // public function analyzeFile($id, $sessid='')
// { // {
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { // if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res; // return $res;
// } // }
// return $this->bsAnalyzeFile($id); // return $this->bsAnalyzeFile($id);
// } // }
/** /**
@ -169,13 +169,13 @@ class GreenBox extends BasicStor {
* Session id * Session id
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
// public function renameFile($id, $newName, $sessid='') // public function renameFile($id, $newName, $sessid='')
// { // {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { // if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res; // return $res;
// } // }
// return $this->bsRenameFile($id, $newName); // return $this->bsRenameFile($id, $newName);
// } // }
/** /**
@ -191,13 +191,13 @@ class GreenBox extends BasicStor {
* session id * session id
* @return TRUE|PEAR_Error * @return TRUE|PEAR_Error
*/ */
// public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='') // public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
// { // {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { // if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res; // return $res;
// } // }
// return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP); // return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
// } // }
/** /**
@ -235,13 +235,13 @@ class GreenBox extends BasicStor {
* session id * session id
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
// public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='') // public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='')
// { // {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { // if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res; // return $res;
// } // }
// return $this->bsReplaceMetadata($id, $mdata, $mdataLoc); // return $this->bsReplaceMetadata($id, $mdata, $mdataLoc);
// } // fn replaceMetadata // } // fn replaceMetadata
/** /**
@ -288,7 +288,7 @@ class GreenBox extends BasicStor {
} }
return $storedFile->md; return $storedFile->md;
// $arr = $storedFile->md->genPhpArray(); // $arr = $storedFile->md->genPhpArray();
$md = FALSE; $md = FALSE;
foreach ($arr['children'] as $i=>$a) { foreach ($arr['children'] as $i=>$a) {
if ($a['elementname'] == 'metadata'){ if ($a['elementname'] == 'metadata'){
@ -514,10 +514,10 @@ class GreenBox extends BasicStor {
* @return string * @return string
* XML * XML
*/ */
// function getPlaylistXml($id, $sessid) // function getPlaylistXml($id, $sessid)
// { // {
// return $this->getMetadata($id, $sessid); // return $this->getMetadata($id, $sessid);
// } // fn getPlaylistXml // } // fn getPlaylistXml
/** /**
@ -1110,14 +1110,14 @@ class GreenBox extends BasicStor {
* status : string - susccess | working | fault * status : string - susccess | working | fault
* tmpfile : string - filepath to result temporary file * tmpfile : string - filepath to result temporary file
*/ */
// function renderPlaylistToRSSList($status='') // function renderPlaylistToRSSList($status='')
// { // {
// $dummytokens = array ('123456789abcdeff'); // $dummytokens = array ('123456789abcdeff');
// foreach ($dummytokens as $token) { // foreach ($dummytokens as $token) {
// $r[] = $this->renderPlaylistToRSSCheck($token); // $r[] = $this->renderPlaylistToRSSCheck($token);
// } // }
// return $r; // return $r;
// } // fn renderPlaylistToRSSList // } // fn renderPlaylistToRSSList
/** /**
@ -1575,11 +1575,11 @@ class GreenBox extends BasicStor {
* @return array * @return array
* search result format (see localSearch) * search result format (see localSearch)
*/ */
// public function getSearchResults($trtok, $andClose=TRUE) // public function getSearchResults($trtok, $andClose=TRUE)
// { // {
// $tr = new Transport($this); // $tr = new Transport($this);
// return $tr->getSearchResults($trtok, $andClose); // return $tr->getSearchResults($trtok, $andClose);
// } // fn getSearchResults // } // fn getSearchResults
/* ========================================================= info methods */ /* ========================================================= info methods */
@ -1722,5 +1722,5 @@ class GreenBox extends BasicStor {
return $res; return $res;
} // fn removePerm } // fn removePerm
} // class GreenBox } // class GreenBox
?> ?>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -38,12 +38,12 @@ class ScheduleGroup {
* @return string * @return string
* The end time, to the nearest second. * The end time, to the nearest second.
*/ */
// protected function calculateEndTime($p_startTime, $p_trackTime) { // protected function calculateEndTime($p_startTime, $p_trackTime) {
// $p_trackTime = substr($p_startTime, 0, ); // $p_trackTime = substr($p_startTime, 0, );
// $start = new DateTime(); // $start = new DateTime();
// $interval = new DateInterval() // $interval = new DateInterval()
// //
// } // }
/** /**
* Add a music clip or playlist to the schedule. * Add a music clip or playlist to the schedule.
@ -109,6 +109,7 @@ class ScheduleGroup {
// Check if there are any conflicts with existing entries // Check if there are any conflicts with existing entries
$length = trim($playlist->getLength()); $length = trim($playlist->getLength());
var_dump($length);
if (empty($length)) { if (empty($length)) {
return new PEAR_Error("Length is empty."); return new PEAR_Error("Length is empty.");
} }
@ -122,8 +123,10 @@ class ScheduleGroup {
$itemStartTime = $p_datetime; $itemStartTime = $p_datetime;
$plItems = $playlist->getContents(); $plItems = $playlist->getContents();
var_dump($plItems);
foreach ($plItems as $row) { foreach ($plItems as $row) {
$trackLength = $row["cliplength"]; $trackLength = $row["cliplength"];
var_dump($trackLength);
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
." (id, playlist_id, starts, ends, group_id, file_id," ." (id, playlist_id, starts, ends, group_id, file_id,"
." clip_length, cue_in, cue_out, fade_in, fade_out)" ." clip_length, cue_in, cue_out, fade_in, fade_out)"
@ -198,7 +201,7 @@ class ScheduleGroup {
public function reschedule($toDateTime) { public function reschedule($toDateTime) {
global $CC_CONFIG, $CC_DBC; 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') " ." WHERE (starts >= '$p_datetime') "
." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))"; ." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))";
//$_SESSION["debug"] = $sql; //$_SESSION["debug"] = $sql;
var_dump($sql);
$count = $CC_DBC->GetOne($sql); $count = $CC_DBC->GetOne($sql);
var_dump($count);
return ($count == '0'); return ($count == '0');
} }
// public function onAddTrackToPlaylist($playlistId, $audioTrackId) { // public function onAddTrackToPlaylist($playlistId, $audioTrackId) {
// //
// } // }
// //
// public function onRemoveTrackFromPlaylist($playlistId, $audioTrackId) { // public function onRemoveTrackFromPlaylist($playlistId, $audioTrackId) {
// //
// } // }
/** /**
* Return TRUE if file is going to be played in the future. * 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'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
), ),
// 'ls:genre' => array( // 'ls:genre' => array(
// array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"), // array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), // array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE), // array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
// array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), // array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), // array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// ), // ),
'ls:channels' => array( 'ls:channels' => array(
array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE), array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE),
), ),
@ -980,42 +980,42 @@ class StoredFile {
* 'file'|'string' * 'file'|'string'
* @return TRUE|PEAR_Error * @return TRUE|PEAR_Error
*/ */
// public function replace($p_oid, $p_name, $p_localFilePath='', $p_metadata='', // public function replace($p_oid, $p_name, $p_localFilePath='', $p_metadata='',
// $p_mdataLoc='file') // $p_mdataLoc='file')
// { // {
// global $CC_CONFIG, $CC_DBC; // global $CC_CONFIG, $CC_DBC;
// $CC_DBC->query("BEGIN"); // $CC_DBC->query("BEGIN");
// $res = $this->setName($p_name); // $res = $this->setName($p_name);
// if (PEAR::isError($res)) { // if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK"); // $CC_DBC->query("ROLLBACK");
// return $res; // return $res;
// } // }
// if ($p_localFilePath != '') { // if ($p_localFilePath != '') {
// $res = $this->setRawMediaData($p_localFilePath); // $res = $this->setRawMediaData($p_localFilePath);
// } else { // } else {
// $res = $this->deleteFile(); // $res = $this->deleteFile();
// } // }
// if (PEAR::isError($res)) { // if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK"); // $CC_DBC->query("ROLLBACK");
// return $res; // return $res;
// } // }
// if ($p_metadata != '') { // if ($p_metadata != '') {
// $res = $this->setMetadata($p_metadata, $p_mdataLoc); // $res = $this->setMetadata($p_metadata, $p_mdataLoc);
// } else { // } else {
//// $res = $this->md->delete(); //// $res = $this->md->delete();
// $res = $this->clearMetadata(); // $res = $this->clearMetadata();
// } // }
// if (PEAR::isError($res)) { // if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK"); // $CC_DBC->query("ROLLBACK");
// return $res; // return $res;
// } // }
// $res = $CC_DBC->query("COMMIT"); // $res = $CC_DBC->query("COMMIT");
// if (PEAR::isError($res)) { // if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK"); // $CC_DBC->query("ROLLBACK");
// return $res; // return $res;
// } // }
// return TRUE; // return TRUE;
// } // }
/** /**
@ -1077,10 +1077,10 @@ class StoredFile {
return $res; return $res;
} }
} }
// $r = $this->md->regenerateXmlFile(); // $r = $this->md->regenerateXmlFile();
// if (PEAR::isError($r)) { // if (PEAR::isError($r)) {
// return $r; // return $r;
// } // }
return TRUE; return TRUE;
} }
@ -1109,21 +1109,21 @@ class StoredFile {
* (NULL = no validation) * (NULL = no validation)
* @return boolean * @return boolean
*/ */
// public function setMetadata($p_metadata, $p_mdataLoc='file', $p_format=NULL) // public function setMetadata($p_metadata, $p_mdataLoc='file', $p_format=NULL)
// { // {
// global $CC_CONFIG, $CC_DBC; // global $CC_CONFIG, $CC_DBC;
// $CC_DBC->query("BEGIN"); // $CC_DBC->query("BEGIN");
// $res = $this->md->replace($p_metadata, $p_mdataLoc, $p_format); // $res = $this->md->replace($p_metadata, $p_mdataLoc, $p_format);
// if (PEAR::isError($res)) { // if (PEAR::isError($res)) {
// $CC_DBC->query("ROLLBACK"); // $CC_DBC->query("ROLLBACK");
// return $res; // return $res;
// } // }
// $res = $CC_DBC->query("COMMIT"); // $res = $CC_DBC->query("COMMIT");
// if (PEAR::isError($res)) { // if (PEAR::isError($res)) {
// return $res; // return $res;
// } // }
// return TRUE; // return TRUE;
// } // }
/** /**
* Set metadata element value * Set metadata element value
@ -1529,13 +1529,13 @@ class StoredFile {
{ {
return md5(uniqid("", true)); return md5(uniqid("", true));
// $ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''); // $ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '');
// $initString = microtime().$ip.rand(); // $initString = microtime().$ip.rand();
// $hash = md5($initString); // $hash = md5($initString);
// // non-negative int8 // // non-negative int8
// $hsd = substr($hash, 0, 1); // $hsd = substr($hash, 0, 1);
// $res = dechex(hexdec($hsd)>>1).substr($hash, 1, 15); // $res = dechex(hexdec($hsd)>>1).substr($hash, 1, 15);
// return StoredFile::NormalizeGunid($res); // return StoredFile::NormalizeGunid($res);
} }
@ -1544,10 +1544,10 @@ class StoredFile {
* *
* @return string * @return string
*/ */
// public static function NormalizeGunid($p_gunid) // public static function NormalizeGunid($p_gunid)
// { // {
// return str_pad($p_gunid, 16, "0", STR_PAD_LEFT); // return str_pad($p_gunid, 16, "0", STR_PAD_LEFT);
// } // }
/** /**
@ -1666,18 +1666,18 @@ class StoredFile {
* *
* @return string * @return string
*/ */
// private function _getResDir() // private function _getResDir()
// { // {
// global $CC_CONFIG, $CC_DBC; // global $CC_CONFIG, $CC_DBC;
// $resDir = $CC_CONFIG['storageDir']."/".substr($this->gunid, 0, 3); // $resDir = $CC_CONFIG['storageDir']."/".substr($this->gunid, 0, 3);
// //$this->gb->debugLog("$resDir"); // //$this->gb->debugLog("$resDir");
// // see Transport::_getResDir too for resDir name create code // // see Transport::_getResDir too for resDir name create code
// if (!is_dir($resDir)) { // if (!is_dir($resDir)) {
// mkdir($resDir, 02775); // mkdir($resDir, 02775);
// chmod($resDir, 02775); // chmod($resDir, 02775);
// } // }
// return $resDir; // return $resDir;
// } // }
/** /**
@ -1725,5 +1725,5 @@ class StoredFile {
return $CC_CONFIG['accessDir']."/$p_token.$p_ext"; return $CC_CONFIG['accessDir']."/$p_token.$p_ext";
} }
} // class StoredFile } // class StoredFile
?> ?>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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