diff options
author | James Bottomley <JBottomley@Parallels.com> | 2013-05-02 20:23:13 -0700 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-02 20:23:13 -0700 |
commit | 7ff500a432bffa9c81e985ddc359fb371d69941a (patch) | |
tree | e2094c926fa374254f55196f3a6f616ab6b85720 | |
parent | d3a081b062198a8b843b86f9e8ccc332b517422f (diff) | |
download | asterisk-aastra-7ff500a432bffa9c81e985ddc359fb371d69941a.tar.gz |
BaseAastra: add timeout to the actionurl settings
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | include/BaseAastra.class.php | 11 |
1 files changed, 10 insertions, 1 deletions
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 @@ abstract class BaseAastra { $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() { |