require_once SHOUT_BASE . '/lib/Forms/AccountForm.php';
-
-$curaccount = $_SESSION['shout']['curaccount'];
-
$RENDERER = new Horde_Form_Renderer();
$title = _("Accounts: ");
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();
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)) {
$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);
}
$vars = Horde_Variables::getDefaultVariables(array());
- $vars->set('account', $curaccount['code']);
+ $vars->set('account', $curaccount);
$Form = new ExtensionDeleteForm($vars);
break;
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();
$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);
}
$vars = Horde_Variables::getDefaultVariables(array());
- $vars->set('account', $curaccount['code']);
+ $vars->set('account', $curaccount);
$Form = new ExtensionDeleteForm($vars);
break;
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();
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.
// 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);
$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);
}
$vars = Horde_Variables::getDefaultVariables(array());
- $vars->set('account', $curaccount['code']);
+ $vars->set('account', $curaccount);
$Form = new DeviceDeleteForm($vars);
break;
// 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();
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();
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.
// 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);
$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);
}
$vars = Horde_Variables::getDefaultVariables(array());
- $vars->set('account', $curaccount['code']);
+ $vars->set('account', $curaccount);
$Form = new DeviceDeleteForm($vars);
break;
// 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();
$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();
}
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)) {
$Form->execute();
$notification->push(_("Menu added."),
'horde.success');
- $menus = $shout->storage->getMenus($curaccount['code']);
+ $menus = $shout->storage->getMenus($curaccount);
$action = 'edit';
} catch (Exception $e) {
// 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.
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();
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();
{
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()) {
{
$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);
{
$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');
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.
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;
{
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;
{
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.');
{
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.
{
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'),
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');
}
$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))) {
}
}
- $_SESSION['shout']['curaccount'] = $accounts[$account];
+ $session->set('shout', 'curaccount_code', $accounts[$account]['code']);
+ $session->set('shout', 'curaccount_name', $accounts[$account]['name']);
}
/**
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
*/
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";
$formtitle = "Add Account";
}
- $accountname = $_SESSION['shout']['curaccount']['name'];
+ $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
$title = sprintf(_("$formtitle %s"), $accountname);
parent::__construct($vars, $title);
$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);
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');
$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);
$devid = $this->_vars->get('devid');
$shout->devices->deleteDevice($account, $devid);
}
-}
\ No newline at end of file
+}
$edit = false;
}
- $accountname = $_SESSION['shout']['curaccount']['name'];
+ $accountname = $GLOBALS['session']->get('shout', 'curaccount_name');
$title = sprintf(_("$formtitle - Account: %s"), $accountname);
parent::__construct($vars, $title);
$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);
$devid = $this->_vars->get('devid');
$shout->devices->deleteDevice($account, $devid);
}
-}
\ No newline at end of file
+}
$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);
$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);
$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);
$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'];
{
$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'),
$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")));
$menu = $this->_vars->get('menu');
$shout->devices->deleteMenu($account, $menu);
}
-}
\ No newline at end of file
+}
$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);
$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);
$devid = $this->_vars->get('devid');
$shout->devices->deleteDevice($account, $devid);
}
-}
\ No newline at end of file
+}
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(
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)) {
$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);
<div class="header">
- Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+ Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
</div>
<div id="conferenceList">
<div class="header">
- Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+ Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
</div>
<div id="extensionList">
<div class="header">
- Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+ Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
</div>
<div id="extensionList">
<?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";
<div class="header">
- Account: <?php echo $_SESSION['shout']['curaccount']['name']; ?>
+ Account: <?php echo $GLOBALS['session']->get('shout', 'curaccount_name'); ?>
</div>
<div id="extensionList">
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.");
}
$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();
// 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);
}
'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);