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


PHP qsa函数代码示例

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


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

示例1: _getHostByAddr_timeout

function _getHostByAddr_timeout($ip, $timeout = 2, $fallback = false)
{
    static $host_bin = null;
    if ($host_bin === null) {
        $host_bin = find_executable('host', array('/usr/bin/', '/usr/sbin/', '/bin/', '/sbin/'));
        if (empty($host_bin)) {
            $host_bin = false;
        }
    }
    if ($host_bin) {
        $err = 0;
        $out = array();
        exec('LANG=C ' . $host_bin . ' -W ' . (int) abs($timeout) . ' ' . qsa($ip) . ' 2>>/dev/null', $out, $err);
        if ($err == 0) {
            if (preg_match('/pointer ([a-z0-9.\\-_]+)/i', implode("\n", $out), $m)) {
                $host = $m[1];
                if (subStr($host, -1) === '.') {
                    $host = subStr($host, 0, -1);
                }
                return $host;
            }
        }
    } else {
        if ($fallback) {
            $host = getHostByAddr($ip);
            if (empty($host) || $host == $ip) {
                return false;
            }
            return $host;
        }
    }
    return false;
}
开发者ID:rkania,项目名称:GS3,代码行数:33,代码来源:system_hosts-foreign.php

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

示例3: gs_user_logout

function gs_user_logout($user, $reboot = true)
{
    $ret = gs_user_is_valid_name($user);
    if (isGsError($ret)) {
        return $ret;
    } elseif (!$ret) {
        return new GsError('Invalid username.');
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get user_id
    #
    $user_id = $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($user) . '\'');
    if ($user_id < 1) {
        return new GsError('Unknown user.');
    }
    $ip_addr = $db->executeGetOne('SELECT `current_ip` FROM `users` WHERE `id`=' . $user_id);
    $rs = $db->execute('SELECT `id`, `mac_addr`, `nobody_index` FROM `phones` WHERE `user_id`=' . $user_id);
    while ($phone = $rs->fetchRow()) {
        # assign the default nobody
        #
        $phone['nobody_index'] = (int) $phone['nobody_index'];
        if ($phone['nobody_index'] < 1) {
            $new_user_id = null;
        } else {
            $new_user_id = (int) $db->executeGetOne('SELECT `id` FROM `users` WHERE `nobody_index`=' . $phone['nobody_index']);
            if ($new_user_id < 1) {
                //?
            }
        }
        $db->execute('UPDATE `phones` SET `user_id`=' . ($new_user_id > 0 ? $new_user_id : 'NULL') . ' WHERE `id`=' . (int) $phone['id'] . ' AND `user_id`=' . $user_id);
    }
    # log out of all queues
    #
    $user_ext = $db->executeGetOne('SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`=' . $user_id);
    $user_ext = preg_replace('/[^0-9]/', '', $user_ext);
    if ($user_ext != '') {
        ob_start();
        @exec(GS_DIR . 'dialplan-scripts/fake-agi-env.php' . ' ' . qsa(GS_DIR . 'dialplan-scripts/queue-login-logout.agi') . ' ' . qsa($user_ext) . ' 0 logoutall 1>>/dev/null 2>>/dev/null');
        ob_end_clean();
    }
    # restart phone
    #
    if ($ip_addr != '') {
        $ret = @gs_prov_phone_checkcfg_by_ip($ip_addr, $reboot);
    }
    if (isGsError($ret)) {
        gs_script_error($ret->getMsg());
    }
    return true;
}
开发者ID:rkania,项目名称:GS3,代码行数:55,代码来源:gs_user_logout.php

示例4: conv_ringtone

 function conv_ringtone($infile, $outbase)
 {
     $outfile = $outbase . '.wav';
     if (is_executable('/usr/local/bin/mpg123')) {
         $mpg123 = '/usr/local/bin/mpg123';
     } elseif (is_executable('/usr/bin/mpg123')) {
         $mpg123 = '/usr/bin/mpg123';
     } elseif (is_executable('/bin/mpg123')) {
         $mpg123 = '/bin/mpg123';
     } else {
         $mpg123 = 'mpg123';
     }
     if (strToLower(subStr($infile, -4, 4)) === '.mp3') {
         # convert mp3 to wav first
         $wavfile = $infile . '.wav';
         $cmd = $mpg123 . ' -m -w - -n 1000 -q ' . qsa($infile) . ' > ' . qsa($wavfile) . ' 2>>/dev/null';
         # cuts file after 1000 frames (around 2.3 MB, depending on the rate)
         # don't use -r 8000 as that doesn't really work for VBR encoded MP3s
         @exec($cmd, $out, $err);
         if ($err != 0) {
             if (is_file($wavfile)) {
                 @unlink($wavfile);
             }
             return false;
         }
         $infile = $wavfile;
         $rm_tmp = $wavfile;
     } else {
         $rm_tmp = false;
     }
     $cmd = 'sox ' . qsa($infile) . ' -c 1 -U ' . qsa($outfile) . ' rate 8000 trim 0 200000s 2>>/dev/null';
     # WAV, uLaw, 8 kHz, 16 bit, mono
     # "The time for loading the file should not be longer then 3 seconds.
     # Size < 200 KByte."
     # cuts file after 200000 samples (around 200 kB)
     @exec($cmd, $out, $err);
     if ($err != 0) {
         # $err == 2 would be unknown format
         if (is_file($outfile)) {
             @unlink($outfile);
         }
         if ($rm_tmp && is_file($rm_tmp)) {
             @unlink($rm_tmp);
         }
         return false;
     }
     return $outfile;
     //return false;
     //return null;  # not implemented
 }
