parent
5661872034
commit
794cf2c845
|
@ -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())) {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -113,11 +115,9 @@ 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)) {
|
||||
|
@ -162,6 +162,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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())
|
||||
{
|
||||
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);
|
||||
|
@ -471,7 +463,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->view->watched_dirs = $watchedDirsPath;
|
||||
}
|
||||
|
||||
public function reloadMetadataAction() {
|
||||
public function reloadMetadataAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$mode = $request->getParam('mode');
|
||||
|
@ -496,12 +489,12 @@ 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()) {
|
||||
// file marked as exists
|
||||
$this->view->error = "File already exists in Airtime.";
|
||||
|
||||
return;
|
||||
} else {
|
||||
// file marked as not exists
|
||||
|
@ -509,8 +502,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$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,41 +510,39 @@ 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);
|
||||
|
@ -560,19 +550,22 @@ class ApiController extends Zend_Controller_Action
|
|||
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();
|
||||
|
@ -589,35 +582,40 @@ class ApiController extends Zend_Controller_Action
|
|||
$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";
|
||||
|
||||
|
@ -639,7 +637,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$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');
|
||||
|
@ -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();
|
||||
|
@ -820,6 +822,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$h = new Application_Model_User($host['subjs_id']);
|
||||
if ($username == $h->getLogin() && md5($password) == $h->getPassword()) {
|
||||
$this->view->msg = true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -855,4 +858,3 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ 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);
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
@ -41,7 +42,8 @@ class DashboardController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function switchSourceAction(){
|
||||
public function switchSourceAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$sourcename = $this->_getParam('sourcename');
|
||||
$current_status = $this->_getParam('status');
|
||||
|
@ -78,8 +80,7 @@ class DashboardController extends Zend_Controller_Action
|
|||
Application_Model_LiveLog::SetNewLogTime($sourcename == 'scheduled_play'?'S':'L',
|
||||
new DateTime("now", new DateTimeZone('UTC')));
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if ($source_connected) {
|
||||
$this->view->error = "You don't have permission to switch source.";
|
||||
} else {
|
||||
|
@ -92,8 +93,8 @@ class DashboardController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function switchOffSource(){
|
||||
|
||||
public function switchOffSource()
|
||||
{
|
||||
}
|
||||
|
||||
public function streamPlayerAction()
|
||||
|
@ -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
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -63,8 +63,7 @@ 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()) {
|
||||
|
@ -76,7 +75,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//SOUNDCLOUD MENU OPTIONS
|
||||
if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
||||
|
@ -95,8 +93,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
if (!is_null($scid)) {
|
||||
$text = "Re-upload to SoundCloud";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$text = "Upload to SoundCloud";
|
||||
}
|
||||
|
||||
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +143,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
if (!$hasPermission) {
|
||||
$this->view->message = "You don't have a permission to delete all playlists/files that are selected.";
|
||||
|
||||
return;
|
||||
} else {
|
||||
Application_Model_Playlist::DeletePlaylists($playlists);
|
||||
|
@ -186,11 +183,9 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
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"/>';
|
||||
}
|
||||
}
|
||||
|
@ -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,15 +29,13 @@ 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())) {
|
||||
$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');
|
||||
|
@ -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']);
|
||||
|
@ -108,8 +102,7 @@ class LoginController extends Zend_Controller_Action
|
|||
|
||||
if (!Application_Model_Preference::GetEnableSystemEmail()) {
|
||||
$this->_redirect('login');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//uses separate layout without a navigation.
|
||||
$this->_helper->layout->setLayout('login');
|
||||
|
||||
|
@ -130,8 +123,7 @@ class LoginController extends Zend_Controller_Action
|
|||
} 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 {
|
||||
} else {
|
||||
$form->email->addError($this->view->translate("Given email not found."));
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +186,3 @@ class LoginController extends Zend_Controller_Action
|
|||
$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');
|
||||
}
|
||||
}
|
||||
|
@ -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,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
class PlayoutHistoryController extends Zend_Controller_Action
|
||||
class PlayouthistoryController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
|
|
|
@ -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"}');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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"]);
|
||||
}
|
||||
|
||||
|
@ -290,16 +287,13 @@ 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) {
|
||||
|
@ -373,7 +367,8 @@ 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) {
|
||||
|
@ -382,7 +377,8 @@ class PreferenceController extends Zend_Controller_Action
|
|||
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++) {
|
||||
|
@ -396,7 +392,8 @@ 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));
|
||||
|
@ -413,6 +410,3 @@ class PreferenceController extends Zend_Controller_Action
|
|||
die();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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"];
|
||||
|
@ -142,6 +142,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$error = $showInstance->moveShow($deltaDay, $deltaMin);
|
||||
|
@ -166,6 +167,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show = new Application_Model_Show($showId);
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
@ -207,6 +209,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show_inst = new Application_Model_ShowInstance($show_instance);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -229,6 +232,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$instance = new Application_Model_ShowInstance($id);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -331,6 +333,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -395,6 +398,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -416,6 +420,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$show = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -425,6 +430,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$originalShow = new Application_Model_ShowInstance($originalShowId);
|
||||
} 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');
|
||||
}*/
|
||||
|
@ -533,6 +537,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -687,8 +692,8 @@ 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))) {
|
||||
|
@ -697,7 +702,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function djEditShowAction(){
|
||||
public function djEditShowAction()
|
||||
{
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
|
@ -735,8 +741,8 @@ 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();
|
||||
|
@ -792,7 +798,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function addShowAction(){
|
||||
public function addShowAction()
|
||||
{
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
|
@ -831,6 +838,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
} catch (Exception $e) {
|
||||
$this->view->show_error = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
$show = new Application_Model_Show($showInstance->getShowId());
|
||||
|
@ -853,8 +861,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
// send kick out source stream signal to pypo
|
||||
$data = array("sourcename"=>"live_dj");
|
||||
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
|
@ -863,7 +870,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
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,11 +908,13 @@ 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');
|
||||
|
@ -937,4 +948,3 @@ class ScheduleController extends Zend_Controller_Action
|
|||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction() {
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
@ -31,8 +31,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
if ($data != "") {
|
||||
$libraryTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
||||
}
|
||||
|
||||
|
@ -40,8 +39,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
if ($data != "") {
|
||||
$timelineTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
|
||||
}
|
||||
|
||||
|
@ -79,8 +77,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
} 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"]);
|
||||
|
@ -101,8 +98,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
|
@ -138,8 +134,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$showLib = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$disableLib = true;
|
||||
}
|
||||
$this->view->disableLib = $disableLib;
|
||||
|
@ -203,8 +198,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$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();
|
||||
|
@ -291,8 +286,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
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");
|
||||
|
|
|
@ -40,8 +40,7 @@ class UserController extends Zend_Controller_Action
|
|||
$formdata = $form->getValues();
|
||||
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']);
|
||||
|
@ -105,16 +104,4 @@ class UserController extends Zend_Controller_Action
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
->initContext();
|
||||
}
|
||||
|
||||
public function setNowPlayingScreenSettingsAction() {
|
||||
|
||||
public function setNowPlayingScreenSettingsAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
|
@ -26,16 +26,16 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
Application_Model_Preference::setValue("nowplaying_screen", $data, true);
|
||||
}
|
||||
|
||||
public function getNowPlayingScreenSettingsAction() {
|
||||
|
||||
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);
|
||||
|
|
|
@ -113,8 +113,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|||
if (in_array($controller, array("api", "auth"))) {
|
||||
|
||||
$this->setRoleName("G");
|
||||
}
|
||||
else if (!Zend_Auth::getInstance()->hasIdentity()){
|
||||
} elseif (!Zend_Auth::getInstance()->hasIdentity()) {
|
||||
|
||||
if ($controller !== 'login') {
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Auth {
|
||||
|
||||
class Application_Model_Auth
|
||||
{
|
||||
const TOKEN_LIFETIME = 'P2D'; // DateInterval syntax
|
||||
|
||||
private function generateToken($action, $user_id)
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
class Application_Model_Dashboard
|
||||
{
|
||||
|
||||
public static function GetPreviousItem($p_timeNow){
|
||||
public static function GetPreviousItem($p_timeNow)
|
||||
{
|
||||
//get previous show and previous item in the schedule table.
|
||||
//Compare the two and if the last show was recorded and started
|
||||
//after the last item in the schedule table, then return the show's
|
||||
|
@ -46,7 +47,8 @@ class Application_Model_Dashboard
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetCurrentItem($p_timeNow){
|
||||
public static function GetCurrentItem($p_timeNow)
|
||||
{
|
||||
//get previous show and previous item in the schedule table.
|
||||
//Compare the two and if the last show was recorded and started
|
||||
//after the last item in the schedule table, then return the show's
|
||||
|
@ -66,6 +68,7 @@ class Application_Model_Dashboard
|
|||
* just in case we allow tracks to be scheduled without a show
|
||||
* in the future.
|
||||
*/
|
||||
|
||||
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||
"starts"=>$row[0]["starts"],
|
||||
"ends"=>$row[0]["ends"]);
|
||||
|
@ -92,7 +95,8 @@ class Application_Model_Dashboard
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetNextItem($p_timeNow){
|
||||
public static function GetNextItem($p_timeNow)
|
||||
{
|
||||
//get previous show and previous item in the schedule table.
|
||||
//Compare the two and if the last show was recorded and started
|
||||
//after the last item in the schedule table, then return the show's
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Datatables {
|
||||
|
||||
class Application_Model_Datatables
|
||||
{
|
||||
/*
|
||||
* query used to return data for a paginated/searchable datatable.
|
||||
*/
|
||||
|
@ -64,8 +64,7 @@ class Application_Model_Datatables {
|
|||
if ($displayLength !== -1) {
|
||||
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
|
||||
|
||||
//limit the results returned.
|
||||
|
@ -81,16 +80,14 @@ class Application_Model_Datatables {
|
|||
if (isset($sqlTotalDisplayRows)) {
|
||||
$r = $con->query($sqlTotalDisplayRows);
|
||||
$totalDisplayRows = $r->fetchColumn(0);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
|
||||
$r = $con->query($sql);
|
||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$results = $r->fetchAll();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Logging::debug($e->getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Email {
|
||||
|
||||
class Application_Model_Email
|
||||
{
|
||||
/**
|
||||
* Send email
|
||||
*
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
class Application_Model_LiveLog
|
||||
{
|
||||
|
||||
public static function GetLiveShowDuration($p_keepData=false) {
|
||||
public static function GetLiveShowDuration($p_keepData=false)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -87,11 +88,11 @@ class Application_Model_LiveLog
|
|||
$seconds = explode(".", $seconds);
|
||||
if (isset($seconds[0])) {
|
||||
$minutes = (double) (($hours*60)+$minutes . "." . $seconds[0]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$minutes = (double) (($hours*60)+$minutes);
|
||||
}
|
||||
}
|
||||
|
||||
return $minutes;
|
||||
} catch (Exception $e) {
|
||||
header('HTTP/1.0 503 Service Unavailable');
|
||||
|
@ -119,8 +120,7 @@ class Application_Model_LiveLog
|
|||
$last_row = self::UpdateLastLogEndTime(array_pop($rows));
|
||||
array_push($rows, $last_row);
|
||||
$skip = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sql = "SELECT * FROM CC_LIVE_LOG"
|
||||
." WHERE state = 'S'"
|
||||
." ORDER BY id";
|
||||
|
@ -191,22 +191,19 @@ class Application_Model_LiveLog
|
|||
if ($clip_length_seconds / 3600 >= 1) {
|
||||
array_push($clip_length_arr, str_pad(floor($clip_length_seconds / 3600), 2, "0", STR_PAD_LEFT));
|
||||
$clip_length_seconds -= floor($clip_length_seconds / 3600);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
array_push($clip_length_arr, "00");
|
||||
}
|
||||
if ($clip_length_seconds / 60 >= 1) {
|
||||
array_push($clip_length_arr, str_pad(floor($clip_length_seconds / 60), 2, "0", STR_PAD_LEFT));
|
||||
$clip_length_seconds -= floor($clip_length_seconds / 60);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
array_push($clip_length_arr, "00");
|
||||
}
|
||||
|
||||
array_push($clip_length_arr, str_pad($clip_length_seconds, 2, "0", STR_PAD_LEFT));
|
||||
$clip_length = implode(":", $clip_length_arr);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$clip_length = $track['clip_length'];
|
||||
}
|
||||
|
||||
|
@ -249,11 +246,11 @@ class Application_Model_LiveLog
|
|||
$seconds = explode(".", $seconds);
|
||||
if (isset($seconds[0])) {
|
||||
$minutes = (double) (($hours*60)+$minutes . "." . $seconds[0]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$minutes = (double) (($hours*60)+$minutes);
|
||||
}
|
||||
}
|
||||
|
||||
return $minutes;
|
||||
} catch (Exception $e) {
|
||||
header('HTTP/1.0 503 Service Unavailable');
|
||||
|
@ -262,7 +259,8 @@ class Application_Model_LiveLog
|
|||
}
|
||||
}
|
||||
|
||||
public static function UpdateLastLogEndTime($log) {
|
||||
public static function UpdateLastLogEndTime($log)
|
||||
{
|
||||
if ($log['end_time'] == null) {
|
||||
$current_time = new DateTime("now", new DateTimeZone('UTC'));
|
||||
$log['end_time'] = $current_time;
|
||||
|
@ -270,10 +268,12 @@ class Application_Model_LiveLog
|
|||
self::SetEndTime($log['state'], $current_time, true);
|
||||
self::SetNewLogTime($log['state'], $current_time);
|
||||
}
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
public static function SetNewLogTime($state, $dateTime){
|
||||
public static function SetNewLogTime($state, $dateTime)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -306,7 +306,8 @@ class Application_Model_LiveLog
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetEndTime($state, $dateTime, $override=false){
|
||||
public static function SetEndTime($state, $dateTime, $override=false)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
class Application_Model_LoginAttempts {
|
||||
public function __construct(){
|
||||
|
||||
class Application_Model_LoginAttempts
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function increaseAttempts($ip){
|
||||
public static function increaseAttempts($ip)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$sql = "select count(*) from cc_login_attempts WHERE ip='$ip'";
|
||||
$res = $con->query($sql)->fetchColumn(0);
|
||||
|
@ -17,14 +19,17 @@ class Application_Model_LoginAttempts {
|
|||
}
|
||||
}
|
||||
|
||||
public static function getAttempts($ip){
|
||||
public static function getAttempts($ip)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$sql = "select attempts from cc_login_attempts WHERE ip='$ip'";
|
||||
$res = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return $res ? $res : 0;
|
||||
}
|
||||
|
||||
public static function resetAttempts($ip){
|
||||
public static function resetAttempts($ip)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$sql = "select count(*) from cc_login_attempts WHERE ip='$ip'";
|
||||
$res = $con->query($sql)->fetchColumn(0);
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
class NestedDirectoryException extends Exception { }
|
||||
|
||||
class Application_Model_MusicDir {
|
||||
|
||||
class Application_Model_MusicDir
|
||||
{
|
||||
/**
|
||||
* @holds propel database object
|
||||
*/
|
||||
|
@ -40,21 +40,25 @@ class Application_Model_MusicDir {
|
|||
$this->_dir->save();
|
||||
}
|
||||
|
||||
public function setExistsFlag($flag){
|
||||
public function setExistsFlag($flag)
|
||||
{
|
||||
$this->_dir->setExists($flag);
|
||||
$this->_dir->save();
|
||||
}
|
||||
|
||||
public function setWatchedFlag($flag){
|
||||
public function setWatchedFlag($flag)
|
||||
{
|
||||
$this->_dir->setWatched($flag);
|
||||
$this->_dir->save();
|
||||
}
|
||||
|
||||
public function getWatchedFlag(){
|
||||
public function getWatchedFlag()
|
||||
{
|
||||
return $this->_dir->getWatched();
|
||||
}
|
||||
|
||||
public function getExistsFlag(){
|
||||
public function getExistsFlag()
|
||||
{
|
||||
return $this->_dir->getExists();
|
||||
}
|
||||
|
||||
|
@ -113,7 +117,8 @@ class Application_Model_MusicDir {
|
|||
* @return boolean
|
||||
* Returns true if it is the ancestor, false otherwise.
|
||||
*/
|
||||
private static function isAncestorDir($p_dir1, $p_dir2){
|
||||
private static function isAncestorDir($p_dir1, $p_dir2)
|
||||
{
|
||||
if (strlen($p_dir1) > strlen($p_dir2)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -130,7 +135,8 @@ class Application_Model_MusicDir {
|
|||
* The path we want to validate
|
||||
* @return void
|
||||
*/
|
||||
public static function isPathValid($p_path){
|
||||
public static function isPathValid($p_path)
|
||||
{
|
||||
$dirs = self::getWatchedDirs();
|
||||
$dirs[] = self::getStorDir();
|
||||
|
||||
|
@ -187,7 +193,6 @@ class Application_Model_MusicDir {
|
|||
$dir->setType($p_type);
|
||||
$p_path = Application_Common_OsPath::normpath($p_path)."/";
|
||||
|
||||
|
||||
try {
|
||||
/* isPathValid() checks if path is a substring or a superstring of an
|
||||
* existing dir and if not, throws NestedDirectoryException */
|
||||
|
@ -207,6 +212,7 @@ class Application_Model_MusicDir {
|
|||
return array("code"=>0);
|
||||
} catch (NestedDirectoryException $nde) {
|
||||
$msg = $nde->getMessage();
|
||||
|
||||
return array("code"=>1, "error"=>"$msg");
|
||||
} catch (Exception $e) {
|
||||
return array("code"=>1, "error"=>"'$p_path' is already set as the current storage dir or in the watched folders list");
|
||||
|
@ -271,6 +277,7 @@ class Application_Model_MusicDir {
|
|||
$data["directory"] = $p_path;
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@ -290,9 +297,9 @@ class Application_Model_MusicDir {
|
|||
->findOne();
|
||||
if ($dir == NULL) {
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$mus_dir = new Application_Model_MusicDir($dir);
|
||||
|
||||
return $mus_dir;
|
||||
}
|
||||
}
|
||||
|
@ -355,6 +362,7 @@ class Application_Model_MusicDir {
|
|||
$data["directory"] = $p_dir;
|
||||
$data["dir_id"] = $dirId;
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
|
||||
|
||||
return array("code"=>0);
|
||||
} else {
|
||||
return array("code"=>1, "error"=>"'$p_dir' is already set as the current storage dir or in the watched folders list.");
|
||||
|
@ -373,6 +381,7 @@ class Application_Model_MusicDir {
|
|||
$directory = $dir->getDirectory();
|
||||
if (substr($p_filepath, 0, strlen($directory)) === $directory) {
|
||||
$mus_dir = new Application_Model_MusicDir($dir);
|
||||
|
||||
return $mus_dir;
|
||||
}
|
||||
}
|
||||
|
@ -390,8 +399,8 @@ class Application_Model_MusicDir {
|
|||
* When $userAddedWatchedDir is true, it will set "Watched" flag to false
|
||||
* otherwise, it will set "Exists" flag to true
|
||||
**/
|
||||
public static function removeWatchedDir($p_dir, $userAddedWatchedDir=true){
|
||||
|
||||
public static function removeWatchedDir($p_dir, $userAddedWatchedDir=true)
|
||||
{
|
||||
//make sure that $p_dir has a trailing "/"
|
||||
$real_path = Application_Common_OsPath::normpath($p_dir)."/";
|
||||
if ($real_path != "/") {
|
||||
|
@ -405,6 +414,7 @@ class Application_Model_MusicDir {
|
|||
$data = array();
|
||||
$data["directory"] = $p_dir;
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("remove_watch", $data);
|
||||
|
||||
return array("code"=>0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ require_once 'formatters/LengthFormatter.php';
|
|||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class Application_Model_Playlist {
|
||||
|
||||
class Application_Model_Playlist
|
||||
{
|
||||
/**
|
||||
* propel connection object.
|
||||
*/
|
||||
|
@ -55,8 +55,7 @@ class Application_Model_Playlist {
|
|||
if (is_null($this->pl)) {
|
||||
throw new PlaylistNotFoundException();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->pl = new CcPlaylist();
|
||||
$this->pl->setDbUTime("now", new DateTimeZone("UTC"));
|
||||
$this->pl->save();
|
||||
|
@ -79,7 +78,8 @@ class Application_Model_Playlist {
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId() {
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
@ -117,28 +117,30 @@ class Application_Model_Playlist {
|
|||
return $this->pl->getDbDescription();
|
||||
}
|
||||
|
||||
public function getCreator() {
|
||||
|
||||
public function getCreator()
|
||||
{
|
||||
return $this->pl->getCcSubjs()->getDbLogin();
|
||||
}
|
||||
|
||||
public function getCreatorId() {
|
||||
public function getCreatorId()
|
||||
{
|
||||
return $this->pl->getCcSubjs()->getDbId();
|
||||
}
|
||||
|
||||
public function setCreator($p_id) {
|
||||
|
||||
public function setCreator($p_id)
|
||||
{
|
||||
$this->pl->setDbCreatorId($p_id);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
}
|
||||
|
||||
public function getLastModified($format = null) {
|
||||
public function getLastModified($format = null)
|
||||
{
|
||||
return $this->pl->getDbMtime($format);
|
||||
}
|
||||
|
||||
public function getSize() {
|
||||
|
||||
public function getSize()
|
||||
{
|
||||
return $this->pl->countCcPlaylistcontentss();
|
||||
}
|
||||
|
||||
|
@ -148,8 +150,8 @@ class Application_Model_Playlist {
|
|||
* file_exists flag set to true
|
||||
* @return array
|
||||
*/
|
||||
public function getContents($filterFiles=false) {
|
||||
|
||||
public function getContents($filterFiles=false)
|
||||
{
|
||||
Logging::log("Getting contents for playlist {$this->id}");
|
||||
|
||||
$files = array();
|
||||
|
@ -193,8 +195,8 @@ class Application_Model_Playlist {
|
|||
* but this isn't practical since fades shouldn't be very long usuall 1 second or less. This function
|
||||
* will normalize the fade so that it looks like 00.000000 to the user.
|
||||
**/
|
||||
public function normalizeFade($fade) {
|
||||
|
||||
public function normalizeFade($fade)
|
||||
{
|
||||
//First get rid of the first six characters 00:00: which will be added back later for db update
|
||||
$fade = substr($fade, 6);
|
||||
|
||||
|
@ -211,12 +213,11 @@ class Application_Model_Playlist {
|
|||
}
|
||||
|
||||
//aggregate column on playlistcontents cliplength column.
|
||||
public function getLength() {
|
||||
|
||||
public function getLength()
|
||||
{
|
||||
return $this->pl->getDbLength();
|
||||
}
|
||||
|
||||
|
||||
private function insertPlaylistElement($info)
|
||||
{
|
||||
$row = new CcPlaylistcontents();
|
||||
|
@ -246,8 +247,7 @@ class Application_Model_Playlist {
|
|||
$entry["cueout"] = $file->getDbLength();
|
||||
|
||||
return $entry;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new Exception("trying to add a file that does not exist.");
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,6 @@ class Application_Model_Playlist {
|
|||
Logging::log("index is {$index}");
|
||||
$pos = ($addType == 'after') ? $index + 1 : $index;
|
||||
|
||||
|
||||
$contentsToUpdate = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos, Criteria::GREATER_EQUAL)
|
||||
|
@ -284,8 +283,7 @@ class Application_Model_Playlist {
|
|||
|
||||
Logging::log("Adding to playlist");
|
||||
Logging::log("at position {$pos}");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
//add to the end of the playlist
|
||||
if ($addType == 'after') {
|
||||
|
@ -329,8 +327,7 @@ class Application_Model_Playlist {
|
|||
$this->pl->save($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
@ -378,8 +375,7 @@ class Application_Model_Playlist {
|
|||
$item->save($this->con);
|
||||
$pos = $pos + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Logging::log("moving items after {$p_afterItem}");
|
||||
|
||||
foreach ($otherContent as $item) {
|
||||
|
@ -400,13 +396,11 @@ class Application_Model_Playlist {
|
|||
}
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
$this->pl = CcPlaylistQuery::create()->findPK($this->id);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
|
@ -444,16 +438,14 @@ class Application_Model_Playlist {
|
|||
$this->pl->save($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getFadeInfo($pos) {
|
||||
|
||||
public function getFadeInfo($pos)
|
||||
{
|
||||
Logging::log("Getting fade info for pos {$pos}");
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
|
@ -465,6 +457,7 @@ class Application_Model_Playlist {
|
|||
#Propel returns values in form 00.000000 format which is for only seconds.
|
||||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
|
||||
return array($fadeIn, $fadeOut);
|
||||
}
|
||||
|
||||
|
@ -526,8 +519,7 @@ class Application_Model_Playlist {
|
|||
$this->pl->save($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
@ -535,8 +527,8 @@ class Application_Model_Playlist {
|
|||
return array("fadeIn" => $fadeIn, "fadeOut" => $fadeOut);
|
||||
}
|
||||
|
||||
public function setPlaylistfades($fadein, $fadeout) {
|
||||
|
||||
public function setPlaylistfades($fadein, $fadeout)
|
||||
{
|
||||
if (isset($fadein)) {
|
||||
Logging::log("Setting playlist fade in {$fadein}");
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
|
@ -578,6 +570,7 @@ class Application_Model_Playlist {
|
|||
try {
|
||||
if (is_null($cueIn) && is_null($cueOut)) {
|
||||
$errArray["error"] = "Cue in and cue out are null.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
|
@ -608,6 +601,7 @@ class Application_Model_Playlist {
|
|||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
|
@ -615,6 +609,7 @@ class Application_Model_Playlist {
|
|||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
|
@ -626,13 +621,13 @@ class Application_Model_Playlist {
|
|||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
|
||||
}
|
||||
else if (!is_null($cueIn)) {
|
||||
} elseif (!is_null($cueIn)) {
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
|
@ -642,8 +637,7 @@ class Application_Model_Playlist {
|
|||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength($cliplength);
|
||||
}
|
||||
else if (!is_null($cueOut)) {
|
||||
} elseif (!is_null($cueOut)) {
|
||||
|
||||
if ($cueOut === "") {
|
||||
$cueOut = $origLength;
|
||||
|
@ -653,6 +647,7 @@ class Application_Model_Playlist {
|
|||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
|
@ -660,6 +655,7 @@ class Application_Model_Playlist {
|
|||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
|
@ -692,8 +688,7 @@ class Application_Model_Playlist {
|
|||
$this->pl->save($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
@ -719,6 +714,7 @@ class Application_Model_Playlist {
|
|||
{
|
||||
$cat = $this->categories[$category];
|
||||
$method = 'get' . $cat;
|
||||
|
||||
return $this->$method();
|
||||
}
|
||||
|
||||
|
@ -749,6 +745,7 @@ class Application_Model_Playlist {
|
|||
if (isset($arr[1])) {
|
||||
return intval($arr[0])*60 + floatval($arr[1]);
|
||||
}
|
||||
|
||||
return floatval($arr[0]);
|
||||
}
|
||||
|
||||
|
@ -786,6 +783,7 @@ class Application_Model_Playlist {
|
|||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"];
|
||||
|
||||
return $con->query($sql)->fetchColumn(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
require_once 'formatters/LengthFormatter.php';
|
||||
|
||||
class Application_Model_PlayoutHistory {
|
||||
|
||||
class Application_Model_PlayoutHistory
|
||||
{
|
||||
private $con;
|
||||
private $timezone;
|
||||
|
||||
|
@ -24,8 +24,8 @@ class Application_Model_PlayoutHistory {
|
|||
"copyright" => "file.copyright",
|
||||
);
|
||||
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts)
|
||||
{
|
||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
|
@ -37,16 +37,16 @@ class Application_Model_PlayoutHistory {
|
|||
/*
|
||||
* map front end mDataProp labels to proper column names for searching etc.
|
||||
*/
|
||||
private function translateColumns() {
|
||||
|
||||
private function translateColumns()
|
||||
{
|
||||
for ($i = 0; $i < $this->opts["iColumns"]; $i++) {
|
||||
|
||||
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
|
||||
}
|
||||
}
|
||||
|
||||
public function getItems() {
|
||||
|
||||
public function getItems()
|
||||
{
|
||||
$this->translateColumns();
|
||||
|
||||
$select = array(
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
class Application_Model_Preference
|
||||
{
|
||||
|
||||
public static function setValue($key, $value, $isUserValue = false){
|
||||
public static function setValue($key, $value, $isUserValue = false)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
//called from a daemon process
|
||||
if (!class_exists("Zend_Auth", false) || !Zend_Auth::getInstance()->hasIdentity()) {
|
||||
$id = NULL;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$id = $auth->getIdentity()->id;
|
||||
}
|
||||
|
@ -72,7 +72,8 @@ class Application_Model_Preference
|
|||
|
||||
}
|
||||
|
||||
public static function getValue($key, $isUserValue = false){
|
||||
public static function getValue($key, $isUserValue = false)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -89,6 +90,7 @@ class Application_Model_Preference
|
|||
}
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
if ($result == 0)
|
||||
|
||||
return "";
|
||||
else {
|
||||
$sql = "SELECT valstr FROM cc_pref"
|
||||
|
@ -100,6 +102,7 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($result !== false) ? $result : "";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
@ -109,7 +112,8 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetHeadTitle(){
|
||||
public static function GetHeadTitle()
|
||||
{
|
||||
$title = self::getValue("station_name");
|
||||
$defaultNamespace->title = $title;
|
||||
if (strlen($title) > 0)
|
||||
|
@ -118,7 +122,8 @@ class Application_Model_Preference
|
|||
return $title."Airtime";
|
||||
}
|
||||
|
||||
public static function SetHeadTitle($title, $view=null){
|
||||
public static function SetHeadTitle($title, $view=null)
|
||||
{
|
||||
self::setValue("station_name", $title);
|
||||
|
||||
// in case this is called from airtime-saas script
|
||||
|
@ -142,7 +147,8 @@ class Application_Model_Preference
|
|||
* @param DateTime $dateTime
|
||||
* A row from cc_show_days table
|
||||
*/
|
||||
public static function SetShowsPopulatedUntil($dateTime) {
|
||||
public static function SetShowsPopulatedUntil($dateTime)
|
||||
{
|
||||
self::setValue("shows_populated_until", $dateTime->format("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
|
@ -155,7 +161,8 @@ class Application_Model_Preference
|
|||
*
|
||||
* @return DateTime (in UTC Timezone)
|
||||
*/
|
||||
public static function GetShowsPopulatedUntil() {
|
||||
public static function GetShowsPopulatedUntil()
|
||||
{
|
||||
$date = self::getValue("shows_populated_until");
|
||||
|
||||
if ($date == "") {
|
||||
|
@ -165,11 +172,13 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetDefaultFade($fade) {
|
||||
public static function SetDefaultFade($fade)
|
||||
{
|
||||
self::setValue("default_fade", $fade);
|
||||
}
|
||||
|
||||
public static function GetDefaultFade() {
|
||||
public static function GetDefaultFade()
|
||||
{
|
||||
$fade = self::getValue("default_fade");
|
||||
|
||||
if ($fade === "") {
|
||||
|
@ -191,10 +200,12 @@ class Application_Model_Preference
|
|||
$fade = number_format($fade, 6);
|
||||
//fades need 2 leading zeros for DateTime conversion
|
||||
$fade = str_pad($fade, 9, "0", STR_PAD_LEFT);
|
||||
|
||||
return $fade;
|
||||
}
|
||||
|
||||
public static function SetDefaultTransitionFade($fade) {
|
||||
public static function SetDefaultTransitionFade($fade)
|
||||
{
|
||||
self::setValue("default_transition_fade", $fade);
|
||||
|
||||
$eventType = "update_transition_fade";
|
||||
|
@ -202,15 +213,18 @@ class Application_Model_Preference
|
|||
Application_Model_RabbitMq::SendMessageToPypo($eventType, $md);
|
||||
}
|
||||
|
||||
public static function GetDefaultTransitionFade() {
|
||||
public static function GetDefaultTransitionFade()
|
||||
{
|
||||
$transition_fade = self::getValue("default_transition_fade");
|
||||
if ($transition_fade == "") {
|
||||
$transition_fade = "00.000000";
|
||||
}
|
||||
|
||||
return $transition_fade;
|
||||
}
|
||||
|
||||
public static function SetStreamLabelFormat($type){
|
||||
public static function SetStreamLabelFormat($type)
|
||||
{
|
||||
self::setValue("stream_label_format", $type);
|
||||
|
||||
$eventType = "update_stream_format";
|
||||
|
@ -219,76 +233,94 @@ class Application_Model_Preference
|
|||
Application_Model_RabbitMq::SendMessageToPypo($eventType, $md);
|
||||
}
|
||||
|
||||
public static function GetStreamLabelFormat(){
|
||||
public static function GetStreamLabelFormat()
|
||||
{
|
||||
return self::getValue("stream_label_format");
|
||||
}
|
||||
|
||||
public static function GetStationName(){
|
||||
public static function GetStationName()
|
||||
{
|
||||
return self::getValue("station_name");
|
||||
}
|
||||
|
||||
public static function SetAutoUploadRecordedShowToSoundcloud($upload) {
|
||||
public static function SetAutoUploadRecordedShowToSoundcloud($upload)
|
||||
{
|
||||
self::setValue("soundcloud_auto_upload_recorded_show", $upload);
|
||||
}
|
||||
|
||||
public static function GetAutoUploadRecordedShowToSoundcloud() {
|
||||
public static function GetAutoUploadRecordedShowToSoundcloud()
|
||||
{
|
||||
return self::getValue("soundcloud_auto_upload_recorded_show");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudUser($user) {
|
||||
public static function SetSoundCloudUser($user)
|
||||
{
|
||||
self::setValue("soundcloud_user", $user);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudUser() {
|
||||
public static function GetSoundCloudUser()
|
||||
{
|
||||
return self::getValue("soundcloud_user");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudPassword($password) {
|
||||
public static function SetSoundCloudPassword($password)
|
||||
{
|
||||
if (strlen($password) > 0)
|
||||
self::setValue("soundcloud_password", $password);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudPassword() {
|
||||
public static function GetSoundCloudPassword()
|
||||
{
|
||||
return self::getValue("soundcloud_password");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudTags($tags) {
|
||||
public static function SetSoundCloudTags($tags)
|
||||
{
|
||||
self::setValue("soundcloud_tags", $tags);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudTags() {
|
||||
public static function GetSoundCloudTags()
|
||||
{
|
||||
return self::getValue("soundcloud_tags");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudGenre($genre) {
|
||||
public static function SetSoundCloudGenre($genre)
|
||||
{
|
||||
self::setValue("soundcloud_genre", $genre);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudGenre() {
|
||||
public static function GetSoundCloudGenre()
|
||||
{
|
||||
return self::getValue("soundcloud_genre");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudTrackType($track_type) {
|
||||
public static function SetSoundCloudTrackType($track_type)
|
||||
{
|
||||
self::setValue("soundcloud_tracktype", $track_type);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudTrackType() {
|
||||
public static function GetSoundCloudTrackType()
|
||||
{
|
||||
return self::getValue("soundcloud_tracktype");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudLicense($license) {
|
||||
public static function SetSoundCloudLicense($license)
|
||||
{
|
||||
self::setValue("soundcloud_license", $license);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudLicense() {
|
||||
public static function GetSoundCloudLicense()
|
||||
{
|
||||
return self::getValue("soundcloud_license");
|
||||
}
|
||||
|
||||
public static function SetAllow3rdPartyApi($bool) {
|
||||
public static function SetAllow3rdPartyApi($bool)
|
||||
{
|
||||
self::setValue("third_party_api", $bool);
|
||||
}
|
||||
|
||||
public static function GetAllow3rdPartyApi() {
|
||||
public static function GetAllow3rdPartyApi()
|
||||
{
|
||||
$val = self::getValue("third_party_api");
|
||||
if (strlen($val) == 0) {
|
||||
return "0";
|
||||
|
@ -297,89 +329,110 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetPhone($phone){
|
||||
public static function SetPhone($phone)
|
||||
{
|
||||
self::setValue("phone", $phone);
|
||||
}
|
||||
|
||||
public static function GetPhone(){
|
||||
public static function GetPhone()
|
||||
{
|
||||
return self::getValue("phone");
|
||||
}
|
||||
|
||||
public static function SetEmail($email){
|
||||
public static function SetEmail($email)
|
||||
{
|
||||
self::setValue("email", $email);
|
||||
}
|
||||
|
||||
public static function GetEmail(){
|
||||
public static function GetEmail()
|
||||
{
|
||||
return self::getValue("email");
|
||||
}
|
||||
|
||||
public static function SetStationWebSite($site){
|
||||
public static function SetStationWebSite($site)
|
||||
{
|
||||
self::setValue("station_website", $site);
|
||||
}
|
||||
|
||||
public static function GetStationWebSite(){
|
||||
public static function GetStationWebSite()
|
||||
{
|
||||
return self::getValue("station_website");
|
||||
}
|
||||
|
||||
public static function SetSupportFeedback($feedback){
|
||||
public static function SetSupportFeedback($feedback)
|
||||
{
|
||||
self::setValue("support_feedback", $feedback);
|
||||
}
|
||||
|
||||
public static function GetSupportFeedback(){
|
||||
public static function GetSupportFeedback()
|
||||
{
|
||||
return self::getValue("support_feedback");
|
||||
}
|
||||
|
||||
public static function SetPublicise($publicise){
|
||||
public static function SetPublicise($publicise)
|
||||
{
|
||||
self::setValue("publicise", $publicise);
|
||||
}
|
||||
|
||||
public static function GetPublicise(){
|
||||
public static function GetPublicise()
|
||||
{
|
||||
return self::getValue("publicise");
|
||||
}
|
||||
|
||||
public static function SetRegistered($registered){
|
||||
public static function SetRegistered($registered)
|
||||
{
|
||||
self::setValue("registered", $registered);
|
||||
}
|
||||
|
||||
public static function GetRegistered(){
|
||||
public static function GetRegistered()
|
||||
{
|
||||
return self::getValue("registered");
|
||||
}
|
||||
|
||||
public static function SetStationCountry($country){
|
||||
public static function SetStationCountry($country)
|
||||
{
|
||||
self::setValue("country", $country);
|
||||
}
|
||||
|
||||
public static function GetStationCountry(){
|
||||
public static function GetStationCountry()
|
||||
{
|
||||
return self::getValue("country");
|
||||
}
|
||||
|
||||
public static function SetStationCity($city){
|
||||
public static function SetStationCity($city)
|
||||
{
|
||||
self::setValue("city", $city);
|
||||
}
|
||||
|
||||
public static function GetStationCity(){
|
||||
public static function GetStationCity()
|
||||
{
|
||||
return self::getValue("city");
|
||||
}
|
||||
|
||||
public static function SetStationDescription($description){
|
||||
public static function SetStationDescription($description)
|
||||
{
|
||||
self::setValue("description", $description);
|
||||
}
|
||||
|
||||
public static function GetStationDescription(){
|
||||
public static function GetStationDescription()
|
||||
{
|
||||
return self::getValue("description");
|
||||
}
|
||||
|
||||
public static function SetTimezone($timezone){
|
||||
public static function SetTimezone($timezone)
|
||||
{
|
||||
self::setValue("timezone", $timezone);
|
||||
date_default_timezone_set($timezone);
|
||||
$md = array("timezone" => $timezone);
|
||||
}
|
||||
|
||||
public static function GetTimezone(){
|
||||
public static function GetTimezone()
|
||||
{
|
||||
return self::getValue("timezone");
|
||||
}
|
||||
|
||||
public static function SetStationLogo($imagePath){
|
||||
public static function SetStationLogo($imagePath)
|
||||
{
|
||||
if (!empty($imagePath)) {
|
||||
$image = @file_get_contents($imagePath);
|
||||
$image = base64_encode($image);
|
||||
|
@ -387,11 +440,13 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetStationLogo(){
|
||||
public static function GetStationLogo()
|
||||
{
|
||||
return self::getValue("logoImage");
|
||||
}
|
||||
|
||||
public static function GetUniqueId(){
|
||||
public static function GetUniqueId()
|
||||
{
|
||||
return self::getValue("uniqueId");
|
||||
}
|
||||
|
||||
|
@ -405,6 +460,7 @@ class Application_Model_Preference
|
|||
foreach ($res as $r) {
|
||||
$out[$r["isocode"]] = $r["name"];
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
@ -509,13 +565,15 @@ class Application_Model_Preference
|
|||
if ($returnArray) {
|
||||
$outputArray['PROMOTE'] = self::GetPublicise();
|
||||
$outputArray['LOGOIMG'] = self::GetStationLogo();
|
||||
|
||||
return $outputArray;
|
||||
} else {
|
||||
return $outputString;
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetInstallMethod(){
|
||||
public static function GetInstallMethod()
|
||||
{
|
||||
$easy_install = file_exists('/usr/bin/airtime-easy-setup');
|
||||
$debian_install = file_exists('/var/lib/dpkg/info/airtime.config');
|
||||
if ($debian_install) {
|
||||
|
@ -529,102 +587,127 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetRemindMeDate(){
|
||||
public static function SetRemindMeDate()
|
||||
{
|
||||
$weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y"));
|
||||
self::setValue("remindme", $weekAfter);
|
||||
}
|
||||
|
||||
public static function GetRemindMeDate(){
|
||||
public static function GetRemindMeDate()
|
||||
{
|
||||
return self::getValue("remindme");
|
||||
}
|
||||
|
||||
public static function SetImportTimestamp(){
|
||||
public static function SetImportTimestamp()
|
||||
{
|
||||
$now = time();
|
||||
if (self::GetImportTimestamp()+5 < $now) {
|
||||
self::setValue("import_timestamp", $now);
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetImportTimestamp(){
|
||||
public static function GetImportTimestamp()
|
||||
{
|
||||
return self::getValue("import_timestamp");
|
||||
}
|
||||
|
||||
public static function GetStreamType(){
|
||||
public static function GetStreamType()
|
||||
{
|
||||
$st = self::getValue("stream_type");
|
||||
|
||||
return explode(',', $st);
|
||||
}
|
||||
|
||||
public static function GetStreamBitrate(){
|
||||
public static function GetStreamBitrate()
|
||||
{
|
||||
$sb = self::getValue("stream_bitrate");
|
||||
|
||||
return explode(',', $sb);
|
||||
}
|
||||
|
||||
public static function SetPrivacyPolicyCheck($flag){
|
||||
public static function SetPrivacyPolicyCheck($flag)
|
||||
{
|
||||
self::setValue("privacy_policy", $flag);
|
||||
}
|
||||
|
||||
public static function GetPrivacyPolicyCheck(){
|
||||
public static function GetPrivacyPolicyCheck()
|
||||
{
|
||||
return self::getValue("privacy_policy");
|
||||
}
|
||||
|
||||
public static function SetNumOfStreams($num){
|
||||
public static function SetNumOfStreams($num)
|
||||
{
|
||||
self::setValue("num_of_streams", intval($num));
|
||||
}
|
||||
|
||||
public static function GetNumOfStreams(){
|
||||
public static function GetNumOfStreams()
|
||||
{
|
||||
return self::getValue("num_of_streams");
|
||||
}
|
||||
|
||||
public static function SetMaxBitrate($bitrate){
|
||||
public static function SetMaxBitrate($bitrate)
|
||||
{
|
||||
self::setValue("max_bitrate", intval($bitrate));
|
||||
}
|
||||
|
||||
public static function GetMaxBitrate(){
|
||||
public static function GetMaxBitrate()
|
||||
{
|
||||
return self::getValue("max_bitrate");
|
||||
}
|
||||
|
||||
public static function SetPlanLevel($plan){
|
||||
public static function SetPlanLevel($plan)
|
||||
{
|
||||
self::setValue("plan_level", $plan);
|
||||
}
|
||||
|
||||
public static function GetPlanLevel(){
|
||||
public static function GetPlanLevel()
|
||||
{
|
||||
$plan = self::getValue("plan_level");
|
||||
if (trim($plan) == '') {
|
||||
$plan = 'disabled';
|
||||
}
|
||||
|
||||
return $plan;
|
||||
}
|
||||
|
||||
public static function SetTrialEndingDate($date){
|
||||
public static function SetTrialEndingDate($date)
|
||||
{
|
||||
self::setValue("trial_end_date", $date);
|
||||
}
|
||||
|
||||
public static function GetTrialEndingDate(){
|
||||
public static function GetTrialEndingDate()
|
||||
{
|
||||
return self::getValue("trial_end_date");
|
||||
}
|
||||
|
||||
public static function SetEnableStreamConf($bool){
|
||||
public static function SetEnableStreamConf($bool)
|
||||
{
|
||||
self::setValue("enable_stream_conf", $bool);
|
||||
}
|
||||
|
||||
public static function GetEnableStreamConf(){
|
||||
public static function GetEnableStreamConf()
|
||||
{
|
||||
if (self::getValue("enable_stream_conf") == Null) {
|
||||
return "true";
|
||||
}
|
||||
|
||||
return self::getValue("enable_stream_conf");
|
||||
}
|
||||
|
||||
public static function GetAirtimeVersion(){
|
||||
public static function GetAirtimeVersion()
|
||||
{
|
||||
if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development" && function_exists('exec')) {
|
||||
$version = exec("git rev-parse --short HEAD 2>/dev/null", $out, $return_code);
|
||||
if ($return_code == 0) {
|
||||
return self::getValue("system_version")."+".$version.":".time();
|
||||
}
|
||||
}
|
||||
|
||||
return self::getValue("system_version");
|
||||
}
|
||||
|
||||
public static function GetLatestVersion(){
|
||||
public static function GetLatestVersion()
|
||||
{
|
||||
$latest = self::getValue("latest_version");
|
||||
if ($latest == null || strlen($latest) == 0) {
|
||||
return self::GetAirtimeVersion();
|
||||
|
@ -633,14 +716,16 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetLatestVersion($version){
|
||||
public static function SetLatestVersion($version)
|
||||
{
|
||||
$pattern = "/^[0-9]+\.[0-9]+\.[0-9]+/";
|
||||
if (preg_match($pattern, $version)) {
|
||||
self::setValue("latest_version", $version);
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetLatestLink(){
|
||||
public static function GetLatestLink()
|
||||
{
|
||||
$link = self::getValue("latest_link");
|
||||
if ($link == null || strlen($link) == 0) {
|
||||
return 'http://airtime.sourcefabric.org';
|
||||
|
@ -649,7 +734,8 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetLatestLink($link){
|
||||
public static function SetLatestLink($link)
|
||||
{
|
||||
$pattern = "#^(http|https|ftp)://" .
|
||||
"([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+" .
|
||||
"(/[a-zA-Z0-9\-\.\_\~\:\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+)*/?$#";
|
||||
|
@ -658,27 +744,33 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetUploadToSoundcloudOption($upload) {
|
||||
public static function SetUploadToSoundcloudOption($upload)
|
||||
{
|
||||
self::setValue("soundcloud_upload_option", $upload);
|
||||
}
|
||||
|
||||
public static function GetUploadToSoundcloudOption() {
|
||||
public static function GetUploadToSoundcloudOption()
|
||||
{
|
||||
return self::getValue("soundcloud_upload_option");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudDownloadbleOption($upload) {
|
||||
public static function SetSoundCloudDownloadbleOption($upload)
|
||||
{
|
||||
self::setValue("soundcloud_downloadable", $upload);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudDownloadbleOption() {
|
||||
public static function GetSoundCloudDownloadbleOption()
|
||||
{
|
||||
return self::getValue("soundcloud_downloadable");
|
||||
}
|
||||
|
||||
public static function SetWeekStartDay($day) {
|
||||
public static function SetWeekStartDay($day)
|
||||
{
|
||||
self::setValue("week_start_day", $day);
|
||||
}
|
||||
|
||||
public static function GetWeekStartDay() {
|
||||
public static function GetWeekStartDay()
|
||||
{
|
||||
$val = self::getValue("week_start_day");
|
||||
if (strlen($val) == 0) {
|
||||
return "0";
|
||||
|
@ -690,7 +782,8 @@ class Application_Model_Preference
|
|||
/**
|
||||
* Stores the last timestamp of user updating stream setting
|
||||
*/
|
||||
public static function SetStreamUpdateTimestamp() {
|
||||
public static function SetStreamUpdateTimestamp()
|
||||
{
|
||||
$now = time();
|
||||
self::setValue("stream_update_timestamp", $now);
|
||||
}
|
||||
|
@ -698,19 +791,23 @@ class Application_Model_Preference
|
|||
/**
|
||||
* Gets the last timestamp of user updating stream setting
|
||||
*/
|
||||
public static function GetStreamUpdateTimestemp() {
|
||||
public static function GetStreamUpdateTimestemp()
|
||||
{
|
||||
$update_time = self::getValue("stream_update_timestamp");
|
||||
if ($update_time == null) {
|
||||
$update_time = 0;
|
||||
}
|
||||
|
||||
return $update_time;
|
||||
}
|
||||
|
||||
public static function GetClientId() {
|
||||
public static function GetClientId()
|
||||
{
|
||||
return self::getValue("client_id");
|
||||
}
|
||||
|
||||
public static function SetClientId($id) {
|
||||
public static function SetClientId($id)
|
||||
{
|
||||
if (is_numeric($id)) {
|
||||
self::setValue("client_id", $id);
|
||||
}
|
||||
|
@ -723,7 +820,8 @@ class Application_Model_Preference
|
|||
*
|
||||
* @param $timeScale new time scale
|
||||
*/
|
||||
public static function SetCalendarTimeScale($timeScale) {
|
||||
public static function SetCalendarTimeScale($timeScale)
|
||||
{
|
||||
self::setValue("calendar_time_scale", $timeScale, true /* user specific */);
|
||||
}
|
||||
|
||||
|
@ -731,11 +829,13 @@ class Application_Model_Preference
|
|||
* Retrieves the time scale preference for the current user.
|
||||
* Defaults to month if no entry exists
|
||||
*/
|
||||
public static function GetCalendarTimeScale() {
|
||||
public static function GetCalendarTimeScale()
|
||||
{
|
||||
$val = self::getValue("calendar_time_scale", true /* user specific */);
|
||||
if (strlen($val) == 0) {
|
||||
$val = "month";
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
@ -744,7 +844,8 @@ class Application_Model_Preference
|
|||
*
|
||||
* @param $numEntries new number of entries to show
|
||||
*/
|
||||
public static function SetLibraryNumEntries($numEntries) {
|
||||
public static function SetLibraryNumEntries($numEntries)
|
||||
{
|
||||
self::setValue("library_num_entries", $numEntries, true /* user specific */);
|
||||
}
|
||||
|
||||
|
@ -752,11 +853,13 @@ class Application_Model_Preference
|
|||
* Retrieves the number of entries to show preference in library under Playlist Builder.
|
||||
* Defaults to 10 if no entry exists
|
||||
*/
|
||||
public static function GetLibraryNumEntries() {
|
||||
public static function GetLibraryNumEntries()
|
||||
{
|
||||
$val = self::getValue("library_num_entries", true /* user specific */);
|
||||
if (strlen($val) == 0) {
|
||||
$val = "10";
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
@ -765,7 +868,8 @@ class Application_Model_Preference
|
|||
*
|
||||
* @param $timeInterval new time interval
|
||||
*/
|
||||
public static function SetCalendarTimeInterval($timeInterval) {
|
||||
public static function SetCalendarTimeInterval($timeInterval)
|
||||
{
|
||||
self::setValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
||||
}
|
||||
|
||||
|
@ -773,47 +877,58 @@ class Application_Model_Preference
|
|||
* Retrieves the time interval preference for the current user.
|
||||
* Defaults to 30 min if no entry exists
|
||||
*/
|
||||
public static function GetCalendarTimeInterval() {
|
||||
public static function GetCalendarTimeInterval()
|
||||
{
|
||||
$val = self::getValue("calendar_time_interval", true /* user specific */);
|
||||
if (strlen($val) == 0) {
|
||||
$val = "30";
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
public static function SetDiskQuota($value){
|
||||
public static function SetDiskQuota($value)
|
||||
{
|
||||
self::setValue("disk_quota", $value, false);
|
||||
}
|
||||
|
||||
public static function GetDiskQuota(){
|
||||
public static function GetDiskQuota()
|
||||
{
|
||||
$val = self::getValue("disk_quota");
|
||||
if (strlen($val) == 0) {
|
||||
$val = "0";
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
public static function SetLiveSteamMasterUsername($value){
|
||||
public static function SetLiveSteamMasterUsername($value)
|
||||
{
|
||||
self::setValue("live_stream_master_username", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamMasterUsername(){
|
||||
public static function GetLiveSteamMasterUsername()
|
||||
{
|
||||
return self::getValue("live_stream_master_username");
|
||||
}
|
||||
|
||||
public static function SetLiveSteamMasterPassword($value){
|
||||
public static function SetLiveSteamMasterPassword($value)
|
||||
{
|
||||
self::setValue("live_stream_master_password", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamMasterPassword(){
|
||||
public static function GetLiveSteamMasterPassword()
|
||||
{
|
||||
return self::getValue("live_stream_master_password");
|
||||
}
|
||||
|
||||
public static function SetSourceStatus($sourcename, $status){
|
||||
public static function SetSourceStatus($sourcename, $status)
|
||||
{
|
||||
self::setValue($sourcename, $status, false);
|
||||
}
|
||||
|
||||
public static function GetSourceStatus($sourcename){
|
||||
public static function GetSourceStatus($sourcename)
|
||||
{
|
||||
$value = self::getValue($sourcename);
|
||||
if ($value == null || $value == "false") {
|
||||
return false;
|
||||
|
@ -822,11 +937,13 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetSourceSwitchStatus($sourcename, $status){
|
||||
public static function SetSourceSwitchStatus($sourcename, $status)
|
||||
{
|
||||
self::setValue($sourcename."_switch", $status, false);
|
||||
}
|
||||
|
||||
public static function GetSourceSwitchStatus($sourcename){
|
||||
public static function GetSourceSwitchStatus($sourcename)
|
||||
{
|
||||
$value = self::getValue($sourcename."_switch");
|
||||
if ($value == null || $value == "off") {
|
||||
return "off";
|
||||
|
@ -835,61 +952,75 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
|
||||
public static function SetMasterDJSourceConnectionURL($value){
|
||||
public static function SetMasterDJSourceConnectionURL($value)
|
||||
{
|
||||
self::setValue("master_dj_source_connection_url", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMasterDJSourceConnectionURL(){
|
||||
public static function GetMasterDJSourceConnectionURL()
|
||||
{
|
||||
return self::getValue("master_dj_source_connection_url");
|
||||
}
|
||||
|
||||
public static function SetLiveDJSourceConnectionURL($value){
|
||||
public static function SetLiveDJSourceConnectionURL($value)
|
||||
{
|
||||
self::setValue("live_dj_source_connection_url", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveDJSourceConnectionURL(){
|
||||
public static function GetLiveDJSourceConnectionURL()
|
||||
{
|
||||
return self::getValue("live_dj_source_connection_url");
|
||||
}
|
||||
|
||||
/* Source Connection URL override status starts */
|
||||
public static function GetLiveDjConnectionUrlOverride(){
|
||||
public static function GetLiveDjConnectionUrlOverride()
|
||||
{
|
||||
return self::getValue("live_dj_connection_url_override");
|
||||
}
|
||||
|
||||
public static function SetLiveDjConnectionUrlOverride($value){
|
||||
public static function SetLiveDjConnectionUrlOverride($value)
|
||||
{
|
||||
self::setValue("live_dj_connection_url_override", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMasterDjConnectionUrlOverride(){
|
||||
public static function GetMasterDjConnectionUrlOverride()
|
||||
{
|
||||
return self::getValue("master_dj_connection_url_override");
|
||||
}
|
||||
|
||||
public static function SetMasterDjConnectionUrlOverride($value){
|
||||
public static function SetMasterDjConnectionUrlOverride($value)
|
||||
{
|
||||
self::setValue("master_dj_connection_url_override", $value, false);
|
||||
}
|
||||
/* Source Connection URL override status ends */
|
||||
|
||||
public static function SetAutoTransition($value){
|
||||
public static function SetAutoTransition($value)
|
||||
{
|
||||
self::setValue("auto_transition", $value, false);
|
||||
}
|
||||
|
||||
public static function GetAutoTransition(){
|
||||
public static function GetAutoTransition()
|
||||
{
|
||||
return self::getValue("auto_transition");
|
||||
}
|
||||
|
||||
public static function SetAutoSwitch($value){
|
||||
public static function SetAutoSwitch($value)
|
||||
{
|
||||
self::setValue("auto_switch", $value, false);
|
||||
}
|
||||
|
||||
public static function GetAutoSwitch(){
|
||||
public static function GetAutoSwitch()
|
||||
{
|
||||
return self::getValue("auto_switch");
|
||||
}
|
||||
|
||||
public static function SetEnableSystemEmail($upload) {
|
||||
public static function SetEnableSystemEmail($upload)
|
||||
{
|
||||
self::setValue("enable_system_email", $upload);
|
||||
}
|
||||
|
||||
public static function GetEnableSystemEmail() {
|
||||
public static function GetEnableSystemEmail()
|
||||
{
|
||||
$v = self::getValue("enable_system_email");
|
||||
|
||||
if ($v === "") {
|
||||
|
@ -899,56 +1030,69 @@ class Application_Model_Preference
|
|||
return $v;
|
||||
}
|
||||
|
||||
public static function SetSystemEmail($value) {
|
||||
public static function SetSystemEmail($value)
|
||||
{
|
||||
self::setValue("system_email", $value, false);
|
||||
}
|
||||
|
||||
public static function GetSystemEmail() {
|
||||
public static function GetSystemEmail()
|
||||
{
|
||||
return self::getValue("system_email");
|
||||
}
|
||||
|
||||
public static function SetMailServerConfigured($value) {
|
||||
public static function SetMailServerConfigured($value)
|
||||
{
|
||||
self::setValue("mail_server_configured", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerConfigured() {
|
||||
public static function GetMailServerConfigured()
|
||||
{
|
||||
return self::getValue("mail_server_configured");
|
||||
}
|
||||
|
||||
public static function SetMailServer($value) {
|
||||
public static function SetMailServer($value)
|
||||
{
|
||||
self::setValue("mail_server", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServer() {
|
||||
public static function GetMailServer()
|
||||
{
|
||||
return self::getValue("mail_server");
|
||||
}
|
||||
|
||||
public static function SetMailServerEmailAddress($value) {
|
||||
public static function SetMailServerEmailAddress($value)
|
||||
{
|
||||
self::setValue("mail_server_email_address", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerEmailAddress() {
|
||||
public static function GetMailServerEmailAddress()
|
||||
{
|
||||
return self::getValue("mail_server_email_address");
|
||||
}
|
||||
|
||||
public static function SetMailServerPassword($value) {
|
||||
public static function SetMailServerPassword($value)
|
||||
{
|
||||
self::setValue("mail_server_password", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerPassword() {
|
||||
public static function GetMailServerPassword()
|
||||
{
|
||||
return self::getValue("mail_server_password");
|
||||
}
|
||||
|
||||
public static function SetMailServerPort($value) {
|
||||
public static function SetMailServerPort($value)
|
||||
{
|
||||
self::setValue("mail_server_port", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerPort() {
|
||||
public static function GetMailServerPort()
|
||||
{
|
||||
return self::getValue("mail_server_port");
|
||||
}
|
||||
/* User specific preferences end */
|
||||
|
||||
public static function ShouldShowPopUp(){
|
||||
public static function ShouldShowPopUp()
|
||||
{
|
||||
$today = mktime(0, 0, 0, gmdate("m"), gmdate("d"), gmdate("Y"));
|
||||
$remindDate = Application_Model_Preference::GetRemindMeDate();
|
||||
if ($remindDate == NULL || $today >= $remindDate) {
|
||||
|
@ -956,4 +1100,3 @@ class Application_Model_Preference
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,13 @@ require_once 'php-amqplib/amqp.inc';
|
|||
|
||||
class Application_Model_RabbitMq
|
||||
{
|
||||
static public $doPush = FALSE;
|
||||
public static $doPush = FALSE;
|
||||
|
||||
/**
|
||||
* Sets a flag to push the schedule at the end of the request.
|
||||
*/
|
||||
public static function PushSchedule() {
|
||||
public static function PushSchedule()
|
||||
{
|
||||
Application_Model_RabbitMq::$doPush = TRUE;
|
||||
}
|
||||
|
||||
|
@ -93,4 +94,3 @@ class Application_Model_RabbitMq
|
|||
$conn->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Schedule {
|
||||
|
||||
class Application_Model_Schedule
|
||||
{
|
||||
/**
|
||||
* Return TRUE if file is going to be played in the future.
|
||||
*
|
||||
|
@ -70,8 +70,8 @@ class Application_Model_Schedule {
|
|||
public static function GetPrevCurrentNext($p_previousShowID, $p_currentShowID, $p_nextShowID, $p_timeNow)
|
||||
{
|
||||
if ($p_previousShowID == null && $p_currentShowID == null && $p_nextShowID == null)
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -161,10 +161,12 @@ class Application_Model_Schedule {
|
|||
"starts"=>$rows[$previousIndex]["starts"],
|
||||
"ends"=>$rows[$previousIndex]["ends"]);;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function GetLastScheduleItem($p_timeNow){
|
||||
public static function GetLastScheduleItem($p_timeNow)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT"
|
||||
|
@ -182,11 +184,13 @@ class Application_Model_Schedule {
|
|||
." LIMIT 1";
|
||||
|
||||
$row = $con->query($sql)->fetchAll();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId){
|
||||
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
/* Note that usually there will be one result returned. In some
|
||||
|
@ -207,10 +211,12 @@ class Application_Model_Schedule {
|
|||
." LIMIT 1";
|
||||
|
||||
$row = $con->query($sql)->fetchAll();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function GetNextScheduleItem($p_timeNow){
|
||||
public static function GetNextScheduleItem($p_timeNow)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT"
|
||||
|
@ -228,6 +234,7 @@ class Application_Model_Schedule {
|
|||
." LIMIT 1";
|
||||
|
||||
$row = $con->query($sql)->fetchAll();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
@ -273,7 +280,6 @@ class Application_Model_Schedule {
|
|||
OR (si.ends > '{$p_start}' AND si.ends <= '{$p_end}')
|
||||
OR (si.starts <= '{$p_start}' AND si.ends >= '{$p_end}'))";
|
||||
|
||||
|
||||
if (count($p_shows) > 0) {
|
||||
$sql .= " AND show_id IN (".implode(",", $p_shows).")";
|
||||
}
|
||||
|
@ -283,6 +289,7 @@ class Application_Model_Schedule {
|
|||
Logging::debug($sql);
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
@ -305,10 +312,12 @@ class Application_Model_Schedule {
|
|||
$sql .= " WHERE id=$p_id";
|
||||
|
||||
$retVal = $con->exec($sql);
|
||||
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
public static function UpdateBrodcastedStatus($dateTime, $value){
|
||||
public static function UpdateBrodcastedStatus($dateTime, $value)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$now = $dateTime->format("Y-m-d H:i:s");
|
||||
|
@ -316,6 +325,7 @@ class Application_Model_Schedule {
|
|||
." SET broadcasted=$value"
|
||||
." WHERE starts <= '$now' AND ends >= '$now'";
|
||||
$retVal = $con->exec($sql);
|
||||
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
|
@ -324,10 +334,10 @@ class Application_Model_Schedule {
|
|||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['scheduleTable'];
|
||||
|
||||
return $con->query($sql)->fetchColumn(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a time string in the format "YYYY-MM-DD HH:mm:SS"
|
||||
* to "YYYY-MM-DD-HH-mm-SS".
|
||||
|
@ -340,6 +350,7 @@ class Application_Model_Schedule {
|
|||
$p_time = substr($p_time, 0, 19);
|
||||
$p_time = str_replace(" ", "-", $p_time);
|
||||
$p_time = str_replace(":", "-", $p_time);
|
||||
|
||||
return $p_time;
|
||||
}
|
||||
|
||||
|
@ -353,6 +364,7 @@ class Application_Model_Schedule {
|
|||
private static function PypoTimeToAirtimeTime($p_time)
|
||||
{
|
||||
$t = explode("-", $p_time);
|
||||
|
||||
return $t[0]."-".$t[1]."-".$t[2]." ".$t[3].":".$t[4].":00";
|
||||
}
|
||||
|
||||
|
@ -373,6 +385,7 @@ class Application_Model_Schedule {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -397,10 +410,10 @@ class Application_Model_Schedule {
|
|||
$seconds = intval($t[2]);
|
||||
}
|
||||
$ret = $millisecs + ($seconds * 1000) + ($t[1] * 60 * 1000) + ($t[0] * 60 * 60 * 1000);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute the difference between two times in the format "HH:MM:SS.mmmmmm".
|
||||
* Note: currently only supports calculating millisec differences.
|
||||
|
@ -423,6 +436,7 @@ class Application_Model_Schedule {
|
|||
$millisec2 = intval($millisec2);
|
||||
$diff = abs($millisec1 - $millisec2)/1000;
|
||||
}
|
||||
|
||||
return $diff;
|
||||
}
|
||||
|
||||
|
@ -442,7 +456,8 @@ class Application_Model_Schedule {
|
|||
* Returns null if nothing found, else an array of associative
|
||||
* arrays representing each row.
|
||||
*/
|
||||
public static function GetItems($p_startTime, $p_endTime) {
|
||||
public static function GetItems($p_startTime, $p_endTime)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -464,7 +479,6 @@ class Application_Model_Schedule {
|
|||
." LEFT JOIN $CC_CONFIG[filesTable] AS f"
|
||||
." ON st.file_id = f.id";
|
||||
|
||||
|
||||
$predicates = " WHERE st.ends > '$p_startTime'"
|
||||
." AND st.starts < '$p_endTime'"
|
||||
." AND st.playout_status > 0"
|
||||
|
@ -496,8 +510,8 @@ class Application_Model_Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null){
|
||||
|
||||
public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
/* if $p_fromDateTime and $p_toDateTime function parameters are null, then set range
|
||||
|
@ -615,14 +629,16 @@ class Application_Model_Schedule {
|
|||
$con->exec("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
|
||||
}
|
||||
|
||||
public static function deleteWithFileId($fileId){
|
||||
public static function deleteWithFileId($fileId)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=$fileId";
|
||||
$res = $con->query($sql);
|
||||
}
|
||||
|
||||
public static function createNewFormSections($p_view){
|
||||
public static function createNewFormSections($p_view)
|
||||
{
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
|
@ -677,7 +693,8 @@ class Application_Model_Schedule {
|
|||
* There is still lots of clean-up to do. For example we shouldn't be passing $controller into
|
||||
* this method to manipulate the view (this should be done inside the controller function). With
|
||||
* 2.1 deadline looming, this is OK for now. -Martin */
|
||||
public static function updateShowInstance($data, $controller){
|
||||
public static function updateShowInstance($data, $controller)
|
||||
{
|
||||
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
|
@ -743,6 +760,7 @@ class Application_Model_Schedule {
|
|||
//$formAbsoluteRebroadcast->disable();
|
||||
//$formRebroadcast->disable();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -755,8 +773,8 @@ class Application_Model_Schedule {
|
|||
* Another clean-up is to move all the form manipulation to the proper form class.....
|
||||
* -Martin
|
||||
*/
|
||||
public static function addUpdateShow($data, $controller, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null){
|
||||
|
||||
public static function addUpdateShow($data, $controller, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null)
|
||||
{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
|
@ -917,7 +935,8 @@ class Application_Model_Schedule {
|
|||
}
|
||||
}
|
||||
|
||||
public static function checkOverlappingShows($show_start, $show_end, $update=false, $instanceId=null) {
|
||||
public static function checkOverlappingShows($show_start, $show_end, $update=false, $instanceId=null)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$overlapping = false;
|
||||
|
@ -944,6 +963,7 @@ class Application_Model_Schedule {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $overlapping;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Scheduler {
|
||||
|
||||
class Application_Model_Scheduler
|
||||
{
|
||||
private $con;
|
||||
private $fileInfo = array(
|
||||
"id" => "",
|
||||
|
@ -19,8 +19,8 @@ class Application_Model_Scheduler {
|
|||
|
||||
private $checkUserPermissions = true;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
|
||||
$this->epochNow = microtime(true);
|
||||
|
@ -35,18 +35,18 @@ class Application_Model_Scheduler {
|
|||
$this->user = Application_Model_User::getCurrentUser();
|
||||
}
|
||||
|
||||
public function setCheckUserPermissions($value) {
|
||||
public function setCheckUserPermissions($value)
|
||||
{
|
||||
$this->checkUserPermissions = $value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* make sure any incoming requests for scheduling are ligit.
|
||||
*
|
||||
* @param array $items, an array containing pks of cc_schedule items.
|
||||
*/
|
||||
private function validateRequest($items) {
|
||||
|
||||
private function validateRequest($items)
|
||||
{
|
||||
$nowEpoch = floatval($this->nowDT->format("U.u"));
|
||||
|
||||
for ($i = 0; $i < count($items); $i++) {
|
||||
|
@ -121,8 +121,8 @@ class Application_Model_Scheduler {
|
|||
*
|
||||
* @return $files
|
||||
*/
|
||||
private function retrieveMediaFiles($id, $type) {
|
||||
|
||||
private function retrieveMediaFiles($id, $type)
|
||||
{
|
||||
$files = array();
|
||||
|
||||
if ($type === "audioclip") {
|
||||
|
@ -130,8 +130,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
if (is_null($file) || !$file->getDbFileExists()) {
|
||||
throw new Exception("A selected File does not exist!");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $id;
|
||||
$data["cliplength"] = $file->getDbLength();
|
||||
|
@ -146,8 +145,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
$files[] = $data;
|
||||
}
|
||||
}
|
||||
else if ($type === "playlist") {
|
||||
} elseif ($type === "playlist") {
|
||||
|
||||
$contents = CcPlaylistcontentsQuery::create()
|
||||
->orderByDbPosition()
|
||||
|
@ -186,8 +184,8 @@ class Application_Model_Scheduler {
|
|||
*
|
||||
* @return DateTime endDT in UTC
|
||||
*/
|
||||
private function findEndTime($p_startDT, $p_duration) {
|
||||
|
||||
private function findEndTime($p_startDT, $p_duration)
|
||||
{
|
||||
$startEpoch = $p_startDT->format("U.u");
|
||||
$durationSeconds = Application_Model_Playlist::playlistTimeToSeconds($p_duration);
|
||||
|
||||
|
@ -205,8 +203,8 @@ class Application_Model_Scheduler {
|
|||
return $dt;
|
||||
}
|
||||
|
||||
private function findNextStartTime($DT, $instance) {
|
||||
|
||||
private function findNextStartTime($DT, $instance)
|
||||
{
|
||||
$sEpoch = $DT->format("U.u");
|
||||
$nEpoch = $this->epochNow;
|
||||
|
||||
|
@ -227,8 +225,7 @@ class Application_Model_Scheduler {
|
|||
->setDbPlayoutStatus(-1)
|
||||
->setDbInstanceId($instance->getDbId())
|
||||
->save($this->con);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$nextDT = $DT;
|
||||
}
|
||||
|
||||
|
@ -240,8 +237,8 @@ class Application_Model_Scheduler {
|
|||
* @param array $exclude
|
||||
* ids of sched items to remove from the calulation.
|
||||
*/
|
||||
private function removeGaps($showInstance, $exclude=null) {
|
||||
|
||||
private function removeGaps($showInstance, $exclude=null)
|
||||
{
|
||||
Logging::log("removing gaps from show instance #".$showInstance);
|
||||
|
||||
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
|
||||
|
@ -257,7 +254,6 @@ class Application_Model_Scheduler {
|
|||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
||||
|
||||
foreach ($schedule as $item) {
|
||||
|
||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||
|
@ -276,8 +272,8 @@ class Application_Model_Scheduler {
|
|||
* @param array $fileIds
|
||||
* @param array $playlistIds
|
||||
*/
|
||||
private function insertAfter($scheduleItems, $schedFiles, $adjustSched = true) {
|
||||
|
||||
private function insertAfter($scheduleItems, $schedFiles, $adjustSched = true)
|
||||
{
|
||||
try {
|
||||
|
||||
$affectedShowInstances = array();
|
||||
|
@ -339,8 +335,7 @@ class Application_Model_Scheduler {
|
|||
//need to keep same id for resources if we want REST.
|
||||
if (isset($file['sched_id'])) {
|
||||
$sched = CcScheduleQuery::create()->findPK($file['sched_id'], $this->con);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sched = new CcSchedule();
|
||||
}
|
||||
Logging::log(print_r($file,true));
|
||||
|
@ -408,8 +403,7 @@ class Application_Model_Scheduler {
|
|||
$endProfile = microtime(true);
|
||||
Logging::debug("updating last scheduled timestamp.");
|
||||
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Logging::debug($e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
|
@ -419,8 +413,8 @@ class Application_Model_Scheduler {
|
|||
* @param array $scheduleItems
|
||||
* @param array $mediaItems
|
||||
*/
|
||||
public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true) {
|
||||
|
||||
public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true)
|
||||
{
|
||||
$this->con->beginTransaction();
|
||||
|
||||
$schedFiles = array();
|
||||
|
@ -437,8 +431,7 @@ class Application_Model_Scheduler {
|
|||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
@ -448,8 +441,8 @@ class Application_Model_Scheduler {
|
|||
* @param array $selectedItem
|
||||
* @param array $afterItem
|
||||
*/
|
||||
public function moveItem($selectedItems, $afterItems, $adjustSched = true) {
|
||||
|
||||
public function moveItem($selectedItems, $afterItems, $adjustSched = true)
|
||||
{
|
||||
$startProfile = microtime(true);
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
@ -492,8 +485,7 @@ class Application_Model_Scheduler {
|
|||
$schedId = $selected->getDbId();
|
||||
if (isset($modifiedMap[$showInstanceId])) {
|
||||
array_push($modifiedMap[$showInstanceId], $schedId);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$modifiedMap[$showInstanceId] = array($schedId);
|
||||
}
|
||||
}
|
||||
|
@ -530,15 +522,14 @@ class Application_Model_Scheduler {
|
|||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeItems($scheduledItems, $adjustSched = true) {
|
||||
|
||||
public function removeItems($scheduledItems, $adjustSched = true)
|
||||
{
|
||||
$showInstances = array();
|
||||
$this->con->beginTransaction();
|
||||
|
||||
|
@ -575,8 +566,7 @@ class Application_Model_Scheduler {
|
|||
->setDbClipLength($cliplength)
|
||||
->setDbEnds($this->nowDT)
|
||||
->save($this->con);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$removedItem->delete($this->con);
|
||||
}
|
||||
}
|
||||
|
@ -613,8 +603,7 @@ class Application_Model_Scheduler {
|
|||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
@ -625,8 +614,8 @@ class Application_Model_Scheduler {
|
|||
*
|
||||
* @param $p_id id of the show instance to cancel.
|
||||
*/
|
||||
public function cancelShow($p_id) {
|
||||
|
||||
public function cancelShow($p_id)
|
||||
{
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
@ -652,8 +641,7 @@ class Application_Model_Scheduler {
|
|||
|
||||
$this->removeItems($remove, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
||||
$rebroadcasts->delete($this->con);
|
||||
}
|
||||
|
@ -666,8 +654,7 @@ class Application_Model_Scheduler {
|
|||
if ($instance->getDbRecord()) {
|
||||
Application_Model_RabbitMq::SendMessageToShowRecorder("cancel_recording");
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
class Application_Model_ServiceRegister {
|
||||
|
||||
public static function Register($p_componentName, $p_ipAddress){
|
||||
|
||||
class Application_Model_ServiceRegister
|
||||
{
|
||||
public static function Register($p_componentName, $p_ipAddress)
|
||||
{
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName($p_componentName);
|
||||
|
||||
if ($component == NULL) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Show {
|
||||
|
||||
class Application_Model_Show
|
||||
{
|
||||
private $_showId;
|
||||
|
||||
public function __construct($showId=NULL)
|
||||
|
@ -12,6 +12,7 @@ class Application_Model_Show {
|
|||
public function getName()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
|
||||
return $show->getDbName();
|
||||
}
|
||||
|
||||
|
@ -22,25 +23,29 @@ class Application_Model_Show {
|
|||
Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
|
||||
public function setAirtimeAuthFlag($flag){
|
||||
public function setAirtimeAuthFlag($flag)
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
$show->setDbLiveStreamUsingAirtimeAuth($flag);
|
||||
$show->save();
|
||||
}
|
||||
|
||||
public function setCustomAuthFlag($flag){
|
||||
public function setCustomAuthFlag($flag)
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
$show->setDbLiveStreamUsingCustomAuth($flag);
|
||||
$show->save();
|
||||
}
|
||||
|
||||
public function setCustomUsername($username){
|
||||
public function setCustomUsername($username)
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
$show->setDbLiveStreamUser($username);
|
||||
$show->save();
|
||||
}
|
||||
|
||||
public function setCustomPassword($password){
|
||||
public function setCustomPassword($password)
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
$show->setDbLiveStreamPass($password);
|
||||
$show->save();
|
||||
|
@ -49,6 +54,7 @@ class Application_Model_Show {
|
|||
public function getDescription()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
|
||||
return $show->getDbDescription();
|
||||
}
|
||||
|
||||
|
@ -61,6 +67,7 @@ class Application_Model_Show {
|
|||
public function getColor()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
|
||||
return $show->getDbColor();
|
||||
}
|
||||
|
||||
|
@ -73,6 +80,7 @@ class Application_Model_Show {
|
|||
public function getUrl()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
|
||||
return $show->getDbUrl();
|
||||
}
|
||||
|
||||
|
@ -85,6 +93,7 @@ class Application_Model_Show {
|
|||
public function getGenre()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
|
||||
return $show->getDbGenre();
|
||||
}
|
||||
|
||||
|
@ -97,6 +106,7 @@ class Application_Model_Show {
|
|||
public function getBackgroundColor()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
|
||||
return $show->getDbBackgroundColor();
|
||||
}
|
||||
|
||||
|
@ -166,8 +176,7 @@ class Application_Model_Show {
|
|||
$hours = $deltaMin/60;
|
||||
if ($hours > 0) {
|
||||
$hours = floor($hours);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$hours = ceil($hours);
|
||||
}
|
||||
|
||||
|
@ -205,8 +214,7 @@ class Application_Model_Show {
|
|||
}
|
||||
|
||||
$con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
Logging::log("Couldn't update schedule status.");
|
||||
Logging::log($e->getMessage());
|
||||
|
@ -313,7 +321,8 @@ class Application_Model_Show {
|
|||
* @return boolean
|
||||
* true if originated from recording, otherwise false.
|
||||
*/
|
||||
public function isRecorded(){
|
||||
public function isRecorded()
|
||||
{
|
||||
$showInstancesRow = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($this->getId())
|
||||
->filterByDbRecord(1)
|
||||
|
@ -414,8 +423,7 @@ class Application_Model_Show {
|
|||
|
||||
if (!is_null($showDaysRow)) {
|
||||
return ($showDaysRow->getDbRepeatType() != -1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -437,6 +445,7 @@ class Application_Model_Show {
|
|||
if (!is_null($showDaysRow)) {
|
||||
return $showDaysRow->getDbRepeatType();
|
||||
} else
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -457,6 +466,7 @@ class Application_Model_Show {
|
|||
." ORDER BY last_show DESC";
|
||||
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($query !== false) ? $query : "";
|
||||
}
|
||||
|
||||
|
@ -470,7 +480,8 @@ class Application_Model_Show {
|
|||
* it cause any scheduled playlists within those show instances to
|
||||
* be gone for good.
|
||||
*/
|
||||
public function deleteAllInstances(){
|
||||
public function deleteAllInstances()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$timestamp = gmdate("Y-m-d H:i:s");
|
||||
|
@ -487,7 +498,8 @@ class Application_Model_Show {
|
|||
* Deletes all future rebroadcast instances of the current
|
||||
* show object from the show_instances table.
|
||||
*/
|
||||
public function deleteAllRebroadcasts(){
|
||||
public function deleteAllRebroadcasts()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$timestamp = gmdate("Y-m-d H:i:s");
|
||||
|
@ -510,7 +522,8 @@ class Application_Model_Show {
|
|||
* @param string $p_date
|
||||
* The date which to delete after, if null deletes from the current timestamp.
|
||||
*/
|
||||
public function removeAllInstancesFromDate($p_date=null){
|
||||
public function removeAllInstancesFromDate($p_date=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$timestamp = gmdate("Y-m-d H:i:s");
|
||||
|
@ -542,7 +555,8 @@ class Application_Model_Show {
|
|||
* @param string $p_date
|
||||
* The date which to delete before
|
||||
*/
|
||||
public function removeAllInstancesBeforeDate($p_date){
|
||||
public function removeAllInstancesBeforeDate($p_date)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$timestamp = gmdate("Y-m-d H:i:s");
|
||||
|
@ -562,7 +576,8 @@ class Application_Model_Show {
|
|||
* @return string
|
||||
* The start date in the format YYYY-MM-DD
|
||||
*/
|
||||
public function getStartDateAndTime(){
|
||||
public function getStartDateAndTime()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$showId = $this->getId();
|
||||
|
@ -581,6 +596,7 @@ class Application_Model_Show {
|
|||
|
||||
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
|
||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||
|
||||
return $dt->format("Y-m-d H:i");
|
||||
}
|
||||
}
|
||||
|
@ -591,8 +607,10 @@ class Application_Model_Show {
|
|||
* @return string
|
||||
* The start date in the format YYYY-MM-DD
|
||||
*/
|
||||
public function getStartDate(){
|
||||
public function getStartDate()
|
||||
{
|
||||
list($date,) = explode(" ", $this->getStartDateAndTime());
|
||||
|
||||
return $date;
|
||||
}
|
||||
|
||||
|
@ -603,8 +621,10 @@ class Application_Model_Show {
|
|||
* The start time in the format HH:MM
|
||||
*/
|
||||
|
||||
public function getStartTime(){
|
||||
public function getStartTime()
|
||||
{
|
||||
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
|
@ -615,7 +635,8 @@ class Application_Model_Show {
|
|||
* @return string
|
||||
* The end date in the format YYYY-MM-DD
|
||||
*/
|
||||
public function getEndDate(){
|
||||
public function getEndDate()
|
||||
{
|
||||
$startDate = $this->getStartDate();
|
||||
$startTime = $this->getStartTime();
|
||||
$duration = $this->getDuration();
|
||||
|
@ -634,7 +655,8 @@ class Application_Model_Show {
|
|||
* @return string
|
||||
* The start time in the format HH:MM:SS
|
||||
*/
|
||||
public function getEndTime(){
|
||||
public function getEndTime()
|
||||
{
|
||||
$startDate = $this->getStartDate();
|
||||
$startTime = $this->getStartTime();
|
||||
$duration = $this->getDuration();
|
||||
|
@ -654,9 +676,11 @@ class Application_Model_Show {
|
|||
* @return boolean
|
||||
* true if the StartDate is in the past, false otherwise
|
||||
*/
|
||||
public function isStartDateTimeInPast(){
|
||||
public function isStartDateTimeInPast()
|
||||
{
|
||||
$date = new Application_Common_DateHelper;
|
||||
$current_timestamp = $date->getUtcTimestamp();
|
||||
|
||||
return ($current_timestamp > ($this->getStartDate()." ".$this->getStartTime()));
|
||||
}
|
||||
|
||||
|
@ -667,7 +691,8 @@ class Application_Model_Show {
|
|||
* A simple array containing all ID's of show instance
|
||||
* scheduled in the future.
|
||||
*/
|
||||
public function getAllFutureInstanceIds(){
|
||||
public function getAllFutureInstanceIds()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$date = new Application_Common_DateHelper;
|
||||
|
@ -685,6 +710,7 @@ class Application_Model_Show {
|
|||
foreach ($rows as $row) {
|
||||
$instance_ids[] = $row["id"];
|
||||
}
|
||||
|
||||
return $instance_ids;
|
||||
}
|
||||
|
||||
|
@ -695,7 +721,8 @@ class Application_Model_Show {
|
|||
* browser.
|
||||
*
|
||||
*/
|
||||
private function updateDurationTime($p_data){
|
||||
private function updateDurationTime($p_data)
|
||||
{
|
||||
//need to update cc_show_instances, cc_show_days
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -713,10 +740,10 @@ class Application_Model_Show {
|
|||
."AND ends > TIMESTAMP '$timestamp'";
|
||||
$con->exec($sql);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function updateStartDateTime($p_data, $p_endDate){
|
||||
private function updateStartDateTime($p_data, $p_endDate)
|
||||
{
|
||||
//need to update cc_schedule, cc_show_instances, cc_show_days
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -757,17 +784,20 @@ class Application_Model_Show {
|
|||
}
|
||||
}
|
||||
|
||||
public function getDuration($format=false){
|
||||
public function getDuration($format=false)
|
||||
{
|
||||
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
|
||||
if (!$format) {
|
||||
return $showDay->getDbDuration();
|
||||
} else {
|
||||
$info = explode(':',$showDay->getDbDuration());
|
||||
|
||||
return str_pad(intval($info[0]),2,'0',STR_PAD_LEFT).'h '.str_pad(intval($info[1]),2,'0',STR_PAD_LEFT).'m';
|
||||
}
|
||||
}
|
||||
|
||||
public function getShowDays(){
|
||||
public function getShowDays()
|
||||
{
|
||||
$showDays = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->find();
|
||||
|
||||
$days = array();
|
||||
|
@ -781,7 +811,8 @@ class Application_Model_Show {
|
|||
/* Only used for shows that aren't repeating.
|
||||
*
|
||||
* @return Boolean: true if show has an instance, otherwise false. */
|
||||
public function hasInstance(){
|
||||
public function hasInstance()
|
||||
{
|
||||
return (!is_null($this->getInstance()));
|
||||
}
|
||||
|
||||
|
@ -789,7 +820,8 @@ class Application_Model_Show {
|
|||
*
|
||||
* @return CcShowInstancesQuery: An propel object representing a
|
||||
* row in the cc_show_instances table. */
|
||||
public function getInstance(){
|
||||
public function getInstance()
|
||||
{
|
||||
$showInstance = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($this->getId())
|
||||
->findOne();
|
||||
|
@ -800,7 +832,8 @@ class Application_Model_Show {
|
|||
/**
|
||||
* returns info about live stream override info
|
||||
*/
|
||||
public function getLiveStreamInfo(){
|
||||
public function getLiveStreamInfo()
|
||||
{
|
||||
$info = array();
|
||||
if ($this->_showId == null) {
|
||||
return $info;
|
||||
|
@ -811,6 +844,7 @@ class Application_Model_Show {
|
|||
$info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth();
|
||||
$info['custom_username'] = $ccShow->getDbLiveStreamUser();
|
||||
$info['custom_password'] = $ccShow->getDbLiveStreamPass();
|
||||
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
@ -825,11 +859,11 @@ class Application_Model_Show {
|
|||
*
|
||||
* @return Boolean: true if show has an instance on $p_dateTime,
|
||||
* otherwise false. */
|
||||
public function hasInstanceOnDate($p_dateTime){
|
||||
public function hasInstanceOnDate($p_dateTime)
|
||||
{
|
||||
return (!is_null($this->getInstanceOnDate($p_dateTime)));
|
||||
}
|
||||
|
||||
|
||||
/* Only used for shows that are repeating. Note that this will return
|
||||
* shows that have been "modified" (does not check if the "modified_instance"
|
||||
* column is set to true). This is intended behaviour.
|
||||
|
@ -838,7 +872,8 @@ class Application_Model_Show {
|
|||
*
|
||||
* @return CcShowInstancesQuery: An propel object representing a
|
||||
* row in the cc_show_instances table. */
|
||||
public function getInstanceOnDate($p_dateTime){
|
||||
public function getInstanceOnDate($p_dateTime)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$timestamp = $p_dateTime->format("Y-m-d H:i:s");
|
||||
|
@ -850,6 +885,7 @@ class Application_Model_Show {
|
|||
|
||||
$query = $con->query($sql);
|
||||
$row = ($query !== false) ? $query->fetchColumn(0) : null;
|
||||
|
||||
return CcShowInstancesQuery::create()
|
||||
->findPk($row);
|
||||
}
|
||||
|
@ -890,8 +926,7 @@ class Application_Model_Show {
|
|||
if (count($intersect) != count($p_data['add_show_day_check'])) {
|
||||
$repeatingDaysChanged = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$repeatingDaysChanged = true;
|
||||
}
|
||||
|
||||
|
@ -923,8 +958,7 @@ class Application_Model_Show {
|
|||
if ((strlen($this->getRepeatingEndDate()) == 0) == $p_data['add_show_no_end']) {
|
||||
//show "Never Ends" option was toggled.
|
||||
if ($p_data['add_show_no_end']) {
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->removeAllInstancesFromDate($p_endDate);
|
||||
}
|
||||
}
|
||||
|
@ -957,14 +991,12 @@ class Application_Model_Show {
|
|||
|
||||
if ($data['add_show_no_end']) {
|
||||
$endDate = NULL;
|
||||
}
|
||||
else if ($data['add_show_repeats']) {
|
||||
} elseif ($data['add_show_repeats']) {
|
||||
$endDateTime = new DateTime($data['add_show_end_date']);
|
||||
//$endDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
$endDateTime->add(new DateInterval("P1D"));
|
||||
$endDate = $endDateTime->format("Y-m-d");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$endDateTime = new DateTime($data['add_show_start_date']);
|
||||
//$endDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||
$endDateTime->add(new DateInterval("P1D"));
|
||||
|
@ -1075,8 +1107,7 @@ class Application_Model_Show {
|
|||
$showRebroad->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($isRecorded && $data['add_show_rebroadcast'] && ($repeatType == -1)){
|
||||
} elseif ($isRecorded && $data['add_show_rebroadcast'] && ($repeatType == -1)) {
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
if ($data['add_show_rebroadcast_date_absolute_'.$i]) {
|
||||
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
|
||||
|
@ -1127,8 +1158,7 @@ class Application_Model_Show {
|
|||
}
|
||||
|
||||
$con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
Logging::log("Couldn't update schedule status.");
|
||||
Logging::log($e->getMessage());
|
||||
|
@ -1137,6 +1167,7 @@ class Application_Model_Show {
|
|||
|
||||
Application_Model_Show::populateShowUntil($showId);
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
||||
return $showId;
|
||||
}
|
||||
|
||||
|
@ -1178,17 +1209,15 @@ class Application_Model_Show {
|
|||
* @param DateTime $p_populateUntilDateTime
|
||||
* DateTime object in UTC time.
|
||||
*/
|
||||
private static function populateShow($p_showDaysRow, $p_populateUntilDateTime) {
|
||||
private static function populateShow($p_showDaysRow, $p_populateUntilDateTime)
|
||||
{
|
||||
if ($p_showDaysRow["repeat_type"] == -1) {
|
||||
Application_Model_Show::populateNonRepeatingShow($p_showDaysRow, $p_populateUntilDateTime);
|
||||
}
|
||||
else if($p_showDaysRow["repeat_type"] == 0) {
|
||||
} elseif ($p_showDaysRow["repeat_type"] == 0) {
|
||||
Application_Model_Show::populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, 'P7D');
|
||||
}
|
||||
else if($p_showDaysRow["repeat_type"] == 1) {
|
||||
} elseif ($p_showDaysRow["repeat_type"] == 1) {
|
||||
Application_Model_Show::populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, 'P14D');
|
||||
}
|
||||
else if($p_showDaysRow["repeat_type"] == 2) {
|
||||
} elseif ($p_showDaysRow["repeat_type"] == 2) {
|
||||
Application_Model_Show::populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, 'P1M');
|
||||
}
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
@ -1348,7 +1377,8 @@ class Application_Model_Show {
|
|||
Application_Model_Show::setNextPop($start, $show_id, $day);
|
||||
}
|
||||
|
||||
private static function advanceRepeatingDate($p_interval, $start, $timezone){
|
||||
private static function advanceRepeatingDate($p_interval, $start, $timezone)
|
||||
{
|
||||
$startDt = new DateTime($start, new DateTimeZone($timezone));
|
||||
if ($p_interval == 'P1M') {
|
||||
/* When adding months, there is a problem if we are on January 31st and add one month with PHP.
|
||||
|
@ -1411,6 +1441,7 @@ class Application_Model_Show {
|
|||
$duration = explode(":", $p_duration);
|
||||
list($hours, $mins) = array_slice($duration, 0, 2);
|
||||
$endDateTime->add(new DateInterval("PT{$hours}H{$mins}M"));
|
||||
|
||||
return array($startDateTime, $endDateTime);
|
||||
}
|
||||
|
||||
|
@ -1433,8 +1464,8 @@ class Application_Model_Show {
|
|||
* string of user's timezone "Europe/Prague"
|
||||
*
|
||||
*/
|
||||
private static function createRebroadcastInstances($p_rebroadcasts, $p_currentUtcTimestamp, $p_showId, $p_showInstanceId, $p_startTime, $p_duration, $p_timezone=null){
|
||||
|
||||
private static function createRebroadcastInstances($p_rebroadcasts, $p_currentUtcTimestamp, $p_showId, $p_showInstanceId, $p_startTime, $p_duration, $p_timezone=null)
|
||||
{
|
||||
//Y-m-d
|
||||
//use only the date part of the show start time stamp for the offsets to work properly.
|
||||
$date = explode(" ", $p_startTime);
|
||||
|
@ -1500,8 +1531,7 @@ class Application_Model_Show {
|
|||
|
||||
$sql = $sql." AND (si1.starts >= '{$start_string}' AND si1.starts < timestamp '{$end_string}')";
|
||||
$sql = $sql." AND (si1.record = 1)";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
$sql = $sql." AND ((si1.starts >= '{$start_string}' AND si1.starts < '{$end_string}')
|
||||
OR (si1.ends > '{$start_string}' AND si1.ends <= '{$end_string}')
|
||||
|
@ -1520,6 +1550,7 @@ class Application_Model_Show {
|
|||
}
|
||||
|
||||
$result = $con->query($sql)->fetchAll();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -1551,8 +1582,7 @@ class Application_Model_Show {
|
|||
$endTimeString = $p_endTimestamp->format("Y-m-d H:i:s");
|
||||
if (!is_null($p_startTimestamp)) {
|
||||
$startTimeString = $p_startTimestamp->format("Y-m-d H:i:s");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$today_timestamp = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$startTimeString = $today_timestamp->format("Y-m-d H:i:s");
|
||||
}
|
||||
|
@ -1605,11 +1635,9 @@ class Application_Model_Show {
|
|||
|
||||
if ($p_editable && $show["record"] && $nowEpoch > $startsEpoch) {
|
||||
$options["editable"] = false;
|
||||
}
|
||||
else if ($p_editable && $show["rebroadcast"] && $nowEpoch > $parentStartsEpoch) {
|
||||
} elseif ($p_editable && $show["rebroadcast"] && $nowEpoch > $parentStartsEpoch) {
|
||||
$options["editable"] = false;
|
||||
}
|
||||
else if ($p_editable && $nowEpoch < $endsEpoch) {
|
||||
} elseif ($p_editable && $nowEpoch < $endsEpoch) {
|
||||
$options["editable"] = true;
|
||||
}
|
||||
$events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);
|
||||
|
@ -1622,7 +1650,8 @@ class Application_Model_Show {
|
|||
* Calculates the percentage of a show scheduled given the start and end times in date/time format
|
||||
* and the time_filled as the total time the schow is scheduled for in time format.
|
||||
**/
|
||||
private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled){
|
||||
private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled)
|
||||
{
|
||||
$durationSeconds = (strtotime($p_ends) - strtotime($p_starts));
|
||||
$time_filled = Application_Model_Schedule::WallTimeToMillisecs($p_time_filled) / 1000;
|
||||
$percent = ceil(( $time_filled / $durationSeconds) * 100);
|
||||
|
@ -1677,8 +1706,8 @@ class Application_Model_Show {
|
|||
/* Takes in a UTC DateTime object.
|
||||
* Converts this to local time, since cc_show days
|
||||
* requires local time. */
|
||||
public function setShowFirstShow($p_dt){
|
||||
|
||||
public function setShowFirstShow($p_dt)
|
||||
{
|
||||
//clone object since we are modifying it and it was passed by reference.
|
||||
$dt = clone $p_dt;
|
||||
|
||||
|
@ -1697,8 +1726,8 @@ class Application_Model_Show {
|
|||
/* Takes in a UTC DateTime object
|
||||
* Converts this to local time, since cc_show days
|
||||
* requires local time. */
|
||||
public function setShowLastShow($p_dt){
|
||||
|
||||
public function setShowLastShow($p_dt)
|
||||
{
|
||||
//clone object since we are modifying it and it was passed by reference.
|
||||
$dt = clone $p_dt;
|
||||
|
||||
|
@ -1741,6 +1770,7 @@ class Application_Model_Show {
|
|||
|
||||
// Convert back to local timezone
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
@ -1884,6 +1914,7 @@ class Application_Model_Show {
|
|||
}
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
require_once 'formatters/LengthFormatter.php';
|
||||
require_once 'formatters/TimeFilledFormatter.php';
|
||||
|
||||
class Application_Model_ShowBuilder {
|
||||
|
||||
class Application_Model_ShowBuilder
|
||||
{
|
||||
private $timezone;
|
||||
|
||||
//in UTC timezone
|
||||
|
@ -49,8 +49,8 @@ class Application_Model_ShowBuilder {
|
|||
* @param DateTime $p_startsDT
|
||||
* @param DateTime $p_endsDT
|
||||
*/
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts)
|
||||
{
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
|
@ -60,8 +60,8 @@ class Application_Model_ShowBuilder {
|
|||
$this->currentShow = false;
|
||||
}
|
||||
|
||||
private function getUsersShows() {
|
||||
|
||||
private function getUsersShows()
|
||||
{
|
||||
$shows = array();
|
||||
|
||||
$host_shows = CcShowHostsQuery::create()
|
||||
|
@ -77,8 +77,8 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
|
||||
//check to see if this row should be editable by the user.
|
||||
private function isAllowed($p_item, &$row) {
|
||||
|
||||
private function isAllowed($p_item, &$row)
|
||||
{
|
||||
//cannot schedule in a recorded show.
|
||||
if (intval($p_item["si_record"]) === 1) {
|
||||
return;
|
||||
|
@ -89,7 +89,8 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
private function getItemColor($p_item, &$row) {
|
||||
private function getItemColor($p_item, &$row)
|
||||
{
|
||||
$defaultColor = "ffffff";
|
||||
$defaultBackground = "3366cc";
|
||||
|
||||
|
@ -107,17 +108,16 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
|
||||
//information about whether a track is inside|boundary|outside a show.
|
||||
private function getItemStatus($p_item, &$row) {
|
||||
|
||||
private function getItemStatus($p_item, &$row)
|
||||
{
|
||||
$row["status"] = intval($p_item["playout_status"]);
|
||||
}
|
||||
|
||||
private function getRowTimestamp($p_item, &$row) {
|
||||
|
||||
private function getRowTimestamp($p_item, &$row)
|
||||
{
|
||||
if (is_null($p_item["si_last_scheduled"])) {
|
||||
$ts = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$dt = new DateTime($p_item["si_last_scheduled"], new DateTimeZone("UTC"));
|
||||
$ts = intval($dt->format("U"));
|
||||
}
|
||||
|
@ -130,18 +130,15 @@ class Application_Model_ShowBuilder {
|
|||
* 1 = current
|
||||
* 2 = future
|
||||
*/
|
||||
private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row) {
|
||||
|
||||
private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row)
|
||||
{
|
||||
if ($row["footer"] === true && $this->epoch_now > $p_epochItemStart && $this->epoch_now > $p_epochItemEnd) {
|
||||
$row["scheduled"] = 0;
|
||||
}
|
||||
else if ($row["footer"] === true && $this->epoch_now < $p_epochItemEnd) {
|
||||
} elseif ($row["footer"] === true && $this->epoch_now < $p_epochItemEnd) {
|
||||
$row["scheduled"] = 2;
|
||||
}
|
||||
else if ($row["header"] === true && $this->epoch_now >= $p_epochItemStart) {
|
||||
} elseif ($row["header"] === true && $this->epoch_now >= $p_epochItemStart) {
|
||||
$row["scheduled"] = 0;
|
||||
}
|
||||
else if ($row["header"] === true && $this->epoch_now < $p_epochItemEnd) {
|
||||
} elseif ($row["header"] === true && $this->epoch_now < $p_epochItemEnd) {
|
||||
$row["scheduled"] = 2;
|
||||
}
|
||||
|
||||
|
@ -163,8 +160,8 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
private function makeHeaderRow($p_item) {
|
||||
|
||||
private function makeHeaderRow($p_item)
|
||||
{
|
||||
$row = $this->defaultRowArray;
|
||||
$this->isAllowed($p_item, $row);
|
||||
$this->getRowTimestamp($p_item, $row);
|
||||
|
@ -188,8 +185,7 @@ class Application_Model_ShowBuilder {
|
|||
$time = $dt->format("Y-m-d H:i");
|
||||
|
||||
$row["rebroadcast_title"] = "Rebroadcast of {$name} from {$time}";
|
||||
}
|
||||
else if (intval($p_item["si_record"]) === 1) {
|
||||
} elseif (intval($p_item["si_record"]) === 1) {
|
||||
$row["record"] = true;
|
||||
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
@ -204,8 +200,7 @@ class Application_Model_ShowBuilder {
|
|||
if ($startsEpoch < $this->epoch_now && $endsEpoch > $this->epoch_now) {
|
||||
$row["currentShow"] = true;
|
||||
$this->currentShow = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->currentShow = false;
|
||||
}
|
||||
|
||||
|
@ -229,7 +224,8 @@ class Application_Model_ShowBuilder {
|
|||
return $row;
|
||||
}
|
||||
|
||||
private function makeScheduledItemRow($p_item) {
|
||||
private function makeScheduledItemRow($p_item)
|
||||
{
|
||||
$row = $this->defaultRowArray;
|
||||
|
||||
if (isset($p_item["sched_starts"])) {
|
||||
|
@ -283,8 +279,7 @@ class Application_Model_ShowBuilder {
|
|||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||
|
||||
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$row["empty"] = true;
|
||||
$row["id"] = 0 ;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
@ -305,8 +300,8 @@ class Application_Model_ShowBuilder {
|
|||
return $row;
|
||||
}
|
||||
|
||||
private function makeFooterRow($p_item) {
|
||||
|
||||
private function makeFooterRow($p_item)
|
||||
{
|
||||
$row = $this->defaultRowArray;
|
||||
$row["footer"] = true;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
@ -346,14 +341,14 @@ class Application_Model_ShowBuilder {
|
|||
* @return boolean whether the schedule in the show builder's range has been updated.
|
||||
*
|
||||
*/
|
||||
public function hasBeenUpdatedSince($timestamp, $instances) {
|
||||
public function hasBeenUpdatedSince($timestamp, $instances)
|
||||
{
|
||||
$outdated = false;
|
||||
$shows = Application_Model_Show::getShows($this->startDT, $this->endDT);
|
||||
|
||||
if ($this->opts["showFilter"] !== 0) {
|
||||
$include[] = $this->opts["showFilter"];
|
||||
}
|
||||
else if ($this->opts["myShows"] === 1) {
|
||||
} elseif ($this->opts["myShows"] === 1) {
|
||||
|
||||
$include = $this->getUsersShows();
|
||||
}
|
||||
|
@ -368,8 +363,7 @@ class Application_Model_ShowBuilder {
|
|||
|
||||
if (isset($show["last_scheduled"])) {
|
||||
$dt = new DateTime($show["last_scheduled"], new DateTimeZone("UTC"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$dt = new DateTime($show["created"], new DateTimeZone("UTC"));
|
||||
}
|
||||
|
||||
|
@ -392,8 +386,8 @@ class Application_Model_ShowBuilder {
|
|||
return $outdated;
|
||||
}
|
||||
|
||||
public function GetItems() {
|
||||
|
||||
public function GetItems()
|
||||
{
|
||||
$current_id = -1;
|
||||
$display_items = array();
|
||||
|
||||
|
@ -401,8 +395,7 @@ class Application_Model_ShowBuilder {
|
|||
if ($this->opts["myShows"] === 1) {
|
||||
|
||||
$shows = $this->getUsersShows();
|
||||
}
|
||||
else if ($this->opts["showFilter"] !== 0) {
|
||||
} elseif ($this->opts["showFilter"] !== 0) {
|
||||
$shows[] = $this->opts["showFilter"];
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
require_once 'formatters/LengthFormatter.php';
|
||||
|
||||
class Application_Model_ShowInstance {
|
||||
|
||||
class Application_Model_ShowInstance
|
||||
{
|
||||
private $_instanceId;
|
||||
private $_showInstance;
|
||||
|
||||
|
@ -27,11 +27,13 @@ class Application_Model_ShowInstance {
|
|||
return $this->_instanceId;
|
||||
}
|
||||
|
||||
public function getShow(){
|
||||
public function getShow()
|
||||
{
|
||||
return new Application_Model_Show($this->getShowId());
|
||||
}
|
||||
|
||||
public function deleteRebroadcasts(){
|
||||
public function deleteRebroadcasts()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$timestamp = gmdate("Y-m-d H:i:s");
|
||||
|
@ -62,12 +64,14 @@ class Application_Model_ShowInstance {
|
|||
public function getName()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->getShowId());
|
||||
|
||||
return $show->getDbName();
|
||||
}
|
||||
|
||||
public function getGenre()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->getShowId());
|
||||
|
||||
return $show->getDbGenre();
|
||||
}
|
||||
|
||||
|
@ -93,6 +97,7 @@ class Application_Model_ShowInstance {
|
|||
{
|
||||
$showStart = $this->getShowInstanceStart();
|
||||
$showStartExplode = explode(" ", $showStart);
|
||||
|
||||
return $showStartExplode[0];
|
||||
}
|
||||
|
||||
|
@ -113,6 +118,7 @@ class Application_Model_ShowInstance {
|
|||
public function getSoundCloudFileId()
|
||||
{
|
||||
$file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
|
||||
|
||||
return $file->getSoundCloudId();
|
||||
}
|
||||
|
||||
|
@ -199,8 +205,8 @@ class Application_Model_ShowInstance {
|
|||
* @return $newDateTime
|
||||
* php DateTime, $dateTime with the added time deltas.
|
||||
*/
|
||||
private static function addDeltas($dateTime, $deltaDay, $deltaMin) {
|
||||
|
||||
private static function addDeltas($dateTime, $deltaDay, $deltaMin)
|
||||
{
|
||||
$newDateTime = clone $dateTime;
|
||||
|
||||
$days = abs($deltaDay);
|
||||
|
@ -211,15 +217,13 @@ class Application_Model_ShowInstance {
|
|||
|
||||
if ($deltaDay > 0) {
|
||||
$newDateTime->add($dayInterval);
|
||||
}
|
||||
else if ($deltaDay < 0){
|
||||
} elseif ($deltaDay < 0) {
|
||||
$newDateTime->sub($dayInterval);
|
||||
}
|
||||
|
||||
if ($deltaMin > 0) {
|
||||
$newDateTime->add($minInterval);
|
||||
}
|
||||
else if ($deltaMin < 0) {
|
||||
} elseif ($deltaMin < 0) {
|
||||
$newDateTime->sub($minInterval);
|
||||
}
|
||||
|
||||
|
@ -286,6 +290,7 @@ class Application_Model_ShowInstance {
|
|||
//recorded show doesn't exist.
|
||||
catch (Exception $e) {
|
||||
$this->_showInstance->delete();
|
||||
|
||||
return "Show was deleted because recorded show does not exist!";
|
||||
}
|
||||
|
||||
|
@ -537,12 +542,10 @@ class Application_Model_ShowInstance {
|
|||
->filterByDbId($showId)
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($this->isRebroadcast()) {
|
||||
$this->_showInstance->delete();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$show->delete();
|
||||
}
|
||||
}
|
||||
|
@ -567,8 +570,7 @@ class Application_Model_ShowInstance {
|
|||
try {
|
||||
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
|
||||
$rebroad->addFileToShow($file_id, false);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
|
@ -586,8 +588,7 @@ class Application_Model_ShowInstance {
|
|||
$time_arr[1] = "." . $time_arr[1];
|
||||
$milliseconds = number_format(round($time_arr[1], 2), 2);
|
||||
$time = $time_arr[0] . substr($milliseconds, 1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$time = $time_arr[0] . ".00";
|
||||
}
|
||||
} else {
|
||||
|
@ -601,6 +602,7 @@ class Application_Model_ShowInstance {
|
|||
public function getTimeScheduledSecs()
|
||||
{
|
||||
$time_filled = $this->getTimeScheduled();
|
||||
|
||||
return Application_Model_Playlist::playlistTimeToSeconds($time_filled);
|
||||
}
|
||||
|
||||
|
@ -608,6 +610,7 @@ class Application_Model_ShowInstance {
|
|||
{
|
||||
$ends = $this->getShowInstanceEnd(null);
|
||||
$starts = $this->getShowInstanceStart(null);
|
||||
|
||||
return intval($ends->format('U')) - intval($starts->format('U'));
|
||||
}
|
||||
|
||||
|
@ -678,10 +681,12 @@ class Application_Model_ShowInstance {
|
|||
."LIMIT 1";
|
||||
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($query !== false) ? $query : NULL;
|
||||
}
|
||||
|
||||
public function getShowEndGapTime(){
|
||||
public function getShowEndGapTime()
|
||||
{
|
||||
$showEnd = $this->getShowInstanceEnd();
|
||||
$lastItemEnd = $this->getLastAudioItemEnd();
|
||||
|
||||
|
@ -695,7 +700,8 @@ class Application_Model_ShowInstance {
|
|||
return ($diff < 0) ? 0 : $diff;
|
||||
}
|
||||
|
||||
public static function GetLastShowInstance($p_timeNow){
|
||||
public static function GetLastShowInstance($p_timeNow)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -767,6 +773,7 @@ class Application_Model_ShowInstance {
|
|||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT count(*) as cnt FROM $CC_CONFIG[showInstances] WHERE ends < '$day'";
|
||||
|
||||
return $con->query($sql)->fetchColumn(0);
|
||||
}
|
||||
|
||||
|
@ -785,7 +792,8 @@ class Application_Model_ShowInstance {
|
|||
return $con->query($sql)->fetchAll();
|
||||
}
|
||||
|
||||
function isRepeating(){
|
||||
public function isRepeating()
|
||||
{
|
||||
if ($this->getShow()->isRepeating()) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
require_once 'soundcloud-api/Services/Soundcloud.php';
|
||||
|
||||
class Application_Model_Soundcloud {
|
||||
|
||||
class Application_Model_Soundcloud
|
||||
{
|
||||
private $_soundcloud;
|
||||
|
||||
public function __construct()
|
||||
|
@ -24,13 +24,11 @@ class Application_Model_Soundcloud {
|
|||
|
||||
public function uploadTrack($filepath, $filename, $description, $tags=array(), $release=null, $genre=null)
|
||||
{
|
||||
if($this->getToken())
|
||||
{
|
||||
if ($this->getToken()) {
|
||||
if (count($tags)) {
|
||||
$tags = join(" ", $tags);
|
||||
$tags = $tags." ".Application_Model_Preference::GetSoundCloudTags();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$tags = Application_Model_Preference::GetSoundCloudTags();
|
||||
}
|
||||
|
||||
|
@ -60,8 +58,7 @@ class Application_Model_Soundcloud {
|
|||
|
||||
if (isset($genre) && $genre != "") {
|
||||
$track_data['track[genre]'] = $genre;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$default_genre = Application_Model_Preference::GetSoundCloudGenre();
|
||||
if ($default_genre != "") {
|
||||
$track_data['track[genre]'] = $default_genre;
|
||||
|
|
|
@ -13,8 +13,8 @@ require_once 'formatters/BitrateFormatter.php';
|
|||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @see MetaData
|
||||
*/
|
||||
class Application_Model_StoredFile {
|
||||
|
||||
class Application_Model_StoredFile
|
||||
{
|
||||
/**
|
||||
* @holds propel database object
|
||||
*/
|
||||
|
@ -60,7 +60,8 @@ class Application_Model_StoredFile {
|
|||
return $this->_file->getDbId();
|
||||
}
|
||||
|
||||
public function getGunId() {
|
||||
public function getGunId()
|
||||
{
|
||||
return $this->_file->getDbGunid();
|
||||
}
|
||||
|
||||
|
@ -69,7 +70,8 @@ class Application_Model_StoredFile {
|
|||
return $this->_file->getDbFtype();
|
||||
}
|
||||
|
||||
public function getPropelOrm(){
|
||||
public function getPropelOrm()
|
||||
{
|
||||
return $this->_file;
|
||||
}
|
||||
|
||||
|
@ -88,8 +90,7 @@ class Application_Model_StoredFile {
|
|||
{
|
||||
if (is_null($p_md)) {
|
||||
$this->setDbColMetadata();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$dbMd = array();
|
||||
|
||||
if (isset($p_md["MDATA_KEY_YEAR"])) {
|
||||
|
@ -137,8 +138,7 @@ class Application_Model_StoredFile {
|
|||
$method = "set$propelColumn";
|
||||
$this->_file->$method(null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
foreach ($p_md as $dbColumn => $mdValue) {
|
||||
//don't blank out name, defaults to original filename on first insertion to database.
|
||||
if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) {
|
||||
|
@ -217,6 +217,7 @@ class Application_Model_StoredFile {
|
|||
{
|
||||
$propelColumn = $this->_dbMD[$p_category];
|
||||
$method = "get$propelColumn";
|
||||
|
||||
return $this->_file->$method();
|
||||
}
|
||||
|
||||
|
@ -290,6 +291,7 @@ class Application_Model_StoredFile {
|
|||
$res = $con->exec($sql);
|
||||
$this->state = $p_state;
|
||||
$this->editedby = $p_editedby;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -297,7 +299,8 @@ class Application_Model_StoredFile {
|
|||
* Returns an array of playlist objects that this file is a part of.
|
||||
* @return array
|
||||
*/
|
||||
public function getPlaylists() {
|
||||
public function getPlaylists()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT playlist_id "
|
||||
|
@ -310,6 +313,7 @@ class Application_Model_StoredFile {
|
|||
$playlists[] = Application_Model_Playlist::Recall($id);
|
||||
}
|
||||
}
|
||||
|
||||
return $playlists;
|
||||
}
|
||||
|
||||
|
@ -375,8 +379,7 @@ class Application_Model_StoredFile {
|
|||
|
||||
if ($mime == "audio/vorbis" || $mime == "application/ogg") {
|
||||
return "ogg";
|
||||
}
|
||||
else if ($mime == "audio/mp3" || $mime == "audio/mpeg") {
|
||||
} elseif ($mime == "audio/mp3" || $mime == "audio/mpeg") {
|
||||
return "mp3";
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +435,8 @@ class Application_Model_StoredFile {
|
|||
* is specified in the airtime.conf config file. If either of these is
|
||||
* not specified, then use values provided by the $_SERVER global variable.
|
||||
*/
|
||||
public function getFileUrlUsingConfigAddress(){
|
||||
public function getFileUrlUsingConfigAddress()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
if (isset($CC_CONFIG['baseUrl'])) {
|
||||
|
@ -450,8 +454,10 @@ class Application_Model_StoredFile {
|
|||
return $this->constructGetFileUrl($serverName, $serverPort);
|
||||
}
|
||||
|
||||
private function constructGetFileUrl($p_serverName, $p_serverPort){
|
||||
private function constructGetFileUrl($p_serverName, $p_serverPort)
|
||||
{
|
||||
Logging::log("getting media! - 2");
|
||||
|
||||
return "http://$p_serverName:$p_serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
|
@ -462,6 +468,7 @@ Logging::log("getting media! - 2");
|
|||
public function getRelativeFileUrl($baseUrl)
|
||||
{
|
||||
Logging::log("getting media!");
|
||||
|
||||
return $baseUrl."/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
|
@ -482,8 +489,7 @@ Logging::log("getting media! - 2");
|
|||
if ($res === -1) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -514,13 +520,11 @@ Logging::log("getting media! - 2");
|
|||
{
|
||||
if (isset($p_id)) {
|
||||
$file = CcFilesQuery::create()->findPK(intval($p_id));
|
||||
}
|
||||
else if (isset($p_gunid)) {
|
||||
} elseif (isset($p_gunid)) {
|
||||
$file = CcFilesQuery::create()
|
||||
->filterByDbGunid($p_gunid)
|
||||
->findOne();
|
||||
}
|
||||
else if (isset($p_md5sum)) {
|
||||
} elseif (isset($p_md5sum)) {
|
||||
if ($exist) {
|
||||
$file = CcFilesQuery::create()
|
||||
->filterByDbMd5($p_md5sum)
|
||||
|
@ -531,8 +535,7 @@ Logging::log("getting media! - 2");
|
|||
->filterByDbMd5($p_md5sum)
|
||||
->findOne();
|
||||
}
|
||||
}
|
||||
else if (isset($p_filepath)) {
|
||||
} elseif (isset($p_filepath)) {
|
||||
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
|
||||
|
||||
if (is_null($path_info)) {
|
||||
|
@ -544,8 +547,7 @@ Logging::log("getting media! - 2");
|
|||
->filterByDbDirectory($music_dir->getId())
|
||||
->filterByDbFilepath($path_info[1])
|
||||
->findOne();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -554,14 +556,15 @@ Logging::log("getting media! - 2");
|
|||
$storedFile->_file = $file;
|
||||
|
||||
return $storedFile;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
public function getName()
|
||||
{
|
||||
$info = pathinfo($this->getFilePath());
|
||||
|
||||
return $info['filename'];
|
||||
}
|
||||
|
||||
|
@ -601,7 +604,8 @@ Logging::log("getting media! - 2");
|
|||
return Application_Model_StoredFile::Recall(null, null, null, $p_filepath);
|
||||
}
|
||||
|
||||
public static function RecallByPartialFilepath($partial_path){
|
||||
public static function RecallByPartialFilepath($partial_path)
|
||||
{
|
||||
$path_info = Application_Model_MusicDir::splitFilePath($partial_path);
|
||||
|
||||
if (is_null($path_info)) {
|
||||
|
@ -619,11 +623,12 @@ Logging::log("getting media! - 2");
|
|||
$storedFile->_file = $file;
|
||||
$res[] = $storedFile;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function searchLibraryFiles($datatables) {
|
||||
|
||||
public static function searchLibraryFiles($datatables)
|
||||
{
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
|
||||
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
|
||||
|
@ -639,16 +644,13 @@ Logging::log("getting media! - 2");
|
|||
if ($key === "id") {
|
||||
$plSelect[] = "PL.id AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "track_title") {
|
||||
} elseif ($key === "track_title") {
|
||||
$plSelect[] = "name AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "ftype") {
|
||||
} elseif ($key === "ftype") {
|
||||
$plSelect[] = "'playlist'::varchar AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "artist_name") {
|
||||
} elseif ($key === "artist_name") {
|
||||
$plSelect[] = "login AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
|
@ -656,8 +658,7 @@ Logging::log("getting media! - 2");
|
|||
else if (in_array($key, array("length", "utime", "mtime"))) {
|
||||
$plSelect[] = $key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else if ($key === "year") {
|
||||
} elseif ($key === "year") {
|
||||
|
||||
$plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
||||
$fileSelect[] = "year AS ".$key;
|
||||
|
@ -666,8 +667,7 @@ Logging::log("getting media! - 2");
|
|||
else if (in_array($key, array("track_number", "bit_rate", "sample_rate"))) {
|
||||
$plSelect[] = "NULL::int AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$plSelect[] = "NULL::text AS ".$key;
|
||||
$fileSelect[] = $key;
|
||||
}
|
||||
|
@ -728,8 +728,7 @@ Logging::log("getting media! - 2");
|
|||
if ($type == "au") {//&& isset( $audioResults )) {
|
||||
$row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
|
||||
$row['image'] = '<img title="Track preview" src="/css/images/icon_audioclip.png">';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$row['image'] = '<img title="Playlist preview" src="/css/images/icon_playlist.png">';
|
||||
}
|
||||
}
|
||||
|
@ -839,7 +838,8 @@ Logging::log("getting media! - 2");
|
|||
* Check, using disk_free_space, the space available in the $destination_folder folder to see if it has
|
||||
* enough space to move the $audio_file into and report back to the user if not.
|
||||
**/
|
||||
public static function isEnoughDiskSpaceToCopy($destination_folder, $audio_file){
|
||||
public static function isEnoughDiskSpaceToCopy($destination_folder, $audio_file)
|
||||
{
|
||||
//check to see if we have enough space in the /organize directory to copy the file
|
||||
$freeSpace = disk_free_space($destination_folder);
|
||||
$fileSize = filesize($audio_file);
|
||||
|
@ -847,7 +847,8 @@ Logging::log("getting media! - 2");
|
|||
return $freeSpace >= $fileSize;
|
||||
}
|
||||
|
||||
public static function copyFileToStor($p_targetDir, $fileName, $tempname){
|
||||
public static function copyFileToStor($p_targetDir, $fileName, $tempname)
|
||||
{
|
||||
$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $tempname;
|
||||
Logging::log('copyFileToStor: moving file '.$audio_file);
|
||||
$md5 = md5_file($audio_file);
|
||||
|
@ -868,6 +869,7 @@ Logging::log("getting media! - 2");
|
|||
if (!file_exists($stor."/organize")) {
|
||||
if (!mkdir($stor."/organize", 0777)) {
|
||||
$result = array("code" => 109, "message" => "Failed to create 'organize' directory.");
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -899,14 +901,15 @@ Logging::log("getting media! - 2");
|
|||
$result = array("code" => 107, "message" => "The file was not uploaded, there is ".$freeSpace."MB of disk space left and the file you are uploading has a size of ".$fileSize."MB.");
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass the file through Liquidsoap and test if it is readable. Return True if readable, and False otherwise.
|
||||
*/
|
||||
public static function liquidsoapFilePlayabilityTest($audio_file){
|
||||
|
||||
public static function liquidsoapFilePlayabilityTest($audio_file)
|
||||
{
|
||||
$LIQUIDSOAP_ERRORS = array('TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.');
|
||||
|
||||
// Ask Liquidsoap if file is playable
|
||||
|
@ -915,6 +918,7 @@ Logging::log("getting media! - 2");
|
|||
exec($command, $output, $rv);
|
||||
|
||||
$isError = count($output) > 0 && in_array($output[0], $LIQUIDSOAP_ERRORS);
|
||||
|
||||
return ($rv == 0 && !$isError);
|
||||
}
|
||||
|
||||
|
@ -924,6 +928,7 @@ Logging::log("getting media! - 2");
|
|||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG["filesTable"]." WHERE file_exists";
|
||||
|
||||
return $con->query($sql)->fetchColumn(0);
|
||||
}
|
||||
|
||||
|
@ -976,6 +981,7 @@ Logging::log("getting media! - 2");
|
|||
}
|
||||
|
||||
$rows = $con->query($sql, PDO::FETCH_ASSOC);
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
@ -993,6 +999,7 @@ Logging::log("getting media! - 2");
|
|||
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
return count($rows);
|
||||
} catch (Exception $e) {
|
||||
header('HTTP/1.0 503 Service Unavailable');
|
||||
|
@ -1008,7 +1015,8 @@ Logging::log("getting media! - 2");
|
|||
->save();
|
||||
}
|
||||
|
||||
public function getSoundCloudLinkToFile(){
|
||||
public function getSoundCloudLinkToFile()
|
||||
{
|
||||
return $this->_file->getDbSoundCloudLinkToFile();
|
||||
}
|
||||
|
||||
|
@ -1018,42 +1026,51 @@ Logging::log("getting media! - 2");
|
|||
->save();
|
||||
}
|
||||
|
||||
public function getSoundCloudId(){
|
||||
public function getSoundCloudId()
|
||||
{
|
||||
return $this->_file->getDbSoundCloudId();
|
||||
}
|
||||
|
||||
public function setSoundCloudErrorCode($code){
|
||||
public function setSoundCloudErrorCode($code)
|
||||
{
|
||||
$this->_file->setDbSoundCloudErrorCode($code)
|
||||
->save();
|
||||
}
|
||||
|
||||
public function getSoundCloudErrorCode(){
|
||||
public function getSoundCloudErrorCode()
|
||||
{
|
||||
return $this->_file->getDbSoundCloudErrorCode();
|
||||
}
|
||||
|
||||
public function setSoundCloudErrorMsg($msg){
|
||||
public function setSoundCloudErrorMsg($msg)
|
||||
{
|
||||
$this->_file->setDbSoundCloudErrorMsg($msg)
|
||||
->save();
|
||||
}
|
||||
|
||||
public function getSoundCloudErrorMsg(){
|
||||
public function getSoundCloudErrorMsg()
|
||||
{
|
||||
return $this->_file->getDbSoundCloudErrorMsg();
|
||||
}
|
||||
|
||||
public function getDirectory(){
|
||||
public function getDirectory()
|
||||
{
|
||||
return $this->_file->getDbDirectory();
|
||||
}
|
||||
|
||||
public function setFileExistsFlag($flag){
|
||||
public function setFileExistsFlag($flag)
|
||||
{
|
||||
$this->_file->setDbFileExists($flag)
|
||||
->save();
|
||||
}
|
||||
public function setSoundCloudUploadTime($time){
|
||||
public function setSoundCloudUploadTime($time)
|
||||
{
|
||||
$this->_file->setDbSoundCloundUploadTime($time)
|
||||
->save();
|
||||
}
|
||||
|
||||
public function getFileExistsFlag(){
|
||||
public function getFileExistsFlag()
|
||||
{
|
||||
return $this->_file->getDbFileExists();
|
||||
}
|
||||
|
||||
|
@ -1065,8 +1082,7 @@ Logging::log("getting media! - 2");
|
|||
if (is_null($file)) {
|
||||
return "File does not exist";
|
||||
}
|
||||
if(Application_Model_Preference::GetUploadToSoundcloudOption())
|
||||
{
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
for ($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
|
||||
$description = $file->getDbTrackTitle();
|
||||
$tag = array();
|
||||
|
@ -1079,8 +1095,7 @@ Logging::log("getting media! - 2");
|
|||
$this->setSoundCloudLinkToFile($soundcloud_res['permalink_url']);
|
||||
$this->setSoundCloudUploadTime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
break;
|
||||
}
|
||||
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
||||
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
||||
$code = $e->getHttpCode();
|
||||
$msg = $e->getHttpBody();
|
||||
$temp = explode('"error":',$msg);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
class Application_Model_StreamSetting {
|
||||
|
||||
class Application_Model_StreamSetting
|
||||
{
|
||||
public static function setValue($key, $value, $type)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
@ -44,6 +44,7 @@ class Application_Model_StreamSetting {
|
|||
." WHERE keyname = '$key'";
|
||||
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($result !== false) ? $result : null;
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +150,7 @@ class Application_Model_StreamSetting {
|
|||
"value"=>self::getDjLiveStreamMountPoint(),
|
||||
"type"=>"string");
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
@ -257,6 +259,7 @@ class Application_Model_StreamSetting {
|
|||
} else {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -286,6 +289,7 @@ class Application_Model_StreamSetting {
|
|||
$out[$stream] = $info;
|
||||
}
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ define('ALIBERR_BADSMEMB', 21);
|
|||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
class Application_Model_Subjects {
|
||||
|
||||
class Application_Model_Subjects
|
||||
{
|
||||
/* ======================================================= public methods */
|
||||
|
||||
public static function increaseLoginAttempts($login)
|
||||
|
@ -25,6 +25,7 @@ class Application_Model_Subjects {
|
|||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = login_attempts+1"
|
||||
." WHERE login='$login'";
|
||||
$res = $con->exec($sql);
|
||||
|
||||
return (intval($res) > 0);
|
||||
}
|
||||
|
||||
|
@ -35,6 +36,7 @@ class Application_Model_Subjects {
|
|||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'"
|
||||
." WHERE login='$login'";
|
||||
$res = $con->exec($sql);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -44,8 +46,8 @@ class Application_Model_Subjects {
|
|||
$con = Propel::getConnection();
|
||||
$sql = "SELECT login_attempts FROM ".$CC_CONFIG['subjTable']." WHERE login='$login'";
|
||||
$res = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($res !== false) ? $res : 0;
|
||||
}
|
||||
|
||||
} // class Subjects
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
class Application_Model_Systemstatus
|
||||
{
|
||||
|
||||
public static function GetMonitStatus($p_ip){
|
||||
public static function GetMonitStatus($p_ip)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$monit_user = $CC_CONFIG['monit_user'];
|
||||
$monit_password = $CC_CONFIG['monit_password'];
|
||||
|
@ -33,8 +34,8 @@ class Application_Model_Systemstatus
|
|||
return $docRoot;
|
||||
}
|
||||
|
||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||
|
||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName)
|
||||
{
|
||||
$starting = array(
|
||||
"name"=>"",
|
||||
"process_id"=>"STARTING...",
|
||||
|
@ -65,10 +66,8 @@ class Application_Model_Systemstatus
|
|||
);
|
||||
$data = $notRunning;
|
||||
|
||||
|
||||
if (!is_null($p_docRoot)) {
|
||||
foreach ($p_docRoot->getElementsByTagName("service") AS $item)
|
||||
{
|
||||
foreach ($p_docRoot->getElementsByTagName("service") AS $item) {
|
||||
if ($item->getElementsByTagName("name")->item(0)->nodeValue == $p_serviceName) {
|
||||
|
||||
$monitor = $item->getElementsByTagName("monitor");
|
||||
|
@ -119,10 +118,12 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetPlatformInfo(){
|
||||
public static function GetPlatformInfo()
|
||||
{
|
||||
$keys = array("release", "machine", "memory", "swap");
|
||||
foreach ($keys as $key) {
|
||||
$data[$key] = "UNKNOWN";
|
||||
|
@ -130,8 +131,7 @@ class Application_Model_Systemstatus
|
|||
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
if (!is_null($docRoot)) {
|
||||
foreach ($docRoot->getElementsByTagName("platform") AS $item)
|
||||
{
|
||||
foreach ($docRoot->getElementsByTagName("platform") AS $item) {
|
||||
foreach ($keys as $key) {
|
||||
$keyElement = $item->getElementsByTagName($key);
|
||||
if ($keyElement->length > 0) {
|
||||
|
@ -144,8 +144,8 @@ class Application_Model_Systemstatus
|
|||
return $data;
|
||||
}
|
||||
|
||||
public static function GetPypoStatus(){
|
||||
|
||||
public static function GetPypoStatus()
|
||||
{
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||
if (is_null($component)) {
|
||||
return null;
|
||||
|
@ -159,8 +159,8 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetLiquidsoapStatus(){
|
||||
|
||||
public static function GetLiquidsoapStatus()
|
||||
{
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("pypo");
|
||||
if (is_null($component)) {
|
||||
return null;
|
||||
|
@ -174,8 +174,8 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetMediaMonitorStatus(){
|
||||
|
||||
public static function GetMediaMonitorStatus()
|
||||
{
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor");
|
||||
if (is_null($component)) {
|
||||
return null;
|
||||
|
@ -189,15 +189,16 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetIcecastStatus(){
|
||||
public static function GetIcecastStatus()
|
||||
{
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
$data = self::ExtractServiceInformation($docRoot, "icecast2");
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetRabbitMqStatus(){
|
||||
|
||||
public static function GetRabbitMqStatus()
|
||||
{
|
||||
if (isset($_SERVER["RABBITMQ_HOST"])) {
|
||||
$rabbitmq_host = $_SERVER["RABBITMQ_HOST"];
|
||||
} else {
|
||||
|
@ -209,7 +210,8 @@ class Application_Model_Systemstatus
|
|||
return $data;
|
||||
}
|
||||
|
||||
public static function GetDiskInfo(){
|
||||
public static function GetDiskInfo()
|
||||
{
|
||||
$partions = array();
|
||||
|
||||
if (isset($_SERVER['AIRTIME_SRV'])) {
|
||||
|
|
|
@ -5,8 +5,8 @@ define('UTYPE_ADMIN', 'A');
|
|||
define('UTYPE_GUEST', 'G');
|
||||
define('UTYPE_PROGRAM_MANAGER', 'P');
|
||||
|
||||
class Application_Model_User {
|
||||
|
||||
class Application_Model_User
|
||||
{
|
||||
private $_userInstance;
|
||||
|
||||
public function __construct($userId)
|
||||
|
@ -90,6 +90,7 @@ class Application_Model_User {
|
|||
return $this->_userInstance->getDbType() === 'A';
|
||||
case UTYPE_HOST:
|
||||
$userId = $this->_userInstance->getDbId();
|
||||
|
||||
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||
case UTYPE_PROGRAM_MANAGER:
|
||||
return $this->_userInstance->getDbType() === 'P';
|
||||
|
@ -154,54 +155,63 @@ class Application_Model_User {
|
|||
public function getLogin()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbLogin();
|
||||
}
|
||||
|
||||
public function getPassword()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbPass();
|
||||
}
|
||||
|
||||
public function getFirstName()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbFirstName();
|
||||
}
|
||||
|
||||
public function getLastName()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbLastName();
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbType();
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbEmail();
|
||||
}
|
||||
|
||||
public function getCellPhone()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbCellPhone();
|
||||
}
|
||||
|
||||
public function getSkype()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbSkypeContact();
|
||||
}
|
||||
|
||||
public function getJabber()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
|
||||
return $user->getDbJabberContact();
|
||||
|
||||
}
|
||||
|
@ -221,6 +231,7 @@ class Application_Model_User {
|
|||
private function createUser()
|
||||
{
|
||||
$user = new CcSubjs();
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
@ -275,6 +286,7 @@ class Application_Model_User {
|
|||
}
|
||||
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($query !== false) ? $query : null;
|
||||
}
|
||||
|
||||
|
@ -337,6 +349,7 @@ class Application_Model_User {
|
|||
//we get here if $userinfo->id is defined, but doesn't exist
|
||||
//in the database anymore.
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue