当前位置: 首页>>代码示例>>PHP>>正文


PHP gs_log函数代码示例

本文整理汇总了PHP中gs_log函数的典型用法代码示例。如果您正苦于以下问题:PHP gs_log函数的具体用法?PHP gs_log怎么用?PHP gs_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了gs_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: retrieve_keys

 function retrieve_keys($phone_type, $variables = array())
 {
     if ($this->_user_id > 0) {
         $this->_keys = gs_keys_get_by_user($this->_user_name, $phone_type);
     } else {
         $this->_keys = gs_keys_get_by_profile($this->_profile_id, $phone_type);
     }
     if (isGsError($this->_keys) || !is_array($this->_keys)) {
         gs_log(GS_LOG_NOTICE, isGsError($this->_keys) ? $this->_keys->getMsg() : 'Failed to get softkeys');
         $this->_keys = null;
         return false;
     }
     if (is_array($variables) && count($variables) > 0) {
         $search = array_keys($variables);
         $replace = array_values($variables);
         unset($variables);
         foreach ($this->_keys as $key_name => $key_defs) {
             foreach ($key_defs as $inh_slf => $key_def) {
                 if ($this->_keys[$key_name][$inh_slf]['data'] != '') {
                     $this->_keys[$key_name][$inh_slf]['data'] = str_replace($search, $replace, $key_def['data']);
                 }
             }
         }
     }
     return true;
 }
开发者ID:rkania,项目名称:GS3,代码行数:26,代码来源:gs_keys_get_unknown.php

示例2: siemens_push_str

