From 69d8eae845b8c62864f986fb422ef823a0880c93 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Mon, 14 Mar 2022 11:15:04 +0100 Subject: [PATCH] style(legacy): fix code format with php-cs-fixer (#1674) --- legacy/application/airtime-boot.php | 18 +- .../cloud_storage/FileStorageBackend.php | 4 +- .../common/AutoPlaylistManager.php | 6 +- legacy/application/common/CORSHelper.php | 6 +- legacy/application/common/DateHelper.php | 2 +- legacy/application/common/FileDataHelper.php | 10 +- legacy/application/common/FileIO.php | 24 +-- legacy/application/common/SessionHelper.php | 6 +- legacy/application/common/WidgetHelper.php | 10 +- legacy/application/configs/conf.php | 14 +- legacy/application/configs/constants.php | 10 +- legacy/application/configs/navigation.php | 2 +- .../application/controllers/ApiController.php | 96 ++++----- .../controllers/DashboardController.php | 4 +- .../controllers/EmbedController.php | 2 +- .../EmbeddablewidgetsController.php | 8 +- .../controllers/ErrorController.php | 10 +- .../controllers/FeedsController.php | 2 +- .../controllers/IndexController.php | 6 +- .../controllers/LibraryController.php | 24 +-- .../controllers/LocaleController.php | 122 ++++++------ .../controllers/LoginController.php | 36 ++-- .../controllers/PlaylistController.php | 18 +- .../controllers/PlayouthistoryController.php | 2 +- .../controllers/PluploadController.php | 16 +- .../controllers/PreferenceController.php | 10 +- .../controllers/ScheduleController.php | 38 ++-- .../controllers/ShowbuilderController.php | 10 +- .../controllers/UserController.php | 16 +- .../controllers/UsersettingsController.php | 2 +- .../controllers/WebstreamController.php | 6 +- .../controllers/plugins/Acl_plugin.php | 16 +- .../plugins/PageLayoutInitPlugin.php | 26 +-- .../forms/AddShowAbsoluteRebroadcastDates.php | 2 +- .../application/forms/AddShowLiveStream.php | 4 +- .../forms/AddShowRebroadcastDates.php | 2 +- legacy/application/forms/AddShowRepeats.php | 4 +- legacy/application/forms/AddShowWhen.php | 16 +- legacy/application/forms/AddShowWho.php | 2 +- legacy/application/forms/AddTracktype.php | 2 +- legacy/application/forms/AddUser.php | 2 +- .../forms/DangerousPreferences.php | 2 +- legacy/application/forms/EditHistory.php | 8 +- legacy/application/forms/EditHistoryItem.php | 4 +- .../application/forms/GeneralPreferences.php | 20 +- .../forms/LiveStreamingPreferences.php | 8 +- legacy/application/forms/Login.php | 4 +- legacy/application/forms/Preferences.php | 4 +- .../application/forms/SmartBlockCriteria.php | 22 +-- legacy/application/logging/Logging.php | 18 +- legacy/application/models/Block.php | 50 ++--- legacy/application/models/Dashboard.php | 34 ++-- legacy/application/models/Datatables.php | 14 +- legacy/application/models/Library.php | 2 +- legacy/application/models/ListenerStat.php | 10 +- legacy/application/models/LiveLog.php | 12 +- legacy/application/models/Locale.php | 8 +- legacy/application/models/MusicDir.php | 16 +- legacy/application/models/Playlist.php | 54 ++--- legacy/application/models/Preference.php | 42 ++-- legacy/application/models/RabbitMq.php | 14 +- legacy/application/models/Schedule.php | 60 +++--- legacy/application/models/Scheduler.php | 186 +++++++++--------- legacy/application/models/ServiceRegister.php | 4 +- legacy/application/models/Show.php | 102 +++++----- legacy/application/models/ShowBuilder.php | 48 ++--- legacy/application/models/ShowInstance.php | 22 +-- legacy/application/models/StoredFile.php | 78 ++++---- legacy/application/models/StreamSetting.php | 28 +-- legacy/application/models/Systemstatus.php | 6 +- legacy/application/models/User.php | 8 +- legacy/application/models/Webstream.php | 38 ++-- legacy/application/models/airtime/CcFiles.php | 38 ++-- .../models/airtime/CcPlaylistcontents.php | 4 +- .../airtime/CcPlayoutHistoryMetaData.php | 2 +- legacy/application/models/airtime/CcShow.php | 8 +- .../application/models/airtime/CcShowDays.php | 4 +- .../models/airtime/CcShowInstances.php | 8 +- .../application/models/airtime/CloudFile.php | 2 +- legacy/application/models/airtime/Podcast.php | 6 +- .../models/formatters/LengthFormatter.php | 4 +- .../models/formatters/TimeFilledFormatter.php | 2 +- legacy/application/models/tests/AllTests.php | 6 +- .../models/tests/SchedulerTests.php | 4 +- .../models/tests/StoredFileTests.php | 8 +- legacy/application/models/tests/populator.php | 8 +- .../rest/controllers/MediaController.php | 8 +- .../rest/controllers/PodcastController.php | 6 +- .../controllers/PodcastEpisodesController.php | 6 +- .../rest/controllers/RouteController.php | 2 +- .../rest/controllers/ShowImageController.php | 12 +- .../modules/rest/helpers/RestAuth.php | 6 +- .../application/services/CalendarService.php | 54 ++--- .../application/services/HistoryService.php | 104 +++++----- legacy/application/services/MediaService.php | 24 +-- .../services/PodcastEpisodeService.php | 2 +- .../application/services/PodcastService.php | 32 +-- .../application/services/SchedulerService.php | 60 +++--- .../application/services/ShowFormService.php | 38 ++-- legacy/application/services/ShowService.php | 168 ++++++++-------- legacy/application/upgrade/Upgrades.php | 24 +-- legacy/public/index.php | 2 +- legacy/public/setup/setup-functions.php | 2 +- legacy/tests/application/bootstrap.php | 16 +- .../application/helpers/AirtimeInstall.php | 12 +- .../tests/application/helpers/TestHelper.php | 34 ++-- .../models/database/BlockDbTest.php | 6 +- .../models/unit/ScheduleUnitTest.php | 26 +-- .../services/database/ShowServiceDbTest.php | 26 +-- .../services/unit/ShowServiceUnitTest.php | 8 +- .../application/testdata/ShowServiceData.php | 2 +- 111 files changed, 1163 insertions(+), 1163 deletions(-) diff --git a/legacy/application/airtime-boot.php b/legacy/application/airtime-boot.php index 76a181af3..6e1b8abc8 100644 --- a/legacy/application/airtime-boot.php +++ b/legacy/application/airtime-boot.php @@ -14,8 +14,8 @@ error_reporting(E_ALL | E_STRICT); function exception_error_handler($errno, $errstr, $errfile, $errline) { - //Check if the statement that threw this error wanted its errors to be - //suppressed. If so then return without with throwing exception. + // Check if the statement that threw this error wanted its errors to be + // suppressed. If so then return without with throwing exception. if (0 === error_reporting()) { return; } @@ -37,25 +37,25 @@ set_include_path(APPLICATION_PATH . '/common' . PATH_SEPARATOR . get_include_pat set_include_path(APPLICATION_PATH . '/common/enum' . PATH_SEPARATOR . get_include_path()); set_include_path(APPLICATION_PATH . '/common/interface' . PATH_SEPARATOR . get_include_path()); -//Propel classes. +// Propel classes. set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path()); -//Controller plugins. +// Controller plugins. set_include_path(APPLICATION_PATH . '/controllers' . PATH_SEPARATOR . get_include_path()); -//Controller plugins. +// Controller plugins. set_include_path(APPLICATION_PATH . '/controllers/plugins' . PATH_SEPARATOR . get_include_path()); -//Services. +// Services. set_include_path(APPLICATION_PATH . '/services' . PATH_SEPARATOR . get_include_path()); -//cloud storage directory +// cloud storage directory set_include_path(APPLICATION_PATH . '/cloud_storage' . PATH_SEPARATOR . get_include_path()); -//Upgrade directory +// Upgrade directory set_include_path(APPLICATION_PATH . '/upgrade' . PATH_SEPARATOR . get_include_path()); -//Common directory +// Common directory set_include_path(APPLICATION_PATH . '/common' . PATH_SEPARATOR . get_include_path()); /** Zend_Application */ diff --git a/legacy/application/cloud_storage/FileStorageBackend.php b/legacy/application/cloud_storage/FileStorageBackend.php index 2fc6b4a4a..a70838a27 100644 --- a/legacy/application/cloud_storage/FileStorageBackend.php +++ b/legacy/application/cloud_storage/FileStorageBackend.php @@ -4,7 +4,7 @@ class FileStorageBackend extends StorageBackend { public function getAbsoluteFilePath($resourceId) { - //TODO + // TODO return $resourceId; } @@ -15,7 +15,7 @@ class FileStorageBackend extends StorageBackend public function deletePhysicalFile($resourceId) { - //TODO + // TODO } public function deleteAllCloudFileObjects() diff --git a/legacy/application/common/AutoPlaylistManager.php b/legacy/application/common/AutoPlaylistManager.php index 59a2dcbbc..54f62170d 100644 --- a/legacy/application/common/AutoPlaylistManager.php +++ b/legacy/application/common/AutoPlaylistManager.php @@ -45,7 +45,7 @@ class AutoPlaylistManager $si = new Application_Model_ShowInstance($autoplaylist->getDbId()); // the intro playlist should be added exactly once if ($introplaylistid != null) { - //Logging::info('adding intro'); + // Logging::info('adding intro'); $si->addPlaylistToShowStart($introplaylistid, false); } while (!$full) { @@ -68,7 +68,7 @@ class AutoPlaylistManager if ($tempPercentScheduled == $ps) { break; } - //now reset it to the current percent scheduled + // now reset it to the current percent scheduled $tempPercentScheduled = $ps; } // the outroplaylist is added at the end, it will always overbook @@ -93,7 +93,7 @@ class AutoPlaylistManager */ protected static function _upcomingAutoPlaylistShows() { - //setting now so that past shows aren't referenced + // setting now so that past shows aren't referenced $now = new DateTime('now', new DateTimeZone('UTC')); // only build playlists for shows that start up to an hour from now $future = clone $now; diff --git a/legacy/application/common/CORSHelper.php b/legacy/application/common/CORSHelper.php index 56ca627ba..bd8f0d1c8 100644 --- a/legacy/application/common/CORSHelper.php +++ b/legacy/application/common/CORSHelper.php @@ -4,19 +4,19 @@ class CORSHelper { public static function enableCrossOriginRequests(&$request, &$response) { - //Chrome sends the Origin header for all requests, so we whitelist the webserver's hostname as well. + // Chrome sends the Origin header for all requests, so we whitelist the webserver's hostname as well. $origin = $request->getHeader('Origin'); $allowedOrigins = self::getAllowedOrigins($request); if ((!(preg_match('/https?:\/\/localhost/', $origin) === 1)) && ($origin != '') && (!in_array($origin, $allowedOrigins)) ) { - //Don't allow CORS from other domains to prevent XSS. + // Don't allow CORS from other domains to prevent XSS. Logging::error("request origin '{$origin}' is not in allowed '" . implode(', ', $allowedOrigins) . "'!"); throw new Zend_Controller_Action_Exception('Forbidden', 403); } - //Allow AJAX requests from configured websites. We use this to allow other pages to use LibreTimes API. + // Allow AJAX requests from configured websites. We use this to allow other pages to use LibreTimes API. if ($origin) { $response = $response->setHeader('Access-Control-Allow-Origin', $origin); } diff --git a/legacy/application/common/DateHelper.php b/legacy/application/common/DateHelper.php index 183aa7294..daba57731 100644 --- a/legacy/application/common/DateHelper.php +++ b/legacy/application/common/DateHelper.php @@ -150,7 +150,7 @@ class Application_Common_DateHelper */ public static function removeSecondsFromTime($p_dateTime) { - //Format is in hh:mm:ss. We want hh:mm + // Format is in hh:mm:ss. We want hh:mm $timeExplode = explode(':', $p_dateTime); if (count($timeExplode) == 3) { diff --git a/legacy/application/common/FileDataHelper.php b/legacy/application/common/FileDataHelper.php index 20e204a01..cc4b65a4d 100644 --- a/legacy/application/common/FileDataHelper.php +++ b/legacy/application/common/FileDataHelper.php @@ -44,7 +44,7 @@ class FileDataHelper $data['year'] = intval($data['year']); } if (array_key_exists('bpm', $data)) { - //Some BPM tags are silly and include the word "BPM". Let's strip that... + // Some BPM tags are silly and include the word "BPM". Let's strip that... $data['bpm'] = str_ireplace('BPM', '', $data['bpm']); // This will convert floats to ints too. $data['bpm'] = intval($data['bpm']); @@ -143,7 +143,7 @@ class FileDataHelper $path_parts = pathinfo($filename); $file = $importDir . 'artwork/' . $path_parts['filename']; - //Save Data URI + // Save Data URI if (file_put_contents($file, $base64)) { $get_img = $DbPath . 'artwork/' . $path_parts['filename']; } else { @@ -204,7 +204,7 @@ class FileDataHelper $path_parts = pathinfo($fullpath); $file = $path_parts['filename']; - //Save Data URI + // Save Data URI if (file_put_contents($audioPath . '/' . $file, $base64)) { $get_img = $dbPath . '/' . $file; } else { @@ -261,7 +261,7 @@ class FileDataHelper $path_parts = pathinfo($fullpath); $file = $path_parts['filename']; - //Save Data URI + // Save Data URI if (file_put_contents($audioPath . '/' . $file, $base64)) { $get_img = $dbPath . '/' . $file; } else { @@ -429,7 +429,7 @@ class FileDataHelper $Image = 'data:image/jpeg;charset=utf-8;base64,' . base64_encode($file); $base64 = @$Image; - //Save Data URI + // Save Data URI if (file_put_contents($conv_filename, $base64)) { } else { Logging::error('Could not save Data URI'); diff --git a/legacy/application/common/FileIO.php b/legacy/application/common/FileIO.php index 6b13cba26..95daa46fa 100644 --- a/legacy/application/common/FileIO.php +++ b/legacy/application/common/FileIO.php @@ -24,11 +24,11 @@ class Application_Common_FileIO throw new LibreTimeFileNotFoundException($filePath); } - //Note that $size is allowed to be zero. If that's the case, it means we don't - //know the filesize, and we need to figure one out so modern browsers don't get - //confused. This should only affect files imported by legacy upstream since - //media monitor did not always set the proper size in the database but analyzer - //seems to always have a value for this. + // Note that $size is allowed to be zero. If that's the case, it means we don't + // know the filesize, and we need to figure one out so modern browsers don't get + // confused. This should only affect files imported by legacy upstream since + // media monitor did not always set the proper size in the database but analyzer + // seems to always have a value for this. if ($size === 0) { $fstats = fstat($fm); $size = $fstats['size']; @@ -41,7 +41,7 @@ class Application_Common_FileIO $begin = 0; $end = $size - 1; - ob_start(); //Must start a buffer here for these header() functions + ob_start(); // Must start a buffer here for these header() functions if (isset($_SERVER['HTTP_RANGE'])) { if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) { @@ -67,16 +67,16 @@ class Application_Common_FileIO header("Content-Range: bytes {$begin}-{$end}/{$size}"); } - //We can have multiple levels of output buffering. Need to - //keep looping until all have been disabled!!! - //http://www.php.net/manual/en/function.ob-end-flush.php + // We can have multiple levels of output buffering. Need to + // keep looping until all have been disabled!!! + // http://www.php.net/manual/en/function.ob-end-flush.php while (ob_get_level() > 0) { ob_end_flush(); } - //These two lines were removed from Airtime 2.5.x at some point after Libretime forked from Airtime. - //These lines allow seek to work for files. - //Issue #349 + // These two lines were removed from Airtime 2.5.x at some point after Libretime forked from Airtime. + // These lines allow seek to work for files. + // Issue #349 $cur = $begin; fseek($fm, $begin, 0); diff --git a/legacy/application/common/SessionHelper.php b/legacy/application/common/SessionHelper.php index 72d8ac400..bc79f2902 100644 --- a/legacy/application/common/SessionHelper.php +++ b/legacy/application/common/SessionHelper.php @@ -4,9 +4,9 @@ class SessionHelper { public static function reopenSessionForWriting() { - //PHP will send double Set-Cookie headers if we reopen the - //session for writing, and this breaks IE8 and some other browsers. - //This hacky workaround prevents double headers. Background here: + // PHP will send double Set-Cookie headers if we reopen the + // session for writing, and this breaks IE8 and some other browsers. + // This hacky workaround prevents double headers. Background here: // https://bugs.php.net/bug.php?id=38104 ini_set('session.cache_limiter', null); session_start(); // Reopen the session for writing (without resending the Set-Cookie header) diff --git a/legacy/application/common/WidgetHelper.php b/legacy/application/common/WidgetHelper.php index c3240d6d1..03841b7bb 100644 --- a/legacy/application/common/WidgetHelper.php +++ b/legacy/application/common/WidgetHelper.php @@ -6,7 +6,7 @@ class WidgetHelper { public static function getWeekInfo($userDefinedTimezone) { - //weekStart is in station time. + // weekStart is in station time. $weekStartDateTime = Application_Common_DateHelper::getWeekStartDateTime(); $dow = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', @@ -29,11 +29,11 @@ class WidgetHelper $weekStartDateTime->setTimezone($utcTimezone); $utcDayStart = $weekStartDateTime->format(DEFAULT_TIMESTAMP_FORMAT); for ($i = 0; $i < 14; ++$i) { - //have to be in station timezone when adding 1 day for daylight savings. + // have to be in station timezone when adding 1 day for daylight savings. $weekStartDateTime->setTimezone(new DateTimeZone($timezone)); $weekStartDateTime->add(new DateInterval('P1D')); - //convert back to UTC to get the actual timestamp used for search. + // convert back to UTC to get the actual timestamp used for search. $weekStartDateTime->setTimezone($utcTimezone); $utcDayEnd = $weekStartDateTime->format(DEFAULT_TIMESTAMP_FORMAT); @@ -115,7 +115,7 @@ class WidgetHelper $weekStartDateTime->add(new DateInterval('P1D')); - //convert back to UTC to get the actual timestamp used for search. + // convert back to UTC to get the actual timestamp used for search. $weekStartDateTime->setTimezone($utcTimezone); } @@ -145,7 +145,7 @@ class WidgetHelper $result['shows'] = $shows; // convert image paths to point to api endpoints - //TODO: do we need this here? + // TODO: do we need this here? self::findAndConvertPaths($result); return $result; diff --git a/legacy/application/configs/conf.php b/legacy/application/configs/conf.php index 033d01a17..0eb776a7e 100644 --- a/legacy/application/configs/conf.php +++ b/legacy/application/configs/conf.php @@ -14,7 +14,7 @@ class Config $CC_CONFIG = []; // General - //////////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////////// $CC_CONFIG['apiKey'] = [$values['general']['api_key']]; // Base URL @@ -34,7 +34,7 @@ class Config $CC_CONFIG['staticBaseDir'] = $values['general']['static_base_dir'] ?? '/'; // Database - //////////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////////// $CC_CONFIG['dsn']['phptype'] = 'pgsql'; $CC_CONFIG['dsn']['host'] = $values['database']['host'] ?? 'localhost'; $CC_CONFIG['dsn']['port'] = $values['database']['port'] ?? 5432; @@ -43,7 +43,7 @@ class Config $CC_CONFIG['dsn']['password'] = $values['database']['password'] ?? 'libretime'; // RabbitMQ - //////////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////////// $CC_CONFIG['rabbitmq']['host'] = $values['rabbitmq']['host'] ?? 'localhost'; $CC_CONFIG['rabbitmq']['port'] = $values['rabbitmq']['port'] ?? 5672; $CC_CONFIG['rabbitmq']['vhost'] = $values['rabbitmq']['vhost'] ?? '/libretime'; @@ -51,11 +51,11 @@ class Config $CC_CONFIG['rabbitmq']['password'] = $values['rabbitmq']['password'] ?? 'libretime'; // Storage - //////////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////////// $CC_CONFIG['current_backend'] = $values['current_backend']['storage_backend'] ?? 'file'; // Facebook (DEPRECATED) - //////////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////////// if (isset($values['facebook']['facebook_app_id'])) { $CC_CONFIG['facebook-app-id'] = $values['facebook']['facebook_app_id']; $CC_CONFIG['facebook-app-url'] = $values['facebook']['facebook_app_url']; @@ -63,7 +63,7 @@ class Config } // LDAP - //////////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////////// if (array_key_exists('ldap', $values)) { $CC_CONFIG['ldap_hostname'] = $values['ldap']['hostname']; $CC_CONFIG['ldap_binddn'] = $values['ldap']['binddn']; @@ -79,7 +79,7 @@ class Config } // Demo - //////////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////////// if (isset($values['demo']['demo'])) { $CC_CONFIG['demo'] = $values['demo']['demo']; } diff --git a/legacy/application/configs/constants.php b/legacy/application/configs/constants.php index 8477a7781..46cc4bb63 100644 --- a/legacy/application/configs/constants.php +++ b/legacy/application/configs/constants.php @@ -110,14 +110,14 @@ define('MDATA_KEY_TRACK_TYPE', 'track_type'); define('UI_MDATA_VALUE_FORMAT_FILE', 'File'); define('UI_MDATA_VALUE_FORMAT_STREAM', 'live stream'); -//User types +// User types define('UTYPE_HOST', 'H'); define('UTYPE_ADMIN', 'A'); define('UTYPE_SUPERADMIN', 'S'); define('UTYPE_GUEST', 'G'); define('UTYPE_PROGRAM_MANAGER', 'P'); -//Constants for playout history template fields +// Constants for playout history template fields define('TEMPLATE_DATE', 'date'); define('TEMPLATE_TIME', 'time'); define('TEMPLATE_DATETIME', 'datetime'); @@ -131,7 +131,7 @@ define('UI_PLAYLISTCONTROLLER_OBJ_SESSNAME', 'PLAYLISTCONTROLLER_OBJ'); /*define('UI_PLAYLIST_SESSNAME', 'PLAYLIST'); define('UI_BLOCK_SESSNAME', 'BLOCK');*/ -//TuneIn integration +// TuneIn integration define('TUNEIN_API_URL', 'http://air.radiotime.com/Playing.ashx'); // Celery @@ -146,7 +146,7 @@ define('PODCAST_SERVICE_NAME', 'podcast'); define('STATION_PODCAST_SERVICE_NAME', 'station_podcast'); // Podcast Types -//define('STATION_PODCAST', 0); -//define('IMPORTED_PODCAST', 1); +// define('STATION_PODCAST', 0); +// define('IMPORTED_PODCAST', 1); define('ITUNES_XML_NAMESPACE_URL', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); diff --git a/legacy/application/configs/navigation.php b/legacy/application/configs/navigation.php index d651a1901..34854f26a 100644 --- a/legacy/application/configs/navigation.php +++ b/legacy/application/configs/navigation.php @@ -191,5 +191,5 @@ $pages[] = [ $container = new Zend_Navigation($pages); $container->id = 'nav'; -//store it in the registry: +// store it in the registry: Zend_Registry::set('Zend_Navigation', $container); diff --git a/legacy/application/controllers/ApiController.php b/legacy/application/controllers/ApiController.php index 27744ae34..998654974 100644 --- a/legacy/application/controllers/ApiController.php +++ b/legacy/application/controllers/ApiController.php @@ -13,7 +13,7 @@ class ApiController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(true); } - //Ignore API key and session authentication for these APIs: + // Ignore API key and session authentication for these APIs: $ignoreAuth = ['live-info', 'live-info-v2', 'week-info', @@ -75,7 +75,7 @@ class ApiController extends Zend_Controller_Action ->addActionContext('update-cue-values-by-silan', 'json') ->addActionContext('get-usability-hint', 'json') ->addActionContext('poll-celery', 'json') - ->addActionContext('recalculate-schedule', 'json') //RKTN-260 + ->addActionContext('recalculate-schedule', 'json') // RKTN-260 ->initContext(); } @@ -98,8 +98,8 @@ class ApiController extends Zend_Controller_Action return true; } - //Start the session so the authentication is - //enforced by the ACL plugin. + // Start the session so the authentication is + // enforced by the ACL plugin. Zend_Session::start(); $authAdapter = Zend_Auth::getInstance(); Application_Model_Auth::pinSessionToClient($authAdapter); @@ -186,7 +186,7 @@ class ApiController extends Zend_Controller_Action } } - //Used by the SaaS monitoring + // Used by the SaaS monitoring public function onAirLightAction() { $request = $this->getRequest(); @@ -354,7 +354,7 @@ class ApiController extends Zend_Controller_Action $timezone ); - //Convert the UTC scheduler time ("now") to the user-defined timezone. + // Convert the UTC scheduler time ("now") to the user-defined timezone. $result['schedulerTime'] = Application_Common_DateHelper::UTCStringToTimezoneString($result['schedulerTime'], $timezone); $result['timezone'] = $upcase ? strtoupper($timezone) : $timezone; $result['timezoneOffset'] = Application_Common_DateHelper::getTimezoneOffset($timezone); @@ -495,7 +495,7 @@ class ApiController extends Zend_Controller_Action $timezone ); - //Convert the UTC scheduler time ("now") to the user-defined timezone. + // Convert the UTC scheduler time ("now") to the user-defined timezone. $result['station']['schedulerTime'] = Application_Common_DateHelper::UTCStringToTimezoneString($result['station']['schedulerTime'], $timezone); $result['station']['timezone'] = $upcase ? strtoupper($timezone) : $timezone; } @@ -510,7 +510,7 @@ class ApiController extends Zend_Controller_Action $request = $this->getRequest(); $result = WidgetHelper::getWeekInfo($this->getRequest()->getParam('timezone')); - //used by caller to determine if the airtime they are running or widgets in use is out of date. + // used by caller to determine if the airtime they are running or widgets in use is out of date. $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; $this->returnJsonOrJsonp($request, $result); @@ -551,7 +551,7 @@ class ApiController extends Zend_Controller_Action throw new ZendActionHttpException($this, 400, 'ERROR: Show does not have an associated image.'); } } catch (Exception $e) { - //To avoid broken images on your site, we return the station logo if we can't find the show logo. + // To avoid broken images on your site, we return the station logo if we can't find the show logo. $this->_redirect('api/station-logo'); return; @@ -562,7 +562,7 @@ class ApiController extends Zend_Controller_Action // but has been cached in a client's browser this will throw an exception Application_Common_FileIO::smartReadFile($path, filesize($path), $mime_type); } catch (LibreTimeFileNotFoundException $e) { - //throw new ZendActionHttpException($this, 404, "ERROR: No image found at $path"); + // throw new ZendActionHttpException($this, 404, "ERROR: No image found at $path"); $this->_redirect('api/station-logo'); return; @@ -607,7 +607,7 @@ class ApiController extends Zend_Controller_Action $storDir = Application_Model_MusicDir::getStorDir(); $fp = $storDir->getDirectory(); - //$this->view->type = $type; + // $this->view->type = $type; $file = Application_Model_StoredFile::RecallById($trackid); $md = $file->getMetadata(); @@ -624,7 +624,7 @@ class ApiController extends Zend_Controller_Action } } } elseif ($return === 'artwork') { - //default + // default foreach ($md as $key => $value) { if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) { FileDataHelper::renderImage($fp . $md['MDATA_KEY_ARTWORK'] . '-512.jpg'); @@ -779,13 +779,13 @@ class ApiController extends Zend_Controller_Action $historyService = new Application_Service_HistoryService(); $historyService->insertPlayedItem($media_id); - //set a 'last played' timestamp for media item - //needed for smart blocks + // set a 'last played' timestamp for media item + // needed for smart blocks $mediaType = Application_Model_Schedule::GetType($media_id); if ($mediaType == 'file') { $file_id = Application_Model_Schedule::GetFileId($media_id); if (!is_null($file_id)) { - //we are dealing with a file not a stream + // we are dealing with a file not a stream $file = Application_Model_StoredFile::RecallById($file_id); $now = new DateTime('now', new DateTimeZone('UTC')); $file->setLastPlayedTime($now); @@ -854,17 +854,17 @@ class ApiController extends Zend_Controller_Action { $showCanceled = false; $file = Application_Model_StoredFile::RecallById($file_id); - //$show_instance = $this->_getParam('show_instance'); + // $show_instance = $this->_getParam('show_instance'); try { $show_inst = new Application_Model_ShowInstance($show_instance_id); $show_inst->setRecordedFile($file_id); } catch (Exception $e) { - //we've reached here probably because the show was - //cancelled, and therefore the show instance does not exist - //anymore (ShowInstance constructor threw this error). We've - //done all we can do (upload the file and put it in the - //library), now lets just return. + // we've reached here probably because the show was + // cancelled, and therefore the show instance does not exist + // anymore (ShowInstance constructor threw this error). We've + // done all we can do (upload the file and put it in the + // library), now lets just return. $showCanceled = true; } @@ -916,18 +916,18 @@ class ApiController extends Zend_Controller_Action $filepath = $md['MDATA_KEY_FILEPATH']; $file = Application_Model_StoredFile::RecallByFilepath($filepath, $con); - //File is not in database anymore. + // File is not in database anymore. if (is_null($file)) { $return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME); } - //Updating a metadata change. + // Updating a metadata change. else { - //CC-5207 - restart media-monitor causes it to reevaluate all - //files in watched directories, and reset their cue-in/cue-out - //values. Since media-monitor has nothing to do with cue points - //let's unset it here. Note that on mode == "create", we still - //want media-monitor sending info about cue_out which by default - //will be equal to length of track until silan can take over. + // CC-5207 - restart media-monitor causes it to reevaluate all + // files in watched directories, and reset their cue-in/cue-out + // values. Since media-monitor has nothing to do with cue points + // let's unset it here. Note that on mode == "create", we still + // want media-monitor sending info about cue_out which by default + // will be equal to length of track until silan can take over. unset($md['MDATA_KEY_CUE_IN'], $md['MDATA_KEY_CUE_OUT']); $file->setMetadata($md); @@ -942,7 +942,7 @@ class ApiController extends Zend_Controller_Action $return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME); } else { $filepath = $md['MDATA_KEY_FILEPATH']; - //$filepath = str_replace("\\", "", $filepath); + // $filepath = str_replace("\\", "", $filepath); $file->setFilePath($filepath); } } elseif ($mode == 'delete') { @@ -959,7 +959,7 @@ class ApiController extends Zend_Controller_Action } } elseif ($mode == 'delete_dir') { $filepath = $md['MDATA_KEY_FILEPATH']; - //$filepath = str_replace("\\", "", $filepath); + // $filepath = str_replace("\\", "", $filepath); $files = Application_Model_StoredFile::RecallByPartialFilepath($filepath, $con); foreach ($files as $file) { @@ -1283,7 +1283,7 @@ class ApiController extends Zend_Controller_Action $djtype = $request->getParam('djtype'); if ($djtype == 'master') { - //check against master + // check against master if ($username == Application_Model_Preference::GetLiveStreamMasterUsername() && $password == Application_Model_Preference::GetLiveStreamMasterPassword()) { $this->view->msg = true; @@ -1291,7 +1291,7 @@ class ApiController extends Zend_Controller_Action $this->view->msg = false; } } elseif ($djtype == 'dj') { - //check against show dj auth + // check against show dj auth $showInfo = Application_Model_Show::getCurrentShow(); // there is current playing show @@ -1342,7 +1342,7 @@ class ApiController extends Zend_Controller_Action { $dir_id = $this->_getParam('dir_id'); - //connect to db and get get sql + // connect to db and get get sql $rows = Application_Model_StoredFile::listAllFiles2($dir_id, 100); $this->_helper->json->sendJson($rows); @@ -1350,7 +1350,7 @@ class ApiController extends Zend_Controller_Action public function getFilesWithoutSilanValueAction() { - //connect to db and get get sql + // connect to db and get get sql $rows = Application_Model_StoredFile::getAllFilesWithoutSilan(); $this->_helper->json->sendJson($rows); @@ -1382,16 +1382,16 @@ class ApiController extends Zend_Controller_Action // TODO : move this code into model -- RG $file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm(); - //What we are doing here is setting a more accurate length that was - //calculated with silan by actually scanning the entire file. This - //process takes a really long time, and so we only do it in the background - //after the file has already been imported -MK + // What we are doing here is setting a more accurate length that was + // calculated with silan by actually scanning the entire file. This + // process takes a really long time, and so we only do it in the background + // after the file has already been imported -MK try { $length = $file->getDbLength(); if (isset($info['length'])) { $length = $info['length']; - //length decimal number in seconds. Need to convert it to format - //HH:mm:ss to get around silly PHP limitations. + // length decimal number in seconds. Need to convert it to format + // HH:mm:ss to get around silly PHP limitations. $length = Application_Common_DateHelper::secondsToPlaylistTime($length); $file->setDbLength($length); } @@ -1406,7 +1406,7 @@ class ApiController extends Zend_Controller_Action } catch (Exception $e) { Logging::info('Failed to update silan values for ' . $file->getDbTrackTitle()); Logging::info('File length analyzed by Silan is: ' . $length); - //set silan_check to true so we don't attempt to re-anaylze again + // set silan_check to true so we don't attempt to re-anaylze again $file->setDbSilanCheck(true); $file->save(); } @@ -1422,7 +1422,7 @@ class ApiController extends Zend_Controller_Action $media_id = intval($request->getParam('media_id')); $data_arr = json_decode($data); - //$media_id is -1 sometimes when a stream has stopped playing + // $media_id is -1 sometimes when a stream has stopped playing if (!is_null($media_id) && $media_id > 0) { if (isset($data_arr->title)) { $data_title = substr($data_arr->title, 0, 1024); @@ -1602,7 +1602,7 @@ class ApiController extends Zend_Controller_Action [$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($request); if ((!isset($showId)) || (!is_numeric($showId))) { - //if (!isset($showId)) { + // if (!isset($showId)) { $this->_helper->json->sendJson( ['jsonrpc' => '2.0', 'error' => ['code' => 400, 'message' => 'missing invalid type for required show_id parameter. use type int.' . $showId]] ); @@ -1712,7 +1712,7 @@ class ApiController extends Zend_Controller_Action header('Content-Type: application/x-mpegurl'); header('Content-Disposition: attachment; filename=stream.m3u'); - $m3uFile = "#EXTM3U\r\n\r\n"; //Windows linebreaks eh + $m3uFile = "#EXTM3U\r\n\r\n"; // Windows linebreaks eh $stationName = Application_Model_Preference::GetStationName(); $streamData = Application_Model_StreamSetting::getEnabledStreamData(); @@ -1738,17 +1738,17 @@ class ApiController extends Zend_Controller_Action $showInstances = CcShowInstancesQuery::create() ->filterByDbStarts($now, Criteria::GREATER_THAN) - //->filterByDbModifiedInstance(false) + // ->filterByDbModifiedInstance(false) ->orderByDbStarts() ->find(); - //->find($this->con); + // ->find($this->con); $total = $showInstances->count(); $progress = 0; foreach ($showInstances as $instance) { echo round(floatval($progress / $total) * 100) . '% - ' . $instance->getDbId() . "\n
"; flush(); ob_flush(); - //while(@ob_end_clean()); + // while(@ob_end_clean()); $scheduler->removeGaps2($instance->getDbId()); ++$progress; } diff --git a/legacy/application/controllers/DashboardController.php b/legacy/application/controllers/DashboardController.php index eb80f6490..707b1ca51 100644 --- a/legacy/application/controllers/DashboardController.php +++ b/legacy/application/controllers/DashboardController.php @@ -63,7 +63,7 @@ class DashboardController extends Zend_Controller_Action Application_Model_Preference::SetSourceSwitchStatus($sourcename, 'off'); $this->view->status = 'OFF'; - //Log table updates + // Log table updates Application_Model_LiveLog::SetEndTime( $sourcename == 'scheduled_play' ? 'S' : 'L', new DateTime('now', new DateTimeZone('UTC')) @@ -72,7 +72,7 @@ class DashboardController extends Zend_Controller_Action Application_Model_Preference::SetSourceSwitchStatus($sourcename, 'on'); $this->view->status = 'ON'; - //Log table updates + // Log table updates Application_Model_LiveLog::SetNewLogTime( $sourcename == 'scheduled_play' ? 'S' : 'L', new DateTime('now', new DateTimeZone('UTC')) diff --git a/legacy/application/controllers/EmbedController.php b/legacy/application/controllers/EmbedController.php index 2f67b328b..0af4ef8d3 100644 --- a/legacy/application/controllers/EmbedController.php +++ b/legacy/application/controllers/EmbedController.php @@ -95,7 +95,7 @@ class EmbedController extends Zend_Controller_Action $this->view->schedule_data = json_encode($weeklyScheduleData); $currentDay = new DateTime('now', new DateTimeZone(Application_Model_Preference::GetTimezone())); - //day of the month without leading zeros (1 to 31) + // day of the month without leading zeros (1 to 31) $this->view->currentDayOfMonth = $currentDay->format('j'); } } diff --git a/legacy/application/controllers/EmbeddablewidgetsController.php b/legacy/application/controllers/EmbeddablewidgetsController.php index 5ab3cbbc1..80d725d0c 100644 --- a/legacy/application/controllers/EmbeddablewidgetsController.php +++ b/legacy/application/controllers/EmbeddablewidgetsController.php @@ -68,7 +68,7 @@ class EmbeddableWidgetsController extends Zend_Controller_Action $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - //TODO: Get list of page IDs (deserialize) + // TODO: Get list of page IDs (deserialize) $request = $this->getRequest(); if (!$request->isPost()) { @@ -82,8 +82,8 @@ class EmbeddableWidgetsController extends Zend_Controller_Action $facebookMicroserviceUrl = $CC_CONFIG['facebook-app-url']; $facebookMicroserviceApiKey = $CC_CONFIG['facebook-app-api-key']; - //Post the page tab ID and station subdomain to the social microservice so that mapping can be saved - //in a database. + // Post the page tab ID and station subdomain to the social microservice so that mapping can be saved + // in a database. foreach ($facebookPageIds as $facebookPageId) { $postfields = []; $postfields['facebookPageId'] = $facebookPageId; @@ -113,6 +113,6 @@ class EmbeddableWidgetsController extends Zend_Controller_Action curl_close($ch); } - //$arr = json_decode($jsondata, true); # Decode JSON String + // $arr = json_decode($jsondata, true); # Decode JSON String } } diff --git a/legacy/application/controllers/ErrorController.php b/legacy/application/controllers/ErrorController.php index 9ad9946c0..5c2a5e241 100644 --- a/legacy/application/controllers/ErrorController.php +++ b/legacy/application/controllers/ErrorController.php @@ -4,8 +4,8 @@ class ErrorController extends Zend_Controller_Action { public function init() { - //The default layout includes the Dashboard header, which may contain private information. - //We cannot show that. + // The default layout includes the Dashboard header, which may contain private information. + // We cannot show that. $this->view->layout()->disableLayout(); $this->setupCSS(); @@ -46,8 +46,8 @@ class ErrorController extends Zend_Controller_Action break; } } else { - //$exceptions = $this->_getAllParams(); - //Logging::error($exceptions); + // $exceptions = $this->_getAllParams(); + // Logging::error($exceptions); $this->error404Action(); return; @@ -58,7 +58,7 @@ class ErrorController extends Zend_Controller_Action if (($log = $this->getLog())) { $log->crit($this->view->message, $errors->exception); }*/ - //Logging that actually works: -- Albert + // Logging that actually works: -- Albert Logging::error($this->view->message . ': ' . $errors->exception); // conditionally display exceptions diff --git a/legacy/application/controllers/FeedsController.php b/legacy/application/controllers/FeedsController.php index c8c1cf406..817946b35 100644 --- a/legacy/application/controllers/FeedsController.php +++ b/legacy/application/controllers/FeedsController.php @@ -40,7 +40,7 @@ class FeedsController extends Zend_Controller_Action $begin = 0; $end = $size - 1; - //ob_start(); //Must start a buffer here for these header() functions + // ob_start(); //Must start a buffer here for these header() functions if (isset($_SERVER['HTTP_RANGE'])) { if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) { diff --git a/legacy/application/controllers/IndexController.php b/legacy/application/controllers/IndexController.php index 36fbb853a..ca2e15ea0 100644 --- a/legacy/application/controllers/IndexController.php +++ b/legacy/application/controllers/IndexController.php @@ -18,7 +18,7 @@ class IndexController extends Zend_Controller_Action $this->view->headScript()->appendScript('$.i18n.setDictionary(general_dict)'); $this->view->headScript()->appendScript("var baseUrl='{$baseUrl}'"); - //jplayer + // jplayer $this->view->headScript()->appendFile($baseUrl . 'js/jplayer/jquery.jplayer.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl . 'js/jplayer/jplayer.playlist.min.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); @@ -27,7 +27,7 @@ class IndexController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl . 'css/radio-page/station-podcast.css?' . $CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version']); - //jplayer control buttons + // jplayer control buttons $this->view->headLink()->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']); $this->_helper->layout->setLayout('radio-page'); @@ -54,7 +54,7 @@ class IndexController extends Zend_Controller_Action } $this->view->displayLoginButton = $displayRadioPageLoginButtonValue; - //station feed episodes + // station feed episodes $stationPodcastId = Application_Model_Preference::getStationPodcastId(); $podcastEpisodesService = new Application_Service_PodcastEpisodeService(); $episodes = $podcastEpisodesService->getPodcastEpisodes($stationPodcastId, 0, 0, PodcastEpisodesPeer::PUBLICATION_DATE, 'DESC'); diff --git a/legacy/application/controllers/LibraryController.php b/legacy/application/controllers/LibraryController.php index 8c14179d7..12dcf1c84 100644 --- a/legacy/application/controllers/LibraryController.php +++ b/legacy/application/controllers/LibraryController.php @@ -79,7 +79,7 @@ class LibraryController extends Zend_Controller_Action $baseUrl = Application_Common_OsPath::getBaseDir(); $id = $this->_getParam('id'); $type = $this->_getParam('type'); - //playlist||timeline + // playlist||timeline $screen = $this->_getParam('screen'); $menu = []; @@ -87,7 +87,7 @@ class LibraryController extends Zend_Controller_Action $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new Application_Model_User($userInfo->id); - //Open a jPlayer window and play the audio clip. + // Open a jPlayer window and play the audio clip. $menu['play'] = ['name' => _('Preview'), 'icon' => 'play', 'disabled' => false]; $isAdminOrPM = $user->isUserType([UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER]); @@ -184,11 +184,11 @@ class LibraryController extends Zend_Controller_Action public function deleteAction() { - //array containing id and type of media to delete. + // array containing id and type of media to delete. $mediaItems = $this->_getParam('media', null); $user = Application_Model_User::getCurrentUser(); - //$isAdminOrPM = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); + // $isAdminOrPM = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $files = []; $playlists = []; @@ -221,7 +221,7 @@ class LibraryController extends Zend_Controller_Action } catch (BlockNoPermissionException $e) { $message = $noPermissionMsg; } catch (Exception $e) { - //TODO: warn user that not all blocks could be deleted. + // TODO: warn user that not all blocks could be deleted. } try { @@ -229,7 +229,7 @@ class LibraryController extends Zend_Controller_Action } catch (WebstreamNoPermissionException $e) { $message = $noPermissionMsg; } catch (Exception $e) { - //TODO: warn user that not all streams could be deleted. + // TODO: warn user that not all streams could be deleted. Logging::info($e); } @@ -243,7 +243,7 @@ class LibraryController extends Zend_Controller_Action } catch (DeleteScheduledFileException $e) { $message = _('Could not delete file because it is scheduled in the future.'); } catch (Exception $e) { - //could throw a scheduled in future exception. + // could throw a scheduled in future exception. $message = _('Could not delete file(s).'); Logging::info($message . ': ' . $e->getMessage()); } @@ -309,8 +309,8 @@ class LibraryController extends Zend_Controller_Action // the issue here is that the format that getCriteria provides is different from the format the saveCriteria // expects due to the useage of startForm. So we either need to write new code that simply copies the database // or figure out a way to instantiate a form inside of here and save it without modifying it. - //$newBlForm = new Application_Form_SmartBlockCriteria; - //$newBlForm->startForm($id); + // $newBlForm = new Application_Form_SmartBlockCriteria; + // $newBlForm->startForm($id); $criteria = CcBlockcriteriaQuery::create()->orderByDbCriteria()->findByDbBlockId($id); foreach ($criteria as &$c) { $row = new CcBlockcriteria(); @@ -366,9 +366,9 @@ class LibraryController extends Zend_Controller_Action if ($request->isPost()) { $js = $this->_getParam('data'); $serialized = []; - //need to convert from serialized jQuery array. + // need to convert from serialized jQuery array. foreach ($js as $j) { - //on edit, if no artwork is set and audiofile has image, automatically add it + // on edit, if no artwork is set and audiofile has image, automatically add it if ($j['name'] == 'artwork') { if ($j['value'] == null || $j['value'] == '') { $serialized['artwork'] = FileDataHelper::resetArtwork($file_id); @@ -479,6 +479,6 @@ class LibraryController extends Zend_Controller_Action public function publishDialogAction() { $this->_helper->layout->disableLayout(); - //This just spits out publish-dialog.phtml! + // This just spits out publish-dialog.phtml! } } diff --git a/legacy/application/controllers/LocaleController.php b/legacy/application/controllers/LocaleController.php index fb8d6a46a..a5bf895f2 100644 --- a/legacy/application/controllers/LocaleController.php +++ b/legacy/application/controllers/LocaleController.php @@ -12,7 +12,7 @@ final class LocaleController extends Zend_Controller_Action echo 'var datatables_dict =' . file_get_contents( Application_Common_OsPath::join( - //$_SERVER["DOCUMENT_ROOT"], + // $_SERVER["DOCUMENT_ROOT"], dirname(__FILE__) . '/../../public/', // Fixing this... -- Albert 'js/datatables/i18n/', $locale . '.txt' @@ -23,17 +23,17 @@ final class LocaleController extends Zend_Controller_Action public function generalTranslationTableAction() { $translations = [ - //common/common.js + // common/common.js 'Audio Player' => _('Audio Player'), 'Something went wrong!' => _('Something went wrong!'), - //dashboard/dashboard.js + // dashboard/dashboard.js 'Recording:' => _('Recording:'), 'Master Stream' => _('Master Stream'), 'Live Stream' => _('Live Stream'), 'Nothing Scheduled' => _('Nothing Scheduled'), 'Current Show:' => _('Current Show:'), 'Current' => _('Current'), - //dashboard/versiontooltip.js + // dashboard/versiontooltip.js 'You are running the latest version' => _('You are running the latest version'), 'New version available: ' => _('New version available: '), 'You have a pre-release version of LibreTime intalled.' => _('You have a pre-release version of LibreTime intalled.'), @@ -41,15 +41,15 @@ final class LocaleController extends Zend_Controller_Action 'A feature update for your LibreTime installation is available.' => _('A feature update for your LibreTime installation is available.'), 'A major update for your LibreTime installation is available.' => _('A major update for your LibreTime installation is available.'), 'Multiple major updates for LibreTime installation are available. Please upgrade as soon as possible.' => _('Multiple major updates for LibreTime installation are available. Please upgrade as soon as possible.'), - //library/events/library_playlistbuilder.js + // library/events/library_playlistbuilder.js 'Add to current playlist' => _('Add to current playlist'), 'Add to current smart block' => _('Add to current smart block'), 'Adding 1 Item' => _('Adding 1 Item'), 'Adding %s Items' => _('Adding %s Items'), 'You can only add tracks to smart blocks.' => _('You can only add tracks to smart blocks.'), 'You can only add tracks, smart blocks, and webstreams to playlists.' => _('You can only add tracks, smart blocks, and webstreams to playlists.'), - //library/events/library_showbuilder.js - //already in library/events/library_playlistbuilder.js + // library/events/library_showbuilder.js + // already in library/events/library_playlistbuilder.js 'Please select a cursor position on timeline.' => _('Please select a cursor position on timeline.'), "You haven't added any tracks" => _("You haven't added any tracks"), "You haven't added any playlists" => _("You haven't added any playlists"), @@ -62,9 +62,9 @@ final class LocaleController extends Zend_Controller_Action 'Learn about smart blocks' => _('Learn about smart blocks'), 'Learn about webstreams' => _('Learn about webstreams'), "Click 'New' to create one." => _("Click 'New' to create one."), - //"Adding 1 Item" => _("Adding 1 Item"), - //"Adding %s Items" => _("Adding %s Items"), - //library/library.js + // "Adding 1 Item" => _("Adding 1 Item"), + // "Adding %s Items" => _("Adding %s Items"), + // library/library.js 'Add' => _('Add'), 'New' => _('New'), 'Edit' => _('Edit'), @@ -120,7 +120,7 @@ final class LocaleController extends Zend_Controller_Action 'Are you sure you want to delete the selected item?' => _('Are you sure you want to delete the selected item?'), 'Uploading in progress...' => _('Uploading in progress...'), 'Retrieving data from the server...' => _('Retrieving data from the server...'), - //library/podcast.js + // library/podcast.js 'Import' => _('Import'), 'Imported?' => _('Imported?'), 'View' => _('View'), @@ -131,9 +131,9 @@ final class LocaleController extends Zend_Controller_Action 'Input must be in the format: yyyy-mm-dd' => _('Input must be in the format: yyyy-mm-dd'), 'Input must be in the format: hh:mm:ss.t' => _('Input must be in the format: hh:mm:ss.t'), 'My Podcast' => _('My Podcast'), - //library/plupload.js + // library/plupload.js 'You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?' => _('You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?'), - //library/spl.js + // library/spl.js 'Open Media Builder' => _('Open Media Builder'), "please put in a time '00:00:00 (.0)'" => _("please put in a time '00:00:00 (.0)'"), "Please enter a valid time in seconds. Eg. 0.5'" => _('Please enter a valid time in seconds. Eg. 0.5'), @@ -143,14 +143,14 @@ final class LocaleController extends Zend_Controller_Action 'Playlist saved' => _('Playlist saved'), 'Playlist shuffled' => _('Playlist shuffled'), "Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore." => _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."), - //listenerstat/listenerstat.js + // listenerstat/listenerstat.js 'Listener Count on %s: %s' => _('Listener Count on %s: %s'), - //nowplaying/register.js + // nowplaying/register.js 'Remind me in 1 week' => _('Remind me in 1 week'), 'Remind me never' => _('Remind me never'), 'Yes, help Airtime' => _('Yes, help Airtime'), 'Image must be one of jpg, jpeg, png, or gif' => _('Image must be one of jpg, jpeg, png, or gif'), - //playlist/smart_blockbuilder.js + // playlist/smart_blockbuilder.js 'A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show.' => _('A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show.'), 'A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library.' => _('A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library.'), 'The desired block length will not be reached if %s cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block.' => _('The desired block length will not be reached if %s cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block.'), @@ -170,14 +170,14 @@ final class LocaleController extends Zend_Controller_Action 'is in the range' => _('is in the range'), 'Preview' => _('Preview'), 'Generate' => _('Generate'), - //preferences/musicdirs.js + // preferences/musicdirs.js 'Choose Storage Folder' => _('Choose Storage Folder'), 'Choose Folder to Watch' => _('Choose Folder to Watch'), "Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!" => _("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!"), 'Manage Media Folders' => _('Manage Media Folders'), 'Are you sure you want to remove the watched folder?' => _('Are you sure you want to remove the watched folder?'), 'This path is currently not accessible.' => _('This path is currently not accessible.'), - //preferences/streamsetting.js + // preferences/streamsetting.js 'Some stream types require extra configuration. Details about enabling %sAAC+ Support%s or %sOpus Support%s are provided.' => _('Some stream types require extra configuration. Details about enabling %sAAC+ Support%s or %sOpus Support%s are provided.'), 'Connected to the streaming server' => _('Connected to the streaming server'), 'The stream is disabled' => _('The stream is disabled'), @@ -192,9 +192,9 @@ final class LocaleController extends Zend_Controller_Action "If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."), 'WARNING: This will restart your stream and may cause a short dropout for your listeners!' => _('WARNING: This will restart your stream and may cause a short dropout for your listeners!'), 'This is the admin username and password for Icecast/SHOUTcast to get listener statistics.' => _('This is the admin username and password for Icecast/SHOUTcast to get listener statistics.'), - //preferences/support-setting.js + // preferences/support-setting.js 'Image must be one of jpg, jpeg, png, or gif' => _('Image must be one of jpg, jpeg, png, or gif'), - //schedule/add-show.js + // schedule/add-show.js 'Warning: You cannot change this field while the show is currently playing' => _('Warning: You cannot change this field while the show is currently playing'), 'No result found' => _('No result found'), 'This follows the same security pattern for the shows: only users assigned to the show can connect.' => _('This follows the same security pattern for the shows: only users assigned to the show can connect.'), @@ -204,9 +204,9 @@ final class LocaleController extends Zend_Controller_Action 'Warning: Shows cannot be re-linked' => _('Warning: Shows cannot be re-linked'), 'By linking your repeating shows any media items scheduled in any repeat show will also get scheduled in the other repeat shows' => _('By linking your repeating shows any media items scheduled in any repeat show will also get scheduled in the other repeat shows'), 'Timezone is set to the station timezone by default. Shows in the calendar will be displayed in your local time defined by the Interface Timezone in your user settings.' => _('Timezone is set to the station timezone by default. Shows in the calendar will be displayed in your local time defined by the Interface Timezone in your user settings.'), - //schedule/full-calendar-functions - //already in schedule/add-show.js - //"The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"), + // schedule/full-calendar-functions + // already in schedule/add-show.js + // "The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"), 'Show' => _('Show'), 'Show is empty' => _('Show is empty'), '1m' => _('1m'), @@ -219,9 +219,9 @@ final class LocaleController extends Zend_Controller_Action 'Retreiving data from the server...' => _('Retreiving data from the server...'), 'This show has no scheduled content.' => _('This show has no scheduled content.'), 'This show is not completely filled with content.' => _('This show is not completely filled with content.'), - //already in schedule/add-show.js - //"The show instance doesn"t exist anymore!" => _("The show instance doesn"t exist anymore!"), - //schedule/schedule.js + // already in schedule/add-show.js + // "The show instance doesn"t exist anymore!" => _("The show instance doesn"t exist anymore!"), + // schedule/schedule.js 'January' => _('January'), 'February' => _('February'), 'March' => _('March'), @@ -269,10 +269,10 @@ final class LocaleController extends Zend_Controller_Action 'Stop recording current show?' => _('Stop recording current show?'), 'Ok' => _('Ok'), 'Contents of Show' => _('Contents of Show'), - //already in schedule/add-show.js - //"The show instance doesn"t exist anymore!" => _("The show instance doesn"t exist anymore!"), + // already in schedule/add-show.js + // "The show instance doesn"t exist anymore!" => _("The show instance doesn"t exist anymore!"), 'Remove all content?' => _('Remove all content?'), - //showbuilder/builder.js + // showbuilder/builder.js 'Delete selected item(s)?' => _('Delete selected item(s)?'), 'Start' => _('Start'), 'End' => _('End'), @@ -281,11 +281,11 @@ final class LocaleController extends Zend_Controller_Action ' of ' => _(' of '), ' records' => _(' records'), 'There are no shows scheduled during the specified time period.' => _('There are no shows scheduled during the specified time period.'), - //already in library/library.js - //"Title" => _("Title"), - //"Creator" => _("Creator"), - //"Album" => _("Album"), - //"Mime" => _("Mime"), + // already in library/library.js + // "Title" => _("Title"), + // "Creator" => _("Creator"), + // "Album" => _("Album"), + // "Mime" => _("Mime"), 'Cue In' => _('Cue In'), 'Cue Out' => _('Cue Out'), 'Fade In' => _('Fade In'), @@ -293,9 +293,9 @@ final class LocaleController extends Zend_Controller_Action 'Show Empty' => _('Show Empty'), 'Recording From Line In' => _('Recording From Line In'), 'Track preview' => _('Track preview'), - //already in library/spl.js - //"Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn"t "watched" anymore." - //=> _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn"t "watched" anymore."), + // already in library/spl.js + // "Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn"t "watched" anymore." + // => _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn"t "watched" anymore."), 'Cannot schedule outside a show.' => _('Cannot schedule outside a show.'), 'Moving 1 Item' => _('Moving 1 Item'), 'Moving %s Items' => _('Moving %s Items'), @@ -304,8 +304,8 @@ final class LocaleController extends Zend_Controller_Action 'Fade Editor' => _('Fade Editor'), 'Cue Editor' => _('Cue Editor'), 'Waveform features are available in a browser supporting the Web Audio API' => _('Waveform features are available in a browser supporting the Web Audio API'), - //already in library/library.js - //"Select" => _("Select"), + // already in library/library.js + // "Select" => _("Select"), 'Select all' => _('Select all'), 'Select none' => _('Select none'), 'Trim overbooked shows' => _('Trim overbooked shows'), @@ -313,20 +313,20 @@ final class LocaleController extends Zend_Controller_Action 'Jump to the current playing track' => _('Jump to the current playing track'), 'Jump to Current' => _('Jump to Current'), 'Cancel current show' => _('Cancel current show'), - //already in schedule/schedule.js - //"Cancel Current Show?" => _("Cancel Current Show?"), + // already in schedule/schedule.js + // "Cancel Current Show?" => _("Cancel Current Show?"), 'Stop recording current show?' => _('Stop recording current show?'), - //showbuilder/main_builder.js + // showbuilder/main_builder.js 'Open library to add or remove content' => _('Open library to add or remove content'), 'Add / Remove Content' => _('Add / Remove Content'), - //status/status.js + // status/status.js 'in use' => _('in use'), 'Disk' => _('Disk'), - //serverbrowse/serverbrowse.js + // serverbrowse/serverbrowse.js 'Look in' => _('Look in'), 'Cancel' => _('Cancel'), 'Open' => _('Open'), - //user/user.js + // user/user.js 'Admin' => _('Admin'), 'DJ' => _('DJ'), 'Program Manager' => _('Program Manager'), @@ -351,17 +351,17 @@ final class LocaleController extends Zend_Controller_Action 'View system status' => _('View system status'), 'Access playout history' => _('Access playout history'), 'View listener stats' => _('View listener stats'), - //dataTables/ColVis.js + // dataTables/ColVis.js 'Show / hide columns' => _('Show / hide columns'), 'Columns' => _('Columns'), - //datatables.columnFilter.js + // datatables.columnFilter.js 'From {from} to {to}' => _('From {from} to {to}'), 'kbps' => _('kbps'), 'yyyy-mm-dd' => _('yyyy-mm-dd'), 'hh:mm:ss.t' => _('hh:mm:ss.t'), 'kHz' => _('kHz'), - //datepicker - //months are already in schedule/schedule.js + // datepicker + // months are already in schedule/schedule.js 'Su' => _('Su'), 'Mo' => _('Mo'), 'Tu' => _('Tu'), @@ -370,12 +370,12 @@ final class LocaleController extends Zend_Controller_Action 'Fr' => _('Fr'), 'Sa' => _('Sa'), 'Close' => _('Close'), - //timepicker + // timepicker 'Hour' => _('Hour'), 'Minute' => _('Minute'), 'Done' => _('Done'), - //plupload ships with translation files but a lot are incomplete - //so we will keep them here to prevent incomplete translations + // plupload ships with translation files but a lot are incomplete + // so we will keep them here to prevent incomplete translations 'Select files' => _('Select files'), 'Add files to the upload queue and click the start button.' => _('Add files to the upload queue and click the start button.'), 'Filename' => _('Add files to the upload queue and click the start button.'), @@ -403,7 +403,7 @@ final class LocaleController extends Zend_Controller_Action "Upload URL might be wrong or doesn't exist" => _("Upload URL might be wrong or doesn't exist"), 'Error: File too large: ' => _('Error: File too large: '), 'Error: Invalid file extension: ' => _('Error: Invalid file extension: '), - //history translations + // history translations 'Set Default' => _('Set Default'), 'Create Entry' => _('Create Entry'), 'Edit History Record' => _('Edit History Record'), @@ -413,14 +413,14 @@ final class LocaleController extends Zend_Controller_Action "%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished." => _("%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished."), 'New Show' => _('New Show'), 'New Log Entry' => _('New Log Entry'), - //Datatables: + // Datatables: 'No data available in table' => _('No data available in table'), '(filtered from _MAX_ total entries)' => _('(filtered from _MAX_ total entries)'), ': activate to sort column ascending', ': activate to sort column descending', - //End of datatables + // End of datatables - //New entries from .js "" => _(""), + // New entries from .js "" => _(""), 'First' => _('First'), 'Last' => _('Last'), 'Next' => _('Next'), @@ -450,7 +450,7 @@ final class LocaleController extends Zend_Controller_Action 'Showing 0 to 0 of 0 tracks' => _('Showing 0 to 0 of 0 tracks'), 'Showing 0 to 0 of 0 track types' => _('Showing 0 to 0 of 0 track types'), '(filtered from _MAX_ total track types)' => _('(filtered from _MAX_ total track types)'), - //"This is used for tracks containing music." => _("This is used for tracks containing music."), + // "This is used for tracks containing music." => _("This is used for tracks containing music."), 'Are you sure you want to delete this tracktype?' => _('Are you sure you want to delete this tracktype?'), 'No track types were found.' => _('No track types were found.'), 'No track types found' => _('No track types found'), @@ -479,11 +479,11 @@ final class LocaleController extends Zend_Controller_Action 'Add New Podcast' => _('Add New Podcast'), "Cannot schedule outside a show.\nTry creating a show first." => _("Cannot schedule outside a show.\nTry creating a show first."), 'No files have been uploaded yet.' => _('No files have been uploaded yet.'), - //"Value is required and can't be empty" => _("Value is required and can't be empty"), - //"mute" => _("mute"), - //"max volume" => _("max volume"), + // "Value is required and can't be empty" => _("Value is required and can't be empty"), + // "mute" => _("mute"), + // "max volume" => _("max volume"), - //embed player + // embed player 'On Air' => _('On Air'), 'Off Air' => _('Off Air'), 'Offline' => _('Offline'), diff --git a/legacy/application/controllers/LoginController.php b/legacy/application/controllers/LoginController.php index d3a272718..6148c6d1c 100644 --- a/legacy/application/controllers/LoginController.php +++ b/legacy/application/controllers/LoginController.php @@ -21,13 +21,13 @@ class LoginController extends Zend_Controller_Action $response = $this->getResponse(); $stationLocale = Application_Model_Preference::GetDefaultLocale(); - //Enable AJAX requests from www.airtime.pro for the sign-in process. + // Enable AJAX requests from www.airtime.pro for the sign-in process. CORSHelper::enableCrossOriginRequests($request, $response); Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); if (Zend_Session::isStarted()) { - //Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization. + // Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization. SessionHelper::reopenSessionForWriting(); $auth = Zend_Auth::getInstance(); @@ -38,7 +38,7 @@ class LoginController extends Zend_Controller_Action } } - //uses separate layout without a navigation. + // uses separate layout without a navigation. $this->_helper->layout->setLayout('login'); $this->view->error = false; @@ -50,35 +50,35 @@ class LoginController extends Zend_Controller_Action $message = _('Please enter your username and password.'); if ($request->isPost()) { - //Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization. - //session_start(); + // Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization. + // session_start(); if ($form->isValid($request->getPost())) { - //get the username and password from the form + // get the username and password from the form $username = $form->getValue('username'); $password = $form->getValue('password'); $locale = $form->getValue('locale'); $authAdapter = Application_Model_Auth::getAuthAdapter(); - //pass to the adapter the submitted username and password + // pass to the adapter the submitted username and password $authAdapter->setIdentity($username) ->setCredential($password); $result = $auth->authenticate($authAdapter); if ($result->isValid()) { Zend_Session::regenerateId(); - //all info about this user from the login table omit only the password + // all info about this user from the login table omit only the password $userInfo = $authAdapter->getResultRowObject(null, 'password'); - //the default storage is a session with namespace Zend_Auth + // the default storage is a session with namespace Zend_Auth $authStorage = $auth->getStorage(); $authStorage->write($userInfo); Application_Model_LoginAttempts::resetAttempts($_SERVER['REMOTE_ADDR']); Application_Model_Subjects::resetLoginAttempts($username); - //set the user locale in case user changed it in when logging in + // set the user locale in case user changed it in when logging in Application_Model_Preference::SetUserLocale($locale); $this->_redirect('showbuilder'); @@ -98,7 +98,7 @@ class LoginController extends Zend_Controller_Action public function logoutAction() { - //Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization. + // Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization. SessionHelper::reopenSessionForWriting(); $auth = Zend_Auth::getInstance(); @@ -122,7 +122,7 @@ class LoginController extends Zend_Controller_Action Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); - //uses separate layout without a navigation. + // uses separate layout without a navigation. $this->_helper->layout->setLayout('login'); $form = new Application_Form_PasswordRestore(); @@ -156,7 +156,7 @@ class LoginController extends Zend_Controller_Action } else { $form->email->addError($this->view->translate(_('That username or email address could not be found.'))); } - } else { //Form is not valid + } else { // Form is not valid $form->email->addError($this->view->translate(_('There was a problem with the username or email address you entered.'))); } } @@ -171,13 +171,13 @@ class LoginController extends Zend_Controller_Action Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); - //uses separate layout without a navigation. + // uses separate layout without a navigation. $this->_helper->layout->setLayout('login'); } public function passwordChangeAction() { - //uses separate layout without a navigation. + // uses separate layout without a navigation. $this->_helper->layout->setLayout('login'); $request = $this->getRequest(); @@ -192,7 +192,7 @@ class LoginController extends Zend_Controller_Action Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); - //check validity of token + // check validity of token if (!$auth->checkToken($user_id, $token, 'password.restore')) { Logging::debug('token not valid'); $this->_helper->redirector('index', 'login'); @@ -213,10 +213,10 @@ class LoginController extends Zend_Controller_Action $zend_auth->authenticate($authAdapter); - //all info about this user from the login table omit only the password + // all info about this user from the login table omit only the password $userInfo = $authAdapter->getResultRowObject(null, 'password'); - //the default storage is a session with namespace Zend_Auth + // the default storage is a session with namespace Zend_Auth $authStorage = $zend_auth->getStorage(); $authStorage->write($userInfo); diff --git a/legacy/application/controllers/PlaylistController.php b/legacy/application/controllers/PlaylistController.php index 4775e5ffc..a7e925b25 100644 --- a/legacy/application/controllers/PlaylistController.php +++ b/legacy/application/controllers/PlaylistController.php @@ -31,7 +31,7 @@ class PlaylistController extends Zend_Controller_Action ->addActionContext('change-playlist', 'json') ->initContext(); - //This controller writes to the session all over the place, so we're going to reopen it for writing here. + // This controller writes to the session all over the place, so we're going to reopen it for writing here. SessionHelper::reopenSessionForWriting(); } @@ -106,7 +106,7 @@ class PlaylistController extends Zend_Controller_Action $form->startForm($obj->getId(), $formIsValid); $this->view->form = $form; $this->view->obj = $obj; - //$this->view->type = "sb"; + // $this->view->type = "sb"; $this->view->id = $obj->getId(); if ($isJson) { @@ -115,7 +115,7 @@ class PlaylistController extends Zend_Controller_Action $this->view->html = $this->view->render($viewPath); } else { $this->view->obj = $obj; - //$this->view->type = "pl"; + // $this->view->type = "pl"; $this->view->id = $obj->getId(); if ($isJson) { return $this->view->html = $this->view->render($viewPath); @@ -185,7 +185,7 @@ class PlaylistController extends Zend_Controller_Action public function newAction() { - //$pl_sess = $this->pl_sess; + // $pl_sess = $this->pl_sess; $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $type = $this->_getParam('type'); @@ -306,7 +306,7 @@ class PlaylistController extends Zend_Controller_Action $obj->addAudioClips($ids, $afterItem, $addType); } elseif ($obj->isStatic()) { // if the dest is a block object - //check if any items are playlists + // check if any items are playlists foreach ($ids as $id) { if (is_array($id) && isset($id[1])) { if ($id[1] != 'audioclip') { @@ -574,7 +574,7 @@ class PlaylistController extends Zend_Controller_Action $this->view->result = 1; } $this->view->name = $bl->getName(); - //$this->view->type = "sb"; + // $this->view->type = "sb"; $this->view->id = $bl->getId(); $this->view->modified = $bl->getLastModified('U'); } elseif ($params['type'] == 'playlist') { @@ -583,7 +583,7 @@ class PlaylistController extends Zend_Controller_Action $this->view->name = $params['name']; } - //$this->_helper->json->sendJson($result); + // $this->_helper->json->sendJson($result); } public function smartBlockGenerateAction() @@ -591,7 +591,7 @@ class PlaylistController extends Zend_Controller_Action $request = $this->getRequest(); $params = $request->getPost(); - //make sure block exists + // make sure block exists try { $bl = new Application_Model_Block($params['obj_id']); @@ -601,7 +601,7 @@ class PlaylistController extends Zend_Controller_Action $result = $bl->generateSmartBlock($params['data']); $this->view->result = $result['result']; $this->createUpdateResponse($bl, true); - //$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true))); + // $this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true))); } else { $this->view->obj = $bl; $this->view->id = $bl->getId(); diff --git a/legacy/application/controllers/PlayouthistoryController.php b/legacy/application/controllers/PlayouthistoryController.php index 1e83f31a9..d46783b22 100644 --- a/legacy/application/controllers/PlayouthistoryController.php +++ b/legacy/application/controllers/PlayouthistoryController.php @@ -62,7 +62,7 @@ class PlayouthistoryController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl . 'css/history_styles.css?' . $CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.contextMenu.css?' . $CC_CONFIG['airtime_version']); - //set datatables columns for display of data. + // set datatables columns for display of data. $historyService = new Application_Service_HistoryService(); $columns = json_encode($historyService->getDatatablesLogSheetColumns()); $script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify({$columns}) ); "; diff --git a/legacy/application/controllers/PluploadController.php b/legacy/application/controllers/PluploadController.php index 2a9b46d3e..9584adf69 100644 --- a/legacy/application/controllers/PluploadController.php +++ b/legacy/application/controllers/PluploadController.php @@ -33,10 +33,10 @@ class PluploadController extends Zend_Controller_Action $this->view->quotaLimitReached = true; } - //Because uploads are done via AJAX (and we're not using Zend form for those), we manually add the CSRF - //token in here. + // Because uploads are done via AJAX (and we're not using Zend form for those), we manually add the CSRF + // token in here. $csrf_namespace = new Zend_Session_Namespace('csrf_namespace'); - //The CSRF token is generated in Bootstrap.php + // The CSRF token is generated in Bootstrap.php $csrf_element = new Zend_Form_Element_Hidden('csrf'); $csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label'); @@ -80,10 +80,10 @@ class PluploadController extends Zend_Controller_Action $rowStart = intval($request->getParam('iDisplayStart', 0)); $recentUploadsQuery = CcFilesQuery::create(); - //old propel 1.5 to reuse this query item (for counts/finds) + // old propel 1.5 to reuse this query item (for counts/finds) $recentUploadsQuery->keepQuery(true); - //Hide deleted files + // Hide deleted files $recentUploadsQuery->filterByDbFileExists(true); $numTotalRecentUploads = $recentUploadsQuery->count(); @@ -95,7 +95,7 @@ class PluploadController extends Zend_Controller_Action } elseif ($filter == 'failed') { $recentUploadsQuery->filterByDbImportStatus(2); $numTotalDisplayUploads = $recentUploadsQuery->count(); - //TODO: Consider using array('min' => 200)) or something if we have multiple errors codes for failure. + // TODO: Consider using array('min' => 200)) or something if we have multiple errors codes for failure. } $recentUploads = $recentUploadsQuery @@ -110,12 +110,12 @@ class PluploadController extends Zend_Controller_Action foreach ($recentUploads as $upload) { $upload = $upload->toArray(BasePeer::TYPE_FIELDNAME); - //TODO: $this->sanitizeResponse($upload)); + // TODO: $this->sanitizeResponse($upload)); $upload['utime'] = new DateTime($upload['utime'], $utcTimezone); $upload['utime']->setTimeZone($displayTimezone); $upload['utime'] = $upload['utime']->format(DEFAULT_TIMESTAMP_FORMAT); - //TODO: Invoke sanitization here (MediaController's removeBlacklist stuff) + // TODO: Invoke sanitization here (MediaController's removeBlacklist stuff) array_push($uploadsArray, $upload); } diff --git a/legacy/application/controllers/PreferenceController.php b/legacy/application/controllers/PreferenceController.php index c84205a5c..13fc11399 100644 --- a/legacy/application/controllers/PreferenceController.php +++ b/legacy/application/controllers/PreferenceController.php @@ -73,10 +73,10 @@ class PreferenceController extends Zend_Controller_Action $this->view->statusMsg = "
" . _('Preferences updated.') . '
'; $form = new Application_Form_Preferences(); $this->view->form = $form; - //$this->_helper->json->sendJson(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml'))); + // $this->_helper->json->sendJson(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml'))); } else { $this->view->form = $form; - //$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml'))); + // $this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml'))); } } $this->view->logoImg = Application_Model_Preference::GetStationLogo(); @@ -261,7 +261,7 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::setReplayGainModifier($values['replayGainModifier']); $md = ['schedule' => Application_Model_Schedule::getSchedule()]; Application_Model_RabbitMq::SendMessageToPypo('update_schedule', $md); - //Application_Model_RabbitMq::PushSchedule(); + // Application_Model_RabbitMq::PushSchedule(); } // pulling this from the 2.5.x branch @@ -363,7 +363,7 @@ class PreferenceController extends Zend_Controller_Action if ($handle !== false) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { - //only show directories that aren't private. + // only show directories that aren't private. if (is_dir($path . $file) && substr($file, 0, 1) != '.') { $element = []; $element['name'] = $file; @@ -376,7 +376,7 @@ class PreferenceController extends Zend_Controller_Action } } ksort($result); - //returns format serverBrowse is looking for. + // returns format serverBrowse is looking for. $this->_helper->json->sendJson($result); } diff --git a/legacy/application/controllers/ScheduleController.php b/legacy/application/controllers/ScheduleController.php index 8cf69e176..bc4da3e66 100644 --- a/legacy/application/controllers/ScheduleController.php +++ b/legacy/application/controllers/ScheduleController.php @@ -46,7 +46,7 @@ class ScheduleController extends Zend_Controller_Action $baseUrl = Application_Common_OsPath::getBaseDir(); - //Embed the schedule in our page response so we don't have to make an AJAX request to get this data after the page load. + // Embed the schedule in our page response so we don't have to make an AJAX request to get this data after the page load. $scheduleController = new ScheduleController($this->getRequest(), $this->getResponse()); $scheduleController->eventFeedPreloadAction(); $events = json_encode($scheduleController->view->events); @@ -64,10 +64,10 @@ class ScheduleController extends Zend_Controller_Action $this->view->headScript()->appendFile($baseUrl . 'js/contextmenu/jquery.contextMenu.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); - //full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time - //this should be as a default, however with our new drop down timezone changing for shows, we should reset this offset then?? + // full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time + // this should be as a default, however with our new drop down timezone changing for shows, we should reset this offset then?? $this->view->headScript()->appendScript('var timezoneOffset = ' . Application_Common_DateHelper::getStationTimezoneOffset() . '; //in seconds'); - //set offset to ensure it loads last + // set offset to ensure it loads last $this->view->headScript()->offsetSetFile(90, $baseUrl . 'js/airtime/schedule/full-calendar-functions.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl . 'js/fullcalendar/fullcalendar.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); @@ -89,7 +89,7 @@ class ScheduleController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl . 'css/add-show.css?' . $CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.contextMenu.css?' . $CC_CONFIG['airtime_version']); - //Start Show builder JS/CSS requirements + // Start Show builder JS/CSS requirements $headScript = $this->view->headScript(); AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']); @@ -106,7 +106,7 @@ class ScheduleController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl . 'css/datatables/css/dataTables.colReorder.min.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']); - //End Show builder JS/CSS requirements + // End Show builder JS/CSS requirements $this->createShowFormAction(true); @@ -333,7 +333,7 @@ class ScheduleController extends Zend_Controller_Action 'user' ); - //TODO: Add timezone and timezoneOffset back into the ApiController's results. + // TODO: Add timezone and timezoneOffset back into the ApiController's results. $range['timezone'] = Application_Common_DateHelper::getUserTimezoneAbbreviation(); $range['timezoneOffset'] = Application_Common_DateHelper::getUserTimezoneOffset(); @@ -346,7 +346,7 @@ class ScheduleController extends Zend_Controller_Action $live_dj_switch = Application_Model_Preference::GetSourceSwitchStatus('live_dj'); $master_dj_switch = Application_Model_Preference::GetSourceSwitchStatus('master_dj'); - //might not be the correct place to implement this but for now let's just do it here + // might not be the correct place to implement this but for now let's just do it here $source_status['live_dj_source'] = $live_dj; $source_status['master_dj_source'] = $master_dj; $this->view->source_status = $source_status; @@ -384,7 +384,7 @@ class ScheduleController extends Zend_Controller_Action $originalShowName = $originalShow->getName(); $originalShowStart = $originalShow->getShowInstanceStart(); - //convert from UTC to user's timezone for display. + // convert from UTC to user's timezone for display. $displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone()); $originalDateTime = new DateTime($originalShowStart, new DateTimeZone('UTC')); $originalDateTime->setTimezone($displayTimeZone); @@ -464,7 +464,7 @@ class ScheduleController extends Zend_Controller_Action $js = $this->_getParam('data'); $data = []; - //need to convert from serialized jQuery array. + // need to convert from serialized jQuery array. foreach ($js as $j) { $data[$j['name']] = $j['value']; } @@ -520,7 +520,7 @@ class ScheduleController extends Zend_Controller_Action $js = $this->_getParam('data'); $data = []; - //need to convert from serialized jQuery array. + // need to convert from serialized jQuery array. foreach ($js as $j) { $data[$j['name']] = $j['value']; } @@ -530,7 +530,7 @@ class ScheduleController extends Zend_Controller_Action ); $service_show = new Application_Service_ShowService(null, $data, true); - //TODO: move this to js + // TODO: move this to js $data['add_show_hosts'] = $this->_getParam('hosts'); $data['add_show_day_check'] = $this->_getParam('days'); @@ -570,7 +570,7 @@ class ScheduleController extends Zend_Controller_Action if (!$validateStartTime) { $this->view->when->getElement('add_show_start_time')->setOptions(['disabled' => true]); } - //$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true)); + // $this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true)); $this->view->addNewShow = false; $this->view->action = 'edit-show'; @@ -585,7 +585,7 @@ class ScheduleController extends Zend_Controller_Action $js = $this->_getParam('data'); $data = []; - //need to convert from serialized jQuery array. + // need to convert from serialized jQuery array. foreach ($js as $j) { $data[$j['name']] = $j['value']; } @@ -612,11 +612,11 @@ class ScheduleController extends Zend_Controller_Action $this->view->addNewShow = true; if ($data['add_show_start_now'] == 'now') { - //have to use the timezone the user has entered in the form to check past/present + // have to use the timezone the user has entered in the form to check past/present $showTimezone = new DateTimeZone($data['add_show_timezone']); $nowDateTime = new DateTime('now', $showTimezone); - //$showStartDateTime = new DateTime($start_time, $showTimezone); - //$showEndDateTime = new DateTime($end_time, $showTimezone); + // $showStartDateTime = new DateTime($start_time, $showTimezone); + // $showEndDateTime = new DateTime($end_time, $showTimezone); $data['add_show_start_time'] = $nowDateTime->format('H:i'); $data['add_show_start_date'] = $nowDateTime->format('Y-m-d'); @@ -626,7 +626,7 @@ class ScheduleController extends Zend_Controller_Action // Get the show ID from the show service to pass as a parameter to the RESTful ShowImageController $this->view->showId = $service_show->addUpdateShow($data); - //send new show forms to the user + // send new show forms to the user $this->createShowFormAction(true); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); @@ -734,7 +734,7 @@ class ScheduleController extends Zend_Controller_Action $menu[] = ['action' => ['type' => 'gourl', 'url' => $url], 'title' => _('Download'), ]; - //returns format jjmenu is looking for. + // returns format jjmenu is looking for. $this->_helper->json->sendJson($menu); } diff --git a/legacy/application/controllers/ShowbuilderController.php b/legacy/application/controllers/ShowbuilderController.php index ce70b2ff4..c91867a46 100644 --- a/legacy/application/controllers/ShowbuilderController.php +++ b/legacy/application/controllers/ShowbuilderController.php @@ -21,7 +21,7 @@ class ShowbuilderController extends Zend_Controller_Action $baseUrl = Application_Common_OsPath::getBaseDir(); $userType = Application_Model_User::GetCurrentUser()->getType(); - //$this->_helper->layout->setLayout("showbuilder"); + // $this->_helper->layout->setLayout("showbuilder"); $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '{$userType}' );"); @@ -70,7 +70,7 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->csrf = $csrf_element; $request = $this->getRequest(); - //populate date range form for show builder. + // populate date range form for show builder. $now = time(); $from = $request->getParam('from', $now); $to = $request->getParam('to', $now + (3 * 60 * 60)); @@ -133,12 +133,12 @@ class ShowbuilderController extends Zend_Controller_Action $instance = $item->getCcShowInstances(); $menu['preview'] = ['name' => _('Preview'), 'icon' => 'play']; - //select the cursor + // select the cursor $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 + // remove/truncate the item from the schedule $menu['del'] = ['name' => _('Delete'), 'icon' => 'delete', 'url' => $baseUrl . 'showbuilder/schedule-remove']; } @@ -199,7 +199,7 @@ class ShowbuilderController extends Zend_Controller_Action $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. + // 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, diff --git a/legacy/application/controllers/UserController.php b/legacy/application/controllers/UserController.php index 16d728069..76d6f5500 100644 --- a/legacy/application/controllers/UserController.php +++ b/legacy/application/controllers/UserController.php @@ -69,7 +69,7 @@ class UserController extends Zend_Controller_Action $user->setPassword($formData['password']); } if (array_key_exists('type', $formData)) { - if ($formData['type'] != UTYPE_SUPERADMIN) { //Don't allow any other user to be promoted to Super Admin + if ($formData['type'] != UTYPE_SUPERADMIN) { // Don't allow any other user to be promoted to Super Admin $user->setType($formData['type']); } } @@ -136,12 +136,12 @@ class UserController extends Zend_Controller_Action if ($form->isValid($formData) && $form->validateLogin($formData['cu_login'], $formData['cu_user_id'])) { $user = new Application_Model_User($formData['cu_user_id']); - //Stupid hack because our schema enforces non-null first_name - //even though by default the admin user has no first name... (....) + // Stupid hack because our schema enforces non-null first_name + // even though by default the admin user has no first name... (....) if (Application_Model_User::getCurrentUser()->isSuperAdmin()) { if (empty($formData['cu_first_name'])) { $formData['cu_first_name'] = 'admin'; - $formData['cu_last_name'] = 'admin'; //ditto, avoid non-null DB constraint + $formData['cu_last_name'] = 'admin'; // ditto, avoid non-null DB constraint } } if (isset($formData['cu_first_name'])) { @@ -180,9 +180,9 @@ class UserController extends Zend_Controller_Action Application_Model_Preference::SetUserLocale($formData['cu_locale']); Application_Model_Preference::SetUserTimezone($formData['cu_timezone']); - //configure localization with new locale setting + // configure localization with new locale setting Application_Model_Locale::configureLocalization($formData['cu_locale']); - //reinitialize form so language gets translated + // reinitialize form so language gets translated $form = new Application_Form_EditUser(); $this->view->successMessage = "
" . _('Settings updated successfully!') . '
'; @@ -234,8 +234,8 @@ class UserController extends Zend_Controller_Action } elseif ($files_action == 'reassign_to') { // TODO : fix code to actually use the line below and pick a // real owner instead of defaulting to the first found admin - //$new_owner_id = $this->_getParam("new_owner"); - //$new_owner = new Application_Model_User($new_owner_id); + // $new_owner_id = $this->_getParam("new_owner"); + // $new_owner = new Application_Model_User($new_owner_id); $user->donateFilesTo($new_owner); Logging::info("Reassign to user {$new_owner->getDbId()}"); } diff --git a/legacy/application/controllers/UsersettingsController.php b/legacy/application/controllers/UsersettingsController.php index a1ca18a77..4336a4f72 100644 --- a/legacy/application/controllers/UsersettingsController.php +++ b/legacy/application/controllers/UsersettingsController.php @@ -81,7 +81,7 @@ class UsersettingsController extends Zend_Controller_Action { SessionHelper::reopenSessionForWriting(); Zend_Session::namespaceUnset('referrer'); - //pass in true to indicate 'Remind me never' was clicked + // pass in true to indicate 'Remind me never' was clicked Application_Model_Preference::SetRemindMeDate(true); } diff --git a/legacy/application/controllers/WebstreamController.php b/legacy/application/controllers/WebstreamController.php index 1f2ad39fd..a823511bf 100644 --- a/legacy/application/controllers/WebstreamController.php +++ b/legacy/application/controllers/WebstreamController.php @@ -24,7 +24,7 @@ class WebstreamController extends Zend_Controller_Action $webstream = new CcWebstream(); - //we're not saving this primary key in the DB so it's OK to be -1 + // we're not saving this primary key in the DB so it's OK to be -1 $webstream->setDbId(-1); $webstream->setDbName(_('Untitled Webstream')); $webstream->setDbDescription(''); @@ -35,7 +35,7 @@ class WebstreamController extends Zend_Controller_Action $webstream->setDbUtime(new DateTime('now', new DateTimeZone('UTC'))); $webstream->setDbMtime(new DateTime('now', new DateTimeZone('UTC'))); - //clear the session in case an old playlist was open: CC-4196 + // clear the session in case an old playlist was open: CC-4196 Application_Model_Library::changePlaylist(null, null); $this->view->obj = new Application_Model_Webstream($webstream); @@ -116,7 +116,7 @@ class WebstreamController extends Zend_Controller_Action /*we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.*/ $user = Application_Model_User::getCurrentUser(); - //only allow when webstream belongs to the DJ + // only allow when webstream belongs to the DJ return $webstream->getDbCreatorId() == $user->getId(); } /*we are creating a new stream. Don't need to check whether the diff --git a/legacy/application/controllers/plugins/Acl_plugin.php b/legacy/application/controllers/plugins/Acl_plugin.php index 94d626815..72ba8196f 100644 --- a/legacy/application/controllers/plugins/Acl_plugin.php +++ b/legacy/application/controllers/plugins/Acl_plugin.php @@ -119,20 +119,20 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract ])) { $this->setRoleName('G'); } elseif (Zend_Session::isStarted() && !Zend_Auth::getInstance()->hasIdentity()) { - //The controller uses sessions but we don't have an identity yet. + // The controller uses sessions but we don't have an identity yet. // If we don't have an identity and we're making a RESTful request, // we need to do API key verification if ($request->getModuleName() == 'rest') { if (!$this->verifyAuth()) { - //$this->denyAccess(); - //$this->getResponse()->sendResponse(); - //$r->gotoSimpleAndExit('index', 'login', $request->getModuleName()); + // $this->denyAccess(); + // $this->getResponse()->sendResponse(); + // $r->gotoSimpleAndExit('index', 'login', $request->getModuleName()); - //die(); + // die(); throw new Zend_Controller_Exception('Incorrect API key', 401); } - } else { //Non-REST, regular Airtime web app requests + } else { // Non-REST, regular Airtime web app requests // Redirect user to the landing page if they are trying to // access a resource that requires a valid session. // Skip the redirection if they are already on the landing page @@ -148,7 +148,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract ->setBody($json) ->sendResponse(); - //redirectAndExit() cleans up, sends the headers and stops the script + // redirectAndExit() cleans up, sends the headers and stops the script Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit(); } else { $r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); @@ -156,7 +156,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract } } } - } else { //We have a session/identity. + } else { // We have a session/identity. // If we have an identity and we're making a RESTful request, // we need to check the CSRF token if ($_SERVER['REQUEST_METHOD'] != 'GET' && $request->getModuleName() == 'rest') { diff --git a/legacy/application/controllers/plugins/PageLayoutInitPlugin.php b/legacy/application/controllers/plugins/PageLayoutInitPlugin.php index ea203e643..1ce81c445 100644 --- a/legacy/application/controllers/plugins/PageLayoutInitPlugin.php +++ b/legacy/application/controllers/plugins/PageLayoutInitPlugin.php @@ -26,10 +26,10 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract $controller = strtolower($request->getControllerName()); $action = strtolower($request->getActionName()); - //List of controllers where we don't need a session, and we don't need - //all the standard HTML / JS boilerplate. + // List of controllers where we don't need a session, and we don't need + // all the standard HTML / JS boilerplate. if (!in_array($controller, [ - 'index', //Radio Page + 'index', // Radio Page 'api', 'auth', 'error', @@ -38,11 +38,11 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract 'feeds', ]) ) { - //Start the session + // Start the session Zend_Session::start(); Application_Model_Auth::pinSessionToClient(Zend_Auth::getInstance()); - //localization configuration + // localization configuration Application_Model_Locale::configureLocalization(); $this->_initGlobals(); @@ -122,11 +122,11 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract $csrf_namespace->setExpirationSeconds(168 * 60 * 60); } - //Here we are closing the session for writing because otherwise no requests - //in this session will be handled in parallel. This gives a major boost to the perceived performance - //of the application (page load times are more consistent, no lock contention). + // Here we are closing the session for writing because otherwise no requests + // in this session will be handled in parallel. This gives a major boost to the perceived performance + // of the application (page load times are more consistent, no lock contention). session_write_close(); - //Zend_Session::writeClose(true); + // Zend_Session::writeClose(true); } /** @@ -140,7 +140,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract $view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';"); $view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';"); $view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';"); - //Each page refresh or tab open has uniqID, not to be used for security + // Each page refresh or tab open has uniqID, not to be used for security $view->headScript()->appendScript("var UNIQID = '" . uniqid() . "';"); $track_type_options = []; @@ -204,8 +204,8 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract ->appendScript('$.i18n.setDictionary(general_dict)') ->appendScript("var baseUrl='{$baseUrl}'"); - //These timezones are needed to adjust javascript Date objects on the client to make sense to the user's set timezone - //or the server's set timezone. + // These timezones are needed to adjust javascript Date objects on the client to make sense to the user's set timezone + // or the server's set timezone. $serverTimeZone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone()); $now = new DateTime('now', $serverTimeZone); $offset = $now->format('Z') * -1; @@ -218,7 +218,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract $view->headScript()->appendScript("var userTimezoneOffset = {$offset}; //in seconds"); } - //scripts for now playing bar + // scripts for now playing bar $view->headScript()->appendFile($baseUrl . 'js/airtime/airtime_bootstrap.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') ->appendFile($baseUrl . 'js/airtime/dashboard/helperfunctions.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') ->appendFile($baseUrl . 'js/airtime/dashboard/dashboard.js?' . $CC_CONFIG['airtime_version'], 'text/javascript') diff --git a/legacy/application/forms/AddShowAbsoluteRebroadcastDates.php b/legacy/application/forms/AddShowAbsoluteRebroadcastDates.php index 3625318eb..f1ec1d7cd 100644 --- a/legacy/application/forms/AddShowAbsoluteRebroadcastDates.php +++ b/legacy/application/forms/AddShowAbsoluteRebroadcastDates.php @@ -84,7 +84,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm $show_end->add(new DateInterval("PT{$duration[0]}H")); $show_end->add(new DateInterval("PT{$duration[1]}M")); - $show_end->add(new DateInterval('PT1H')); //min time to wait until a rebroadcast + $show_end->add(new DateInterval('PT1H')); // min time to wait until a rebroadcast $rebroad_start = $day . ' ' . $formData['add_show_rebroadcast_time_absolute_' . $i]; $rebroad_start = new DateTime($rebroad_start); diff --git a/legacy/application/forms/AddShowLiveStream.php b/legacy/application/forms/AddShowLiveStream.php index 31d8cead2..81711a4f5 100644 --- a/legacy/application/forms/AddShowLiveStream.php +++ b/legacy/application/forms/AddShowLiveStream.php @@ -17,7 +17,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm ->setRequired(false); $this->addElement($cb_custom_auth); - //custom username + // custom username $custom_username = new Zend_Form_Element_Text('custom_username'); $custom_username->setAttrib('class', 'input_text') ->setAttrib('autocomplete', 'off') @@ -28,7 +28,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm new ConditionalNotEmpty(['cb_custom_auth' => '1']), ]); $this->addElement($custom_username); - //custom password + // custom password $custom_password = new Zend_Form_Element_Password('custom_password'); $custom_password->setAttrib('class', 'input_text') ->setAttrib('autocomplete', 'off') diff --git a/legacy/application/forms/AddShowRebroadcastDates.php b/legacy/application/forms/AddShowRebroadcastDates.php index 867345df7..b4f031ecd 100644 --- a/legacy/application/forms/AddShowRebroadcastDates.php +++ b/legacy/application/forms/AddShowRebroadcastDates.php @@ -92,7 +92,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm $show_end->add(new DateInterval("PT{$duration[0]}H")); $show_end->add(new DateInterval("PT{$duration[1]}M")); - $show_end->add(new DateInterval('PT1H')); //min time to wait until a rebroadcast + $show_end->add(new DateInterval('PT1H')); // min time to wait until a rebroadcast $rebroad_start = $formData['add_show_start_date'] . ' ' . $formData['add_show_rebroadcast_time_' . $i]; $rebroad_start = new DateTime($rebroad_start); diff --git a/legacy/application/forms/AddShowRepeats.php b/legacy/application/forms/AddShowRepeats.php index 036b1c914..daf128c3d 100644 --- a/legacy/application/forms/AddShowRepeats.php +++ b/legacy/application/forms/AddShowRepeats.php @@ -8,7 +8,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm $linked->setLabel(_('Link:')); $this->addElement($linked); - //Add type select + // Add type select $this->addElement('select', 'add_show_repeat_type', [ 'required' => true, 'label' => _('Repeat Type:'), @@ -98,7 +98,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm $end_timestamp = $formData['add_show_end_date']; $showTimeZone = new DateTimeZone($formData['add_show_timezone']); - //We're assuming all data is valid at this point (timezone, etc.). + // We're assuming all data is valid at this point (timezone, etc.). $startDate = new DateTime($start_timestamp, $showTimeZone); $endDate = new DateTime($end_timestamp, $showTimeZone); diff --git a/legacy/application/forms/AddShowWhen.php b/legacy/application/forms/AddShowWhen.php index e2892ffda..42ba81551 100644 --- a/legacy/application/forms/AddShowWhen.php +++ b/legacy/application/forms/AddShowWhen.php @@ -25,7 +25,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm ]) ->setValue('future') ->setDecorators(['ViewHelper']); - //$startDate->setAttrib('alt', 'date'); + // $startDate->setAttrib('alt', 'date'); $this->addElement($startNow); // Add start date element @@ -135,7 +135,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $start_time = $formData['add_show_start_date'] . ' ' . $formData['add_show_start_time']; $end_time = $formData['add_show_end_date_no_repeat'] . ' ' . $formData['add_show_end_time']; - //have to use the timezone the user has entered in the form to check past/present + // have to use the timezone the user has entered in the form to check past/present $showTimezone = new DateTimeZone($formData['add_show_timezone']); $nowDateTime = new DateTime('now', $showTimezone); $showStartDateTime = new DateTime($start_time, $showTimezone); @@ -164,7 +164,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $valid = false; } - //validate duration. + // validate duration. $duration = $showStartDateTime->diff($showEndDateTime); if ($showStartDateTime > $showEndDateTime) { @@ -193,7 +193,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm * upto this point */ if ($valid) { - //we need to know the start day of the week in show's local timezome + // we need to know the start day of the week in show's local timezome $startDow = $showStartDateTime->format('w'); $utc = new DateTimeZone('UTC'); @@ -201,7 +201,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $showEndDateTime->setTimezone($utc); if ($formData['add_show_repeats']) { - //get repeating show end date + // get repeating show end date if ($formData['add_show_no_end']) { $date = Application_Model_Preference::GetShowsPopulatedUntil(); @@ -217,7 +217,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $populateUntilDateTime->setTimezone($utc); } - //get repeat interval + // get repeat interval if ($formData['add_show_repeat_type'] == 0) { $interval = 'P7D'; } elseif ($formData['add_show_repeat_type'] == 1) { @@ -280,7 +280,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $repeatShowEnd->setTimezone($showTimezone); $repeatShowStart->add(new DateInterval('P' . $daysAdd . 'D')); $repeatShowEnd->add(new DateInterval('P' . $daysAdd . 'D')); - //set back to UTC + // set back to UTC $repeatShowStart->setTimezone($utc); $repeatShowEnd->setTimezone($utc); } @@ -290,7 +290,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm */ while ($repeatShowStart->getTimestamp() < $populateUntilDateTime->getTimestamp()) { if ($formData['add_show_id'] == -1) { - //this is a new show + // this is a new show $overlapping = Application_Model_Schedule::checkOverlappingShows( $repeatShowStart, $repeatShowEnd diff --git a/legacy/application/forms/AddShowWho.php b/legacy/application/forms/AddShowWho.php index d8b7e552b..5efd524a9 100644 --- a/legacy/application/forms/AddShowWho.php +++ b/legacy/application/forms/AddShowWho.php @@ -18,7 +18,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm $options[$host['index']] = $host['label']; } - //Add hosts selection + // Add hosts selection $hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts'); $hosts->setLabel(_('DJs:')) ->setMultiOptions($options); diff --git a/legacy/application/forms/AddTracktype.php b/legacy/application/forms/AddTracktype.php index 4e6fa73e8..8ae6e0395 100644 --- a/legacy/application/forms/AddTracktype.php +++ b/legacy/application/forms/AddTracktype.php @@ -49,7 +49,7 @@ class Application_Form_AddTracktype extends Zend_Form '0' => _('Disabled'), '1' => _('Enabled'), ]); - //$visibility->getValue(); + // $visibility->getValue(); $visibility->setRequired(true); $this->addElement($visibility); diff --git a/legacy/application/forms/AddUser.php b/legacy/application/forms/AddUser.php index 7351b426e..b805844c2 100644 --- a/legacy/application/forms/AddUser.php +++ b/legacy/application/forms/AddUser.php @@ -29,7 +29,7 @@ class Application_Form_AddUser extends Zend_Form $login->setRequired(true); $login->addValidator($notEmptyValidator); $login->addFilter('StringTrim'); - //$login->addValidator('UserNameValidate'); + // $login->addValidator('UserNameValidate'); $this->addElement($login); $password = new Zend_Form_Element_Password('password'); diff --git a/legacy/application/forms/DangerousPreferences.php b/legacy/application/forms/DangerousPreferences.php index 16b6add21..8fa1e2d6a 100644 --- a/legacy/application/forms/DangerousPreferences.php +++ b/legacy/application/forms/DangerousPreferences.php @@ -10,7 +10,7 @@ class Application_Form_DangerousPreferences extends Zend_Form_SubForm $clearLibrary = new Zend_Form_Element_Button('clear_library'); $clearLibrary->setLabel(_('Delete All Tracks in Library')); - //$submit->removeDecorator('Label'); + // $submit->removeDecorator('Label'); $clearLibrary->setAttribs(['class' => 'btn centered']); $clearLibrary->setAttrib('onclick', 'deleteAllFiles();'); $clearLibrary->removeDecorator('DtDdWrapper'); diff --git a/legacy/application/forms/EditHistory.php b/legacy/application/forms/EditHistory.php index e98697d04..7301e9f46 100644 --- a/legacy/application/forms/EditHistory.php +++ b/legacy/application/forms/EditHistory.php @@ -3,7 +3,7 @@ class Application_Form_EditHistory extends Zend_Form { public const VALIDATE_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss'; - //this is used by the javascript widget, unfortunately h/H is opposite from Zend. + // this is used by the javascript widget, unfortunately h/H is opposite from Zend. public const TIMEPICKER_DATETIME_FORMAT = 'yyyy-MM-dd hh:mm:ss'; public const VALIDATE_DATE_FORMAT = 'yyyy-MM-dd'; @@ -151,8 +151,8 @@ class Application_Form_EditHistory extends Zend_Form for ($i = 0, $len = count($template); $i < $len; ++$i) { $item = $template[$i]; - //don't dynamically add this as it should be included in the - //init() function already if it should show up in the UI.. + // don't dynamically add this as it should be included in the + // init() function already if it should show up in the UI.. if (in_array($item['name'], $required)) { continue; } @@ -187,7 +187,7 @@ class Application_Form_EditHistory extends Zend_Form $options = isset($arr[self::ITEM_OPTIONS]) ? $arr[self::ITEM_OPTIONS] : null; $validator = new $arr[self::ITEM_CLASS]($options); - //extra validator info + // extra validator info if (isset($arr['params'])) { foreach ($arr['params'] as $key => $value) { $method = 'set' . ucfirst($key); diff --git a/legacy/application/forms/EditHistoryItem.php b/legacy/application/forms/EditHistoryItem.php index eb0e851f0..3e5d0a072 100644 --- a/legacy/application/forms/EditHistoryItem.php +++ b/legacy/application/forms/EditHistoryItem.php @@ -43,7 +43,7 @@ class Application_Form_EditHistoryItem extends Application_Form_EditHistory $ends->addFilter('StringTrim'); $ends->setLabel(_('End Time')); $ends->setDecorators(['ViewHelper']); - //$ends->setRequired(true); + // $ends->setRequired(true); $this->addElement($ends); } @@ -57,7 +57,7 @@ class Application_Form_EditHistoryItem extends Application_Form_EditHistory $possibleInstances['0'] = _('No Show'); $instance = new Zend_Form_Element_Select('his_instance_select'); - //$instance->setLabel(_("Choose Show Instance")); + // $instance->setLabel(_("Choose Show Instance")); $instance->setMultiOptions($possibleInstances); $instance->setValue($default); $instance->setDecorators(['ViewHelper']); diff --git a/legacy/application/forms/GeneralPreferences.php b/legacy/application/forms/GeneralPreferences.php index 54ab73791..25af4dddc 100644 --- a/legacy/application/forms/GeneralPreferences.php +++ b/legacy/application/forms/GeneralPreferences.php @@ -20,7 +20,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn(); $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut(); - //Station name + // Station name $this->addElement('text', 'stationName', [ 'class' => 'input_text', 'label' => _('Station Name'), @@ -57,7 +57,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $stationLogoRemove->setAttrib('onclick', 'removeLogo();'); $this->addElement($stationLogoRemove); - //Default station crossfade duration + // Default station crossfade duration $this->addElement('text', 'stationDefaultCrossfadeDuration', [ 'class' => 'input_text', 'label' => _('Default Crossfade Duration (s):'), @@ -71,7 +71,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm 'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(), ]); - //Default station fade in + // Default station fade in $this->addElement('text', 'stationDefaultFadeIn', [ 'class' => 'input_text', 'label' => _('Default Fade In (s):'), @@ -85,7 +85,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm 'value' => $defaultFadeIn, ]); - //Default station fade out + // Default station fade out $this->addElement('text', 'stationDefaultFadeOut', [ 'class' => 'input_text', 'label' => _('Default Fade Out (s):'), @@ -126,7 +126,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm ]); $podcast_album_override->setValue(Application_Model_Preference::GetPodcastAlbumOverride()); $podcast_album_override->setDescription(_('Enabling this feature will cause podcast episode tracks to have their Artist, Title, and Album metatags set from podcast feed values. Note that enabling this feature is recommended in order to ensure reliable scheduling of episodes via smartblocks.')); - $podcast_album_override->setSeparator(' '); //No
between radio buttons + $podcast_album_override->setSeparator(' '); // No
between radio buttons $podcast_album_override->addDecorator('HtmlTag', ['tag' => 'dd', 'id' => 'podcastAlbumOverride-element', 'class' => 'radio-inline-list', @@ -141,14 +141,14 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm ]); $podcast_auto_smartblock->setValue(Application_Model_Preference::GetPodcastAutoSmartblock()); $podcast_auto_smartblock->setDescription(_('If this option is enabled, a new smartblock and playlist matching the newest track of a podcast will be generated immediately upon creation of a new podcast. Note that the "Overwrite Podcast Episode Metatags" feature must also be enabled in order for smartblocks to reliably find episodes.')); - $podcast_auto_smartblock->setSeparator(' '); //No
between radio buttons + $podcast_auto_smartblock->setSeparator(' '); // No
between radio buttons $podcast_auto_smartblock->addDecorator('HtmlTag', ['tag' => 'dd', 'id' => 'podcastAutoSmartblock-element', 'class' => 'radio-inline-list', ]); $this->addElement($podcast_auto_smartblock); - //TODO add and insert Podcast Smartblock and Playlist autogenerate options + // TODO add and insert Podcast Smartblock and Playlist autogenerate options $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api->setLabel(_('Public LibreTime API')); @@ -160,8 +160,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setDescription(_('Enabling this feature will allow LibreTime to provide schedule data to external widgets that can be embedded in your website.')); - $third_party_api->setSeparator(' '); //No
between radio buttons - //$third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list'))); + $third_party_api->setSeparator(' '); // No
between radio buttons + // $third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list'))); $third_party_api->addDecorator('HtmlTag', ['tag' => 'dd', 'id' => 'thirdPartyApi-element', 'class' => 'radio-inline-list', @@ -218,7 +218,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm ]); $feature_preview_mode->setValue(Application_Model_Preference::GetFeaturePreviewMode()); $feature_preview_mode->setDescription(_('Enable this to opt-in to test new features.')); - $feature_preview_mode->setSeparator(' '); //No
between radio buttons + $feature_preview_mode->setSeparator(' '); // No
between radio buttons $feature_preview_mode->addDecorator('HtmlTag', ['tag' => 'dd', 'id' => 'featurePreviewMode-element', 'class' => 'radio-inline-list', diff --git a/legacy/application/forms/LiveStreamingPreferences.php b/legacy/application/forms/LiveStreamingPreferences.php index c8cfd4e73..6eea9aecf 100644 --- a/legacy/application/forms/LiveStreamingPreferences.php +++ b/legacy/application/forms/LiveStreamingPreferences.php @@ -34,7 +34,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm ->setValue($defaultFade); $this->addElement($transition_fade); - //Master username + // Master username $master_username = new Zend_Form_Element_Text('master_username'); $master_username->setAttrib('autocomplete', 'off') ->setAllowEmpty(true) @@ -43,7 +43,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm ->setValue(Application_Model_Preference::GetLiveStreamMasterUsername()); $this->addElement($master_username); - //Master password + // Master password if ($isDemo) { $master_password = new Zend_Form_Element_Text('master_password'); } else { @@ -67,7 +67,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm ->setValue(Application_Model_Preference::GetMasterDJSourceConnectionURL()); $this->addElement($masterSourceHost); - //liquidsoap harbor.input port + // liquidsoap harbor.input port $betweenValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(1024, 49151); $m_port = Application_Model_StreamSetting::getMasterLiveStreamPort(); @@ -97,7 +97,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm ->setValue(Application_Model_Preference::GetLiveDJSourceConnectionURL()); $this->addElement($showSourceHost); - //liquidsoap harbor.input port + // liquidsoap harbor.input port $l_port = Application_Model_StreamSetting::getDjLiveStreamPort(); $showSourcePort = new Zend_Form_Element_Text('show_source_port'); diff --git a/legacy/application/forms/Login.php b/legacy/application/forms/Login.php index 722705cb3..b0969bc5b 100644 --- a/legacy/application/forms/Login.php +++ b/legacy/application/forms/Login.php @@ -9,8 +9,8 @@ class Application_Form_Login extends Zend_Form // Set the method for the display form to POST $this->setMethod('post'); - //If the request comes from an origin we consider safe, we disable the CSRF - //token checking ONLY for the login page. + // If the request comes from an origin we consider safe, we disable the CSRF + // token checking ONLY for the login page. $request = Zend_Controller_Front::getInstance()->getRequest(); if ($request) { $refererUrl = $request->getHeader('referer'); diff --git a/legacy/application/forms/Preferences.php b/legacy/application/forms/Preferences.php index eb59b5417..58fd218e9 100644 --- a/legacy/application/forms/Preferences.php +++ b/legacy/application/forms/Preferences.php @@ -26,7 +26,7 @@ class Application_Form_Preferences extends Zend_Form $this->addSubForm($general_pref, 'preferences_general'); - //tunein form + // tunein form $tuneinPreferences = new Application_Form_TuneInPreferences(); $this->addSubForm($tuneinPreferences, 'preferences_tunein'); @@ -35,7 +35,7 @@ class Application_Form_Preferences extends Zend_Form $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel(_('Save')); - //$submit->removeDecorator('Label'); + // $submit->removeDecorator('Label'); $submit->setAttribs(['class' => 'btn right-floated']); $submit->removeDecorator('DtDdWrapper'); diff --git a/legacy/application/forms/SmartBlockCriteria.php b/legacy/application/forms/SmartBlockCriteria.php index 8d22e0cd0..63a0e0306 100644 --- a/legacy/application/forms/SmartBlockCriteria.php +++ b/legacy/application/forms/SmartBlockCriteria.php @@ -278,7 +278,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $storedCrit = $bl->getCriteriaGrouped(); Logging::info($storedCrit); - //need to convert criteria to be displayed in the user's timezone if there's some timestamp type. + // need to convert criteria to be displayed in the user's timezone if there's some timestamp type. self::convertTimestamps($storedCrit['crit']); /* $modRoadMap stores the number of same criteria @@ -297,8 +297,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm if (isset($storedCrit['crit'])) { $criteriaKeys = array_keys($storedCrit['crit']); } - //the way the everything is currently built it setups 25 smartblock criteria forms and then disables them - //but this creates 29 elements + // the way the everything is currently built it setups 25 smartblock criteria forms and then disables them + // but this creates 29 elements $numElements = count($this->getCriteriaOptions()); // loop through once for each potential criteria option ie album, composer, track // criteria from different groups are separated already by the getCriteriaGrouped call @@ -309,7 +309,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm // if there is a criteria found then count the number of rows for this specific criteria ie > 1 track title // need to refactor this to maintain separation based upon criteria grouping if (isset($criteriaKeys[$i])) { - //Logging::info($criteriaKeys[$i]); + // Logging::info($criteriaKeys[$i]); Logging::info($storedCrit['crit'][$criteriaKeys[$i]]); $critCount = count($storedCrit['crit'][$criteriaKeys[$i]]); } else { @@ -387,7 +387,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $criteriaValue = new Zend_Form_Element_Select('sp_criteria_value_' . $i . '_' . $j); $criteriaValue->setAttrib('class', 'input_select sp_input_select')->setDecorators(['viewHelper']); - if (isset($criteriaKeys[$i])) { //do if $relativeTT above + if (isset($criteriaKeys[$i])) { // do if $relativeTT above $criteriaValue->setAttrib('enabled', 'enabled'); } else { $criteriaValue->setAttrib('disabled', 'disabled'); @@ -505,8 +505,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $criteriaExtraDatetimeSelect->setAttrib('disabled', 'disabled'); } $this->addElement($criteriaExtraDatetimeSelect); - }//for - }//for + }// for + }// for $repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks'); $repeatTracks->setDecorators(['viewHelper']) @@ -845,7 +845,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $element->addError(_('Only non-negative integer numbers are allowed (e.g 1 or 5) for the text value')); $isValid = false; // TODO validate this on numeric input with whatever parsing also do for extra - //if the modifier is before ago or between we skip validation until we confirm format + // if the modifier is before ago or between we skip validation until we confirm format } elseif (isset($d['sp_criteria_datetime_select']) && $d['sp_criteria_datetime_select'] == '0') { $element->addError(_('You must select a time unit for a relative datetime.')); $isValid = false; @@ -912,9 +912,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $element->addError(_('Value cannot be empty')); $isValid = false; } - }//end foreach - }//for loop - }//if + }// end foreach + }// for loop + }// if return $isValid; } diff --git a/legacy/application/logging/Logging.php b/legacy/application/logging/Logging.php index 526b08890..d833a5982 100644 --- a/legacy/application/logging/Logging.php +++ b/legacy/application/logging/Logging.php @@ -11,8 +11,8 @@ class Logging $writer = new Zend_Log_Writer_Stream(self::$_path); if (Zend_Version::compareVersion('1.11') > 0) { - //Running Zend version 1.10 or lower. Need to instantiate our - //own Zend Log class with backported code from 1.11. + // Running Zend version 1.10 or lower. Need to instantiate our + // own Zend Log class with backported code from 1.11. require_once __DIR__ . '/AirtimeLog.php'; self::$_logger = new Airtime_Zend_Log($writer); } else { @@ -54,7 +54,7 @@ class Logging } if ($debugMode) { - //debug_backtrace is SLOW so we don't want this invoke unless there was a real error! (hence $debugMode) + // debug_backtrace is SLOW so we don't want this invoke unless there was a real error! (hence $debugMode) $bt = debug_backtrace(); $caller = $bt[1]; $file = basename($caller['file']); @@ -86,7 +86,7 @@ class Logging $logger = self::getLogger(); $logger->err(self::getLinePrefix(true) . self::toString($p_msg)); - //Escape the % symbols in any of our errors because Sentry chokes (vsprint formatting error). + // Escape the % symbols in any of our errors because Sentry chokes (vsprint formatting error). $msg = self::toString($p_msg); $msg = str_replace('%', '%%', $msg); } @@ -132,9 +132,9 @@ class Logging public static function loggingShutdownCallback() { - //Catch the types of errors that PHP doesn't normally let us catch and - //would otherwise log to the apache log. We route these to our Airtime log to improve the modularity - //and reliability of our error logging. (All errors are in one spot!) + // Catch the types of errors that PHP doesn't normally let us catch and + // would otherwise log to the apache log. We route these to our Airtime log to improve the modularity + // and reliability of our error logging. (All errors are in one spot!) $err = error_get_last(); if (!is_array($err) || !array_key_exists('type', $err)) { return; @@ -149,7 +149,7 @@ class Logging case E_CORE_WARNING: case E_COMPILE_ERROR: case E_COMPILE_WARNING: - //error_log("Oh noes, a fatal: " . var_export($err, true), 1, 'fatals@example.com'); + // error_log("Oh noes, a fatal: " . var_export($err, true), 1, 'fatals@example.com'); $errorStr = ''; if (array_key_exists('message', $err)) { $errorStr .= $err['message']; @@ -170,7 +170,7 @@ class Logging public static function setupParseErrorLogging() { - //Static callback: + // Static callback: register_shutdown_function('Logging::loggingShutdownCallback'); } } diff --git a/legacy/application/models/Block.php b/legacy/application/models/Block.php index 127a9c1d3..0f4512a96 100644 --- a/legacy/application/models/Block.php +++ b/legacy/application/models/Block.php @@ -32,7 +32,7 @@ class Application_Model_Block implements Application_Model_LibraryEditable 'crossfadeDuration' => 0, ]; - //using propel's phpNames. + // using propel's phpNames. private $categories = [ 'dc:title' => 'Name', 'dc:creator' => 'Creator', @@ -243,14 +243,14 @@ SQL; $offset -= $trackoffset; $offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset); - //format the length for UI. + // format the length for UI. $formatter = new LengthFormatter($row['length']); $row['length'] = $formatter->format(); $formatter = new LengthFormatter($offset_cliplength); $row['offset'] = $formatter->format(); - //format the fades in format 00(.0) + // format the fades in format 00(.0) $fades = $this->getFadeInfo($row['position']); $row['fadein'] = $fades[0]; $row['fadeout'] = $fades[1]; @@ -262,7 +262,7 @@ SQL; $row['cuein'] = str_pad(substr($row['cuein'], 0, 10), 10, '.0'); $row['cueout'] = str_pad(substr($row['cueout'], 0, 10), 10, '.0'); - //format original length + // format original length $formatter = new LengthFormatter($row['orig_length']); $row['orig_length'] = $formatter->format(); @@ -283,10 +283,10 @@ SQL; */ public function normalizeFade($fade) { - //First get rid of the first six characters 00:00: which will be added back later for db update + // First get rid of the first six characters 00:00: which will be added back later for db update $fade = substr($fade, 6); - //Second add .000000 if the fade does't have milliseconds format already + // Second add .000000 if the fade does't have milliseconds format already $dbFadeStrPos = strpos($fade, '.'); if ($dbFadeStrPos === false) { $fade .= '.000000'; @@ -296,7 +296,7 @@ SQL; } } - //done, just need to set back the formated values + // done, just need to set back the formated values return $fade; } @@ -463,11 +463,11 @@ SQL; Logging::info('Adding to block'); Logging::info("at position {$pos}"); } else { - //add to the end of the block + // add to the end of the block if ($addType == 'after') { $pos = $this->getSize(); } - //add to the beginning of the block. + // add to the beginning of the block. else { $pos = 0; @@ -488,7 +488,7 @@ SQL; } foreach ($p_items as $ac) { - //Logging::info("Adding audio file {$ac[0]}"); + // Logging::info("Adding audio file {$ac[0]}"); try { if (is_array($ac) && $ac[1] == 'audioclip') { $res = $this->insertBlockElement($this->buildEntry($ac[0], $pos)); @@ -511,7 +511,7 @@ SQL; } } - //reset the positions of the remaining items. + // reset the positions of the remaining items. for ($i = 0; $i < count($contentsToUpdate); ++$i) { $contentsToUpdate[$i]->setDbPosition($pos); $contentsToUpdate[$i]->save($this->con); @@ -556,7 +556,7 @@ SQL; ->find($this->con); $pos = 0; - //moving items to beginning of the block. + // moving items to beginning of the block. if (is_null($p_afterItem)) { Logging::info('moving items to beginning of block'); @@ -635,7 +635,7 @@ SQL; ->orderByDbPosition() ->find($this->con); - //reset the positions of the remaining items. + // reset the positions of the remaining items. for ($i = 0; $i < count($contents); ++$i) { $contents[$i]->setDbPosition($i); $contents[$i]->save($this->con); @@ -656,7 +656,7 @@ SQL; public function getFadeInfo($pos) { - //Logging::info("Getting fade info for pos {$pos}"); + // Logging::info("Getting fade info for pos {$pos}"); $row = CcBlockcontentsQuery::create() ->joinWith(CcFilesPeer::OM_CLASS) @@ -664,8 +664,8 @@ SQL; ->filterByDbPosition($pos) ->findOne(); - //Propel returns values in form 00.000000 format which is for only seconds. - //We only want to display 1 decimal + // Propel returns values in form 00.000000 format which is for only seconds. + // We only want to display 1 decimal $fadeIn = substr($row->getDbFadein(), 0, 4); $fadeOut = substr($row->getDbFadeout(), 0, 4); @@ -719,9 +719,9 @@ SQL; */ public function changeFadeInfo($id, $fadeIn, $fadeOut, $offset = null) { - //See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema - //For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against - //setting it to nonNull for checks down below + // See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema + // For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against + // setting it to nonNull for checks down below $fadeIn = $fadeIn ? '00:00:' . $fadeIn : $fadeIn; $fadeOut = $fadeOut ? '00:00:' . $fadeOut : $fadeOut; @@ -745,7 +745,7 @@ SQL; $result = Application_Common_Database::prepareAndExecute($sql, $params, 'column'); if ($result) { - //"Fade In can't be larger than overall playlength."; + // "Fade In can't be larger than overall playlength."; $fadeIn = $clipLength; } $row->setDbFadein($fadeIn); @@ -765,7 +765,7 @@ SQL; $result = Application_Common_Database::prepareAndExecute($sql, $params, 'column'); if ($result) { - //"Fade Out can't be larger than overall playlength."; + // "Fade Out can't be larger than overall playlength."; $fadeOut = $clipLength; } $row->setDbFadeout($fadeOut); @@ -1113,7 +1113,7 @@ SQL; false ); - //$this->block->reload(); + // $this->block->reload(); $this->block->setDbMtime(new DateTime('now', new DateTimeZone('UTC'))); $this->block->save($this->con); $this->con->commit(); @@ -1195,7 +1195,7 @@ SQL; // delete criteria under $p_blockId CcBlockcriteriaQuery::create()->findByDbBlockId($this->id)->delete(); // Logging::info($p_criteriaData); - //insert modifier rows + // insert modifier rows if (isset($p_criteriaData['criteria'])) { $critKeys = array_keys($p_criteriaData['criteria']); for ($i = 0; $i < count($critKeys); ++$i) { @@ -1612,7 +1612,7 @@ SQL; $qry = CcFilesQuery::create(); $qry->useFkOwnerQuery('subj', 'left join'); - //Logging::info($storedCrit); + // Logging::info($storedCrit); if (isset($storedCrit['crit'])) { foreach ($storedCrit['crit'] as $crit) { $i = 0; @@ -1630,7 +1630,7 @@ SQL; $column = CcFilesPeer::getTableMap()->getColumnByPhpName(self::$criteria2PeerMap[$spCriteria]); - //data should already be in UTC, do we have to do anything special here anymore? + // data should already be in UTC, do we have to do anything special here anymore? if ($column->getType() == PropelColumnTypes::TIMESTAMP) { $spCriteriaValue = $criteria['value']; diff --git a/legacy/application/models/Dashboard.php b/legacy/application/models/Dashboard.php index 3b1b313ec..a46295218 100644 --- a/legacy/application/models/Dashboard.php +++ b/legacy/application/models/Dashboard.php @@ -4,10 +4,10 @@ class Application_Model_Dashboard { 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 - //name. Else return the last item from the schedule. + // 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 + // name. Else return the last item from the schedule. $showInstance = Application_Model_ShowInstance::GetLastShowInstance($p_timeNow); $row = Application_Model_Schedule::GetLastScheduleItem($p_timeNow); @@ -23,7 +23,7 @@ class Application_Model_Dashboard } if (count($row) == 0) { if ($showInstance->isRecorded()) { - //last item is a show instance + // last item is a show instance return ['name' => $showInstance->getName(), 'starts' => $showInstance->getShowInstanceStart(), 'ends' => $showInstance->getShowInstanceEnd(), ]; @@ -31,7 +31,7 @@ class Application_Model_Dashboard return null; } - //return the one that started later. + // return the one that started later. if ($row[0]['starts'] >= $showInstance->getShowInstanceStart()) { return ['name' => $row[0]['artist_name'] . ' - ' . $row[0]['track_title'], 'starts' => $row[0]['starts'], @@ -45,10 +45,10 @@ class Application_Model_Dashboard 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 - //name. Else return the last item from the schedule. + // 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 + // name. Else return the last item from the schedule. $row = []; $showInstance = Application_Model_ShowInstance::GetCurrentShowInstance($p_timeNow); @@ -71,7 +71,7 @@ class Application_Model_Dashboard 'ends' => $row[0]['ends'], ]; } if (count($row) == 0) { - //last item is a show instance + // last item is a show instance if ($showInstance->isRecorded()) { return ['name' => $showInstance->getName(), 'starts' => $showInstance->getShowInstanceStart(), @@ -93,10 +93,10 @@ class Application_Model_Dashboard 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 - //name. Else return the last item from the schedule. + // 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 + // name. Else return the last item from the schedule. $showInstance = Application_Model_ShowInstance::GetNextShowInstance($p_timeNow); $row = Application_Model_Schedule::GetNextScheduleItem($p_timeNow); @@ -113,7 +113,7 @@ class Application_Model_Dashboard } if (count($row) == 0) { if ($showInstance->isRecorded()) { - //last item is a show instance + // last item is a show instance return ['name' => $showInstance->getName(), 'starts' => $showInstance->getShowInstanceStart(), 'ends' => $showInstance->getShowInstanceEnd(), ]; @@ -121,7 +121,7 @@ class Application_Model_Dashboard return null; } - //return the one that starts sooner. + // return the one that starts sooner. if ($row[0]['starts'] <= $showInstance->getShowInstanceStart()) { return ['name' => $row[0]['artist_name'] . ' - ' . $row[0]['track_title'], diff --git a/legacy/application/models/Datatables.php b/legacy/application/models/Datatables.php index 879b4af14..1d75913bb 100644 --- a/legacy/application/models/Datatables.php +++ b/legacy/application/models/Datatables.php @@ -74,7 +74,7 @@ class Application_Model_Datatables if (isset($data['advSearch']) && $data['advSearch'] === 'true') { $librarySetting = Application_Model_Preference::getCurrentLibraryTableColumnMap(); - //$displayColumns[] = 'owner'; + // $displayColumns[] = 'owner'; // map that maps original column position to db name $current2dbname = []; @@ -173,27 +173,27 @@ class Application_Model_Datatables $sql = $selectorRows . ' FROM ' . $fromTable . ' ORDER BY ' . $orderby; } - //limit the results returned. + // limit the results returned. if ($displayLength !== -1) { $sql .= ' OFFSET ' . $data['iDisplayStart'] . ' LIMIT ' . $displayLength; } try { - //Logging::info($sqlTotalRows); + // Logging::info($sqlTotalRows); $r = $con->query($sqlTotalRows); $totalRows = $r->fetchColumn(0); if (isset($sqlTotalDisplayRows)) { - //Logging::info("sql is set"); - //Logging::info($sqlTotalDisplayRows); + // Logging::info("sql is set"); + // Logging::info($sqlTotalDisplayRows); $totalDisplayRows = Application_Common_Database::prepareAndExecute($sqlTotalDisplayRows, $params, 'column'); } else { - //Logging::info("sql is not set."); + // Logging::info("sql is not set."); $totalDisplayRows = $totalRows; } - //TODO + // TODO if ($needToBind) { $results = Application_Common_Database::prepareAndExecute($sql, $params); } else { diff --git a/legacy/application/models/Library.php b/legacy/application/models/Library.php index d8b1f8560..882e09d7a 100644 --- a/legacy/application/models/Library.php +++ b/legacy/application/models/Library.php @@ -34,7 +34,7 @@ class Application_Model_Library public static function getPlaylistNames($alphasort = false) { $playlistNames = [null => _('None')]; - //if we want to return the playlists sorted alphabetically by name + // if we want to return the playlists sorted alphabetically by name if ($alphasort) { $playlists = CcPlaylistQuery::create() ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) diff --git a/legacy/application/models/ListenerStat.php b/legacy/application/models/ListenerStat.php index b189ddd0c..579ee4f18 100644 --- a/legacy/application/models/ListenerStat.php +++ b/legacy/application/models/ListenerStat.php @@ -72,8 +72,8 @@ SQL; if (isset($out[$enabledMountPoint])) { $enabledOut[$enabledMountPoint] = $out[$enabledMountPoint]; } else { - //TODO fix this hack (here for CC-5254) - //all shoutcast streams are automatically put under "shoutcast" mount point. + // TODO fix this hack (here for CC-5254) + // all shoutcast streams are automatically put under "shoutcast" mount point. if (isset($out['shoutcast'])) { $enabledOut['shoutcast'] = $out['shoutcast']; } @@ -183,9 +183,9 @@ SQL; ); if (strlen($mount_name_id) == 0) { - //there is a race condition here where theoretically the row - //with value "mount_name" could appear, but this is *very* - //unlikely and won't break anything even if it happens. + // there is a race condition here where theoretically the row + // with value "mount_name" could appear, but this is *very* + // unlikely and won't break anything even if it happens. $mount_name_id = Application_Common_Database::prepareAndExecute( $mount_name_insert_sql, ['mn' => $dp['mount_name']], diff --git a/legacy/application/models/LiveLog.php b/legacy/application/models/LiveLog.php index 534421622..56f196fae 100644 --- a/legacy/application/models/LiveLog.php +++ b/legacy/application/models/LiveLog.php @@ -96,7 +96,7 @@ class Application_Model_LiveLog ); } } - //Trim milliseconds + // Trim milliseconds $seconds = explode('.', $seconds); if (isset($seconds[0])) { $minutes = (float) (($hours * 60) + $minutes . '.' . $seconds[0]); @@ -197,7 +197,7 @@ class Application_Model_LiveLog * clip length. */ $clip_length = $track['clip_length']; - //Convert clip_length into seconds + // Convert clip_length into seconds $clip_length_intervals = explode(':', $clip_length); for ($i = 0; $i < count($clip_length_intervals); ++$i) { if (!isset($clip_length_intervals[$i])) { @@ -207,7 +207,7 @@ class Application_Model_LiveLog $clip_length_seconds = $clip_length_intervals[0] * 3600 + $clip_length_intervals[1] * 60 + $clip_length_intervals[2]; $extra_time = $extra_time->format('%H:%i:%s'); - //Convert extra_time into seconds; + // Convert extra_time into seconds; $extra_time_intervals = explode(':', $extra_time); for ($i = 0; $i < count($extra_time_intervals); ++$i) { if (!isset($extra_time_intervals[$i])) { @@ -218,7 +218,7 @@ class Application_Model_LiveLog $clip_length_seconds -= $extra_time_seconds; - //Convert new clip_length into "H-i-s" format + // Convert new clip_length into "H-i-s" format $clip_length_arr = []; if ($clip_length_seconds / 3600 >= 1) { array_push($clip_length_arr, str_pad(floor($clip_length_seconds / 3600), 2, '0', STR_PAD_LEFT)); @@ -267,7 +267,7 @@ class Application_Model_LiveLog } if (!$p_keepData) { - //Delete row because we do not need data anymore + // Delete row because we do not need data anymore $sql_delete = 'DELETE FROM CC_LIVE_LOG' . ' WHERE id = :id'; Application_Common_Database::prepareAndExecute( @@ -389,7 +389,7 @@ class Application_Model_LiveLog ); } - //If live broadcasting is off, turn scheduled play on + // If live broadcasting is off, turn scheduled play on $scheduled = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play'); if ($state == 'L' && $scheduled == 'on' && !$override) { self::SetNewLogTime('S', $dateTime); diff --git a/legacy/application/models/Locale.php b/legacy/application/models/Locale.php index 8ef28e58f..3c68f296a 100644 --- a/legacy/application/models/Locale.php +++ b/legacy/application/models/Locale.php @@ -42,10 +42,10 @@ final class Application_Model_Locale } else { $lang = $locale . '.' . $codeset; } - //putenv("LC_ALL=$lang"); - //putenv("LANG=$lang"); - //Setting the LANGUAGE env var supposedly lets gettext search inside our locale dir even if the system - //doesn't have the particular locale that we want installed. This doesn't actually seem to work though. -- Albert + // putenv("LC_ALL=$lang"); + // putenv("LANG=$lang"); + // Setting the LANGUAGE env var supposedly lets gettext search inside our locale dir even if the system + // doesn't have the particular locale that we want installed. This doesn't actually seem to work though. -- Albert putenv("LANGUAGE={$locale}"); if (setlocale(LC_MESSAGES, $lang) === false) { Logging::warn('Your system does not have the ' . $lang . ' locale installed. Run: sudo locale-gen ' . $lang); diff --git a/legacy/application/models/MusicDir.php b/legacy/application/models/MusicDir.php index 3f9fc9d75..1ab002e0b 100644 --- a/legacy/application/models/MusicDir.php +++ b/legacy/application/models/MusicDir.php @@ -117,7 +117,7 @@ SQL; } else { self::setExistsFlag(false); } - //$res = $this->_dir->delete(); + // $res = $this->_dir->delete(); foreach ($show_instances as $show_instance_row) { $temp_show = new Application_Model_ShowInstance($show_instance_row['instance_id']); @@ -271,19 +271,19 @@ SQL; return $res; } - //convert "linked" files (Airtime <= 1.8.2) to watched files. + // convert "linked" files (Airtime <= 1.8.2) to watched files. $propel_link_dir = CcMusicDirsQuery::create() ->filterByType('link') ->findOne(); - //see if any linked files exist. + // see if any linked files exist. if (isset($propel_link_dir)) { - //newly added watched directory object + // newly added watched directory object $propel_new_watch = CcMusicDirsQuery::create() ->filterByDirectory(Application_Common_OsPath::normpath($p_path) . '/') ->findOne(); - //any files of the deprecated "link" type. + // any files of the deprecated "link" type. $link_files = CcFilesQuery::create() ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) ->filterByDbDirectory($propel_link_dir->getId()) @@ -294,9 +294,9 @@ SQL; foreach ($link_files as $link_file) { $link_filepath = $link_file->getDbFilepath(); - //convert "link" file into a watched file. + // convert "link" file into a watched file. if ((strlen($newly_watched_dir) < strlen($link_filepath)) && (substr($link_filepath, 0, strlen($newly_watched_dir)) === $newly_watched_dir)) { - //get the filepath path not including the watched directory. + // get the filepath path not including the watched directory. $sub_link_filepath = substr($link_filepath, strlen($newly_watched_dir)); $link_file->setDbDirectory($propel_new_watch->getId()); @@ -433,7 +433,7 @@ SQL; */ public static function removeWatchedDir($p_dir, $userAddedWatchedDir = true) { - //make sure that $p_dir has a trailing "/" + // make sure that $p_dir has a trailing "/" $real_path = Application_Common_OsPath::normpath($p_dir) . '/'; if ($real_path != '/') { $p_dir = $real_path; diff --git a/legacy/application/models/Playlist.php b/legacy/application/models/Playlist.php index 18d11fd1f..217473541 100644 --- a/legacy/application/models/Playlist.php +++ b/legacy/application/models/Playlist.php @@ -39,7 +39,7 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable 'crossfadeDuration' => 0, ]; - //using propel's phpNames. + // using propel's phpNames. private $categories = [ 'dc:title' => 'Name', 'dc:creator' => 'Creator', @@ -132,8 +132,8 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable public function getLastModified($format = null) { - //Logging::info($this->pl->getDbMtime($format)); - //Logging::info($this->pl); + // Logging::info($this->pl->getDbMtime($format)); + // Logging::info($this->pl); return $this->pl->getDbMtime($format); } @@ -227,7 +227,7 @@ SQL; AND pc.TYPE = 2)) AS temp ORDER BY temp.position; SQL; - //Logging::info($sql); + // Logging::info($sql); $params = [ ':playlist_id1' => $this->id, ':playlist_id2' => $this->id, ':playlist_id3' => $this->id, ]; @@ -239,7 +239,7 @@ SQL; $offset = 0; foreach ($rows as &$row) { - //Logging::info($row); + // Logging::info($row); $clipSec = Application_Common_DateHelper::playlistTimeToSeconds($row['length']); $row['trackSec'] = $clipSec; @@ -252,7 +252,7 @@ SQL; $offset -= $trackoffset; $offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset); - //format the length for UI. + // format the length for UI. if ($row['type'] == 2) { $bl = new Application_Model_Block($row['item_id']); $formatter = new LengthFormatter($bl->getLength()); @@ -264,7 +264,7 @@ SQL; $formatter = new LengthFormatter($offset_cliplength); $row['offset'] = $formatter->format(); - //format the fades in format 00(.000000) + // format the fades in format 00(.000000) $fades = $this->getFadeInfo($row['position']); $row['fadein'] = $fades[0] ?? null; $row['fadeout'] = $fades[1] ?? null; @@ -276,7 +276,7 @@ SQL; $row['cuein'] = str_pad(substr($row['cuein'], 0, 10), 10, '.0'); $row['cueout'] = str_pad(substr($row['cueout'], 0, 10), 10, '.0'); - //format original length + // format original length $formatter = new LengthFormatter($row['orig_length']); $row['orig_length'] = $formatter->format(); @@ -297,10 +297,10 @@ SQL; */ public function normalizeFade($fade) { - //First get rid of the first six characters 00:00: which will be added back later for db update + // First get rid of the first six characters 00:00: which will be added back later for db update $fade = substr($fade, 6); - //Second add .000000 if the fade does't have milliseconds format already + // Second add .000000 if the fade does't have milliseconds format already $dbFadeStrPos = strpos($fade, '.'); if ($dbFadeStrPos === false) { $fade .= '.000000'; @@ -310,7 +310,7 @@ SQL; } } - //done, just need to set back the formated values + // done, just need to set back the formated values return $fade; } @@ -334,7 +334,7 @@ SQL; return Application_Common_Database::prepareAndExecute($sql, [':playlist_id' => $this->id]); } - //aggregate column on playlistcontents cliplength column. + // aggregate column on playlistcontents cliplength column. public function getLength() { if ($this->hasDynamicBlock()) { @@ -467,11 +467,11 @@ SQL; ->orderByDbPosition() ->find($this->con); } else { - //add to the end of the playlist + // add to the end of the playlist if ($addType == 'after') { $pos = $this->getSize(); } - //add to the beginning of the playlist. + // add to the beginning of the playlist. else { $pos = 0; @@ -500,7 +500,7 @@ SQL; $pos = $pos + 1; } - //reset the positions of the remaining items. + // reset the positions of the remaining items. for ($i = 0; $i < count($contentsToUpdate); ++$i) { $contentsToUpdate[$i]->setDbPosition($pos); $contentsToUpdate[$i]->save($this->con); @@ -543,7 +543,7 @@ SQL; ->find($this->con); $pos = 0; - //moving items to beginning of the playlist. + // moving items to beginning of the playlist. if (is_null($p_afterItem)) { Logging::info('moving items to beginning of playlist'); @@ -622,7 +622,7 @@ SQL; ->orderByDbPosition() ->find($this->con); - //reset the positions of the remaining items. + // reset the positions of the remaining items. for ($i = 0; $i < count($contents); ++$i) { $contents[$i]->setDbPosition($i); $contents[$i]->save($this->con); @@ -650,8 +650,8 @@ SQL; if (!$row) { return null; } - //Propel returns values in form 00.000000 format which is for only seconds. - //We only want to display 1 decimal + // Propel returns values in form 00.000000 format which is for only seconds. + // We only want to display 1 decimal $fadeIn = substr($row->getDbFadein(), 0, 4); $fadeOut = substr($row->getDbFadeout(), 0, 4); @@ -704,9 +704,9 @@ SQL; */ public function changeFadeInfo($id, $fadeIn, $fadeOut, $offset = null) { - //See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema - //For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against - //setting it to nonNull for checks down below + // See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema + // For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against + // setting it to nonNull for checks down below $fadeIn = $fadeIn ? '00:00:' . $fadeIn : $fadeIn; $fadeOut = $fadeOut ? '00:00:' . $fadeOut : $fadeOut; @@ -723,7 +723,7 @@ SQL; if (!is_null($fadeIn)) { $sql = "SELECT :fadein::INTERVAL > INTERVAL '{$clipLength}'"; if (Application_Common_Database::prepareAndExecute($sql, [':fadein' => $fadeIn], 'column')) { - //"Fade In can't be larger than overall playlength."; + // "Fade In can't be larger than overall playlength."; $fadeIn = $clipLength; } $row->setDbFadein($fadeIn); @@ -736,7 +736,7 @@ SQL; if (!is_null($fadeOut)) { $sql = "SELECT :fadeout::INTERVAL > INTERVAL '{$clipLength}'"; if (Application_Common_Database::prepareAndExecute($sql, [':fadeout' => $fadeOut], 'column')) { - //Fade Out can't be larger than overall playlength."; + // Fade Out can't be larger than overall playlength."; $fadeOut = $clipLength; } $row->setDbFadeout($fadeOut); @@ -1118,16 +1118,16 @@ SQL; */ public function containsMissingFiles() { - $playlistContents = $this->pl->getCcPlaylistcontentss('type = 0'); //type=0 is only files, not other types of media + $playlistContents = $this->pl->getCcPlaylistcontentss('type = 0'); // type=0 is only files, not other types of media - //Slightly faster than the other Propel version below (this one does an INNER JOIN): + // Slightly faster than the other Propel version below (this one does an INNER JOIN): $missingFiles = CcFilesQuery::create() ->join('CcFiles.CcPlaylistcontents') ->where('CcPlaylistcontents.DbPlaylistId = ?', $this->pl->getDbId()) ->where('CcFiles.DbFileExists = ?', 'false') ->find(); - //Nicer Propel version but slightly slower because it generates a LEFT JOIN: + // Nicer Propel version but slightly slower because it generates a LEFT JOIN: /* $missingFiles = CcPlaylistcontentsQuery::create() ->filterByDbPlaylistId($this->pl->getDbId()) diff --git a/legacy/application/models/Preference.php b/legacy/application/models/Preference.php index 18761c215..82af5caef 100644 --- a/legacy/application/models/Preference.php +++ b/legacy/application/models/Preference.php @@ -4,8 +4,8 @@ class Application_Model_Preference { private static function getUserId() { - //pass in true so the check is made with the autoloader - //we need this check because saas calls this function from outside Zend + // pass in true so the check is made with the autoloader + // we need this check because saas calls this function from outside Zend if (!class_exists('Zend_Session', true) || !Zend_Session::isStarted() || !class_exists('Zend_Auth', true) || !Zend_Auth::getInstance()->hasIdentity()) { $userId = null; } else { @@ -25,8 +25,8 @@ class Application_Model_Preference { $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME); - //We are using row-level locking in Postgres via "FOR UPDATE" instead of a transaction here - //because sometimes this function needs to be called while a transaction is already started. + // We are using row-level locking in Postgres via "FOR UPDATE" instead of a transaction here + // because sometimes this function needs to be called while a transaction is already started. try { /* Comment this out while we reevaluate it in favor of a unique constraint @@ -37,14 +37,14 @@ class Application_Model_Preference throw new Exception("User id can't be null for a user preference {$key}."); } - //Check if key already exists + // Check if key already exists $sql = 'SELECT valstr FROM cc_pref' . ' WHERE keystr = :key'; $paramMap = []; $paramMap[':key'] = $key; - //For user specific preference, check if id matches as well + // For user specific preference, check if id matches as well if ($isUserValue) { $sql .= ' AND subjid = :id'; $paramMap[':id'] = $userId; @@ -62,7 +62,7 @@ class Application_Model_Preference $paramMap = []; if ($result > 1) { - //this case should not happen. + // this case should not happen. throw new Exception('Invalid number of results returned. Should be ' . "0 or 1, but is '{$result}' instead"); } @@ -148,21 +148,21 @@ class Application_Model_Preference try { $userId = null; if ($isUserValue) { - //This is nested in here because so we can still use getValue() when the session hasn't started yet. + // This is nested in here because so we can still use getValue() when the session hasn't started yet. $userId = self::getUserId(); if (is_null($userId)) { throw new Exception("User id can't be null for a user preference."); } } - //Check if key already exists + // Check if key already exists $sql = 'SELECT COUNT(*) FROM cc_pref' . ' WHERE keystr = :key'; $paramMap = []; $paramMap[':key'] = $key; - //For user specific preference, check if id matches as well + // For user specific preference, check if id matches as well if ($isUserValue) { $sql .= ' AND subjid = :id'; $paramMap[':id'] = $userId; @@ -172,7 +172,7 @@ class Application_Model_Preference $result = Application_Common_Database::prepareAndExecute($sql, $paramMap, Application_Common_Database::COLUMN); - //return an empty string if the result doesn't exist. + // return an empty string if the result doesn't exist. if ($result == 0) { $res = ''; } else { @@ -182,7 +182,7 @@ class Application_Model_Preference $paramMap = []; $paramMap[':key'] = $key; - //For user specific preference, check if id matches as well + // For user specific preference, check if id matches as well if ($isUserValue) { $sql .= ' AND subjid = :id'; $paramMap[':id'] = $userId; @@ -218,9 +218,9 @@ class Application_Model_Preference // in case this is called from airtime-saas script if ($view !== null) { - //set session variable to new station name so that html title is updated. - //should probably do this in a view helper to keep this controller as minimal as possible. - $view->headTitle()->exchangeArray([]); //clear headTitle ArrayObject + // set session variable to new station name so that html title is updated. + // should probably do this in a view helper to keep this controller as minimal as possible. + $view->headTitle()->exchangeArray([]); // clear headTitle ArrayObject $view->headTitle(self::GetHeadTitle()); } @@ -811,7 +811,7 @@ class Application_Model_Preference { self::setValue('num_of_streams', intval($num)); - //Enable or disable each stream according to whatever was just changed. + // Enable or disable each stream according to whatever was just changed. for ($streamIdx = 1; $streamIdx <= MAX_NUM_STREAMS; ++$streamIdx) { $prefix = 's' . $streamIdx . '_'; $enable = 'false'; @@ -819,7 +819,7 @@ class Application_Model_Preference $enable = 'true'; } - //Enable or disable the stream in the Stream Settings DB table. + // Enable or disable the stream in the Stream Settings DB table. Application_Model_StreamSetting::setIndividualStreamSetting([$prefix . 'enable' => $enable]); } } @@ -855,16 +855,16 @@ class Application_Model_Preference public static function GetSchemaVersion() { - CcPrefPeer::clearInstancePool(); //Ensure we don't get a cached Propel object (cached DB results) - //because we're updating this version number within this HTTP request as well. + CcPrefPeer::clearInstancePool(); // Ensure we don't get a cached Propel object (cached DB results) + // because we're updating this version number within this HTTP request as well. - //New versions use schema_version + // New versions use schema_version $pref = CcPrefQuery::create() ->filterByKeystr('schema_version') ->findOne(); if (empty($pref)) { - //Pre-2.5.2 releases all used this ambiguous "system_version" key to represent both the code and schema versions... + // Pre-2.5.2 releases all used this ambiguous "system_version" key to represent both the code and schema versions... $pref = CcPrefQuery::create() ->filterByKeystr('system_version') ->findOne(); diff --git a/legacy/application/models/RabbitMq.php b/legacy/application/models/RabbitMq.php index d8c47038c..ce17c01a5 100644 --- a/legacy/application/models/RabbitMq.php +++ b/legacy/application/models/RabbitMq.php @@ -37,8 +37,8 @@ class Application_Model_RabbitMq true ); - //I'm pretty sure we DON'T want to autodelete ANY exchanges but I'm keeping the code - //the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014 + // I'm pretty sure we DON'T want to autodelete ANY exchanges but I'm keeping the code + // the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014 $channel->exchange_declare($exchange, $exchangeType, false, true, $autoDeleteExchange); $msg = new \PhpAmqpLib\Message\AMQPMessage($data, ['content_type' => 'text/plain']); @@ -70,8 +70,8 @@ class Application_Model_RabbitMq { $exchange = 'airtime-pypo'; - $now = new DateTime('@' . time()); //in UTC timezone - $end_timestamp = new DateTime('@' . (time() + 3600 * 2)); //in UTC timezone + $now = new DateTime('@' . time()); // in UTC timezone + $end_timestamp = new DateTime('@' . (time() + 3600 * 2)); // in UTC timezone $temp = []; $temp['event_type'] = $event_type; @@ -126,7 +126,7 @@ class Application_Model_RabbitMq $data['file_prefix'] = $filePrefix; $jsonData = json_encode($data); - //self::sendMessage($exchange, 'topic', false, $jsonData, 'airtime-uploads'); + // self::sendMessage($exchange, 'topic', false, $jsonData, 'airtime-uploads'); if (!isset($conn)) { throw new Exception('Cannot connect to RabbitMQ server'); @@ -141,8 +141,8 @@ class Application_Model_RabbitMq true ); - //I'm pretty sure we DON'T want to autodelete ANY exchanges but I'm keeping the code - //the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014 + // I'm pretty sure we DON'T want to autodelete ANY exchanges but I'm keeping the code + // the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014 $channel->exchange_declare($exchange, $exchangeType, false, true, $autoDeleteExchange); $msg = new \PhpAmqpLib\Message\AMQPMessage($jsonData, ['content_type' => 'text/plain']); diff --git a/legacy/application/models/Schedule.php b/legacy/application/models/Schedule.php index a99ebfe95..6ece0318f 100644 --- a/legacy/application/models/Schedule.php +++ b/legacy/application/models/Schedule.php @@ -94,7 +94,7 @@ SQL; */ public static function GetPlayOrderRange($utcTimeEnd = null, $showsToRetrieve = 5) { - //Everything in this function must be done in UTC. You will get a swift kick in the pants if you mess that up. + // Everything in this function must be done in UTC. You will get a swift kick in the pants if you mess that up. // when timeEnd is unspecified, return to the default behaviour - set a range of 48 hours from current time if (!$utcTimeEnd) { @@ -120,13 +120,13 @@ SQL; 'schedulerTime' => $utcNow->format(DEFAULT_TIMESTAMP_FORMAT), 'source_enabled' => $source, ], - //Previous, current, next songs! + // Previous, current, next songs! 'tracks' => [ 'previous' => $results['previous'], 'current' => $results['current'], 'next' => $results['next'], ], - //Current and next shows + // Current and next shows 'shows' => [ 'previous' => $shows['previousShow'], 'current' => $shows['currentShow'], @@ -154,11 +154,11 @@ SQL; return [ 'env' => APPLICATION_ENV, 'schedulerTime' => $utcNow->format(DEFAULT_TIMESTAMP_FORMAT), - //Previous, current, next songs! + // Previous, current, next songs! 'previous' => $results['previous'] != null ? $results['previous'] : (count($shows['previousShow']) > 0 ? $shows['previousShow'][0] : null), 'current' => $results['current'] != null ? $results['current'] : ((count($shows['currentShow']) > 0 && $shows['currentShow'][0]['record'] == 1) ? $shows['currentShow'][0] : null), 'next' => $results['next'] != null ? $results['next'] : (count($shows['nextShow']) > 0 ? $shows['nextShow'][0] : null), - //Current and next shows + // Current and next shows 'currentShow' => $shows['currentShow'], 'nextShow' => $shows['nextShow'], 'source_enabled' => $source, @@ -179,7 +179,7 @@ SQL; */ public static function getPreviousCurrentNextMedia($utcNow, $currentShowInstanceId, $source) { - $timeZone = new DateTimeZone('UTC'); //This function works entirely in UTC. + $timeZone = new DateTimeZone('UTC'); // This function works entirely in UTC. assert(get_class($utcNow) === 'DateTime'); assert($utcNow->getTimeZone() == $timeZone); @@ -404,7 +404,7 @@ SQL; . ' LEFT JOIN cc_show_instances sit' . ' ON st.instance_id = sit.id' . ' WHERE st.starts > TIMESTAMP :timeNow' - . ' AND st.starts >= sit.starts' //this and the next line are necessary since we can overbook shows. + . ' AND st.starts >= sit.starts' // this and the next line are necessary since we can overbook shows. . ' AND st.starts < sit.ends' . ' ORDER BY st.starts' . ' LIMIT 1'; @@ -426,8 +426,8 @@ SQL; $p_start_str = $p_start->format(DEFAULT_TIMESTAMP_FORMAT); $p_end_str = $p_end->format(DEFAULT_TIMESTAMP_FORMAT); - //We need to search 48 hours before and after the show times so that that we - //capture all of the show's contents. + // We need to search 48 hours before and after the show times so that that we + // capture all of the show's contents. $p_track_start = $p_start->sub(new DateInterval('PT48H'))->format(DEFAULT_TIMESTAMP_FORMAT); $p_track_end = $p_end->add(new DateInterval('PT48H'))->format(DEFAULT_TIMESTAMP_FORMAT); @@ -921,7 +921,7 @@ SQL; $start = self::AirtimeTimeToPypoTime($item['start']); $end = self::AirtimeTimeToPypoTime($item['end']); - //create an event to start stream buffering 5 seconds ahead of the streams actual time. + // create an event to start stream buffering 5 seconds ahead of the streams actual time. $buffer_start = new DateTime($item['start'], new DateTimeZone('UTC')); $buffer_start->sub(new DateInterval('PT5S')); @@ -950,8 +950,8 @@ SQL; ]; self::appendScheduleItem($data, $start, $schedule_item); - //since a stream never ends we have to insert an additional "kick stream" event. The "start" - //time of this event is the "end" time of the stream minus 1 second. + // since a stream never ends we have to insert an additional "kick stream" event. The "start" + // time of this event is the "end" time of the stream minus 1 second. $dt = new DateTime($item['end'], new DateTimeZone('UTC')); $dt->sub(new DateInterval('PT1S')); @@ -997,7 +997,7 @@ SQL; $cache_ahead_hours = $CC_CONFIG['cache_ahead_hours']; if (is_numeric($cache_ahead_hours)) { - //make sure we are not dealing with a float + // make sure we are not dealing with a float $cache_ahead_hours = intval($cache_ahead_hours); } else { $cache_ahead_hours = 1; @@ -1024,7 +1024,7 @@ SQL; $trackEndDateTime = new DateTime($item['end'], $utcTimeZone); if ($trackStartDateTime->getTimestamp() > $showEndDateTime->getTimestamp()) { - //do not send any tracks that start past their show's end time + // do not send any tracks that start past their show's end time continue; } @@ -1036,29 +1036,29 @@ SQL; } if (!is_null($item['file_id'])) { - //row is from "file" + // row is from "file" $media_id = $item['file_id']; $storedFile = Application_Model_StoredFile::RecallById($media_id); $file = $storedFile->getPropelOrm(); - //Even local files are downloaded through the REST API in case we need to transform - //their filenames (eg. in the case of a bad file extension, because Liquidsoap won't play them) + // Even local files are downloaded through the REST API in case we need to transform + // their filenames (eg. in the case of a bad file extension, because Liquidsoap won't play them) $uri = Application_Common_HTTPHelper::getStationUrl() . 'rest/media/' . $media_id; - //$uri = $file->getAbsoluteFilePath(); + // $uri = $file->getAbsoluteFilePath(); $filesize = $file->getFileSize(); self::createFileScheduleEvent($data, $item, $media_id, $uri, $filesize); } elseif (!is_null($item['stream_id'])) { - //row is type "webstream" + // row is type "webstream" $media_id = $item['stream_id']; $uri = $item['url']; self::createStreamScheduleEvent($data, $item, $media_id, $uri); } - //throw new Exception("Unknown schedule type: ".print_r($item, true)); - //It's currently possible (and normal) to get cc_schedule rows without - //a file_id or stream_id. If you're using linked shows, placeholder rows can be put - //in the schedule when you cancel a track or delete stuff, so we should not throw an exception - //here and instead just ignore it. + // throw new Exception("Unknown schedule type: ".print_r($item, true)); + // It's currently possible (and normal) to get cc_schedule rows without + // a file_id or stream_id. If you're using linked shows, placeholder rows can be put + // in the schedule when you cancel a track or delete stuff, so we should not throw an exception + // here and instead just ignore it. } } @@ -1122,8 +1122,8 @@ SQL; public static function getSchedule($p_fromDateTime = null, $p_toDateTime = null) { - //generate repeating shows if we are fetching the schedule - //for days beyond the shows_populated_until value in cc_pref + // generate repeating shows if we are fetching the schedule + // for days beyond the shows_populated_until value in cc_pref $needScheduleUntil = $p_toDateTime; if (is_null($needScheduleUntil)) { $needScheduleUntil = new DateTime('now', new DateTimeZone('UTC')); @@ -1135,12 +1135,12 @@ SQL; $data = []; $data['media'] = []; - //Harbor kick times *MUST* be ahead of schedule events, so that pypo - //executes them first. + // Harbor kick times *MUST* be ahead of schedule events, so that pypo + // executes them first. self::createInputHarborKickTimes($data, $range_start, $range_end); self::createScheduledEvents($data, $range_start, $range_end); - //self::foldData($data["media"]); + // self::foldData($data["media"]); return $data; } @@ -1167,7 +1167,7 @@ SQL; $instanceId = null, $showId = null ) { - //if the show instance does not exist or was deleted, return false + // if the show instance does not exist or was deleted, return false if (!is_null($showId)) { $ccShowInstance = CcShowInstancesQuery::create() ->filterByDbShowId($showId) diff --git a/legacy/application/models/Scheduler.php b/legacy/application/models/Scheduler.php index 5a21a014f..8f628e8eb 100644 --- a/legacy/application/models/Scheduler.php +++ b/legacy/application/models/Scheduler.php @@ -11,7 +11,7 @@ final class Application_Model_Scheduler 'fadein' => '00:00:00', 'fadeout' => '00:00:00', 'sched_id' => null, - 'type' => 0, //default type of '0' to represent files. type '1' represents a webstream + 'type' => 0, // default type of '0' to represent files. type '1' represents a webstream ]; private $epochNow; @@ -27,10 +27,10 @@ final class Application_Model_Scheduler { $this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); - //subtracting one because sometimes when we cancel a track, we set its end time - //to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled - //track can still be included in the new schedule because it may have a few ms left to play. - //subtracting 1 second from epochNow resolves this issue. + // subtracting one because sometimes when we cancel a track, we set its end time + // to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled + // track can still be included in the new schedule because it may have a few ms left to play. + // subtracting 1 second from epochNow resolves this issue. $this->epochNow = microtime(true) - 1; $this->nowDT = DateTime::createFromFormat('U.u', $this->epochNow, new DateTimeZone('UTC')); @@ -66,7 +66,7 @@ final class Application_Model_Scheduler $ccShowInstance = CcShowInstancesQuery::create() ->findPk($sourceInstanceId); - //does the item being moved belong to a linked show + // does the item being moved belong to a linked show $isSourceLinked = $ccShowInstance->getCcShow()->isLinked(); if ($isDestinationLinked && !$isSourceLinked) { @@ -88,7 +88,7 @@ final class Application_Model_Scheduler */ private function validateRequest($items, $addRemoveAction = false, $cancelShow = false) { - //$items is where tracks get inserted (they are schedule locations) + // $items is where tracks get inserted (they are schedule locations) $nowEpoch = floatval($this->nowDT->format('U.u')); @@ -98,13 +98,13 @@ final class Application_Model_Scheduler for ($i = 0; $i < count($items); ++$i) { $id = $items[$i]['id']; - //could be added to the beginning of a show, which sends id = 0; + // could be added to the beginning of a show, which sends id = 0; if ($id > 0) { - //schedule_id of where we are inserting after? + // schedule_id of where we are inserting after? $schedInfo[$id] = $items[$i]['instance']; } - //format is instance_id => timestamp + // format is instance_id => timestamp $instanceInfo[$items[$i]['instance']] = $items[$i]['timestamp']; } @@ -120,12 +120,12 @@ final class Application_Model_Scheduler $instanceIds = array_keys($instanceInfo); $showInstances = CcShowInstancesQuery::create()->findPKs($instanceIds, $this->con); - //an item has been deleted + // an item has been deleted if (count($schedIds) !== count($schedItems)) { throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (sched mismatch)")); } - //a show has been deleted + // a show has been deleted if (count($instanceIds) !== count($showInstances)) { throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (instance mismatch)")); } @@ -175,8 +175,8 @@ final class Application_Model_Scheduler if ($addRemoveAction && !$cancelShow) { $ccShow = $instance->getCcShow(); if ($ccShow->isLinked()) { - //get all the linked shows instances and check if - //any of them are currently playing + // get all the linked shows instances and check if + // any of them are currently playing $ccShowInstances = $ccShow->getCcShowInstancess(); $timeNowUTC = gmdate(DEFAULT_TIMESTAMP_FORMAT); foreach ($ccShowInstances as $ccShowInstance) { @@ -237,7 +237,7 @@ final class Application_Model_Scheduler $data['cuein'] = $file->getDbCuein(); $data['cueout'] = $file->getDbCueout(); - //fade is in format SS.uuuuuu + // fade is in format SS.uuuuuu $data['fadein'] = Application_Model_Preference::GetDefaultFadeIn(); $data['fadeout'] = Application_Model_Preference::GetDefaultFadeOut(); @@ -262,8 +262,8 @@ final class Application_Model_Scheduler $data['cliplength'] = $plItem['length']; $data['cuein'] = $plItem['cuein']; $data['cueout'] = $plItem['cueout']; - $data['fadein'] = '00.500000'; //$plItem['fadein']; - $data['fadeout'] = '00.500000'; //$plItem['fadeout']; + $data['fadein'] = '00.500000'; // $plItem['fadein']; + $data['fadeout'] = '00.500000'; // $plItem['fadeout']; $data['type'] = 1; $files[] = $data; } elseif ($plItem['type'] == 2) { @@ -296,7 +296,7 @@ final class Application_Model_Scheduler $cueout = Application_Common_DateHelper::calculateLengthInSeconds($data['cueout']); $data['cliplength'] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); - //fade is in format SS.uuuuuu + // fade is in format SS.uuuuuu $data['fadein'] = $defaultFadeIn; $data['fadeout'] = $defaultFadeOut; @@ -311,7 +311,7 @@ final class Application_Model_Scheduler $showLimit -= $this->timeLengthOfFiles($files); } } elseif ($type == 'stream') { - //need to return + // need to return $stream = CcWebstreamQuery::create()->findPK($id, $this->con); if (is_null($stream) /* || !$file->visible() */) { @@ -323,7 +323,7 @@ final class Application_Model_Scheduler $data['cueout'] = $stream->getDbLength(); $data['type'] = 1; - //fade is in format SS.uuuuuu + // fade is in format SS.uuuuuu $data['fadein'] = Application_Model_Preference::GetDefaultFadeIn(); $data['fadeout'] = Application_Model_Preference::GetDefaultFadeOut(); @@ -357,7 +357,7 @@ final class Application_Model_Scheduler $cueout = Application_Common_DateHelper::calculateLengthInSeconds($data['cueout']); $data['cliplength'] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); - //fade is in format SS.uuuuuu + // fade is in format SS.uuuuuu $data['fadein'] = $defaultFadeIn; $data['fadeout'] = $defaultFadeOut; @@ -382,14 +382,14 @@ final class Application_Model_Scheduler { $startEpoch = $p_startDT->format('U.u'); - //add two float numbers to 6 subsecond precision - //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. + // add two float numbers to 6 subsecond precision + // DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. $newEpoch = bcsub($startEpoch, (string) $p_seconds, 6); $dt = DateTime::createFromFormat('U.u', $newEpoch, new DateTimeZone('UTC')); if ($dt === false) { - //PHP 5.3.2 problem + // PHP 5.3.2 problem $dt = DateTime::createFromFormat('U', intval($newEpoch), new DateTimeZone('UTC')); } @@ -401,14 +401,14 @@ final class Application_Model_Scheduler $startEpoch = $p_startDT->format('U.u'); $endEpoch = $p_endDT->format('U.u'); - //add two float numbers to 6 subsecond precision - //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. + // add two float numbers to 6 subsecond precision + // DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. $newEpoch = bcsub($endEpoch, (string) $startEpoch, 6); $dt = DateTime::createFromFormat('U.u', $newEpoch, new DateTimeZone('UTC')); if ($dt === false) { - //PHP 5.3.2 problem + // PHP 5.3.2 problem $dt = DateTime::createFromFormat('U', intval($newEpoch), new DateTimeZone('UTC')); } @@ -427,14 +427,14 @@ final class Application_Model_Scheduler $startEpoch = $p_startDT->format('U.u'); $durationSeconds = Application_Common_DateHelper::playlistTimeToSeconds($p_duration); - //add two float numbers to 6 subsecond precision - //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. + // add two float numbers to 6 subsecond precision + // DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. $endEpoch = bcadd($startEpoch, (string) $durationSeconds, 6); $dt = DateTime::createFromFormat('U.u', $endEpoch, new DateTimeZone('UTC')); if ($dt === false) { - //PHP 5.3.2 problem + // PHP 5.3.2 problem $dt = DateTime::createFromFormat('U', intval($endEpoch), new DateTimeZone('UTC')); } @@ -448,17 +448,17 @@ final class Application_Model_Scheduler $sEpoch = $DT->format('U.u'); $nEpoch = $this->epochNow; - //check for if the show has started. + // check for if the show has started. if (bccomp($nEpoch, $sEpoch, 6) === 1) { $this->applyCrossfades = false; - //need some kind of placeholder for cc_schedule. - //playout_status will be -1. + // need some kind of placeholder for cc_schedule. + // playout_status will be -1. $nextDT = $this->nowDT; $length = bcsub($nEpoch, $sEpoch, 6); $cliplength = Application_Common_DateHelper::secondsToPlaylistTime($length); - //fillers are for only storing a chunk of time space that has already passed. + // fillers are for only storing a chunk of time space that has already passed. $filler = new CcSchedule(); $filler->setDbStarts($DT) ->setDbEnds($this->nowDT) @@ -575,9 +575,9 @@ final class Application_Model_Scheduler ->find($this->con); foreach ($schedule as $item) { - //START OF TIME RECALC HACK + // START OF TIME RECALC HACK - //TODO: Copy the cue in, cue out, and track length from the cc_files table + // TODO: Copy the cue in, cue out, and track length from the cc_files table $file = $item->getCcFiles($this->con); if (!$file) { continue; @@ -589,13 +589,13 @@ final class Application_Model_Scheduler $cueIn = new DateTime($file->getDbCueIn()); $clipLength = $this->findTimeDifference2($cueIn, $cueOut); - //The clip length is supposed to be cue out - cue in: - //FIXME: How do we correctly do time arithmetic in PHP without losing the millseconds? + // The clip length is supposed to be cue out - cue in: + // FIXME: How do we correctly do time arithmetic in PHP without losing the millseconds? $item->setDbClipLength($clipLength->format(DEFAULT_INTERVAL_FORMAT)); $item->save($this->con); - //Ensure we don't get cached results + // Ensure we don't get cached results CcSchedulePeer::clearInstancePool(); - //END OF TIME RECALC HACK + // END OF TIME RECALC HACK $itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength()); $item->setDbStarts($itemStartDT) @@ -604,7 +604,7 @@ final class Application_Model_Scheduler $itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration); } - $instance->updateDbTimeFilled($this->con); //FIXME: TIME RECALC HACK (Albert) + $instance->updateDbTimeFilled($this->con); // FIXME: TIME RECALC HACK (Albert) $schedule->save($this->con); } @@ -628,8 +628,8 @@ final class Application_Model_Scheduler $affectedShowInstances = []; - //dont want to recalculate times for moved items - //only moved items have a sched_id + // dont want to recalculate times for moved items + // only moved items have a sched_id $excludeIds = []; $startProfile = microtime(true); @@ -646,7 +646,7 @@ final class Application_Model_Scheduler $linked = false; foreach ($scheduleItems as $schedule) { - //reset + // reset $this->applyCrossfades = true; $id = intval($schedule['id']); @@ -719,10 +719,10 @@ final class Application_Model_Scheduler $excludePositions = []; foreach ($instances as &$instance) { - //reset + // reset $this->applyCrossfades = true; - //$instanceId = $instance["id"]; + // $instanceId = $instance["id"]; $instanceId = $instance->getDbId(); if ($id !== 0) { /* We use the selected cursor's position to find the same @@ -741,9 +741,9 @@ final class Application_Model_Scheduler ); if (!$linkedItemEnds) { - //With dynamic smart blocks there may be different number of items in - //each show. In case the position does not exist we need to select - //the end time of the last position + // With dynamic smart blocks there may be different number of items in + // each show. In case the position does not exist we need to select + // the end time of the last position $maxPos_sql = 'SELECT max(position) from cc_schedule ' . "WHERE instance_id = {$instanceId}"; $pos = Application_Common_Database::prepareAndExecute( @@ -752,7 +752,7 @@ final class Application_Model_Scheduler Application_Common_Database::COLUMN ); - //show instance has no scheduled tracks + // show instance has no scheduled tracks if (empty($pos)) { $pos = 0; $nextStartDT = new DateTime($instance->getDbStarts(), new DateTimeZone('UTC')); @@ -781,14 +781,14 @@ final class Application_Model_Scheduler ++$pos; } - //$pos++; + // $pos++; } - //selected empty row to add after + // selected empty row to add after else { $showStartDT = new DateTime($instance->getDbStarts(), new DateTimeZone('UTC')); $nextStartDT = $this->findNextStartTime($showStartDT, $instanceId); - //first item in show so start position counter at 0 + // first item in show so start position counter at 0 $pos = 0; /* Show is empty so we don't need to calculate crossfades @@ -839,12 +839,12 @@ final class Application_Model_Scheduler $doUpdate = false; $values = []; - //array that stores the cc_file ids so we can update the is_scheduled flag + // array that stores the cc_file ids so we can update the is_scheduled flag $fileIds = []; foreach ($filesToInsert as &$file) { - //item existed previously and is being moved. - //need to keep same id for resources if we want REST. + // item existed previously and is being moved. + // need to keep same id for resources if we want REST. if (isset($file['sched_id'])) { $adjustFromDT = clone $nextStartDT; $doUpdate = true; @@ -975,7 +975,7 @@ final class Application_Model_Scheduler $nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration); ++$pos; - }//all files have been inserted/moved + }// all files have been inserted/moved if ($doInsert) { $insert_sql = 'INSERT INTO cc_schedule ' . '(starts, ends, cue_in, cue_out, fade_in, fade_out, ' . @@ -1018,7 +1018,7 @@ final class Application_Model_Scheduler $pstart = microtime(true); - //recalculate the start/end times after the inserted items. + // recalculate the start/end times after the inserted items. foreach ($followingSchedItems as $item) { $endTimeDT = $this->findEndTime($nextStartDT, $item['clip_length']); $endTimeDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration); @@ -1044,14 +1044,14 @@ final class Application_Model_Scheduler if ($moveAction) { $this->calculateCrossfades($instanceId); } - }//for each instance - }//for each schedule location + }// for each instance + }// for each schedule location $endProfile = microtime(true); Logging::debug('finished adding scheduled items.'); Logging::debug(floatval($endProfile) - floatval($startProfile)); - //update the status flag in cc_schedule. + // update the status flag in cc_schedule. $instances = CcShowInstancesQuery::create() ->filterByPrimaryKeys($affectedShowInstances) ->find($this->con); @@ -1068,7 +1068,7 @@ final class Application_Model_Scheduler $startProfile = microtime(true); - //update the last scheduled timestamp. + // update the last scheduled timestamp. CcShowInstancesQuery::create() ->filterByPrimaryKeys($affectedShowInstances) ->update(['DbLastScheduled' => new DateTime('now', new DateTimeZone('UTC'))], $this->con); @@ -1107,11 +1107,11 @@ final class Application_Model_Scheduler $this->con->beginTransaction(); try { - //Increase the transaction isolation level to prevent two concurrent requests from potentially resulting - //in tracks scheduled at the same time. + // Increase the transaction isolation level to prevent two concurrent requests from potentially resulting + // in tracks scheduled at the same time. $this->con->exec('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'); - $this->validateMediaItems($mediaItems); //Check for missing files, etc. + $this->validateMediaItems($mediaItems); // Check for missing files, etc. $this->validateRequest($scheduleItems, true); /* @@ -1156,14 +1156,14 @@ final class Application_Model_Scheduler */ public function moveItem($selectedItems, $afterItems, $adjustSched = true) { - //$startProfile = microtime(true); + // $startProfile = microtime(true); $this->con->beginTransaction(); - //$this->con->useDebug(true); + // $this->con->useDebug(true); try { - //Increase the transaction isolation level to prevent two concurrent requests from potentially resulting - //in tracks scheduled at the same time. + // Increase the transaction isolation level to prevent two concurrent requests from potentially resulting + // in tracks scheduled at the same time. $this->con->exec('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'); $this->validateItemMove($selectedItems, $afterItems[0]); @@ -1171,16 +1171,16 @@ final class Application_Model_Scheduler $this->validateRequest($afterItems); $endProfile = microtime(true); - //Logging::debug("validating move request took:"); - //Logging::debug(floatval($endProfile) - floatval($startProfile)); + // Logging::debug("validating move request took:"); + // Logging::debug(floatval($endProfile) - floatval($startProfile)); $afterInstance = CcShowInstancesQuery::create()->findPK($afterItems[0]['instance'], $this->con); - //map show instances to cc_schedule primary keys. + // map show instances to cc_schedule primary keys. $modifiedMap = []; $movedData = []; - //prepare each of the selected items. + // prepare each of the selected items. for ($i = 0; $i < count($selectedItems); ++$i) { $selected = CcScheduleQuery::create()->findPk($selectedItems[$i]['id'], $this->con); $selectedInstance = $selected->getCcShowInstances($this->con); @@ -1196,7 +1196,7 @@ final class Application_Model_Scheduler $movedData[] = $data; - //figure out which items must be removed from calculated show times. + // figure out which items must be removed from calculated show times. $showInstanceId = $selectedInstance->getDbId(); $schedId = $selected->getDbId(); if (isset($modifiedMap[$showInstanceId])) { @@ -1206,33 +1206,33 @@ final class Application_Model_Scheduler } } - //calculate times excluding the to be moved items. + // calculate times excluding the to be moved items. foreach ($modifiedMap as $instance => $schedIds) { $startProfile = microtime(true); $this->removeGaps($instance, $schedIds); - //$endProfile = microtime(true); - //Logging::debug("removing gaps from instance $instance:"); - //Logging::debug(floatval($endProfile) - floatval($startProfile)); + // $endProfile = microtime(true); + // Logging::debug("removing gaps from instance $instance:"); + // Logging::debug(floatval($endProfile) - floatval($startProfile)); } - //$startProfile = microtime(true); + // $startProfile = microtime(true); $this->insertAfter($afterItems, null, $movedData, $adjustSched, true); - //$endProfile = microtime(true); - //Logging::debug("inserting after removing gaps."); - //Logging::debug(floatval($endProfile) - floatval($startProfile)); + // $endProfile = microtime(true); + // Logging::debug("inserting after removing gaps."); + // Logging::debug(floatval($endProfile) - floatval($startProfile)); $modified = array_keys($modifiedMap); - //need to adjust shows we have moved items from. + // need to adjust shows we have moved items from. foreach ($modified as $instanceId) { $instance = CcShowInstancesQuery::create()->findPK($instanceId, $this->con); $instance->updateScheduleStatus($this->con); } - //$this->con->useDebug(false); + // $this->con->useDebug(false); $this->con->commit(); Application_Model_RabbitMq::PushSchedule(); @@ -1267,10 +1267,10 @@ final class Application_Model_Scheduler $instance = $removedItem->getCcShowInstances($this->con); $effectedInstanceIds[$instance->getDbId()] = $instance->getDbId(); - //check if instance is linked and if so get the schedule items - //for all linked instances so we can delete them too + // check if instance is linked and if so get the schedule items + // for all linked instances so we can delete them too if (!$cancelShow && $instance->getCcShow()->isLinked()) { - //returns all linked instances if linked + // returns all linked instances if linked $ccShowInstances = $this->getInstances($instance->getDbId()); $instanceIds = []; @@ -1288,7 +1288,7 @@ final class Application_Model_Scheduler ->delete($this->con); } - //check to truncate the currently playing item instead of deleting it. + // check to truncate the currently playing item instead of deleting it. if ($removedItem->isCurrentItem($this->epochNow)) { $nEpoch = $this->epochNow; $sEpoch = $removedItem->getDbStarts('U.u'); @@ -1300,9 +1300,9 @@ final class Application_Model_Scheduler $cueOutSec = bcadd($cueinSec, $length, 6); $cueout = Application_Common_DateHelper::secondsToPlaylistTime($cueOutSec); - //Set DbEnds - 1 second because otherwise there can be a timing issue - //when sending the new schedule to Pypo where Pypo thinks the track is still - //playing. + // Set DbEnds - 1 second because otherwise there can be a timing issue + // when sending the new schedule to Pypo where Pypo thinks the track is still + // playing. $removedItem->setDbCueOut($cueout) ->setDbClipLength($cliplength) ->setDbEnds($this->nowDT) @@ -1320,7 +1320,7 @@ final class Application_Model_Scheduler } } - //update the status flag in cc_schedule. + // update the status flag in cc_schedule. $instances = CcShowInstancesQuery::create() ->filterByPrimaryKeys($effectedInstanceIds) ->find($this->con); @@ -1330,7 +1330,7 @@ final class Application_Model_Scheduler $instance->correctSchedulePositions(); } - //update the last scheduled timestamp. + // update the last scheduled timestamp. CcShowInstancesQuery::create() ->filterByPrimaryKeys($showInstances) ->update(['DbLastScheduled' => new DateTime('now', new DateTimeZone('UTC'))], $this->con); diff --git a/legacy/application/models/ServiceRegister.php b/legacy/application/models/ServiceRegister.php index e79e82489..a25dbff4f 100644 --- a/legacy/application/models/ServiceRegister.php +++ b/legacy/application/models/ServiceRegister.php @@ -5,10 +5,10 @@ class Application_Model_ServiceRegister public static function GetRemoteIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { - //check ip from share internet + // check ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { - //to check ip is pass from proxy + // to check ip is pass from proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; diff --git a/legacy/application/models/Show.php b/legacy/application/models/Show.php index 18591e26f..6d2de43fb 100644 --- a/legacy/application/models/Show.php +++ b/legacy/application/models/Show.php @@ -213,8 +213,8 @@ SQL; */ public function delete() { - //usually we hide the show-instance, but in this case we are deleting the show template - //so delete all show-instances as well. + // usually we hide the show-instance, but in this case we are deleting the show template + // so delete all show-instances as well. CcShowInstancesQuery::create()->filterByDbOriginalShow($this->_showId)->delete(); $show = CcShowQuery::create()->findPK($this->_showId); @@ -232,7 +232,7 @@ SQL; $utcTimezone = new DateTimeZone('UTC'); $nowDateTime = new DateTime('now', $utcTimezone); - //keep track of cc_show_day entries we need to update + // keep track of cc_show_day entries we need to update $showDayIds = []; /* @@ -244,7 +244,7 @@ SQL; */ $ccShow = CcShowQuery::create()->findPk($this->_showId); if ($ccShow->isRepeating()) { - //convert instance to local timezone + // convert instance to local timezone $ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId); $startsDT = $ccShowInstance->getDbStarts(null); $timezone = $ccShow->getFirstCcShowDay()->getDbTimezone(); @@ -271,7 +271,7 @@ SQL; $excludeIds = $ccShow->getEditedRepeatingInstanceIds(); - //exlcude edited instances from resize + // exlcude edited instances from resize $showInstances = CcShowInstancesQuery::create() ->filterByDbShowId($this->_showId) ->filterByDbModifiedInstance(false) @@ -280,7 +280,7 @@ SQL; } elseif ($ccShowDay->getDbRepeatType() == -1) { array_push($showDayIds, $ccShowDay->getDbId()); - //treat edited instance as separate show for resize + // treat edited instance as separate show for resize $showInstances = CcShowInstancesQuery::create() ->filterByDbId($instanceId) ->find(); @@ -301,11 +301,11 @@ SQL; 2. If the show being resized and any of its repeats overlap with other scheduled shows */ - //keep track of instance ids for update show instances start/end times + // keep track of instance ids for update show instances start/end times $instanceIds = []; $displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone()); - //check if new show time overlaps with any other shows + // check if new show time overlaps with any other shows foreach ($showInstances as $si) { array_push($instanceIds, $si->getDbId()); @@ -319,15 +319,15 @@ SQL; $startsDateTime->setTimezone($displayTimezone); $endsDateTime->setTimezone($displayTimezone); - //$newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin); + // $newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin); $newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin); if ($newEndsDateTime->getTimestamp() < $nowDateTime->getTimestamp()) { return _('End date/time cannot be in the past'); } - //convert our new starts/ends to UTC. - //$newStartsDateTime->setTimezone($utc); + // convert our new starts/ends to UTC. + // $newStartsDateTime->setTimezone($utc); $newEndsDateTime->setTimezone($utcTimezone); $overlapping = Application_Model_Schedule::checkOverlappingShows( @@ -385,7 +385,7 @@ SQL; $con->beginTransaction(); try { - //update the status flag in cc_schedule. + // update the status flag in cc_schedule. /* Since we didn't use a propel object when updating * cc_show_instances table we need to clear the instances @@ -772,7 +772,7 @@ SQL; */ private function updateDurationTime($p_data) { - //need to update cc_show_instances, cc_show_days + // need to update cc_show_instances, cc_show_days $con = Propel::getConnection(); $timestamp = gmdate(DEFAULT_TIMESTAMP_FORMAT); @@ -925,13 +925,13 @@ SQL; try { $con->beginTransaction(); - //It is extremely important that we increase the transaction isolation level, so that if two - //requests cause the show schedule to be generated at the same time, one will be rolled back. + // It is extremely important that we increase the transaction isolation level, so that if two + // requests cause the show schedule to be generated at the same time, one will be rolled back. $con->exec('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'); - //UTC DateTime object + // UTC DateTime object $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); - //if application is requesting shows past our previous populated until date, generate shows up until this point. + // if application is requesting shows past our previous populated until date, generate shows up until this point. if (is_null($showsPopUntil) || $showsPopUntil->getTimestamp() < $needScheduleUntil->getTimestamp()) { $service_show = new Application_Service_ShowService(); $ccShow = $service_show->delegateInstanceCreation(null, $needScheduleUntil, true); @@ -940,7 +940,7 @@ SQL; $con->commit(); } catch (Exception $e) { $con->rollBack(); - //throw $e; + // throw $e; Logging::warn('Did not create show instances due to transaction error. This is usually safe and caused by two concurrent transactions. ' . $e->getMessage()); } @@ -989,7 +989,7 @@ LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id LEFT JOIN cc_show AS show ON show.id = si1.show_id WHERE si1.modified_instance = FALSE SQL; - //only want shows that are starting at the time or later. + // only want shows that are starting at the time or later. $start_string = $start_timestamp->format(DEFAULT_TIMESTAMP_FORMAT); $end_string = $end_timestamp->format(DEFAULT_TIMESTAMP_FORMAT); @@ -1131,7 +1131,7 @@ SQL; $event['record'] = intval($show['record']); $event['rebroadcast'] = intval($show['rebroadcast']); - //for putting the now playing icon on the show. + // for putting the now playing icon on the show. if ($now > $startsDT && $now < $endsDT) { $event['nowPlaying'] = true; } else { @@ -1141,15 +1141,15 @@ SQL; if (!empty($show['background_color'])) { $event['color'] = '#' . $show['background_color']; } else { - $event['color'] = '#' . self::getDefaultBackgroundColor($startsDT); //DEFAULT_SHOW_COLOR; + $event['color'] = '#' . self::getDefaultBackgroundColor($startsDT); // DEFAULT_SHOW_COLOR; } - //event colouring + // event colouring if ($show['color'] != '') { $event['textColor'] = '#' . $show['color']; } else { $bg = $event['color']; - //Calculate the text colour (black or white) based on the brightness of the background. + // Calculate the text colour (black or white) based on the brightness of the background. $r = intval(substr($bg, 1, 2), 16); $g = intval(substr($bg, 3, 2), 16); $b = intval(substr($bg, 5, 2), 16); @@ -1199,11 +1199,11 @@ SQL; array_push($palette, $dayPalette); } - //$hashValue = (md5($date->format('d'))[0] % $cols) + ((intval($date->format('h'))/24) % $rows); + // $hashValue = (md5($date->format('d'))[0] % $cols) + ((intval($date->format('h'))/24) % $rows); $row = intval($date->format('w')) % count($palette); $foo = $date->format('H'); $col = intval(intval($date->format('H')) / 24.0 * count($palette[0])); - //$color = $palette[$hashValue % sizeof($palette)]; + // $color = $palette[$hashValue % sizeof($palette)]; return $palette[$row][$col]; } @@ -1224,7 +1224,7 @@ SQL; $endDt = new DateTime($p_ends, $utcTimezone); $durationSeconds = intval($endDt->format('U')) - intval($startDt->format('U')); $time_filled = Application_Common_DateHelper::playlistTimeToSeconds($p_time_filled); - if ($durationSeconds != 0) { //Prevent division by zero if the show duration somehow becomes zero. + if ($durationSeconds != 0) { // Prevent division by zero if the show duration somehow becomes zero. $percent = ceil(($time_filled / $durationSeconds) * 100); } else { $percent = 0; @@ -1247,7 +1247,7 @@ SQL; if ($timeNow == null) { $timeNow = gmdate(DEFAULT_TIMESTAMP_FORMAT); } - //TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin + // TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin $sql = <<<'SQL' SELECT si.starts AS start_timestamp, si.ends AS end_timestamp, @@ -1298,7 +1298,7 @@ SQL; */ public static function getPrevCurrentNext($utcNow, $utcEndStr, $showsToRetrieve) { - $timeZone = new DateTimeZone('UTC'); //This function works entirely in UTC. + $timeZone = new DateTimeZone('UTC'); // This function works entirely in UTC. assert(get_class($utcNow) === 'DateTime'); assert($utcNow->getTimeZone() == $timeZone); @@ -1390,14 +1390,14 @@ SQL; */ public static function getPrevCurrentNextOld($utcNow) { - $timeZone = new DateTimeZone('UTC'); //This function works entirely in UTC. + $timeZone = new DateTimeZone('UTC'); // This function works entirely in UTC. assert(get_class($utcNow) === 'DateTime'); assert($utcNow->getTimeZone() == $timeZone); $CC_CONFIG = Config::getConfig(); $con = Propel::getConnection(); - //TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin + // TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin $sql = <<<'SQL' SELECT si.starts AS start_timestamp, si.ends AS end_timestamp, @@ -1441,11 +1441,11 @@ SQL; $results['nextShow'] = []; for ($i = 0; $i < $numberOfRows; ++$i) { - //All shows start/end times are stored in the database as UTC. + // All shows start/end times are stored in the database as UTC. $showStartTime = new DateTime($rows[$i]['starts'], $timeZone); $showEndTime = new DateTime($rows[$i]['ends'], $timeZone); - //Find the show that is within the current time. + // Find the show that is within the current time. if (($showStartTime <= $utcNow) && ($showEndTime > $utcNow)) { if ($i - 1 >= 0) { $results['previousShow'][0] = [ @@ -1483,11 +1483,11 @@ SQL; break; } - //Previous is any row that ends after time now capture it in case we need it later. + // Previous is any row that ends after time now capture it in case we need it later. if ($showEndTime < $utcNow) { $previousShowIndex = $i; } - //if we hit this we know we've gone to far and can stop looping. + // if we hit this we know we've gone to far and can stop looping. if ($showStartTime > $utcNow) { $results['nextShow'][0] = [ 'id' => $rows[$i]['id'], @@ -1506,8 +1506,8 @@ SQL; break; } } - //If we didn't find a a current show because the time didn't fit we may still have - //found a previous show so use it. + // If we didn't find a a current show because the time didn't fit we may still have + // found a previous show so use it. if (count($results['previousShow']) == 0 && isset($previousShowIndex)) { $results['previousShow'][0] = [ 'id' => $rows[$previousShowIndex]['id'], @@ -1546,7 +1546,7 @@ SQL; $timeEnd = "'{$timeStart}' + INTERVAL '2 days'"; } - //TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin + // TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin $sql = <<<'SQL' SELECT si.starts AS start_timestamp, si.ends AS end_timestamp, @@ -1570,9 +1570,9 @@ WHERE si.show_id = s.id ORDER BY si.starts SQL; - //PDO won't accept "ALL" as a limit value (complains it is not an - //integer, and so we must completely remove the limit clause if we - //want to show all results - MK + // PDO won't accept "ALL" as a limit value (complains it is not an + // integer, and so we must completely remove the limit clause if we + // want to show all results - MK if ($limit != 'ALL') { $sql .= PHP_EOL . 'LIMIT :lim'; $params = [ @@ -1607,10 +1607,10 @@ SQL; { $utcTimeZone = new DateTimeZone('UTC'); - //We have to get the start of the day in the user's timezone, and then convert that to UTC. + // We have to get the start of the day in the user's timezone, and then convert that to UTC. $start = new DateTime('first day of this month', new DateTimeZone(Application_Model_Preference::GetUserTimezone())); - $start->setTimezone($utcTimeZone); //Covert it to UTC. + $start->setTimezone($utcTimeZone); // Covert it to UTC. $monthInterval = new DateInterval('P1M'); $end = clone $start; $end->add($monthInterval); @@ -1627,14 +1627,14 @@ SQL; { $utcTimeZone = new DateTimeZone('UTC'); - //We have to get the start of the day in the user's timezone, and then convert that to UTC. + // We have to get the start of the day in the user's timezone, and then convert that to UTC. $start = new DateTime('first day of this month', new DateTimeZone(Application_Model_Preference::GetUserTimezone())); $dayOfWeekNumeric = $start->format('w'); - $start->sub(new DateInterval("P{$dayOfWeekNumeric}D")); //Subtract the index of the day of the week the month starts on. (adds this many days from the previous month) - $start->setTimezone($utcTimeZone); //Covert it to UTC. + $start->sub(new DateInterval("P{$dayOfWeekNumeric}D")); // Subtract the index of the day of the week the month starts on. (adds this many days from the previous month) + $start->setTimezone($utcTimeZone); // Covert it to UTC. - $fullCalendarMonthInterval = new DateInterval('P42D'); //42 days + $fullCalendarMonthInterval = new DateInterval('P42D'); // 42 days $end = clone $start; $end->add($fullCalendarMonthInterval); @@ -1646,11 +1646,11 @@ SQL; $weekStartDayNum = Application_Model_Preference::GetWeekStartDay(); $utcTimeZone = new DateTimeZone('UTC'); - //We have to get the start of the week in the user's timezone, and then convert that to UTC. + // We have to get the start of the week in the user's timezone, and then convert that to UTC. $start = new DateTime('Sunday last week', new DateTimeZone(Application_Model_Preference::GetUserTimezone())); - $start->add(new DateInterval("P{$weekStartDayNum}D")); //Shift the start date to the station's "Week Starts on Day" + $start->add(new DateInterval("P{$weekStartDayNum}D")); // Shift the start date to the station's "Week Starts on Day" - $start->setTimezone($utcTimeZone); //Covert it to UTC. + $start->setTimezone($utcTimeZone); // Covert it to UTC. $weekInterval = new DateInterval('P1W'); $end = clone $start; $end->add($weekInterval); @@ -1662,10 +1662,10 @@ SQL; { $utcTimeZone = new DateTimeZone('UTC'); - //We have to get the start of the day in the user's timezone, and then convert that to UTC. + // We have to get the start of the day in the user's timezone, and then convert that to UTC. $start = new DateTime('today', new DateTimeZone(Application_Model_Preference::GetUserTimezone())); - $start->setTimezone($utcTimeZone); //Covert it to UTC. + $start->setTimezone($utcTimeZone); // Covert it to UTC. $dayInterval = new DateInterval('P1D'); $end = clone $start; $end->add($dayInterval); diff --git a/legacy/application/models/ShowBuilder.php b/legacy/application/models/ShowBuilder.php index 342b4c00f..f37ded651 100644 --- a/legacy/application/models/ShowBuilder.php +++ b/legacy/application/models/ShowBuilder.php @@ -4,9 +4,9 @@ class Application_Model_ShowBuilder { private $timezone; - //in UTC timezone + // in UTC timezone private $startDT; - //in UTC timezone + // in UTC timezone private $endDT; private $user; @@ -41,8 +41,8 @@ class Application_Model_ShowBuilder 'fadeout' => '', 'image' => false, 'mime' => null, - 'color' => '', //in hex without the '#' sign. - 'backgroundColor' => '', //in hex without the '#' sign. + 'color' => '', // in hex without the '#' sign. + 'backgroundColor' => '', // in hex without the '#' sign. ]; /* @@ -76,10 +76,10 @@ class Application_Model_ShowBuilder return $shows; } - //check to see if this row should be editable by the user. + // check to see if this row should be editable by the user. private function isAllowed($p_item, &$row) { - //cannot schedule in a recorded show. + // cannot schedule in a recorded show. if (intval($p_item['si_record']) === 1) { return; } @@ -119,7 +119,7 @@ class Application_Model_ShowBuilder $row['backgroundColor'] = $backgroundColor; } - //information about whether a track is inside|boundary|outside a show. + // information about whether a track is inside|boundary|outside a show. private function getItemStatus($p_item, &$row) { $row['status'] = intval($p_item['playout_status']); @@ -156,19 +156,19 @@ class Application_Model_ShowBuilder $row['scheduled'] = 2; } - //item is in the past. + // item is in the past. elseif ($this->epoch_now > $p_epochItemEnd) { $row['scheduled'] = 0; } - //item is the currently scheduled item. + // item is the currently scheduled item. elseif ($this->epoch_now >= $p_epochItemStart && $this->epoch_now < $p_epochItemEnd) { $row['scheduled'] = 1; - //how many seconds the view should wait to redraw itself. + // how many seconds the view should wait to redraw itself. $row['refresh'] = $p_epochItemEnd - $this->epoch_now; } - //item is in the future. + // item is in the future. elseif ($this->epoch_now < $p_epochItemStart) { $row['scheduled'] = 2; } else { @@ -185,7 +185,7 @@ class Application_Model_ShowBuilder private function makeHeaderRow($p_item) { $row = $this->defaultRowArray; - //$this->isAllowed($p_item, $row); + // $this->isAllowed($p_item, $row); $this->getRowTimestamp($p_item, $row); $this->getItemColor($p_item, $row); @@ -196,7 +196,7 @@ class Application_Model_ShowBuilder $showEndDT->setTimezone(new DateTimeZone($this->timezone)); $endsEpoch = floatval($showEndDT->format('U.u')); - //is a rebroadcast show + // is a rebroadcast show if (intval($p_item['si_rebroadcast']) === 1) { $row['rebroadcast'] = true; @@ -263,7 +263,7 @@ class Application_Model_ShowBuilder $endsEpoch = floatval($schedEndDT->format('U.u')); $showEndEpoch = floatval($showEndDT->format('U.u')); - //don't want an overbooked item to stay marked as current. + // don't want an overbooked item to stay marked as current. $this->getScheduledStatus($startsEpoch, min($endsEpoch, $showEndEpoch), $row); $row['id'] = intval($p_item['sched_id']); @@ -294,7 +294,7 @@ class Application_Model_ShowBuilder $this->contentDT = $schedEndDT; } - //show is empty or is a special kind of show (recording etc) + // show is empty or is a special kind of show (recording etc) elseif (intval($p_item['si_record']) === 1) { $row['record'] = true; $row['instance'] = intval($p_item['si_id']); @@ -403,7 +403,7 @@ class Application_Model_ShowBuilder ); } - //check if any of the shows have a more recent timestamp. + // check if any of the shows have a more recent timestamp. $showTimeStamp = intval($dt->format('U')); if ($timestamp < $showTimeStamp) { $outdated = true; @@ -413,8 +413,8 @@ class Application_Model_ShowBuilder } } - //see if the displayed show instances have changed. (deleted, - //empty schedule etc) + // see if the displayed show instances have changed. (deleted, + // empty schedule etc) if ($outdated === false && count($instances) !== count($currentInstances)) { Logging::debug('show instances have changed.'); @@ -449,15 +449,15 @@ class Application_Model_ShowBuilder for ($i = 0, $rows = count($scheduled_items); $i < $rows; ++$i) { $item = $scheduled_items[$i]; - //don't send back data for filler rows. + // don't send back data for filler rows. if (isset($item['playout_status']) && $item['playout_status'] < 0) { continue; } - //make a header row. + // make a header row. if ($current_id !== $item['si_id']) { - //make a footer row. + // make a footer row. if ($current_id !== -1) { // pass in the previous row as it's the last row for // the previous show. @@ -473,9 +473,9 @@ class Application_Model_ShowBuilder $this->pos = 1; } - //make a normal data row. + // make a normal data row. $row = $this->makeScheduledItemRow($item); - //don't display the empty rows. + // don't display the empty rows. if (isset($row)) { $display_items[] = $row; } @@ -486,7 +486,7 @@ class Application_Model_ShowBuilder } } - //make the last footer if there were any scheduled items. + // make the last footer if there were any scheduled items. if (count($scheduled_items) > 0) { $display_items[] = $this->makeFooterRow($scheduled_items[ count($scheduled_items) - 1]); diff --git a/legacy/application/models/ShowInstance.php b/legacy/application/models/ShowInstance.php index 053a26982..3862fb223 100644 --- a/legacy/application/models/ShowInstance.php +++ b/legacy/application/models/ShowInstance.php @@ -318,7 +318,7 @@ SQL; private function checkToDeleteShow($showId) { - //UTC DateTime object + // UTC DateTime object $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); $showDays = CcShowDaysQuery::create() @@ -327,16 +327,16 @@ SQL; $showEnd = $showDays->getDbLastShow(); - //there will always be more shows populated. + // there will always be more shows populated. if (is_null($showEnd)) { return false; } $lastShowStartDateTime = new DateTime("{$showEnd} {$showDays->getDbStartTime()}", new DateTimeZone($showDays->getDbTimezone())); - //end dates were non inclusive. + // end dates were non inclusive. $lastShowStartDateTime = self::addDeltas($lastShowStartDateTime, -1, 0); - //there's still some shows left to be populated. + // there's still some shows left to be populated. if ($lastShowStartDateTime->getTimestamp() > $showsPopUntil->getTimestamp()) { return false; } @@ -351,7 +351,7 @@ SQL; if (is_null($showInstances)) { return true; } - //only 1 show instance left of the show, make it non repeating. + // only 1 show instance left of the show, make it non repeating. if (count($showInstances) === 1) { $showInstance = $showInstances[0]; @@ -365,7 +365,7 @@ SQL; $startDate->setTimeZone(new DateTimeZone($tz)); $endDate = self::addDeltas($startDate, 1, 0); - //make a new rule for a non repeating show. + // make a new rule for a non repeating show. $showDayNew = new CcShowDays(); $showDayNew->setDbFirstShow($startDate->format('Y-m-d')); $showDayNew->setDbLastShow($endDate->format('Y-m-d')); @@ -378,10 +378,10 @@ SQL; $showDayNew->setDbRecord($showDaysOld[0]->getDbRecord()); $showDayNew->save(); - //delete the old rules for repeating shows + // delete the old rules for repeating shows $showDaysOld->delete(); - //remove the old repeating deleted instances. + // remove the old repeating deleted instances. $showInstances = CcShowInstancesQuery::create() ->filterByDbShowId($showId) ->filterByDbModifiedInstance(true) @@ -413,7 +413,7 @@ SQL; return; } - //delete the rebroadcasts of the removed recorded show. + // delete the rebroadcasts of the removed recorded show. if ($recording) { CcShowInstancesQuery::create() ->filterByDbOriginalShow($this->_instanceId) @@ -511,7 +511,7 @@ SQL; $durationSeconds = $this->getDurationSecs(); $timeSeconds = $this->getTimeScheduledSecs(); - if ($durationSeconds != 0) { //Prevent division by zero if the show duration is somehow zero. + if ($durationSeconds != 0) { // Prevent division by zero if the show duration is somehow zero. $percent = ceil(($timeSeconds / $durationSeconds) * 100); } else { $percent = 0; @@ -531,7 +531,7 @@ SQL; if ($days > 0) { $totalHours = $days * 24 + $hours; - //$interval object does not have milliseconds so hard code to .00 + // $interval object does not have milliseconds so hard code to .00 $returnStr = $totalHours . ':' . $interval->format('%I:%S') . '.00'; } else { $returnStr = $hours . ':' . $interval->format('%I:%S') . '.00'; diff --git a/legacy/application/models/StoredFile.php b/legacy/application/models/StoredFile.php index 8a16faedd..96734950f 100644 --- a/legacy/application/models/StoredFile.php +++ b/legacy/application/models/StoredFile.php @@ -45,7 +45,7 @@ class Application_Model_StoredFile 'bit_rate' => 'DbBitRate', 'sample_rate' => 'DbSampleRate', 'mime' => 'DbMime', - //"md5" => "DbMd5", + // "md5" => "DbMd5", 'ftype' => 'DbFtype', 'language' => 'DbLanguage', 'replay_gain' => 'DbReplayGain', @@ -183,7 +183,7 @@ class Application_Model_StoredFile // if MDATA_OWNER_ID is not set then we default to the // first admin user we find if (!array_key_exists('owner_id', $p_md)) { - //$admins = Application_Model_User::getUsers(array('A')); + // $admins = Application_Model_User::getUsers(array('A')); $admins = array_merge( Application_Model_User::getUsersOfType('A')->getData(), Application_Model_User::getUsersOfType('S')->getData() @@ -268,7 +268,7 @@ class Application_Model_StoredFile */ public function setDbColMetadataValue($p_category, $p_value) { - //don't blank out name, defaults to original filename on first insertion to database. + // don't blank out name, defaults to original filename on first insertion to database. if ($p_category == 'track_title' && (is_null($p_value) || $p_value == '')) { return; } @@ -412,8 +412,8 @@ SQL; throw new Exception('Cannot delete file with filesize ' . $filesize); } - //Delete the physical file from either the local stor directory - //or from the cloud + // Delete the physical file from either the local stor directory + // or from the cloud if ($this->_file->getDbImportStatus() == CcFiles::IMPORT_STATUS_SUCCESS) { try { $this->_file->deletePhysicalFile(); @@ -421,20 +421,20 @@ SQL; if ($quiet) { Logging::info($e); } else { - //Just log the exception and continue. + // Just log the exception and continue. Logging::error($e); } } } - //Update the user's disk usage + // Update the user's disk usage Application_Model_Preference::updateDiskUsage(-1 * $filesize); - //Explicitly update any playlist's and block's length that contain - //the file getting deleted + // Explicitly update any playlist's and block's length that contain + // the file getting deleted self::updateBlockAndPlaylistLength($this->_file->getDbId()); - //delete the file record from cc_files (and cloud_file, if applicable) + // delete the file record from cc_files (and cloud_file, if applicable) $this->_file->delete(); } @@ -607,7 +607,7 @@ SQL; */ public static function RecallById($p_id = null, $con = null) { - //TODO + // TODO if (is_null($con)) { $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME); } @@ -620,9 +620,9 @@ SQL; throw new Exception('Could not recall file with id: ' . $p_id); } - //Attempt to get the cloud file object and return it. If no cloud - //file object is found then we are dealing with a regular stored - //object so return that + // Attempt to get the cloud file object and return it. If no cloud + // file object is found then we are dealing with a regular stored + // object so return that $cloudFile = CloudFileQuery::create()->findOneByCcFileId($p_id); if (is_null($cloudFile)) { @@ -757,14 +757,14 @@ SQL; $fileSelect[] = $key; $streamSelect[] = 'NULL::INTERVAL AS ' . $key; } - //file length is displayed based on cueout - cuein. + // file length is displayed based on cueout - cuein. elseif ($key === 'length') { $plSelect[] = $key; $blSelect[] = $key; $fileSelect[] = '(cueout - cuein)::INTERVAL AS length'; $streamSelect[] = $key; } - //same columns in each table. + // same columns in each table. elseif (in_array($key, ['utime', 'mtime'])) { $plSelect[] = $key; $blSelect[] = $key; @@ -776,7 +776,7 @@ SQL; $fileSelect[] = 'year AS ' . $key; $streamSelect[] = 'EXTRACT(YEAR FROM utime)::varchar AS ' . $key; } - //need to cast certain data as ints for the union to search on. + // need to cast certain data as ints for the union to search on. elseif (in_array($key, ['track_number', 'bit_rate', 'sample_rate', 'bpm'])) { $plSelect[] = 'NULL::int AS ' . $key; $blSelect[] = 'NULL::int AS ' . $key; @@ -810,29 +810,29 @@ SQL; $plTable = "({$plSelect} FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id))"; $blTable = "({$blSelect} FROM cc_block AS BL LEFT JOIN cc_subjs AS sub ON (sub.id = BL.creator_id))"; $fileTable = "({$fileSelect} FROM cc_files AS FILES LEFT JOIN cc_subjs AS sub ON (sub.id = FILES.owner_id) WHERE file_exists = 'TRUE' AND hidden='FALSE')"; - //$fileTable = "({$fileSelect} FROM cc_files AS FILES WHERE file_exists = 'TRUE')"; + // $fileTable = "({$fileSelect} FROM cc_files AS FILES WHERE file_exists = 'TRUE')"; $streamTable = "({$streamSelect} FROM cc_webstream AS ws LEFT JOIN cc_subjs AS sub ON (sub.id = ws.creator_id))"; $unionTable = "({$plTable} UNION {$blTable} UNION {$fileTable} UNION {$streamTable}) AS RESULTS"; - //choose which table we need to select data from. + // choose which table we need to select data from. switch ($type) { case MediaType::FILE: - $fromTable = $fileTable . ' AS File'; //need an alias for the table if it's standalone. + $fromTable = $fileTable . ' AS File'; // need an alias for the table if it's standalone. break; case MediaType::PLAYLIST: - $fromTable = $plTable . ' AS Playlist'; //need an alias for the table if it's standalone. + $fromTable = $plTable . ' AS Playlist'; // need an alias for the table if it's standalone. break; case MediaType::BLOCK: - $fromTable = $blTable . ' AS Block'; //need an alias for the table if it's standalone. + $fromTable = $blTable . ' AS Block'; // need an alias for the table if it's standalone. break; case MediaType::WEBSTREAM: - $fromTable = $streamTable . ' AS StreamTable'; //need an alias for the table if it's standalone. + $fromTable = $streamTable . ' AS StreamTable'; // need an alias for the table if it's standalone. break; @@ -854,7 +854,7 @@ SQL; foreach ($results['aaData'] as &$row) { $row['id'] = intval($row['id']); - //taken from Datatables.php, needs to be cleaned up there. + // taken from Datatables.php, needs to be cleaned up there. if (isset($r['ftype'])) { if ($r['ftype'] == 'playlist') { $pl = new Application_Model_Playlist($r['id']); @@ -896,7 +896,7 @@ SQL; $len_formatter = new LengthFormatter($row_length); $row['length'] = $len_formatter->format(); - //convert mtime and utime to localtime + // convert mtime and utime to localtime $row['mtime'] = new DateTime($row['mtime'], $utcTimezone); $row['mtime']->setTimeZone($displayTimezone); $row['mtime'] = $row['mtime']->format(DEFAULT_TIMESTAMP_FORMAT); @@ -904,7 +904,7 @@ SQL; $row['utime']->setTimeZone($displayTimezone); $row['utime'] = $row['utime']->format(DEFAULT_TIMESTAMP_FORMAT); - //need to convert last played to localtime if it exists. + // need to convert last played to localtime if it exists. if (isset($row['lptime'])) { $row['lptime'] = new DateTime($row['lptime'], $utcTimezone); $row['lptime']->setTimeZone($displayTimezone); @@ -970,8 +970,8 @@ SQL; 'organize', $originalFilename ); - //if the uploaded file is not UTF-8 encoded, let's encode it. Assuming source - //encoding is ISO-8859-1 + // if the uploaded file is not UTF-8 encoded, let's encode it. Assuming source + // encoding is ISO-8859-1 $audio_stor = mb_detect_encoding($audio_stor, 'UTF-8') == 'UTF-8' ? $audio_stor : utf8_encode($audio_stor); if ($copyFile) { Logging::info("Copying file {$audio_file} to {$audio_stor}"); @@ -981,7 +981,7 @@ SQL; } else { Logging::info("Moving file {$audio_file} to {$audio_stor}"); - //Ensure we have permissions to overwrite the file in stor, in case it already exists. + // Ensure we have permissions to overwrite the file in stor, in case it already exists. if (file_exists($audio_stor)) { chmod($audio_stor, 0644); } @@ -989,11 +989,11 @@ SQL; // Martin K.: changed to rename: Much less load + quicker since this is // an atomic operation if (rename($audio_file, $audio_stor) === false) { - //something went wrong likely there wasn't enough space in . - //the audio_stor to move the file too warn the user that . - //the file wasn't uploaded and they should check if there . - //is enough disk space . - unlink($audio_file); //remove the file after failed rename + // something went wrong likely there wasn't enough space in . + // the audio_stor to move the file too warn the user that . + // the file wasn't uploaded and they should check if there . + // is enough disk space . + unlink($audio_file); // remove the file after failed rename throw new Exception('The file was not uploaded, this error can occur if the computer ' . 'hard drive does not have enough disk space or the stor ' @@ -1077,7 +1077,7 @@ SQL; return $results; } - //TODO: MERGE THIS FUNCTION AND "listAllFiles" -MK + // TODO: MERGE THIS FUNCTION AND "listAllFiles" -MK public static function listAllFiles2($dir_id = null, $limit = 'ALL') { $con = Propel::getConnection(); @@ -1151,10 +1151,10 @@ SQL; // This method seems to be unsued everywhere so I've commented it out // If it's absence does not have any effect then it will be completely // removed soon - //public function getFileExistsFlag() - //{ - //return $this->_file->getDbFileExists(); - //} + // public function getFileExistsFlag() + // { + // return $this->_file->getDbFileExists(); + // } public function getFileOwnerId() { diff --git a/legacy/application/models/StreamSetting.php b/legacy/application/models/StreamSetting.php index 0408372c7..6546cb101 100644 --- a/legacy/application/models/StreamSetting.php +++ b/legacy/application/models/StreamSetting.php @@ -38,7 +38,7 @@ class Application_Model_StreamSetting $stmt->bindParam(':type', $type); if ($stmt->execute()) { - //do nothing + // do nothing } else { $msg = implode(',', $stmt->errorInfo()); @@ -50,7 +50,7 @@ class Application_Model_StreamSetting { $con = Propel::getConnection(); - //Check if key already exists + // Check if key already exists $sql = 'SELECT value FROM cc_stream_setting' . ' WHERE keyname = :key'; @@ -79,8 +79,8 @@ class Application_Model_StreamSetting $port = $streamData[$prefix . 'port']; $mount = $streamData[$prefix . 'mount']; if ($streamData[$prefix . 'output'] == 'shoutcast') { - $url = "http://{$host}:{$port}/;"; //The semi-colon is important to make Shoutcast stream URLs play instead turn into a page. - } else { //Icecast + $url = "http://{$host}:{$port}/;"; // The semi-colon is important to make Shoutcast stream URLs play instead turn into a page. + } else { // Icecast $url = "http://{$host}:{$port}/{$mount}"; } $streams[$id] = [ @@ -123,19 +123,19 @@ class Application_Model_StreamSetting ->filterByDbKeyName("{$p_streamId}_%") ->find(); - //This is way too much code because someone made only stupid decisions about how - //the layout of this table worked. The git history doesn't lie. + // This is way too much code because someone made only stupid decisions about how + // the layout of this table worked. The git history doesn't lie. $data = []; foreach ($rows as $row) { $key = $row->getDbKeyName(); $value = $row->getDbValue(); $type = $row->getDbType(); - //Fix stupid defaults so we end up with proper typing in our JSON + // Fix stupid defaults so we end up with proper typing in our JSON if ($row->getDbType() == 'boolean') { if (empty($value)) { - //In Python, there is no way to tell the difference between ints and booleans, - //which we need to differentiate between for when we're generating the Liquidsoap - //config file. Returning booleans as a string is a workaround that lets us do that. + // In Python, there is no way to tell the difference between ints and booleans, + // which we need to differentiate between for when we're generating the Liquidsoap + // config file. Returning booleans as a string is a workaround that lets us do that. $value = 'false'; } $data[$key] = $value; @@ -149,7 +149,7 @@ class Application_Model_StreamSetting } } - //Add in defaults in case they don't exist in the database. + // Add in defaults in case they don't exist in the database. $keyPrefix = $p_streamId . '_'; self::ensureKeyExists($keyPrefix . 'admin_pass', $data); self::ensureKeyExists($keyPrefix . 'admin_user', $data); @@ -180,7 +180,7 @@ class Application_Model_StreamSetting $settings = self::getStreamData($p_streamId); foreach ($settings as $key => $value) { unset($settings[$key]); - $newKey = substr($key, strlen($p_streamId) + 1); //$p_streamId is assumed to be the key prefix. + $newKey = substr($key, strlen($p_streamId) + 1); // $p_streamId is assumed to be the key prefix. $settings[$newKey] = $value; } @@ -219,7 +219,7 @@ class Application_Model_StreamSetting { $stream_setting = CcStreamSettingQuery::create()->filterByDbKeyName($key)->findOne(); if (is_null($stream_setting)) { - //throw new Exception("Keyname $key does not exist!"); + // throw new Exception("Keyname $key does not exist!"); $stream_setting = new CcStreamSetting(); $stream_setting->setDbKeyName($key); $stream_setting->setDbType(''); @@ -355,7 +355,7 @@ class Application_Model_StreamSetting $stmt->bindParam(':msg', $msg); if ($stmt->execute()) { - //do nothing + // do nothing } else { $msg = implode(',', $stmt->errorInfo()); diff --git a/legacy/application/models/Systemstatus.php b/legacy/application/models/Systemstatus.php index 681272646..8e3d06617 100644 --- a/legacy/application/models/Systemstatus.php +++ b/legacy/application/models/Systemstatus.php @@ -14,7 +14,7 @@ class Application_Model_Systemstatus curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); // curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password"); - //wait a max of 3 seconds before aborting connection attempt + // wait a max of 3 seconds before aborting connection attempt curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); $result = curl_exec($ch); @@ -75,12 +75,12 @@ class Application_Model_Systemstatus if ($status == '2') { $data = $starting; } elseif ($status == 1) { - //is monitored, but is it running? + // is monitored, but is it running? $pid = $item->getElementsByTagName('pid'); if ($pid->length == 0) { $data = $notRunning; } - //running! + // running! } elseif ($status == 0) { $data = $notMonitored; } diff --git a/legacy/application/models/User.php b/legacy/application/models/User.php index eb46e04f1..c17968497 100644 --- a/legacy/application/models/User.php +++ b/legacy/application/models/User.php @@ -362,8 +362,8 @@ class Application_Model_User } if ($record['login'] == 'sourcefabric_admin') { - //arrays in PHP are basically associative arrays that can be iterated in order. - //Deleting an earlier element does not change the keys of elements that come after it. --MK + // arrays in PHP are basically associative arrays that can be iterated in order. + // Deleting an earlier element does not change the keys of elements that come after it. --MK unset($res['aaData'][$key]); --$res['iTotalDisplayRecords']; --$res['iTotalRecords']; @@ -400,8 +400,8 @@ SQL; try { return new self($userinfo->id); } catch (Exception $e) { - //we get here if $userinfo->id is defined, but doesn't exist - //in the database anymore. + // we get here if $userinfo->id is defined, but doesn't exist + // in the database anymore. Zend_Auth::getInstance()->clearIdentity(); return null; diff --git a/legacy/application/models/Webstream.php b/legacy/application/models/Webstream.php index f74b9b748..7336156f7 100644 --- a/legacy/application/models/Webstream.php +++ b/legacy/application/models/Webstream.php @@ -6,7 +6,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable public function __construct($webstream) { - //TODO: hacky... + // TODO: hacky... if (is_int($webstream)) { $this->webstream = CcWebstreamQuery::create()->findPK($webstream); if (is_null($this->webstream)) { @@ -93,7 +93,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $isAdminOrPM = $user->isUserType([UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER]); if (!$isAdminOrPM) { - //Make sure the user has ownership of ALL the selected webstreams before + // Make sure the user has ownership of ALL the selected webstreams before $leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId); if (count($leftOver) == 0) { CcWebstreamQuery::create()->findPKs($p_ids)->delete(); @@ -141,8 +141,8 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable } if (!$invalid_date_interval) { - //Due to the way our Regular Expression is set up, we could have $minutes or $hours - //not set. Do simple test here + // Due to the way our Regular Expression is set up, we could have $minutes or $hours + // not set. Do simple test here if (!is_numeric($hours)) { $hours = 0; } @@ -150,7 +150,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $minutes = 0; } - //minutes cannot be over 59. Need to convert anything > 59 minutes into hours. + // minutes cannot be over 59. Need to convert anything > 59 minutes into hours. $hours += intval($minutes / 60); $minutes = $minutes % 60; @@ -168,9 +168,9 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable } $url = $parameters['url']; - //simple validator that checks to make sure that the url starts with - //http(s), - //and that the domain is at least 1 letter long + // simple validator that checks to make sure that the url starts with + // http(s), + // and that the domain is at least 1 letter long $result = preg_match('/^(http|https):\/\/.+/', $url, $matches); $mime = null; @@ -221,7 +221,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable } // TODO : Fix this interface - //This function should not be defined in the interface. + // This function should not be defined in the interface. public function setMetadata($key, $val) { throw new Exception('Not implemented.'); @@ -246,7 +246,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // grab URL and pass it to the browser - //TODO: What if invalid url? + // TODO: What if invalid url? $content = curl_exec($ch); // close cURL resource, and free up system resources @@ -260,7 +260,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $content = self::getUrlData($url); $dom = new DOMDocument(); - //TODO: What if invalid xml? + // TODO: What if invalid xml? $dom->loadXML($content); $tracks = $dom->getElementsByTagName('track'); @@ -279,16 +279,16 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $content = self::getUrlData($url); $matches = []; - $numStreams = 0; //Number of streams explicitly listed in the PLS. + $numStreams = 0; // Number of streams explicitly listed in the PLS. if (preg_match('/NumberOfEntries=([0-9]*)/', $content, $matches) !== false) { $numStreams = $matches[1]; } - //Find all the stream URLs in the playlist + // Find all the stream URLs in the playlist if (preg_match_all('/File[0-9]*=(.*)/', $content, $matches) !== false) { - //This array contains all the streams! If we need fallback stream URLs in the future, - //they're already in this array... + // This array contains all the streams! If we need fallback stream URLs in the future, + // they're already in this array... return $matches[1][0]; } @@ -299,13 +299,13 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable { $content = self::getUrlData($url); - //split into lines: + // split into lines: $delim = "\n"; if (strpos($content, "\r\n") !== false) { $delim = "\r\n"; } $lines = explode("{$delim}", $content); - //$lines = preg_split('/$\R?^/m', $content); + // $lines = preg_split('/$\R?^/m', $content); if (count($lines) > 0) { return $lines[0]; @@ -358,7 +358,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable * */ private static function cleanHeaders($headers) { - //find the position of HTTP/1 200 OK + // find the position of HTTP/1 200 OK // $position = 0; foreach ($headers as $i => $v) { @@ -439,7 +439,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $p_webstreamId, Application_Model_Schedule::getAllFutureScheduledWebstreams() )) { - //$webstream->setDbIsScheduled($p_status)->save(); + // $webstream->setDbIsScheduled($p_status)->save(); $updateIsScheduled = true; } diff --git a/legacy/application/models/airtime/CcFiles.php b/legacy/application/models/airtime/CcFiles.php index abdef8caa..787d2a97a 100644 --- a/legacy/application/models/airtime/CcFiles.php +++ b/legacy/application/models/airtime/CcFiles.php @@ -27,7 +27,7 @@ class CcFiles extends BaseCcFiles public const IMPORT_STATUS_PENDING = 1; public const IMPORT_STATUS_FAILED = 2; - //fields that are not modifiable via our RESTful API + // fields that are not modifiable via our RESTful API private static $blackList = [ 'id', 'directory', @@ -41,7 +41,7 @@ class CcFiles extends BaseCcFiles 'is_playlist', ]; - //fields we should never expose through our RESTful API + // fields we should never expose through our RESTful API private static $privateFields = [ 'file_exists', 'silan_check', @@ -85,8 +85,8 @@ class CcFiles extends BaseCcFiles * files won't get removed from the organize folder. */ - //Extract the original filename, which we set as the temporary title for the track - //until it's finished being processed by the analyzer. + // Extract the original filename, which we set as the temporary title for the track + // until it's finished being processed by the analyzer. $originalFilename = $fileArray['file']['name']; $tempFilePath = $fileArray['file']['tmp_name']; @@ -136,7 +136,7 @@ class CcFiles extends BaseCcFiles $file = new CcFiles(); try { - //Only accept files with a file extension that we support. + // Only accept files with a file extension that we support. // Let the analyzer do the heavy lifting in terms of mime verification and playability $fileExtension = pathinfo($originalFilename, PATHINFO_EXTENSION); if (!in_array(strtolower($fileExtension), array_values(FileDataHelper::getAudioMimeTypeArray()))) { @@ -205,7 +205,7 @@ class CcFiles extends BaseCcFiles if ($file && isset($fileArray['resource_id'])) { $file->fromArray($fileArray, BasePeer::TYPE_FIELDNAME); - //store the original filename + // store the original filename $file->setDbFilepath($fileArray['filename']); $fileSizeBytes = $fileArray['filesize']; @@ -226,9 +226,9 @@ class CcFiles extends BaseCcFiles $file->fromArray($fileArray, BasePeer::TYPE_FIELDNAME); - //Our RESTful API takes "full_path" as a field, which we then split and translate to match - //our internal schema. Internally, file path is stored relative to a directory, with the directory - //as a foreign key to cc_music_dirs. + // Our RESTful API takes "full_path" as a field, which we then split and translate to match + // our internal schema. Internally, file path is stored relative to a directory, with the directory + // as a foreign key to cc_music_dirs. if (isset($fileArray['full_path'])) { $fileSizeBytes = filesize($fileArray['full_path']); if (!isset($fileSizeBytes) || $fileSizeBytes === false) { @@ -241,7 +241,7 @@ class CcFiles extends BaseCcFiles $pos = strpos($fullPath, $storDir); if ($pos !== false) { - assert($pos == 0); //Path must start with the stor directory path + assert($pos == 0); // Path must start with the stor directory path $filePathRelativeToStor = substr($fullPath, strlen($storDir)); $file->setDbFilepath($filePathRelativeToStor); @@ -293,7 +293,7 @@ class CcFiles extends BaseCcFiles // EditAudioMD form is used here for validation $fileForm = new Application_Form_EditAudioMD(); - $fileForm->startForm(0); //The file ID doesn't matter here + $fileForm->startForm(0); // The file ID doesn't matter here $fileForm->populate($fileArray); /* @@ -305,8 +305,8 @@ class CcFiles extends BaseCcFiles foreach ($fileArray as $tag => &$value) { if ($fileForm->getElement($tag)) { $stringLengthValidator = $fileForm->getElement($tag)->getValidator('StringLength'); - //$stringLengthValidator will be false if the StringLength validator doesn't exist on the current element - //in which case we don't have to truncate the extra characters + // $stringLengthValidator will be false if the StringLength validator doesn't exist on the current element + // in which case we don't have to truncate the extra characters if ($stringLengthValidator) { $value = substr($value, 0, $stringLengthValidator->getMax()); } @@ -365,7 +365,7 @@ class CcFiles extends BaseCcFiles * * @return array */ - //TODO: rename this function? + // TODO: rename this function? public static function sanitizeResponse($file) { $response = $file->toArray(BasePeer::TYPE_FIELDNAME); @@ -389,7 +389,7 @@ class CcFiles extends BaseCcFiles { $info = pathinfo($this->getAbsoluteFilePath()); - //filename doesn't contain the extension because PHP is awful + // filename doesn't contain the extension because PHP is awful $mime = $this->getDbMime(); $extension = FileDataHelper::getFileExtensionFromMime($mime); @@ -492,8 +492,8 @@ class CcFiles extends BaseCcFiles private static function stripInvalidUtf8Characters($string) { - //Remove invalid UTF-8 characters - //reject overly long 2 byte sequences, as well as characters above U+10000 and replace with ? + // Remove invalid UTF-8 characters + // reject overly long 2 byte sequences, as well as characters above U+10000 and replace with ? $string = preg_replace( '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' . '|[\x00-\x7F][\x80-\xBF]+' . @@ -504,11 +504,11 @@ class CcFiles extends BaseCcFiles $string ); - //reject overly long 3 byte sequences and UTF-16 surrogates and replace with ? + // reject overly long 3 byte sequences and UTF-16 surrogates and replace with ? $string = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' . '|\xED[\xA0-\xBF][\x80-\xBF]/S', '?', $string); - //Do a final encoding conversion to + // Do a final encoding conversion to return mb_convert_encoding($string, 'UTF-8', 'UTF-8'); } diff --git a/legacy/application/models/airtime/CcPlaylistcontents.php b/legacy/application/models/airtime/CcPlaylistcontents.php index 852732106..bfde42f42 100644 --- a/legacy/application/models/airtime/CcPlaylistcontents.php +++ b/legacy/application/models/airtime/CcPlaylistcontents.php @@ -70,7 +70,7 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; $this->save(); - //FIXME(XXX): Propel silently drops the milliseconds from our fadein time. :( + // FIXME(XXX): Propel silently drops the milliseconds from our fadein time. :( return $this; } // setDbFadein() @@ -108,7 +108,7 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; $this->save(); - //FIXME(XXX): Propel silently drops the milliseconds from our fadeout time. :( + // FIXME(XXX): Propel silently drops the milliseconds from our fadeout time. :( return $this; } // setDbFadeout() diff --git a/legacy/application/models/airtime/CcPlayoutHistoryMetaData.php b/legacy/application/models/airtime/CcPlayoutHistoryMetaData.php index ff35cb417..bba058970 100644 --- a/legacy/application/models/airtime/CcPlayoutHistoryMetaData.php +++ b/legacy/application/models/airtime/CcPlayoutHistoryMetaData.php @@ -18,7 +18,7 @@ class CcPlayoutHistoryMetaData extends BaseCcPlayoutHistoryMetaData */ public function setDbValue($v) { - //make sure the metadata isn't longer than the DB field. + // make sure the metadata isn't longer than the DB field. $v = substr($v, 0, 128); parent::setDbValue($v); diff --git a/legacy/application/models/airtime/CcShow.php b/legacy/application/models/airtime/CcShow.php index cf1829b13..b162d8fbc 100644 --- a/legacy/application/models/airtime/CcShow.php +++ b/legacy/application/models/airtime/CcShow.php @@ -94,7 +94,7 @@ class CcShow extends BaseCcShow */ public function isRepeating() { - //get all cc_show_day entries that are repeating + // get all cc_show_day entries that are repeating $ccShowDays = CcShowDaysQuery::create() ->filterByDbShowId($this->id) ->filterByDbRepeatType(0, Criteria::GREATER_EQUAL) @@ -113,7 +113,7 @@ class CcShow extends BaseCcShow */ public function getEditedRepeatingInstanceIds() { - //get cc_show_days that have been edited (not repeating) + // get cc_show_days that have been edited (not repeating) $ccShowDays = CcShowDaysQuery::create() ->filterByDbShowId($this->id) ->filterByDbRepeatType(-1) @@ -123,7 +123,7 @@ class CcShow extends BaseCcShow $utc = new DateTimeZone('UTC'); foreach ($ccShowDays as $day) { - //convert to UTC + // convert to UTC $starts = new DateTime( $day->getDbFirstShow() . ' ' . $day->getDbStartTime(), new DateTimeZone($day->getDbTimezone()) @@ -301,7 +301,7 @@ class CcShow extends BaseCcShow return $instanceIds; } - //what is this?? + // what is this?? public function getOtherInstances($instanceId) { return CcShowInstancesQuery::create() diff --git a/legacy/application/models/airtime/CcShowDays.php b/legacy/application/models/airtime/CcShowDays.php index ea4efe61f..514597f32 100644 --- a/legacy/application/models/airtime/CcShowDays.php +++ b/legacy/application/models/airtime/CcShowDays.php @@ -33,8 +33,8 @@ class CcShowDays extends BaseCcShowDays new DateTimeZone($this->getDbTimezone()) ); - //set timezone to that of the show - //$dt->setTimezone(new DateTimeZone($this->getDbTimezone())); + // set timezone to that of the show + // $dt->setTimezone(new DateTimeZone($this->getDbTimezone())); } /** diff --git a/legacy/application/models/airtime/CcShowInstances.php b/legacy/application/models/airtime/CcShowInstances.php index 7e8c22225..35038926c 100644 --- a/legacy/application/models/airtime/CcShowInstances.php +++ b/legacy/application/models/airtime/CcShowInstances.php @@ -108,19 +108,19 @@ class CcShowInstances extends BaseCcShowInstances return $dt->format($format); } - //post save hook to update the cc_schedule status column for the tracks in the show. + // post save hook to update the cc_schedule status column for the tracks in the show. public function updateScheduleStatus(PropelPDO $con) { $this->updateDbTimeFilled($con); - //scheduled track is in the show + // scheduled track is in the show CcScheduleQuery::create() ->filterByDbInstanceId($this->id) ->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL) ->filterByDbEnds($this->ends, Criteria::LESS_EQUAL) ->update(['DbPlayoutStatus' => 1], $con); - //scheduled track is a boundary track + // scheduled track is a boundary track CcScheduleQuery::create() ->filterByDbInstanceId($this->id) ->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL) @@ -128,7 +128,7 @@ class CcShowInstances extends BaseCcShowInstances ->filterByDbEnds($this->ends, Criteria::GREATER_THAN) ->update(['DbPlayoutStatus' => 2], $con); - //scheduled track is overbooked. + // scheduled track is overbooked. CcScheduleQuery::create() ->filterByDbInstanceId($this->id) ->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL) diff --git a/legacy/application/models/airtime/CloudFile.php b/legacy/application/models/airtime/CloudFile.php index c8f8e1986..64de1aa28 100644 --- a/legacy/application/models/airtime/CloudFile.php +++ b/legacy/application/models/airtime/CloudFile.php @@ -49,7 +49,7 @@ class CloudFile extends BaseCloudFile $filename = $this->getDbFilepath(); $info = pathinfo($filename); - //Add the correct file extension based on the MIME type, for files that were uploaded with the wrong extension. + // Add the correct file extension based on the MIME type, for files that were uploaded with the wrong extension. $mime = $this->getDbMime(); $extension = FileDataHelper::getFileExtensionFromMime($mime); diff --git a/legacy/application/models/airtime/Podcast.php b/legacy/application/models/airtime/Podcast.php index 68618d15b..392f95006 100644 --- a/legacy/application/models/airtime/Podcast.php +++ b/legacy/application/models/airtime/Podcast.php @@ -29,8 +29,8 @@ class Podcast extends BasePodcast if (!is_null($importedPodcast)) { $importedPodcastArray = $importedPodcast->toArray($keyType); - //unset these values because we already have the podcast id in $podcastArray - //and we don't need the imported podcast ID + // unset these values because we already have the podcast id in $podcastArray + // and we don't need the imported podcast ID unset($importedPodcastArray['id'], $importedPodcastArray['podcast_id']); return array_merge($podcastArray, $importedPodcastArray); @@ -63,6 +63,6 @@ class Podcast extends BasePodcast $importedPodcast->fromArray($arr, $keyType); $importedPodcast->save(); } - //TODO: station podcast + // TODO: station podcast } } diff --git a/legacy/application/models/formatters/LengthFormatter.php b/legacy/application/models/formatters/LengthFormatter.php index be0a40c10..c2b37a2d9 100644 --- a/legacy/application/models/formatters/LengthFormatter.php +++ b/legacy/application/models/formatters/LengthFormatter.php @@ -30,12 +30,12 @@ class LengthFormatter } $minutes = $pieces[1]; - //length is less than 1 hour + // length is less than 1 hour if (!isset($hours)) { if (intval($minutes) !== 0) { $minutes = ltrim($minutes, '0'); } - //length is less than 1 minute + // length is less than 1 minute else { unset($minutes); } diff --git a/legacy/application/models/formatters/TimeFilledFormatter.php b/legacy/application/models/formatters/TimeFilledFormatter.php index 9785be13f..74a2a895d 100644 --- a/legacy/application/models/formatters/TimeFilledFormatter.php +++ b/legacy/application/models/formatters/TimeFilledFormatter.php @@ -42,7 +42,7 @@ class TimeFilledFormatter $perfect = false; } - //0 over/under lap of content. + // 0 over/under lap of content. if ($perfect === true) { $formatted = '+ 0s'; } diff --git a/legacy/application/models/tests/AllTests.php b/legacy/application/models/tests/AllTests.php index 148e0fa74..6cb7a5b67 100644 --- a/legacy/application/models/tests/AllTests.php +++ b/legacy/application/models/tests/AllTests.php @@ -5,12 +5,12 @@ $WHITE_SCREEN_OF_DEATH = false; require_once dirname(__FILE__) . '/../../configs/conf.php'; -//$suite = new PHPUnit_TestSuite("PlayListTests"); -//$suite = new PHPUnit_TestSuite("SchedulerTests"); +// $suite = new PHPUnit_TestSuite("PlayListTests"); +// $suite = new PHPUnit_TestSuite("SchedulerTests"); $suite = new PHPUnit_TestSuite('StoredFileTest'); $suite->addTestSuite('PlaylistTests'); $suite->addTestSuite('SchedulerTests'); -//$suite->addTestSuite("SchedulerExportTests"); +// $suite->addTestSuite("SchedulerExportTests"); $result = PHPUnit::run($suite); echo $result->toString(); diff --git a/legacy/application/models/tests/SchedulerTests.php b/legacy/application/models/tests/SchedulerTests.php index 8359d3fce..7eccf4031 100644 --- a/legacy/application/models/tests/SchedulerTests.php +++ b/legacy/application/models/tests/SchedulerTests.php @@ -15,7 +15,7 @@ class SchedulerTests extends PHPUnit_TestCase global $CC_CONFIG; // Clear the files table - //$sql = "DELETE FROM ".$CC_CONFIG["filesTable"]; + // $sql = "DELETE FROM ".$CC_CONFIG["filesTable"]; // Add a file $values = ['filepath' => dirname(__FILE__) . '/test10001.mp3']; @@ -26,7 +26,7 @@ class SchedulerTests extends PHPUnit_TestCase $this->storedFile2 = Application_Model_StoredFile::Insert($values, false); // Clear the schedule table - //$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]; + // $sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]; } public function testDateToId() diff --git a/legacy/application/models/tests/StoredFileTests.php b/legacy/application/models/tests/StoredFileTests.php index 65b7e2f02..ed0b0e96e 100644 --- a/legacy/application/models/tests/StoredFileTests.php +++ b/legacy/application/models/tests/StoredFileTests.php @@ -27,8 +27,8 @@ class StoredFileTest extends PHPUnit_TestCase . ' [dc:type] = ' . $metadata['dc:type'] . "\n"; $this->fail("Metadata has unexpected values:\n" . $str); } - //var_dump($metadata); - //$this->assertTrue(FALSE); + // var_dump($metadata); + // $this->assertTrue(FALSE); } public function testDeleteAndPutFile() @@ -47,7 +47,7 @@ class StoredFileTest extends PHPUnit_TestCase $values = ['filepath' => $filePath, 'dc:description' => 'Unit test ' . time(), ]; $storedFile = Application_Model_StoredFile::Insert($values, false); - //var_dump($storedFile); + // var_dump($storedFile); $id = $storedFile->getId(); if (!is_numeric($id)) { $this->fail('StoredFile not created correctly. id = ' . $id); @@ -64,7 +64,7 @@ class StoredFileTest extends PHPUnit_TestCase return; } - //var_dump($md); + // var_dump($md); // Check if the length field has been set. $f2 = Application_Model_StoredFile::RecallByGunid($storedFile->getGunid()); diff --git a/legacy/application/models/tests/populator.php b/legacy/application/models/tests/populator.php index 2d5018818..f3c1c7a58 100644 --- a/legacy/application/models/tests/populator.php +++ b/legacy/application/models/tests/populator.php @@ -74,16 +74,16 @@ function createTestShow($showNumber, $showTime, $duration = '1:00') $data['add_show_record'] = 0; $data['add_show_hosts'] = ''; $showId = Application_Model_Show::create($data); - //echo "show created, ID: $showId\n"; + // echo "show created, ID: $showId\n"; // populating the show with a playlist $instances = Application_Model_Show::getShows($showTime, $showTime); $instance = array_pop($instances); $show = new Application_Model_ShowInstance($instance['instance_id']); - //echo "Adding playlist to show instance ".$show->getShowInstanceId()."\n"; + // echo "Adding playlist to show instance ".$show->getShowInstanceId()."\n"; $show->scheduleShow([1]); - //echo "done\n"; - //$show->scheduleShow(array($playlist->getId())); + // echo "done\n"; + // $show->scheduleShow(array($playlist->getId())); } $showTime = new DateTime(); diff --git a/legacy/application/modules/rest/controllers/MediaController.php b/legacy/application/modules/rest/controllers/MediaController.php index 8d7cf429a..e8074327b 100644 --- a/legacy/application/modules/rest/controllers/MediaController.php +++ b/legacy/application/modules/rest/controllers/MediaController.php @@ -27,7 +27,7 @@ class Rest_MediaController extends Zend_Rest_Controller $offset = $this->_getParam('offset', 0); $limit = $this->_getParam('limit', $totalFileCount); - //Sorting parameters + // Sorting parameters $sortColumn = $this->_getParam('sort', CcFilesPeer::ID); $sortDir = $this->_getParam('sort_dir', Criteria::ASC); @@ -38,7 +38,7 @@ class Rest_MediaController extends Zend_Rest_Controller ->setLimit($limit) ->setOffset($offset) ->orderBy($sortColumn, $sortDir); - //->orderByDbId(); + // ->orderByDbId(); $queryCount = $query->count(); $queryResult = $query->find(); @@ -114,8 +114,8 @@ class Rest_MediaController extends Zend_Rest_Controller public function postAction() { - //If we do get an ID on a POST, then that doesn't make any sense - //since POST is only for creating. + // If we do get an ID on a POST, then that doesn't make any sense + // since POST is only for creating. if ($id = $this->_getParam('id', false)) { $resp = $this->getResponse(); $resp->setHttpResponseCode(400); diff --git a/legacy/application/modules/rest/controllers/PodcastController.php b/legacy/application/modules/rest/controllers/PodcastController.php index d670e629f..65bef6593 100644 --- a/legacy/application/modules/rest/controllers/PodcastController.php +++ b/legacy/application/modules/rest/controllers/PodcastController.php @@ -26,7 +26,7 @@ class Rest_PodcastController extends Zend_Rest_Controller $offset = $this->_getParam('offset', 0); $limit = $this->_getParam('limit', 0); - //Sorting parameters + // Sorting parameters $sortColumn = $this->_getParam('sort', PodcastPeer::ID); $sortDir = $this->_getParam('sort_dir', Criteria::ASC); @@ -72,8 +72,8 @@ class Rest_PodcastController extends Zend_Rest_Controller public function postAction() { - //If we do get an ID on a POST, then that doesn't make any sense - //since POST is only for creating. + // If we do get an ID on a POST, then that doesn't make any sense + // since POST is only for creating. if ($id = $this->_getParam('id', false)) { $resp = $this->getResponse(); $resp->setHttpResponseCode(400); diff --git a/legacy/application/modules/rest/controllers/PodcastEpisodesController.php b/legacy/application/modules/rest/controllers/PodcastEpisodesController.php index 281aefa96..61f2051a7 100644 --- a/legacy/application/modules/rest/controllers/PodcastEpisodesController.php +++ b/legacy/application/modules/rest/controllers/PodcastEpisodesController.php @@ -42,7 +42,7 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller $offset = $this->_getParam('offset', 0); $limit = $this->_getParam('limit', $totalPodcastEpisodesCount); - //Sorting parameters + // Sorting parameters $sortColumn = $this->_getParam('sort', PodcastEpisodesPeer::ID); $sortDir = $this->_getParam('sort_dir', Criteria::ASC); @@ -90,8 +90,8 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller public function postAction() { - //If we do get an episode ID on a POST, then that doesn't make any sense - //since POST is only for creating. + // If we do get an episode ID on a POST, then that doesn't make any sense + // since POST is only for creating. if ($episodeId = $this->_getParam('episode_id', false)) { $resp = $this->getResponse(); $resp->setHttpResponseCode(400); diff --git a/legacy/application/modules/rest/controllers/RouteController.php b/legacy/application/modules/rest/controllers/RouteController.php index 0340af0c2..f76ddface 100644 --- a/legacy/application/modules/rest/controllers/RouteController.php +++ b/legacy/application/modules/rest/controllers/RouteController.php @@ -60,7 +60,7 @@ class Rest_RouteController extends Zend_Controller_Router_Route $path = explode(self::URI_DELIMITER, $path); } - //Store path count for method mapping + // Store path count for method mapping $pathElementCount = count($path); // Determine Action diff --git a/legacy/application/modules/rest/controllers/ShowImageController.php b/legacy/application/modules/rest/controllers/ShowImageController.php index 5e73e51dc..5d714861c 100644 --- a/legacy/application/modules/rest/controllers/ShowImageController.php +++ b/legacy/application/modules/rest/controllers/ShowImageController.php @@ -156,7 +156,7 @@ class Rest_ShowImageController extends Zend_Rest_Controller { $ownerId = RestAuth::getOwnerId(); - //Only accept files with a file extension that we support. + // Only accept files with a file extension that we support. $fileExtension = $this->getFileExtension($tempFilePath); if (!in_array(strtolower($fileExtension), explode(',', 'jpg,png,gif,jpeg'))) { @@ -250,11 +250,11 @@ class Rest_ShowImageController extends Zend_Rest_Controller Logging::info("copyFileToStor: moving file {$image_file} to {$image_stor}"); if (@rename($image_file, $image_stor) === false) { - //something went wrong likely there wasn't enough space in . - //the audio_stor to move the file too warn the user that . - //the file wasn't uploaded and they should check if there . - //is enough disk space . - unlink($image_file); //remove the file after failed rename + // something went wrong likely there wasn't enough space in . + // the audio_stor to move the file too warn the user that . + // the file wasn't uploaded and they should check if there . + // is enough disk space . + unlink($image_file); // remove the file after failed rename throw new Exception('The file was not uploaded, this error can occur if the computer ' . 'hard drive does not have enough disk space or the stor ' diff --git a/legacy/application/modules/rest/helpers/RestAuth.php b/legacy/application/modules/rest/helpers/RestAuth.php index d15c60378..214d003ce 100644 --- a/legacy/application/modules/rest/helpers/RestAuth.php +++ b/legacy/application/modules/rest/helpers/RestAuth.php @@ -4,7 +4,7 @@ class RestAuth { public static function verifyAuth($checkApiKey, $checkSession, $action) { - //Session takes precedence over API key for now: + // Session takes precedence over API key for now: if ($checkSession && self::verifySession() || $checkApiKey && self::verifyAPIKey($action) ) { @@ -51,11 +51,11 @@ class RestAuth private static function verifyAPIKey($action) { - //The API key is passed in via HTTP "basic authentication": + // The API key is passed in via HTTP "basic authentication": // http://en.wikipedia.org/wiki/Basic_access_authentication $CC_CONFIG = Config::getConfig(); - //Decode the API key that was passed to us in the HTTP request. + // Decode the API key that was passed to us in the HTTP request. $authHeader = $action->getRequest()->getHeader('Authorization'); $encodedRequestApiKey = substr($authHeader, strlen('Basic ')); $encodedStoredApiKey = base64_encode($CC_CONFIG['apiKey'][0] . ':'); diff --git a/legacy/application/services/CalendarService.php b/legacy/application/services/CalendarService.php index 68647d56a..16824c333 100644 --- a/legacy/application/services/CalendarService.php +++ b/legacy/application/services/CalendarService.php @@ -31,15 +31,15 @@ class Application_Service_CalendarService $isAdminOrPM = $this->currentUser->isAdminOrPM(); $isHostOfShow = $this->currentUser->isHostOfShow($this->ccShow->getDbId()); - //DateTime objects in UTC + // DateTime objects in UTC $startDT = $this->ccShowInstance->getDbStarts(null); $endDT = $this->ccShowInstance->getDbEnds(null); - //timestamps + // timestamps $start = $startDT->getTimestamp(); $end = $endDT->getTimestamp(); - //show has ended + // show has ended if ($now > $end) { if ($this->ccShowInstance->isRecorded()) { $ccFile = $this->ccShowInstance->getCcFiles(); @@ -68,10 +68,10 @@ class Application_Service_CalendarService $currentShowId = count($currentShow) == 1 ? $currentShow[0]['id'] : null; $showIsLinked = $this->ccShow->isLinked(); - //user can add/remove content if the show has not ended + // user can add/remove content if the show has not ended if ($now < $end && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded()) { - //if the show is not linked OR if the show is linked AND not the current playing show - //the user can add/remove content + // if the show is not linked OR if the show is linked AND not the current playing show + // the user can add/remove content if (!$showIsLinked || ($showIsLinked && $currentShowId != $this->ccShow->getDbId())) { $menu['schedule'] = [ // "name"=> _("Add / Remove Content"), @@ -81,8 +81,8 @@ class Application_Service_CalendarService } } - //"Show Content" should be a menu item at all times except when - //the show is recorded + // "Show Content" should be a menu item at all times except when + // the show is recorded if (!$this->ccShowInstance->isRecorded()) { $menu['content'] = [ // "name"=> _("Show Content"), @@ -91,10 +91,10 @@ class Application_Service_CalendarService 'url' => $baseUrl . 'schedule/show-content-dialog', ]; } - //user can remove all content if the show has not started + // user can remove all content if the show has not started if ($now < $start && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded()) { - //if the show is not linked OR if the show is linked AND not the current playing show - //the user can remove all content + // if the show is not linked OR if the show is linked AND not the current playing show + // the user can remove all content if (!$showIsLinked || ($showIsLinked && $currentShowId != $this->ccShow->getDbId())) { $menu['clear'] = [ // "name"=> _("Remove All Content"), @@ -104,7 +104,7 @@ class Application_Service_CalendarService } } - //show is currently playing and user is admin + // show is currently playing and user is admin if ($start <= $now && $now < $end && $isAdminOrPM) { // Menu separator $menu['sep1'] = '-----------'; @@ -171,13 +171,13 @@ class Application_Service_CalendarService } } - //show hasn't started yet and user is admin + // show hasn't started yet and user is admin if ($now < $start && $isAdminOrPM) { // Menu separator $menu['sep3'] = '-----------'; - //show is repeating so give user the option to delete all - //repeating instances or just the one + // show is repeating so give user the option to delete all + // repeating instances or just the one if ($isRepeating) { $menu['del'] = [ 'name' => _('Delete'), @@ -263,9 +263,9 @@ class Application_Service_CalendarService throw new Exception(_("Can't move a past show")); } - //the user is moving the show on the calendar from the perspective of local time. - //incase a show is moved across a time change border offsets should be added to the localtime - //stamp and then converted back to UTC to avoid show time changes! + // the user is moving the show on the calendar from the perspective of local time. + // incase a show is moved across a time change border offsets should be added to the localtime + // stamp and then converted back to UTC to avoid show time changes! $showTimezone = $this->ccShow->getFirstCcShowDay()->getDbTimezone(); $startsDateTime->setTimezone(new DateTimeZone($showTimezone)); $endsDateTime->setTimezone(new DateTimeZone($showTimezone)); @@ -286,11 +286,11 @@ class Application_Service_CalendarService The key lesson here is that in general: duration != end - start ... so be careful! */ - //$newEndsDateTime = self::addDeltas($endsDateTime, $deltaDay, $deltaMin); <--- Wrong, don't do it. + // $newEndsDateTime = self::addDeltas($endsDateTime, $deltaDay, $deltaMin); <--- Wrong, don't do it. $newEndsDateTime = clone $newStartsDateTime; $newEndsDateTime = $newEndsDateTime->add($duration); - //convert our new starts/ends to UTC. + // convert our new starts/ends to UTC. $newStartsDateTime->setTimezone(new DateTimeZone('UTC')); $newEndsDateTime->setTimezone(new DateTimeZone('UTC')); @@ -298,7 +298,7 @@ class Application_Service_CalendarService throw new Exception(_("Can't move show into past")); } - //check if show is overlapping + // check if show is overlapping $overlapping = Application_Model_Schedule::checkOverlappingShows( $newStartsDateTime, $newEndsDateTime, @@ -310,9 +310,9 @@ class Application_Service_CalendarService } if ($this->ccShow->isRecorded()) { - //rebroadcasts should start at max 1 hour after a recorded show has ended. + // rebroadcasts should start at max 1 hour after a recorded show has ended. $minRebroadcastStart = self::addDeltas($newEndsDateTime, 0, 60); - //check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts. + // check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts. $rebroadcasts = CcShowInstancesQuery::create() ->filterByDbOriginalShow($this->ccShow->getDbId()) ->filterByDbStarts($minRebroadcastStart->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN) @@ -350,7 +350,7 @@ class Application_Service_CalendarService $con = Propel::getConnection(); $con->beginTransaction(); - //new starts,ends are in UTC + // new starts,ends are in UTC [$newStartsDateTime, $newEndsDateTime] = $this->validateShowMove( $deltaDay, $deltaMin @@ -364,8 +364,8 @@ class Application_Service_CalendarService ->save($con); if (!$this->ccShowInstance->getCcShow()->isRebroadcast()) { - //we can get the first show day because we know the show is - //not repeating, and therefore will only have one show day entry + // we can get the first show day because we know the show is + // not repeating, and therefore will only have one show day entry $ccShowDay = $this->ccShow->getFirstCcShowDay(); $showTimezone = new DateTimeZone($ccShowDay->getDbTimezone()); $ccShowDay @@ -390,7 +390,7 @@ class Application_Service_CalendarService } } - //TODO move the method resizeShow from Application_Model_Show here. + // TODO move the method resizeShow from Application_Model_Show here. public function resizeShow($deltaDay, $deltaMin) { try { diff --git a/legacy/application/services/HistoryService.php b/legacy/application/services/HistoryService.php index 7f0a4fb2e..5c2353ff9 100644 --- a/legacy/application/services/HistoryService.php +++ b/legacy/application/services/HistoryService.php @@ -19,7 +19,7 @@ class Application_Service_HistoryService return [self::TEMPLATE_TYPE_ITEM, self::TEMPLATE_TYPE_FILE]; } - //opts is from datatables. + // opts is from datatables. public function getPlayedItemData($startDT, $endDT, $opts, $instanceId = null) { $mainSqlQuery = ''; @@ -52,8 +52,8 @@ class Application_Service_HistoryService } } - //----------------------------------------------------------------------- - //Using the instance_id to filter the data. + // ----------------------------------------------------------------------- + // Using the instance_id to filter the data. $historyRange = '(' . 'SELECT history.starts, history.ends, history.id AS history_id, history.instance_id' . @@ -88,14 +88,14 @@ class Application_Service_HistoryService $numFileMdFields = count($fields_filemd); if ($numFileMdFields > 0) { - //these 3 selects are only needed if $fields_filemd has some fields. + // these 3 selects are only needed if $fields_filemd has some fields. $fileSelect = ['history_file.history_id']; $nonNullFileSelect = ['file.id as file_id']; $nullFileSelect = ['null_file.history_id']; $fileMdFilters = []; - //populate the different dynamic selects with file info. + // populate the different dynamic selects with file info. for ($i = 0; $i < $numFileMdFields; ++$i) { $field = $fields_filemd[$i]; $key = $field['name']; @@ -110,7 +110,7 @@ class Application_Service_HistoryService $paramMap["meta_{$key}"] = $key; } - //the files associated with scheduled playback in Airtime. + // the files associated with scheduled playback in Airtime. $historyFile = '(' . 'SELECT history.id AS history_id, history.file_id' . ' FROM cc_playout_history AS history' . @@ -124,15 +124,15 @@ class Application_Service_HistoryService $fileMd = str_replace('%NON_NULL_FILE_SELECT%', implode(', ', $nonNullFileSelect), $fileMd); - //null files are from manually added data (filling in webstream info etc) + // null files are from manually added data (filling in webstream info etc) $nullFile = '(' . 'SELECT history.id AS history_id' . ' FROM cc_playout_history AS history' . ' WHERE history.file_id IS NULL' . ') AS null_file'; - //---------------------------------- - //building the file inner query + // ---------------------------------- + // building the file inner query $fileSqlQuery = 'SELECT ' . implode(', ', $fileSelect) . @@ -172,8 +172,8 @@ class Application_Service_HistoryService " LEFT JOIN {$filter} USING(history_id)"; } - //---------------------------------------------------------------------- - //need to count the total rows to tell Datatables. + // ---------------------------------------------------------------------- + // need to count the total rows to tell Datatables. $stmt = $this->con->prepare($mainSqlQuery); foreach ($paramMap as $param => $v) { $stmt->bindValue($param, $v); @@ -187,8 +187,8 @@ class Application_Service_HistoryService throw new Exception("Error: {$msg}"); } - //------------------------------------------------------------------------ - //Using Datatables parameters to sort the data. + // ------------------------------------------------------------------------ + // Using Datatables parameters to sort the data. if (empty($opts['iSortingCols'])) { $orderBys = []; @@ -209,7 +209,7 @@ class Application_Service_HistoryService $orderBys[] = "{$key}_filter.{$key} {$sortDir}"; } - //throw new Exception("Error: $key is not part of the template."); + // throw new Exception("Error: $key is not part of the template."); } } @@ -220,11 +220,11 @@ class Application_Service_HistoryService " ORDER BY {$orders}"; } - //--------------------------------------------------------------- - //using Datatables parameters to add limits/offsets + // --------------------------------------------------------------- + // using Datatables parameters to add limits/offsets $displayLength = empty($opts['iDisplayLength']) ? -1 : intval($opts['iDisplayLength']); - //limit the results returned. + // limit the results returned. if ($displayLength !== -1) { $mainSqlQuery .= ' OFFSET :offset LIMIT :limit'; @@ -247,8 +247,8 @@ class Application_Service_HistoryService throw new Exception("Error: {$msg}"); } - //----------------------------------------------------------------------- - //processing results. + // ----------------------------------------------------------------------- + // processing results. $timezoneUTC = new DateTimeZone('UTC'); $timezoneLocal = new DateTimeZone($this->timezone); @@ -265,12 +265,12 @@ class Application_Service_HistoryService $result[$field['label']] = (bool) $result[$field['name']]; } - //need to display the results in the station's timezone. + // need to display the results in the station's timezone. $dateTime = new DateTime($result['starts'], $timezoneUTC); $dateTime->setTimezone($timezoneLocal); $result['starts'] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT); - //if ends is null we don't want it to default to "now" + // if ends is null we don't want it to default to "now" if (isset($result['ends'])) { $dateTime = new DateTime($result['ends'], $timezoneUTC); $dateTime->setTimezone($timezoneLocal); @@ -282,17 +282,17 @@ class Application_Service_HistoryService $result[MDATA_KEY_DURATION] = $formatter->format(); } - //need to add a checkbox.. + // need to add a checkbox.. $result['checkbox'] = ''; - //$unicodeChar = '\u2612'; - //$result["new"] = json_decode('"'.$unicodeChar.'"'); - //$result["new"] = "U+2612"; + // $unicodeChar = '\u2612'; + // $result["new"] = json_decode('"'.$unicodeChar.'"'); + // $result["new"] = "U+2612"; } return [ 'sEcho' => empty($opts['sEcho']) ? null : intval($opts['sEcho']), - //"iTotalDisplayRecords" => intval($totalDisplayRows), + // "iTotalDisplayRecords" => intval($totalDisplayRows), 'iTotalDisplayRecords' => intval($totalRows), 'iTotalRecords' => intval($totalRows), 'history' => $rows, @@ -343,8 +343,8 @@ class Application_Service_HistoryService 'SELECT ' . implode(', ', $select) . " FROM {$fileSummaryTable}"; - //------------------------------------------------------------------------- - //need to count the total rows to tell Datatables. + // ------------------------------------------------------------------------- + // need to count the total rows to tell Datatables. $stmt = $this->con->prepare($mainSqlQuery); foreach ($paramMap as $param => $v) { $stmt->bindValue($param, $v); @@ -358,8 +358,8 @@ class Application_Service_HistoryService throw new Exception("Error: {$msg}"); } - //------------------------------------------------------------------------ - //Using Datatables parameters to sort the data. + // ------------------------------------------------------------------------ + // Using Datatables parameters to sort the data. $numOrderColumns = $opts['iSortingCols']; $orderBys = []; @@ -379,8 +379,8 @@ class Application_Service_HistoryService " ORDER BY {$orders}"; } - //------------------------------------------------------------ - //using datatables params to add limits/offsets + // ------------------------------------------------------------ + // using datatables params to add limits/offsets $displayLength = intval($opts['iDisplayLength']); if ($displayLength !== -1) { $mainSqlQuery .= @@ -404,8 +404,8 @@ class Application_Service_HistoryService throw new Exception("Error: {$msg}"); } - //----------------------------------------------------------------- - //processing the results + // ----------------------------------------------------------------- + // processing the results foreach ($rows as &$row) { if (isset($row[MDATA_KEY_DURATION])) { $formatter = new LengthFormatter($row[MDATA_KEY_DURATION]); @@ -415,7 +415,7 @@ class Application_Service_HistoryService return [ 'sEcho' => intval($opts['sEcho']), - //"iTotalDisplayRecords" => intval($totalDisplayRows), + // "iTotalDisplayRecords" => intval($totalDisplayRows), 'iTotalDisplayRecords' => intval($totalRows), 'iTotalRecords' => intval($totalRows), 'history' => $rows, @@ -436,7 +436,7 @@ class Application_Service_HistoryService Logging::info($shows); - //need to filter the list to only their shows + // need to filter the list to only their shows if ((!empty($user)) && ($user->isHost())) { $showIds = []; @@ -475,7 +475,7 @@ class Application_Service_HistoryService $timezoneLocal = new DateTimeZone($this->timezone); foreach ($filteredShows as &$result) { - //need to display the results in the station's timezone. + // need to display the results in the station's timezone. $dateTime = new DateTime($result['starts'], $timezoneUTC); $dateTime->setTimezone($timezoneLocal); $result['starts'] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT); @@ -495,7 +495,7 @@ class Application_Service_HistoryService try { $item = CcScheduleQuery::create()->findPK($schedId, $this->con); - //TODO figure out how to combine these all into 1 query. + // TODO figure out how to combine these all into 1 query. $showInstance = $item->getCcShowInstances($this->con); $show = $showInstance->getCcShow($this->con); @@ -539,13 +539,13 @@ class Application_Service_HistoryService throw new Exception('Invalid schedule id: ' . $schedId); } - //TODO figure out how to combine these all into 1 query. + // TODO figure out how to combine these all into 1 query. $showInstance = $item->getCcShowInstances($this->con); $show = $showInstance->getCcShow($this->con); $fileId = $item->getDbFileId(); - //don't add webstreams + // don't add webstreams if (isset($fileId)) { $metadata = []; $metadata['showname'] = $show->getDbName(); @@ -555,7 +555,7 @@ class Application_Service_HistoryService $recordStart = $item->getDbStarts(null); $recordEnd = ($instanceEnd < $itemEnd) ? $instanceEnd : $itemEnd; - //first check if this is a duplicate + // first check if this is a duplicate // (caused by restarting liquidsoap) $prevRecord = CcPlayoutHistoryQuery::create() @@ -640,7 +640,7 @@ class Application_Service_HistoryService $value = $metadata[$key]; } - //need to convert to the station's local time first. + // need to convert to the station's local time first. if ($field['type'] == TEMPLATE_DATETIME && !is_null($value)) { $timezoneUTC = new DateTimeZone('UTC'); $timezoneLocal = new DateTimeZone($this->timezone); @@ -771,7 +771,7 @@ class Application_Service_HistoryService $field = $fields[$i]; $key = $field['name']; - //required is delt with before this loop. + // required is delt with before this loop. if (in_array($key, $required)) { continue; } @@ -793,7 +793,7 @@ class Application_Service_HistoryService $f->setDbColMetadata($md); } - //Use this array to update existing values. + // Use this array to update existing values. $mds = $historyRecord->getCcPlayoutHistoryMetaDatas(); foreach ($mds as $md) { $prevmd[$md->getDbKey()] = $md; @@ -820,7 +820,7 @@ class Application_Service_HistoryService } } - //start,end timestamp strings in local timezone. + // start,end timestamp strings in local timezone. public function populateShowInstances($start, $end) { $timezoneLocal = new DateTimeZone($this->timezone); @@ -1004,14 +1004,14 @@ class Application_Service_HistoryService } } - //---------------- Following code is for History Templates --------------------------// + // ---------------- Following code is for History Templates --------------------------// public function getFieldTypes() { return [ - //TEMPLATE_DATE, - //TEMPLATE_TIME, - //TEMPLATE_DATETIME, + // TEMPLATE_DATE, + // TEMPLATE_TIME, + // TEMPLATE_DATETIME, TEMPLATE_STRING, TEMPLATE_BOOLEAN, TEMPLATE_INT, @@ -1026,7 +1026,7 @@ class Application_Service_HistoryService TEMPLATE_TIME => 'strval', TEMPLATE_DATETIME => 'strval', TEMPLATE_STRING => 'strval', - TEMPLATE_BOOLEAN => 'intval', //boolval only exists in php 5.5+ + TEMPLATE_BOOLEAN => 'intval', // boolval only exists in php 5.5+ TEMPLATE_INT => 'intval', TEMPLATE_FLOAT => 'floatval', ]; @@ -1083,7 +1083,7 @@ class Application_Service_HistoryService $fields[] = ['name' => 'starts', 'label' => _('Start Time'), 'type' => TEMPLATE_DATETIME, 'isFileMd' => false]; $fields[] = ['name' => 'ends', 'label' => _('End Time'), 'type' => TEMPLATE_DATETIME, 'isFileMd' => false]; - $fields[] = ['name' => MDATA_KEY_TITLE, 'label' => _('Title'), 'type' => TEMPLATE_STRING, 'isFileMd' => true]; //these fields can be populated from an associated file. + $fields[] = ['name' => MDATA_KEY_TITLE, 'label' => _('Title'), 'type' => TEMPLATE_STRING, 'isFileMd' => true]; // these fields can be populated from an associated file. $fields[] = ['name' => MDATA_KEY_CREATOR, 'label' => _('Creator'), 'type' => TEMPLATE_STRING, 'isFileMd' => true]; $template['name'] = 'Log Sheet ' . date(DEFAULT_TIMESTAMP_FORMAT) . ' Template'; @@ -1219,7 +1219,7 @@ class Application_Service_HistoryService public function getDatatablesLogSheetColumns() { - //need to prepend a checkbox column. + // need to prepend a checkbox column. $checkbox = [ 'sTitle' => '', 'mDataProp' => 'checkbox', diff --git a/legacy/application/services/MediaService.php b/legacy/application/services/MediaService.php index 6a58ab491..eeac3e7cc 100644 --- a/legacy/application/services/MediaService.php +++ b/legacy/application/services/MediaService.php @@ -34,12 +34,12 @@ class Application_Service_MediaService $importedStorageDirectory = $storDir->getDirectory() . '/imported/' . $ownerId; } - //Copy the temporary file over to the "organize" folder so that it's off our webserver - //and accessible by libretime-analyzer which could be running on a different machine. + // Copy the temporary file over to the "organize" folder so that it's off our webserver + // and accessible by libretime-analyzer which could be running on a different machine. $newTempFilePath = Application_Model_StoredFile::moveFileToStor($filePath, $originalFilename, $copyFile); - //Dispatch a message to libretime-analyzer through RabbitMQ, - //notifying it that there's a new upload to process! + // Dispatch a message to libretime-analyzer through RabbitMQ, + // notifying it that there's a new upload to process! $storageBackend = new ProxyStorageBackend($CC_CONFIG['current_backend']); Application_Model_RabbitMq::SendMessageToAnalyzer( $newTempFilePath, @@ -75,13 +75,13 @@ class Application_Service_MediaService if ($media->getPropelOrm()->isValidPhysicalFile()) { $filename = $media->getPropelOrm()->getFilename(); - //Download user left clicks a track and selects Download. + // Download user left clicks a track and selects Download. if (!$inline) { - //We are using Content-Disposition to specify - //to the browser what name the file should be saved as. + // We are using Content-Disposition to specify + // to the browser what name the file should be saved as. header('Content-Disposition: attachment; filename="' . $filename . '"'); } else { - //user clicks play button for track and downloads it. + // user clicks play button for track and downloads it. header('Content-Disposition: inline; filename="' . $filename . '"'); } @@ -100,7 +100,7 @@ class Application_Service_MediaService assert(is_array($filePaths)); do { - //Read from $filePath and stream it to the browser. + // Read from $filePath and stream it to the browser. $filePath = array_shift($filePaths); try { @@ -108,14 +108,14 @@ class Application_Service_MediaService $mimeType = $media->getPropelOrm()->getDbMime(); Application_Common_FileIO::smartReadFile($filePath, $size, $mimeType); - break; //Break out of the loop if we successfully read the file! + break; // Break out of the loop if we successfully read the file! } catch (LibreTimeFileNotFoundException $e) { - //If we have no alternate filepaths left, then let the exception bubble up. + // If we have no alternate filepaths left, then let the exception bubble up. if (count($filePaths) == 0) { throw $e; } } - //Retry with the next alternate filepath in the list + // Retry with the next alternate filepath in the list } while (count($filePaths) > 0); exit; diff --git a/legacy/application/services/PodcastEpisodeService.php b/legacy/application/services/PodcastEpisodeService.php index e47a80215..85206447f 100644 --- a/legacy/application/services/PodcastEpisodeService.php +++ b/legacy/application/services/PodcastEpisodeService.php @@ -471,7 +471,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir } else { $enclosure = $item->get_enclosure(); } - //Logging::info($enclosure); + // Logging::info($enclosure); $itemId = $item->get_id(); $ingested = in_array($itemId, $episodeIds) ? (empty($episodeFiles[$itemId]) ? -1 : 1) : 0; $file = $ingested > 0 && !empty($episodeFiles[$itemId]) ? diff --git a/legacy/application/services/PodcastService.php b/legacy/application/services/PodcastService.php index a366d9a09..799edd932 100644 --- a/legacy/application/services/PodcastService.php +++ b/legacy/application/services/PodcastService.php @@ -51,7 +51,7 @@ class Application_Service_PodcastService */ public static function createFromFeedUrl($feedUrl) { - //TODO: why is this so slow? + // TODO: why is this so slow? $rss = self::getPodcastFeed($feedUrl); if (!$rss) { throw new InvalidPodcastException(); @@ -84,7 +84,7 @@ class Application_Service_PodcastService } $podcastArray['category'] = htmlspecialchars(implode('', $categories)); - //TODO: put in constants + // TODO: put in constants $itunesChannel = 'http://www.itunes.com/dtds/podcast-1.0.dtd'; $itunesSubtitle = $rss->get_channel_tags($itunesChannel, 'subtitle'); @@ -224,7 +224,7 @@ class Application_Service_PodcastService return $podcast->getDbId(); } - //TODO move this somewhere where it makes sense + // TODO move this somewhere where it makes sense private static function getOwnerId() { try { @@ -467,53 +467,53 @@ class Application_Service_PodcastService $item = $channel->addChild('item'); $publishedFile = CcFilesQuery::create()->findPk($episode->getDbFileId()); - //title + // title self::addEscapedChild($item, 'title', $publishedFile->getDbTrackTitle()); - //link - do we need this? + // link - do we need this? - //pubDate + // pubDate self::addEscapedChild($item, 'pubDate', gmdate(DATE_RFC2822, strtotime($episode->getDbPublicationDate()))); - //category + // category foreach ($itunesCategories as $c) { if (!empty($c)) { self::addEscapedChild($item, 'category', $c); } } - //guid + // guid $guid = self::addEscapedChild($item, 'guid', $episode->getDbEpisodeGuid()); $guid->addAttribute('isPermaLink', 'false'); - //description + // description self::addEscapedChild($item, 'description', $publishedFile->getDbDescription()); - //encolsure - url, length, type attribs + // encolsure - url, length, type attribs $enclosure = $item->addChild('enclosure'); $enclosure->addAttribute('url', $episode->getDbDownloadUrl()); $enclosure->addAttribute('length', $publishedFile->getDbFilesize()); $enclosure->addAttribute('type', $publishedFile->getDbMime()); - //itunes:subtitle + // itunes:subtitle // From http://www.apple.com/ca/itunes/podcasts/specs.html#subtitle : // 'The contents of the tag are displayed in the Description column in iTunes.' // self::addEscapedChild($item, "xmlns:itunes:subtitle", $publishedFile->getDbTrackTitle()); self::addEscapedChild($item, 'xmlns:itunes:subtitle', $publishedFile->getDbDescription()); - //itunes:summary + // itunes:summary self::addEscapedChild($item, 'xmlns:itunes:summary', $publishedFile->getDbDescription()); - //itunes:author + // itunes:author self::addEscapedChild($item, 'xmlns:itunes:author', $publishedFile->getDbArtistName()); - //itunes:explicit - skip this? + // itunes:explicit - skip this? - //itunes:duration + // itunes:duration self::addEscapedChild($item, 'xmlns:itunes:duration', explode('.', $publishedFile->getDbLength())[0]); } - //Format it nicely with newlines... + // Format it nicely with newlines... $dom = new DOMDocument(); $dom->loadXML($xml->asXML()); $dom->formatOutput = true; diff --git a/legacy/application/services/SchedulerService.php b/legacy/application/services/SchedulerService.php index f115245eb..12f9ecbd8 100644 --- a/legacy/application/services/SchedulerService.php +++ b/legacy/application/services/SchedulerService.php @@ -11,7 +11,7 @@ class Application_Service_SchedulerService 'fadein' => '00:00:00', 'fadeout' => '00:00:00', 'sched_id' => null, - 'type' => 0, //default type of '0' to represent files. type '1' represents a webstream + 'type' => 0, // default type of '0' to represent files. type '1' represents a webstream ]; private $epochNow; @@ -23,10 +23,10 @@ class Application_Service_SchedulerService { $this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); - //subtracting one because sometimes when we cancel a track, we set its end time - //to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled - //track can still be included in the new schedule because it may have a few ms left to play. - //subtracting 1 second from epochNow resolves this issue. + // subtracting one because sometimes when we cancel a track, we set its end time + // to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled + // track can still be included in the new schedule because it may have a few ms left to play. + // subtracting 1 second from epochNow resolves this issue. $this->epochNow = microtime(true) - 1; $this->nowDT = DateTime::createFromFormat('U.u', $this->epochNow, new DateTimeZone('UTC')); @@ -85,7 +85,7 @@ class Application_Service_SchedulerService foreach ($ccShowInstances as $instance) { Logging::info('Removing gaps from show instance #' . $instance->getDbId()); - //DateTime object + // DateTime object $itemStart = $instance->getDbStarts(null); $ccScheduleItems = CcScheduleQuery::create() @@ -95,7 +95,7 @@ class Application_Service_SchedulerService ->find(); foreach ($ccScheduleItems as $ccSchedule) { - //DateTime object + // DateTime object $itemEnd = $this->findEndTime($itemStart, $ccSchedule->getDbClipLength()); $ccSchedule->setDbStarts($itemStart) @@ -118,14 +118,14 @@ class Application_Service_SchedulerService $startEpoch = $instanceStart->format('U.u'); $durationSeconds = Application_Common_DateHelper::playlistTimeToSeconds($clipLength); - //add two float numbers to 6 subsecond precision - //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. + // add two float numbers to 6 subsecond precision + // DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. $endEpoch = bcadd($startEpoch, (string) $durationSeconds, 6); $dt = DateTime::createFromFormat('U.u', $endEpoch, new DateTimeZone('UTC')); if ($dt === false) { - //PHP 5.3.2 problem + // PHP 5.3.2 problem $dt = DateTime::createFromFormat('U', intval($endEpoch), new DateTimeZone('UTC')); } @@ -136,14 +136,14 @@ class Application_Service_SchedulerService { $startEpoch = $p_startDT->format('U.u'); - //add two float numbers to 6 subsecond precision - //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. + // add two float numbers to 6 subsecond precision + // DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. $newEpoch = bcsub($startEpoch, (string) $p_seconds, 6); $dt = DateTime::createFromFormat('U.u', $newEpoch, new DateTimeZone('UTC')); if ($dt === false) { - //PHP 5.3.2 problem + // PHP 5.3.2 problem $dt = DateTime::createFromFormat('U', intval($newEpoch), new DateTimeZone('UTC')); } @@ -210,11 +210,11 @@ class Application_Service_SchedulerService */ public static function fillLinkedInstances($ccShow, $instanceIdsToFill, $instanceId = null) { - //Get the "template" schedule for the linked show (contents of the linked show) that will be - //copied into to all the new show instances. + // Get the "template" schedule for the linked show (contents of the linked show) that will be + // copied into to all the new show instances. $linkedShowSchedule = self::getLinkedShowSchedule($ccShow->getDbId(), $instanceIdsToFill, $instanceId); - //get time_filled so we can update cc_show_instances + // get time_filled so we can update cc_show_instances if (!empty($linkedShowSchedule)) { $timeFilled_sql = 'SELECT time_filled FROM cc_show_instances ' . "WHERE id = {$linkedShowSchedule[0]['instance_id']}"; @@ -224,8 +224,8 @@ class Application_Service_SchedulerService Application_Common_Database::COLUMN ); } else { - //We probably shouldn't return here because the code below will - //set this on each empty show instance... + // We probably shouldn't return here because the code below will + // set this on each empty show instance... $timeFilled = '00:00:00'; } @@ -233,23 +233,23 @@ class Application_Service_SchedulerService $con = Propel::getConnection(); - //Here we begin to fill the new show instances (as specified by $instanceIdsToFill) - //with content from $linkedShowSchedule. + // Here we begin to fill the new show instances (as specified by $instanceIdsToFill) + // with content from $linkedShowSchedule. try { $con->beginTransaction(); if (!empty($linkedShowSchedule)) { foreach ($instanceIdsToFill as $id) { - //Start by clearing the show instance that needs to be filling. This ensure - //we're not going to get in trouble in case there's an programming error somewhere else. + // Start by clearing the show instance that needs to be filling. This ensure + // we're not going to get in trouble in case there's an programming error somewhere else. self::clearShowInstanceContents($id); // Now fill the show instance with the same content that $linkedShowSchedule has. $instanceStart_sql = 'SELECT starts FROM cc_show_instances ' . "WHERE id = {$id} " . 'ORDER BY starts'; - //What's tricky here is that when we copy the content, we have to adjust - //the start and end times of each track so they're inside the new show instance's time slot. + // What's tricky here is that when we copy the content, we have to adjust + // the start and end times of each track so they're inside the new show instance's time slot. $nextStartDT = new DateTime( Application_Common_Database::prepareAndExecute( $instanceStart_sql, @@ -287,7 +287,7 @@ class Application_Service_SchedulerService $endTimeDT, $defaultCrossfadeDuration ); - } //foreach show item + } // foreach show item if (!empty($values)) { $insert_sql = 'INSERT INTO cc_schedule (starts, ends, ' . @@ -301,13 +301,13 @@ class Application_Service_SchedulerService ); } - //update cc_schedule status column + // update cc_schedule status column $instance = CcShowInstancesQuery::create()->findPk($id); $instance->updateScheduleStatus($con); - } //foreach linked instance + } // foreach linked instance } - //update time_filled and last_scheduled in cc_show_instances + // update time_filled and last_scheduled in cc_show_instances $now = gmdate(DEFAULT_TIMESTAMP_FORMAT); $whereClause = new Criteria(); $whereClause->add(CcShowInstancesPeer::ID, $instanceIdsToFill, Criteria::IN); @@ -363,7 +363,7 @@ class Application_Service_SchedulerService $endTimeDT, Application_Model_Preference::GetDefaultCrossfadeDuration() ); - } //foreach show item + } // foreach show item $ccShowInstance ->setDbTimeFilled($timeFilled) @@ -376,7 +376,7 @@ class Application_Service_SchedulerService /** Clears a show instance's schedule (which is actually clearing cc_schedule during that show instance's time slot.) */ private static function clearShowInstanceContents($instanceId) { - //Application_Common_Database::prepareAndExecute($delete_sql, array(), Application_Common_Database::EXECUTE); + // Application_Common_Database::prepareAndExecute($delete_sql, array(), Application_Common_Database::EXECUTE); $con = Propel::getConnection(); $query = $con->prepare('DELETE FROM cc_schedule WHERE instance_id = :instance_id'); $query->bindParam(':instance_id', $instanceId); diff --git a/legacy/application/services/ShowFormService.php b/legacy/application/services/ShowFormService.php index 197a23afa..2ed1656b2 100644 --- a/legacy/application/services/ShowFormService.php +++ b/legacy/application/services/ShowFormService.php @@ -122,7 +122,7 @@ class Application_Service_ShowFormService public function delegateShowFormPopulation($forms) { $this->populateFormWhat($forms['what']); - //local show start DT + // local show start DT $this->populateFormAutoPlaylist($forms['autoplaylist']); $showStart = $this->populateFormWhen($forms['when']); $this->populateFormRepeats($forms['repeats'], $showStart); @@ -175,10 +175,10 @@ class Application_Service_ShowFormService $showStart = $ccShowDay->getLocalStartDateAndTime(); $showEnd = $ccShowDay->getLocalEndDateAndTime(); - //check if the first show is in the past + // check if the first show is in the past if ($ccShowDay->isShowStartInPast()) { - //for a non-repeating show, we should never allow user to change the start time. - //for a repeating show, we should allow because the form works as repeating template form + // for a non-repeating show, we should never allow user to change the start time. + // for a repeating show, we should allow because the form works as repeating template form if (!$ccShowDay->isRepeating()) { $form->disableStartDateAndTime(); } else { @@ -193,7 +193,7 @@ class Application_Service_ShowFormService } } - //Disable starting a show 'now' when editing an existing show. + // Disable starting a show 'now' when editing an existing show. $form->getElement('add_show_start_now')->setAttrib('disable', ['now']); $form->populate( @@ -237,23 +237,23 @@ class Application_Service_ShowFormService { $ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId); - //get timezone the show is created in + // get timezone the show is created in $timezone = $ccShowInstance->getCcShow()->getFirstCcShowDay()->getDbTimezone(); - //$timezone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone()); + // $timezone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone()); - //DateTime object in UTC + // DateTime object in UTC $showStart = $ccShowInstance->getDbStarts(null); $showStart->setTimezone(new DateTimeZone($timezone)); $showEnd = $ccShowInstance->getDbEnds(null); $showEnd->setTimezone(new DateTimeZone($timezone)); - //if the show has started, do not allow editing on the start time + // if the show has started, do not allow editing on the start time if ($showStart->getTimestamp() <= time()) { $form->disableStartDateAndTime(); } - //Disable starting a show 'now' when editing an existing show. + // Disable starting a show 'now' when editing an existing show. $form->getElement('add_show_start_now')->setAttrib('disable', ['now']); $form->populate( @@ -297,18 +297,18 @@ class Application_Service_ShowFormService $service_show = new Application_Service_ShowService($this->ccShow->getDbId()); $repeatEndDate = $service_show->getRepeatingEndDate(); - //end dates are stored non-inclusively so we need to - //subtract one day + // end dates are stored non-inclusively so we need to + // subtract one day if (!is_null($repeatEndDate)) { $repeatEndDate->sub(new DateInterval('P1D')); } - //default monthly repeat type + // default monthly repeat type $monthlyRepeatType = 2; $repeatType = $ccShowDays[0]->getDbRepeatType(); if ($repeatType == REPEAT_MONTHLY_WEEKLY) { $monthlyRepeatType = $repeatType; - //a repeat type of 2 means the show is repeating monthly + // a repeat type of 2 means the show is repeating monthly $repeatType = 2; } elseif ($repeatType == REPEAT_MONTHLY_MONTHLY) { $monthlyRepeatType = $repeatType; @@ -445,7 +445,7 @@ class Application_Service_ShowFormService $formValues = []; $i = 1; foreach ($absolutRebroadcasts as $ar) { - //convert dates to user's local time + // convert dates to user's local time $start = new DateTime($ar->getDbStarts(), new DateTimeZone('UTC')); $start->setTimezone(new DateTimeZone($timezone)); $formValues["add_show_rebroadcast_date_absolute_{$i}"] = $start->format('Y-m-d'); @@ -486,15 +486,15 @@ class Application_Service_ShowFormService $validateStartDate = $formData['start_date_disabled'] === 'false'; $validateStartTime = $formData['start_time_disabled'] === 'false'; - //CcShowDays object of the show currently being edited + // CcShowDays object of the show currently being edited $currentShowDay = $this->ccShow->getFirstCcShowDay(); - //DateTime object + // DateTime object $dt = $currentShowDay->getLocalStartDateAndTime(); $formData['add_show_record'] = $currentShowDay->getDbRecord(); - //if the show is repeating, set the start date to the next - //repeating instance in the future + // if the show is repeating, set the start date to the next + // repeating instance in the future $originalShowStartDateTime = $this->getCurrentOrNextInstanceStartTime(); if (!$originalShowStartDateTime) { $originalShowStartDateTime = $dt; diff --git a/legacy/application/services/ShowService.php b/legacy/application/services/ShowService.php index 94873ba13..a4b680b1f 100644 --- a/legacy/application/services/ShowService.php +++ b/legacy/application/services/ShowService.php @@ -23,9 +23,9 @@ class Application_Service_ShowService private $origShowRepeatStatus; private $instanceIdsForScheduleUpdates; - //keeps track of which show instances are new from either adding a new show - //day or changing the repeat type day during a show edit, or when a user moves - //forward in the calendar + // keeps track of which show instances are new from either adding a new show + // day or changing the repeat type day during a show edit, or when a user moves + // forward in the calendar private $newInstanceIdsCreated; public function __construct($showId = null, $showData = null, $isUpdate = false) @@ -70,12 +70,12 @@ class Application_Service_ShowService $showId = $showData['add_show_id']; // UPDATE SCHEDULE START TIME - //get the ccShow object to which this instance belongs - //so we can get the original start date and time + // get the ccShow object to which this instance belongs + // so we can get the original start date and time $this->ccShow = CcShowQuery::create() ->findPk($showId); - //DateTime in shows's local time + // DateTime in shows's local time $newStartDateTime = new DateTime( $showData['add_show_start_date'] . ' ' . $showData['add_show_start_time'], @@ -85,7 +85,7 @@ class Application_Service_ShowService $ccShowInstanceOrig = CcShowInstancesQuery::create() ->findPk($showData['add_show_instance_id']); - //convert original start time into the show's local timezone + // convert original start time into the show's local timezone $origLocalStartDateTime = $ccShowInstanceOrig->getLocalStartDateTime(); $diff = $this->calculateShowStartDiff( @@ -143,7 +143,7 @@ class Application_Service_ShowService $this->getPopulateShowUntilDateTIme() ); - //update cc_schedule with the new instance id + // update cc_schedule with the new instance id $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME); $selectCriteria = new Criteria(); $selectCriteria->add(CcSchedulePeer::INSTANCE_ID, $showData['add_show_instance_id']); @@ -157,7 +157,7 @@ class Application_Service_ShowService ->setDbDescription($showData['add_show_instance_description']) ->save(); - //delete the edited instance from the repeating sequence + // delete the edited instance from the repeating sequence $ccShowInstanceOrig ->setDbModifiedInstance(true) ->setDbDescription($showData['add_show_instance_description']) @@ -211,7 +211,7 @@ class Application_Service_ShowService throw new Exception('Permission denied'); } - //update ccShow + // update ccShow $this->setCcShow($showData); $daysAdded = []; @@ -237,23 +237,23 @@ class Application_Service_ShowService $this->deleteCcShowHosts(); if ($this->isRebroadcast) { - //delete entry in cc_show_rebroadcast + // delete entry in cc_show_rebroadcast $this->deleteCcShowRebroadcasts(); } $this->storeInstanceIds(); } - //update ccShowDays + // update ccShowDays $this->setCcShowDays($showData); - //update ccShowRebroadcasts + // update ccShowRebroadcasts $this->setCcShowRebroadcasts($showData); - //update ccShowHosts + // update ccShowHosts $this->setCcShowHosts($showData); - //create new ccShowInstances + // create new ccShowInstances $this->delegateInstanceCreation($daysAdded); if ($this->isUpdate) { @@ -332,7 +332,7 @@ class Application_Service_ShowService if ($this->ccShow->isRepeating()) { $ccShowDays = $this->ccShow->getRepeatingCcShowDays(); } else { - //$ccShowDays = $this->ccShow->getCcShowDayss(); + // $ccShowDays = $this->ccShow->getCcShowDayss(); /* Cannot use the above statement to get the cc_show_days * object because it's getting the old object before the @@ -364,8 +364,8 @@ class Application_Service_ShowService $ccShows[$show_id] = $day->getccShow(); } - //keep track of the new show instances getting created - //so we can fill their schedule after + // keep track of the new show instances getting created + // so we can fill their schedule after if (!isset($this->newInstanceIdsCreated[$show_id])) { $this->newInstanceIdsCreated[$show_id] = []; } @@ -535,23 +535,23 @@ SQL; $daysAdded = []; - //CcShowDay object + // CcShowDay object if ($this->ccShow->isRepeating()) { $currentShowDay = $this->ccShow->getFirstRepeatingCcShowDay(); - //all cc_show_days + // all cc_show_days $ccShowDays = $this->ccShow->getRepeatingCcShowDays(); } else { $currentShowDay = $this->ccShow->getFirstCcShowDay(); - //all cc_show_days + // all cc_show_days $ccShowDays = $this->ccShow->getCcShowDayss(); } - //new end date in the show's timezone (from the select box) + // new end date in the show's timezone (from the select box) $endDateTime = $this->calculateEndDate($showData); - //repeat option was toggled + // repeat option was toggled if ($showData['add_show_repeats'] != $currentShowDay->isRepeating()) { $this->deleteAllRepeatInstances($currentShowDay, $showId); @@ -559,9 +559,9 @@ SQL; $this->deleteAllShowDays($showId); } - //if repeat option was checked we need to treat the current show day - //as a new show day so the repeat instances get created properly - //in createWeeklyRepeatInstances() + // if repeat option was checked we need to treat the current show day + // as a new show day so the repeat instances get created properly + // in createWeeklyRepeatInstances() if ($showData['add_show_repeats']) { array_push($daysAdded, $currentShowDay->getDbDay()); } @@ -570,29 +570,29 @@ SQL; if ($showData['add_show_repeats']) { $localShowStart = $currentShowDay->getLocalStartDateAndTime(); - //if the start date changes, these are the repeat types - //that require show instance deletion + // if the start date changes, these are the repeat types + // that require show instance deletion $deleteRepeatTypes = [REPEAT_BI_WEEKLY, REPEAT_TRI_WEEKLY, REPEAT_QUAD_WEEKLY, REPEAT_MONTHLY_MONTHLY, REPEAT_MONTHLY_WEEKLY, ]; if (in_array($this->repeatType, $deleteRepeatTypes) && $showData['add_show_start_date'] != $localShowStart->format('Y-m-d')) { - //Start date has changed when repeat type is bi-weekly or monthly. - //This screws up the repeating positions of show instances, so - //we need to delete them (CC-2351) + // Start date has changed when repeat type is bi-weekly or monthly. + // This screws up the repeating positions of show instances, so + // we need to delete them (CC-2351) $this->deleteAllInstances($showId); } $currentRepeatType = $currentShowDay->getDbRepeatType(); - //only delete instances if the show being edited was already repeating - //and the repeat type changed + // only delete instances if the show being edited was already repeating + // and the repeat type changed if ($currentRepeatType != -1 && $this->repeatType != $currentRepeatType) { $this->deleteAllInstances($showId); $this->deleteAllShowDays($showId); // when repeating by day of the month (1st, 2nd, etc.) we do not store the repeat week days } elseif ($currentRepeatType != 2) { - //repeat type is the same, check if the days of the week are the same + // repeat type is the same, check if the days of the week are the same $repeatingDaysChanged = false; $showDays = []; @@ -601,7 +601,7 @@ SQL; } if (count($showData['add_show_day_check']) == count($showDays)) { - //same number of days checked, lets see if they are the same numbers + // same number of days checked, lets see if they are the same numbers $intersect = array_intersect($showData['add_show_day_check'], $showDays); if (count($intersect) != count($showData['add_show_day_check'])) { $repeatingDaysChanged = true; @@ -618,8 +618,8 @@ SQL; } if (count($daysRemoved) > 0) { - //delete repeating show instances for the repeating - //days that were removed + // delete repeating show instances for the repeating + // days that were removed /*if ($this->ccShow->isLinked()) { $this->preserveLinkedShowContent(); }*/ @@ -633,30 +633,30 @@ SQL; if ($showData['add_show_start_date'] != $localShowStart->format('Y-m-d') || $showData['add_show_start_time'] != $localShowStart->format('H:i')) { - //start date has been pushed forward so we need to delete - //any instances of this show scheduled before the new start date + // start date has been pushed forward so we need to delete + // any instances of this show scheduled before the new start date if ($showData['add_show_start_date'] > $localShowStart->format('Y-m-d')) { $this->deleteInstancesBeforeDate($showData['add_show_start_date'], $showId); } } } - //get the endate from the past for this show. - //check if this is null if "no end" + // get the endate from the past for this show. + // check if this is null if "no end" $currentShowEndDateTime = $this->getRepeatingEndDate(); if ($endDateTime && $currentShowEndDateTime != $endDateTime) { $endDate = clone $endDateTime; $endDate->setTimezone(new DateTimeZone('UTC')); - //show's "No End" option was toggled - //or the end date comes earlier + // show's "No End" option was toggled + // or the end date comes earlier if (is_null($currentShowEndDateTime) || ($endDateTime < $currentShowEndDateTime)) { - //"No End" option was unchecked so we need to delete the - //repeat instances that are scheduled after the new end date - //OR - //end date was pushed back so we have to delete any - //instances of this show scheduled after the new end date + // "No End" option was unchecked so we need to delete the + // repeat instances that are scheduled after the new end date + // OR + // end date was pushed back so we have to delete any + // instances of this show scheduled after the new end date $this->deleteInstancesFromDate($endDate->format('Y-m-d'), $showId); } } @@ -754,7 +754,7 @@ SQL; { $daysRemovedUTC = []; - //convert the start day of the week to UTC + // convert the start day of the week to UTC foreach ($showDays as $showDay) { if (in_array($showDay->getDbDay(), $daysRemoved)) { $showDay->reload(); @@ -764,7 +764,7 @@ SQL; } foreach ($daysRemoved as $day) { - //delete the cc_show_day entries as well + // delete the cc_show_day entries as well CcShowDaysQuery::create() ->filterByDbShowId($showId) ->filterByDbDay($day) @@ -854,14 +854,14 @@ SQL; ->setDbModifiedInstance(true) ->save(); - //delete the rebroadcasts of the removed recorded show + // delete the rebroadcasts of the removed recorded show if ($ccShowInstance->isRecorded()) { CcShowInstancesQuery::create() ->filterByDbOriginalShow($instanceId) ->delete(); } - //delete all files scheduled in cc_schedules table + // delete all files scheduled in cc_schedules table CcScheduleQuery::create() ->filterByDbInstanceId($instanceId) ->delete(); @@ -895,7 +895,7 @@ SQL; */ $lastShowDays = []; - //get the show's timezone + // get the show's timezone $ccShow = CcShowQuery::create()->findPk($showId); if ($ccShow->isRepeating()) { $showTimezone = $ccShow->getFirstRepeatingCcShowDay()->getDbTimezone(); @@ -1013,11 +1013,11 @@ SQL; */ private function calculateEndDate($showData) { - //if no end return null + // if no end return null if ($showData['add_show_no_end']) { $endDate = null; } - //if the show is repeating & ends, then return the end date + // if the show is repeating & ends, then return the end date elseif ($showData['add_show_repeats']) { $endDate = new DateTime( $showData['add_show_end_date'], @@ -1025,7 +1025,7 @@ SQL; ); $endDate->add(new DateInterval('P1D')); } - //the show doesn't repeat, so add one day to the start date. + // the show doesn't repeat, so add one day to the start date. else { $endDate = new DateTime( $showData['add_show_start_date'], @@ -1040,7 +1040,7 @@ SQL; private function updateScheduleStartEndTimes($showData) { $showId = $this->ccShow->getDbId(); - //DateTime in show's local time + // DateTime in show's local time $newStartDateTime = new DateTime( $showData['add_show_start_date'] . ' ' . $showData['add_show_start_time'], @@ -1145,7 +1145,7 @@ SQL; */ private function createNonRepeatingInstance($showDay, $populateUntil) { - //DateTime object + // DateTime object $start = $showDay->getLocalStartDateAndTime(); [$utcStartDateTime, $utcEndDateTime] = $this->createUTCStartEndDateTime( @@ -1156,7 +1156,7 @@ SQL; if ($utcStartDateTime->getTimestamp() < $populateUntil->getTimestamp()) { $ccShowInstance = new CcShowInstances(); if ($this->isUpdate) { - //use original cc_show_day object to get the current cc_show_instance + // use original cc_show_day object to get the current cc_show_instance $origStartDateTime = new DateTime( $this->origCcShowDay->getDbFirstShow() . ' ' . $this->origCcShowDay->getDbStartTime(), new DateTimeZone($this->origCcShowDay->getDbTimezone()) @@ -1200,21 +1200,21 @@ SQL; $daysAdded = null ) { $show_id = $showDay->getDbShowId(); - $first_show = $showDay->getDbFirstShow(); //non-UTC - $last_show = $showDay->getDbLastShow(); //non-UTC + $first_show = $showDay->getDbFirstShow(); // non-UTC + $last_show = $showDay->getDbLastShow(); // non-UTC $duration = $showDay->getDbDuration(); $day = $showDay->getDbDay(); $record = $showDay->getDbRecord(); $timezone = $showDay->getDbTimezone(); - //DateTime local + // DateTime local $start = $this->getNextRepeatingPopulateStartDateTime($showDay); if (is_null($repeatInterval) && $repeatType == REPEAT_MONTHLY_WEEKLY) { $repeatInterval = self::getMonthlyWeeklyRepeatInterval($start, $timezone); } - //DatePeriod in user's local time + // DatePeriod in user's local time $datePeriod = $this->getDatePeriod( $start, $timezone, @@ -1302,14 +1302,14 @@ SQL; private function createMonthlyRepeatInstances($showDay, $populateUntil) { $show_id = $showDay->getDbShowId(); - $first_show = $showDay->getDbFirstShow(); //non-UTC - $last_show = $showDay->getDbLastShow(); //non-UTC + $first_show = $showDay->getDbFirstShow(); // non-UTC + $last_show = $showDay->getDbLastShow(); // non-UTC $duration = $showDay->getDbDuration(); $day = $showDay->getDbDay(); $record = $showDay->getDbRecord(); $timezone = $showDay->getDbTimezone(); - //DateTime local + // DateTime local $start = $this->getNextRepeatingPopulateStartDateTime($showDay); if (isset($last_show)) { $end = new DateTime($last_show, new DateTimeZone($timezone)); @@ -1589,7 +1589,7 @@ SQL; $ccShowInstance = CcShowInstancesQuery::create() ->filterByDbStarts($temp->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::EQUAL) ->filterByDbShowId($this->ccShow->getDbId(), Criteria::EQUAL) - //->filterByDbModifiedInstance(false, Criteria::EQUAL) + // ->filterByDbModifiedInstance(false, Criteria::EQUAL) ->filterByDbRebroadcast(0, Criteria::EQUAL) ->limit(1) ->find(); @@ -1653,10 +1653,10 @@ SQL; $ccShow->setDbAutoPlaylistId($showData['add_show_autoplaylist_id']); } - //Here a user has edited a show and linked it. - //We need to grab the existing show instances ids and fill their content - //with the content from the show instance that was clicked on to edit the show. - //We do this because linked show instances need to have the same content in each. + // Here a user has edited a show and linked it. + // We need to grab the existing show instances ids and fill their content + // with the content from the show instance that was clicked on to edit the show. + // We do this because linked show instances need to have the same content in each. if ($this->isUpdate && (!$ccShow->getDbLinked() && $showData['add_show_linked'])) { $existingShowInstanceIds = $ccShow->getFutureInstanceIds(new Criteria()); Application_Service_SchedulerService::fillLinkedInstances($ccShow, $existingShowInstanceIds, $showData['add_show_instance_id']); @@ -1693,8 +1693,8 @@ SQL; $endDate = null; } - //Our calculated start DOW must be used for non repeating since a day has not been selected. - //For all repeating shows, only the selected days of the week will be repeated on. + // Our calculated start DOW must be used for non repeating since a day has not been selected. + // For all repeating shows, only the selected days of the week will be repeated on. $startDow = $startDateTime->format('w'); if (!$showData['add_show_repeats']) { $showData['add_show_day_check'] = [$startDow]; @@ -1708,7 +1708,7 @@ SQL; ->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType()) ->findOne(); if (!$showDay) { - //repeat type changed so we have to create a new show_day rule + // repeat type changed so we have to create a new show_day rule $showDay = new CcShowDays(); } } else { @@ -1723,8 +1723,8 @@ SQL; $showDay->setDbRepeatType($this->repeatType); $showDay->setDbShowId($showId); $showDay->setDbRecord($this->isRecorded); - //in case we are editing a show we need to set this to the first show - //so when editing, the date period iterator will start from the beginning + // in case we are editing a show we need to set this to the first show + // so when editing, the date period iterator will start from the beginning $showDay->setDbNextPopDate($startDateTime->format('Y-m-d')); $showDay->save(); } else { @@ -1746,7 +1746,7 @@ SQL; || $this->origCcShowDay->getDbRepeatType() == 3) { $day = null; } elseif (!$this->origShowRepeatStatus) { - //keep current show day to use for updating cc_show_day rule + // keep current show day to use for updating cc_show_day rule $keepDay = $day; $day = $this->origCcShowDay->getDbDay(); } @@ -1757,9 +1757,9 @@ SQL; ->filterByDbDay($day) ->findOne(); if (!$showDay) { - //if no show day object was found it is because a new - //repeating day of the week was added OR the repeat - //type has changed + // if no show day object was found it is because a new + // repeating day of the week was added OR the repeat + // type has changed $showDay = new CcShowDays(); } @@ -1779,8 +1779,8 @@ SQL; $showDay->setDbRepeatType($this->repeatType); $showDay->setDbShowId($showId); $showDay->setDbRecord($this->isRecorded); - //in case we are editing a show we need to set this to the first show - //so when editing, the date period iterator will start from the beginning + // in case we are editing a show we need to set this to the first show + // so when editing, the date period iterator will start from the beginning $showDay->setDbNextPopDate($startDateTimeClone->format('Y-m-d')); $showDay->save(); } @@ -1899,8 +1899,8 @@ SQL; $timezone = $startDateTime->getTimezone(); if (isset($offset)) { - //$offset["hours"] and $offset["mins"] represents the start time - //of a rebroadcast show + // $offset["hours"] and $offset["mins"] represents the start time + // of a rebroadcast show $startDateTime = new DateTime($startDateTime->format('Y-m-d') . ' ' . $offset['hours'] . ':' . $offset['mins'], $timezone); $startDateTime->add(new DateInterval("P{$offset['days']}D")); diff --git a/legacy/application/upgrade/Upgrades.php b/legacy/application/upgrade/Upgrades.php index 955188df3..54e5c961a 100644 --- a/legacy/application/upgrade/Upgrades.php +++ b/legacy/application/upgrade/Upgrades.php @@ -32,7 +32,7 @@ class UpgradeManager public static function getSupportedSchemaVersions() { $config = Config::getConfig(); - //What versions of the schema does the code support today: + // What versions of the schema does the code support today: return [$config['airtime_version']]; } @@ -167,17 +167,17 @@ abstract class AirtimeUpgrader protected function toggleMaintenanceScreen($toggle) { if ($toggle) { - //Disable Airtime UI - //create a temporary maintenance notification file - //when this file is on the server, zend framework redirects all - //requests to the maintenance page and sets a 503 response code + // Disable Airtime UI + // create a temporary maintenance notification file + // when this file is on the server, zend framework redirects all + // requests to the maintenance page and sets a 503 response code /* DISABLED because this does not work correctly $this->maintenanceFile = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."maintenance.txt" : "/tmp/maintenance.txt"; $file = fopen($this->maintenanceFile, 'w'); fclose($file); */ } - //delete maintenance.txt to give users access back to Airtime + // delete maintenance.txt to give users access back to Airtime /* DISABLED because this does not work correctly if ($this->maintenanceFile) { unlink($this->maintenanceFile); @@ -298,7 +298,7 @@ class AirtimeUpgrader253 extends AirtimeUpgrader protected function _runUpgrade() { - //Update disk_usage value in cc_pref + // Update disk_usage value in cc_pref $storDir = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE'] . 'srv/airtime/stor' : '/srv/airtime/stor'; $diskUsage = shell_exec("du -sb {$storDir} | awk '{print $1}'"); @@ -322,15 +322,15 @@ class AirtimeUpgrader254 extends AirtimeUpgrader protected function _runUpgrade() { - //First, ensure there are no superadmins already. + // First, ensure there are no superadmins already. $numberOfSuperAdmins = CcSubjsQuery::create() ->filterByDbType(UTYPE_SUPERADMIN) - ->filterByDbLogin('sourcefabric_admin', Criteria::NOT_EQUAL) //Ignore sourcefabric_admin users + ->filterByDbLogin('sourcefabric_admin', Criteria::NOT_EQUAL) // Ignore sourcefabric_admin users ->count(); - //Only create a super admin if there isn't one already. + // Only create a super admin if there isn't one already. if ($numberOfSuperAdmins == 0) { - //Find the "admin" user and promote them to superadmin. + // Find the "admin" user and promote them to superadmin. $adminUser = CcSubjsQuery::create() ->filterByDbLogin('admin') ->findOne(); @@ -351,7 +351,7 @@ class AirtimeUpgrader254 extends AirtimeUpgrader $adminUser->save(); Logging::info($_SERVER['HTTP_HOST'] . ': ' . $this->getNewVersion() . ' Upgrade: Promoted user ' . $adminUser->getLogin() . ' to be a Super Admin.'); - //Also try to promote the sourcefabric_admin user + // Also try to promote the sourcefabric_admin user $sofabAdminUser = CcSubjsQuery::create() ->filterByDbLogin('sourcefabric_admin') ->findOne(); diff --git a/legacy/public/index.php b/legacy/public/index.php index b5a72d57e..3930ba7c2 100644 --- a/legacy/public/index.php +++ b/legacy/public/index.php @@ -27,7 +27,7 @@ function isApiCall() return strpos($path, 'api') !== false; } -//Rest Module Controllers - for custom Rest_RouteController.php +// Rest Module Controllers - for custom Rest_RouteController.php set_include_path(APPLICATION_PATH . '/modules/rest/controllers/' . PATH_SEPARATOR . get_include_path()); // Vendors (Composer, zend-loader is explicitly specified due to https://github.com/zf1/zend-application/pull/2#issuecomment-102599655) diff --git a/legacy/public/setup/setup-functions.php b/legacy/public/setup/setup-functions.php index 8fc546c1b..34a9290ad 100644 --- a/legacy/public/setup/setup-functions.php +++ b/legacy/public/setup/setup-functions.php @@ -32,7 +32,7 @@ abstract class Setup if (!file_exists(INSTALLER_CONFIG_FILEPATH)) { copy(SAMPLE_CONFIG_FILEPATH, INSTALLER_CONFIG_FILEPATH); } - //Logging::info(CONFIG_TEMP_FILEPATH); + // Logging::info(CONFIG_TEMP_FILEPATH); $this->_write(INSTALLER_CONFIG_FILEPATH); } diff --git a/legacy/tests/application/bootstrap.php b/legacy/tests/application/bootstrap.php index 9cefaa7ca..d1a4c9963 100644 --- a/legacy/tests/application/bootstrap.php +++ b/legacy/tests/application/bootstrap.php @@ -38,28 +38,28 @@ Logging::setLogPath(LIBRETIME_LOG_FILEPATH); set_include_path(APPLICATION_PATH . '/common' . PATH_SEPARATOR . get_include_path()); -//Propel classes. +// Propel classes. set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path()); -//Services +// Services set_include_path(APPLICATION_PATH . '/services' . PATH_SEPARATOR . get_include_path()); -//models +// models set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path()); -//Controllers. +// Controllers. set_include_path(APPLICATION_PATH . '/controllers' . PATH_SEPARATOR . get_include_path()); -//Controller plugins. +// Controller plugins. set_include_path(APPLICATION_PATH . '/controllers/plugins' . PATH_SEPARATOR . get_include_path()); -//test data +// test data set_include_path(APPLICATION_PATH . '/../tests/application/testdata' . PATH_SEPARATOR . get_include_path()); -//helper functions +// helper functions set_include_path(APPLICATION_PATH . '/../tests/application/helpers' . PATH_SEPARATOR . get_include_path()); -//cloud storage files +// cloud storage files set_include_path(APPLICATION_PATH . '/cloud_storage' . PATH_SEPARATOR . get_include_path()); require_once 'jooola/propel1/runtime/lib/Propel.php'; diff --git a/legacy/tests/application/helpers/AirtimeInstall.php b/legacy/tests/application/helpers/AirtimeInstall.php index 46908664e..7610b4865 100644 --- a/legacy/tests/application/helpers/AirtimeInstall.php +++ b/legacy/tests/application/helpers/AirtimeInstall.php @@ -2,7 +2,7 @@ set_include_path(__DIR__ . '/../../legacy/library' . PATH_SEPARATOR . get_include_path()); -//require_once('Zend/Loader/Autoloader.php'); +// require_once('Zend/Loader/Autoloader.php'); class AirtimeInstall { public const CONF_DIR_BINARIES = '/usr/lib/airtime'; @@ -59,12 +59,12 @@ class AirtimeInstall $version = $con->query($sql)->fetchColumn(0); } catch (PDOException $e) { // no pref table therefore Airtime is not installed. - //We only get here if airtime database exists, but the table doesn't - //This state sometimes happens if a previous Airtime uninstall couldn't remove - //the database because it was busy, so it just removed the tables instead. + // We only get here if airtime database exists, but the table doesn't + // This state sometimes happens if a previous Airtime uninstall couldn't remove + // the database because it was busy, so it just removed the tables instead. return null; } - //if version is empty string, then version is older than version 1.8.0 + // if version is empty string, then version is older than version 1.8.0 if ($version == '') { try { // If this table exists, then it's version 1.7.0 @@ -215,7 +215,7 @@ class AirtimeInstall { echo ' * Creating database tables' . PHP_EOL; // Put Propel sql files in Database - //$command = AirtimeInstall::CONF_DIR_WWW."/library/propel/generator/bin/propel-gen ".AirtimeInstall::CONF_DIR_WWW."/build/ insert-sql 2>/dev/null"; + // $command = AirtimeInstall::CONF_DIR_WWW."/library/propel/generator/bin/propel-gen ".AirtimeInstall::CONF_DIR_WWW."/build/ insert-sql 2>/dev/null"; $dir = self::GetAirtimeSrcDir() . '/build/sql/'; $files = ['schema.sql', 'sequences.sql', 'views.sql', 'triggers.sql', 'defaultdata.sql']; foreach ($files as $f) { diff --git a/legacy/tests/application/helpers/TestHelper.php b/legacy/tests/application/helpers/TestHelper.php index 6f5b3b657..e941fa9df 100644 --- a/legacy/tests/application/helpers/TestHelper.php +++ b/legacy/tests/application/helpers/TestHelper.php @@ -6,17 +6,17 @@ class TestHelper { $authAdapter = Application_Model_Auth::getAuthAdapter(); - //pass to the adapter the submitted username and password + // pass to the adapter the submitted username and password $authAdapter->setIdentity('admin') ->setCredential('admin'); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authAdapter); if ($result->isValid()) { - //all info about this user from the login table omit only the password + // all info about this user from the login table omit only the password $userInfo = $authAdapter->getResultRowObject(null, 'password'); - //the default storage is a session with namespace Zend_Auth + // the default storage is a session with namespace Zend_Auth $authStorage = $auth->getStorage(); $authStorage->write($userInfo); } @@ -39,8 +39,8 @@ class TestHelper public static function installTestDatabase() { - //We need to load the config before our app bootstrap runs. The config - //is normally + // We need to load the config before our app bootstrap runs. The config + // is normally $CC_CONFIG = Config::getConfig(); $dbhost = $CC_CONFIG['dsn']['host']; @@ -51,7 +51,7 @@ class TestHelper $databaseAlreadyExists = AirtimeInstall::createDatabase(); if ($databaseAlreadyExists) { - //Truncate all the tables + // Truncate all the tables $con = Propel::getConnection(); $sql = "select * from pg_tables where tableowner = '{$dbuser}'"; @@ -61,7 +61,7 @@ class TestHelper $rows = []; } - //Add any tables that shouldn't be cleared here. + // Add any tables that shouldn't be cleared here. // cc_subjs - Most of Airtime requires an admin account to work, which has id=1, // so don't clear it. // cc_music_dirs - Has foreign key constraints against cc_files, so we clear cc_files @@ -74,23 +74,23 @@ class TestHelper if (in_array($tablename, $tablesToNotClear)) { continue; } - //echo " * Clearing database table $tablename..."; + // echo " * Clearing database table $tablename..."; - //TRUNCATE is actually slower than DELETE in many cases: - //http://stackoverflow.com/questions/11419536/postgresql-truncation-speed - //$sql = "TRUNCATE TABLE $tablename CASCADE"; + // TRUNCATE is actually slower than DELETE in many cases: + // http://stackoverflow.com/questions/11419536/postgresql-truncation-speed + // $sql = "TRUNCATE TABLE $tablename CASCADE"; $sql = "DELETE FROM {$tablename}"; AirtimeInstall::InstallQuery($sql, false); } - //Now that cc_files is empty, clearing cc_music_dirs should work + // Now that cc_files is empty, clearing cc_music_dirs should work $sql = 'DELETE FROM cc_music_dirs'; AirtimeInstall::InstallQuery($sql, false); // Because files are stored relative to their watch directory, // we need to set the "stor" path before we can successfully // create a fake file in the database. - //Copy paste from airtime-db-install.php: + // Copy paste from airtime-db-install.php: $stor_dir = '/tmp'; $con = Propel::getConnection(); $sql = "INSERT INTO cc_music_dirs (directory, type) VALUES ('{$stor_dir}', 'stor')"; @@ -106,9 +106,9 @@ class TestHelper $con->commit(); - //Because we're DELETEing all the rows instead of using TRUNCATE (for speed), - //we have to reset the sequences so the auto-increment columns (like primary keys) - //all start at 1 again. This is hacky but it still lets all of this execute fast. + // Because we're DELETEing all the rows instead of using TRUNCATE (for speed), + // we have to reset the sequences so the auto-increment columns (like primary keys) + // all start at 1 again. This is hacky but it still lets all of this execute fast. $sql = "SELECT c.relname FROM pg_class c WHERE c.relkind = 'S'"; try { @@ -124,7 +124,7 @@ class TestHelper } $con->commit(); } else { - //Create all the database tables + // Create all the database tables AirtimeInstall::CreateDatabaseTables($dbuser, $dbpasswd, $dbname, $dbhost, $dbport); AirtimeInstall::UpdateDatabaseTables(); } diff --git a/legacy/tests/application/models/database/BlockDbTest.php b/legacy/tests/application/models/database/BlockDbTest.php index 9d70cee5e..81a21ac6d 100644 --- a/legacy/tests/application/models/database/BlockDbTest.php +++ b/legacy/tests/application/models/database/BlockDbTest.php @@ -4,7 +4,7 @@ * @internal * @coversNothing */ -class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework_TestCase +class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase // PHPUnit_Framework_TestCase { private $_connectionMock; @@ -60,7 +60,7 @@ class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework $bltest = new Application_Model_Block(); $bltest->saveSmartBlockCriteria($testCriteria); $tracks = $bltest->getListOfFilesUnderLimit(); - //$tracks = $bltest->getLength(); + // $tracks = $bltest->getLength(); $this->assertNotEmpty($tracks); // need to load a example criteria into the database } @@ -82,7 +82,7 @@ class BlockDbTest extends Zend_Test_PHPUnit_DatabaseTestCase //PHPUnit_Framework $bltest = new Application_Model_Block(); $bltest->saveSmartBlockCriteria($testCriteria); $tracks = $bltest->getListOfFilesUnderLimit(); - //$tracks = $bltest->getLength(); + // $tracks = $bltest->getLength(); $this->assertNotEmpty($tracks); // add assertion that the length is less than 1 hour... // need to load a example criteria into the database diff --git a/legacy/tests/application/models/unit/ScheduleUnitTest.php b/legacy/tests/application/models/unit/ScheduleUnitTest.php index 111572751..d5e960e85 100644 --- a/legacy/tests/application/models/unit/ScheduleUnitTest.php +++ b/legacy/tests/application/models/unit/ScheduleUnitTest.php @@ -4,7 +4,7 @@ * @internal * @coversNothing */ -class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase //PHPUnit_Framework_TestCase +class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase // PHPUnit_Framework_TestCase { public function setUp() { @@ -26,23 +26,23 @@ class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase //PHPUnit_Fr $testShowData = ShowServiceData::getNoRepeatNoRRData(); $showService = new Application_Service_ShowService(); $futureDate = new DateTime(); - $futureDate->add(new DateInterval('P1Y')); //1 year into the future + $futureDate->add(new DateInterval('P1Y')); // 1 year into the future $futureDateString = $futureDate->format('Y-m-d'); $testShowData['add_show_start_date'] = $futureDateString; $testShowData['add_show_end_date'] = $futureDateString; $testShowData['add_show_end_date_no_repeat'] = $futureDateString; - //Fudge the "populated until" date to workaround and issue where the default - //value will prevent anything from actually being scheduled. Normally this isn't - //a problem because as soon as you view the calendar for the first time, this is - //set to a week ahead in the future. + // Fudge the "populated until" date to workaround and issue where the default + // value will prevent anything from actually being scheduled. Normally this isn't + // a problem because as soon as you view the calendar for the first time, this is + // set to a week ahead in the future. $populateUntil = new DateTime('now', new DateTimeZone('UTC')); - $populateUntil = $populateUntil->add(new DateInterval('P2Y')); //2 years ahead in the future. + $populateUntil = $populateUntil->add(new DateInterval('P2Y')); // 2 years ahead in the future. Application_Model_Preference::SetShowsPopulatedUntil($populateUntil); - //$showService->setCcShow($testShowData); //Denise says this is not needed. - $showService->addUpdateShow($testShowData); //Create show instances + // $showService->setCcShow($testShowData); //Denise says this is not needed. + $showService->addUpdateShow($testShowData); // Create show instances // Moved creation of stor directory to TestHelper for setup @@ -57,23 +57,23 @@ class ScheduleUnitTest extends Zend_Test_PHPUnit_ControllerTestCase //PHPUnit_Fr 'MDATA_KEY_DURATION' => '00:01:00', 'is_record' => false, ]; - //Create the file in the database via the HTTP API. + // Create the file in the database via the HTTP API. $apiController = new ApiController($this->request, $this->getResponse()); $results = $apiController->dispatchMetadata($metadata, 'create'); $fileId = $results['fileid']; $this->assertNotEquals($fileId, -1); $this->assertEquals($fileId, 1); - //The file should not be scheduled in the future (or at all) at this point + // The file should not be scheduled in the future (or at all) at this point $scheduleModel = new Application_Model_Schedule(); $scheduleModel->IsFileScheduledInTheFuture($fileId); $this->assertEquals($scheduleModel->IsFileScheduledInTheFuture($fileId), false); - //Schedule the fake file in the test show, which should be in the future. + // Schedule the fake file in the test show, which should be in the future. $showInstance = new Application_Model_ShowInstance(1); $showInstance->addFileToShow($fileId); - //Test the function we actually want to test. :-) + // Test the function we actually want to test. :-) $this->assertEquals($scheduleModel->IsFileScheduledInTheFuture($fileId), true); } } diff --git a/legacy/tests/application/services/database/ShowServiceDbTest.php b/legacy/tests/application/services/database/ShowServiceDbTest.php index 42addcd49..ed41e4e96 100644 --- a/legacy/tests/application/services/database/ShowServiceDbTest.php +++ b/legacy/tests/application/services/database/ShowServiceDbTest.php @@ -17,14 +17,14 @@ require_once '../application/configs/conf.php'; class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase { private $_connectionMock; - //private $_nowDT; + // private $_nowDT; public function setUp() { TestHelper::installTestDatabase(); TestHelper::setupZendBootstrap(); - //$this->_nowDT = new DateTime("now", new DateTimeZone("UTC")); + // $this->_nowDT = new DateTime("now", new DateTimeZone("UTC")); parent::setUp(); } @@ -308,11 +308,11 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $service_show = new Application_Service_ShowService(null, $data); $service_show->addUpdateShow($data); - //delete some single instances first + // delete some single instances first $service_show->deleteShow(1, true); $service_show->deleteShow(6, true); $service_show->deleteShow(8, true); - //delete all instances including and after where id=4 + // delete all instances including and after where id=4 $service_show->deleteShow(4); $ds = new Zend_Test_PHPUnit_Db_DataSet_QueryDataSet( @@ -338,10 +338,10 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $showService = new Application_Service_ShowService(null, $data); $showService->addUpdateShow($data); - //move the start date forward one week and the start time forward one hour + // move the start date forward one week and the start time forward one hour $editData = ShowServiceData::getEditRepeatInstanceData(); - //need to create a new service so it gets constructed with the new data + // need to create a new service so it gets constructed with the new data $showService = new Application_Service_ShowService(null, $editData); $showService->editRepeatingShowInstance($editData); @@ -398,7 +398,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $showService->addUpdateShow($data); - //simulate the user moves forward in the calendar + // simulate the user moves forward in the calendar $end = new DateTime('2044-03-12', new DateTimeZone('UTC')); $showService->delegateInstanceCreation(null, $end, true); @@ -515,7 +515,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $showService = new Application_Service_ShowService(null, $data); $showService->addUpdateShow($data); - //insert some fake tracks into cc_schedule table + // insert some fake tracks into cc_schedule table $ccFiles = new CcFiles(); $ccFiles ->setDbCueIn('00:00:00') @@ -538,7 +538,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $scheduler = new Application_Model_Scheduler(); $scheduler->scheduleAfter($scheduleItems, $mediaItems); - //delete the first repeat day + // delete the first repeat day $data['add_show_day_check'] = [6]; $data['add_show_id'] = 1; $showService = new Application_Service_ShowService(null, $data, true); @@ -572,7 +572,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $showService = new Application_Service_ShowService(null, $data); $showService->addUpdateShow($data); - //insert some fake tracks into cc_schedule table + // insert some fake tracks into cc_schedule table $ccFiles = new CcFiles(); $ccFiles ->setDbCueIn('00:00:00') @@ -595,7 +595,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase $scheduler = new Application_Model_Scheduler(); $scheduler->scheduleAfter($scheduleItems, $mediaItems); - //delete the first repeat day + // delete the first repeat day $data['add_show_day_check'] = [6]; $data['add_show_id'] = 1; $showService = new Application_Service_ShowService(null, $data, true); @@ -622,7 +622,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase { TestHelper::loginUser(); - //test change repeat type from weekly to no-repeat + // test change repeat type from weekly to no-repeat $data = ShowServiceData::getWeeklyRepeatNoEndNoRRData(); $showService = new Application_Service_ShowService(null, $data); $showService->addUpdateShow($data); @@ -652,7 +652,7 @@ class ShowServiceDbTest extends Zend_Test_PHPUnit_DatabaseTestCase { TestHelper::loginUser(); - //test change repeat type weekly to bi-weekly + // test change repeat type weekly to bi-weekly $data = ShowServiceData::getWeeklyRepeatNoEndNoRRData(); $showService = new Application_Service_ShowService(null, $data); $showService->addUpdateShow($data); diff --git a/legacy/tests/application/services/unit/ShowServiceUnitTest.php b/legacy/tests/application/services/unit/ShowServiceUnitTest.php index e2fe41350..f8a6561a3 100644 --- a/legacy/tests/application/services/unit/ShowServiceUnitTest.php +++ b/legacy/tests/application/services/unit/ShowServiceUnitTest.php @@ -105,7 +105,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase $utcTimezone = new DateTimeZone('UTC'); - //America/Toronto + // America/Toronto $localStartDT = new DateTime('2044-01-01 06:30', new DateTimeZone('America/Toronto')); $localEndDT = new DateTime('2044-01-01 07:30', new DateTimeZone('America/Toronto')); @@ -113,7 +113,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase $this->assertEquals([ $localStartDT->setTimezone($utcTimezone), $localEndDT->setTimezone($utcTimezone), ], $dt); - //America/Toronto with offset for rebroadcast shows + // America/Toronto with offset for rebroadcast shows $localStartDT = new DateTime('2044-01-01 06:30', new DateTimeZone('America/Toronto')); $localEndDT = new DateTime('2044-01-01 07:30', new DateTimeZone('America/Toronto')); @@ -125,7 +125,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase $this->assertEquals([ $localRebroadcastStartDT->setTimezone($utcTimezone), $localRebroadcastEndDT->setTimezone($utcTimezone), ], $dt); - //Australia/Brisbane + // Australia/Brisbane $localStartDT = new DateTime('2044-01-01 06:30', new DateTimeZone('Australia/Brisbane')); $localEndDT = new DateTime('2044-01-01 07:30', new DateTimeZone('Australia/Brisbane')); @@ -133,7 +133,7 @@ class ShowServiceUnitTest extends PHPUnit_Framework_TestCase $this->assertEquals([ $localStartDT->setTimezone($utcTimezone), $localEndDT->setTimezone($utcTimezone), ], $dt); - //America/Vancouver + // America/Vancouver $localStartDT = new DateTime('2044-01-01 06:30', new DateTimeZone('America/Vancouver')); $localEndDT = new DateTime('2044-01-01 07:30', new DateTimeZone('America/Vancouver')); diff --git a/legacy/tests/application/testdata/ShowServiceData.php b/legacy/tests/application/testdata/ShowServiceData.php index ef78e9710..55da33e27 100644 --- a/legacy/tests/application/testdata/ShowServiceData.php +++ b/legacy/tests/application/testdata/ShowServiceData.php @@ -2,7 +2,7 @@ class ShowServiceData { - //Just a regular show - Non repeating, and not a recording & rebroadcast show. + // Just a regular show - Non repeating, and not a recording & rebroadcast show. public static function getNoRepeatNoRRData() { return [