Merge branch 'cc-5709-airtime-analyzer' of github.com:sourcefabric/Airtime into cc-5709-airtime-analyzer
Conflicts: airtime_mvc/application/Bootstrap.php airtime_mvc/application/controllers/plugins/Acl_plugin.php
This commit is contained in:
commit
52f3ed816e
12 changed files with 418 additions and 1277 deletions
|
@ -17,6 +17,7 @@ require_once "Timezone.php";
|
|||
require_once "Auth.php";
|
||||
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
|
||||
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
||||
require_once __DIR__.'/controllers/plugins/Maintenance.php';
|
||||
|
||||
require_once (APPLICATION_PATH."/logging/Logging.php");
|
||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||
|
|
|
@ -6,11 +6,11 @@ bootstrap.class = "Bootstrap"
|
|||
appnamespace = "Application"
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
|
||||
;resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
|
||||
resources.frontController.plugins.putHandler = "Zend_Controller_Plugin_PutHandler"
|
||||
;load everything in the modules directory including models
|
||||
resources.modules[] = ""
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
|
||||
resources.modules[] = ""
|
||||
resources.view[] =
|
||||
; These are no longer needed. They are specified in /etc/airtime/airtime.conf:
|
||||
;resources.db.adapter = "Pdo_Pgsql"
|
||||
|
|
|
@ -111,7 +111,6 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
$controller = strtolower($request->getControllerName());
|
||||
Application_Model_Auth::pinSessionToClient(Zend_Auth::getInstance());
|
||||
|
||||
|
||||
//Ignore authentication for all access to the rest API. We do auth via API keys for this
|
||||
//and/or by OAuth.
|
||||
if (strtolower($request->getModuleName()) == "rest")
|
||||
|
|
|
@ -738,13 +738,16 @@ SQL;
|
|||
$replay_gain = is_null($item["replay_gain"]) ? "0": $item["replay_gain"];
|
||||
$replay_gain += Application_Model_Preference::getReplayGainModifier();
|
||||
|
||||
if ( !Application_Model_Preference::GetEnableReplayGain() ) {
|
||||
if (!Application_Model_Preference::GetEnableReplayGain() ) {
|
||||
$replay_gain = 0;
|
||||
}
|
||||
|
||||
$fileMetadata = CcFiles::sanitizeResponse(CcFilesQuery::create()->findPk($media_id));
|
||||
|
||||
$schedule_item = array(
|
||||
'id' => $media_id,
|
||||
'type' => 'file',
|
||||
'metadata' => $fileMetadata,
|
||||
'row_id' => $item["id"],
|
||||
'uri' => $uri,
|
||||
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
|
||||
|
|
|
@ -13,6 +13,14 @@
|
|||
*/
|
||||
class CcFiles extends BaseCcFiles {
|
||||
|
||||
//fields we should never expose through our RESTful API
|
||||
private static $privateFields = array(
|
||||
'file_exists',
|
||||
'silan_check',
|
||||
'is_scheduled',
|
||||
'is_playlist'
|
||||
);
|
||||
|
||||
public function getCueLength()
|
||||
{
|
||||
$cuein = $this->getDbCuein();
|
||||
|
@ -46,4 +54,20 @@ class CcFiles extends BaseCcFiles {
|
|||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Strips out the private fields we do not want to send back in API responses
|
||||
* @param $file a CcFiles object
|
||||
*/
|
||||
//TODO: rename this function?
|
||||
public static function sanitizeResponse($file)
|
||||
{
|
||||
$response = $file->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
foreach (self::$privateFields as $key) {
|
||||
unset($response[$key]);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
} // CcFiles
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
class Rest_MediaController extends Zend_Rest_Controller
|
||||
{
|
||||
//fields that are not modifiable via our RESTful API
|
||||
private $blackList = array(
|
||||
private static $blackList = array(
|
||||
'id',
|
||||
'directory',
|
||||
'filepath',
|
||||
|
@ -18,14 +18,6 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
'is_playlist'
|
||||
);
|
||||
|
||||
//fields we should never expose through our RESTful API
|
||||
private $privateFields = array(
|
||||
'file_exists',
|
||||
'silan_check',
|
||||
'is_scheduled',
|
||||
'is_playlist'
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
|
@ -41,7 +33,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
$files_array = array();
|
||||
foreach (CcFilesQuery::create()->find() as $file)
|
||||
{
|
||||
array_push($files_array, $this->sanitizeResponse($file));
|
||||
array_push($files_array, CcFiles::sanitizeResponse($file));
|
||||
}
|
||||
|
||||
$this->getResponse()
|
||||
|
@ -134,7 +126,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody(json_encode($this->sanitizeResponse($file)));
|
||||
->appendBody(json_encode(CcFiles::sanitizeResponse($file)));
|
||||
} else {
|
||||
$this->fileNotFoundResponse();
|
||||
}
|
||||
|
@ -201,7 +193,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->appendBody(json_encode($this->sanitizeResponse($file)));
|
||||
->appendBody(json_encode(CcFiles::sanitizeResponse($file)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +257,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody(json_encode($this->sanitizeResponse($file)));
|
||||
->appendBody(json_encode(CcFiles::sanitizeResponse($file)));
|
||||
} else {
|
||||
$file->setDbImportStatus(2)->save();
|
||||
$this->fileNotFoundResponse();
|
||||
|
@ -490,30 +482,15 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
* from outside of Airtime
|
||||
* @param array $data
|
||||
*/
|
||||
private function removeBlacklistedFieldsFromRequestData($data)
|
||||
private static function removeBlacklistedFieldsFromRequestData($data)
|
||||
{
|
||||
foreach ($this->blackList as $key) {
|
||||
foreach (self::$blackList as $key) {
|
||||
unset($data[$key]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Strips out the private fields we do not want to send back in API responses
|
||||
*/
|
||||
//TODO: rename this function?
|
||||
public function sanitizeResponse($file)
|
||||
{
|
||||
$response = $file->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
foreach ($this->privateFields as $key) {
|
||||
unset($response[$key]);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function removeEmptySubFolders($path)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue