From 8ec9ccedf309b86005341d2bd26aacdfa7548abd Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 5 Sep 2012 16:07:40 -0400 Subject: [PATCH 1/7] CC-4358: Calendar: Show Content: Undefined Index -fixed --- .../controllers/AudiopreviewController.php | 2 +- airtime_mvc/application/models/ShowInstance.php | 12 ++++++++++-- .../views/scripts/schedule/show-content-dialog.phtml | 8 ++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php index f827bbf08..4a55d8576 100644 --- a/airtime_mvc/application/controllers/AudiopreviewController.php +++ b/airtime_mvc/application/controllers/AudiopreviewController.php @@ -278,7 +278,7 @@ class AudiopreviewController extends Zend_Controller_Action $elementMap = array( 'element_title' => isset($track['track_title']) ? $track['track_title'] : "", - 'element_artist' => isset($track['artist_name']) ? $track['artist_name'] : "", + 'element_artist' => isset($track['creator']) ? $track['creator'] : "", 'element_position' => $position, 'element_id' => ++$position, ); diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 2d2b18894..b90051c7f 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -655,6 +655,9 @@ FROM ( 0::INTEGER as type , f.id AS item_id, f.track_title, + f.album_title AS album, + f.genre AS genre, + f.length AS length, f.artist_name AS creator, f.file_exists AS EXISTS, f.filepath AS filepath @@ -668,6 +671,9 @@ FROM ( 1::INTEGER as type, ws.id AS item_id, (ws.name || ': ' || ws.url) AS title, + null AS album, + null AS genre, + ws.length AS length, sub.login AS creator, 't'::boolean AS EXISTS, ws.url AS filepath @@ -688,8 +694,10 @@ SQL; $dt->setTimezone(new DateTimeZone(date_default_timezone_get())); $row["starts"] = $dt->format("Y-m-d H:i:s"); - $formatter = new LengthFormatter($row["clip_length"]); - $row["clip_length"] = $formatter->format(); + if (isset($row['length'])) { + $formatter = new LengthFormatter($row["length"]); + $row["length"] = $formatter->format(); + } } diff --git a/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml b/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml index 103796adc..a935f3f99 100644 --- a/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml +++ b/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml @@ -11,12 +11,12 @@ showContent as $row): ?> - " class=""> + " class=""> - - - + + + From 91c74d899524ab5f6547d946df7469c9b408c308 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 5 Sep 2012 16:21:59 -0400 Subject: [PATCH 2/7] -fixed syntax error --- airtime_mvc/application/models/Show.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 9fcaee13e..dd3a1e520 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1832,7 +1832,7 @@ SELECT si.starts AS start_timestamp, s.url, starts, ends -FROM cc_show_instances si, +FROM cc_show_instances si LEFT JOIN cc_show s ON si.instance_id = s.id WHERE si.show_id = s.id @@ -1875,7 +1875,7 @@ SELECT si.starts AS start_timestamp, s.url, starts, ends -FROM cc_show_instances si, +FROM cc_show_instances si LEFT JOIN cc_show s ON si.instance_id = s.id WHERE si.show_id = s.id From d9baddeba069bec147a555ac104628af7aa10419 Mon Sep 17 00:00:00 2001 From: denise Date: Wed, 5 Sep 2012 16:38:55 -0400 Subject: [PATCH 3/7] CC-4349: Encoded search in library should be labelled 'Encoded by' -fixed --- airtime_mvc/public/js/airtime/library/library.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index c2d5f8e70..c37522d87 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -21,6 +21,7 @@ var AIRTIME = (function(AIRTIME) { "mtime" : "n", "lptime" : "n", "disc_number" : "n", + "encoded_by" : "s", "genre" : "s", "isrc_number" : "s", "label" : "s", @@ -406,7 +407,7 @@ var AIRTIME = (function(AIRTIME) { /* Bit Rate */ { "sTitle" : "Bit Rate" , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" } , /* Sample Rate */ { "sTitle" : "Sample" , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" } , /* ISRC Number */ { "sTitle" : "ISRC" , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" } , - /* Encoded */ { "sTitle" : "Encoded" , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" } , + /* Encoded */ { "sTitle" : "Encoded By" , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" } , /* Label */ { "sTitle" : "Label" , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" } , /* Copyright */ { "sTitle" : "Copyright" , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" } , /* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" } , From 80fa090f13bfe613cdd8cf57c91976be92ac2321 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 5 Sep 2012 16:39:58 -0400 Subject: [PATCH 4/7] Uncommented old line of code perhaps it's useful --- airtime_mvc/application/controllers/ApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 2435b4e87..cd0ed19d1 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -511,7 +511,7 @@ class ApiController extends Zend_Controller_Action } } elseif ($mode == "delete") { $filepath = $md['MDATA_KEY_FILEPATH']; - //$filepath = str_replace("\\", "", $filepath); + $filepath = str_replace("\\", "", $filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { From 0838e310944c7115f7aec8c16ecec7a77022e19e Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 5 Sep 2012 16:57:01 -0400 Subject: [PATCH 5/7] cc-4347: PDO --- airtime_mvc/application/models/Schedule.php | 28 ++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 6699946b4..63e594bb8 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -1063,20 +1063,46 @@ SQL; * In both cases (new and edit) we only grab shows that * are scheduled 2 days prior */ + $se = $show_end->format('Y-m-d H:i:s'); if ($update) { $sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]." where (ends <= '{$show_end->format('Y-m-d H:i:s')}' or starts <= '{$show_end->format('Y-m-d H:i:s')}') and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days') and modified_instance = false and id != ".$instanceId. " order by ends"; + $stmt = $con->prepare("SELECT id, starts, ends FROM :showInstances + where (ends <= :show_end1 + or starts <= :show_end2) + and date(starts) >= (date(:show_end3) - INTERVAL '2 days') + and modified_instance = false and id != :instanceId order by ends"); + $stmt->execute(array( + ':showInstances' => $CC_CONFIG['showInstances'], + ':show_end1' => $se, + ':show_end2' => $se, + ':show_end3' => $se, + ':instanceId' => $instanceId + )); } else { + // TODO : Remove raw sql later $sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]." where (ends <= '{$show_end->format('Y-m-d H:i:s')}' or starts <= '{$show_end->format('Y-m-d H:i:s')}') and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days') and modified_instance = false order by ends"; + $stmt = $con->prepare("SELECT id, starts, ends FROM :showInstances + where (ends <= :show_end1 + or starts <= :show_end2) + and date(starts) >= (date(:show_end3) - INTERVAL '2 days') + and modified_instance = false order by ends"); + $stmt->execute(array( + ':showInstances' => $CC_CONFIG['showInstances'], + ':show_end1' => $se, + ':show_end2' => $se, + ':show_end3' => $se, + )); } - $rows = $con->query($sql); + //$rows = $con->query($sql); + $rows->fetchAll(); foreach ($rows as $row) { $start = new DateTime($row["starts"], new DateTimeZone('UTC')); From 7cbfb5d40d132b4a86b5088c49d0d770c4435aa8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 5 Sep 2012 17:29:34 -0400 Subject: [PATCH 6/7] allow Airtime environment to be accessed from CLI --- airtime_mvc/public/index.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/index.php b/airtime_mvc/public/index.php index e496f133c..2827b3835 100644 --- a/airtime_mvc/public/index.php +++ b/airtime_mvc/public/index.php @@ -27,7 +27,7 @@ set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_pat set_include_path(APPLICATION_PATH . '/controllers/plugins' . PATH_SEPARATOR . get_include_path()); //Zend framework -if (file_exists('/usr/share/php/libzend-framework-php')){ +if (file_exists('/usr/share/php/libzend-framework-php')) { set_include_path('/usr/share/php/libzend-framework-php' . PATH_SEPARATOR . get_include_path()); } @@ -39,5 +39,13 @@ $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); -$application->bootstrap() + +if (substr($sapi_type, 0, 3) == 'cli') { + set_include_path(APPLICATION_PATH . PATH_SEPARATOR . get_include_path()); + require_once("Bootstrap.php"); +} else { + $application->bootstrap() ->run(); +} + + From b6b4e25a37fdc4d624add3e23a7a5f436787d2f4 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 5 Sep 2012 17:34:12 -0400 Subject: [PATCH 7/7] allow Airtime environment to be accessed from CLI -fixed --- airtime_mvc/public/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/airtime_mvc/public/index.php b/airtime_mvc/public/index.php index 2827b3835..062e2aed2 100644 --- a/airtime_mvc/public/index.php +++ b/airtime_mvc/public/index.php @@ -40,6 +40,7 @@ $application = new Zend_Application( APPLICATION_PATH . '/configs/application.ini' ); +$sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cli') { set_include_path(APPLICATION_PATH . PATH_SEPARATOR . get_include_path()); require_once("Bootstrap.php");