Merge branch 'cc-5709-airtime-analyzer' into cc-5709-airtime-analyzer-saas

Conflicts:
	airtime_mvc/public/index.php

* Reverted some SaaS-only thing Martin did a year ago. Looks benign but
  only one way to find out...
This commit is contained in:
Albert Santoni 2014-03-27 16:38:03 -04:00
commit 1c5e2d6205
59 changed files with 1851 additions and 140 deletions

View file

@ -65,7 +65,7 @@ class LoginController extends Zend_Controller_Action
Application_Model_LoginAttempts::resetAttempts($_SERVER['REMOTE_ADDR']);
Application_Model_Subjects::resetLoginAttempts($username);
$tempSess = new Zend_Session_Namespace("referrer");
$tempSess->referrer = 'login';

View file

@ -2,12 +2,11 @@
class PluploadController extends Zend_Controller_Action
{
public function init()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('upload', 'json')
->addActionContext('copyfile', 'json')
$ajaxContext->addActionContext('upload', 'json')
->addActionContext('recent-uploads', 'json')
->initContext();
}
@ -18,12 +17,14 @@ class PluploadController extends Zend_Controller_Action
$baseUrl = Application_Common_OsPath::getBaseDir();
$locale = Application_Model_Preference::GetLocale();
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/plupload/i18n/'.$locale.'.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/plupload.queue.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']);
}
public function uploadAction()
@ -34,17 +35,53 @@ class PluploadController extends Zend_Controller_Action
$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "tempfilepath" => $tempFileName));
}
public function copyfileAction()
public function recentUploadsAction()
{
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
$filename = $this->_getParam('name');
$tempname = $this->_getParam('tempname');
$result = Application_Model_StoredFile::copyFileToStor($upload_dir,
$filename, $tempname);
if (!is_null($result))
$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "error" => $result));
if (isset($_GET['uploadFilter'])) {
$filter = $_GET['uploadFilter'];
} else {
$filter = "all";
}
$limit = isset($_GET['iDisplayLength']) ? $_GET['iDisplayLength'] : 10;
$rowStart = isset($_GET['iDisplayStart']) ? $_GET['iDisplayStart'] : 0;
$recentUploadsQuery = CcFilesQuery::create()->filterByDbUtime(array('min' => time() - 30 * 24 * 60 * 60))
->orderByDbUtime(Criteria::DESC);
$numTotalRecentUploads = $recentUploadsQuery->find()->count();
if ($filter == "pending") {
$recentUploadsQuery->filterByDbImportStatus("1");
} else if ($filter == "failed") {
$recentUploadsQuery->filterByDbImportStatus(array('min' => 100));
}
$recentUploads = $recentUploadsQuery->offset($rowStart)->limit($limit)->find();
$numRecentUploads = $limit;
//CcFilesQuery::create()->filterByDbUtime(array('min' => time() - 30 * 24 * 60 * 60))
//$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "tempfilepath" => $tempFileName));
$uploadsArray = array();
foreach ($recentUploads as $upload)
{
$upload->toArray(BasePeer::TYPE_FIELDNAME);
//array_push($uploadsArray, $upload); //TODO: $this->sanitizeResponse($upload));
//$this->_helper->json->sendJson($upload->asJson());
//TODO: Invoke sanitization here
array_push($uploadsArray, $upload->toArray(BasePeer::TYPE_FIELDNAME));
}
$this->_helper->json->sendJson(array("jsonrpc" => "2.0"));
$this->view->sEcho = intval($this->getRequest()->getParam('sEcho'));
$this->view->iTotalDisplayRecords = $numTotalRecentUploads;
//$this->view->iTotalDisplayRecords = $numRecentUploads; //$r["iTotalDisplayRecords"];
$this->view->iTotalRecords = $numTotalRecentUploads; //$r["iTotalRecords"];
$this->view->files = $uploadsArray; //$r["aaData"];
}
}

View file

@ -110,6 +110,13 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
{
$controller = strtolower($request->getControllerName());
//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")
{
return;
}
if (in_array($controller, array("api", "auth", "locale"))) {
$this->setRoleName("G");