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


PHP gs_get_conf函数代码示例

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


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

示例1: 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

示例2: InitRecordCall

function InitRecordCall($filename, $index, $comment)
{
    //FIXME
    $user = gs_user_get($_SESSION['sudo_user']['name']);
    $call = "Channel: SIP/" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: vm-rec-multiple\n" . "Extension: webdialrecord\n" . "Callerid: {$comment} <Aufnahme>\n" . "Setvar: __user_id=" . $_SESSION['sudo_user']['info']['id'] . "\n" . "Setvar: __user_name=" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __callfile_from_user=" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "Setvar: __record_file=" . $filename . "\n";
    $filename = '/tmp/gs-' . $_SESSION['sudo_user']['info']['id'] . '-' . _pack_int(time()) . rand(100, 999) . '.call';
    $cf = @fOpen($filename, 'wb');
    if (!$cf) {
        gs_log(GS_LOG_WARNING, 'Failed to write call file "' . $filename . '"');
        echo 'Failed to write call file.';
        die;
    }
    @fWrite($cf, $call, strLen($call));
    @fClose($cf);
    @chmod($filename, 0666);
    $spoolfile = '/var/spool/asterisk/outgoing/' . baseName($filename);
    if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
        $our_host_ids = @gs_get_listen_to_ids();
        if (!is_array($our_host_ids)) {
            $our_host_ids = array();
        }
        $user_is_on_this_host = in_array($_SESSION['sudo_user']['info']['host_id'], $our_host_ids);
    } else {
        $user_is_on_this_host = true;
    }
    if ($user_is_on_this_host) {
        # the Asterisk of this user and the web server both run on this host
        $err = 0;
        $out = array();
        @exec('sudo mv ' . qsa($filename) . ' ' . qsa($spoolfile) . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            @unlink($filename);
            gs_log(GS_LOG_WARNING, 'Failed to move call file "' . $filename . '" to "' . '/var/spool/asterisk/outgoing/' . baseName($filename) . '"');
            echo 'Failed to move call file.';
            die;
        }
    } else {
        $cmd = 'sudo scp -o StrictHostKeyChecking=no -o BatchMode=yes ' . qsa($filename) . ' ' . qsa('root@' . $user['host'] . ':' . $filename);
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        @unlink($filename);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to scp call file "' . $filename . '" to ' . $user['host']);
            echo 'Failed to scp call file.';
            die;
        }
        //remote_exec( $user['host'], $cmd, 10, $out, $err ); // <-- does not use sudo!
        $cmd = 'sudo ssh -o StrictHostKeyChecking=no -o BatchMode=yes -l root ' . qsa($user['host']) . ' ' . qsa('mv ' . qsa($filename) . ' ' . qsa($spoolfile));
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to mv call file "' . $filename . '" on ' . $user['host'] . ' to "' . $spoolfile . '"');
            echo 'Failed to mv call file on remote host.';
            die;
        }
    }
}
开发者ID:rkania,项目名称:GS3,代码行数:57,代码来源:forwards_queues.php

示例3: gs_asterisks_reload

