diff --git a/include/ajax.staff.php b/include/ajax.staff.php index 54c0fed5b92dd54fa2d431eee05a872f2ab406db..e3fec3a653dea884cce34c13ee19bf84881c5a3b 100644 --- a/include/ajax.staff.php +++ b/include/ajax.staff.php @@ -29,6 +29,7 @@ class StaffAjaxAPI extends AjaxController { Http::response(404, 'No such agent'); $form = new PasswordResetForm($_POST); + $errors = array(); if (!$_POST && isset($_SESSION['new-agent-passwd'])) $form->data($_SESSION['new-agent-passwd']); @@ -76,6 +77,7 @@ class StaffAjaxAPI extends AjaxController { Http::response(404, 'No such agent'); $form = new PasswordChangeForm($_POST); + $errors = array(); if ($_POST && $form->isValid()) { $clean = $form->getClean(); diff --git a/include/class.format.php b/include/class.format.php index 4e5bb04b832d597104de8f287d495e14b953bf0f..6c0ee841b705ba688abc439ab12d5280ae237c8c 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -869,8 +869,6 @@ implements TemplateVariable { } function getVar($what) { - global $cfg; - // TODO: Rebase date format so that locale is discovered HERE. switch ($what) { @@ -906,20 +904,21 @@ extends FormattedLocalDate { return (string) new FormattedLocalDate($this->date, $cfg->getTimezone(), false, $this->fromdb); } - function getVar($what, $context) { + function getVar($what, $context=null) { global $cfg; - if ($rv = parent::getVar($what)) + if ($rv = parent::getVar($what, $context)) return $rv; switch ($what) { case 'user': // Fetch $recipient from the context and find that user's time zone - if ($recipient = $context->getObj('recipient')) { + if ($context && ($recipient = $context->getObj('recipient'))) { $tz = $recipient->getTimezone() ?: $cfg->getDefaultTimezone(); return new FormattedLocalDate($this->date, $tz, $recipient); } - break; + // Don't resolve the variable until correspondance is sent out + return false; case 'system': return new FormattedLocalDate($this->date, $cfg->getDefaultTimezone()); } diff --git a/include/class.thread.php b/include/class.thread.php index c0fbb8fec54c199573d176ddac58532e57ff3ea4..81fb47aed86b942e0ffe61a3de87b8a6bc5a51ad 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -2447,7 +2447,7 @@ implements TemplateVariable { return $message; $this->lastmessage = SqlFunction::NOW(); - $this->save(); + $this->save(true); return $message; } @@ -2460,7 +2460,7 @@ implements TemplateVariable { return $resp; $this->lastresponse = SqlFunction::NOW(); - $this->save(); + $this->save(true); return $resp; }