Merge branch 'master' of dev.sourcefabric.org:airtime

Conflicts:
	application/configs/conf.php
	install/airtime-install.php
This commit is contained in:
martin 2011-02-22 16:32:04 -05:00
commit a20e279840
64 changed files with 110 additions and 193 deletions

View File

@ -176,8 +176,4 @@ function load_airtime_config(){
'database' => $ini_array['database']['dbname']),
'api_key' => array($ini_array['general']['api_key'])
);
}
?>

View File

@ -83,7 +83,7 @@ class ApiController extends Zend_Controller_Action
//header("Content-Type: $mtype");
*/
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if ($ext == "ogg")
header("Content-Type: audio/ogg");
@ -212,4 +212,3 @@ class ApiController extends Zend_Controller_Action
}
}
?>

View File

@ -181,4 +181,3 @@ class AccessRecur {
}
} // class AccessRecur
?>

View File

@ -619,4 +619,3 @@ class Alib {
} // fn test
} // class Alib
?>

View File

@ -484,4 +484,3 @@ class Backup
}
} // classs Backup
?>

View File

@ -2182,5 +2182,5 @@ class BasicStor {
fclose($fp);
}
} // class BasicStor
?>
} // class BasicStor

View File

@ -1723,4 +1723,3 @@ class GreenBox extends BasicStor {
} // fn removePerm
} // class GreenBox
?>

View File

@ -1746,4 +1746,3 @@ class LocStor extends BasicStor {
/* ==================================================== auxiliary methods */
} // class LocStor
?>

View File

@ -349,4 +349,3 @@ class M3uPlaylistAnimateElement {
}
}
?>

View File

@ -172,7 +172,7 @@ class Playlist {
$storedPlaylist->currentlyaccessing = $pl->getDbCurrentlyaccessing();
$storedPlaylist->editedby = $pl->getDbEditedby();
$storedPlaylist->mtime = $pl->getDbMtime();
return $storedPlaylist;
}
@ -931,17 +931,17 @@ class Playlist {
if(is_null($fadeIn)) {
if($defaultFade != "")
$fadeIn = $defaultFade;
$fadeIn = $defaultFade;
else
$fadeIn = '00:00:00.000';
}
if(is_null($fadeOut)) {
if($defaultFade != "")
$fadeOut = $defaultFade;
$fadeOut = $defaultFade;
else
$fadeOut = '00:00:00.000';
}
$row = new CcPlaylistcontents();
$row->setDbPlaylistId($plId);
$row->setDbFileId($fileId);
@ -1386,4 +1386,3 @@ class PlaylistMetadataExport
}
}
?>

View File

@ -439,4 +439,4 @@ class Prefs {
}
} // class Prefs
?>

View File

@ -287,4 +287,3 @@ class Renderer
} // class Renderer
?>

View File

@ -433,4 +433,4 @@ class Restore {
}
} // class Restore
?>

View File

