diff options
author | James Bottomley <JBottomley@Parallels.com> | 2013-05-01 23:10:56 -0700 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-01 23:10:56 -0700 |
commit | 1ffd06749871587fef73a4f4188fc24aadd928da (patch) | |
tree | a73ccd0d187543ec1dbc513760a5167901eadc26 | |
parent | fe99a5d46c132d1f4ea4c84370a4250b9685f2e6 (diff) | |
download | asterisk-aastra-1ffd06749871587fef73a4f4188fc24aadd928da.tar.gz |
ActionURI: add handler
Add handler file for action URIs
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | actionuri.php | 5 | ||||
-rw-r--r-- | include/ActionURIHandler.class.php | 26 | ||||
-rw-r--r-- | include/BaseAastra.class.php | 15 |
4 files changed, 53 insertions, 1 deletions
@@ -46,10 +46,13 @@ blacklist-files = \ include/Blacklist.class.php \ include/BlacklistManager.class.php +actionuri-files = \ + include/ActionURIHandler.class.php + blacklist-doc-files = \ etc/extensions-blacklist.conf -packages := blacklist +packages := blacklist actionuri all: @echo @@ -76,3 +79,6 @@ install-blacklist: install-php install-web install -m 0644 blackwhitelist.php $(web_prefix) install -m 0644 $(blacklist-doc-files) $(doc_prefix) +install-actionuri: install-php install-web + install -m 0644 $(actionuri-files) $(php_prefix) + install -m 0644 actionuri.php $(web_prefix) diff --git a/actionuri.php b/actionuri.php new file mode 100644 index 0000000..597719e --- /dev/null +++ b/actionuri.php @@ -0,0 +1,5 @@ +<?php + require_once('asterisk-aastra/ActionURIHandler.class.php'); + $c = new ActionURIHandler(); + $c->init(); +?> diff --git a/include/ActionURIHandler.class.php b/include/ActionURIHandler.class.php new file mode 100644 index 0000000..7a3c552 --- /dev/null +++ b/include/ActionURIHandler.class.php @@ -0,0 +1,26 @@ +<?php +## +# Copyright 2013 by James Bottomley +## +# actionuri handler class +## +require_once('BaseAastra.class.php'); +require_once('AastraIPPhoneExecute.class.php'); + +class ActionURIHandler extends BaseAastra { + function start() { + $this->displayObject(new AastraIPPhoneExecute()); + $uri = $this->getActionHandler(); + if (!$uri) { + ## + # do nothing. This is the most common case + # because mostly nothing wants to intercept + # the actions + ## + $this->do->addEntry(" "); + } else { + $this->do->addEntry($uri); + } + } +} +?> diff --git a/include/BaseAastra.class.php b/include/BaseAastra.class.php index 537aca8..d29aa77 100644 --- a/include/BaseAastra.class.php +++ b/include/BaseAastra.class.php @@ -64,6 +64,21 @@ abstract class BaseAastra { $this->do->output(); } + 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); + } + + function setActionHandler($app, $url) { + $this->asm->database_put('actionhandler', $app.'-'.$this->user, $url); + } + + function delActionHandler($app) { + $this->asm->database_del('actionhandler', $app.'-'.$this->user); + } + function yesno() { $this->do->addSoftkey('1', 'Yes', $this->fullurl.'&yesno=yes'); $this->do->addSoftkey('2', 'No', $this->fullurl.'&yesno=no'); |