cc-4347: PDO00!!!

This commit is contained in:
Rudi Grinberg 2012-09-05 17:46:29 -04:00
parent 23ee726cfd
commit 0385c008ce
1 changed files with 14 additions and 10 deletions

View File

@ -324,24 +324,28 @@ class Application_Model_ShowInstance
{ {
$con = Propel::getConnection(); $con = Propel::getConnection();
$hours = $deltaMin/60; $hours = $deltaMin / 60;
if($hours > 0)
$hours = floor($hours);
else
$hours = ceil($hours);
$mins = abs($deltaMin%60); $hours = ($hours > 0) ? floor($hours) : ceil($hours);
$mins = abs($deltaMin % 60);
$today_timestamp = gmdate("Y-m-d H:i:s"); $today_timestamp = gmdate("Y-m-d H:i:s");
$starts = $this->getShowInstanceStart(); $starts = $this->getShowInstanceStart();
$ends = $this->getShowInstanceEnd(); $ends = $this->getShowInstanceEnd();
if (strtotime($today_timestamp) > strtotime($starts)) { if (strtotime($today_timestamp) > strtotime($starts)) {
return "can't resize a past show"; return "can't resize a past show";
} }
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'"; //$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
$new_ends = $con->query($sql)->fetchColumn(0); $sql = "SELECT timestamp :ends + interval :deltaDays + interval :deltaTime";
$now_ends = Application_Common_Database::prepareAndExecute($sql,
array(':ends' => $ends,
':deltaDays' => "$deltaDay days",
':deltaTime' => "{$hours}:{$mins}"), 'column'
);
//only need to check overlap if show increased in size. //only need to check overlap if show increased in size.
if (strtotime($new_ends) > strtotime($ends)) { if (strtotime($new_ends) > strtotime($ends)) {