@ -175,7 +175,7 @@ class ScheduleGroup {
// Get the end time for the given entry
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
." WHERE group_id=$p_groupId";
$startTime = $CC_DBC->GetOne($sql);
return $this->add($show_instance, $startTime, null, $p_playlistId);
}
@ -281,8 +281,8 @@ class Schedule {
public static function getTimeUnScheduledInRange($s_datetime, $e_datetime) {
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT SUM(clip_length) FROM ".$CC_CONFIG["scheduleTable"]."
WHERE (starts >= '{$s_datetime}')
$sql = "SELECT SUM(clip_length) FROM ".$CC_CONFIG["scheduleTable"]."
WHERE (starts >= '{$s_datetime}')
AND (ends <= '{$e_datetime}')";
$time = $CC_DBC->GetOne($sql);
@ -302,12 +302,12 @@ class Schedule {
public static function getTimeScheduledInRange($s_datetime, $e_datetime) {
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT SUM(clip_length) FROM ".$CC_CONFIG["scheduleTable"]."
WHERE (starts >= '{$s_datetime}')
$sql = "SELECT SUM(clip_length) FROM ".$CC_CONFIG["scheduleTable"]."
WHERE (starts >= '{$s_datetime}')
AND (ends <= '{$e_datetime}')";
$res = $CC_DBC->GetOne($sql);
if(is_null($res))
return 0;
@ -315,9 +315,9 @@ class Schedule {
}
public static function getPercentScheduledInRange($s_datetime, $e_datetime) {
$time = Schedule::getTimeScheduledInRange($s_datetime, $e_datetime);
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$sql = "SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '{$s_datetime}')";
@ -333,11 +333,11 @@ class Schedule {
$i_epoch = $r->fetchColumn(0);
$percent = ceil(($i_epoch / ($e_epoch - $s_epoch)) * 100);
return $percent;
}
/**
* Return TRUE if file is going to be played in the future.
*
@ -447,58 +447,58 @@ class Schedule {
"timezoneOffset"=> date("Z"),
"apiKey"=>$CC_CONFIG['apiKey'][0]);
}
/**
* Builds an SQL Query for accessing scheduled item information from
* the database.
* the database.
*
* @param int $timeNow
* @param int $timePeriod
* @param int $count
* @param String $interval
* @return date
*
* $timeNow is the the currentTime in the format "Y-m-d H:i:s".
*
* $timeNow is the the currentTime in the format "Y-m-d H:i:s".
* For example: 2011-02-02 22:00:54
*
*
* $timePeriod can be either negative, zero or positive. This is used
* to indicate whether we want items from the past, present or future.
*
*
* $count indicates how many results we want to limit ourselves to.
*
*
* $interval is used to indicate how far into the past or future we
* want to search the database. For example "5 days", "18 hours", "60 minutes",
* "30 seconds" etc.
*/
public static function Get_Scheduled_Item_Data($timeStamp, $timePeriod=0, $count = 0, $interval="0 hours"){
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, show.name as show_name, st.instance_id"
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show"
." WHERE st.playlist_id = pt.id"
." AND st.file_id = ft.id"
." AND st.instance_id = si.id"
." AND si.show_id = show.id";
if ($timePeriod < 0){
$sql .= " AND st.ends < TIMESTAMP '$timeStamp'"
." AND st.ends > (TIMESTAMP '$timeStamp' - INTERVAL '$interval')"
." ORDER BY st.starts DESC"
." LIMIT $count";
." LIMIT $count";
} else if ($timePeriod == 0){
$sql .= " AND st.starts <= TIMESTAMP '$timeStamp'"
." AND st.ends >= TIMESTAMP '$timeStamp'";
." AND st.ends >= TIMESTAMP '$timeStamp'";
} else if ($timePeriod > 0){
$sql .= " AND st.starts > TIMESTAMP '$timeStamp'"
." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')"
." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')"
." ORDER BY st.starts"
." LIMIT $count";
." LIMIT $count";
}
$rows = $CC_DBC->GetAll($sql);
return $rows;
}
/**
* Convert a time string in the format "YYYY-MM-DD HH:mm:SS"
@ -704,4 +704,3 @@ class Schedule {
}
?>

View File

@ -310,4 +310,3 @@ class SmilPlaylistAnimateElement {
}
} // class SmilPlaylistAnimateElement
?>

View File

@ -492,9 +492,9 @@ class StoredFile {
$escapedValue = pg_escape_string($this->gunid);
$sql = "SELECT * FROM ".$CC_CONFIG["filesTable"]
." WHERE gunid='$escapedValue'";
$this->md = $CC_DBC->getRow($sql);
if (PEAR::isError($this->md)) {
$error = $this->md;
$this->md = null;
@ -511,7 +511,7 @@ class StoredFile {
$compatibilityData[$xmlName] = $value;
}
}
//$this->md = array_merge($this->md, $compatibilityData);
$this->md = $compatibilityData;
}
@ -706,7 +706,7 @@ class StoredFile {
$sql = "SELECT *"
." FROM ".$CC_CONFIG['filesTable']
." WHERE $cond";
$row = $CC_DBC->getRow($sql);
if (PEAR::isError($row) || is_null($row)) {
return $row;
@ -1784,7 +1784,7 @@ class StoredFile {
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS";
return StoredFile::searchFiles($fromTable, $datatables);
}
public static function searchPlaylistsForSchedule($p_length, $datatables) {
@ -1793,9 +1793,9 @@ class StoredFile {
$datatables["optWhere"][] = "plt.length <= INTERVAL '{$p_length}'";
$datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
return StoredFile::searchFiles($fromTable, $datatables);
}
}
public static function searchFiles($fromTable, $data)
{
@ -1814,8 +1814,8 @@ class StoredFile {
// Where clause
if(isset($data["optWhere"])) {
$where[] = join(" AND ", $data["optWhere"]);
$where[] = join(" AND ", $data["optWhere"]);
}
if(isset($searchTerms)) {
@ -1823,7 +1823,7 @@ class StoredFile {
$searchCols = array();
for($i=0; $i<$data["iColumns"]; $i++) {
if($data["bSearchable_".$i] == "true") {
$searchCols[] = $columnsDisplayed[$i];
}
@ -1832,14 +1832,14 @@ class StoredFile {
$outerCond = array();
foreach($searchTerms as $term) {
$innerCond = array();
foreach($searchCols as $col) {
$escapedTerm = pg_escape_string($term);
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
}
$outerCond[] = "(".join(" OR ", $innerCond).")";
$outerCond[] = "(".join(" OR ", $innerCond).")";
}
$where[] = "(".join(" AND ", $outerCond).")";
}
@ -1869,12 +1869,12 @@ class StoredFile {
else {
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
}
$results = $CC_DBC->getAll($sql);
//echo $results;
//echo $sql;
//put back to default fetch mode.
//put back to default fetch mode.
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
if(!isset($totalDisplayRows)) {
@ -1883,8 +1883,8 @@ class StoredFile {
return array("sEcho" => intval($data["sEcho"]), "iTotalDisplayRecords" => $totalDisplayRows, "iTotalRecords" => $totalRows, "aaData" => $results);
/*
@ -1921,7 +1921,7 @@ class StoredFile {
$and_cond[] = $string;
}
if(count($and_cond) > 0) {
$or_cond[] = "(".join(" ".$inner." ", $and_cond).")";
}
@ -1958,4 +1958,4 @@ class StoredFile {
}
}
?>

View File

@ -680,4 +680,4 @@ class Subjects {
} // fn test
} // class Subjects
?>

View File

@ -1830,4 +1830,4 @@ class Transport
}
?>

View File

@ -416,4 +416,4 @@ class TransportRecord
}
} // class TransportRecord
?>

View File

@ -382,4 +382,4 @@ class Validator {
} // class Validator
?>

View File

@ -395,4 +395,4 @@ class XmlParser {
}
}
?>

View File

@ -324,5 +324,3 @@ $audioClipFormat = array(
// 'regexp'=>'^\d{4}(-\d{2}(-\d{2}(T\d{2}:\d{2}(:\d{2}\.\d+)?(Z)|([\+\-]?\d{2}:\d{2}))?)?)?$',
),
);
?>

View File

@ -211,4 +211,4 @@ class Cron {
return $this->cronfile.' "'.str_replace('"','\"',serialize($this->params)).'"';
}
}
?>

View File

@ -14,4 +14,4 @@ class CronJob
{
}
}
?>

View File

@ -281,4 +281,4 @@ class Crontab
return $returnar;
}
}
?>

View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/php
<?php
chdir(dirname(__FILE__));
$p = unserialize($argv[1]);
@ -6,4 +6,3 @@ require_once (dirname(__FILE__).'/'.$p['class'].'.php');
$cronjob = new $p['class']();
$ret = $cronjob->execute($p['params']);
exit(0);
?>

View File

@ -18,4 +18,3 @@ if (!$r) {
}
exit(0);
?>

View File

@ -39,4 +39,3 @@ if (TR_LOG_LEVEL>1) {
$tr->trLog("transportCronJob($pid) end ($trtok)");
}
exit(0);
?>

View File

@ -1,17 +1,3 @@
<?php
header ("location: html/");
exit;
/*
?>
<html><head>
<title>StorageServer module</title>
</head><body>
<h3>StorageServer module</h3>
<br>
<a href="../html/" accesskey="H"><b>H</b>TML client</a><br>
<a href="../xmlrpc/" accesskey="X"><b>X</b>mlRpc test</a><br>
<a href="../tests/" accesskey="T"><b>T</b>est</a><br>
</body></html>
<?
*/
?>

View File

@ -110,8 +110,3 @@ $playlistFormat = array(
*/
);
/*
?
ls:filename Text auto
*/
?>

View File

@ -21,4 +21,4 @@ $result = PHPUnit::run($suite);
echo $result->toString();
?>

View File

@ -178,4 +178,4 @@ class PlaylistTests extends PHPUnit_TestCase {
}
}
?>

View File

@ -39,4 +39,3 @@ class SchedulerExportTests extends PHPUnit_TestCase {
}
}
?>

View File

@ -125,4 +125,3 @@ class SchedulerTests extends PHPUnit_TestCase {
}
}
?>

View File

@ -84,4 +84,3 @@ class StoredFileTest extends PHPUnit_TestCase {
}
}
?>

View File

@ -22,4 +22,3 @@ if (is_array($r)) {
print_r($r);
}
echo"\n";
?>

View File

@ -1,4 +1,3 @@
<?php
header ("location: ../");
exit;
?>

View File

@ -22,4 +22,4 @@ $sql3 = "SELECT TIMESTAMP '2011-01-01 00:00:00.000' + INTERVAL '01:00:00.123456'
$result3 = $con->query($sql3);
var_dump($result3->fetchAll());
?>

View File

@ -140,4 +140,3 @@ $comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; echo `$comm`;
if(file_exists("../trans/log")) echo `tail -n 25 ../trans/log`;
echo "#Transport test: OK.\n\n";
*/
?>

View File

@ -59,4 +59,3 @@ echo "$r\n";
echo "#storeWebstream test: OK.\n\n"
*/
?>

View File

@ -338,8 +338,3 @@ $webstreamFormat = array(
*/
);
/*
?
ls:filename Text auto
*/
?>

View File

@ -3830,4 +3830,4 @@ class XR_LocStor extends LocStor {
} // class XR_LocStor
?>

View File

@ -1,4 +1,3 @@
<?php
header ("location: xrLocStor.php");
exit;
?>

View File

@ -96,4 +96,4 @@ fclose($fp);
fclose($putdata);
header("HTTP/1.1 200");
?>

View File

@ -508,4 +508,3 @@ $r = $spc->DisplayScheduleMethod($this->Base->sessid, '20040101T00:00:00', '2005
#$r = $spc->GetSchedulerTimeMethod(); var_dump($r);
================= */
?>

View File

@ -125,4 +125,3 @@ switch ($ftype) {
// var_dump($ftype);
http_error(500, "500 Unknown ftype ($ftype)");
}
?>

View File

@ -169,4 +169,4 @@ foreach ($methods as $method => $description) {
$s = new XML_RPC_Server($defs);
?>

View File

@ -365,4 +365,3 @@ if (isset($infos[$method]['r'])) {
}
}
?>

View File

@ -3,24 +3,23 @@
class Application_Validate_UserNameValidate extends Zend_Validate_Abstract
{
const LOGIN = 'login';
protected $_messageTemplates = array(
self::LOGIN => "'%value%' is already taken"
);
public function isValid($value)
{
$this->_setValue($value);
$count = CcSubjsQuery::create()->filterByDbLogin($value)->count();
if ($count != 0) {
$this->_error(self::LOGIN);
return false;
}
return true;
}
}
?>

View File

@ -1,6 +1,6 @@
<?php
class Airtime_View_Helper_LoggedInAs extends Zend_View_Helper_Abstract
class Airtime_View_Helper_LoggedInAs extends Zend_View_Helper_Abstract
{
public function loggedInAs ()
{
@ -10,8 +10,7 @@ class Airtime_View_Helper_LoggedInAs extends Zend_View_Helper_Abstract
if ($auth->hasIdentity()) {
$username = $auth->getIdentity()->login;
}
return $username;
return $username;
}
}
?>

View File

@ -45,7 +45,7 @@ function checkIfRoot(){
if(exec("whoami") != "root"){
echo "Must be root user.\n";
exit(1);
}
}
}
function updateINIKeyValues($filename, $property, $value){
@ -62,7 +62,7 @@ function updateINIKeyValues($filename, $property, $value){
for($i=0; $i<$n; $i++){
fwrite($fp, $lines[$i]);
}
fclose($fp);
fclose($fp);
}
function directorySetup($CC_CONFIG){
@ -90,7 +90,7 @@ echo " *** Directory Setup ***\n";
//exit(1);
}
$CC_CONFIG[$d] = $rp;
}
}
}
@ -153,4 +153,4 @@ $command = __DIR__."/../utils/airtime-import --copy ../audio_samples/ > /dev/nul
$command = "python ".__DIR__."/../pypo/install/pypo-install.py";
system($command);
echo "******************************* Install Complete *******************************\n";
?>

