Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-09-07 17:38:35 -04:00
commit 33035a4212
4 changed files with 204 additions and 191 deletions

View File

@ -371,15 +371,15 @@ class ApiController extends Zend_Controller_Action
public function recordedShowsAction() public function recordedShowsAction()
{ {
$today_timestamp = date("Y-m-d H:i:s"); $today_timestamp = date("Y-m-d H:i:s");
$now = new DateTime($today_timestamp); $now = new DateTime($today_timestamp);
$end_timestamp = $now->add(new DateInterval("PT2H")); $end_timestamp = $now->add(new DateInterval("PT2H"));
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s"); $end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
$this->view->shows = $this->view->shows =
Application_Model_Show::getShows( Application_Model_Show::getShows(
Application_Common_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()), Application_Common_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()),
Application_Common_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()), Application_Common_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()),
$excludeInstance = null, $onlyRecord = true); $onlyRecord = true);
$this->view->is_recording = false; $this->view->is_recording = false;
$this->view->server_timezone = Application_Model_Preference::GetTimezone(); $this->view->server_timezone = Application_Model_Preference::GetTimezone();

View File

@ -88,7 +88,7 @@ class Application_Model_RabbitMq
$temp['server_timezone'] = Application_Model_Preference::GetTimezone(); $temp['server_timezone'] = Application_Model_Preference::GetTimezone();
if ($event_type == "update_recorder_schedule") { if ($event_type == "update_recorder_schedule") {
$temp['shows'] = Application_Model_Show::getShows($now, $temp['shows'] = Application_Model_Show::getShows($now,
$end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE); $end_timestamp, $onlyRecord=TRUE);
} }
$data = json_encode($temp); $data = json_encode($temp);
$msg = new AMQPMessage($data, array('content_type' => 'text/plain')); $msg = new AMQPMessage($data, array('content_type' => 'text/plain'));

View File