function siemens_push_str($phone_ip, $postdata)
{
    $prov_host = gs_get_conf('GS_PROV_HOST');
    $data = "POST /server_push.html/ServerPush HTTP/1.1\r\n";
    $data .= "User-Agent: Gemeinschaft\r\n";
    $data .= "Host: {$phone_ip}:8085\r\n";
    $data .= "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n";
    $data .= "Connection: keep-alive\r\n";
    $data .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $data .= "Content-Length: " . strLen($postdata) . "\r\n\r\n";
    $data .= $postdata;
    $socket = @fSockOpen($phone_ip, 8085, $error_no, $error_str, 4);
    if (!$socket) {
        gs_log(GS_LOG_NOTICE, "Siemens: Failed to open socket - IP: {$phone_ip}");
        return 0;
    }
    stream_set_timeout($socket, 4);
    $bytes_written = (int) @fWrite($socket, $data, strLen($data));
    @fFlush($socket);
    $response = @fGetS($socket);
    @fClose($socket);
    if (strPos($response, '200') === false) {
        gs_log(GS_LOG_WARNING, "Siemens: Failed to push to phone {$phone_ip}");
        return 0;
    }
    gs_log(GS_LOG_DEBUG, "Siemens: Pushed {$bytes_written} bytes to phone {$phone_ip}");
    return $bytes_written;
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:28,代码来源:siemens-fns.php

示例3: _not_found

function _not_found($errmsg = '')
{
    @header('HTTP/1.0 404 Not Found', true, 404);
    @header('Status: 404 Not Found', true, 404);
    @header('Content-Type: text/plain; charset=utf-8');
    echo '/*  ', $errmsg ? $errmsg : 'Not found.', '  */';
    gs_log(GS_LOG_DEBUG, $errmsg ? $errmsg : 'LDAP lookup: User not found');
    exit(1);
}
开发者ID:rkania,项目名称:GS3,代码行数:9,代码来源:ldap-user-info.php

示例4: gs_host_get_api

function gs_host_get_api($host_id)
{
    if ($host_id < 1) {
        return '__fail_api';
    }
    $db = gs_db_master_connect();
    if (!$db) {
        gs_log(GS_LOG_WARNING, 'Could not connect to DB');
        return '__fail_api';
    }
    $api = $db->executeGetOne('SELECT `value` ' . 'FROM `host_params` ' . 'WHERE ' . '`host_id`=' . (int) $host_id . ' AND ' . '`param`=\'api\'');
    return (string) $api;
}
开发者ID:rkania,项目名称:GS3,代码行数:13,代码来源:boi-api.php

示例5: CanonicalPhoneNumber

 function CanonicalPhoneNumber($number)
 {
     $this->_INTL = $this->_cnf('GS_CANONIZE_INTL_PREFIX', '00');
     if ($this->_INTL === '+' || $this->_INTL == '') {
         $this->_INTL = '00';
     }
     $this->_CNTR = $this->_cnf('GS_CANONIZE_COUNTRY_CODE', '49');
     $this->_NATL = $this->_cnf('GS_CANONIZE_NATL_PREFIX', '0');
     $this->_NINT = gs_get_conf('GS_CANONIZE_NATL_PREFIX_INTL', false);
     $this->_AREA = $this->_cnf('GS_CANONIZE_AREA_CODE', '251');
     $this->_LOCL = $this->_cnf('GS_CANONIZE_LOCAL_BRANCH', '99999999');
     $this->_CBCP = $this->_cnf('GS_CANONIZE_CBC_PREFIX', '010');
     $this->_SPCL = gs_get_conf('GS_CANONIZE_SPECIAL', '//');
     if (!is_valid_pcre($this->_SPCL)) {
         gs_log(GS_LOG_WARNING, 'Your GS_CANONIZE_SPECIAL pattern is not a valid PCRE');
         $this->_SPCL = '/^1(:1[0-9]{1,5}|9222)/';
         # 110, 112, 116116, 118.*, 19222 etc.
     }
     //$n = preg_replace('/[^0-9A-Z+*\-\/ ]/', '', strToUpper(trim( $number )));
     //$n = preg_replace('/[ \/\-]/', ' ', $n);
     $n = preg_replace('/[^0-9A-Z+*]/', '', strToUpper(trim($number)));
     // "+" is allowed as the first char only:
     $n = preg_replace('/(?!^)\\+/', '', $n);
     $this->orig = $n;
     if ($this->orig != '') {
         $this->norm = $this->_canonize();
         $this->_to_intl();
         $this->_to_natl();
         $this->_to_locl();
         $this->_check_prv_branch();
         if ($this->is_call_by_call) {
             $this->in_prv_branch = false;
         }
         if ($this->is_call_by_call) {
             $this->dial = '';
             $this->errt = 'cbc';
         } elseif ($this->in_prv_branch) {
             $this->dial = $this->extn;
             $this->errt = 'self';
         } elseif ($this->is_special) {
             $this->dial = $this->orig;
         } else {
             $this->dial = $this->natl;
         }
     } else {
         $this->errt = 'empty';
     }
 }
开发者ID:rkania,项目名称:GS3,代码行数:48,代码来源:canonization.php

示例6: aastra_get_expansion_modules

function aastra_get_expansion_modules()
{
    $exp_mod = array();
    if (@$_SERVER['HTTP_X_AASTRA_EXPMOD1']) {
        $exp_mod[0] = 'aastra-' . strToLower($_SERVER['HTTP_X_AASTRA_EXPMOD1']);
        gs_log(GS_LOG_DEBUG, 'Expansion module 1 : ' . $exp_mod[0]);
    }
    if (@$_SERVER['HTTP_X_AASTRA_EXPMOD2']) {
        $exp_mod[1] = 'aastra-' . strToLower($_SERVER['HTTP_X_AASTRA_EXPMOD2']);
        gs_log(GS_LOG_DEBUG, 'Expansion module 2 : ' . $exp_mod[1]);
    }
    if (@$_SERVER['HTTP_X_AASTRA_EXPMOD3']) {
        $exp_mod[2] = 'aastra-' . strToLower($_SERVER['HTTP_X_AASTRA_EXPMOD3']);
        gs_log(GS_LOG_DEBUG, 'Expansion module 3 : ' . $exp_mod[3]);
    }
    return $exp_mod;
}
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:17,代码来源:settings.php

示例7: gs_mysql_find_socket

function gs_mysql_find_socket($db_host)
{
    $socket = null;
    # never use socket for remote databases
    if (!in_array((string) $db_host, array('127.0.0.1', 'localhost', ''), true)) {
        return null;
    }
    /*
    wo der Socket liegt findet man so heraus:
    mysqladmin variables | grep sock
    oder es steht auch in der MySQL-Konfiguration:
    cat /etc/my.cnf | grep sock
    bzw.
    cat /etc/mysql/my.cnf | grep sock
    */
    $err = 0;
    $out = array();
    @exec('sed -e ' . qsa('/^\\[\\(mysqld_safe\\|safe_mysqld\\)\\]/,/^\\[/!d') . ' /etc/mysql/my.cnf 2>>/dev/null | grep \'^socket\' 2>>/dev/null', $out, $err);
    // Debian
    if ($err === 0) {
        $socket = _grep_mysql_socket(implode("\n", $out));
    }
    if ($socket === null) {
        $err = 0;
        $out = array();
        @exec('sed -e ' . qsa('/^\\[\\(mysqld_safe\\|safe_mysqld\\)\\]/,/^\\[/!d') . ' /etc/my.cnf 2>>/dev/null | grep \'^socket\' 2>>/dev/null', $out, $err);
        // CentOS
        if ($err === 0) {
            $socket = _grep_mysql_socket(implode("\n", $out));
        }
        if ($socket === null) {
            $err = 0;
            $out = array();
            @exec('mysqladmin -s variables | grep socket 2>>/dev/null', $out, $err);
            // should work everywhere if mysqladmin is available
            if ($err === 0) {
                $socket = _grep_mysql_socket(implode("\n", $out));
            }
            if ($socket === null) {
                gs_log(GS_LOG_WARNING, 'Could not find MySQL socket');
            }
        }
    }
    return $socket !== null ? $socket : null;
}
开发者ID:rkania,项目名称:GS3,代码行数:45,代码来源:mysql-find-socket.php

示例8: gs_get_listen_to_ips

function gs_get_listen_to_ips($primary_only = false)
{
    /*
    if (gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
    	# return special address
    	//return ($primary_only ? array('255.255.255.255') : array('255.255.255.255'));
    	return array('255.255.255.255');
    }
    */
    //if (gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
    if (gs_get_conf('GS_INSTALLATION_TYPE') === 'gpbx') {
        return array(trim(gs_keyval_get('vlan_0_ipaddr')));
    }
    $file = GS_DIR . 'etc/listen-to-ip';
    if (!@file_exists($file)) {
        # kann entweder passieren wenn wir ein Gemeinschaft-Node sind
        # (dann ist es extrem schlecht wenn die Datei fehlt) oder wenn
        # wir ein Web-Server ohne Asterisk sind (dann ist es ok)
        gs_log(GS_LOG_DEBUG, "File \"{$file}\" not found");
        return false;
    }
    if (!is_array($lines = @file($file))) {
        gs_log(GS_LOG_DEBUG, "Failed to read \"{$file}\"");
        return false;
    }
    $ips = array();
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line == '' || @$line[0] == '#') {
            continue;
        }
        if (!preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $line, $m)) {
            continue;
        }
        $ips[] = normalizeIPs($m[0]);
        if ($primary_only) {
            # only return the first IP address (our main one)
            return $ips;
        }
    }
    // remove duplicates:
    $ips = array_flip(array_flip($ips));
    sort($ips);
    return $ips;
}
开发者ID:rkania,项目名称:GS3,代码行数:45,代码来源:get-listen-to-ips.php

