From: Ben Klang Date: Mon, 31 Oct 2005 12:34:40 +0000 (+0000) Subject: Split user management routines to external module "congregation" X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8254629432214e9cfe0646c22049613107815166;p=horde.git Split user management routines to external module "congregation" git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@76 06cd67b6-e706-0410-b29e-9de616bca6e9 --- diff --git a/andrew.webprj b/andrew.webprj index b55c2db93..a3a5d8f15 100644 --- a/andrew.webprj +++ b/andrew.webprj @@ -6,20 +6,20 @@ - + - - + + - - + + - + - + @@ -44,34 +44,36 @@ - - + + - + - + - - + + - + - - + + - - + + + + - + @@ -97,26 +99,31 @@ - - + + templates/ toolbars/ + Ben Klang ben@alkaloid.net No Debugger - *~; + *~;CVS;.*~; + + + + diff --git a/dialplan/edit.php b/dialplan/edit.php index c0a4dd26a..21e42a108 100644 --- a/dialplan/edit.php +++ b/dialplan/edit.php @@ -14,7 +14,6 @@ require_once 'Horde/Variables.php'; $RENDERER = &new Horde_Form_Renderer(); $empty = ''; -$wereerrors = 0; $vars = &Variables::getDefaultVariables($empty); $formname = $vars->get('formname'); diff --git a/lib/Driver.php b/lib/Driver.php index 0f422b3c6..e9674c7d6 100644 --- a/lib/Driver.php +++ b/lib/Driver.php @@ -14,6 +14,7 @@ * @since Shout 0.1 * @package Shout */ +require_once SHOUT_BASE . "/lib/defines.php"; // {{{ Shout_Driver class class Shout_Driver { @@ -25,6 +26,7 @@ class Shout_Driver { * @var array $_params */ var $_params = array(); + // }}} // {{{ Shout_Driver constructor diff --git a/lib/Driver/ldap.php b/lib/Driver/ldap.php index 9f5830df4..4d556a860 100644 --- a/lib/Driver/ldap.php +++ b/lib/Driver/ldap.php @@ -22,6 +22,7 @@ class Shout_Driver_ldap extends Shout_Driver * @var boolean $_connected */ var $_connected = false; + // }}} // {{{ Shout_Driver_ldap constructor @@ -34,42 +35,6 @@ class Shout_Driver_ldap extends Shout_Driver { parent::Shout_Driver($params); $this->_connect(); - - /* These next lines will translate between indexes used in the - * application and LDAP. The rationale is that translation here will - * help make Shout more driver-independant. The keys used to contruct - * user arrays should be more appropriate to human-legibility (name - * instead of 'cn' and email instead of 'mail'). This translation is - * only needed because LDAP indexes users based on an arbitrary - * attribute and the application indexes by extension/context. In my - * environment users are indexed by their 'mail' attribute and others - * may index based on 'cn' or 'uid'. Any time a new $prefs['uid'] needs - * to be supported, this function should be checked and possibly - * modified to handle that translation. - */ - switch($this->_params['uid']) { - case 'cn': - $this->_ldapKey = 'cn'; - $this->_appKey = 'name'; - break; - case 'mail': - $this->_ldapKey = 'mail'; - $this->_appKey = 'email'; - break; - case 'uid': - # There is no value that maps uid to LDAP so we can choose to use - # either extension or name, or anything really. I want to - # support it since it's a very common DN attribute. - # Since it's entirely administrator's preference, I'll - # set it to name for now - $this->_ldapKey = 'uid'; - $this->_appKey = 'name'; - break; - case 'voiceMailbox': - $this->_ldapKey = 'voiceMailbox'; - $this->_appKey = 'extension'; - break; - } } // }}} @@ -104,6 +69,7 @@ class Shout_Driver_ldap extends Shout_Driver $searchfilter="(objectClass=asteriskObject)"; } else { $searchfilter = "(|"; + # FIXME Change this to non-V-Office specific objectClass if ($searchfilters & SHOUT_CONTEXT_CUSTOMERS) { $searchfilter.="(objectClass=vofficeCustomer)"; } else { @@ -130,16 +96,15 @@ class Shout_Driver_ldap extends Shout_Driver $searchfilter .= ")"; } - # Collect all the possible contexts from the backend $res = @ldap_search($this->_LDAP, SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'], - "(&(objectClass=asteriskObject)$searchfilter)", - array('context')); + "$searchfilter"); + #array('context', 'associatedDomain')); if (!$res) { return PEAR::raiseError("Unable to locate any contexts " . "underneath ".SHOUT_ASTERISK_BRANCH.",".$this->_params['basedn'] . - " matching those search filters"); + " matching those search filters" . ldap_error($this->_LDAP)); } $res = ldap_get_entries($this->_LDAP, $res); @@ -147,8 +112,10 @@ class Shout_Driver_ldap extends Shout_Driver $entries[$searchfilters] = array(); while ($i < $res['count']) { $context = $res[$i]['context'][0]; + @$domain = $res[$i]['associateddomain'][0]; if (Shout::checkRights("shout:contexts:$context", $filterperms)) { - $entries[$searchfilters][] = $context; + $entries[$searchfilters][$context] = + array('domain' => $domain); } $i++; } @@ -222,74 +189,90 @@ type"); */ function &getUsers($context) { - + static $entries = array(); if (isset($entries[$context])) { return $entries[$context]; } - - $search = @ldap_search($this->_LDAP, - SHOUT_USERS_BRANCH.','.$this->_params['basedn'], - '(&(objectClass='.SHOUT_USER_OBJECTCLASS.')(context='.$context.'))', - array('voiceMailbox', 'asteriskUserDialOptions', - 'asteriskVoiceMailboxOptions', 'voiceMailboxPin', - 'cn', 'telephoneNumber', - 'asteriskUserDialTimeout', 'mail', 'asteriskPager')); - if (!$search) { - return PEAR::raiseError("Unable to search directory: " . - ldap_error($this->_LDAP)); - } - $res = ldap_get_entries($this->_LDAP, $search); - $entries[$context] = array(); - $i = 0; - while ($i < $res['count']) { - $extension = $res[$i]['voicemailbox'][0]; - $entries[$context][$extension] = array(); - - $j = 0; - $entries[$context][$extension]['dialopts'] = array(); - while ($j < @$res[$i]['asteriskuserdialoptions']['count']) { - $entries[$context][$extension]['dialopts'][] = - $res[$i]['asteriskuserdialoptions'][$j]; - $j++; - } - - $j = 0; - $entries[$context][$extension]['mailboxopts'] = array(); - while ($j < @$res[$i]['asteriskvoicemailboxoptions']['count']) { - $entries[$context][$extension]['mailboxopts'][] = - $res[$i]['asteriskvoicemailboxoptions'][$j]; - $j++; - } - - $entries[$context][$extension]['mailboxpin'] = - $res[$i]['voicemailboxpin'][0]; - - @$entries[$context][$extension]['name'] = - $res[$i]['cn'][0]; - - $j = 0; - $entries[$context][$extension]['phonenumbers'] = array(); - while ($j < @$res[$i]['telephonenumber']['count']) { - $entries[$context][$extension]['phonenumbers'][] = - $res[$i]['telephonenumber'][$j]; - $j++; - } - - # FIXME Do some sanity checking here. Also set a default? - @$entries[$context][$extension]['dialtimeout'] = - $res[$i]['asteriskuserdialtimeout'][0]; - @$entries[$context][$extension]['email'] = - $res[$i]['mail'][0]; - - @$entries[$context][$extension]['pageremail'] = - $res[$i]['asteriskpager'][0]; - - $i++; - } - - return $entries[$context]; + $contexts = &$this->getContexts(); + $domain = $contexts[$context]['domain']; + + $registry = &Registry::singleton(); + require_once $registry->applicationFilePath('%application%/lib/defines.php', 'congregation'); + $users = $registry->callByPackage('congregation', 'getUsersByDomain', + array($domain, CONGREGATION_USER_PHONE)); + + foreach ($users as $user) { + $extension = $user['extension']; + $entries[$context][$extension] = $user; + } + ksort($entries[$context]); + + return($entries[$context]); + +// $search = @ldap_search($this->_LDAP, +// SHOUT_USERS_BRANCH.','.$this->_params['basedn'], +//'(&(objectClass='.SHOUT_USER_OBJECTCLASS.')(context='.$context.'))', +// array('voiceMailbox', 'asteriskUserDialOptions', +// 'asteriskVoiceMailboxOptions', 'voiceMailboxPin', +// 'cn', 'telephoneNumber', +// 'asteriskUserDialTimeout', 'mail', 'asteriskPager')); +// if (!$search) { +// return PEAR::raiseError("Unable to search directory: " . +// ldap_error($this->_LDAP)); +// } +// $res = ldap_get_entries($this->_LDAP, $search); +// $entries[$context] = array(); +// $i = 0; +// while ($i < $res['count']) { +// $extension = $res[$i]['voicemailbox'][0]; +// $entries[$context][$extension] = array(); +// +// $j = 0; +// $entries[$context][$extension]['dialopts'] = array(); +// while ($j < @$res[$i]['asteriskuserdialoptions']['count']) { +// $entries[$context][$extension]['dialopts'][] = +// $res[$i]['asteriskuserdialoptions'][$j]; +// $j++; +// } +// +// $j = 0; +// $entries[$context][$extension]['mailboxopts'] = array(); +// while ($j < @$res[$i]['asteriskvoicemailboxoptions']['count']) { +// $entries[$context][$extension]['mailboxopts'][] = +// $res[$i]['asteriskvoicemailboxoptions'][$j]; +// $j++; +// } +// +// $entries[$context][$extension]['mailboxpin'] = +// $res[$i]['voicemailboxpin'][0]; +// +// @$entries[$context][$extension]['name'] = +// $res[$i]['cn'][0]; +// +// $j = 0; +// $entries[$context][$extension]['phonenumbers'] = array(); +// while ($j < @$res[$i]['telephonenumber']['count']) { +// $entries[$context][$extension]['phonenumbers'][] = +// $res[$i]['telephonenumber'][$j]; +// $j++; +// } +// +// # FIXME Do some sanity checking here. Also set a default? +// @$entries[$context][$extension]['dialtimeout'] = +// $res[$i]['asteriskuserdialtimeout'][0]; +// +// @$entries[$context][$extension]['email'] = +// $res[$i]['mail'][0]; +// +// @$entries[$context][$extension]['pageremail'] = +// $res[$i]['asteriskpager'][0]; +// +// $i++; +// } +// +// return $entries[$context]; } // }}} @@ -301,6 +284,9 @@ type"); */ function getHomeContext() { + # FIXME Probably should key this off the domain part of the user's + # FIXME Auth::getAuth() and match context with associatedDomain + # FIXME Also, cache this lookup $res = @ldap_search($this->_LDAP, SHOUT_USERS_BRANCH.','.$this->_params['basedn'], "(&(mail=".Auth::getAuth().")(objectClass=asteriskUser))", @@ -386,7 +372,7 @@ for $context")); if (isset($dialplans[$context])) { return $dialplans[$context]; } - + $res = @ldap_search($this->_LDAP, SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'], "(&(objectClass=asteriskExtensions)(context=$context))", @@ -481,12 +467,12 @@ for $context")); return $dialplans[$context]; } // }}} - + // {{{ /** * Get the limits for the current user, the user's context, and global * Return the most specific values in every case. Return default values - * where no data is found. If $extension is specified, $context must + * where no data is found. If $extension is specified, $context must * also be specified. * * @param optional string $context Context to search @@ -495,9 +481,10 @@ for $context")); * * @return array Array with elements indicating various limits */ + # FIXME Figure out how this fits into Shout/Congregation better function &getLimits($context = null, $extension = null) { - + $limits = array('telephonenumbersmax', 'voicemailboxesmax', 'asteriskusers'); @@ -514,7 +501,7 @@ for $context")); } return $limits[$context]; } - + # Set some default limits (to unlimited) static $cachedlimits = array(); # Initialize the limits with defaults @@ -523,18 +510,18 @@ for $context")); $cachedlimits[$limit] = 99999; } } - + # Collect the global limits $res = @ldap_search($this->_LDAP, SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'], '(&(objectClass=asteriskLimits)(cn=globals))', $limits); - + if (!$res) { return PEAR::raiseError('Unable to search the LDAP server for ' . 'global limits'); } - + $res = ldap_get_entries($this->_LDAP, $res); # There should only have been one object returned so we'll just take the # first result returned @@ -544,7 +531,7 @@ for $context")); $cachedlimits[$limit] = $res[0][$limit][0]; } } - } else { + } else { return PEAR::raiseError("No global object found."); } @@ -553,12 +540,12 @@ for $context")); $res = ldap_search($this->_LDAP, SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'], "(&(objectClass=asteriskLimits)(cn=$context))"); - + if (!$res) { return PEAR::raiseError('Unable to search the LDAP server ' . "for $context specific limits"); } - + $cachedlimits[$context][$extension] = array(); if ($res['count'] > 0) { foreach ($limits as $limit) { @@ -576,18 +563,18 @@ for $context")); $cachedlimits[$limit]; } } - + if (isset($extension)) { $res = @ldap_search($this->_LDAP, SHOUT_USERS_BRANCH.','.$this->_params['basedn'], "(&(objectClass=asteriskLimits)(voiceMailbox=$extension)". "(context=$context))"); - + if (!$res) { return PEAR::raiseError('Unable to search the LDAP server '. "for Extension $extension, $context specific limits"); } - + $cachedlimits[$context][$extension] = array(); if ($res['count'] > 0) { foreach ($limits as $limit) { @@ -612,7 +599,7 @@ for $context")); } } // }}} - + // {{{ /** * Save a user to the LDAP tree @@ -627,17 +614,6 @@ for $context")); */ function saveUser($context, $extension, $userdetails) { - # FIXME: Add test to make sure we aren't duplicating the extension - $res = ldap_search($this->_LDAP, SHOUT_USERS_BRANCH.','.$this->_params['basedn'], - "(&(objectClass=asteriskUser)(voiceMailbox=". - $userdetails['newextension']."))"); - $res = ldap_get_entries($this->_LDAP, $res); - if ($res['count'] > 0) { - # The extension already exists. Do some sanity checking to make - # sure we know we're modifying an existing user - # FIXME - } - # FIXME Access Control/Authorization if (!Shout::checkRights("shout:contexts:$context:users", PERMS_DELETE, 1)) { @@ -646,7 +622,38 @@ for $context")); } $ldapKey = &$this->_ldapKey; $appKey = &$this->_appKey; - + + $contexts = &$this->getContexts(); + $domain = $contexts[$context]['domain']; + + # Check to ensure the extension is unique within this context + $filter = '(&(objectClass=asteriskVoiceMailbox)(context='.$context.'))'; + $reqattrs = array('dn', $ldapKey); + $res = @ldap_search($this->_LDAP, + SHOUT_USERS_BRANCH . ',' . $this->_params['basedn'], + $filter, $reqattrs); + if (!$res) { + return PEAR::raiseError('Unable to check directory for duplicate extension: ' . + ldap_error($this->_LDAP)); + } + if (($res['count'] > 1) || + ($res['count'] != 0 && + !in_array($res[0][$ldapKey], $userdetails[$appKey])_) { + return PEAR::raiseError('Duplicate extension found. Not saving changes.'); + } + + $validusers = &$this->getUsers($context); + $userId = $validusers[$extension][$appKey]; + + $registry = &Registry::singleton(); + require_once $registry->applicationFilePath('%application%/lib/defines.php', 'congregation'); + $userModes = $registry->callByPackage('congregation', 'getUserModes', + array($domain, $userId)); + # FIXME Handle error here + + $registry->callByPackage('congregation', 'saveUser', + array($domain, $userId, $userModes | CONGREGATION_USER_PHONE, )); + $entry = array( 'cn' => $userdetails['name'], 'mail' => $userdetails['email'], @@ -655,18 +662,18 @@ for $context")); 'context' => $context, 'asteriskUserDialOptions' => $userdetails['dialopts'], ); - + if (!empty ($userdetails['telephonenumbers'])) { $entry['telephoneNumber'] = $userdetails['telephonenumbers']; } - + $validusers = &$this->getUsers($context); if (!isset($validusers[$extension])) { # Test to see if we're modifying an existing user that has # no telephone system objectClasses and update that object/user $rdn = "$ldapKey=".$userdetails[$appKey].','; $branch = SHOUT_USERS_BRANCH.','.$this->_params['basedn']; - + # This test is something of a hack. I want a cheap way to check # for the existance of an object. I don't want to do a full search # so instead I compare that the dn equals the dn. If the object @@ -683,7 +690,7 @@ for $context")); # The object/user exists but doesn't have the Asterisk # objectClasses $extension = $userdetails['newextension']; - + # $tmp is the minimal information required to establish # an account in LDAP as required by the objectClasses. # The entry will be fully populated below. @@ -699,7 +706,7 @@ for $context")); return PEAR::raiseError("Unable to modify the user: " . ldap_error($this->_LDAP)); } - + # Populate the $validusers array to make the edit go smoothly # below $validusers[$extension] = array(); @@ -707,7 +714,7 @@ for $context")); # The remainder of the work is done at the outside of the # parent if() like a normal edit. - + } elseif ($res === -1) { # We must be adding a new user. $entry['objectClass'] = array( @@ -719,7 +726,7 @@ for $context")); 'asteriskUser', 'asteriskVoiceMailbox' ); - + # Check to see if the maximum number of users for this context # has been reached $limits = $this->getLimits($context); @@ -730,19 +737,19 @@ for $context")); print count($validusers).$limits['asteriskusers']; return PEAR::raiseError('Maximum number of users reached.'); } - + $res = @ldap_add($this->_LDAP, $rdn.$branch, $entry); if (!$res) { return PEAR::raiseError('LDAP Add failed: ' . ldap_error($this->_LDAP)); } - + return true; } } - + # Anything after this point is an edit. - + # Check to see if the object needs to be renamed (DN changed) if ($validusers[$extension][$appKey] != $entry[$ldapKey]) { $oldrdn = $ldapKey.'='.$validusers[$extension][$appKey]; @@ -755,7 +762,7 @@ for $context")); ldap_error($this->_LDAP)); } } - + # Update the object/user $dn = $ldapKey.'='.$entry[$ldapKey]; $dn .= ','.SHOUT_USERS_BRANCH.','.$this->_params['basedn']; @@ -764,16 +771,16 @@ for $context")); return PEAR::raiseError('LDAP Modify failed: ' . ldap_error($this->_LDAP)); } - + # We must have been successful return true; } // }}} - + // {{{ deleteUser method /** * Deletes a user from the LDAP tree - * + * * @param string $context Context to delete the user from * @param string $extension Extension of the user to be deleted * @@ -783,21 +790,21 @@ for $context")); { $ldapKey = &$this->_ldapKey; $appKey = &$this->_appKey; - + if (!Shout::checkRights("shout:contexts:$context:users", PERMS_DELETE, 1)) { return PEAR::raiseError("No permission to delete users in this " . "context."); } - + $validusers = $this->getUsers($context); if (!isset($validusers[$extension])) { return PEAR::raiseError("That extension does not exist."); } - + $dn = "$ldapKey=".$validusers[$extension][$appKey]; $dn .= ',' . SHOUT_USERS_BRANCH . ',' . $this->_params['basedn']; - + $res = @ldap_delete($this->_LDAP, $dn); if (!$res) { return PEAR::raiseError("Unable to delete $extension from " . @@ -806,7 +813,7 @@ for $context")); return true; } // }}} - + // {{{ connect method /** * Attempts to open a connection to the LDAP server. diff --git a/lib/Shout.php b/lib/Shout.php index b8cbd6688..26cfdd056 100644 --- a/lib/Shout.php +++ b/lib/Shout.php @@ -1,14 +1,20 @@ + * + * See the enclosed file COPYING for license information (GPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. + * + * @author Ben Klang + * @version $Revision$ + * @since Shout 0.1 + * @package Shout + */ +require_once SHOUT_BASE . "/lib/defines.php"; // {{{ Class Shout class Shout @@ -35,7 +41,7 @@ class Shout $url = Util::addParameter($url, array('context' => $context, 'section' => $section, 'action' => 'add')); - + # Goofy hack to make the icon make a little more sense # when editing/deleting users if (!isset($action)) { @@ -56,7 +62,7 @@ class Shout $url = Util::addParameter($url, array('context' => $context, 'section' => $section, 'action' => 'add')); - + # Goofy hack to make the icon make a little sense # when editing/deleting users if (!isset($action)) { @@ -69,7 +75,7 @@ class Shout $menu->add($url, _("$icontitle Extension"), "add-extension.gif"); } - + if ($returnType == 'object') { return $menu; } else { diff --git a/lib/User.php b/lib/User.php index 04143f13e..e35dac60a 100644 --- a/lib/User.php +++ b/lib/User.php @@ -18,7 +18,7 @@ class UserDetailsForm extends Horde_Form { global $shout; $context = $vars->get("context"); $extension = $vars->get("extension"); - + $users = &$shout->getUsers($context); if (array_key_exists($extension, $users)) { # We must be editing an existing user @@ -31,7 +31,7 @@ class UserDetailsForm extends Horde_Form { } parent::Horde_Form($vars, _("$formtitle - Context: $context")); - + $this->addHidden('', 'context', 'text', true); $this->addHidden('', 'curextension', 'text', true); $vars->set('curextension', $extension); @@ -40,10 +40,11 @@ class UserDetailsForm extends Horde_Form { $this->addVariable(_("Full Name"), 'name', 'text', true); $this->addVariable(_("Extension"), 'newextension', 'int', true); $this->addVariable(_("E-Mail Address"), 'email', 'text', true); + $this->addVariable(_("Pager E-Mail Address"), 'pageremail', 'text', false); # TODO: Integrate with To-Be-Written user manager and possibly make this # TODO: new user also an email account. $this->addVariable(_("PIN"), 'pin', 'int', true); - + $t = 1; while ($t <= $limits['telephonenumbersmax']) { $this->addVariable(_("Telephone Number $t:"), "telephone$t", @@ -51,15 +52,23 @@ class UserDetailsForm extends Horde_Form { false); $t++; } - + $this->addVariable(_("Music on Hold while transferring"), 'moh', - 'radio', true, false, null, - array('values' => array(true => 'Yes', false => 'No'))); + 'boolean', true, false);#, _("When checked, a calling user will hear music on hold while the caller is connected")); $this->addVariable(_("Allow Call Transfers"), 'transfer', - 'radio', true, false, null, - array('values' => array(true => 'Yes', false => 'No'))); + 'boolean', true, false);#, _("When checked, the called user will be allowed to transfer the incoming call to other extensions")); + $this->addVariable(_("Explicit Call Acceptance"), 'eca', + 'boolean', true, false);#, _("When checked, the called user will be required to press 1 to accept the call. Only turn this off if you really know what you're doing!")); + $this->addVariable(_("Call Appearance"), 'callappearance', + 'radio', true, false, null, array('values' => + array('caller' => 'From Calling Party', + 'self' => 'From Self', + 'v-office' => 'From V-Office', + ) + ) + ); } - + // {{{ fillUserForm method /** * Fill in the blanks for the UserDetailsForm @@ -74,30 +83,47 @@ class UserDetailsForm extends Horde_Form { { #Array ( [dialopts] => Array ( [0] => m [1] => t ) [mailboxopts] => Array ( #) [mailboxpin] => 1234 [name] => Ricardo Paul [phonenumbers] => Array ( ) - #[dialtimeout] => 30 [email] => ricardo.paul@v-office.biz [pageremail] => ) + #[dialtimeout] => 30 [email] => ricardo.paul@v-office.biz [pageremail] => ) $vars->set('name', $userdetails['name']); $vars->set('email', @$userdetails['email']); $vars->set('pin', $userdetails['mailboxpin']); $vars->set('newextension', $vars->get('extension')); - + $i = 1; foreach($userdetails['phonenumbers'] as $number) { $vars->set("telephone$i", $number); $i++; } - + if (in_array('m', $userdetails['dialopts'])) { $vars->set('moh', true); } else { $vars->set('moh', false); } - + if (in_array('t', $userdetails['dialopts'])) { $vars->set('transfer', true); } else { $vars->set('transfer', false); } - + + if (in_array('e', $userdetails['dialopts'])) { + $vars->set('eca', true); + } else { + $vars->set('eca', false); + } + + if (in_array('__CALLPRESENT:${VOFFICENUM}', $userdetails['dialopts'])) { + $vars->set('eca', true); + $vars->set('callappearance', 'v-office'); + } elseif (in_array('__CALLPRESENT:${CALLER}', $userdetails['dialopts'])) { + $vars->set('eca', true); + $vars->set('callappearance', 'caller'); + } elseif (in_array('__CALLPRESENT:${SELF}', $userdetails['dialopts'])) { + $vars->set('eca', true); + $vars->set('callappearance', 'self'); + } + return true; } // }}} diff --git a/lib/base.php b/lib/base.php index e4deede4a..31e01df49 100644 --- a/lib/base.php +++ b/lib/base.php @@ -51,6 +51,7 @@ require_once 'Horde/Text/Filter.php'; require_once 'Horde/UI/Tabs.php'; $GLOBALS['shout'] = &Shout_Driver::singleton(); +// $shout = $GLOBALS['shout']; // Horde libraries. require_once 'Horde/Help.php'; \ No newline at end of file diff --git a/main/system.php b/main/system.php index 6d5eff42d..c529220cc 100644 --- a/main/system.php +++ b/main/system.php @@ -15,7 +15,6 @@ $RENDERER = &new Horde_Form_Renderer(); $empty = ''; $beendone = 0; -$wereerrors = 0; $vars = &Variables::getDefaultVariables($empty); $syscontext = Util::getFormData("syscontext"); diff --git a/users/edit.php b/users/edit.php index 5ecc311bb..86460603a 100644 --- a/users/edit.php +++ b/users/edit.php @@ -14,7 +14,6 @@ require_once 'Horde/Variables.php'; $RENDERER = &new Horde_Form_Renderer(); $empty = ''; -$wereerrors = 0; $vars = &Variables::getDefaultVariables($empty); $formname = $vars->get('formname'); diff --git a/users/save.php b/users/save.php index 24d80153b..230f571e0 100644 --- a/users/save.php +++ b/users/save.php @@ -13,8 +13,6 @@ require_once 'Horde/Variables.php'; $RENDERER = &new Horde_Form_Renderer(); -$wereerrors = 0; - $vars = &Variables::getDefaultVariables(); $formname = $vars->get('formname'); @@ -57,7 +55,7 @@ if (Util::getFormData('transfer')) { $userdetails['dialopts'][] = 't'; } -$res = $shout->saveUser($context, $curextension, $userdetails); -if (is_a($res, 'PEAR_Error')) { - print $res->getMessage(); -} \ No newline at end of file +// $res = $shout->saveUser($context, $curextension, $userdetails); +// if (is_a($res, 'PEAR_Error')) { +// print $res->getMessage(); +// } \ No newline at end of file