Exemplo n.º 1
0
 public function saveAction()
 {
     try {
         $shout = $GLOBALS['shout'] = Horde_Registry::appInit('shout');
         $vars = $this->vars;
         if (!($action = $vars->get('action'))) {
             throw new Shout_Exception("Invalid action requested.");
         }
         $account = $GLOBALS['session']->get('shout', 'curaccount_code');
         $digit = $vars->get('digit');
         $menu = $vars->get('menu');
         $action = $vars->get('action');
         if ($action == 'none') {
             // Remove the menu action and return
             $shout->dialplan->deleteMenuAction($account, $menu, $digit);
             return true;
         }
         $actions = Shout::getMenuActions();
         if (!isset($actions[$action])) {
             throw new Shout_Exception('Invalid action requested.');
         }
         $args = array();
         foreach ($actions[$action]['args'] as $name => $info) {
             $args[$name] = $vars->get($name);
         }
         $shout->dialplan->saveMenuAction($account, $menu, $digit, $action, $args);
         return true;
     } catch (Exception $e) {
         //FIXME: Create a way to notify the user of the failure.
         Horde::log($e, 'ERR');
         return false;
     }
 }