Convert Shout to Horde_Session
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 17 Nov 2010 20:51:46 +0000 (13:51 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 18 Nov 2010 16:39:15 +0000 (09:39 -0700)
25 files changed:
shout/admin.php
shout/admin/accounts.php
shout/admin/numbers.php
shout/conferences.php
shout/devices.php
shout/dialplan.php
shout/extensions.php
shout/index.php
shout/lib/Ajax/Application.php
shout/lib/Application.php
shout/lib/Forms/AccountForm.php
shout/lib/Forms/ConferenceForm.php
shout/lib/Forms/DeviceForm.php
shout/lib/Forms/ExtensionForm.php
shout/lib/Forms/MenuForm.php
shout/lib/Forms/NumberForm.php
shout/lib/Forms/RecordingForm.php
shout/lib/Shout.php
shout/recordings.php
shout/templates/conferences/list.inc
shout/templates/devices/list.inc
shout/templates/extensions.inc.php
shout/templates/menu.inc
shout/templates/recordings/list.inc
shout/wizard.php

index 9d7e866..28c08b6 100644 (file)
@@ -14,9 +14,6 @@ $shout = Horde_Registry::appInit('shout');
 
 require_once SHOUT_BASE . '/lib/Forms/AccountForm.php';
 
-
-$curaccount = $_SESSION['shout']['curaccount'];
-
 $RENDERER = new Horde_Form_Renderer();
 
 $title = _("Accounts: ");
index 45f4869..67c6add 100644 (file)
@@ -15,7 +15,7 @@ $shout = Horde_Registry::appInit('shout');
 require_once SHOUT_BASE . '/lib/Forms/AccountForm.php';
 
 $action = Horde_Util::getFormData('action');
-$curaccount = $_SESSION['shout']['curaccount'];
+$curaccount = $GLOBALS['session']->get('shout', 'curaccount');
 
 $RENDERER = new Horde_Form_Renderer();
 
@@ -25,7 +25,7 @@ switch ($action) {
 case 'add':
 case 'edit':
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new AccountDetailsForm($vars);
 
     if ($Form->isSubmitted() && $Form->validate($vars, true)) {
@@ -58,7 +58,7 @@ case 'delete':
     $extension = Horde_Util::getFormData('extension');
 
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new ExtensionDeleteForm($vars);
 
     $FormValid = $Form->validate($vars, true);
@@ -77,7 +77,7 @@ case 'delete':
     }
 
     $vars = Horde_Variables::getDefaultVariables(array());
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new ExtensionDeleteForm($vars);
 
     break;
index 7bf341d..8ebb6f5 100644 (file)
@@ -15,7 +15,7 @@ $shout = Horde_Registry::appInit('shout');
 require_once SHOUT_BASE . '/lib/Forms/NumberForm.php';
 
 $action = Horde_Util::getFormData('action');
-$curaccount = $_SESSION['shout']['curaccount'];
+$curaccount = $GLOBALS['session']->get('shout', 'curaccount_code');
 
 $RENDERER = new Horde_Form_Renderer();
 
@@ -59,7 +59,7 @@ case 'delete':
     $extension = Horde_Util::getFormData('extension');
 
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new ExtensionDeleteForm($vars);
 
     $FormValid = $Form->validate($vars, true);
@@ -78,7 +78,7 @@ case 'delete':
     }
 
     $vars = Horde_Variables::getDefaultVariables(array());
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new ExtensionDeleteForm($vars);
 
     break;
index 39daec3..a9f2cf3 100644 (file)
@@ -14,7 +14,7 @@ $shout = Horde_Registry::appInit('shout');
 
 require_once SHOUT_BASE . '/lib/Forms/ConferenceForm.php';
 
-$curaccount = $_SESSION['shout']['curaccount'];
+$curaccount = $GLOBALS['session']->get('shout', 'curaccount_code');
 $action = Horde_Util::getFormData('action');
 $vars = Horde_Variables::getDefaultVariables();
 
@@ -26,7 +26,7 @@ switch ($action) {
 case 'add':
 case 'edit':
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new ConferenceDetailsForm($vars);
 
     // Show the list if the save was successful, otherwise back to edit.
@@ -49,7 +49,7 @@ case 'edit':
 
     // Create a new add/edit form
     $roomno = Horde_Util::getFormData('roomno');
-    $conferences = $shout->storage->getConferences($curaccount['code']);
+    $conferences = $shout->storage->getConferences($curaccount);
     $vars = new Horde_Variables($conferences[$roomno]);
 
     $vars->set('action', $action);
@@ -65,7 +65,7 @@ case 'delete':
     $devid = Horde_Util::getFormData('devid');
 
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDeleteForm($vars);
 
     $FormValid = $Form->validate($vars, true);
@@ -83,7 +83,7 @@ case 'delete':
     }
 
     $vars = Horde_Variables::getDefaultVariables(array());
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDeleteForm($vars);
     break;
 
@@ -95,7 +95,7 @@ default:
 
 // Fetch the (possibly updated) list of extensions
 try {
-    $conferences = $shout->devices->getConferences($curaccount['code']);
+    $conferences = $shout->devices->getConferences($curaccount);
 } catch (Exception $e) {
     $notification->push($e);
     $devices = array();
index fc6e0b5..61e4c11 100644 (file)
@@ -14,7 +14,7 @@ $shout = Horde_Registry::appInit('shout');
 
 require_once SHOUT_BASE . '/lib/Forms/DeviceForm.php';
 
-$curaccount = $_SESSION['shout']['curaccount'];
+$curaccount = $GLOBALS['session']->get('shout', 'curaccount_code');
 $action = Horde_Util::getFormData('action');
 $vars = Horde_Variables::getDefaultVariables();
 
@@ -26,7 +26,7 @@ switch ($action) {
 case 'add':
 case 'edit':
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDetailsForm($vars);
 
     // Show the list if the save was successful, otherwise back to edit.
@@ -51,7 +51,7 @@ case 'edit':
 
     // Create a new add/edit form
     $devid = Horde_Util::getFormData('devid');
-    $devices = $shout->devices->getDevices($curaccount['code']);
+    $devices = $shout->devices->getDevices($curaccount);
     $vars = new Horde_Variables($devices[$devid]);
 
     $vars->set('action', $action);
@@ -66,7 +66,7 @@ case 'delete':
     $devid = Horde_Util::getFormData('devid');
 
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDeleteForm($vars);
 
     $FormValid = $Form->validate($vars, true);
@@ -84,7 +84,7 @@ case 'delete':
     }
 
     $vars = Horde_Variables::getDefaultVariables(array());
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new DeviceDeleteForm($vars);
 
     break;
@@ -97,7 +97,7 @@ default:
 
 // Fetch the (possibly updated) list of extensions
 try {
-    $devices = $shout->devices->getDevices($curaccount['code']);
+    $devices = $shout->devices->getDevices($curaccount);
 } catch (Exception $e) {
     $notification->push($e);
     $devices = array();
index 9669713..cdd1585 100644 (file)
@@ -16,9 +16,9 @@ require_once SHOUT_BASE . '/lib/Forms/MenuForm.php';
 
 $action = Horde_Util::getFormData('action');
 $menu = Horde_Util::getFormData('menu');
-$curaccount = $_SESSION['shout']['curaccount'];
+$curaccount = $GLOBALS['session']->get('shout', 'curaccount_code');
 
-$menus = $shout->storage->getMenus($curaccount['code']);
+$menus = $shout->storage->getMenus($curaccount);
 if (empty($menus)) {
     Horde::url('wizard.php', true)->redirect();
 }
@@ -26,7 +26,7 @@ if (empty($menus)) {
 switch($action) {
 case 'add':
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new MenuForm($vars);
 
     if ($Form->isSubmitted() && $Form->validate($vars, true)) {
@@ -35,7 +35,7 @@ case 'add':
             $Form->execute();
             $notification->push(_("Menu added."),
                                   'horde.success');
-            $menus = $shout->storage->getMenus($curaccount['code']);
+            $menus = $shout->storage->getMenus($curaccount);
             $action = 'edit';
 
         } catch (Exception $e) {
@@ -62,9 +62,9 @@ default:
 // after a successful add.
 if ($action == 'edit') {
     try {
-        $destinations = $shout->extensions->getExtensions($curaccount['code']);
-        $conferences = $shout->storage->getConferences($curaccount['code']);
-        $recordings = $shout->storage->getRecordings($curaccount['code']);
+        $destinations = $shout->extensions->getExtensions($curaccount);
+        $conferences = $shout->storage->getConferences($curaccount);
+        $recordings = $shout->storage->getRecordings($curaccount);
         // If any of these are empty, we need to coerce them to null.
         // Otherwise we end up with a Prototype.js $H([]) (Hash of an empty
         // Array) which causes confusion inside the library.
index 1080c24..f360096 100644 (file)
@@ -14,17 +14,14 @@ $shout = Horde_Registry::appInit('shout');
 
 require_once SHOUT_BASE . '/lib/Forms/ExtensionForm.php';
 
-$curaccount = $_SESSION['shout']['curaccount'];
-
 $RENDERER = new Horde_Form_Renderer();
 
 $section = 'extensions';
 $title = _("Extensions: ");
 
-
 // Fetch the (possibly updated) list of extensions
 try {
-    $extensions = $shout->extensions->getExtensions($curaccount['code']);
+    $extensions = $shout->extensions->getExtensions($session->get('shout', 'curaccount_code'));
 } catch (Exception $e) {
     $notification->push($e);
     $extensions = array();
index 1dd9fd4..df4ae93 100644 (file)
 require_once dirname(__FILE__) . '/lib/Application.php';
 $shout = Horde_Registry::appInit('shout');
 
-if (empty($_SESSION['shout']['curaccount'])) {
+if (!($curaccount = $GLOBALS['session']->get('shout', 'curaccount_code'))) {
     die("Permission denied.");
 }
 
-$curaccount = $_SESSION['shout']['curaccount'];
-$menus = $shout->storage->getMenus($curaccount['code']);
+$menus = $shout->storage->getMenus($curaccount);
 
 if (empty($menus)) {
     Horde::url('wizard.php', true)->redirect();
index 96b8b8f..eefe401 100644 (file)
@@ -17,9 +17,9 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
     {
         try {
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-            $curaccount = $_SESSION['shout']['curaccount'];
+            $curaccount = $GLOBALS['session']->get('shout', 'curaccount_code');
             require_once SHOUT_BASE . '/lib/Forms/ExtensionForm.php';
-            $this->_vars->set('account', $curaccount['code']);
+            $this->_vars->set('account', $curaccount);
             $Form = new ExtensionDetailsForm($this->_vars);
             $Form->setSubmitted();
             if ($Form->isValid()) {
@@ -40,7 +40,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
     {
         $vars = $this->_vars;
         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-        $account = $_SESSION['shout']['curaccount']['code'];
+        $account = $GLOBALS['session']->get('shout', 'curaccount_code');
         try {
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
             $shout->extensions->addDestination($account, $vars->extension, $vars->type, $vars->destination);
@@ -60,7 +60,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
     {
         $vars = $this->_vars;
         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-        $account = $_SESSION['shout']['curaccount']['code'];
+        $account = $GLOBALS['session']->get('shout', 'curaccount_code');
         try {
             // FIXME: Use Form?
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
@@ -82,7 +82,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
         try {
             $vars = $this->_vars;
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-            $account = $_SESSION['shout']['curaccount']['code'];
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
             return $shout->extensions->getExtensions($account);
         } catch (Exception $e) {
             //FIXME: Create a way to notify the user of the failure.
@@ -96,7 +96,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
         try {
             $vars = $this->_vars;
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-            $account = $_SESSION['shout']['curaccount']['code'];
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
             $devices = $shout->devices->getDevices($account);
             if (empty($devices)) {
                 return false;
@@ -117,7 +117,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
     {
         try {
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-            $account = $_SESSION['shout']['curaccount']['code'];
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
             $menus = $shout->storage->getMenus($account);
             if (empty($menus)) {
                 return false;
@@ -138,7 +138,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
     {
         try {
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-            $account = $_SESSION['shout']['curaccount']['code'];
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
             $menu = $this->_vars->get('menu');
             if (empty($menu)) {
                 throw new Shout_Exception('Must specify a menu to delete.');
@@ -156,7 +156,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
     {
         try {
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-            $account = $_SESSION['shout']['curaccount']['code'];
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
             return $shout->storage->getConferences($account);
         } catch (Exception $e) {
             //FIXME: Create a way to notify the user of the failure.
@@ -169,7 +169,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
     {
         try {
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-            $account = $_SESSION['shout']['curaccount']['code'];
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
             $vars = &$this->_vars;
             $info = array(
                 'name' => $vars->get('name'),
@@ -193,7 +193,7 @@ class Shout_Ajax_Application extends Horde_Core_Ajax_Application
             if (!($action = $vars->get('action'))) {
                 throw new Shout_Exception("Invalid action requested.");
             }
-            $account = $_SESSION['shout']['curaccount']['code'];
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
             $digit = $vars->get('digit');
             $menu = $vars->get('menu');
             $action = $vars->get('action');
index 936ed74..ed044d9 100644 (file)
@@ -90,8 +90,8 @@ class Shout_Application extends Horde_Registry_Application
         }
 
         $account = Horde_Util::getFormData('account');
-        if (empty($account) && !empty($_SESSION['shout']['curaccount'])) {
-            $account = $_SESSION['shout']['curaccount']['code'];
+        if (empty($account)) {
+            $account = $GLOBALS['session']->get('shout', 'curaccount_code');
         }
 
         if (!empty($account) && !in_array($account, array_keys($accounts))) {
@@ -111,7 +111,8 @@ class Shout_Application extends Horde_Registry_Application
             }
         }
 
-        $_SESSION['shout']['curaccount'] = $accounts[$account];
+        $session->set('shout', 'curaccount_code', $accounts[$account]['code']);
+        $session->set('shout', 'curaccount_name', $accounts[$account]['name']);
     }
 
     /**
@@ -155,7 +156,7 @@ class Shout_Application extends Horde_Registry_Application
 
     public function getRecordings()
     {
-        $account = $_SESSION['shout']['curaccount']['code'];
+        $account = $GLOBALS['session']->get('shout', 'curaccount_code');
         $rlist = $this->vfs->listFolder($account);
 
         // In Asterisk, filenames the same basename and different extension are
index 0ddb09c..492b10f 100644 (file)
@@ -22,7 +22,7 @@ class AccountDetailsForm extends Horde_Form {
      */
     function __construct(&$vars)
     {
-        $account = $_SESSION['shout']['curaccount']['code'];
+        $account = $GLOBALS['session']->get('shout', 'curaccount_code');
         $action = $vars->get('action');
         if ($action == 'edit') {
             $formtitle = "Edit Account";
@@ -31,7 +31,7 @@ class AccountDetailsForm extends Horde_Form {
             $formtitle = "Add Account";
         }
 
-        $accountname = $_SESSION['shout']['curaccount']['name'];
+        $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
         $title = sprintf(_("$formtitle %s"), $accountname);
         parent::__construct($vars, $title);
 
@@ -71,7 +71,8 @@ class AccountDeleteForm extends Horde_Form
         $account = $vars->get('account');
 
         $title = _("Delete Extension %s - Account: %s");
-        $title = sprintf($title, $extension, $_SESSION['shout']['accounts'][$account]['name']);
+        $account_config = $GLOBALS['session']->get('shout', 'accounts/' . $account);
+        $title = sprintf($title, $extension, $account_config['name']);
         parent::__construct($vars, $title);
 
         $this->addHidden('', 'account', 'text', true);
index 739c098..49df62d 100644 (file)
@@ -13,7 +13,7 @@ class ConferenceDetailsForm extends Horde_Form {
 
     function __construct(&$vars)
     {
-        $accountname = $_SESSION['shout']['curaccount']['name'];
+        $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
         if ($vars->exists('roomno')) {
             $title = sprintf(_("Edit Conference Room - Account: %s"), $accountname);
             $roomno = $vars->get('roomno');
@@ -75,7 +75,8 @@ class ConferenceDeleteForm extends Horde_Form
         $account = $vars->get('account');
 
         $title = _("FIXME Delete Device %s - Account: %s");
-        $title = sprintf($title, $devid, $_SESSION['shout']['accounts'][$account]['name']);
+        $account_config = $GLOBALS['session']->get('shout', 'accounts/' . $account);
+        $title = sprintf($title, $devid, $account_config['name']);
         parent::__construct($vars, $title);
 
         $this->addHidden('', 'account', 'text', true);
@@ -91,4 +92,4 @@ class ConferenceDeleteForm extends Horde_Form
         $devid = $this->_vars->get('devid');
         $shout->devices->deleteDevice($account, $devid);
     }
-}
\ No newline at end of file
+}
index ed568ca..a851b28 100644 (file)
@@ -22,7 +22,7 @@ class DeviceDetailsForm extends Horde_Form {
             $edit = false;
         }
 
-        $accountname = $_SESSION['shout']['curaccount']['name'];
+        $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
         $title = sprintf(_("$formtitle - Account: %s"), $accountname);
         parent::__construct($vars, $title);
 
@@ -98,7 +98,8 @@ class DeviceDeleteForm extends Horde_Form
         $account = $vars->get('account');
 
         $title = _("Delete Device %s - Account: %s");
-        $title = sprintf($title, $devid, $_SESSION['shout']['accounts'][$account]['name']);
+        $account_config = $GLOBALS['session']->get('shout', 'accounts/' . $account);
+        $title = sprintf($title, $devid, $account_config['name']);
         parent::__construct($vars, $title);
 
         $this->addHidden('', 'account', 'text', true);
@@ -114,4 +115,4 @@ class DeviceDeleteForm extends Horde_Form
         $devid = $this->_vars->get('devid');
         $shout->devices->deleteDevice($account, $devid);
     }
-}
\ No newline at end of file
+}
index 0fa6814..617bb3c 100644 (file)
@@ -28,7 +28,7 @@ class ExtensionDetailsForm extends Horde_Form {
             $formtitle = "Add User";
         }
 
-        $accountname = $_SESSION['shout']['curaccount']['name'];
+        $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
         $title = sprintf(_("$formtitle - Account: %s"), $accountname);
         parent::__construct($vars, $title);
 
@@ -81,7 +81,7 @@ class ExtensionDeleteForm extends Horde_Form
         $account = $vars->get('account');
 
         $title = _("Delete Extension %s - Account: %s");
-        $title = sprintf($title, $extension, $_SESSION['shout']['curaccount']['name']);
+        $title = sprintf($title, $extension, $GLOBALS['session']->get('shout', 'curaccount_name'));
         parent::__construct($vars, $title);
 
         $this->addHidden('', 'account', 'text', true);
index d64c948..872e8be 100644 (file)
@@ -22,12 +22,12 @@ class MenuForm extends Horde_Form {
             $edit = false;
         }
 
-        $accountname = $_SESSION['shout']['curaccount']['name'];
+        $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
         $title = sprintf(_("%s - Account: %s"), $formtitle, $accountname);
         parent::__construct($vars, $title);
 
         $this->addHidden('', 'action', 'text', true);
-        
+
         if ($edit) {
             $this->addHidden('', 'oldname', 'text', true);
             $vars->set('oldname', $menu);
@@ -36,7 +36,7 @@ class MenuForm extends Horde_Form {
         $this->addVariable(_("Description"), 'description', 'text', false);
 
         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-        $recordings = $shout->storage->getRecordings($_SESSION['shout']['curaccount']['code']);
+        $recordings = $shout->storage->getRecordings($GLOBALS['session']->get('shout', 'curaccount_code'));
         $list = array();
         foreach ($recordings as $id => $info) {
             $list[$id] = $info['filename'];
@@ -51,7 +51,7 @@ class MenuForm extends Horde_Form {
     {
         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
 
-        $account = $_SESSION['shout']['curaccount']['code'];
+        $account = $GLOBALS['session']->get('shout', 'curaccount_code');
 
         $details = array(
             'name' => $this->_vars->get('name'),
@@ -76,7 +76,7 @@ class DeviceMenuForm extends Horde_Form
         $account = $vars->get('account');
 
         $title = _("Delete Menu %s - Account: %s");
-        $title = sprintf($title, $menu, $_SESSION['shout']['curaccount']['name']);
+        $title = sprintf($title, $menu, $GLOBALS['session']->get('shout', 'curaccount_name'));
         parent::__construct($vars, $title);
 
         $this->setButtons(array(_("Delete"), _("Cancel")));
@@ -89,4 +89,4 @@ class DeviceMenuForm extends Horde_Form
         $menu = $this->_vars->get('menu');
         $shout->devices->deleteMenu($account, $menu);
     }
-}
\ No newline at end of file
+}
index d1a25e8..c6ae7b3 100644 (file)
@@ -84,7 +84,8 @@ class NumberDeleteForm extends Horde_Form
         $account = $vars->get('account');
 
         $title = _("Delete Extension %s - Account: %s");
-        $title = sprintf($title, $extension, $_SESSION['shout']['accounts'][$account]['name']);
+        $account_config = $GLOBALS['session']->get('shout', 'accounts/' . $account);
+        $title = sprintf($title, $extension, $account_config['name']);
         parent::__construct($vars, $title);
 
         $this->addHidden('', 'account', 'text', true);
index 984ad83..25a9b09 100644 (file)
@@ -48,7 +48,8 @@ class ConferenceDeleteForm extends Horde_Form
         $account = $vars->get('account');
 
         $title = _("FIXME Delete Recording %s - Account: %s");
-        $title = sprintf($title, $devid, $_SESSION['shout']['curaccount']['name']);
+        $title = sprintf($title, $devid, $GLOBALS['session']->get('shout', 'curaccount_name'));
+
         parent::__construct($vars, $title);
 
         $this->addHidden('', 'account', 'text', true);
@@ -65,4 +66,4 @@ class ConferenceDeleteForm extends Horde_Form
         $devid = $this->_vars->get('devid');
         $shout->devices->deleteDevice($account, $devid);
     }
-}
\ No newline at end of file
+}
index c6131d5..5adf81c 100644 (file)
@@ -156,7 +156,7 @@ class Shout
     static public function getMenuActions()
     {
         $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
-        $account = $_SESSION['shout']['curaccount']['code'];
+        $account = $GLOBALS['session']->get('shout', 'curaccount_code');
 
         return array(
             'jump' => array(
index a2d6794..b53874d 100644 (file)
@@ -15,13 +15,13 @@ $shout = Horde_Registry::appInit('shout');
 require_once SHOUT_BASE . '/lib/Forms/RecordingForm.php';
 
 $action = Horde_Util::getFormData('action');
-$curaccount = $_SESSION['shout']['curaccount'];
-$recordings = $shout->storage->getRecordings($curaccount['code']);
+$curaccount = $GLOBALS['session']->get('shout', 'curaccount_code');
+$recordings = $shout->storage->getRecordings($curaccount);
 
 switch($action) {
 case 'add':
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new RecordingDetailsForm($vars);
 
     if ($Form->isSubmitted() && $Form->validate($vars, true)) {
@@ -30,7 +30,7 @@ case 'add':
             $Form->execute();
             $notification->push(_("Recording added."),
                                   'horde.success');
-            $recordings = $shout->storage->getRecordings($curaccount['code']);
+            $recordings = $shout->storage->getRecordings($curaccount);
             $action = 'list';
         } catch (Exception $e) {
             $notification->push($e);
index 82f3ed8..97cffa4 100644 (file)
@@ -1,5 +1,5 @@
 <div class="header">
-    Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+    Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
 </div>
 
 <div id="conferenceList">
index d36bf7a..376c6de 100644 (file)
@@ -1,5 +1,5 @@
 <div class="header">
-    Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+    Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
 </div>
 
 <div id="extensionList">
index 2fdbf6a..4bac6c6 100644 (file)
@@ -1,5 +1,5 @@
 <div class="header">
-    Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+    Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
 </div>
 
 <div id="extensionList">
index 233a038..8d383cb 100644 (file)
@@ -33,9 +33,11 @@ function accountSubmit(clear)
    <?php Horde_Util::pformInput() ?>
     <select id="account" name="account" onchange="accountSubmit()">
      <?php
+        $cur_code = $GLOBALS['session']->get('shout', 'curaccount_code');
+
         foreach ($accounts as $account => $info) {
             print "<option value=\"$account\"";
-            if ($account == $curaccount['code']) {
+            if ($account == $cur_code) {
                 print " selected";
             }
             print ">${info['name']}</option>\n";
index 10bc129..a3496d9 100644 (file)
@@ -1,5 +1,5 @@
 <div class="header">
-    Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+    Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
 </div>
 
 <div id="extensionList">
index f6ba965..6f680eb 100644 (file)
@@ -14,10 +14,10 @@ $shout = Horde_Registry::appInit('shout');
 require_once SHOUT_BASE . '/lib/Forms/ExtensionForm.php';
 
 try {
-    $curaccount = $_SESSION['shout']['curaccount'];
+    $curaccount = $GLOBALS['session']->get('shout', 'curaccount_code');
 
     // Only continue if there is an assigned phone number
-    $numbers = $shout->storage->getNumbers($curaccount['code']);
+    $numbers = $shout->storage->getNumbers($curaccount);
     if (empty($numbers)) {
         throw new Shout_Exception("No valid numbers on this account.");
     }
@@ -26,7 +26,7 @@ try {
     $number = $number['number'];
 
     // Only continue if there is no existing "Main Menu"
-    $menus = $shout->storage->getMenus($curaccount['code']);
+    $menus = $shout->storage->getMenus($curaccount);
 
     if (!empty($menus) && !empty($menus[Shout::MAIN_MENU])) {
         Horde::url('dialplan.php', true)->redirect();
@@ -34,11 +34,11 @@ try {
 
     // Create the default recording for the main menu
     try {
-        $recording = $shout->storage->getRecordingByName($curaccount['code'],
+        $recording = $shout->storage->getRecordingByName($curaccount,
                                                          Shout::MAIN_RECORDING);
     } catch (Shout_Exception $e) {
-        $shout->storage->addRecording($curaccount['code'], Shout::MAIN_RECORDING);
-        $recording = $shout->storage->getRecordingByName($curaccount['code'],
+        $shout->storage->addRecording($curaccount, Shout::MAIN_RECORDING);
+        $recording = $shout->storage->getRecordingByName($curaccount,
                                                          Shout::MAIN_RECORDING);
     }
 
@@ -48,17 +48,17 @@ try {
         'description' => _("Main menu: what your callers will hear."),
         'recording_id' => $recording['id']
     );
-    $shout->dialplan->saveMenuInfo($curaccount['code'], $details);
+    $shout->dialplan->saveMenuInfo($curaccount, $details);
 
     // Associate this menu with the first number.
     // FIXME: This could be disruptive.
-    $shout->storage->saveNumber($number, $curaccount['code'], Shout::MAIN_MENU);
+    $shout->storage->saveNumber($number, $curaccount, Shout::MAIN_MENU);
 
     // Populate the default option, granting the ability to log into the admin
     // section.
-    $shout->dialplan->saveMenuAction($curaccount['code'], Shout::MAIN_MENU,
+    $shout->dialplan->saveMenuAction($curaccount, Shout::MAIN_MENU,
                                      'star', 'admin_login', array());
-    $extensions = $shout->extensions->getExtensions($curaccount['code']);
+    $extensions = $shout->extensions->getExtensions($curaccount);
 } catch (Exception $e) {
     print_r($e);
     $notification->push($e);