added optional parameter number_of_days for getting schedule information
This commit is contained in:
parent
2a0c9769aa
commit
b1e71e5adf
|
@ -314,6 +314,27 @@ class ApiController extends Zend_Controller_Action
|
|||
"saturday", "sunday");
|
||||
|
||||
$result = array();
|
||||
|
||||
if(isset($_GET['number_of_days'])){ //allows for schedule to be returned for multiple days
|
||||
for ($i=0; $i<$number_of_days; $i++) {
|
||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "ALL", $utcDayEnd);
|
||||
$utcDayStart = $utcDayEnd;
|
||||
|
||||
Application_Model_Show::convertToLocalTimeZone($shows,
|
||||
array("starts", "ends", "start_timestamp",
|
||||
"end_timestamp"));
|
||||
|
||||
$result[$i] = $shows;
|
||||
}
|
||||
// XSS exploit prevention
|
||||
for ($i=0; $i<$number_of_days; $i++) {
|
||||
foreach ($result[$i] as &$show) {
|
||||
$show["name"] = htmlspecialchars($show["name"]);
|
||||
$show["url"] = htmlspecialchars($show["url"]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for ($i=0; $i<7; $i++) {
|
||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "ALL", $utcDayEnd);
|
||||
|
@ -325,7 +346,6 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$result[$dow[$i]] = $shows;
|
||||
}
|
||||
|
||||
// XSS exploit prevention
|
||||
foreach ($dow as $d) {
|
||||
foreach ($result[$d] as &$show) {
|
||||
|
@ -333,6 +353,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$show["url"] = htmlspecialchars($show["url"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
||||
|
|
Loading…
Reference in New Issue