示例9: _getUser

 function _getUser()
 {
     $ldapproto = gs_get_conf('GS_LDAP_PROTOCOL');
     $ldapuser = trim(@$_REQUEST['login_user']);
     $ldapdn = gs_get_conf('GS_LDAP_PROP_USER') . '=' . $ldapuser . ',' . gs_get_conf('GS_LDAP_SEARCHBASE');
     $ldappass = @$_REQUEST['login_pwd'];
     $ldapsearchdn = gs_get_conf('GS_LDAP_BINDDN');
     $ldapsearchpass = gs_get_conf('GS_LDAP_PWD');
     $ldapconn = @ldap_connect(gs_get_conf('GS_LDAP_HOST'));
     @ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, (int) $ldapproto);
     if (!$ldapconn) {
         gs_log(GS_LOG_WARNING, 'Unable to connect to LDAP server');
         return false;
     }
     if ($ldapuser == '' || $ldappass == '') {
         return false;
     }
     if ($ldapconn) {
         $ldapbind = @ldap_bind($ldapconn, $ldapsearchdn, $ldapsearchpass);
         if ($ldapbind) {
             $searchresult = @ldap_search($ldapconn, gs_get_conf('GS_LDAP_SEARCHBASE'), '(' . gs_get_conf('GS_LDAP_PROP_UID') . '=' . $ldapuser . ')', array());
             $ldapinfo = ldap_get_entries($ldapconn, $searchresult);
             if ($ldapinfo['count'] != 1) {
                 gs_log(GS_LOG_DEBUG, 'Number of users found in LDAP is not 1 (' . $ldapinfo['count'] . ')');
                 return false;
             }
         } else {
             gs_log(GS_LOG_DEBUG, 'Unable to bind to LDAP server as ' . $ldapsearchdn . ', ' . ldap_error($ldapconn));
             return false;
         }
     }
     $ldapbind = @ldap_bind($ldapconn, $ldapinfo[0]['dn'], $ldappass);
     if ($ldapbind) {
         gs_log(GS_LOG_DEBUG, 'User ' . $ldapinfo[0]['dn'] . ' found!');
         return $ldapuser;
     } else {
         gs_log(GS_LOG_DEBUG, 'Unable to bind to LDAP server as ' . $ldapinfo[0]['dn'] . ', ' . ldap_error($ldapconn));
         return false;
     }
 }
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:40,代码来源:ldap.php