@ -84,6 +84,10 @@ class Application_Model_Show
return $show->getDbUrl(); return $show->getDbUrl();
} }
/*TODO : This method is not actually used anywhere as far as I can tell. We
can safely remove it and probably many other superfluous methods.
--RG*/
public function setUrl($p_url) public function setUrl($p_url)
{ {
$show = CcShowQuery::create()->findPK($this->_showId); $show = CcShowQuery::create()->findPK($this->_showId);
@ -178,29 +182,30 @@ class Application_Model_Show
->filterByDbShowId($this->_showId) ->filterByDbShowId($this->_showId)
->find($con); ->find($con);
/* Check if the show being resized and any of its repeats /* Check if the show being resized and any of its repeats * overlap
* overlap with other scheduled shows with other scheduled shows */
*/
foreach ($showInstances as $si) { foreach ($showInstances as $si) {
$startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC")); $startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC"));
$endsDateTime = new DateTime($si->getDbEnds(), new DateTimeZone("UTC")); $endsDateTime = new DateTime($si->getDbEnds(), new DateTimeZone("UTC"));
/* The user is moving the show on the calendar from the perspective of local time. /* The user is moving the show on the calendar from the perspective
* incase a show is moved across a time change border offsets should be added to the local of local time. * incase a show is moved across a time change
* timestamp and then converted back to UTC to avoid show time changes border offsets should be added to the local * timestamp and
*/ then converted back to UTC to avoid show time changes */
$startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
$endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
$newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin); $newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin);
$newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin); $newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin);
//convert our new starts/ends to UTC. //convert our new starts/ends to UTC.
$newStartsDateTime->setTimezone(new DateTimeZone("UTC")); $newStartsDateTime->setTimezone($utc);
$newEndsDateTime->setTimezone(new DateTimeZone("UTC")); $newEndsDateTime->setTimezone($utc);
$overlapping = Application_Model_Schedule::checkOverlappingShows(
$newStartsDateTime, $newEndsDateTime, true, $si->getDbId());
$overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime,
$newEndsDateTime, true, $si->getDbId());
if ($overlapping) { if ($overlapping) {
return "Cannot schedule overlapping shows.\nNote: Resizing a repeating show ". return "Cannot schedule overlapping shows.\nNote: Resizing a repeating show ".
"affects all of its repeats."; "affects all of its repeats.";
@ -208,39 +213,23 @@ class Application_Model_Show
} }
$hours = $deltaMin/60; $hours = $deltaMin/60;
if ($hours > 0) { $hours = ($hours > 0) ? floor($hours) : ceil($hours);
$hours = floor($hours); $mins = abs($deltaMin % 60);
} else {
$hours = ceil($hours);
}
$mins = abs($deltaMin%60);
//current timesamp in UTC. //current timesamp in UTC.
$current_timestamp = gmdate("Y-m-d H:i:s"); $current_timestamp = gmdate("Y-m-d H:i:s");
//update all cc_show_instances that are in the future.
$sql = "UPDATE cc_show_instances
SET ends = (ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
WHERE (show_id = {$this->_showId} AND ends > '$current_timestamp')
AND ((ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}' - starts) <= interval '24:00');";
//update cc_show_days so future shows can be created with the new duration.
//only setting new duration if it is less than or equal to 24 hours.
$sql = $sql . "
UPDATE cc_show_days SET duration = (CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
WHERE show_id = {$this->_showId}
AND ((CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}') <= interval '24:00')";
$sql_gen = <<<SQL $sql_gen = <<<SQL
UPDATE cc_show_instances UPDATE cc_show_instances
SET ends = (ends + interval :deltaDay1 + interval :interval1) SET ends = (ends + interval :deltaDay1 + interval :interval1)
WHERE (show_id = :show_id1 AND ends > :current_timestamp1) WHERE (show_id = :show_id1
AND ((ends + interval :deltaDay2 + interval :interval2 - starts) <= interval '24:00') AND ends > :current_timestamp1)
AND ((ends + interval :deltaDay2 + interval :interval2 - starts) <= interval '24:00')
UPDATE cc_show_days SET duration = (CAST(duration AS interval) + interval :deltaDay3 + interval :interval3) UPDATE cc_show_days
SET duration = (CAST(duration AS interval) + interval :deltaDay3 + interval :interval3)
WHERE show_id = :show_id2 WHERE show_id = :show_id2
AND ((CAST(duration AS interval) + interval :deltaDay4 + interval :interval4) <= interval '24:00') AND ((CAST(duration AS interval) + interval :deltaDay4 + interval :interval4) <= interval '24:00')
SQL; SQL;
Application_Common_Database::prepareAndExecute($sql_gen, Application_Common_Database::prepareAndExecute($sql_gen,
@ -258,9 +247,6 @@ SQL;
':interval4' => "$hours:$mins" ':interval4' => "$hours:$mins"
), "execute"); ), "execute");
//do both the queries at once.
//$con->exec($sql);
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$con->beginTransaction(); $con->beginTransaction();
@ -308,7 +294,9 @@ SQL;
->findOne(); ->findOne();
if (is_null($showInstancesRow)) { if (is_null($showInstancesRow)) {
$sql = "DELETE FROM cc_show WHERE id = {$this->_showId}"; $sql = "DELETE FROM cc_show WHERE id = :show_id";
Application_Common_Database::prepareAndExecute(
$sql, array( 'show_id' => $this->_showId ), "execute");
$con->exec($sql); $con->exec($sql);
} }
@ -366,14 +354,22 @@ SQL;
$uncheckedDaysImploded = implode(",", $daysRemovedUTC); $uncheckedDaysImploded = implode(",", $daysRemovedUTC);
$showId = $this->getId(); $showId = $this->getId();
$esc_uncheckedDays = pg_escape_string($uncheckedDaysImploded);
$timestamp = gmdate("Y-m-d H:i:s"); $timestamp = gmdate("Y-m-d H:i:s");
$sql = "DELETE FROM cc_show_instances" $sql = <<<SQL
." WHERE EXTRACT(DOW FROM starts) IN ($uncheckedDaysImploded)" DELETE
." AND starts > TIMESTAMP '$timestamp'" FROM cc_show_instances
." AND show_id = $showId"; WHERE EXTRACT(DOW FROM starts) IN ($esc_uncheckedDays)
AND starts > :timestamp::TIMESTAMP
AND show_id = :showId
SQL;
$con->exec($sql); Application_Common_Database::prepareAndExecute( $sql,
array(
":timestamp" => $timestamp,
":showId" => $showId,
), "execute");
} }
/** /**
@ -422,27 +418,38 @@ SQL;
*/ */
public function getRebroadcastsAbsolute() public function getRebroadcastsAbsolute()
{ {
$con = Propel::getConnection(); $sql = <<<SQL
SELECT starts
FROM cc_show_instances
WHERE instance_id =
(SELECT id
FROM cc_show_instances
WHERE show_id = :showId
ORDER BY starts LIMIT 1)
AND rebroadcast = 1
ORDER BY starts
SQL;
$showId = $this->getId(); $rebroadcasts = Application_Common_Database::prepareAndExecute( $sql,
array( 'showId' => $this->getId() ), 'all' );
$sql = "SELECT starts FROM cc_show_instances "
."WHERE instance_id = (SELECT id FROM cc_show_instances WHERE show_id = $showId ORDER BY starts LIMIT 1) AND rebroadcast = 1 "
."ORDER BY starts";
//Logging::info($sql);
$rebroadcasts = $con->query($sql)->fetchAll();
$rebroadcastsLocal = array(); $rebroadcastsLocal = array();
//get each rebroadcast show in cc_show_instances, convert to current timezone to get start date/time. //get each rebroadcast show in cc_show_instances, convert to current timezone to get start date/time.
/*TODO: refactor the following code to get rid of the $i temporary
variable. -- RG*/
$i = 0; $i = 0;
foreach ($rebroadcasts as $show) {
$startDateTime = new DateTime($show["starts"], new DateTimeZone("UTC"));
$startDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
$rebroadcastsLocal[$i]["start_date"] = $startDateTime->format("Y-m-d"); $utc = new DateTimeZone("UTC");
$rebroadcastsLocal[$i]["start_time"] = $startDateTime->format("H:i"); $dtz = new DateTimeZone( date_default_timezone_get() );
foreach ($rebroadcasts as $show) {
$startDateTime = new DateTime($show["starts"], $utc);
$startDateTime->setTimezone($dtz);
$rebroadcastsLocal[$i]["start_date"] =
$startDateTime->format("Y-m-d");
$rebroadcastsLocal[$i]["start_time"] =
$startDateTime->format("H:i");
$i = $i + 1; $i = $i + 1;
} }
@ -460,14 +467,15 @@ SQL;
*/ */
public function getRebroadcastsRelative() public function getRebroadcastsRelative()
{ {
$con = Propel::getConnection(); $sql = <<<SQL
SELECT day_offset,
$showId = $this->getId(); start_time
$sql = "SELECT day_offset, start_time FROM cc_show_rebroadcast " FROM cc_show_rebroadcast
."WHERE show_id = $showId " WHERE show_id = :showId
."ORDER BY day_offset"; ORDER BY day_offset
SQL;
return $con->query($sql)->fetchAll(); return Application_Common_Database::prepareAndExecute( $sql,
array( ':showId' => $this->getId() ), 'all' );
} }
/** /**
@ -519,15 +527,18 @@ SQL;
*/ */
public function getRepeatingEndDate() public function getRepeatingEndDate()
{ {
$con = Propel::getConnection(); $sql = <<<SQL
SELECT last_show
FROM cc_show_days
WHERE show_id = :showId
ORDER BY last_show DESC
SQL;
$showId = $this->getId(); $query = Application_Common_Database::prepareAndExecute( $sql,
$sql = "SELECT last_show FROM cc_show_days" array( 'showId' => $this->getId() ), 'column' );
." WHERE show_id = $showId"
." ORDER BY last_show DESC";
$query = $con->query($sql)->fetchColumn(0);
/* TODO: Why return empty string instead of false? very confusing --RG
*/
return ($query !== false) ? $query : ""; return ($query !== false) ? $query : "";
} }
@ -543,16 +554,15 @@ SQL;
*/ */
public function deleteAllInstances() public function deleteAllInstances()
{ {
$con = Propel::getConnection(); $sql = <<<SQL
DELETE
$timestamp = gmdate("Y-m-d H:i:s"); FROM cc_show_instances
WHERE starts > :timestamp::TIMESTAMP
$showId = $this->getId(); AND show_id = :showId
$sql = "DELETE FROM cc_show_instances" SQL;
." WHERE starts > TIMESTAMP '$timestamp'" Application_Common_Database::prepareAndExecute( $sql,
." AND show_id = $showId"; array( ':timestamp' => gmdate("Y-m-d H:i:s"),
':showId' => $this->getId()), 'execute');
$con->exec($sql);
} }
/** /**
@ -561,15 +571,16 @@ SQL;
*/ */
public function deleteAllRebroadcasts() public function deleteAllRebroadcasts()
{ {
$con = Propel::getConnection(); $sql = <<<SQL
DELETE
$timestamp = gmdate("Y-m-d H:i:s"); FROM cc_show_instances
WHERE starts > :timestamp::TIMESTAMP
$showId = $this->getId(); AND show_id :showId
$sql = "DELETE FROM cc_show_instances" AND rebroadcast 1
." WHERE starts > TIMESTAMP '$timestamp'" SQL;
." AND show_id = $showId" Application_Common_Database::prepareAndExecute( $sql,
." AND rebroadcast = 1"; array( ':showId' => $this->getId(),
':timestamp' => gmdate("Y-m-d H:i:s")), 'execute');
$con->exec($sql); $con->exec($sql);
} }
@ -652,8 +663,6 @@ SQL;
$stmt->bindParam(':showId', $showId); $stmt->bindParam(':showId', $showId);
$stmt->execute(); $stmt->execute();
//$query = $con->query($sql);
if (!$stmt) { if (!$stmt) {
return ""; return "";
} }
@ -759,25 +768,20 @@ SQL;
*/ */
public function getAllFutureInstanceIds() public function getAllFutureInstanceIds()
{ {
$con = Propel::getConnection(); $sql = <<<SQL
SELECT id
FROM cc_show_instances
WHERE show_id :showId
AND starts > :timestamp::TIMESTAMP
AND modified_instance != TRUE
SQL;
$rows = Application_Common_Database::prepareAndExecute($sql,
array( ':showId' => $this->getId(),
':timestamp' => gmdate("Y-m-d H:i:s")), "all");
$date = new Application_Common_DateHelper; return array_map( function($i) {
$timestamp = $date->getTimestamp(); return $i['id'];
}, $rows);
$showId = $this->getId();
$sql = "SELECT id from cc_show_instances"
." WHERE show_id = $showId"
." AND starts > TIMESTAMP '$timestamp'"
." AND modified_instance != TRUE";
$rows = $con->query($sql)->fetchAll();
$instance_ids = array();
foreach ($rows as $row) {
$instance_ids[] = $row["id"];
}
return $instance_ids;
} }
/* Called when a show's duration is changed (edited). /* Called when a show's duration is changed (edited).
@ -805,12 +809,11 @@ SQL;
$sql = <<<SQL $sql = <<<SQL
UPDATE cc_show_instances UPDATE cc_show_instances
SET ends = starts + :add_show_duration::INTERVAL SET ends = starts + :add_show_duration::INTERVAL
WHERE show_id = :show_id WHERE show_id = :show_id
AND ends > :timestamp::TIMESTAMP AND ends > :timestamp::TIMESTAMP
SQL; SQL;
Application_Common_Database::prepareAndExecute( $sql, array( Application_Common_Database::prepareAndExecute( $sql, array(
':add_show_duration' => $p_data['add_show_duration'], ':add_show_duration' => $p_data['add_show_duration'],
@ -874,14 +877,11 @@ SQL;
public function getShowDays() public function getShowDays()
{ {
$showDays = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->find(); $showDays = CcShowDaysQuery::create()->filterByDbShowId(
$this->getId())->find();
$days = array(); return array_map( function($showDay) {
foreach ($showDays as $showDay) { return $showDay->getDbDay();
array_push($days, $showDay->getDbDay()); }, $showDays);
}
return $days;
} }
/* Only used for shows that aren't repeating. /* Only used for shows that aren't repeating.
@ -911,7 +911,7 @@ SQL;
public function getLiveStreamInfo() public function getLiveStreamInfo()
{ {
$info = array(); $info = array();
if ($this->_showId == null) { if ($this->getId() == null) {
return $info; return $info;
} else { } else {
$ccShow = CcShowQuery::create()->findPK($this->_showId); $ccShow = CcShowQuery::create()->findPK($this->_showId);
@ -920,7 +920,6 @@ SQL;
$info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth(); $info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth();
$info['custom_username'] = $ccShow->getDbLiveStreamUser(); $info['custom_username'] = $ccShow->getDbLiveStreamUser();
$info['custom_password'] = $ccShow->getDbLiveStreamPass(); $info['custom_password'] = $ccShow->getDbLiveStreamPass();
return $info; return $info;
} }
} }
@ -950,20 +949,24 @@ SQL;
* row in the cc_show_instances table. */ * row in the cc_show_instances table. */
public function getInstanceOnDate($p_dateTime) public function getInstanceOnDate($p_dateTime)
{ {
$con = Propel::getConnection();
$timestamp = $p_dateTime->format("Y-m-d H:i:s"); $timestamp = $p_dateTime->format("Y-m-d H:i:s");
$sql = <<<SQL
$showId = $this->getId(); SELECT id
$sql = "SELECT id FROM cc_show_instances" FROM cc_show_instances
." WHERE date(starts) = date(TIMESTAMP '$timestamp') " WHERE date(starts) = date(TIMESTAMP :timestamp)
." AND show_id = $showId AND rebroadcast = 0"; AND show_id = :showId
AND rebroadcast = 0;
$query = $con->query($sql); SQL;
$row = ($query !== false) ? $query->fetchColumn(0) : null; try {
$row = Application_Common_Database::prepareAndExecute( $sql,
return CcShowInstancesQuery::create() array( 'showId' => $this->getId(),
->findPk($row); ':timestamp' => $timestamp ), 'column');
return CcShowInstancesQuery::create()
->findPk($row);
} catch (Exception $e) {
return null;
}
} }
public function deletePossiblyInvalidInstances($p_data, $p_endDate, $isRecorded, $repeatType) public function deletePossiblyInvalidInstances($p_data, $p_endDate, $isRecorded, $repeatType)
@ -1588,7 +1591,7 @@ SQL;
* @param boolean $onlyRecord * @param boolean $onlyRecord
* @return array * @return array
*/ */
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=FALSE) public static function getShows($start_timestamp, $end_timestamp, $onlyRecord=FALSE)
{ {
$con = Propel::getConnection(); $con = Propel::getConnection();
@ -1600,42 +1603,56 @@ SQL;
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp); Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
} }
$sql = "SELECT si1.starts AS starts, si1.ends AS ends, si1.record AS record, si1.rebroadcast AS rebroadcast, si2.starts AS parent_starts, $sql = <<<SQL
si1.instance_id AS record_id, si1.show_id AS show_id, show.name AS name, SELECT si1.starts AS starts,
show.color AS color, show.background_color AS background_color, si1.file_id AS file_id, si1.id AS instance_id, si1.ends AS ends,
si1.created AS created, si1.last_scheduled AS last_scheduled, si1.time_filled AS time_filled, f.soundcloud_id si1.record AS record,
FROM cc_show_instances AS si1 si1.rebroadcast AS rebroadcast,
LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id si2.starts AS parent_starts,
LEFT JOIN cc_show AS show ON show.id = si1.show_id si1.instance_id AS record_id,
LEFT JOIN cc_files AS f ON f.id = si1.file_id si1.show_id AS show_id,
WHERE si1.modified_instance = FALSE"; show.name AS name,
show.color AS color,
show.background_color AS background_color,
si1.file_id AS file_id,
si1.id AS instance_id,
si1.created AS created,
si1.last_scheduled AS last_scheduled,
si1.time_filled AS time_filled,
f.soundcloud_id
FROM cc_show_instances AS si1
LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id
LEFT JOIN cc_show AS show ON show.id = si1.show_id
LEFT JOIN cc_files AS f ON f.id = si1.file_id
WHERE si1.modified_instance = FALSE
SQL;
//only want shows that are starting at the time or later. //only want shows that are starting at the time or later.
$start_string = $start_timestamp->format("Y-m-d H:i:s"); $start_string = $start_timestamp->format("Y-m-d H:i:s");
$end_string = $end_timestamp->format("Y-m-d H:i:s"); $end_string = $end_timestamp->format("Y-m-d H:i:s");
if ($onlyRecord) { if ($onlyRecord) {
$sql .= " AND (si1.starts >= :start::TIMESTAMP AND si1.starts < timestamp :end::TIMESTAMP)";
$sql .= " AND (si1.record = 1)";
return Application_Common_Database::prepareAndExecute( $sql,
array( ':start' => $start_string,
':end' => $end_string ), 'all');
$sql = $sql." AND (si1.starts >= '{$start_string}' AND si1.starts < timestamp '{$end_string}')";
$sql = $sql." AND (si1.record = 1)";
} else { } else {
$sql .= " ". <<<SQL
$sql = $sql." AND ((si1.starts >= '{$start_string}' AND si1.starts < '{$end_string}') AND ((si1.starts >= :start1::TIMESTAMP AND si1.starts < :end1::TIMESTAMP)
OR (si1.ends > '{$start_string}' AND si1.ends <= '{$end_string}') OR (si1.ends > :start2::TIMESTAMP AND si1.ends <= :end2::TIMESTAMP)
OR (si1.starts <= '{$start_string}' AND si1.ends >= '{$end_string}'))"; OR (si1.starts <= :start3::TIMESTAMP AND si1.ends >= :end3::TIMESTAMP))
SQL;
return Application_Common_Database::prepareAndExecute( $sql,
array(
'start1' => $start_string,
'start2' => $start_string,
'start3' => $start_string,
'end1' => $end_string,
'end2' => $end_string,
'end3' => $end_string
), 'all');
} }
if (isset($excludeInstance)) {
foreach ($excludeInstance as $instance) {
$sql_exclude[] = "si1.id != {$instance}";
}
$exclude = join(" OR ", $sql_exclude);
$sql = $sql." AND ({$exclude})";
}
$result = $con->query($sql)->fetchAll();
return $result;
} }
private static function setNextPop($next_date, $show_id, $day) private static function setNextPop($next_date, $show_id, $day)
@ -1696,10 +1713,10 @@ SQL;
*/ */
public static function &getFullCalendarEvents($p_start, $p_end, $p_editable=false) public static function &getFullCalendarEvents($p_start, $p_end, $p_editable=false)
{ {
$events = array(); $events = array();
$interval = $p_start->diff($p_end); $interval = $p_start->diff($p_end);
$days = $interval->format('%a'); $days = $interval->format('%a');
$shows = Application_Model_Show::getShows($p_start, $p_end); $shows = Application_Model_Show::getShows($p_start, $p_end);
$nowEpoch = time(); $nowEpoch = time();
$timezone = date_default_timezone_get(); $timezone = date_default_timezone_get();
@ -2076,7 +2093,6 @@ SQL;
throw new Exception("Error: $msg"); throw new Exception("Error: $msg");
} }
return $rows;
} }
/** /**
@ -2102,20 +2118,16 @@ SQL;
public static function getMaxLengths() public static function getMaxLengths()
{ {
global $CC_CONFIG;
$con = Propel::getConnection(); $con = Propel::getConnection();
$sql = <<<SQL
//Not using prepared statement here since not using an variable input. SELECT column_name, character_maximum_length FROM information_schema.columns
$sql = "SELECT column_name, character_maximum_length FROM information_schema.columns" WHERE table_name = 'cc_show' AND character_maximum_length > 0
." WHERE table_name = 'cc_show' AND character_maximum_length > 0"; SQL;
$result = $con->query($sql)->fetchAll(); $result = $con->query($sql)->fetchAll();
// store result into assoc array
$assocArray = array(); $assocArray = array();
foreach ($result as $row) { foreach ($result as $row) {
$assocArray[$row['column_name']] = $row['character_maximum_length']; $assocArray[$row['column_name']] = $row['character_maximum_length'];
} }
return $assocArray; return $assocArray;
} }
} }

3
debian/control vendored
View File

@ -41,6 +41,7 @@ Depends: apache2,
sudo, sudo,
sysv-rc, sysv-rc,
tar (>= 1.22), tar (>= 1.22),
coreutils (>= 7.5) | timeout,
unzip, unzip,
vorbis-tools, vorbis-tools,
zendframework | libzend-framework-php, zendframework | libzend-framework-php,
@ -48,7 +49,7 @@ Depends: apache2,
Recommends: icecast2 Recommends: icecast2
Suggests: airtime-audio-samples, Suggests: airtime-audio-samples,
alsa-utils alsa-utils
Description: The open radio software for scheduling and remote station management. Description: open radio software for scheduling and remote station management.
Airtime is an open source application that provides remote automation Airtime is an open source application that provides remote automation
of a radio station. of a radio station.
. .