View File

@ -227,4 +227,4 @@ airtime_uninstall_delete_files($CC_CONFIG['storageDir']);
$command = "python ".__DIR__."/../pypo/install/pypo-uninstall.py";
system($command);
echo "****************************** Uninstall Complete ******************************\n";
?>

View File

@ -99,4 +99,4 @@ if (PEAR::isError($r)) {
die($r->getMessage());
}
exit(0);
?>

View File

@ -1,4 +1,3 @@
<?php
header ("location: ../");
exit;
?>

View File

@ -84,4 +84,4 @@ function install_setDirPermissions($filePath) {
// }
}
?>

View File

@ -8,12 +8,7 @@ if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
exit(1);
}
?>
//------------------------------------------------------------------------
// Install twitter Cron job
//------------------------------------------------------------------------
<?php
require_once(dirname(__FILE__).'/../../../storageServer/var/cron/Cron.php');
$m = '*';
$h ='*';
@ -41,4 +36,4 @@ echo " adding new entry\n";
$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command);
$cron->closeCrontab();
echo "Done.\n";
?>

View File

@ -8,12 +8,7 @@ if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
exit(1);
}
?>
//------------------------------------------------------------------------
// Uninstall twitter Cron job
//------------------------------------------------------------------------
<?php
require_once(dirname(__FILE__).'/../../../storageServer/var/cron/Cron.php');
$old_regex = '/ui_twitterCron\.php/';
@ -34,4 +29,3 @@ foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) {
$cron->closeCrontab();
echo "Done.\n";
?>

View File

@ -97,4 +97,3 @@ $scheduleGroup = new ScheduleGroup();
$scheduleGroup->add($playTime, null, $pl->getId());
echo " SUCCESS: Playlist scheduled at $playTime\n\n";
?>

View File

@ -122,4 +122,3 @@ switch($argv[1]){
}
?>

View File

@ -192,5 +192,3 @@ function admDumpGroup(&$bs, $gid, $ind='')
#var_export($res);
#var_dump($res);
echo "$res";
?>

View File

@ -346,4 +346,3 @@ if ($g_errors > 0) {
echo " *** Total: ".($g_fileCount+$g_duplicates)." files in $time seconds = $speed files/second.\n";
echo "==========================================================================\n";
?>

View File

@ -252,4 +252,3 @@ foreach ($groups as $grname => $group) {
/* -------------------------------------------------------- restoring objects */
ls_restore_restoreObject($tree, /*$storId,*/ FALSE);
?>

View File

@ -1,41 +1,36 @@
#!/usr/bin/php
<?php
/**
* Do database restore in background. - command line php application
*
* required command line parameters:
* @param 1. backup file
* @param 2. status file
* @param 3. token
* @param 4. sessid
*
*/
/**
* Do database restore in background. - command line php application
*
* required command line parameters:
* @param 1. backup file
* @param 2. status file
* @param 3. token
* @param 4. sessid
*
*/
require_once(dirname(__FILE__).'/../application/configs/conf.php');
require_once(dirname(__FILE__).'/../application/models/GreenBox.php');
require_once(dirname(__FILE__).'/../application/models/Restore.php');
include_once('DB.php');
require_once(dirname(__FILE__).'/../application/configs/conf.php');
require_once(dirname(__FILE__).'/../application/models/GreenBox.php');
require_once(dirname(__FILE__).'/../application/models/Restore.php');
include_once('DB.php');
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
if (DB::isError($CC_DBC)) {
die($CC_DBC->getMessage());
}
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
if (DB::isError($CC_DBC)) {
die($CC_DBC->getMessage());
}
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
$gb = new GreenBox();
$rs = new Restore($gb);
$gb = new GreenBox();
$rs = new Restore($gb);
if ($rs->loglevel=='debug') {
$rs->addLogItem('argv:'.print_r($argv,true));
}
if ($rs->loglevel=='debug') {
$rs->addLogItem('argv:'.print_r($argv,true));
}
# sleep(2);
$backupfile = $argv[1];
$token = $argv[3];
$sessid = $argv[4];
$rs->startRestore($backupfile,$token,$sessid);
$backupfile = $argv[1];
$token = $argv[3];
$sessid = $argv[4];
$rs->startRestore($backupfile,$token,$sessid);
?>

View File

@ -22,9 +22,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author$
# Version : $Revision$
# Location : $URL$
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------