X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Freminder.inc.php;h=6b8e5bfafa5e2c1dd36cf42298f0cd06e6bff617;hb=98d858e523a7c7509bdff56e23cec4f435e93e02;hp=715d2d541747d72533d5604f4c35ddac051cfd09;hpb=93d42b4fcc6f055a428c9b63e386ac62c918d08a;p=platal.git diff --git a/include/reminder.inc.php b/include/reminder.inc.php index 715d2d5..6b8e5bf 100644 --- a/include/reminder.inc.php +++ b/include/reminder.inc.php @@ -1,6 +1,6 @@ user = &$user; @@ -71,9 +71,9 @@ abstract class Reminder // and the next ask (if any). private static function UpdateStatus($uid, $type_id, $status, $next_ask) { - XDB::execute('REPLACE INTO reminder - SET uid = {?}, type_id = {?}, status = {?}, - remind_last = NOW(), remind_next = FROM_UNIXTIME({?})', + XDB::execute('INSERT INTO reminder (uid, type_id, status, remind_last, remind_next) + VALUES ({?}, {?}, {?}, NOW(), FROM_UNIXTIME({?})) + ON DUPLICATE KEY UPDATE status = VALUES(status), remind_last = VALUES(remind_last), remind_next = VALUES(remind_next)', $uid, $type_id, $status, ($next_ask > 0 ? time() + $next_ask * 24 * 60 * 60 : null)); } @@ -103,7 +103,7 @@ abstract class Reminder // Displays a reduced version of the reminder and notifies that the action // has been taken into account. - public function NotifiesAction(&$page) + public function NotifiesAction($page) { pl_content_headers("text/html"); $page->changeTpl('reminder/notification.tpl', NO_SKIN); @@ -112,7 +112,7 @@ abstract class Reminder // Displays the reminder as a standalone html snippet. It should be used // when the reminder is the only output of a page. - public function DisplayStandalone(&$page, $previous_reminder = null) + public function DisplayStandalone($page, $previous_reminder = null) { pl_content_headers("text/html"); $page->changeTpl('reminder/base.tpl', NO_SKIN); @@ -123,7 +123,7 @@ abstract class Reminder } // Prepares the display by assigning template variables. - public function Prepare(&$page) + public function Prepare($page) { $page->assign_by_ref('reminder', $this); } @@ -165,7 +165,7 @@ abstract class Reminder // Static factories ------------------------------------------------------- // Returns a chosen class using the user data from |user|, and from the database. - public static function GetCandidateReminder(User &$user) + public static function GetCandidateReminder(User $user) { $res = XDB::query('SELECT rt.*, r.status, r.remind_last FROM reminder_type AS rt @@ -194,7 +194,7 @@ abstract class Reminder // Returns an instantiation of the reminder class which name is |name|, using // user data from |user|, and from the database. - public static function GetByName(User &$user, $name) + public static function GetByName(User $user, $name) { if (!($class = self::GetClassName($name))) { return null;