示例10: aastra_push_str

function aastra_push_str($phone_ip, $xml)
{
    $prov_host = gs_get_conf('GS_PROV_HOST');
    //FIXME - call wget or something. this function should not block
    // for so long!
    // see _gs_prov_phone_checkcfg_by_ip_do_aastra() in
    // opt/gemeinschaft/inc/gs-fns/gs_prov_phone_checkcfg.php
    //$xml = utf8_decode($xml);
    if (subStr($xml, 0, 5) !== '<' . '?xml') {
        $xmlpi = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
    } else {
        $xmlpi = '';
    }
    $data = "POST / HTTP/1.1\r\n";
    $data .= "Host: {$phone_ip}\r\n";
    $data .= "Referer: {$prov_host}\r\n";
    $data .= "Connection: Close\r\n";
    $data .= "Content-Type: text/xml; charset=utf-8\r\n";
    $data .= "Content-Length: " . (strLen('xml=') + strLen($xmlpi) + strLen($xml)) . "\r\n";
    $data .= "\r\n";
    $data .= 'xml=' . $xmlpi . $xml;
    $socket = @fSockOpen($phone_ip, 80, $error_no, $error_str, 4);
    if (!$socket) {
        gs_log(GS_LOG_NOTICE, "Aastra: Failed to open socket - IP: {$phone_ip}");
        return 0;
    }
    stream_set_timeout($socket, 4);
    $bytes_written = (int) @fWrite($socket, $data, strLen($data));
    @fFlush($socket);
    $response = @fGetS($socket);
    @fClose($socket);
    if (strPos($response, '200') === false) {
        gs_log(GS_LOG_WARNING, "Aastra: Failed to push XML to phone {$phone_ip}");
        return 0;
    }
    gs_log(GS_LOG_DEBUG, "Aastra: Pushed {$bytes_written} bytes to phone {$phone_ip}");
    return $bytes_written;
}
开发者ID:rkania,项目名称:GS3,代码行数:38,代码来源:aastra-fns.php

示例11: phone_model

	gs_log( GS_LOG_WARNING, "Phone with IP \"$remote_ip\" (Grandstream) has invalid phone_model (\"". $ua ."\")" );
	# don't explain this to the users
	_err( 'No! See log for details.' );
}

# only gxv3000
if (! in_array($phone_model, array('gxv3000'), true) ) {
	gs_log( GS_LOG_WARNING, 'only gxp3000' );
	_err( 'No! See log for details.' );
}
*/
# DB connect
require_once GS_DIR . 'inc/db_connect.php';
$db = gs_db_slave_connect();
if (!$db) {
    gs_log(GS_LOG_WARNING, "Grandstream phone asks for idle screen - Could not connect to DB");
    _err('Could not connect to DB.');
}
# get user_id
$user_id = (int) $db->executeGetOne('SELECT `id` FROM `users` WHERE `current_ip`=\'' . $db->escape($remote_ip) . '\'');
function checksum($str)
{
    $sum = 0;
    for ($i = 0; $i <= (strLen($str) - 1) / 2; $i++) {
        $sum += ord(subStr($str, 2 * $i, 1)) << 8;
        $sum += ord(subStr($str, 2 * $i + 1, 1));
        $sum &= 0xffff;
    }
    $sum = 0x10000 - $sum;
    return array($sum >> 8 & 0xff, $sum & 0xff);
}
开发者ID:sebastianertz,项目名称:gemeinschaft-grandstream,代码行数:31,代码来源:screensaver.php

示例12: _err

    @ob_end_flush();
    die;
}
function _err($msg = '')
{
    @ob_end_clean();
    ob_start();
    echo '<html>', "\n";
    echo '<head><title>' . __('Fehler') . '</title></head>', "\n";
    echo '<body><b>' . __('Fehler') . '</b>: ' . $msg . '</body>', "\n";
    echo '</html>', "\n";
    _ob_send();
}
//---------------------------------------------------------------------------
if (!gs_get_conf('GS_POLYCOM_PROV_ENABLED')) {
    gs_log(GS_LOG_DEBUG, 'Polycom provisioning not enabled');
    _err('Not enabled.');
}
$user = trim(@$_REQUEST['user']);
if (!preg_match('/^\\d+$/', $user)) {
    _err('Not a valid SIP user.');
}
$type = trim(@$_REQUEST['type']);
if (!in_array($type, array('in', 'out', 'missed', 'queue'), true)) {
    $type = false;
}
if (isset($_REQUEST['delete'])) {
    $delete = (int) $_REQUEST['delete'];
}
$db = gs_db_slave_connect();
//--- get user_id
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:31,代码来源:diallog.php