function gs_asterisks_reload($host_ids, $dialplan_only)
{
    $dialplan_only = !!$dialplan_only;
    if (!$host_ids || !is_array($host_ids)) {
        $host_ids = false;
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get hosts
    #
    $hosts = @gs_hosts_get();
    if (isGsError($hosts)) {
        return new GsError($hosts->getMsg());
    }
    if (!is_array($hosts)) {
        return new GsError('Failed to get hosts.');
    }
    $GS_INSTALLATION_TYPE_SINGLE = gs_get_conf('GS_INSTALLATION_TYPE_SINGLE');
    if (!$GS_INSTALLATION_TYPE_SINGLE) {
        # get our host IDs
        #
        $our_host_ids = @gs_get_listen_to_ids();
        if (isGsError($our_host_ids)) {
            return new GsError($our_host_ids->getMsg());
        }
        if (!is_array($our_host_ids)) {
            return new GsError('Failed to get our host IDs.');
        }
    }
    # are we root? do we have to sudo?
    #
    $uid = @posix_geteuid();
    $uinfo = @posix_getPwUid($uid);
    $uname = @$uinfo['name'];
    $sudo = $uname == 'root' ? '' : 'sudo ';
    $ok = true;
    foreach ($hosts as $host) {
        if (!$host_ids || in_array($host['id'], $host_ids)) {
            $cmd = '/opt/gemeinschaft/sbin/start-asterisk' . ($dialplan_only ? ' --dialplan' : '');
            if (!$GS_INSTALLATION_TYPE_SINGLE && !in_array($host['id'], $our_host_ids)) {
                # this is not the local node
                $cmd = $sudo . 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes -l root ' . qsa($host['host']) . ' ' . qsa($cmd);
            }
            @exec($sudo . $cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
            $ok = $ok && $err == 0;
        }
    }
    if (!$ok) {
        return new GsError('Failed to reload Asterisks.');
    }
    return true;
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:56,代码来源:gs_asterisks_reload.php

示例4: gs_get_listen_to_ids

function gs_get_listen_to_ids($primary_only = false)
{
    /*
    if (gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
    	# return special host ID
    	return array(-1);
    }
    */
    $GS_INSTALLATION_TYPE_SINGLE = gs_get_conf('GS_INSTALLATION_TYPE_SINGLE');
    if (!$GS_INSTALLATION_TYPE_SINGLE) {
        # get our IPs
        #
        $ips = @gs_get_listen_to_ips($primary_only);
        if (!is_array($ips)) {
            # 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, "Failed to get our IP addresses");
            return array();
        }
        if (count($ips) < 1) {
            gs_log(GS_LOG_DEBUG, "We're not configured to listen to any IP addresses");
            return array();
        }
    }
    # connect to db
    # must be to slave db so we can tell our IDs even if the master is down
    #
    $db = gs_db_slave_connect();
    if (!$db) {
        gs_log(GS_LOG_WARNING, "Failed to connect to the database!");
        return array();
    }
    if (!$GS_INSTALLATION_TYPE_SINGLE) {
        # find the corresponding IDs
        #
        $ips_escaped = array();
        foreach ($ips as $ip) {
            $ips_escaped[] = '\'' . $db->escape($ip) . '\'';
        }
        // count($ips) guaranteed to be > 0
        $query = 'SELECT `id` FROM `hosts` WHERE `host` IN (' . implode(',', $ips_escaped) . ')';
    } else {
        $query = 'SELECT `id` FROM `hosts`';
    }
    $rs = $db->execute($query);
    if (!$rs) {
        gs_log(GS_LOG_WARNING, "Database error!");
        return array();
    }
    $ids = array();
    while ($r = $rs->fetchRow()) {
        $ids[] = (int) $r['id'];
    }
    return $ids;
}
开发者ID:rkania,项目名称:GS3,代码行数:56,代码来源:get-listen-to-ids.php

示例5: 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

示例6: _getUser

 function _getUser()
 {
     $user_entered = strToLower(trim(@$_REQUEST['login_user']));
     $pwd_entered = @$_REQUEST['login_pwd'];
     if ($user_entered == '' || $pwd_entered == '') {
         return false;
     }
     if ($user_entered === 'sysadmin' && in_array(gs_get_conf('GS_INSTALLATION_TYPE'), array('gpbx', 'single'), true)) {
         //FIXME
         //Quickhack: sysadmin only valid for /gemeinschaft/setup
         $pin = false;
     } else {
         $db = gs_db_slave_connect();
         if (!$db) {
             return false;
         }
         $pin = $db->executeGetOne('SELECT `pin` FROM `users` WHERE `user`=\'' . $db->escape($user_entered) . '\'');
     }
     return $pin === $pwd_entered ? $user_entered : false;
 }
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:20,代码来源:gemeinschaft.php

示例7: _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

示例8: 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

示例9: str_replace

    echo 'PHP &gt;= 5 required.';
    return;
}
require_once GS_DIR . 'inc/cn_hylafax.php';
include_once GS_DIR . 'inc/util.php';
include_once GS_DIR . 'inc/gs-fns/gs_user_pin_get.php';
echo '<h2>';
if (@$MODULES[$SECTION]['icon']) {
    echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> ';
}
if (count($MODULES[$SECTION]['sub']) > 1) {
    echo $MODULES[$SECTION]['title'], ' - ';
}
echo $MODULES[$SECTION]['sub'][$MODULE]['title'];
echo '</h2>', "\n";
$per_page = (int) gs_get_conf('GS_GUI_NUM_RESULTS');
$page = (int) @$_REQUEST['page'];
$delete = trim(@$_REQUEST['delete']);
if ($delete) {
    fax_kill_job($delete);
}
echo '<script type="text/javascript" src="', GS_URL_PATH, 'js/arrnav.js"></script>', "\n";
?>

<table cellspacing="1">
<thead>
<tr>

<?php 
$jobs_send = fax_get_jobs_send($_SESSION['sudo_user']['name'], gs_user_pin_get($_SESSION['sudo_user']['name']));
$recdate = array();
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:fax_out.php

示例10: _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();
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:31,代码来源:diallog.php

示例11: gs_user_change


//.........这里部分代码省略.........
                    } else {
                        $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");
                        include_once GS_DIR . 'inc/boi-soap/boi-soap.php';
                        $soap_faultcode = null;
                        $ok = gs_boi_update_extension($api, $host['host'], $hp_route_prefix, $sub_ext, $user, $sip_pwd, $pin, $firstname, $lastname, $email, $soap_faultcode);
                        if (!$ok) {
                            gs_db_rollback_trans($db);
                            return new GsError('Failed to add user on new foreign host (SOAP error).');
                        }
                    }
                    break;
                case '':
                    # host does not provide any API
                    gs_log(GS_LOG_NOTICE, 'Adding user ' . $user . ' on foreign host ' . $host['host'] . ' without any API');
                    break;
                default:
                    gs_log(GS_LOG_WARNING, 'Failed to add user ' . $user . ' on foreign host ' . $host['host'] . ' - invalid API "' . $api . '"');
                    gs_db_rollback_trans($db);
                    return new GsError('Failed to add user on foreign host (Invalid API).');
            }
        }
    } else {
        # host did not change
        if ($host['is_foreign']) {
            include_once GS_DIR . 'inc/boi-soap/boi-api.php';
            $api = gs_host_get_api($host['id']);
            switch ($api) {
                case 'm01':
                case 'm02':
                    //if (! class_exists('SoapClient')) {
                    if (!extension_loaded('soap')) {
                        gs_db_rollback_trans($db);
                        return new GsError('Failed to modify user on foreign host (SoapClient not available).');
                    } else {
                        $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");
                        include_once GS_DIR . 'inc/boi-soap/boi-soap.php';
                        $soap_faultcode = null;
                        $ok = gs_boi_update_extension($api, $host['host'], $hp_route_prefix, $sub_ext, $user, $sip_pwd, $pin, $firstname, $lastname, $email, $soap_faultcode);
                        if (!$ok) {
                            gs_db_rollback_trans($db);
                            return new GsError('Failed to modify user on foreign host (SOAP error).');
                        }
                    }
                    break;
                case '':
                    # host does not provide any API
                    gs_log(GS_LOG_NOTICE, 'Modifying user ' . $user . ' on foreign host ' . $host['host'] . ' without any API');
                    break;
                default:
                    gs_log(GS_LOG_WARNING, 'Failed to modify user ' . $user . ' on foreign host ' . $host['host'] . ' - invalid API "' . $api . '"');
                    gs_db_rollback_trans($db);
                    return new GsError('Failed to modify user on foreign host (Invalid API).');
            }
        }
    }
    # commit transaction
    #
    if (!gs_db_commit_trans($db)) {
        return new GsError('Failed to modify user.');
    }
    # new host?
    #
    if ($host['id'] != $old_host_id) {
        # reload dialplan (hints!)
        #
        if (is_array($old_host) && !$old_host['is_foreign']) {
            $ok = @gs_asterisks_prune_peer($ext, array($old_host_id));
            if ($reload) {
                @gs_asterisks_reload(array($old_host_id), true);
            }
        }
        if (!$host['is_foreign']) {
            if ($reload) {
                @gs_asterisks_reload(array($host['id']), true);
            }
        }
    } else {
        $ok = @gs_asterisks_prune_peer($ext, array($host['id']));
    }
    # reboot the phone
    #
    //@ shell_exec( 'asterisk -rx \'sip notify snom-reboot '. $ext .'\' >>/dev/null' );
    @gs_prov_phone_checkcfg_by_ext($ext, true);
    # 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:rkania,项目名称:GS3,代码行数:101,代码来源:gs_user_change.php

