CC-4090: Make code style PSR compliant
-run psr-cs-fixer
This commit is contained in:
parent
5661872034
commit
794cf2c845
40 changed files with 2017 additions and 1874 deletions
|
@ -35,19 +35,19 @@ class ApiController extends Zend_Controller_Action
|
|||
->addActionContext('get-files-without-replay-gain', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
||||
public function checkAuth()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$api_key = $this->_getParam('api_key');
|
||||
|
||||
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
|
||||
is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
@ -79,13 +79,15 @@ class ApiController extends Zend_Controller_Action
|
|||
* Sets up and send init values used in the Calendar.
|
||||
* This is only being used by schedule.js at the moment.
|
||||
*/
|
||||
public function calendarInitAction(){
|
||||
public function calendarInitAction()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||
if (is_null(Zend_Auth::getInstance()->getStorage()->read())) {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -113,14 +115,12 @@ class ApiController extends Zend_Controller_Action
|
|||
$fileID = $this->_getParam("file");
|
||||
$file_id = substr($fileID, 0, strpos($fileID, "."));
|
||||
|
||||
if (ctype_alnum($file_id) && strlen($file_id) == 32)
|
||||
{
|
||||
if (ctype_alnum($file_id) && strlen($file_id) == 32) {
|
||||
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
||||
if ( $media != null )
|
||||
{
|
||||
|
||||
if ($media != null) {
|
||||
|
||||
$filepath = $media->getFilePath();
|
||||
if(is_file($filepath)){
|
||||
if (is_file($filepath)) {
|
||||
$full_path = $media->getPropelOrm()->getDbFilepath();
|
||||
|
||||
$file_base_name = strrchr($full_path, '/');
|
||||
|
@ -137,7 +137,7 @@ class ApiController extends Zend_Controller_Action
|
|||
// http://www.php.net/manual/en/book.fileinfo.php
|
||||
$ext = pathinfo($fileID, PATHINFO_EXTENSION);
|
||||
//Download user left clicks a track and selects Download.
|
||||
if ("true" == $this->_getParam('download')){
|
||||
if ("true" == $this->_getParam('download')) {
|
||||
//path_info breaks up a file path into seperate pieces of informaiton.
|
||||
//We just want the basename which is the file name with the path
|
||||
//information stripped away. We are using Content-Disposition to specify
|
||||
|
@ -147,21 +147,22 @@ class ApiController extends Zend_Controller_Action
|
|||
// I'm removing pathinfo() since it strips away UTF-8 characters.
|
||||
// Using manualy parsing
|
||||
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||
}else{
|
||||
} else {
|
||||
//user clicks play button for track and downloads it.
|
||||
header('Content-Disposition: inline; filename="'.$file_base_name.'"');
|
||||
}
|
||||
if (strtolower($ext) === 'mp3'){
|
||||
if (strtolower($ext) === 'mp3') {
|
||||
$this->smartReadFile($filepath, 'audio/mpeg');
|
||||
} else {
|
||||
$this->smartReadFile($filepath, 'audio/'.$ext);
|
||||
}
|
||||
exit;
|
||||
}else{
|
||||
} else {
|
||||
header ("HTTP/1.1 404 Not Found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -177,39 +178,33 @@ class ApiController extends Zend_Controller_Action
|
|||
* @link https://groups.google.com/d/msg/jplayer/nSM2UmnSKKA/Hu76jDZS4xcJ
|
||||
* @link http://php.net/manual/en/function.readfile.php#86244
|
||||
*/
|
||||
function smartReadFile($location, $mimeType = 'audio/mp3')
|
||||
public function smartReadFile($location, $mimeType = 'audio/mp3')
|
||||
{
|
||||
$size= filesize($location);
|
||||
$time= date('r', filemtime($location));
|
||||
|
||||
$fm = @fopen($location, 'rb');
|
||||
if (!$fm)
|
||||
{
|
||||
if (!$fm) {
|
||||
header ("HTTP/1.1 505 Internal server error");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$begin= 0;
|
||||
$end= $size - 1;
|
||||
|
||||
if (isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches))
|
||||
{
|
||||
if (isset($_SERVER['HTTP_RANGE'])) {
|
||||
if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) {
|
||||
$begin = intval($matches[1]);
|
||||
if (!empty($matches[2]))
|
||||
{
|
||||
if (!empty($matches[2])) {
|
||||
$end = intval($matches[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
if (isset($_SERVER['HTTP_RANGE'])) {
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
header('HTTP/1.1 200 OK');
|
||||
}
|
||||
header("Content-Type: $mimeType");
|
||||
|
@ -217,8 +212,7 @@ class ApiController extends Zend_Controller_Action
|
|||
header('Pragma: no-cache');
|
||||
header('Accept-Ranges: bytes');
|
||||
header('Content-Length:' . (($end - $begin) + 1));
|
||||
if (isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
if (isset($_SERVER['HTTP_RANGE'])) {
|
||||
header("Content-Range: bytes $begin-$end/$size");
|
||||
}
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
|
@ -232,8 +226,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$cur = $begin;
|
||||
fseek($fm, $begin, 0);
|
||||
|
||||
while(!feof($fm) && $cur <= $end && (connection_status() == 0))
|
||||
{
|
||||
while (!feof($fm) && $cur <= $end && (connection_status() == 0)) {
|
||||
echo fread($fm, min(1024 * 16, ($end - $cur) + 1));
|
||||
$cur += 1024 * 16;
|
||||
}
|
||||
|
@ -256,7 +249,7 @@ class ApiController extends Zend_Controller_Action
|
|||
*/
|
||||
public function liveInfoAction()
|
||||
{
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()) {
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
@ -267,7 +260,7 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type');
|
||||
if($type == "endofday") {
|
||||
if ($type == "endofday") {
|
||||
// make getNextShows use end of day
|
||||
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
||||
$result = array("env"=>APPLICATION_ENV,
|
||||
|
@ -275,10 +268,10 @@ class ApiController extends Zend_Controller_Action
|
|||
"nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, 5, $utcTimeEnd));
|
||||
|
||||
Application_Model_Show::convertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
}else{
|
||||
} else {
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
if($limit == "" || !is_numeric($limit)) {
|
||||
if ($limit == "" || !is_numeric($limit)) {
|
||||
$limit = "5";
|
||||
}
|
||||
|
||||
|
@ -303,7 +296,7 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
public function weekInfoAction()
|
||||
{
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()) {
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
@ -315,7 +308,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$dow = array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
|
||||
|
||||
$result = array();
|
||||
for ($i=0; $i<7; $i++){
|
||||
for ($i=0; $i<7; $i++) {
|
||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$utcDayStart = $utcDayEnd;
|
||||
|
@ -374,7 +367,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$rows = Application_Model_Show::GetCurrentShow($today_timestamp);
|
||||
Application_Model_Show::convertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
if (count($rows) > 0){
|
||||
if (count($rows) > 0) {
|
||||
$this->view->is_recording = ($rows[0]['record'] == 1);
|
||||
}
|
||||
}
|
||||
|
@ -388,7 +381,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
||||
|
||||
if (!is_null($result)){
|
||||
if (!is_null($result)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": '.$result[code].', "message" : "'.$result[message].'"}}');
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +409,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$show_genre = $show_inst->getGenre();
|
||||
$show_start_time = Application_Common_DateHelper::ConvertToLocalDateTimeString($show_inst->getShowInstanceStart());
|
||||
|
||||
} catch (Exception $e){
|
||||
} catch (Exception $e) {
|
||||
//we've reached here probably because the show was
|
||||
//cancelled, and therefore the show instance does not
|
||||
//exist anymore (ShowInstance constructor threw this error).
|
||||
|
@ -440,8 +433,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$new_name[] = $filename_parts[count($filename_parts)-1];
|
||||
|
||||
$tmpTitle = implode("-", $new_name);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$tmpTitle = $file->getName();
|
||||
}
|
||||
|
||||
|
@ -449,14 +441,14 @@ class ApiController extends Zend_Controller_Action
|
|||
$file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder");
|
||||
$file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id);
|
||||
|
||||
if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud())
|
||||
{
|
||||
$id = $file->getId();
|
||||
if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) {
|
||||
$id = $file->getId();
|
||||
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
|
||||
}
|
||||
}
|
||||
|
||||
public function mediaMonitorSetupAction() {
|
||||
public function mediaMonitorSetupAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
@ -465,13 +457,14 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$watchedDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
$watchedDirsPath = array();
|
||||
foreach($watchedDirs as $wd){
|
||||
foreach ($watchedDirs as $wd) {
|
||||
$watchedDirsPath[] = $wd->getDirectory();
|
||||
}
|
||||
$this->view->watched_dirs = $watchedDirsPath;
|
||||
}
|
||||
|
||||
public function reloadMetadataAction() {
|
||||
public function reloadMetadataAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$mode = $request->getParam('mode');
|
||||
|
@ -496,21 +489,20 @@ class ApiController extends Zend_Controller_Action
|
|||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
if (is_null($file)) {
|
||||
$file = Application_Model_StoredFile::Insert($md);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// path already exist
|
||||
if($file->getFileExistsFlag()){
|
||||
if ($file->getFileExistsFlag()) {
|
||||
// file marked as exists
|
||||
$this->view->error = "File already exists in Airtime.";
|
||||
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
// file marked as not exists
|
||||
$file->setFileExistsFlag(true);
|
||||
$file->setMetadata($md);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($mode == "modify") {
|
||||
} elseif ($mode == "modify") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
|
@ -518,61 +510,62 @@ class ApiController extends Zend_Controller_Action
|
|||
//File is not in database anymore.
|
||||
if (is_null($file)) {
|
||||
$this->view->error = "File does not exist in Airtime.";
|
||||
|
||||
return;
|
||||
}
|
||||
//Updating a metadata change.
|
||||
else {
|
||||
$file->setMetadata($md);
|
||||
}
|
||||
}
|
||||
else if ($mode == "moved") {
|
||||
} elseif ($mode == "moved") {
|
||||
$md5 = $md['MDATA_KEY_MD5'];
|
||||
$file = Application_Model_StoredFile::RecallByMd5($md5);
|
||||
|
||||
if (is_null($file)) {
|
||||
$this->view->error = "File doesn't exist in Airtime.";
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
$file->setFilePath($filepath);
|
||||
}
|
||||
}
|
||||
else if ($mode == "delete") {
|
||||
} elseif ($mode == "delete") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
|
||||
if (is_null($file)) {
|
||||
$this->view->error = "File doesn't exist in Airtime.";
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$file->deleteByMediaMonitor();
|
||||
}
|
||||
}
|
||||
else if ($mode == "delete_dir") {
|
||||
} elseif ($mode == "delete_dir") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath);
|
||||
|
||||
foreach($files as $file){
|
||||
foreach ($files as $file) {
|
||||
$file->deleteByMediaMonitor();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
$this->view->id = $file->getId();
|
||||
}
|
||||
|
||||
public function listAllFilesAction() {
|
||||
public function listAllFilesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$dir_id = $request->getParam('dir_id');
|
||||
|
||||
$this->view->files = Application_Model_StoredFile::listAllFiles($dir_id);
|
||||
}
|
||||
|
||||
public function listAllWatchedDirsAction() {
|
||||
public function listAllWatchedDirsAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$result = array();
|
||||
|
@ -582,42 +575,47 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$result[$storDir->getId()] = $storDir->getDirectory();
|
||||
|
||||
foreach ($arrWatchedDirs as $watchedDir){
|
||||
foreach ($arrWatchedDirs as $watchedDir) {
|
||||
$result[$watchedDir->getId()] = $watchedDir->getDirectory();
|
||||
}
|
||||
|
||||
$this->view->dirs = $result;
|
||||
}
|
||||
|
||||
public function addWatchedDirAction() {
|
||||
public function addWatchedDirAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$path = base64_decode($request->getParam('path'));
|
||||
|
||||
$this->view->msg = Application_Model_MusicDir::addWatchedDir($path);
|
||||
}
|
||||
|
||||
public function removeWatchedDirAction() {
|
||||
public function removeWatchedDirAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$path = base64_decode($request->getParam('path'));
|
||||
|
||||
$this->view->msg = Application_Model_MusicDir::removeWatchedDir($path);
|
||||
}
|
||||
|
||||
public function setStorageDirAction() {
|
||||
public function setStorageDirAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$path = base64_decode($request->getParam('path'));
|
||||
|
||||
$this->view->msg = Application_Model_MusicDir::setStorDir($path);
|
||||
}
|
||||
|
||||
public function getStreamSettingAction() {
|
||||
public function getStreamSettingAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$info = Application_Model_StreamSetting::getStreamSetting();
|
||||
$this->view->msg = $info;
|
||||
}
|
||||
|
||||
public function statusAction() {
|
||||
public function statusAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$getDiskInfo = $request->getParam('diskinfo') == "true";
|
||||
|
||||
|
@ -632,14 +630,15 @@ class ApiController extends Zend_Controller_Action
|
|||
)
|
||||
);
|
||||
|
||||
if ($getDiskInfo){
|
||||
if ($getDiskInfo) {
|
||||
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
|
||||
}
|
||||
|
||||
$this->view->status = $status;
|
||||
}
|
||||
|
||||
public function registerComponentAction(){
|
||||
public function registerComponentAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$component = $request->getParam('component');
|
||||
|
@ -649,7 +648,8 @@ class ApiController extends Zend_Controller_Action
|
|||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||
}
|
||||
|
||||
public function updateLiquidsoapStatusAction(){
|
||||
public function updateLiquidsoapStatusAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$msg = $request->getParam('msg');
|
||||
|
@ -659,7 +659,8 @@ class ApiController extends Zend_Controller_Action
|
|||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $boot_time);
|
||||
}
|
||||
|
||||
public function updateSourceStatusAction(){
|
||||
public function updateSourceStatusAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$msg = $request->getParam('msg');
|
||||
|
@ -668,13 +669,13 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
// on source disconnection sent msg to pypo to turn off the switch
|
||||
// Added AutoTransition option
|
||||
if($status == "false" && Application_Model_Preference::GetAutoTransition()){
|
||||
if ($status == "false" && Application_Model_Preference::GetAutoTransition()) {
|
||||
$data = array("sourcename"=>$sourcename, "status"=>"off");
|
||||
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
|
||||
Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L',
|
||||
new DateTime("now", new DateTimeZone('UTC')));
|
||||
}elseif($status == "true" && Application_Model_Preference::GetAutoSwitch()){
|
||||
} elseif ($status == "true" && Application_Model_Preference::GetAutoSwitch()) {
|
||||
$data = array("sourcename"=>$sourcename, "status"=>"on");
|
||||
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
|
||||
|
@ -685,7 +686,8 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
// handles addition/deletion of mount point which watched dirs reside
|
||||
public function updateFileSystemMountAction(){
|
||||
public function updateFileSystemMountAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$params = $request->getParams();
|
||||
|
@ -703,10 +705,10 @@ class ApiController extends Zend_Controller_Action
|
|||
// if mount path itself was watched
|
||||
if ($dirPath == $ad) {
|
||||
Application_Model_MusicDir::addWatchedDir($dirPath, false);
|
||||
} else if(substr($dirPath, 0, strlen($ad)) === $ad && $dir->getExistsFlag() == false) {
|
||||
} elseif (substr($dirPath, 0, strlen($ad)) === $ad && $dir->getExistsFlag() == false) {
|
||||
// if dir contains any dir in removed_list( if watched dir resides on new mounted path )
|
||||
Application_Model_MusicDir::addWatchedDir($dirPath, false);
|
||||
} else if (substr($ad, 0, strlen($dirPath)) === $dirPath) {
|
||||
} elseif (substr($ad, 0, strlen($dirPath)) === $dirPath) {
|
||||
// is new mount point within the watched dir?
|
||||
// pyinotify doesn't notify anyhing in this case, so we add this mount point as
|
||||
// watched dir
|
||||
|
@ -715,21 +717,21 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $removed_list as $rd) {
|
||||
|
||||
foreach ($removed_list as $rd) {
|
||||
$rd .= '/';
|
||||
foreach ($watched_dirs as $dir) {
|
||||
$dirPath = $dir->getDirectory();
|
||||
// if dir contains any dir in removed_list( if watched dir resides on new mounted path )
|
||||
if (substr($dirPath, 0, strlen($rd)) === $rd && $dir->getExistsFlag() == true) {
|
||||
Application_Model_MusicDir::removeWatchedDir($dirPath, false);
|
||||
} else if (substr($rd, 0, strlen($dirPath)) === $dirPath) {
|
||||
} elseif (substr($rd, 0, strlen($dirPath)) === $dirPath) {
|
||||
// is new mount point within the watched dir?
|
||||
// pyinotify doesn't notify anyhing in this case, so we walk through all files within
|
||||
// this watched dir in DB and mark them deleted.
|
||||
// In case of h) of use cases, due to pyinotify behaviour of noticing mounted dir, we need to
|
||||
// compare agaisnt all files in cc_files table
|
||||
|
||||
|
||||
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
||||
// get all the files that is under $dirPath
|
||||
$files = Application_Model_StoredFile::listAllFiles($dir->getId(), true);
|
||||
|
@ -739,8 +741,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$f->delete();
|
||||
}
|
||||
}
|
||||
|
||||
if($watchDir) {
|
||||
|
||||
if ($watchDir) {
|
||||
Application_Model_MusicDir::removeWatchedDir($rd, false);
|
||||
}
|
||||
}
|
||||
|
@ -792,7 +794,7 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
if ($djtype == 'master') {
|
||||
//check against master
|
||||
if ($username == Application_Model_Preference::GetLiveSteamMasterUsername()
|
||||
if ($username == Application_Model_Preference::GetLiveSteamMasterUsername()
|
||||
&& $password == Application_Model_Preference::GetLiveSteamMasterPassword()) {
|
||||
$this->view->msg = true;
|
||||
} else {
|
||||
|
@ -818,8 +820,9 @@ class ApiController extends Zend_Controller_Action
|
|||
if ($CcShow->getDbLiveStreamUsingAirtimeAuth()) {
|
||||
foreach ($hosts_ids as $host) {
|
||||
$h = new Application_Model_User($host['subjs_id']);
|
||||
if($username == $h->getLogin() && md5($password) == $h->getPassword()) {
|
||||
if ($username == $h->getLogin() && md5($password) == $h->getPassword()) {
|
||||
$this->view->msg = true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -840,7 +843,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This action is for use by our dev scripts, that make
|
||||
* a change to the database and we want rabbitmq to send
|
||||
* out a message to pypo that a potential change has been made. */
|
||||
|
@ -849,10 +852,9 @@ class ApiController extends Zend_Controller_Action
|
|||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$dir_id = $this->_getParam('dir_id');
|
||||
|
||||
|
||||
//connect to db and get get sql
|
||||
$this->view->rows = Application_Model_StoredFile::listAllFiles2($dir_id, 0);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
if ($logo) {
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
|
@ -70,7 +70,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
if ($logo) {
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
|
@ -84,21 +84,22 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
/**
|
||||
*Function will load and return the contents of the requested playlist.
|
||||
*/
|
||||
public function getPlaylistAction(){
|
||||
public function getPlaylistAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$playlistID = $this->_getParam('playlistID');
|
||||
|
||||
if (!isset($playlistID)){
|
||||
if (!isset($playlistID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pl = new Application_Model_Playlist($playlistID);
|
||||
$result = Array();
|
||||
|
||||
foreach ( $pl->getContents(true) as $track ){
|
||||
foreach ( $pl->getContents(true) as $track ) {
|
||||
|
||||
$elementMap = array( 'element_title' => isset($track['CcFiles']['track_title'])?$track['CcFiles']['track_title']:"",
|
||||
'element_artist' => isset($track['CcFiles']['artist_name'])?$track['CcFiles']['artist_name']:"",
|
||||
|
@ -106,9 +107,9 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
'element_position' => isset($track['position'])?$track['position']:"",
|
||||
);
|
||||
$fileExtension = pathinfo($track['CcFiles']['filepath'], PATHINFO_EXTENSION);
|
||||
if (strtolower($fileExtension) === 'mp3'){
|
||||
if (strtolower($fileExtension) === 'mp3') {
|
||||
$elementMap['element_mp3'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
|
||||
} else if(strtolower($fileExtension) === 'ogg') {
|
||||
} elseif (strtolower($fileExtension) === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['CcFiles']['gunid'].'.'.$fileExtension;
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
|
@ -141,7 +142,7 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo){
|
||||
if ($logo) {
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
|
@ -164,14 +165,14 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
|
||||
$showID = $this->_getParam('showID');
|
||||
|
||||
if (!isset($showID)){
|
||||
if (!isset($showID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$showInstance = new Application_Model_ShowInstance($showID);
|
||||
$result = array();
|
||||
$position = 0;
|
||||
foreach ($showInstance->getShowListContent() as $track){
|
||||
foreach ($showInstance->getShowListContent() as $track) {
|
||||
|
||||
$elementMap = array(
|
||||
'element_title' => isset($track['track_title']) ? $track['track_title'] : "",
|
||||
|
@ -181,9 +182,9 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
);
|
||||
|
||||
$fileExtension = pathinfo($track['filepath'], PATHINFO_EXTENSION);
|
||||
if (strtolower($fileExtension) === 'mp3'){
|
||||
if (strtolower($fileExtension) === 'mp3') {
|
||||
$elementMap['element_mp3'] = $track['gunid'].'.'.$fileExtension;
|
||||
} else if(strtolower($fileExtension) === 'ogg') {
|
||||
} elseif (strtolower($fileExtension) === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['gunid'].'.'.$fileExtension;
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
|
|
|
@ -16,7 +16,8 @@ class DashboardController extends Zend_Controller_Action
|
|||
// action body
|
||||
}
|
||||
|
||||
public function disconnectSourceAction(){
|
||||
public function disconnectSourceAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$sourcename = $request->getParam('sourcename');
|
||||
|
||||
|
@ -29,19 +30,20 @@ class DashboardController extends Zend_Controller_Action
|
|||
|
||||
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
|
||||
|
||||
if($user->canSchedule($show_id) && $source_connected){
|
||||
if ($user->canSchedule($show_id) && $source_connected) {
|
||||
$data = array("sourcename"=>$sourcename);
|
||||
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
||||
}else{
|
||||
if($source_connected){
|
||||
} else {
|
||||
if ($source_connected) {
|
||||
$this->view->error = "You don't have permission to disconnect source.";
|
||||
}else{
|
||||
} else {
|
||||
$this->view->error = "There is no source connected to this input.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function switchSourceAction(){
|
||||
public function switchSourceAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$sourcename = $this->_getParam('sourcename');
|
||||
$current_status = $this->_getParam('status');
|
||||
|
@ -53,24 +55,24 @@ class DashboardController extends Zend_Controller_Action
|
|||
$show_id = isset($show[0]['id'])?$show[0]['id']:0;
|
||||
|
||||
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
|
||||
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play' || $current_status == "on")){
|
||||
if ($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play' || $current_status == "on")) {
|
||||
|
||||
$change_status_to = "on";
|
||||
|
||||
if(strtolower($current_status) == "on"){
|
||||
if (strtolower($current_status) == "on") {
|
||||
$change_status_to = "off";
|
||||
}
|
||||
|
||||
$data = array("sourcename"=>$sourcename, "status"=>$change_status_to);
|
||||
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
|
||||
if(strtolower($current_status) == "on"){
|
||||
if (strtolower($current_status) == "on") {
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
|
||||
$this->view->status = "OFF";
|
||||
|
||||
//Log table updates
|
||||
Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L',
|
||||
new DateTime("now", new DateTimeZone('UTC')));
|
||||
}else{
|
||||
} else {
|
||||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
|
||||
$this->view->status = "ON";
|
||||
|
||||
|
@ -78,22 +80,21 @@ class DashboardController extends Zend_Controller_Action
|
|||
Application_Model_LiveLog::SetNewLogTime($sourcename == 'scheduled_play'?'S':'L',
|
||||
new DateTime("now", new DateTimeZone('UTC')));
|
||||
}
|
||||
}
|
||||
else{
|
||||
if($source_connected){
|
||||
} else {
|
||||
if ($source_connected) {
|
||||
$this->view->error = "You don't have permission to switch source.";
|
||||
}else{
|
||||
if($sourcename == 'scheduled_play'){
|
||||
} else {
|
||||
if ($sourcename == 'scheduled_play') {
|
||||
$this->view->error = "You don't have permission to disconnect source.";
|
||||
}else{
|
||||
} else {
|
||||
$this->view->error = "There is no source connected to this input.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function switchOffSource(){
|
||||
|
||||
public function switchOffSource()
|
||||
{
|
||||
}
|
||||
|
||||
public function streamPlayerAction()
|
||||
|
@ -107,7 +108,7 @@ class DashboardController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('bare');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
if ($logo) {
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
|
@ -125,4 +126,3 @@ class DashboardController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ class ErrorController extends Zend_Controller_Action
|
|||
return false;
|
||||
}
|
||||
$log = $bootstrap->getResource('Log');
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
|
@ -51,8 +52,4 @@ class ErrorController extends Zend_Controller_Action
|
|||
// action body
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,10 +19,3 @@ class IndexController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
//Open a jPlayer window and play the audio clip.
|
||||
//Open a jPlayer window and play the audio clip.
|
||||
$menu["play"] = array("name"=> "Preview", "icon" => "play");
|
||||
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
|
@ -52,7 +52,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
if (isset($this->pl_sess->id) && $screen == "playlist") {
|
||||
// if the user is not admin or pm, check the creator and see if this person owns the playlist
|
||||
$playlist = new Application_Model_Playlist($this->pl_sess->id);
|
||||
if($isAdminOrPM || $playlist->getCreatorId() == $user->getId()){
|
||||
if ($isAdminOrPM || $playlist->getCreatorId() == $user->getId()) {
|
||||
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
|
||||
}
|
||||
}
|
||||
|
@ -63,44 +63,41 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||
$menu["download"] = array("name" => "Download", "icon" => "download", "url" => $url);
|
||||
}
|
||||
else if ($type === "playlist") {
|
||||
} elseif ($type === "playlist") {
|
||||
$playlist = new Application_Model_Playlist($id);
|
||||
if ($this->pl_sess->id !== $id && $screen == "playlist") {
|
||||
if($isAdminOrPM || $playlist->getCreatorId() == $user->getId()){
|
||||
if ($isAdminOrPM || $playlist->getCreatorId() == $user->getId()) {
|
||||
$menu["edit"] = array("name"=> "Edit", "icon" => "edit");
|
||||
}
|
||||
}
|
||||
if($isAdminOrPM || $playlist->getCreatorId() == $user->getId()){
|
||||
if ($isAdminOrPM || $playlist->getCreatorId() == $user->getId()) {
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//SOUNDCLOUD MENU OPTIONS
|
||||
if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
||||
//create a menu separator
|
||||
$menu["sep1"] = "-----------";
|
||||
|
||||
//create a sub menu for Soundcloud actions.
|
||||
$menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
|
||||
|
||||
if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
||||
//create a menu separator
|
||||
$menu["sep1"] = "-----------";
|
||||
|
||||
//create a sub menu for Soundcloud actions.
|
||||
$menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
|
||||
|
||||
$scid = $file->getSoundCloudId();
|
||||
|
||||
if ($scid > 0){
|
||||
$url = $file->getSoundCloudLinkToFile();
|
||||
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
|
||||
}
|
||||
|
||||
if (!is_null($scid)){
|
||||
$text = "Re-upload to SoundCloud";
|
||||
}
|
||||
else {
|
||||
$text = "Upload to SoundCloud";
|
||||
}
|
||||
|
||||
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}");
|
||||
if ($scid > 0) {
|
||||
$url = $file->getSoundCloudLinkToFile();
|
||||
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
|
||||
}
|
||||
|
||||
if (!is_null($scid)) {
|
||||
$text = "Re-upload to SoundCloud";
|
||||
} else {
|
||||
$text = "Upload to SoundCloud";
|
||||
}
|
||||
|
||||
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}");
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
|
@ -123,8 +120,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
if ($media["type"] === "audioclip") {
|
||||
$files[] = intval($media["id"]);
|
||||
}
|
||||
else if ($media["type"] === "playlist") {
|
||||
} elseif ($media["type"] === "playlist") {
|
||||
$playlists[] = intval($media["id"]);
|
||||
}
|
||||
}
|
||||
|
@ -132,10 +128,10 @@ class LibraryController extends Zend_Controller_Action
|
|||
$hasPermission = true;
|
||||
if (count($playlists)) {
|
||||
// make sure use has permission to delete all playslists in the list
|
||||
if(!$isAdminOrPM){
|
||||
foreach($playlists as $pid){
|
||||
if (!$isAdminOrPM) {
|
||||
foreach ($playlists as $pid) {
|
||||
$pl = new Application_Model_Playlist($pid);
|
||||
if($pl->getCreatorId() != $user->getId()){
|
||||
if ($pl->getCreatorId() != $user->getId()) {
|
||||
$hasPermission = false;
|
||||
}
|
||||
}
|
||||
|
@ -145,10 +141,11 @@ class LibraryController extends Zend_Controller_Action
|
|||
if (!$isAdminOrPM && count($files)) {
|
||||
$hasPermission = false;
|
||||
}
|
||||
if(!$hasPermission){
|
||||
if (!$hasPermission) {
|
||||
$this->view->message = "You don't have a permission to delete all playlists/files that are selected.";
|
||||
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
Application_Model_Playlist::DeletePlaylists($playlists);
|
||||
}
|
||||
|
||||
|
@ -180,25 +177,23 @@ class LibraryController extends Zend_Controller_Action
|
|||
//TODO move this to the datatables row callback.
|
||||
foreach ($r["aaData"] as &$data) {
|
||||
|
||||
if ($data['ftype'] == 'audioclip'){
|
||||
if ($data['ftype'] == 'audioclip') {
|
||||
$file = Application_Model_StoredFile::Recall($data['id']);
|
||||
$scid = $file->getSoundCloudId();
|
||||
|
||||
if ($scid == "-2"){
|
||||
if ($scid == "-2") {
|
||||
$data['track_title'] .= '<span class="small-icon progress"/>';
|
||||
}
|
||||
else if ($scid == "-3"){
|
||||
} elseif ($scid == "-3") {
|
||||
$data['track_title'] .= '<span class="small-icon sc-error"/>';
|
||||
}
|
||||
else if (!is_null($scid)){
|
||||
} elseif (!is_null($scid)) {
|
||||
$data['track_title'] .= '<span class="small-icon soundcloud"/>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->files = $r["aaData"];
|
||||
}
|
||||
|
||||
|
@ -206,7 +201,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
{
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
if(!$isAdminOrPM){
|
||||
if (!$isAdminOrPM) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -266,8 +261,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$this->view->md = $md;
|
||||
|
||||
}
|
||||
else if ($type == "playlist") {
|
||||
} elseif ($type == "playlist") {
|
||||
|
||||
$file = new Application_Model_Playlist($id);
|
||||
$this->view->type = $type;
|
||||
|
@ -279,20 +273,21 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->md = $md;
|
||||
$this->view->contents = $file->getContents();
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Logging::log($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function uploadFileSoundcloudAction(){
|
||||
public function uploadFileSoundcloudAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
|
||||
// we should die with ui info
|
||||
die();
|
||||
}
|
||||
|
||||
public function getUploadToSoundcloudStatusAction(){
|
||||
public function getUploadToSoundcloudStatusAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
|
||||
|
@ -302,8 +297,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$file = $show_instance->getRecordedFile();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||
}
|
||||
else if ($type == "file") {
|
||||
} elseif ($type == "file") {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$this->view->sc_id = $file->getSoundCloudId();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
|
|
|
@ -12,8 +12,7 @@ class LoginController extends Zend_Controller_Action
|
|||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
if (Zend_Auth::getInstance()->hasIdentity())
|
||||
{
|
||||
if (Zend_Auth::getInstance()->hasIdentity()) {
|
||||
$this->_redirect('Showbuilder');
|
||||
}
|
||||
|
||||
|
@ -30,21 +29,19 @@ class LoginController extends Zend_Controller_Action
|
|||
|
||||
$message = "Please enter your user name and password";
|
||||
|
||||
if($request->isPost())
|
||||
{
|
||||
if ($request->isPost()) {
|
||||
// if the post contains recaptcha field, which means form had recaptcha field.
|
||||
// Hence add the element for validation.
|
||||
if(array_key_exists('recaptcha_response_field', $request->getPost())){
|
||||
if (array_key_exists('recaptcha_response_field', $request->getPost())) {
|
||||
$form->addRecaptcha();
|
||||
}
|
||||
if($form->isValid($request->getPost()))
|
||||
{
|
||||
if ($form->isValid($request->getPost())) {
|
||||
//get the username and password from the form
|
||||
$username = $form->getValue('username');
|
||||
$password = $form->getValue('password');
|
||||
if(Application_Model_Subjects::getLoginAttempts($username) >= 3 && $form->getElement('captcha') == NULL){
|
||||
if (Application_Model_Subjects::getLoginAttempts($username) >= 3 && $form->getElement('captcha') == NULL) {
|
||||
$form->addRecaptcha();
|
||||
}else{
|
||||
} else {
|
||||
$authAdapter = Application_Model_Auth::getAuthAdapter();
|
||||
|
||||
//pass to the adapter the submitted username and password
|
||||
|
@ -53,8 +50,7 @@ class LoginController extends Zend_Controller_Action
|
|||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if($result->isValid())
|
||||
{
|
||||
if ($result->isValid()) {
|
||||
//all info about this user from the login table omit only the password
|
||||
$userInfo = $authAdapter->getResultRowObject(null, 'password');
|
||||
|
||||
|
@ -69,9 +65,7 @@ class LoginController extends Zend_Controller_Action
|
|||
$tempSess->referrer = 'login';
|
||||
|
||||
$this->_redirect('Showbuilder');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$message = "Wrong username or password provided. Please try again.";
|
||||
Application_Model_Subjects::increaseLoginAttempts($username);
|
||||
Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']);
|
||||
|
@ -87,7 +81,7 @@ class LoginController extends Zend_Controller_Action
|
|||
$this->view->form = $form;
|
||||
$this->view->airtimeVersion = Application_Model_Preference::GetAirtimeVersion();
|
||||
$this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE;
|
||||
if(isset($CC_CONFIG['demo'])){
|
||||
if (isset($CC_CONFIG['demo'])) {
|
||||
$this->view->demo = $CC_CONFIG['demo'];
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +92,7 @@ class LoginController extends Zend_Controller_Action
|
|||
$this->_redirect('showbuilder/index');
|
||||
}
|
||||
|
||||
public function passwordRestoreAction()
|
||||
public function passwordRestoreAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
@ -108,92 +102,87 @@ class LoginController extends Zend_Controller_Action
|
|||
|
||||
if (!Application_Model_Preference::GetEnableSystemEmail()) {
|
||||
$this->_redirect('login');
|
||||
}
|
||||
else {
|
||||
//uses separate layout without a navigation.
|
||||
$this->_helper->layout->setLayout('login');
|
||||
|
||||
$form = new Application_Form_PasswordRestore();
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
||||
$user = CcSubjsQuery::create()
|
||||
->filterByDbEmail($form->email->getValue())
|
||||
->findOne();
|
||||
|
||||
if (!empty($user)) {
|
||||
$auth = new Application_Model_Auth();
|
||||
|
||||
} else {
|
||||
//uses separate layout without a navigation.
|
||||
$this->_helper->layout->setLayout('login');
|
||||
|
||||
$form = new Application_Form_PasswordRestore();
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
||||
$user = CcSubjsQuery::create()
|
||||
->filterByDbEmail($form->email->getValue())
|
||||
->findOne();
|
||||
|
||||
if (!empty($user)) {
|
||||
$auth = new Application_Model_Auth();
|
||||
|
||||
$success = $auth->sendPasswordRestoreLink($user, $this->view);
|
||||
if ($success) {
|
||||
if ($success) {
|
||||
$this->_helper->redirector('password-restore-after', 'login');
|
||||
} else {
|
||||
$form->email->addError($this->view->translate("Email could not be sent. Check your mail server settings and ensure it has been configured properly."));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$form->email->addError($this->view->translate("Given email not found."));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$form->email->addError($this->view->translate("Given email not found."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->view->form = $form;
|
||||
}
|
||||
}
|
||||
|
||||
public function passwordRestoreAfterAction()
|
||||
{
|
||||
//uses separate layout without a navigation.
|
||||
$this->_helper->layout->setLayout('login');
|
||||
}
|
||||
|
||||
public function passwordChangeAction()
|
||||
{
|
||||
//uses separate layout without a navigation.
|
||||
$this->_helper->layout->setLayout('login');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$token = $request->getParam("token", false);
|
||||
$user_id = $request->getParam("user_id", 0);
|
||||
|
||||
$form = new Application_Form_PasswordChange();
|
||||
$auth = new Application_Model_Auth();
|
||||
$user = CcSubjsQuery::create()->findPK($user_id);
|
||||
|
||||
//check validity of token
|
||||
if (!$auth->checkToken($user_id, $token, 'password.restore')) {
|
||||
Logging::debug("token not valid");
|
||||
$this->_helper->redirector('index', 'login');
|
||||
}
|
||||
|
||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
||||
|
||||
$user->setDbPass(md5($form->password->getValue()));
|
||||
$user->save();
|
||||
|
||||
$auth->invalidateTokens($user, 'password.restore');
|
||||
|
||||
$zend_auth = Zend_Auth::getInstance();
|
||||
$zend_auth->clearIdentity();
|
||||
|
||||
$authAdapter = Application_Model_Auth::getAuthAdapter();
|
||||
$authAdapter->setIdentity($user->getDbLogin())
|
||||
->setCredential($form->password->getValue());
|
||||
|
||||
$result = $zend_auth->authenticate($authAdapter);
|
||||
|
||||
//all info about this user from the login table omit only the password
|
||||
$userInfo = $authAdapter->getResultRowObject(null, 'password');
|
||||
|
||||
//the default storage is a session with namespace Zend_Auth
|
||||
$authStorage = $zend_auth->getStorage();
|
||||
$authStorage->write($userInfo);
|
||||
|
||||
$this->_helper->redirector('index', 'showbuilder');
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
}
|
||||
}
|
||||
|
||||
public function passwordRestoreAfterAction()
|
||||
{
|
||||
//uses separate layout without a navigation.
|
||||
$this->_helper->layout->setLayout('login');
|
||||
}
|
||||
|
||||
public function passwordChangeAction()
|
||||
{
|
||||
//uses separate layout without a navigation.
|
||||
$this->_helper->layout->setLayout('login');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$token = $request->getParam("token", false);
|
||||
$user_id = $request->getParam("user_id", 0);
|
||||
|
||||
$form = new Application_Form_PasswordChange();
|
||||
$auth = new Application_Model_Auth();
|
||||
$user = CcSubjsQuery::create()->findPK($user_id);
|
||||
|
||||
//check validity of token
|
||||
if (!$auth->checkToken($user_id, $token, 'password.restore')) {
|
||||
Logging::debug("token not valid");
|
||||
$this->_helper->redirector('index', 'login');
|
||||
}
|
||||
|
||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
||||
|
||||
$user->setDbPass(md5($form->password->getValue()));
|
||||
$user->save();
|
||||
|
||||
$auth->invalidateTokens($user, 'password.restore');
|
||||
|
||||
$zend_auth = Zend_Auth::getInstance();
|
||||
$zend_auth->clearIdentity();
|
||||
|
||||
$authAdapter = Application_Model_Auth::getAuthAdapter();
|
||||
$authAdapter->setIdentity($user->getDbLogin())
|
||||
->setCredential($form->password->getValue());
|
||||
|
||||
$result = $zend_auth->authenticate($authAdapter);
|
||||
|
||||
//all info about this user from the login table omit only the password
|
||||
$userInfo = $authAdapter->getResultRowObject(null, 'password');
|
||||
|
||||
//the default storage is a session with namespace Zend_Auth
|
||||
$authStorage = $zend_auth->getStorage();
|
||||
$authStorage->write($userInfo);
|
||||
|
||||
$this->_helper->redirector('index', 'showbuilder');
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
throw new PlaylistOutDatedException("You are viewing an older version of {$pl->getName()}");
|
||||
}
|
||||
}
|
||||
|
||||
return $pl;
|
||||
}
|
||||
|
||||
|
@ -47,8 +48,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
if (is_null($pl_id)) {
|
||||
unset($this->pl_sess->id);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->pl_sess->id = intval($pl_id);
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->id = $pl->getId();
|
||||
$this->view->html = $this->view->render('playlist/playlist.phtml');
|
||||
unset($this->view->pl);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->view->html = $this->view->render('playlist/playlist.phtml');
|
||||
}
|
||||
}
|
||||
|
@ -114,23 +113,23 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_playlistbuilder.js'),'text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_playlistbuilder.js'),'text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
@ -143,11 +142,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$formatter = new LengthFormatter($pl->getLength());
|
||||
$this->view->length = $formatter->format();
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -177,11 +174,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
try {
|
||||
$pl = new Application_Model_Playlist($id);
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -198,19 +193,16 @@ class PlaylistController extends Zend_Controller_Action
|
|||
if (in_array($this->pl_sess->id, $ids)) {
|
||||
Logging::log("Deleting currently active playlist");
|
||||
$this->changePlaylist(null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Logging::log("Not deleting currently active playlist");
|
||||
$pl = new Application_Model_Playlist($this->pl_sess->id);
|
||||
}
|
||||
|
||||
Application_Model_Playlist::DeletePlaylists($ids);
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -226,14 +218,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl = $this->getPlaylist();
|
||||
$pl->addAudioClips($ids, $afterItem, $addType);
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -249,14 +238,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl = $this->getPlaylist();
|
||||
$pl->moveAudioClips($ids, $afterItem);
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -271,14 +257,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl = $this->getPlaylist();
|
||||
$pl->delAudioClips($ids);
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -296,18 +279,14 @@ class PlaylistController extends Zend_Controller_Action
|
|||
if (!isset($response["error"])) {
|
||||
$this->view->response = $response;
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->view->cue_error = $response["error"];
|
||||
}
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -325,18 +304,14 @@ class PlaylistController extends Zend_Controller_Action
|
|||
if (!isset($response["error"])) {
|
||||
$this->createUpdateResponse($pl);
|
||||
$this->view->response = $response;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->view->fade_error = $response["error"];
|
||||
}
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -350,14 +325,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
$fades = $pl->getFadeInfo($pl->getSize()-1);
|
||||
$this->view->fadeOut = $fades[1];
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -376,14 +348,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl = $this->getPlaylist();
|
||||
$pl->setPlaylistfades($fadeIn, $fadeOut);
|
||||
$this->view->modified = $pl->getLastModified("U");
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -397,14 +366,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl->setName($name);
|
||||
$this->view->playlistName = $name;
|
||||
$this->view->modified = $pl->getLastModified("U");
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
@ -418,16 +384,12 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl->setDescription($description);
|
||||
$this->view->description = $pl->getDescription();
|
||||
$this->view->modified = $pl->getLastModified("U");
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<?php
|
||||
|
||||
class PlayoutHistoryController extends Zend_Controller_Action
|
||||
class PlayouthistoryController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext
|
||||
->addActionContext('playout-history-feed', 'json')
|
||||
->initContext();
|
||||
->addActionContext('playout-history-feed', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -35,50 +35,50 @@ class PlayoutHistoryController extends Zend_Controller_Action
|
|||
'his_time_end' => $end->format("H:i")
|
||||
));
|
||||
|
||||
$this->view->date_form = $form;
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->date_form = $form;
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$offset = date("Z") * -1;
|
||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$offset = date("Z") * -1;
|
||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
|
||||
}
|
||||
|
||||
public function playoutHistoryFeedAction()
|
||||
|
||||
public function playoutHistoryFeedAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
$params = $request->getParams();
|
||||
|
||||
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
||||
|
||||
$params = $request->getParams();
|
||||
|
||||
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
|
||||
$ends_epoch = $request->getParam("end", $current_time);
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
Logging::log("history starts {$startsDT->format("Y-m-d H:i:s")}");
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
Logging::log("history starts {$startsDT->format("Y-m-d H:i:s")}");
|
||||
Logging::log("history ends {$endsDT->format("Y-m-d H:i:s")}");
|
||||
|
||||
|
||||
$history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params);
|
||||
|
||||
|
||||
$r = $history->getItems();
|
||||
|
||||
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->history = $r["history"];
|
||||
$this->view->history = $r["history"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ class PluploadController extends Zend_Controller_Action
|
|||
die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }');
|
||||
}
|
||||
|
||||
public function copyfileAction(){
|
||||
public function copyfileAction()
|
||||
{
|
||||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||
$filename = $this->_getParam('name');
|
||||
$tempname = $this->_getParam('tempname');
|
||||
|
@ -45,6 +46,3 @@ class PluploadController extends Zend_Controller_Action
|
|||
die('{"jsonrpc" : "2.0"}');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -84,18 +84,18 @@ class PreferenceController extends Zend_Controller_Action
|
|||
if ($request->isPost()) {
|
||||
$values = $request->getPost();
|
||||
if ($form->isValid($values)) {
|
||||
if (!$isSass && $values["Publicise"] != 1){
|
||||
if (!$isSass && $values["Publicise"] != 1) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
if(isset($values["Privacy"])){
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
if(!$isSass){
|
||||
if (!$isSass) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetStationCity($values["City"]);
|
||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||
Application_Model_Preference::SetStationLogo($imagePath);
|
||||
if(!$isSass && isset($values["Privacy"])){
|
||||
if (!$isSass && isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
}
|
||||
|
@ -115,11 +115,11 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$privacyChecked = false;
|
||||
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
|
||||
if (Application_Model_Preference::GetPrivacyPolicyCheck() == 1) {
|
||||
$privacyChecked = true;
|
||||
}
|
||||
$this->view->privacyChecked = $privacyChecked;
|
||||
|
@ -132,7 +132,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -159,17 +159,17 @@ class PreferenceController extends Zend_Controller_Action
|
|||
// get current settings
|
||||
$temp = Application_Model_StreamSetting::getStreamSetting();
|
||||
$setting = array();
|
||||
foreach ($temp as $t){
|
||||
foreach ($temp as $t) {
|
||||
$setting[$t['keyname']] = $t['value'];
|
||||
}
|
||||
|
||||
// get predefined type and bitrate from pref table
|
||||
$temp_types = Application_Model_Preference::GetStreamType();
|
||||
$stream_types = array();
|
||||
foreach ($temp_types as $type){
|
||||
if(trim($type) == "ogg"){
|
||||
foreach ($temp_types as $type) {
|
||||
if (trim($type) == "ogg") {
|
||||
$temp = "OGG/VORBIS";
|
||||
}else{
|
||||
} else {
|
||||
$temp = strtoupper(trim($type));
|
||||
}
|
||||
$stream_types[trim($type)] = $temp;
|
||||
|
@ -178,8 +178,8 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
|
||||
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
|
||||
$stream_bitrates = array();
|
||||
foreach ($temp_bitrate as $type){
|
||||
if(intval($type) <= $max_bitrate){
|
||||
foreach ($temp_bitrate as $type) {
|
||||
if (intval($type) <= $max_bitrate) {
|
||||
$stream_bitrates[trim($type)] = strtoupper(trim($type))." Kbit/s";
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$live_stream_subform = new Application_Form_LiveStreamingPreferences();
|
||||
$form->addSubForm($live_stream_subform, "live_stream_subform");
|
||||
|
||||
for($i=1; $i<=$num_of_stream; $i++){
|
||||
for ($i=1; $i<=$num_of_stream; $i++) {
|
||||
$subform = new Application_Form_StreamSettingSubForm();
|
||||
$subform->setPrefix($i);
|
||||
$subform->setSetting($setting);
|
||||
|
@ -208,7 +208,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$error = false;
|
||||
$values = $post_data;
|
||||
|
||||
if($form->isValid($post_data)){
|
||||
if ($form->isValid($post_data)) {
|
||||
if (!$isSaas) {
|
||||
$values['output_sound_device'] = $form->getValue('output_sound_device');
|
||||
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
|
||||
|
@ -232,8 +232,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];
|
||||
if (empty($values["master_harbor_input_port"]) || empty($values["master_harbor_input_mount_point"])) {
|
||||
Application_Model_Preference::SetMasterDJSourceConnectionURL('N/A');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Application_Model_Preference::SetMasterDJSourceConnectionURL($master_connection_url);
|
||||
}
|
||||
} else {
|
||||
|
@ -244,12 +243,10 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"];
|
||||
if (empty($values["dj_harbor_input_port"]) || empty($values["dj_harbor_input_mount_point"])) {
|
||||
Application_Model_Preference::SetLiveDJSourceConnectionURL('N/A');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Application_Model_Preference::SetLiveDJSourceConnectionURL($live_connection_url);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Application_Model_Preference::SetLiveDJSourceConnectionURL($values["live_dj_connection_url"]);
|
||||
}
|
||||
|
||||
|
@ -266,7 +263,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$data = array();
|
||||
$info = Application_Model_StreamSetting::getStreamSetting();
|
||||
$data['setting'] = $info;
|
||||
for($i=1;$i<=$num_of_stream;$i++){
|
||||
for ($i=1;$i<=$num_of_stream;$i++) {
|
||||
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
|
||||
}
|
||||
|
||||
|
@ -290,19 +287,16 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
$result = array();
|
||||
|
||||
if(is_null($path))
|
||||
{
|
||||
if (is_null($path)) {
|
||||
$element = array();
|
||||
$element["name"] = "path should be specified";
|
||||
$element["isFolder"] = false;
|
||||
$element["isError"] = true;
|
||||
$result[$path] = $element;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$path = $path.'/';
|
||||
$handle = opendir($path);
|
||||
if ($handle !== false){
|
||||
if ($handle !== false) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
//only show directories that aren't private.
|
||||
|
@ -329,7 +323,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||
|
||||
$res = Application_Model_MusicDir::setStorDir($chosen);
|
||||
if($res['code'] != 0){
|
||||
if ($res['code'] != 0) {
|
||||
$watched_dirs_form->populate(array('storageFolder' => $chosen));
|
||||
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
||||
}
|
||||
|
@ -344,7 +338,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||
|
||||
$res = Application_Model_MusicDir::addWatchedDir($chosen);
|
||||
if($res['code'] != 0){
|
||||
if ($res['code'] != 0) {
|
||||
$watched_dirs_form->populate(array('watchedFolder' => $chosen));
|
||||
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
||||
}
|
||||
|
@ -373,22 +367,24 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->subform = $watched_dirs_form->render();
|
||||
}
|
||||
|
||||
public function isImportInProgressAction(){
|
||||
public function isImportInProgressAction()
|
||||
{
|
||||
$now = time();
|
||||
$res = false;
|
||||
if(Application_Model_Preference::GetImportTimestamp()+10 > $now){
|
||||
if (Application_Model_Preference::GetImportTimestamp()+10 > $now) {
|
||||
$res = true;
|
||||
}
|
||||
die(json_encode($res));
|
||||
}
|
||||
|
||||
public function getLiquidsoapStatusAction(){
|
||||
public function getLiquidsoapStatusAction()
|
||||
{
|
||||
$out = array();
|
||||
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
|
||||
for($i=1; $i<=$num_of_stream; $i++){
|
||||
for ($i=1; $i<=$num_of_stream; $i++) {
|
||||
$status = Application_Model_StreamSetting::getLiquidsoapError($i);
|
||||
$status = $status == NULL?"Problem with Liquidsoap...":$status;
|
||||
if(!Application_Model_StreamSetting::getStreamEnabled($i)){
|
||||
if (!Application_Model_StreamSetting::getStreamEnabled($i)) {
|
||||
$status = "N/A";
|
||||
}
|
||||
$out[] = array("id"=>$i, "status"=>$status);
|
||||
|
@ -396,16 +392,17 @@ class PreferenceController extends Zend_Controller_Action
|
|||
die(json_encode($out));
|
||||
}
|
||||
|
||||
public function setSourceConnectionUrlAction(){
|
||||
public function setSourceConnectionUrlAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam("type", null);
|
||||
$url = urldecode($request->getParam("url", null));
|
||||
$override = $request->getParam("override", false);
|
||||
|
||||
if($type == 'masterdj'){
|
||||
if ($type == 'masterdj') {
|
||||
Application_Model_Preference::SetMasterDJSourceConnectionURL($url);
|
||||
Application_Model_Preference::SetMasterDjConnectionUrlOverride($override);
|
||||
}elseif($type == 'livedj'){
|
||||
} elseif ($type == 'livedj') {
|
||||
Application_Model_Preference::SetLiveDJSourceConnectionURL($url);
|
||||
Application_Model_Preference::SetLiveDjConnectionUrlOverride($override);
|
||||
}
|
||||
|
@ -413,6 +410,3 @@ class PreferenceController extends Zend_Controller_Action
|
|||
die();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$this->view->preloadShowForm = true;
|
||||
}
|
||||
|
||||
|
@ -110,15 +110,15 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$user = new Application_Model_User($userInfo->id);
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$editable = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$editable = false;
|
||||
}
|
||||
|
||||
$this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
||||
}
|
||||
|
||||
public function getCurrentShowAction() {
|
||||
public function getCurrentShowAction()
|
||||
{
|
||||
$currentShow = Application_Model_Show::GetCurrentShow();
|
||||
if (!empty($currentShow)) {
|
||||
$this->view->si_id = $currentShow[0]["instance_id"];
|
||||
|
@ -140,8 +140,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$error = $showInstance->moveShow($deltaDay, $deltaMin);
|
||||
|
@ -162,10 +163,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
try{
|
||||
try {
|
||||
$show = new Application_Model_Show($showId);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$error = $show->resizeShow($deltaDay, $deltaMin);
|
||||
|
@ -187,9 +189,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
}
|
||||
catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -203,10 +205,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
global $CC_CONFIG;
|
||||
$show_instance = $this->_getParam('id');
|
||||
try{
|
||||
try {
|
||||
$show_inst = new Application_Model_ShowInstance($show_instance);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -225,10 +228,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
try{
|
||||
try {
|
||||
$instance = new Application_Model_ShowInstance($id);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -243,7 +247,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$file = $instance->getRecordedFile();
|
||||
$fileId = $file->getId();
|
||||
|
||||
$menu["view_recorded"] = array("name" => "View Recorded File Metadata", "icon" => "overview",
|
||||
$menu["view_recorded"] = array("name" => "View Recorded File Metadata", "icon" => "overview",
|
||||
"url" => "/library/edit-file-md/id/".$fileId);
|
||||
}
|
||||
|
||||
|
@ -269,13 +273,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
&& $instance->isRecorded()
|
||||
&& Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
||||
$file = $instance->getRecordedFile();
|
||||
$file = $instance->getRecordedFile();
|
||||
$fileId = $file->getId();
|
||||
$scid = $instance->getSoundCloudFileId();
|
||||
|
||||
if ($scid > 0){
|
||||
$url = $file->getSoundCloudLinkToFile();
|
||||
$menu["soundcloud_view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
|
||||
if ($scid > 0) {
|
||||
$url = $file->getSoundCloudLinkToFile();
|
||||
$menu["soundcloud_view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
|
||||
}
|
||||
|
||||
$text = is_null($scid) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud';
|
||||
|
@ -287,8 +291,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
if ($instance->isRecorded()) {
|
||||
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
if (!$instance->isRebroadcast()) {
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form");
|
||||
|
@ -312,8 +315,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$menu["del"]["items"]["single"] = array("name"=> "Delete This Instance", "icon" => "delete", "url" => "/schedule/delete-show");
|
||||
|
||||
$menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => "/schedule/cancel-show");
|
||||
}
|
||||
else if ($isAdminOrPM){
|
||||
} elseif ($isAdminOrPM) {
|
||||
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show");
|
||||
}
|
||||
|
@ -327,10 +329,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showInstanceId = $this->_getParam('id');
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
try{
|
||||
try {
|
||||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -344,15 +347,15 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show = Application_Model_Show::GetCurrentShow();
|
||||
|
||||
/* Convert all UTC times to localtime before sending back to user. */
|
||||
if (isset($range["previous"])){
|
||||
if (isset($range["previous"])) {
|
||||
$range["previous"]["starts"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["previous"]["starts"]);
|
||||
$range["previous"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["previous"]["ends"]);
|
||||
}
|
||||
if (isset($range["current"])){
|
||||
if (isset($range["current"])) {
|
||||
$range["current"]["starts"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["current"]["starts"]);
|
||||
$range["current"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["current"]["ends"]);
|
||||
}
|
||||
if (isset($range["next"])){
|
||||
if (isset($range["next"])) {
|
||||
$range["next"]["starts"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["next"]["starts"]);
|
||||
$range["next"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]);
|
||||
}
|
||||
|
@ -391,14 +394,15 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
try{
|
||||
try {
|
||||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
||||
$show->removeGroupFromShow($group_id);
|
||||
}
|
||||
|
||||
|
@ -412,19 +416,21 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function showContentDialogAction()
|
||||
{
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
try{
|
||||
try {
|
||||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$originalShowId = $show->isRebroadcast();
|
||||
if (!is_null($originalShowId)){
|
||||
try{
|
||||
if (!is_null($originalShowId)) {
|
||||
try {
|
||||
$originalShow = new Application_Model_ShowInstance($originalShowId);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$originalShowName = $originalShow->getName();
|
||||
|
@ -506,12 +512,10 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$formRepeats->disable();
|
||||
$formStyle->disable();
|
||||
|
||||
|
||||
//$formRecord->disable();
|
||||
//$formAbsoluteRebroadcast->disable();
|
||||
//$formRebroadcast->disable();
|
||||
|
||||
|
||||
$this->view->action = "edit-show-instance";
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
}*/
|
||||
|
@ -529,21 +533,22 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$type = $this->_getParam('type');
|
||||
|
||||
$this->view->action = "edit-show";
|
||||
try{
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
}catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
$isDJ = $user->isHost($showInstance->getShowId());
|
||||
|
||||
if(!($isAdminOrPM || $isDJ)) {
|
||||
if (!($isAdminOrPM || $isDJ)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($isDJ){
|
||||
if ($isDJ) {
|
||||
$this->view->action = "dj-edit-show";
|
||||
}
|
||||
|
||||
|
@ -590,12 +595,12 @@ class ScheduleController extends Zend_Controller_Action
|
|||
'add_show_duration' => $show->getDuration(true),
|
||||
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
||||
|
||||
if ($show->isStartDateTimeInPast()){
|
||||
if ($show->isStartDateTimeInPast()) {
|
||||
// for a non-repeating show, we should never allow user to change the start time.
|
||||
// for the repeating show, we should allow because the form works as repeating template form
|
||||
if(!$showInstance->getShow()->isRepeating()){
|
||||
if (!$showInstance->getShow()->isRepeating()) {
|
||||
$formWhen->disableStartDateAndTime();
|
||||
}else{
|
||||
} else {
|
||||
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
|
||||
}
|
||||
}
|
||||
|
@ -603,7 +608,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
//need to get the days of the week in the php timezone (for the front end).
|
||||
$days = array();
|
||||
$showDays = CcShowDaysQuery::create()->filterByDbShowId($showInstance->getShowId())->find();
|
||||
foreach($showDays as $showDay){
|
||||
foreach ($showDays as $showDay) {
|
||||
$showStartDay = new DateTime($showDay->getDbFirstShow(), new DateTimeZone($showDay->getDbTimezone()));
|
||||
$showStartDay->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
array_push($days, $showStartDay->format('w'));
|
||||
|
@ -620,7 +625,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$hosts = array();
|
||||
$showHosts = CcShowHostsQuery::create()->filterByDbShow($showInstance->getShowId())->find();
|
||||
foreach($showHosts as $showHost){
|
||||
foreach ($showHosts as $showHost) {
|
||||
array_push($hosts, $showHost->getDbHost());
|
||||
}
|
||||
$formWho->populate(array('add_show_hosts' => $hosts));
|
||||
|
@ -629,7 +634,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$formLive->populate($show->getLiveStreamInfo());
|
||||
|
||||
if(!$isSaas){
|
||||
if (!$isSaas) {
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
@ -652,7 +657,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$rebroadcastsRelative = $show->getRebroadcastsRelative();
|
||||
$rebroadcastFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsRelative as $rebroadcast){
|
||||
foreach ($rebroadcastsRelative as $rebroadcast) {
|
||||
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
|
||||
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = Application_Common_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||
$i++;
|
||||
|
@ -662,20 +667,20 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
|
||||
$rebroadcastAbsoluteFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsAbsolute as $rebroadcast){
|
||||
foreach ($rebroadcastsAbsolute as $rebroadcast) {
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = $rebroadcast['start_time'];
|
||||
$i++;
|
||||
}
|
||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||
if(!$isAdminOrPM){
|
||||
if (!$isAdminOrPM) {
|
||||
$formRecord->disable();
|
||||
$formAbsoluteRebroadcast->disable();
|
||||
$formRebroadcast->disable();
|
||||
}
|
||||
}
|
||||
|
||||
if(!$isAdminOrPM){
|
||||
if (!$isAdminOrPM) {
|
||||
$formWhat->disable();
|
||||
$formWho->disable();
|
||||
$formWhen->disable();
|
||||
|
@ -687,22 +692,23 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->entries = 5;
|
||||
}
|
||||
|
||||
public function getFormAction() {
|
||||
|
||||
public function getFormAction()
|
||||
{
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
}
|
||||
|
||||
public function djEditShowAction(){
|
||||
public function djEditShowAction()
|
||||
{
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
//need to convert from serialized jQuery array.
|
||||
foreach($js as $j){
|
||||
foreach ($js as $j) {
|
||||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
|
@ -721,12 +727,12 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$data = array();
|
||||
|
||||
//need to convert from serialized jQuery array.
|
||||
foreach($js as $j){
|
||||
foreach ($js as $j) {
|
||||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
$success = Application_Model_Schedule::updateShowInstance($data, $this);
|
||||
if ($success){
|
||||
if ($success) {
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
} else {
|
||||
|
@ -735,21 +741,21 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
}*/
|
||||
|
||||
public function editShowAction(){
|
||||
|
||||
public function editShowAction()
|
||||
{
|
||||
//1) Get add_show_start_date since it might not have been sent
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
//need to convert from serialized jQuery array.
|
||||
foreach($js as $j){
|
||||
foreach ($js as $j) {
|
||||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
$data['add_show_day_check'] = $this->_getParam('days');
|
||||
|
||||
if($data['add_show_day_check'] == "") {
|
||||
if ($data['add_show_day_check'] == "") {
|
||||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
|
@ -757,14 +763,14 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$validateStartDate = true;
|
||||
$validateStartTime = true;
|
||||
if (!array_key_exists('add_show_start_date', $data)){
|
||||
if (!array_key_exists('add_show_start_date', $data)) {
|
||||
//Changing the start date was disabled, since the
|
||||
//array key does not exist. We need to repopulate this entry from the db.
|
||||
//The start date will be returned in UTC time, so lets convert it to local time.
|
||||
$dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime());
|
||||
$data['add_show_start_date'] = $dt->format("Y-m-d");
|
||||
|
||||
if (!array_key_exists('add_show_start_time', $data)){
|
||||
if (!array_key_exists('add_show_start_time', $data)) {
|
||||
$data['add_show_start_time'] = $dt->format("H:i");
|
||||
$validateStartTime = false;
|
||||
}
|
||||
|
@ -775,14 +781,14 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$origianlShowStartDateTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime());
|
||||
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate, $origianlShowStartDateTime, true, $data['add_show_instance_id']);
|
||||
|
||||
if ($success){
|
||||
if ($success) {
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
} else {
|
||||
if (!$validateStartDate){
|
||||
if (!$validateStartDate) {
|
||||
$this->view->when->getElement('add_show_start_date')->setOptions(array('disabled' => true));
|
||||
}
|
||||
if(!$validateStartTime){
|
||||
if (!$validateStartTime) {
|
||||
$this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true));
|
||||
}
|
||||
$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
|
@ -792,26 +798,27 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function addShowAction(){
|
||||
public function addShowAction()
|
||||
{
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
//need to convert from serialized jQuery array.
|
||||
foreach($js as $j){
|
||||
foreach ($js as $j) {
|
||||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
$data['add_show_day_check'] = $this->_getParam('days');
|
||||
|
||||
if($data['add_show_day_check'] == "") {
|
||||
if ($data['add_show_day_check'] == "") {
|
||||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
$validateStartDate = true;
|
||||
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate);
|
||||
|
||||
if ($success){
|
||||
if ($success) {
|
||||
$this->view->addNewShow = true;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
} else {
|
||||
|
@ -829,8 +836,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
try {
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$show = new Application_Model_Show($showInstance->getShowId());
|
||||
|
@ -847,23 +855,23 @@ class ScheduleController extends Zend_Controller_Action
|
|||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->cancelShow($id);
|
||||
// send kick out source stream signal to pypo
|
||||
$data = array("sourcename"=>"live_dj");
|
||||
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
||||
} catch (Exception $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function contentContextMenuAction(){
|
||||
public function contentContextMenuAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
|
@ -891,7 +899,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
* Sets the user specific preference for which time scale to use in Calendar.
|
||||
* This is only being used by schedule.js at the moment.
|
||||
*/
|
||||
public function setTimeScaleAction() {
|
||||
public function setTimeScaleAction()
|
||||
{
|
||||
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
|
||||
}
|
||||
|
||||
|
@ -899,17 +908,19 @@ class ScheduleController extends Zend_Controller_Action
|
|||
* Sets the user specific preference for which time interval to use in Calendar.
|
||||
* This is only being used by schedule.js at the moment.
|
||||
*/
|
||||
public function setTimeIntervalAction() {
|
||||
public function setTimeIntervalAction()
|
||||
{
|
||||
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
|
||||
}
|
||||
|
||||
public function calculateDurationAction() {
|
||||
public function calculateDurationAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$startParam = $this->_getParam('startTime');
|
||||
$endParam = $this->_getParam('endTime');
|
||||
|
||||
try{
|
||||
try {
|
||||
$startDateTime = new DateTime($startParam);
|
||||
$endDateTime = new DateTime($endParam);
|
||||
|
||||
|
@ -919,17 +930,17 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
||||
|
||||
$day = intval($duration->format('%d'));
|
||||
if($day > 0){
|
||||
if ($day > 0) {
|
||||
$hour = intval($duration->format('%h'));
|
||||
$min = intval($duration->format('%i'));
|
||||
$hour += $day * 24;
|
||||
$hour = min($hour, 99);
|
||||
$sign = $duration->format('%r');
|
||||
$result = sprintf('%s%02dh %02dm', $sign, $hour, $min);
|
||||
}else{
|
||||
} else {
|
||||
$result = $duration->format('%r%Hh %Im');
|
||||
}
|
||||
}catch (Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$result = "Invalid Date";
|
||||
}
|
||||
|
||||
|
@ -937,4 +948,3 @@ class ScheduleController extends Zend_Controller_Action
|
|||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,130 +16,125 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction() {
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
global $CC_CONFIG;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$userType = $user->getType();
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
||||
|
||||
$data = Application_Model_Preference::getValue("library_datatable", true);
|
||||
if ($data != "") {
|
||||
$libraryTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
||||
}
|
||||
else {
|
||||
$data = Application_Model_Preference::getValue("library_datatable", true);
|
||||
if ($data != "") {
|
||||
$libraryTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
||||
} else {
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
||||
}
|
||||
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$timelineTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||
}
|
||||
else {
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||
} else {
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
|
||||
}
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript');
|
||||
|
||||
$refer_sses = new Zend_Session_Namespace('referrer');
|
||||
|
||||
if ($request->isPost()) {
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] != 1 && $form->isValid($values)) {
|
||||
$refer_sses = new Zend_Session_Namespace('referrer');
|
||||
|
||||
if ($request->isPost()) {
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] != 1 && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$form->Logo->receive();
|
||||
$imagePath = $form->Logo->getFileName();
|
||||
|
||||
Application_Model_Preference::SetStationCountry($values["Country"]);
|
||||
Application_Model_Preference::SetStationCity($values["City"]);
|
||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||
Application_Model_Preference::SetStationLogo($imagePath);
|
||||
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
} elseif ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$form->Logo->receive();
|
||||
$imagePath = $form->Logo->getFileName();
|
||||
|
||||
Application_Model_Preference::SetStationCountry($values["Country"]);
|
||||
Application_Model_Preference::SetStationCity($values["City"]);
|
||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||
Application_Model_Preference::SetStationLogo($imagePath);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
|
||||
if (isset($values["Privacy"])){
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
} else {
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
else {
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
}
|
||||
|
||||
//popup if previous page was login
|
||||
if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
|
||||
//popup if previous page was login
|
||||
if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
|
||||
//determine whether to remove/hide/display the library.
|
||||
$showLib = false;
|
||||
$showLib = false;
|
||||
if (!$user->isGuest()) {
|
||||
$disableLib = false;
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$settings = unserialize($data);
|
||||
|
||||
if ($settings["library"] == "true") {
|
||||
$showLib = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$disableLib = true;
|
||||
}
|
||||
$this->view->disableLib = $disableLib;
|
||||
|
@ -175,36 +170,36 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$now = floatval(microtime(true));
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
||||
$menu["preview"] = array("name"=> "Preview", "icon" => "play");
|
||||
//select the cursor
|
||||
$menu["selCurs"] = array("name"=> "Select Cursor","icon" => "select-cursor");
|
||||
$menu["delCurs"] = array("name"=> "Remove Cursor","icon" => "select-cursor");
|
||||
|
||||
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
|
||||
|
||||
//remove/truncate the item from the schedule
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
public function contextMenuAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$now = floatval(microtime(true));
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
||||
$menu["preview"] = array("name"=> "Preview", "icon" => "play");
|
||||
//select the cursor
|
||||
$menu["selCurs"] = array("name"=> "Select Cursor","icon" => "select-cursor");
|
||||
$menu["delCurs"] = array("name"=> "Remove Cursor","icon" => "select-cursor");
|
||||
|
||||
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
|
||||
|
||||
//remove/truncate the item from the schedule
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
||||
public function builderDialogAction() {
|
||||
|
||||
public function builderDialogAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam("id");
|
||||
|
||||
|
@ -212,6 +207,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
if (is_null($instance)) {
|
||||
$this->view->error = "show does not exist";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -231,8 +227,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->dialog = $this->view->render('showbuilder/builderDialog.phtml');
|
||||
}
|
||||
|
||||
public function checkBuilderFeedAction() {
|
||||
|
||||
public function checkBuilderFeedAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
|
@ -254,14 +250,13 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
// -1 default will always call the schedule to be sent back if no timestamp is defined.
|
||||
if ($showBuilder->hasBeenUpdatedSince($timestamp, $instances)) {
|
||||
$this->view->update = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->view->update = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function builderFeedAction() {
|
||||
|
||||
public function builderFeedAction()
|
||||
{
|
||||
$start = microtime(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
@ -285,14 +280,14 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->instances = $data["showInstances"];
|
||||
$this->view->timestamp = $current_time;
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("getting builder feed info took:");
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("getting builder feed info took:");
|
||||
Logging::debug(floatval($end) - floatval($start));
|
||||
}
|
||||
|
||||
public function scheduleAddAction() {
|
||||
|
||||
public function scheduleAddAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$mediaItems = $request->getParam("mediaIds", array());
|
||||
$scheduledItems = $request->getParam("schedIds", array());
|
||||
|
@ -300,14 +295,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->scheduleAfter($scheduledItems, $mediaItems);
|
||||
}
|
||||
catch (OutDatedScheduleException $e) {
|
||||
} catch (OutDatedScheduleException $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
|
@ -323,14 +316,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->removeItems($items);
|
||||
}
|
||||
catch (OutDatedScheduleException $e) {
|
||||
} catch (OutDatedScheduleException $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
|
@ -338,8 +329,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function scheduleMoveAction() {
|
||||
|
||||
public function scheduleMoveAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$selectedItems = $request->getParam("selectedItem");
|
||||
$afterItem = $request->getParam("afterItem");
|
||||
|
@ -347,14 +338,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->moveItem($selectedItems, $afterItem);
|
||||
}
|
||||
catch (OutDatedScheduleException $e) {
|
||||
} catch (OutDatedScheduleException $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
|
@ -362,8 +351,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function scheduleReorderAction() {
|
||||
|
||||
public function scheduleReorderAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$showInstance = $request->getParam("instanceId");
|
||||
|
|
|
@ -38,10 +38,9 @@ class UserController extends Zend_Controller_Action
|
|||
if ($form->isValid($request->getPost())) {
|
||||
|
||||
$formdata = $form->getValues();
|
||||
if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 && $formdata['login'] == 'admin' && $formdata['user_id'] != 0){
|
||||
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 && $formdata['login'] == 'admin' && $formdata['user_id'] != 0) {
|
||||
$this->view->successMessage = "<div class='errors'>Specific action is not allowed in demo version!</div>";
|
||||
}
|
||||
else if ($form->validateLogin($formdata)){
|
||||
} elseif ($form->validateLogin($formdata)) {
|
||||
$user = new Application_Model_User($formdata['user_id']);
|
||||
$user->setFirstName($formdata['first_name']);
|
||||
$user->setLastName($formdata['last_name']);
|
||||
|
@ -57,7 +56,7 @@ class UserController extends Zend_Controller_Action
|
|||
|
||||
$form->reset();
|
||||
|
||||
if (strlen($formdata['user_id']) == 0){
|
||||
if (strlen($formdata['user_id']) == 0) {
|
||||
$this->view->successMessage = "<div class='success'>User added successfully!</div>";
|
||||
} else {
|
||||
$this->view->successMessage = "<div class='success'>User updated successfully!</div>";
|
||||
|
@ -98,23 +97,11 @@ class UserController extends Zend_Controller_Action
|
|||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$userId = $userInfo->id;
|
||||
|
||||
if ($delId != $userId){
|
||||
if ($delId != $userId) {
|
||||
$user = new Application_Model_User($delId);
|
||||
$this->view->entries = $user->delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,31 +11,31 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
->addActionContext('get-library-datatable', 'json')
|
||||
->addActionContext('set-library-datatable', 'json')
|
||||
->addActionContext('get-timeline-datatable', 'json')
|
||||
->addActionContext('set-timeline-datatable', 'json')
|
||||
->addActionContext('set-timeline-datatable', 'json')
|
||||
->addActionContext('remindme', 'json')
|
||||
->addActionContext('donotshowregistrationpopup', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function setNowPlayingScreenSettingsAction() {
|
||||
public function setNowPlayingScreenSettingsAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::setValue("nowplaying_screen", $data, true);
|
||||
}
|
||||
|
||||
public function getNowPlayingScreenSettingsAction() {
|
||||
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
public function getNowPlayingScreenSettingsAction()
|
||||
{
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function setLibraryDatatableAction() {
|
||||
|
||||
public function setLibraryDatatableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
|
@ -43,16 +43,16 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
Application_Model_Preference::setValue("library_datatable", $data, true);
|
||||
}
|
||||
|
||||
public function getLibraryDatatableAction() {
|
||||
|
||||
public function getLibraryDatatableAction()
|
||||
{
|
||||
$data = Application_Model_Preference::getValue("library_datatable", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function setTimelineDatatableAction() {
|
||||
|
||||
public function setTimelineDatatableAction()
|
||||
{
|
||||
$start = microtime(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
@ -67,8 +67,8 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
Logging::debug(floatval($end) - floatval($start));
|
||||
}
|
||||
|
||||
public function getTimelineDatatableAction() {
|
||||
|
||||
public function getTimelineDatatableAction()
|
||||
{
|
||||
$start = microtime(true);
|
||||
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
|
@ -76,22 +76,22 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("getting timeline datatables info took:");
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("getting timeline datatables info took:");
|
||||
Logging::debug(floatval($end) - floatval($start));
|
||||
}
|
||||
|
||||
public function remindmeAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
Application_Model_Preference::SetRemindMeDate();
|
||||
}
|
||||
|
||||
public function donotshowregistrationpopupAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
public function remindmeAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
Application_Model_Preference::SetRemindMeDate();
|
||||
}
|
||||
}
|
||||
|
||||
public function donotshowregistrationpopupAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
/**
|
||||
* Sets the ACL object
|
||||
*
|
||||
* @param mixed $aclData
|
||||
* @param mixed $aclData
|
||||
* @return void
|
||||
**/
|
||||
public function setAcl(Zend_Acl $aclData)
|
||||
|
@ -77,9 +77,9 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
/**
|
||||
* Sets the error page
|
||||
*
|
||||
* @param string $action
|
||||
* @param string $controller
|
||||
* @param string $module
|
||||
* @param string $action
|
||||
* @param string $controller
|
||||
* @param string $module
|
||||
* @return void
|
||||
**/
|
||||
public function setErrorPage($action, $controller = 'error', $module = null)
|
||||
|
@ -109,20 +109,19 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$controller = strtolower($request->getControllerName());
|
||||
|
||||
if (in_array($controller, array("api", "auth"))){
|
||||
|
||||
$this->setRoleName("G");
|
||||
}
|
||||
else if (!Zend_Auth::getInstance()->hasIdentity()){
|
||||
|
||||
|
||||
if (in_array($controller, array("api", "auth"))) {
|
||||
|
||||
$this->setRoleName("G");
|
||||
} elseif (!Zend_Auth::getInstance()->hasIdentity()) {
|
||||
|
||||
if ($controller !== 'login') {
|
||||
|
||||
if ($request->isXmlHttpRequest()) {
|
||||
|
||||
$url = 'http://'.$request->getHttpHost().'/login';
|
||||
$json = Zend_Json::encode(array('auth' => false, 'url' => $url));
|
||||
|
||||
|
||||
// Prepare response
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(401)
|
||||
|
@ -131,14 +130,12 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
//redirectAndExit() cleans up, sends the headers and stops the script
|
||||
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
|
||||
$r->gotoSimpleAndExit('index', 'login', $request->getModuleName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$this->setRoleName($userInfo->type);
|
||||
|
|
|
@ -7,7 +7,7 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
|||
if (Application_Model_RabbitMq::$doPush) {
|
||||
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
|
||||
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||
if (!isset($_SERVER['AIRTIME_SRV'])){
|
||||
if (!isset($_SERVER['AIRTIME_SRV'])) {
|
||||
Application_Model_RabbitMq::SendMessageToShowRecorder("update_recorder_schedule");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue