From c894a26da22fc4dbe593fe1d564762795a9b2124 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gon=C3=A7alo=20Queir=C3=B3s?= Date: Mon, 3 Aug 2009 11:21:32 +0200 Subject: [PATCH] Cast values. --- kronolith/ajax.php | 5 +++-- nag/lib/Task.php | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kronolith/ajax.php b/kronolith/ajax.php index d3f59f04e..166bf8a2d 100644 --- a/kronolith/ajax.php +++ b/kronolith/ajax.php @@ -9,6 +9,7 @@ * * @author Michael Slusarz * @author Jan Schneider + * @author Gonçalo Queirós * @package Kronolith */ @@ -130,7 +131,7 @@ try { } $taskList = Horde_Util::getFormData('list'); - $taskType = Horde_Util::getFormData('taskType'); + $taskType = (int)Horde_Util::getFormData('taskType'); $tasks = $registry->call('tasks/listTasks', array(null, null, null, $taskList, $taskType, true)); if (is_a($tasks, 'PEAR_Error')) { @@ -338,7 +339,7 @@ try { break; } $taskList = Horde_Util::getFormData('taskList'); - $taskType = Horde_Util::getFormData('taskType'); + $taskType = (int)Horde_Util::getFormData('taskType'); $taskId = Horde_Util::getFormData('taskId'); $saved = $registry->call('tasks/toggleCompletion', array($taskId, $taskList)); diff --git a/nag/lib/Task.php b/nag/lib/Task.php index 04d6723b0..42c1ed196 100644 --- a/nag/lib/Task.php +++ b/nag/lib/Task.php @@ -667,7 +667,7 @@ class Nag_Task { //whitespace $json->sd = Horde_String::substr($this->desc, 0, 80); } - $json->cp = $this->completed; + $json->cp = (boolean)$this->completed; if ($this->due) { $date = new Horde_Date($this->due); $json->du = $date->toJson(); @@ -676,7 +676,7 @@ class Nag_Task { $date = new Horde_Date($this->start); $json->s = $date->toJson(); } - $json->pr = $this->priority; + $json->pr = (int)$this->priority; if ($full) { // @todo: do we really need all this? @@ -687,14 +687,17 @@ class Nag_Task { $json->o = $this->owner; $json->as = $this->assignee; $json->ct = $this->category; - $json->e = $this->estimate; + if ($this->estimate) { + $date = new Horde_Date($this->estimate); + $json->e = $date->toJson(); + } if ($this->completed_date) { $date = new Horde_Date($this->completed_date); $json->cd = $date->toJson(); } $json->a = $this->alarm; $json->m = $this->methods; - $json->pv = $this->private; + $json->pv = (boolean)$this->private; } return $json; -- 2.11.0