2014-11-20 17:22:53 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Common_HTTPHelper
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Returns start and end DateTime vars from given
|
|
|
|
* HTTP Request object
|
|
|
|
*
|
|
|
|
* @param Request
|
|
|
|
* @return array(start DateTime, end DateTime)
|
|
|
|
*/
|
|
|
|
public static function getStartEndFromRequest($request)
|
|
|
|
{
|
|
|
|
return Application_Common_DateHelper::getStartEnd(
|
|
|
|
$request->getParam("start", null),
|
|
|
|
$request->getParam("end", null),
|
|
|
|
$request->getParam("timezone", null)
|
|
|
|
);
|
|
|
|
}
|
2015-02-20 20:27:16 +01:00
|
|
|
|
|
|
|
public static function getStationUrl()
|
|
|
|
{
|
|
|
|
$CC_CONFIG = Config::getConfig();
|
|
|
|
$baseUrl = $CC_CONFIG['baseUrl'];
|
|
|
|
$baseDir = $CC_CONFIG['baseDir'];
|
|
|
|
$basePort = $CC_CONFIG['basePort'];
|
|
|
|
if (empty($baseDir)) {
|
|
|
|
$baseDir = "/";
|
|
|
|
}
|
2015-03-24 15:11:25 +01:00
|
|
|
if ($baseDir[0] != "/") {
|
2015-02-25 22:09:08 +01:00
|
|
|
$baseDir = "/" . $baseDir;
|
|
|
|
}
|
2015-02-25 22:19:01 +01:00
|
|
|
|
|
|
|
$scheme = "http";
|
|
|
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
|
|
|
$scheme = "https";
|
|
|
|
$basePort = "443"; //Airtime Pro compatibility hack
|
|
|
|
}
|
|
|
|
|
2015-02-20 20:27:16 +01:00
|
|
|
$stationUrl = "$scheme://${baseUrl}:${basePort}${baseDir}";
|
|
|
|
|
|
|
|
return $stationUrl;
|
|
|
|
}
|
2014-11-20 17:22:53 +01:00
|
|
|
}
|