BaseAastra: add timeout to the actionurl settings
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
diff --git a/include/BaseAastra.class.php b/include/BaseAastra.class.php
index d29aa77..1e98459 100644
--- a/include/BaseAastra.class.php
+++ b/include/BaseAastra.class.php
@@ -64,19 +64,28 @@
$this->do->output();
}
+ const validity = 600; # 600 seconds is 10 minutes
+
function getActionHandler() {
if (!isset($_GET['app'])) {
throw new Exception('No App defined in action handler');
}
- return $this->asm->database_get('actionhandler',$_GET['app'].'-'.$this->user);
+ $app = $_GET['app'];
+ $t = $this->asm->database_get('actionhandler', $app.'-'.$this->user.'-timestamp');
+ if ($t > time() + self::validity) {
+ return null;
+ }
+ return $this->asm->database_get('actionhandler',$app.'-'.$this->user);
}
function setActionHandler($app, $url) {
$this->asm->database_put('actionhandler', $app.'-'.$this->user, $url);
+ $this->asm->database_put('actionhandler', $app.'-'.$this->user.'-timestamp', time());
}
function delActionHandler($app) {
$this->asm->database_del('actionhandler', $app.'-'.$this->user);
+ $this->asm->database_del('actionhandler', $app.'-'.$this->user.'-timestamp');
}
function yesno() {