开发者ID:bhepp,项目名称:kazoo-provision,代码行数:50,代码来源:capability.php

示例5: remote_exec

function remote_exec($host, $cmd, $timeout = 10, &$out, &$err)
{
    $host = trim($host);
    if ($host == '') {
        return false;
    }
    $cmd = trim($cmd);
    if ($cmd == '') {
        return false;
    }
    $full_cmd = GS_DIR . 'sbin/remote-exec-do ' . qsa($host) . ' ' . qsa($cmd) . ' ' . (int) $timeout;
    @exec($full_cmd, $buf_out, $buf_err);
    $out = $buf_out;
    $err = (int) $buf_err;
    return true;
}
开发者ID:rkania,项目名称:GS3,代码行数:16,代码来源:remote-exec.php

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

示例7: gs_asterisks_prune_peer

function gs_asterisks_prune_peer($peer, $host_ids = false)
{
    if (!$host_ids || !is_array($host_ids)) {
        $host_ids = false;
    }
    # check peer
    if ($peer === 'all' || $peer == '') {
        $peer = 'all';
    } elseif (!preg_match('/^[1-9][0-9]{1,9}$/', $peer)) {
        return new GsError('Invalid peer name.');
    }
    # 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 = 'asterisk -rx \'sip prune realtime ' . $peer . '\' ';
            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 prune peer "' . $peer . '".');
    }
    return true;
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:61,代码来源:gs_asterisks_prune_peer.php

示例8: qsa

	`key_7_value`     = \'' . $value['key_7_value'] . '\',
	`key_8_type`      = \'' . $value['key_8_type'] . '\',
	`key_8_value`     = \'' . $value['key_8_value'] . '\',
	`key_9_type`      = \'' . $value['key_9_type'] . '\',
	`key_9_value`     = \'' . $value['key_9_value'] . '\',
	`key_pound_type`  = \'' . $value['key_pound_type'] . '\',
	`key_pound_value` = \'' . $value['key_pound_value'] . '\',
	`key_star_type`   = \'' . $value['key_star_type'] . '\',
	`key_star_value`  = \'' . $value['key_star_value'] . '\',
	`t_action_type`   = \'' . $value['key_t_type'] . '\',
	`t_action_value`  = \'' . $value['key_t_value'] . '\',
	`i_action_type`   = \'' . $value['key_i_type'] . '\',
	`i_action_value`  = \'' . $value['key_i_value'] . '\'
WHERE `id`=' . $ivr_id);
    }
    @exec('sudo ' . qsa(GS_DIR . 'sbin/start-asterisk') . ' --dialplan' . ' 1>>/dev/null 2>>/dev/null &');
    $action = 'edit';
}
#####################################################################
#                               save }
#####################################################################
#####################################################################
#                               edit {
#####################################################################
if ($action === 'edit') {
    /*	
    	// its also possible to make a target selection for the keys for queue, user, ivr 
    	// but proberly bad when having lots of users
    	$rs = $DB->execute( 'SELECT `name` FROM `ast_queues`');
    	$queues_ext = array();
    	while ($r = $rs->fetchRow()) {
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:admin_ivrs.php

示例9: subStr

            &&  $info['orig_mbox'] != '') {
            	$id3_comment .= '<< '.$info['orig_mbox'];
            }
            */
            $id3_comment = subStr(_to_id3tag_ascii($id3_comment), 0, 28);
            $sox = find_executable('sox', array('/usr/bin/', '/usr/local/bin/', '/usr/sbin/', '/usr/local/sbin/'));
            if (!$sox) {
                gs_log(GS_LOG_WARNING, 'sox - command not found.');
                _server_error('Failed to convert file.');
            }
            $lame = find_executable('lame', array('/usr/local/bin/', '/usr/bin/', '/usr/local/sbin/', '/usr/sbin/'));
            if (!$lame) {
                gs_log(GS_LOG_WARNING, 'lame - command not found.');
                _server_error('Failed to convert file.');
            }
            $cmd = $sox . ' -q -t al ' . qsa($origfile) . ' -r 8000 -c 1 -s -b 16 -t wav - 2>>/dev/null | ' . $lame . ' --preset fast standard -m m -a -b 32 -B 96 --quiet --ignore-tag-errors --tt ' . qsa($id3_title) . ' --ta ' . qsa($id3_artist) . ' --tl ' . qsa($id3_album) . ' --tc ' . qsa($id3_comment) . ' --tg 101 - ' . qsa($outfile) . ' 2>&1 1>>/dev/null';
            # (ID3 tag genre 101 = "Speech")
            $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.');
            }
            $DB->execute('UPDATE
	`vm_msgs` SET `listened_to`=1
WHERE
	`id`=' . (int) @$_GET['id']);
            @header('Content-Type: audio/mpeg');
            $fake_filename = preg_replace('/[^0-9a-z\\-_.]/i', '', 'vm_' . $userinfo['ext'] . '_' . date('Ymd_Hi', $r['ts']) . '_' . subStr(md5(date('s', $r['ts']) . $r['cidnum']), 0, 4) . '.mp3');
            @header('Content-Disposition: ' . ($attach ? 'attachment' : 'inline') . '; filename="' . $fake_filename . '"');
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:31,代码来源:index.php

示例10: implode

                $DB->execute($query);
            }
        }
        if (count($sql_values) > 0) {
            $query = $query_start . implode(",\n", $sql_values);
            $sql_values = array();
            $DB->execute($query);
        }
        //$ok = (gs_get_conf('GS_DB_MASTER_TRANSACTIONS') ? @$DB->completeTrans() : true);
        $ok = gs_db_commit_trans($DB);
        $file = @$_SESSION['sudo_user']['pb-csv-file'];
        @($_SESSION['sudo_user']['pb-csv-file'] = null);
        if (@is_file($file)) {
            $err = 0;
            $out = array();
            @exec('rm -f ' . qsa($file));
        }
        echo '<br />', "\n";
        echo '<p class="text">', $ok ? __('Die Daten wurden in Ihr pers&ouml;nliches Telefonbuch importiert.') : 'DB Error.', '</p>', "\n";
    }
}
if ($action == '') {
    echo "<h3>" . __('CSV-Export') . "</h3>\n<br />";
    echo '<a href="', GS_URL_PATH, 'srv/csv-export.php', $sudo_url, '" title="', __('CSV-Datei des Telefonbuches herunterladen'), '">' . __('CSV-Datei herunterladen') . '</a>';
    echo "<br /><br /><br /><h3>" . __('CSV-Import') . "</h3>\n<br />";
    echo '<form method="post" action="', GS_URL_PATH, '" enctype="multipart/form-data">', "\n";
    echo gs_form_hidden($SECTION, $MODULE), "\n";
    echo '<input type="hidden" name="action" value="upload" />', "\n";
    echo '<p class="text">', __('Sie haben hier die M&ouml;glichkeit, eine Datei im CSV-Format hochzuladen, um die Eintr&auml;ge in Ihr pers&ouml;nliches Telefonbuch zu &uuml;bernehmen.'), '</p>', "\n";
    echo '<p class="text">', __('Vor dem Import der Datens&auml;tze wird Ihnen zur Kontrolle eine Vorschau angezeigt.'), '</p>', "\n";
    echo '<p class="text">', htmlEnt(__("In der Vorschau kann eingestellt werden, ob das bestehende Telefonbuch erweitert oder ersetzt werden soll.")), '</p>', "\n";
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:31,代码来源:pb_csvimport.php

示例11: gs_keyval_set

function gs_keyval_set($key, $val)
{
    if (!gs_keyval_is_valid_key($key)) {
        return false;
    }
    if ($val === gs_keyval_get($key)) {
        return true;
    }
    # unchanged
    /*
    $val = gs_keyval_enc($val);
    $fh = @fOpen( '/var/lib/gemeinschaft/vars/'.$key, 'wb' );
    if (! $fh) return false;
    @stream_set_write_buffer($fh, 0);
    $ok = (bool)@fWrite($fh, $val, strLen($val));
    @fClose($fh);
    return $ok;
    */
    $cmd = 'echo -n ' . qsa(gs_keyval_enc($val)) . ' > ' . qsa('/var/lib/gemeinschaft/vars/' . $key) . ' 2>>/dev/null';
    $err = 0;
    $out = array();
    @exec('sudo sh -c ' . qsa($cmd) . ' 2>>/dev/null', $out, $err);
    return $err === 0;
}
开发者ID:rkania,项目名称:GS3,代码行数:24,代码来源:keyval.php

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

示例13: strToLower

$lang = strToLower(subStr($lang, 0, 2));
switch ($lang) {
    case 'de':
        $l = array('de_DE.UTF-8', 'de_DE.utf8', 'de_DE.iso88591', 'de_DE.iso885915@euro', 'de_DE.ISO8859-1', 'de_DE.ISO8859-15', 'de_DE@euro', 'de_DE', 'de');
        break;
    case 'en':
        $l = array('en_US.utf8', 'en_US.iso88591', 'en_US.ISO8859-1', 'en_US.US-ASCII', 'en_US', 'en');
        break;
    default:
        $l = array('C');
}
$lfound = setLocale(LC_TIME, $l);
if ($lfound === false) {
    $err = 0;
    $out = array();
    exec('locale -a | grep -i ' . qsa('^' . $lang . '_') . ' 2>>/dev/null', $out, $err);
    if ($err != 0) {
        gs_log(GS_LOG_NOTICE, 'Failed to find locales on your system');
    } else {
        $lfound = setLocale(LC_TIME, $out);
        if ($lfound === false) {
            gs_log(GS_LOG_NOTICE, 'Your system does not have any locales like "' . $lang . '_*"');
        } else {
            gs_log(GS_LOG_NOTICE, 'Using locale "' . $lfound . '" as a fallback');
        }
    }
}
$wdays = array('mo' => 'Mon', 'tu' => 'Tue', 'we' => 'Wed', 'th' => 'Thu', 'fr' => 'Fri', 'sa' => 'Sat', 'su' => 'Sun');
$wdaysl = array();
foreach ($wdays as $col => $wdca) {
    $wdaysl[$col] = mb_subStr(strFTime('%a', strToTime('last ' . $wdca)), 0, 1);
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:routing_inbound.php

示例14: distribute_remove

function distribute_remove($localfile)
{
	global $errormsgs;

	$hostlist = gs_hosts_get();
	$thishost = @gs_get_listen_to_ids();

	foreach($hostlist as $currenthost)
	{
		unset($islocalhost);
		$islocalhost = FALSE;

		foreach($thishost as $hostid)
		{
			if($currenthost["id"] == $hostid) $islocalhost = TRUE;
		}

		if($islocalhost == FALSE)
		{
			unset($cmd);
			$cmd = "sudo ssh -o StrictHostKeyChecking=no -o BatchMode=yes -l root ". qsa($currenthost["host"]) ." ". qsa("rm ". qsa($localfile));
			@exec($cmd ." 1>>/dev/null 2>>/dev/null", $out, $err);
			if($err != 0)
			{
				gs_log(GS_LOG_WARNING, "Failed to remove system recording '". $localfile ."' from ". $currenthost["host"]);
				$errormsgs[] = sprintf(__('Audiodatei kann nicht von Node %s gel&ouml;scht werden'), $currenthost["host"]);
			}
		}
	}
}
开发者ID:netkom,项目名称:GemeinschaftPBX,代码行数:30,代码来源:admin_sysrecs.php

示例15: while

    $rs = $DB->execute('SELECT `host` FROM `hosts` WHERE `is_foreign` = 0');
    while ($r = $rs->fetchRow()) {
        /*
        if ($r['host'] === '127.0.0.1') {  //FIXME
        	gs_log(GS_LOG_DEBUG, "Reloading local Asterisk");
        	echo "Reloading <b>local</b> Asterisk\n";
        	@ob_flush(); @flush();
        	passThru( 'sudo '. qsa(GS_DIR.'sbin/start-asterisk'), $err );
        }
        else {
        */
        gs_log(GS_LOG_DEBUG, "Reloading Asterisk on " . $r['host']);
        echo "Reloading Asterisk on <b>", $r['host'], "</b>\n";
        @ob_flush();
        @flush();
        passThru('sudo ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=8 -l root ' . qsa($r['host']) . ' ' . qsa(GS_DIR . 'sbin/start-asterisk'), $err);
        /*
        }
        */
        echo "\n", '&rarr; <b>', $err == 0 ? 'OK' : 'ERR', '</b>', "\n\n";
    }
    @ob_implicit_flush(0);
    echo '</pre>';
}
/*
elseif ($action === 'shutdown' && $shutdown_enabled) {
?>
<form method="post" action="<?php echo GS_URL_PATH; ?>">
<?php echo gs_form_hidden($SECTION, $MODULE); ?>
<input type="hidden" name="action" value="shutdown2" />
<br />
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:31,代码来源:admin_reload.php


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