From: Florent Bruneau Date: Wed, 23 Jun 2010 08:12:19 +0000 (+0200) Subject: Change the email format directly via the User object to ensure the changes X-Git-Tag: xorg/1.0.0~77 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8d308ee4586dab8103b55b88ad808e679ac799a5;p=platal.git Change the email format directly via the User object to ensure the changes are immediately taken into account (Closes #1112) Signed-off-by: Florent Bruneau --- diff --git a/classes/user.php b/classes/user.php index c69e234..9b1d41e 100644 --- a/classes/user.php +++ b/classes/user.php @@ -405,6 +405,20 @@ class User extends PlUser } + /** Format of the emails sent by the site + */ + public function setEmailFormat($format) + { + Platal::assert($format == self::FORMAT_HTML || $format == self::FORMAT_TEXT, + "Invalid email format \"$format\""); + XDB::execute("UPDATE accounts + SET email_format = {?} + WHERE uid = {?}", + $format, $this->uid); + $this->email_format = $format; + } + + /** Get watch informations */ private function fetchWatchData() diff --git a/modules/platal.php b/modules/platal.php index 197728e..2ad9317 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -132,10 +132,7 @@ class PlatalModule extends PLModule if (Post::has('email_format')) { $fmt = Post::s('email_format'); - XDB::execute("UPDATE accounts - SET email_format = {?} - WHERE uid = {?}", - $fmt, S::v('uid')); + S::user()->setEmailFormat($fmt); S::set('email_format', $fmt); }