From 57aae73074309179fb26e4b3e0f760263f69ac6b Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 11:06:34 -0400 Subject: [PATCH] cc-4347: PDO'd: GetLastShowInstance --- .../application/models/ShowInstance.php | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 1e71510d7..ef2521ad5 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -754,22 +754,17 @@ SQL; public static function GetLastShowInstance($p_timeNow) { - global $CC_CONFIG; - $con = Propel::getConnection(); + $sql = << $p_timeNow ), 'column' ); - $sql = "SELECT si.id" - ." FROM $CC_CONFIG[showInstances] si" - ." WHERE si.ends < TIMESTAMP '$p_timeNow'" - ." AND si.modified_instance = 'f'" - ." ORDER BY si.ends DESC" - ." LIMIT 1"; - - $id = $con->query($sql)->fetchColumn(0); - if ($id) { - return new Application_Model_ShowInstance($id); - } else { - return null; - } + return ($id ? new Application_Model_ShowInstance($id) : null ); } public static function GetCurrentShowInstance($p_timeNow)