$directory[$dindex]['select'] = True; } } # Reverse if ($action == 'reverse') { foreach ($directory as $key => $value) { if ($value['select']) { $directory[$key]['select'] = False; } else { $directory[$key]['select'] = True; } } } # Save the session $array = array('directory' => base64_encode(serialize($directory))); Aastra_save_session('vmail', '600', $array, $ext); # Display Page require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setStyle('none'); if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Msg Forward (%s/%s)', $language), $dpage, $last)); } else { $object->setTitle(Aastra_get_label('Message Forward', $language)); } $index = 1; $rank = 1; $submit = False; # Display items foreach ($directory as $key => $value) {
Aastra_originate_Asterisk('Local/' . Aastra_get_userdevice_Asterisk($user) . '@from-internal', 's', 'record-temp-vm', 1, '', Aastra_get_label('RecordTemporary', $language) . ' <0>', array('_USER='******'enable'); } if ($follow == 1) { Aastra_manage_followme_Asterisk($user, 'enable'); } if ($cfwd != '') { Aastra_manage_cf_Asterisk($user, 'set', $cfwd); } } else { # Save session $array = array('uri_onhook' => $XML_SERVER, 'user' => $user, 'type' => 'temp', 'action' => 'record'); Aastra_save_session('vmail', '600', $array, $user); # Dial special number $object->addEntry('Dial:vmail'); } break; # Display # Display case 'display_back': # Display user message if (Aastra_is_formattedtextscreen_supported()) { require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); if (Aastra_size_formattedtextscreen() > 2) { $object->addLine(''); } if (Aastra_is_formattedtextscreen_color_supported()) {
if ($lookup != '') { $object->setDefault($lookup); } break; # Lookup # Lookup case 'lookup': # Make the search $return = lookup_directory($database, $lookup, $firstn, $lastn, $company, $ARRAY_USER); # Search OK if ($return[0]) { # At least one result if (count($return[1]) > 0) { # Save results $array_directory = array('csv_directory' => base64_encode(serialize($return))); Aastra_save_session('csv_directory', '600', $array_directory); # Call back with browse require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); $object->addEntry($XML_SERVER . '&action=browse&page=1&lookup=' . $lookup . '&lastn=' . $lastn . '&firstn=' . $firstn . '&company=' . $company); } else { # Display error require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Directory Lookup', $language)); $object->setText(Aastra_get_label('Sorry no match found.', $language)); if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('4', Aastra_get_label('Back', $language), $XML_SERVER . '&action=input&lookup=' . $lookup . '&lastn=' . $lastn . '&firstn=' . $firstn . '&company=' . $company); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
function update_user_config($user, $array_key, $header, $selection1, $selection2 = NULL, $type = 'key') { # No special key yet $special = False; # Retrieve current configuration $array_temp = Aastra_readINIfile(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', '#', ':'); $array_user = $array_temp['']; # Prepare process of both keys if ($selection2) { $array_selection = array($selection1, $selection2); } else { $array_selection = array($selection1); } # Process both changes foreach ($array_selection as $selection) { # Key update if ($type == 'key') { # Update selection if ($array_key[$selection]['type'] != '' and $array_key[$selection]['type'] != 'empty') { # XML? if ($array_key[$selection]['type'] == 'xml') { $special = True; } # Update configuration (MAC.cfg) $array_user[$selection . ' type'] = $array_key[$selection]['type']; $array_user[$selection . ' value'] = $array_key[$selection]['value']; $array_user[$selection . ' label'] = $array_key[$selection]['label']; if ($array_key[$selection]['states'] != '') { $array_user[$selection . ' states'] = $array_key[$selection]['states']; } else { unset($array_user[$selection . ' states']); } if ($array_key[$selection]['locked'] != '') { $array_user[$selection . ' locked'] = $array_key[$selection]['locked']; } else { unset($array_user[$selection . ' locked']); } # Update configuration (dynamic) $array_update[] = array('param' => $selection . ' type', 'value' => $array_user[$selection . ' type']); $array_update[] = array('param' => $selection . ' value', 'value' => $array_user[$selection . ' value']); $array_update[] = array('param' => $selection . ' label', 'value' => $array_user[$selection . ' label']); if ($array_key[$selection]['states'] != '') { $array_update[] = array('param' => $selection . ' states', 'value' => $array_user[$selection . ' states']); } if ($array_key[$selection]['locked'] != '') { $array_update[] = array('param' => $selection . ' locked', 'value' => $array_user[$selection . ' locked']); } } else { # Maybe we changed a special key if ($array_user[$selection . ' type'] == 'xml') { $special = True; } # Key is not programmed but maybe locked if ($array_key[$selection]['type'] == '') { unset($array_user[$selection . ' type']); } else { $array_user[$selection . ' type'] = 'empty'; } if ($array_key[$selection]['locked'] == '1') { $array_user[$selection . ' locked'] = $array_key[$selection]['locked']; } else { unset($array_user[$selection . ' locked']); } unset($array_user[$selection . ' value']); unset($array_user[$selection . ' label']); unset($array_user[$selection . ' states']); # Update array $array_update[] = array('param' => $selection . ' type', 'value' => $array_user[$selection . ' type']); $array_update[] = array('param' => $selection . ' value', 'value' => ''); $array_update[] = array('param' => $selection . ' label', 'value' => ''); $array_update[] = array('param' => $selection . ' locked', 'value' => $array_user[$selection . ' locked']); $array_update[] = array('param' => $selection . ' states', 'value' => ''); } } else { # Update parameter $array_user[$selection] = $array_key[$selection]['value']; $array_update[] = array('param' => $selection, 'value' => $array_key[$selection]['value']); } } # Update MAC.cfg $write = @fopen(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', 'w'); if ($write) { # Dump the config file foreach ($array_user as $key => $value) { fputs($write, $key . ': ' . $value . "\n"); } # Close the MAC.cfg file fclose($write); # Update the user keys $keys = Aastra_get_user_context($user, 'keys'); foreach ($array_user as $key => $value) { if (stristr($key, 'key')) { $array_keys[$key] = $value; } if (stristr($key, 'expmod') and stristr($key, 'page')) { $array_keys[$key] = $value; } } $keys[$header['model']] = $array_keys; Aastra_save_user_context($user, 'keys', $keys); } # Update special keys if ($special) { $array_special = update_special_keys($user, $array_user); } # Save Configuration update if (!$special) { $array_selection = NULL; $array_special_keys = NULL; } $array_session = array('keys' => base64_encode(serialize(array($array_selection, $array_update, $array_special)))); Aastra_save_session('key', '120', $array_session); # Return the need for notify return $special; }