sintonia/airtime_mvc/application/common/HTTPHelper.php

45 lines
1.2 KiB
PHP
Raw Normal View History

<?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)
);
}
public static function getStationUrl()
{
$CC_CONFIG = Config::getConfig();
$baseUrl = $CC_CONFIG['baseUrl'];
$baseDir = $CC_CONFIG['baseDir'];
$basePort = $CC_CONFIG['basePort'];
if (empty($baseDir)) {
$baseDir = "/";
}
if ($baseDir[0] != "/") {
$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
}
$stationUrl = "$scheme://${baseUrl}:${basePort}${baseDir}";
return $stationUrl;
}
}