From: Michael M Slusarz Date: Sun, 26 Jul 2009 22:22:59 +0000 (-0600) Subject: Add a once-only option for logintasks (different than first login interval) X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=675989ba1f5cc202e7db393401092fedb735d252;p=horde.git Add a once-only option for logintasks (different than first login interval) --- diff --git a/framework/LoginTasks/lib/Horde/LoginTasks.php b/framework/LoginTasks/lib/Horde/LoginTasks.php index 4f5cf9a0d..49789abd3 100644 --- a/framework/LoginTasks/lib/Horde/LoginTasks.php +++ b/framework/LoginTasks/lib/Horde/LoginTasks.php @@ -26,6 +26,8 @@ class Horde_LoginTasks const EVERY = 5; // Do task on first login only. const FIRST_LOGIN = 6; + // Do task once only. + const ONCE = 7; /* Display styles. */ const DISPLAY_CONFIRM_NO = 1; @@ -182,7 +184,7 @@ class Horde_LoginTasks /* If timestamp is empty (= 0), this is the first time the user has logged in. Don't run any other login task operations on the first login. */ - $addtask = ($ob->interval == self::FIRST_LOGIN); + $addtask = in_array($ob->interval, array(self::FIRST_LOGIN, self::ONCE)); } else { switch ($ob->interval) { case self::YEARLY: @@ -204,6 +206,12 @@ class Horde_LoginTasks case self::EVERY: $addtask = true; break; + + case self::ONCE: + $addtask = empty($lasttasks['_once']) || !in_array($classname, $lasttasks['_once']); + $lasttasks['_once'][] = $classname; + $GLOBALS['prefs']->setValue('last_logintasks', serialize($lasttasks)); + break; } }