示例13: gs_log

        gs_log(GS_LOG_WARNING, 'Failed to convert voicemail file to ' . $fmt . '. (' . trim(implode(' - ', $out)) . ')');
        _server_error('Failed to convert file.');
    }
} elseif ($fmt === 'wav-pcm') {
    # signed linear PCM in WAVE container
    $cmd = $sox . ' -q -t al ' . qsa($origfile) . ' -r 8000 -c 1 -s -b 16 -t wav ' . qsa($outfile) . ' 1>>/dev/null';
    $err = 0;
    $out = array();
    @exec($cmd, $out, $err);
    if ($err != 0) {
        gs_log(GS_LOG_WARNING, 'Failed to convert voicemail file to ' . $fmt . '. (' . trim(implode(' - ', $out)) . ')');
        _server_error('Failed to convert file.');
    }
}
if (!file_exists($outfile)) {
    gs_log(GS_LOG_WARNING, 'Failed to convert voicemail file.');
    _server_error('Failed to convert file.');
}
@header('Content-Type: ' . $formats[$fmt]['mime']);
$fake_filename = preg_replace('/[^0-9a-z\\-_.]/i', '', 'vm_' . $ext . '_' . date('Ymd_Hi', $info['orig_time']) . '_' . subStr(md5(date('s', $info['orig_time']) . $info['cidnum']), 0, 4) . '.' . $formats[$fmt]['ext']);
@header('Content-Disposition: ' . ($attach ? 'attachment' : 'inline') . '; filename="' . $fake_filename . '"');
@header('ETag: ' . $etag);
# set Content-Length to prevent Apache(/PHP?) from using
# "Transfer-Encoding: chunked" which makes the sound file appear too
# short in QuickTime and maybe other players
@header('Transfer-Encoding: identity');
if ($fmt === 'wav-pcma') {
    @header('Content-Length: ' . ((int) strLen($wav_alaw_header) + (int) @fileSize($origfile)));
    echo $wav_alaw_header;
    @readFile($origfile);
} else {
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:31,代码来源:vm-play.php

示例14: gs_log

    gs_log(GS_LOG_WARNING, 'Failed to get provisioning parameters (user)');
} else {
    foreach ($prov_params as $p) {
        if ($p['index'] === null || $p['index'] == -1) {
            # not an array
            if (!array_key_exists($p['param'], $settings)) {
                # don't set unknown parameters because the order is important
                gs_log(GS_LOG_NOTICE, "User prov. param \"{$param_name}\": Unknown parameter");
                continue;
            }
            gs_log(GS_LOG_DEBUG, 'Overriding user prov. param "' . $p['param'] . '": "' . $p['value'] . '"');
            //setting( $p['param'], null       , $p['value'] );
            psetting($p['param'], $p['value']);
        } else {
            # array
            gs_log(GS_LOG_NOTICE, 'User prov. param "' . $p['param'] . '"[' . $p['index'] . ']: Grandstream does not support arrays"');
            //gs_log( GS_LOG_DEBUG, 'Overriding user prov. param "'.$p['param'].'"['.$p['index'].']: "'.$p['value'].'"' );
            //setting( $p['param'], $p['index'], $p['value'] );
        }
    }
}
unset($prov_params);
#####################################################################
#  create BODY
#####################################################################
$body = _settings_out();
#####################################################################
#  create HEADER
#####################################################################
$header_length = 16;
$header = array();
开发者ID:sebastianertz,项目名称:gemeinschaft-grandstream,代码行数:31,代码来源:settings.php

示例15: gs_user_del


