本文整理汇总了PHP中Aastra_get_user_context函数的典型用法代码示例。如果您正苦于以下问题:PHP Aastra_get_user_context函数的具体用法?PHP Aastra_get_user_context怎么用?PHP Aastra_get_user_context使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Aastra_get_user_context函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_user_config
function get_user_config($user, $menu_source, $menu_mode)
{
global $language;
# Retrieve phone data
$update = 0;
$header = Aastra_decode_HTTP_header();
$header['model'] = strtolower($header['model']);
$is_softkeys_supported = Aastra_is_softkeys_supported();
# Read all menu
$all = Aastra_readINIfile($menu_source . '.menu', '#', '=');
# Get user config
if ($is_softkeys_supported and $menu_mode == 'dynamic') {
$config = Aastra_get_user_context($user, 'mymenu' . '_' . $menu_source);
} else {
$config = NULL;
}
# File does not exist
if ($config == NULL) {
unset($all['RESERVED']);
foreach ($all as $key => $value) {
if ($value[$header['model']] == 'no') {
unset($all[$key]);
} else {
$all[$key]['title'] = Aastra_get_label($all[$key]['title'], $language);
}
}
Aastra_natsort2d($all, 'title');
foreach ($all as $key => $value) {
$config['menu'][] = $key;
}
if ($is_softkeys_supported and $menu_mode == 'dynamic') {
$update = 1;
}
} else {
# Read config file
foreach ($config['menu'] as $key => $value) {
if ($all[$value] == NULL or $all[$value][$header['model']] == 'no') {
unset($config['menu'][$key]);
$update = 1;
}
}
}
# Read final file
if ($update == 1) {
Aastra_save_user_context($user, 'mymenu' . '_' . $menu_source, $config);
unset($config);
$config = Aastra_get_user_context($user, 'mymenu' . '_' . $menu_source);
}
# Return array
return $config;
}
示例2: get_user_config
function get_user_config($user)
{
global $asterisk;
if ($asterisk) {
$array_user = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'contacts');
} else {
$array_user = Aastra_get_user_context($user, 'contacts');
}
if ($array_user['display'] == '') {
$array_user['display'] = 'firstlast';
}
if ($array_user['sort'] == '') {
$array_user['sort'] = 'first';
}
if ($asterisk) {
Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'contacts', $array_user);
} else {
Aastra_save_user_context($user, 'contacts', $array_user);
}
return $array_user;
}
示例3: Aastra_propagate_daynight_Asterisk
function Aastra_propagate_daynight_Asterisk($device, $index)
{
global $ASTERISK_LOCATION;
# Get the list of devices
$sip_array = Aastra_readINIfile($ASTERISK_LOCATION . 'sip_additional.conf', ';', '=');
foreach ($sip_array as $key => $value) {
if ($value['callerid'] != '') {
$array_device[] = $key;
}
}
# Remove current device
$array_device = array_flip($array_device);
unset($array_device[$device]);
unset($array_device['']);
$array_device = array_flip($array_device);
# Remove the devices without the application
foreach ($array_device as $key => $value) {
if (!Aastra_is_daynight_notify_allowed_Asterisk(Aastra_get_userdevice_Asterisk($value), $index)) {
unset($array_device[$key]);
} else {
$data = Aastra_get_user_context($value, 'notify');
$data['daynight'] = '1';
Aastra_save_user_context($value, 'notify', $data);
}
}
# Send Notification
Aastra_send_SIP_notify_Asterisk('aastra-xml', $array_device);
}
示例4: Aastra_read_signature
function Aastra_read_signature($user)
{
return Aastra_get_user_context($user, 'signature');
}
示例5: Aastra_get_language
$language = Aastra_get_language();
# Get global compatibility
$nb_softkeys = Aastra_number_softkeys_supported();
# Callback
$XML_SERVER .= '?user=' . $user;
# No ZIP yet
if ($zip == '') {
# Input zip code
$object = new AastraIPPhoneInputScreen();
$object->setTitle(Aastra_get_label('US Local Weather', $language));
$object->setPrompt(Aastra_get_label('Enter ZIP code', $language));
$object->setParameter('zip');
$object->setType('number');
$object->setURL($XML_SERVER);
$object->setDestroyOnExit();
$data = Aastra_get_user_context($user, 'weather');
if ($data['last'] != NULL) {
$object->setDefault($data['last']);
}
if ($nb_softkeys) {
if ($nb_softkeys == 6) {
$object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace');
$object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit');
$object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
} else {
$object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
}
}
} else {
# Save last value requested
$data['last'] = $zip;
示例6: update_user_config
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);
//.........这里部分代码省略.........
示例7: Aastra_trace_call
if ($user == '') {
$user = $header['mac'];
}
# Keep return URI
$XML_SERVER .= '?user=' . $user;
# Trace
Aastra_trace_call('biorhytm', 'user=' . $user);
# Get Language
$language = Aastra_get_language();
# Check compatibility
Aastra_test_phone_version('1.4.2.', 0);
Aastra_test_php_function('imagecreate', Aastra_get_label('PHP-GD extension not installed.', $language));
$nb_softkeys = Aastra_number_softkeys_supported();
# Nothing entered
if ($bdate == '') {
$date = Aastra_get_user_context($user, 'biorhytm');
$object = new AastraIPPhoneInputScreen();
$object->setTitle(Aastra_get_label('Biorhythms', $language));
$object->setPrompt(Aastra_get_label('Birth Date (MM/DD/YYYY)', $language));
$object->setParameter('bdate');
$object->setType('dateUS');
$object->setURL($XML_SERVER);
$object->setDefault($date);
$object->setDestroyOnExit();
if ($nb_softkeys == 10) {
$object->addSoftkey('10', Aastra_get_label('Exit', $language), "SoftKey:Exit");
}
} else {
# Save user context
Aastra_save_user_context($user, 'biorhytm', $bdate);
# Extract day/month/year
示例8: Aastra_save_user_context
if ($data['favorites'][$selection] != '' and $selection != 0) {
$temp = $data['favorites'][$selection - 1];
$data['favorites'][$selection - 1] = $data['favorites'][$selection];
$data['favorites'][$selection] = $temp;
Aastra_save_user_context($user, 'currency', $data);
$default = $selection;
} else {
$default = $selection + 1;
}
$action = 'favorites';
break;
# Down
# Down
case 'down':
# Retrieve favorites
$data = Aastra_get_user_context($user, 'currency');
if ($data['favorites'][$selection] != '' and $selection != AASTRA_MAXLINES - 1) {
$temp = $data['favorites'][$selection + 1];
$data['favorites'][$selection + 1] = $data['favorites'][$selection];
$data['favorites'][$selection] = $temp;
Aastra_save_user_context($user, 'currency', $data);
$default = $selection + 2;
} else {
$default = $selection + 1;
}
$action = 'favorites';
break;
# Favorites
# Favorites
case 'favorites':
$default = $selection + 1;
示例9: Aastra_getvar_safe
#############################################################################
require_once 'AastraCommon.php';
require_once 'AastraIPPhoneTextScreen.class.php';
require_once 'AastraIPPhoneScrollableTextMenu.class.php';
require_once 'AastraIPPhoneScrollableDirectory.class.php';
$cookie = Aastra_getvar_safe('listCookie');
$page = Aastra_getvar_safe('listPage');
$zoomIndex = Aastra_getvar_safe('zoomIndex');
$recentSelection = Aastra_getvar_safe('recentSelection');
$recentPage = Aastra_getvar_safe('recentPage');
Aastra_trace_call('LDAP directory', $_SERVER['REQUEST_URI']);
# Get Language and HTTP header
$language = Aastra_get_language();
$header = Aastra_decode_HTTP_header();
# Load user context
$menu = Aastra_get_user_context($header['mac'], 'scrollableTextMenuData');
if (!is_object($menu)) {
# If not an object: Something went wrong when fetching the user context. Display error and exit.
$object = new AastraIPPhoneTextScreen();
$object->setTitle(Aastra_get_label('Server error', $language));
$object->setText(Aastra_get_label('Context not found. Check cache directory settings.', $language));
$object->output();
exit;
}
if (!$menu->verifyCookie($cookie)) {
# If cookie does not match: Display error and exit.
$object = new AastraIPPhoneTextScreen();
$object->setTitle(Aastra_get_label('Server error', $language));
$object->setText(Aastra_get_label('Session not found. Please try again.', $language));
$object->output();
exit;
示例10: create_mac
//.........这里部分代码省略.........
# Read user custom configuration
$array_user = Aastra_readCFGfile('user-custom.prf', '#', ':');
# User/Device exists
if ($array_user[$extension] != NULL) {
# Use the user configuration additions
foreach ($array_user[$extension] as $key => $value) {
$line = preg_replace($search, $replace, $value);
if (stristr($line, '$$AA_KEYPRESS_AA$$')) {
$pieces = explode(' ', $key);
$line = preg_replace('/\\$\\$AA_KEYPRESS_AA\\$\\$/', $pieces[0], $line);
}
$array_config[$key] = $line;
}
}
# Remove TZ if not needed
if (!$AA_ASK_TZ) {
unset($array_config['time zone name']);
unset($array_config['time zone code']);
}
# Process language
if ($lang_code != '') {
$array_config['language'] = $lang_code;
if (Aastra_test_phone_version('2.0.1.', '1') == 0) {
$array_config['web language'] = $lang_code;
$array_wl = array('fr' => 'French', 'it' => 'Italian', 'es' => 'Spanish', 'en' => 'English', 'de' => 'German', 'pt' => 'Portuguese');
if ($array_wl[substr($lang, 0, 2)] != '') {
$array_config['input language'] = $array_wl[substr($lang, 0, 2)];
}
}
}
# User mode
if ($AA_FREEPBX_MODE == '1') {
# Retrieve user keys
$keys = Aastra_get_user_context($username, 'keys');
# User has existing keys
if (count($keys[$model]) != 0) {
# Remove all profile keys
foreach ($array_config as $key => $value) {
if (stristr($key, 'key')) {
unset($array_config[$key]);
}
}
# Add user keys
foreach ($keys[$model] as $key => $value) {
$array_config[$key] = $value;
}
}
# Process day/night keys
foreach ($array_config as $key => $value) {
if (strstr($value, 'daynight.php')) {
$pieces = explode(' ', $key);
if (stristr($pieces[0], 'expmod')) {
$appli = $pieces[0] . ' ' . $pieces[1];
} else {
$appli = $pieces[0];
}
$url = parse_url($value);
parse_str($url['query'], $parse);
if ($parse['index'] != '') {
$index = $parse['index'];
} else {
$index = '';
}
if (!Aastra_is_daynight_appli_allowed_Asterisk($username, $index)) {
unset($array_config[$appli . ' type']);
unset($array_config[$appli . ' label']);
示例11: Aastra_get_user_context
if ($away['key'] != '') {
$object->AddEntry('Led: ' . $away['key'] . '=off');
}
$agent = Aastra_get_user_context($user, 'agent');
if ($agent['key'] != '') {
$object->AddEntry('Led: ' . $agent['key'] . '=off');
}
$follow = Aastra_get_user_context($user, 'follow');
if ($follow['key'] != '') {
$object->AddEntry('Led: ' . $follow['key'] . '=off');
}
$parking = Aastra_get_user_context($user, 'parking');
if ($parking['key'] != '') {
$object->AddEntry('Led: ' . $parking['key'] . '=off');
}
$vmail = Aastra_get_user_context($user, 'vmail');
foreach ($vmail as $box => $value) {
if ($value['key'] != '') {
$object->AddEntry('Led: ' . $value['key'] . '=off');
}
}
}
for ($i = 1; $i <= $last; $i++) {
$object->addEntry($XML_SERVER . '&action=configuration&page=' . $i);
}
$object->addEntry($array_config['action uri startup']);
# Clear the critical keys
Aastra_save_user_context($user, 'cfwd', NULL);
Aastra_save_user_context($user, 'dnd', NULL);
Aastra_save_user_context($user, 'daynight', NULL);
Aastra_save_user_context($user, 'away', NULL);
示例12: Aastra_propagate_changes_Asterisk
}
# Send a SIP Notification if mode is device and user
if (!$AA_FREEPBX_USEDEVSTATE and $AA_FREEPBX_MODE == '2') {
Aastra_propagate_changes_Asterisk($user, Aastra_get_userdevice_Asterisk($user), array('dnd'));
}
break;
# Initial or recurrent check
# Initial or recurrent check
case 'check':
case 'register':
# Update needed
$update = 1;
# Get current DND status
$dnd = Aastra_manage_dnd_Asterisk($user, 'get');
# Get last DND status
$data = Aastra_get_user_context($user, 'dnd');
$last = $data['last'];
$key = $data['key'];
# Save DND status
$data['last'] = $dnd;
if ($dnd != $last) {
Aastra_save_user_context($user, 'dnd', $data);
}
# Update needed?
if ($action == 'check' and $dnd == $last) {
$update = 0;
}
if ($action == 'register' and $dnd == 0) {
$update = 0;
}
# Prepare display update
示例13: Aastra_propagate_changes_Asterisk
}
# Send a SIP Notification if mode is device and user
if (!$AA_FREEPBX_USEDEVSTATE and $AA_FREEPBX_MODE == '2') {
Aastra_propagate_changes_Asterisk($user, Aastra_get_userdevice_Asterisk($user), array('cfwd'));
}
# Display status screen
if ($mode != '1' and $action != 'cancel2') {
$object->AddEntry($XML_SERVER);
}
break;
# Enter forward number
# Enter forward number
case 'change':
case 'change2':
# Retrieve last input
$data = Aastra_get_user_context($user, 'cfwd');
# Input new call forward
require_once 'AastraIPPhoneInputScreen.class.php';
$object = new AastraIPPhoneInputScreen();
$object->setDestroyOnExit();
$object->setTitle(sprintf(Aastra_get_label('Call Forward for %s', $language), Aastra_get_userdevice_Asterisk($user)));
$object->setPrompt(Aastra_get_label('Enter destination', $language));
$object->setParameter('value');
$object->setType('number');
$object->setURL($XML_SERVER . '&action=set');
$object->setDefault($data['input']);
# Softkeys
if ($nb_softkeys) {
if ($nb_softkeys == 6) {
$object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace');
if ($action == 'change') {
示例14: Aastra_get_user_context
}
break;
# Initial or recurrent check
# Initial or recurrent check
case 'check':
case 'register':
# Update needed
$update = 1;
# Get global status
if (is_agent_logged($agent)) {
$status = 1;
} else {
$status = 0;
}
# Get last agent status
$data = Aastra_get_user_context($agent, 'agent');
$last = $data['last'];
$key = $data['key'];
# Save status if changed
if ($status != $last) {
$data['last'] = $status;
Aastra_save_user_context($agent, 'agent', $data);
}
# Update needed?
if ($action == 'check' and $status == $last) {
$update = 0;
}
if ($action == 'register' and $status == 0) {
$update = 0;
}
# Prepare display update
示例15: Aastra_trace_call
if ($asterisk) {
Aastra_trace_call('asterisk_speed', 'user=' . $user . ', action=' . $action . ', selection=' . $selection . ', value=' . $value . ', step=' . $step);
} else {
Aastra_trace_call('speed', 'user=' . $user . ', action=' . $action . ', selection=' . $selection . ', value=' . $value . ', step=' . $step);
}
# Test User Agent
Aastra_test_phone_versions(array('1' => '1.4.2.', '2' => '1.4.2.', '3' => '2.5.3.', '4' => '2.5.3.', '5' => '3.0.1.'), '0');
# Global data
$XML_SERVER .= '?user=' . $user . '&mode=' . $mode;
# Get Language
$language = Aastra_get_language();
# Init data
if ($asterisk) {
$data = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'speed');
} else {
$data = Aastra_get_user_context($user, 'speed');
}
# Get global compatibility
$is_multipleinputfields = Aastra_is_multipleinputfields_supported();
$nb_softkeys = Aastra_number_softkeys_supported();
$is_icons = Aastra_is_icons_supported();
$is_style_textmenu = Aastra_is_style_textmenu_supported();
# Pre-Process action
switch ($action) {
# UP
case 'up':
# Next action
$action = 'nothing';
# Entry must be real
if ($data[$selection]['name'] != '') {
# Not the first one