示例12: elseif

        } elseif ($key_idx >= 7) {
            # gxp2010
            psetting('P' . (($key_idx - 7) * 4 + 353), subStr($key_def['function'], 1));
            //psetting('P'.(($key_idx-7)*4+354), '');
            //psetting('P'.(($key_idx-7)*4+355), '');
            psetting('P' . (($key_idx - 7) * 4 + 356), $key_def['data']);
        }
    }
}
#####################################################################
#  Override provisioning parameters (group profile)
#####################################################################
$prov_params = null;
$GS_ProvParams = gs_get_prov_params_obj($phone_type);
if ($GS_ProvParams->set_user($user['user'])) {
    if ($GS_ProvParams->retrieve_params($phone_type, array('{GS_PROV_HOST}' => gs_get_conf('GS_PROV_HOST'), '{GS_P_PBX}' => $pbx, '{GS_P_EXTEN}' => $user_ext, '{GS_P_ROUTE_PREFIX}' => $hp_route_prefix, '{GS_P_USER}' => $user['user']))) {
        $prov_params = $GS_ProvParams->get_params();
    }
}
if (!is_array($prov_params)) {
    gs_log(GS_LOG_WARNING, 'Failed to get provisioning parameters (group)');
} else {
    foreach ($prov_params as $param_name => $param_arr) {
        foreach ($param_arr as $param_index => $param_value) {
            if ($param_index == -1) {
                # not an array
                if (!array_key_exists($param_name, $settings)) {
                    # don't set unknown parameters because the order is important
                    gs_log(GS_LOG_NOTICE, "Group prov. param \"{$param_name}\": Unknown parameter");
                    continue;
                }
开发者ID:sebastianertz,项目名称:gemeinschaft-grandstream,代码行数:31,代码来源:settings.php

示例13: 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

示例14: gs_extstate_single

function gs_extstate_single($ext)
{
    if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
        include_once GS_DIR . 'inc/db_connect.php';
        $db = @gs_db_slave_connect();
        if (!$db) {
            gs_log(GS_LOG_FATAL, 'Could not connect to slave DB!');
            return AST_MGR_EXT_UNKNOWN;
        }
        $host = $db->executeGetOne('SELECT `h`.`host`
FROM
	`ast_sipfriends` `s` JOIN
	`users` `u` ON (`u`.`id`=`s`.`_user_id`) JOIN
	`hosts` `h` ON (`h`.`id`=`u`.`host_id`)
WHERE `s`.`name`=\'' . $db->escape($ext) . '\'');
        if (!$host) {
            # not a user
            return AST_MGR_EXT_UNKNOWN;
        }
    } else {
        $host = '127.0.0.1';
    }
    return gs_extstate($host, $ext);
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:24,代码来源:extension-state.php

示例15: _snomCnfXmlEsc

function _snomCnfXmlEsc($str)
{
    return str_replace(array('&', '<', '>', '"'), array('&amp;', '&lt;', '&gt;', '\'\''), $str);
}
function _settings_err($msg = '')
{
    @ob_start();
    echo '<!-- // ', _snomCnfXmlEsc($msg != '' ? str_replace('--', '- -', $msg) : 'Error'), ' // -->', "\n";
    if (!headers_sent()) {
        header('Content-Type: text/plain; charset=utf-8');
        header('Content-Length: ' . (int) @ob_get_length());
    }
    @ob_end_flush();
    exit(1);
}
if (gs_get_conf('GS_SNOM_PROV_M9_ACCOUNTS') < 1) {
    gs_log(GS_LOG_DEBUG, "Snom M9 provisioning not enabled");
    _settings_err('Not enabled.');
}
$requester = gs_prov_check_trust_requester();
if (!$requester['allowed']) {
    _settings_err('No! See log for details.');
}
$mac = preg_replace('/[^0-9A-F]/', '', strToUpper(@$_REQUEST['mac']));
if (strLen($mac) !== 12) {
    gs_log(GS_LOG_NOTICE, "Snom M9 provisioning: Invalid MAC address \"{$mac}\" (wrong length)");
    # don't explain this to the users
    _settings_err('No! See log for details.');
}
if (hexDec(subStr($mac, 0, 2)) % 2 == 1) {
    gs_log(GS_LOG_NOTICE, "Snom M9 provisioning: Invalid MAC address \"{$mac}\" (multicast address)");
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:init-m9.php


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