//.........这里部分代码省略.........
    $db->execute('DELETE FROM `ringtones` WHERE `user_id`=' . $user_id);
    # delete softkeys
    #
    if ($softkey_profile_id > 0) {
        $db->execute('DELETE FROM `softkeys` WHERE `profile_id`=' . $softkey_profile_id);
        $db->execute('DELETE FROM `softkey_profiles` WHERE `id`=' . $softkey_profile_id . ' AND `is_user_profile`=1');
    }
    # delete prov_params
    #
    if ($prov_profile_id > 0) {
        $db->execute('DELETE FROM `prov_params` WHERE `profile_id`=' . $prov_profile_id);
        $db->execute('DELETE FROM `prov_param_profiles` WHERE `id`=' . $prov_profile_id . ' AND `is_group_profile`=0');
    }
    # delete watchlist buddies
    #
    $db->execute('DELETE FROM `user_watchlist` WHERE `user_id`=' . $user_id);
    $db->execute('DELETE FROM `user_watchlist` WHERE `buddy_user_id`=' . $user_id);
    # delete instant messaging
    #
    $db->execute('DELETE FROM `instant_messaging` WHERE `user_id`=' . $user_id);
    # delete monitor data
    #
    $db->execute('DELETE FROM `monitor` WHERE `user_id`=' . $user_id);
    $db->execute('DELETE FROM `monitor_queues` WHERE `user_id`=' . $user_id);
    $db->execute('DELETE FROM `monitor_colors` WHERE `user_id`=' . $user_id);
    # do a clean logout from the current phone
    #
    $db->execute('UPDATE `phones` SET `user_id`=NULL WHERE `user_id`=' . $user_id);
    # delete huntgroup memberships
    #
    $db->execute('DELETE FROM `huntgroups` WHERE `user_id`=' . $user_id);
    # delete drop targets
    #
    $db->execute('DELETE FROM `user_calldrop` WHERE `user_id`=' . $user_id);
    # delete dnd
    #
    $db->execute('DELETE FROM `dnd` WHERE `_user_id`=' . $user_id);
    # delete user
    #
    $db->execute('DELETE FROM `users` WHERE `id`=' . $user_id);
    # astbuttond
    if (GS_BUTTONDAEMON_USE == true) {
        gs_user_remove_ui($ext);
    }
    # reload dialplan (to update hints) and prune realtime peer
    #
    if ($host_id > 0) {
        if (is_array($host) && !$host['is_foreign']) {
            @gs_asterisks_prune_peer($ext, array($host_id));
            if ($reload) {
                @gs_asterisks_reload(array($host_id), true);
            }
        }
    }
    # delete user on foreign host
    #
    if (is_array($host) && $host['is_foreign']) {
        if (trim($ext) != '') {
            include_once GS_DIR . 'inc/boi-soap/boi-api.php';
            $api = gs_host_get_api($host['id']);
            switch ($api) {
                case 'm01':
                case 'm02':
                    $hp_route_prefix = (string) $db->executeGetOne('SELECT `value` FROM `host_params` ' . 'WHERE `host_id`=' . (int) $host['id'] . ' AND `param`=\'route_prefix\'');
                    $sub_ext = subStr($ext, 0, strLen($hp_route_prefix)) === $hp_route_prefix ? subStr($ext, strLen($hp_route_prefix)) : $ext;
                    gs_log(GS_LOG_DEBUG, "Mapping ext. {$ext} to {$sub_ext} for SOAP call");
                    //if (! class_exists('SoapClient')) {
                    if (!extension_loaded('soap')) {
                        return new GsError('Failed to delete user on foreign host (SoapClient not available).');
                    }
                    include_once GS_DIR . 'inc/boi-soap/boi-soap.php';
                    $soap_faultcode = null;
                    $ok = gs_boi_delete_extension($api, $host['host'], $hp_route_prefix, $sub_ext, $soap_faultcode);
                    if (!$ok) {
                        return new GsError('Failed to delete user on foreign host (SOAP error).');
                    }
                    break;
                case '':
                    # host does not provide any API
                    gs_log(GS_LOG_NOTICE, 'Deleting user ' . $user . ' on foreign host ' . $host['host'] . ' without any API');
                    break;
                default:
                    gs_log(GS_LOG_WARNING, 'Failed to delete user ' . $user . ' on foreign host ' . $host['host'] . ' - invalid API "' . $api . '"');
                    return new GsError('Failed to delete user on foreign host (Invalid API).');
            }
        }
    }
    # update fax authentication file if fax enabled
    #
    if (gs_get_conf('GS_FAX_ENABLED')) {
        $ok = gs_hylafax_authfile_sync();
        if (isGsError($ok)) {
            return new GsError($ok->getMsg());
        }
        if (!$ok) {
            return new GsError('Failed to update fax authentication file.');
        }
    }
    return true;
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:101,代码来源:gs_user_del.php


注:本文中的gs_log函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。