Format code using php-cs-fixer

This commit is contained in:
jo 2021-10-11 16:10:47 +02:00
parent 43d7dc92cd
commit d52c6184b9
352 changed files with 17473 additions and 17041 deletions

View file

@ -2,18 +2,18 @@
class ShowbuilderController extends Zend_Controller_Action
{
public function init()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('schedule-move', 'json')
->addActionContext('schedule-add', 'json')
->addActionContext('schedule-remove', 'json')
->addActionContext('builder-dialog', 'json')
->addActionContext('check-builder-feed', 'json')
->addActionContext('builder-feed', 'json')
->addActionContext('context-menu', 'json')
->initContext();
->addActionContext('schedule-add', 'json')
->addActionContext('schedule-remove', 'json')
->addActionContext('builder-dialog', 'json')
->addActionContext('check-builder-feed', 'json')
->addActionContext('builder-feed', 'json')
->addActionContext('context-menu', 'json')
->initContext()
;
}
public function indexAction()
@ -24,46 +24,46 @@ class ShowbuilderController extends Zend_Controller_Action
//$this->_helper->layout->setLayout("showbuilder");
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '{$userType}' );");
$this->view->headLink()->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/contextmenu/jquery.contextMenu.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/blockui/jquery.blockUI.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/buttons/buttons.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/utilities/utilities.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl . 'css/media_library.css?' . $CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.contextMenu.css?' . $CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl . 'css/datatables/css/ColVis.css?' . $CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl . 'css/datatables/css/dataTables.colReorder.min.css?' . $CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/library.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/events/library_showbuilder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$headScript = $this->view->headScript();
AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
// PLUPLOAD
$this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/libs/dropzone.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/tabs.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/timepicker/jquery.ui.timepicker.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/showbuilder/tabs.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/showbuilder/builder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/showbuilder/main_builder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
// MEDIA BUILDER
$this->view->headScript()->appendFile($baseUrl.'js/libs/dayjs.min.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/libs/utc.min.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/libs/timezone.min.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/podcast.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/publish.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl . 'js/libs/dayjs.min.js', 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/libs/utc.min.js', 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/libs/timezone.min.js', 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/spl.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/podcast.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/publish.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/playlist/smart_blockbuilder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl . 'css/playlist_builder.css?' . $CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/dashboard.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.ui.timepicker.css?' . $CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl . 'css/showbuilder.css?' . $CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl . 'css/dashboard.css?' . $CC_CONFIG['airtime_version']);
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf');
@ -72,27 +72,27 @@ class ShowbuilderController extends Zend_Controller_Action
$request = $this->getRequest();
//populate date range form for show builder.
$now = time();
$from = $request->getParam("from", $now);
$to = $request->getParam("to", $now + (3*60*60));
$now = time();
$from = $request->getParam('from', $now);
$to = $request->getParam('to', $now + (3 * 60 * 60));
$utcTimezone = new DateTimeZone("UTC");
$utcTimezone = new DateTimeZone('UTC');
$displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
$start = DateTime::createFromFormat("U", $from, $utcTimezone);
$start = DateTime::createFromFormat('U', $from, $utcTimezone);
$start->setTimezone($displayTimeZone);
$end = DateTime::createFromFormat("U", $to, $utcTimezone);
$end = DateTime::createFromFormat('U', $to, $utcTimezone);
$end->setTimezone($displayTimeZone);
$this->checkAndShowSetupPopup($request);
$form = new Application_Form_ShowBuilder();
$form->populate(array(
'sb_date_start' => $start->format("Y-m-d"),
'sb_time_start' => $start->format("H:i"),
'sb_date_end' => $end->format("Y-m-d"),
'sb_time_end' => $end->format("H:i")
));
$form->populate([
'sb_date_start' => $start->format('Y-m-d'),
'sb_time_start' => $start->format('H:i'),
'sb_date_end' => $end->format('Y-m-d'),
'sb_time_end' => $end->format('H:i'),
]);
$this->view->sb_form = $form;
}
@ -106,15 +106,15 @@ class ShowbuilderController extends Zend_Controller_Action
$previousPage = strtolower($request->getHeader('Referer'));
$userService = new Application_Service_UserService();
$currentUser = $userService->getCurrentUser();
$previousPageWasLoginScreen = (strpos($previousPage, 'login') !== false) ||
(strpos($previousPage, SAAS_LOGIN_REFERRER) !== false);
$previousPageWasLoginScreen = (strpos($previousPage, 'login') !== false)
|| (strpos($previousPage, SAAS_LOGIN_REFERRER) !== false);
// If current user is Super Admin, and they came from the login page,
// and they have not seen the setup popup before
if ($currentUser->isSuperAdmin() && $previousPageWasLoginScreen && empty($setupComplete)) {
$lang_tz_popup_form = new Application_Form_SetupLanguageTimezone();
$this->view->lang_tz_popup_form = $lang_tz_popup_form;
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/lang-timezone-setup.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/nowplaying/lang-timezone-setup.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
}
}
@ -126,22 +126,21 @@ class ShowbuilderController extends Zend_Controller_Action
$now = floatval(microtime(true));
$request = $this->getRequest();
$menu = array();
$menu = [];
$user = Application_Model_User::getCurrentUser();
$item = CcScheduleQuery::create()->findPK($id);
$instance = $item->getCcShowInstances();
$menu["preview"] = array("name"=> _("Preview"), "icon" => "play");
$menu['preview'] = ['name' => _('Preview'), 'icon' => 'play'];
//select the cursor
$menu["selCurs"] = array("name"=> _("Select cursor"),"icon" => "select-cursor");
$menu["delCurs"] = array("name"=> _("Remove cursor"),"icon" => "select-cursor");
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
$menu['selCurs'] = ['name' => _('Select cursor'), 'icon' => 'select-cursor'];
$menu['delCurs'] = ['name' => _('Remove cursor'), 'icon' => 'select-cursor'];
if ($now < floatval($item->getDbEnds('U.u')) && $user->canSchedule($instance->getDbShowId())) {
//remove/truncate the item from the schedule
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."showbuilder/schedule-remove");
$menu['del'] = ['name' => _('Delete'), 'icon' => 'delete', 'url' => $baseUrl . 'showbuilder/schedule-remove'];
}
$this->view->items = $menu;
@ -150,12 +149,12 @@ class ShowbuilderController extends Zend_Controller_Action
public function builderDialogAction()
{
$request = $this->getRequest();
$id = $request->getParam("id");
$id = $request->getParam('id');
$instance = CcShowInstancesQuery::create()->findPK($id);
if (is_null($instance)) {
$this->view->error = _("show does not exist");
$this->view->error = _('show does not exist');
return;
}
@ -176,12 +175,12 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->end = $end_time;
$form = new Application_Form_ShowBuilder();
$form->populate(array(
'sb_date_start' => $start->format("Y-m-d"),
'sb_time_start' => $start->format("H:i"),
'sb_date_end' => $end->format("Y-m-d"),
'sb_time_end' => $end->format("H:i")
));
$form->populate([
'sb_date_start' => $start->format('Y-m-d'),
'sb_time_start' => $start->format('H:i'),
'sb_date_end' => $end->format('Y-m-d'),
'sb_time_end' => $end->format('H:i'),
]);
$this->view->sb_form = $form;
@ -191,41 +190,43 @@ class ShowbuilderController extends Zend_Controller_Action
public function checkBuilderFeedAction()
{
$request = $this->getRequest();
$show_filter = intval($request->getParam("showFilter", 0));
$my_shows = intval($request->getParam("myShows", 0));
$timestamp = intval($request->getParam("timestamp", -1));
$instances = $request->getParam("instances", array());
$show_filter = intval($request->getParam('showFilter', 0));
$my_shows = intval($request->getParam('myShows', 0));
$timestamp = intval($request->getParam('timestamp', -1));
$instances = $request->getParam('instances', []);
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($request);
$opts = array("myShows" => $my_shows, "showFilter" => $show_filter);
$opts = ['myShows' => $my_shows, 'showFilter' => $show_filter];
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts);
//only send the schedule back if updates have been made.
// -1 default will always call the schedule to be sent back if no timestamp is defined.
$this->view->update = $showBuilder->hasBeenUpdatedSince(
$timestamp, $instances);
$timestamp,
$instances
);
}
public function builderFeedAction()
{
$current_time = time();
$current_time = time();
$request = $this->getRequest();
$show_filter = intval($request->getParam("showFilter", 0));
$show_instance_filter = intval($request->getParam("showInstanceFilter", 0));
$my_shows = intval($request->getParam("myShows", 0));
$show_filter = intval($request->getParam('showFilter', 0));
$show_instance_filter = intval($request->getParam('showInstanceFilter', 0));
$my_shows = intval($request->getParam('myShows', 0));
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($request);
$opts = array("myShows" => $my_shows,
"showFilter" => $show_filter,
"showInstanceFilter" => $show_instance_filter);
$opts = ['myShows' => $my_shows,
'showFilter' => $show_filter,
'showInstanceFilter' => $show_instance_filter, ];
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts);
$data = $showBuilder->getItems();
$this->view->schedule = $data["schedule"];
$this->view->instances = $data["showInstances"];
$this->view->schedule = $data['schedule'];
$this->view->instances = $data['showInstances'];
$this->view->timestamp = $current_time;
}
@ -233,15 +234,15 @@ class ShowbuilderController extends Zend_Controller_Action
{
$request = $this->getRequest();
$mediaItems = $request->getParam("mediaIds", array());
$scheduledItems = $request->getParam("schedIds", array());
$mediaItems = $request->getParam('mediaIds', []);
$scheduledItems = $request->getParam('schedIds', []);
$log_vars = array();
$log_vars["url"] = $_SERVER['HTTP_HOST'];
$log_vars["action"] = "showbuilder/schedule-add";
$log_vars["params"] = array();
$log_vars["params"]["media_items"] = $mediaItems;
$log_vars["params"]["scheduled_items"] = $scheduledItems;
$log_vars = [];
$log_vars['url'] = $_SERVER['HTTP_HOST'];
$log_vars['action'] = 'showbuilder/schedule-add';
$log_vars['params'] = [];
$log_vars['params']['media_items'] = $mediaItems;
$log_vars['params']['scheduled_items'] = $scheduledItems;
Logging::info($log_vars);
try {
@ -259,13 +260,13 @@ class ShowbuilderController extends Zend_Controller_Action
public function scheduleRemoveAction()
{
$request = $this->getRequest();
$items = $request->getParam("items", array());
$items = $request->getParam('items', []);
$log_vars = array();
$log_vars["url"] = $_SERVER['HTTP_HOST'];
$log_vars["action"] = "showbuilder/schedule-remove";
$log_vars["params"] = array();
$log_vars["params"]["removed_items"] = $items;
$log_vars = [];
$log_vars['url'] = $_SERVER['HTTP_HOST'];
$log_vars['action'] = 'showbuilder/schedule-remove';
$log_vars['params'] = [];
$log_vars['params']['removed_items'] = $items;
Logging::info($log_vars);
try {
@ -283,8 +284,8 @@ class ShowbuilderController extends Zend_Controller_Action
public function scheduleMoveAction()
{
$request = $this->getRequest();
$selectedItems = $request->getParam("selectedItem");
$afterItem = $request->getParam("afterItem");
$selectedItems = $request->getParam('selectedItem');
$afterItem = $request->getParam('afterItem');
/*
$log_vars = array();
@ -310,7 +311,6 @@ class ShowbuilderController extends Zend_Controller_Action
public function scheduleReorderAction()
{
throw new Exception("this controller is/was a no-op please fix your code");
throw new Exception('this controller is/was a no-op please fix your code');
}
}