Merge branch 'saas' into cc-5709-airtime-analyzer-cloud-storage-saas
Conflicts: airtime_mvc/application/models/StoredFile.php python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py
This commit is contained in:
commit
477ac337e5
23 changed files with 70 additions and 96 deletions
|
@ -11,17 +11,19 @@ class CORSHelper
|
|||
$response = $response->setHeader('Access-Control-Allow-Origin', '*');
|
||||
$origin = $request->getHeader('Origin');
|
||||
if ((!(preg_match("/https?:\/\/localhost/", $origin) === 1)) && ($origin != "") &&
|
||||
(!in_array($origin,
|
||||
array("http://www.airtime.pro",
|
||||
"https://www.airtime.pro",
|
||||
"https://account.sourcefabric.com",
|
||||
"http://" . $_SERVER['SERVER_NAME'],
|
||||
"https://" . $_SERVER['SERVER_NAME']
|
||||
))
|
||||
))
|
||||
(!in_array($origin, self::getAllowedOrigins())))
|
||||
{
|
||||
//Don't allow CORS from other domains to prevent XSS.
|
||||
throw new Zend_Controller_Action_Exception('Forbidden', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getAllowedOrigins()
|
||||
{
|
||||
return array("http://www.airtime.pro",
|
||||
"https://www.airtime.pro",
|
||||
"https://account.sourcefabric.com",
|
||||
"http://" . $_SERVER['SERVER_NAME'],
|
||||
"https://" . $_SERVER['SERVER_NAME']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1212,9 +1212,10 @@ class ApiController extends Zend_Controller_Action
|
|||
} elseif ($djtype == "dj") {
|
||||
//check against show dj auth
|
||||
$showInfo = Application_Model_Show::getCurrentShow();
|
||||
|
||||
// there is current playing show
|
||||
if (isset($showInfo['id'])) {
|
||||
$current_show_id = $showInfo['id'];
|
||||
if (isset($showInfo[0]['id'])) {
|
||||
$current_show_id = $showInfo[0]['id'];
|
||||
$CcShow = CcShowQuery::create()->findPK($current_show_id);
|
||||
|
||||
// get custom pass info from the show
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
include('../library/phing/util/StringHelper.php');
|
||||
|
||||
class Application_Form_Login extends Zend_Form
|
||||
{
|
||||
|
||||
|
@ -10,9 +12,25 @@ class Application_Form_Login extends Zend_Form
|
|||
// Set the method for the display form to POST
|
||||
$this->setMethod('post');
|
||||
|
||||
$this->addElement('hash', 'csrf', array(
|
||||
'salt' => 'unique'
|
||||
));
|
||||
//If the request comes from an origin we consider safe, we disable the CSRF
|
||||
//token checking ONLY for the login page. We do this to allow logins from WHMCS to work.
|
||||
$request = Zend_Controller_Front::getInstance()->getRequest();
|
||||
if ($request) {
|
||||
$refererUrl = $request->getHeader('referer');
|
||||
$originIsSafe = false;
|
||||
foreach (CORSHelper::getAllowedOrigins() as $safeOrigin) {
|
||||
if (StringHelper::startsWith($safeOrigin, $refererUrl)) {
|
||||
$originIsSafe = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$originIsSafe) {
|
||||
$this->addElement('hash', 'csrf', array(
|
||||
'salt' => 'unique'
|
||||
));
|
||||
}
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/login.phtml'))
|
||||
|
|
|
@ -1112,36 +1112,37 @@ class Application_Model_Scheduler
|
|||
|
||||
$removedItems = CcScheduleQuery::create()->findPks($scheduledIds);
|
||||
|
||||
//check to make sure all items selected are up to date
|
||||
foreach ($removedItems as $removedItem) {
|
||||
// This array is used to keep track of every show instance that was
|
||||
// effected by the track deletion. It will be used later on to
|
||||
// remove gaps in the schedule and adjust crossfade times.
|
||||
$effectedInstanceIds = array();
|
||||
|
||||
foreach ($removedItems as $removedItem) {
|
||||
$instance = $removedItem->getCcShowInstances($this->con);
|
||||
$effectedInstanceIds[] = $instance->getDbId();
|
||||
|
||||
//check if instance is linked and if so get the schedule items
|
||||
//for all linked instances so we can delete them too
|
||||
if (!$cancelShow && $instance->getCcShow()->isLinked()) {
|
||||
//returns all linked instances if linked
|
||||
$ccShowInstances = $this->getInstances($instance->getDbId());
|
||||
|
||||
$instanceIds = array();
|
||||
foreach ($ccShowInstances as $ccShowInstance) {
|
||||
$instanceIds[] = $ccShowInstance->getDbId();
|
||||
}
|
||||
/*
|
||||
* Find all the schedule items that are in the same position
|
||||
* as the selected item by the user.
|
||||
* The position of each track is the same across each linked instance
|
||||
*/
|
||||
$effectedInstanceIds = array_merge($effectedInstanceIds, $instanceIds);
|
||||
|
||||
// Delete the same track, represented by $removedItem, in
|
||||
// each linked show instance.
|
||||
$itemsToDelete = CcScheduleQuery::create()
|
||||
->filterByDbPosition($removedItem->getDbPosition())
|
||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||
->find();
|
||||
foreach ($itemsToDelete as $item) {
|
||||
if (!$removedItems->contains($item)) {
|
||||
$removedItems->append($item);
|
||||
}
|
||||
}
|
||||
->filterByDbId($removedItem->getDbId(), Criteria::NOT_EQUAL)
|
||||
->delete($this->con);
|
||||
}
|
||||
|
||||
|
||||
//check to truncate the currently playing item instead of deleting it.
|
||||
if ($removedItem->isCurrentItem($this->epochNow)) {
|
||||
|
||||
|
@ -1165,29 +1166,11 @@ class Application_Model_Scheduler
|
|||
} else {
|
||||
$removedItem->delete($this->con);
|
||||
}
|
||||
|
||||
// update is_scheduled in cc_files but only if
|
||||
// the file is not scheduled somewhere else
|
||||
$fileId = $removedItem->getDbFileId();
|
||||
// check if the removed item is scheduled somewhere else
|
||||
$futureScheduledFiles = Application_Model_Schedule::getAllFutureScheduledFiles();
|
||||
if (!is_null($fileId) && !in_array($fileId, $futureScheduledFiles)) {
|
||||
$db_file = CcFilesQuery::create()->findPk($fileId, $this->con);
|
||||
$db_file->setDbIsScheduled(false)->save($this->con);
|
||||
}
|
||||
}
|
||||
Application_Model_StoredFile::updatePastFilesIsScheduled();
|
||||
|
||||
if ($adjustSched === true) {
|
||||
//get the show instances of the shows we must adjust times for.
|
||||
foreach ($removedItems as $item) {
|
||||
|
||||
$instance = $item->getDBInstanceId();
|
||||
if (!in_array($instance, $showInstances)) {
|
||||
$showInstances[] = $instance;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($showInstances as $instance) {
|
||||
foreach ($effectedInstanceIds as $instance) {
|
||||
$this->removeGaps($instance);
|
||||
$this->calculateCrossfades($instance);
|
||||
}
|
||||
|
@ -1195,7 +1178,7 @@ class Application_Model_Scheduler
|
|||
|
||||
//update the status flag in cc_schedule.
|
||||
$instances = CcShowInstancesQuery::create()
|
||||
->filterByPrimaryKeys($showInstances)
|
||||
->filterByPrimaryKeys($effectedInstanceIds)
|
||||
->find($this->con);
|
||||
|
||||
foreach ($instances as $instance) {
|
||||
|
|
|
@ -1311,7 +1311,6 @@ SQL;
|
|||
$results['nextShow'][0] = array(
|
||||
"id" => $rows[$i]['id'],
|
||||
"instance_id" => $rows[$i]['instance_id'],
|
||||
"instance_description" => $rows[$i]['instance_description'],
|
||||
"name" => $rows[$i]['name'],
|
||||
"description" => $rows[$i]['description'],
|
||||
"url" => $rows[$i]['url'],
|
||||
|
|
|
@ -362,7 +362,8 @@ SQL;
|
|||
{
|
||||
$exists = false;
|
||||
try {
|
||||
$exists = file_exists($this->getFilePath());
|
||||
$filePath = $this->getFilePath();
|
||||
$exists = (file_exists($this->getFilePath()) && !is_dir($filePath));
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -81,35 +81,6 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function clearAction()
|
||||
{
|
||||
if (!$this->verifyAuth(true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//set file_exists flag to false for every file
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
$selectCriteria = new Criteria();
|
||||
$selectCriteria->add(CcFilesPeer::FILE_EXISTS, true);
|
||||
$updateCriteria = new Criteria();
|
||||
$updateCriteria->add(CcFilesPeer::FILE_EXISTS, false);
|
||||
BasePeer::doUpdate($selectCriteria, $updateCriteria, $con);
|
||||
|
||||
//delete all files and directories under .../imported
|
||||
$path = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."/srv/airtime/stor/imported/*" : "/srv/airtime/stor/imported/*";
|
||||
exec("rm -rf $path");
|
||||
|
||||
//update disk_usage value in cc_pref
|
||||
$storDir = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."srv/airtime/stor" : "/srv/airtime/stor";
|
||||
$diskUsage = shell_exec("du -sb $storDir | awk '{print $1}'");
|
||||
Application_Model_Preference::setDiskUsage($diskUsage);
|
||||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody("Library has been cleared");
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
if (!$this->verifyAuth(true, true))
|
||||
|
@ -268,7 +239,6 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
$id = $this->getId();
|
||||
if (!$id) {
|
||||
return;
|
||||
|
|
|
@ -27,7 +27,7 @@ QUEUE = "airtime-uploads"
|
|||
Airtime's music library directory. Lastly, the extracted metadata is
|
||||
reported back to the Airtime web application.
|
||||
|
||||
There's a couple of Very Important technical details and contraints that you
|
||||
There's a couple of Very Important technical details and constraints that you
|
||||
need to know if you're going to work on this code:
|
||||
|
||||
1) airtime_analyzer is designed so it doesn't have to run on the same
|
||||
|
|
|
@ -18,7 +18,7 @@ post_file() {
|
|||
airtime_conf_path=/etc/airtime/airtime.conf
|
||||
|
||||
#maps the instance_path to the url
|
||||
vhost_file=/mnt/airtimepro/system/vhost.map
|
||||
vhost_file=/etc/apache2/airtime/vhost.map
|
||||
|
||||
#instance_path will look like 1/1384, for example
|
||||
instance_path=$(echo ${file_path} | grep -Po "(?<=($base_instance_path)).*?(?=/srv)")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Account Plans</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Add Media Skeleton Present</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Billing Account Details</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Billing Menu Contents</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Calendar Add Show Skeleton</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Calendar Day Week Month Views</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Calendar Skeleton Present</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Invoices Skeleton</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Library Skeleton Present</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Listen Button Skeleton</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Login and Logout</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>Preferences Skeletons</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://bananas.airtime.pro/" />
|
||||
|
||||
<title>System Menu Contents</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue