• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP isGsError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: gs_host_del

function gs_host_del($host, $force = FALSE)
{
    if (!preg_match('/^[0-9\\.]+$/', $host)) {
        return new GsError('Host must be a numeric ID or IP address.');
    }
    $host = gs_host_by_id_or_ip($host);
    if (isGsError($host)) {
        return new GsError($host->getMsg());
    }
    if (!is_array($host)) {
        return new GsError('Cannot retrieve host ID.');
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    $count_users = $db->executeGetOne('SELECT COUNT(`id`) FROM `users` WHERE `host_id`=\'' . $db->escape($host['id']) . '\'');
    if ($count_users > 0) {
        return new GsError('Cannot delete host. Delete ' . $count_users . ' user(s) on this host first.');
    }
    #delete host from all groups
    #
    gs_group_members_purge_by_type('host', array($host['id']));
    # delete host
    #
    $rs = $db->execute('DELETE from `hosts` WHERE `id`=\'' . $db->escape($host['id']) . '\'');
    if (!$rs) {
        return new GsError('Could not delete host ' . $host['id']);
    }
    return true;
}
开发者ID:rkania,项目名称:GS3,代码行数:33,代码来源:gs_host_del.php


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


示例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_prov_group_del

function gs_prov_group_del($id)
{
    $id = (int) $id;
    if ($id < 1) {
        return new GsError('Invalid group ID.');
    }
    $DB = gs_db_master_connect();
    if (!$DB) {
        return new GsError('Could not connect to database.');
    }
    $mptt = new YADB_MPTT($DB, 'user_groups', 'lft', 'rgt', 'id');
    if (GS_BUTTONDAEMON_USE == false) {
        return $mptt->delete($id, true);
    } else {
        $ret = $mptt->delete($id, true);
        if (!isGsError($ret) && $ret) {
            gs_usergroup_remove_ui($id);
        }
        return $ret;
    }
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:21,代码来源:gs_prov_group_del.php


示例5: gs_ivr_target

function gs_ivr_target($typ, $value)
{
    $cmd = '';
    if ($typ == 'announce') {
        $announce_file = gs_sysrec_hash_get($value);
        if (!isGsError($announce_file)) {
            $cmd = 'Background(/opt/gemeinschaft/sys-rec/' . $announce_file . ');';
        }
    } else {
        if ($typ == 'extension') {
            if ($value != '0' && strlen($value) > 0) {
                $cmd = 'goto to-internal-users|' . $value . '|1;';
            }
        } else {
            if ($typ == 'repeat') {
                $cmd = 'jump loop;';
            } else {
                $cmd = 'jump h;';
            }
        }
    }
    return $cmd;
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:23,代码来源:e-ivr.ael.php


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


示例7: gs_ldap_get_first

function gs_ldap_get_first($ldap_conn, $base, $filter = '', $props = array())
{
    $list = gs_ldap_get_list($ldap_conn, $base, $filter, $props, 1);
    if (isGsError($list)) {
        return new GsError($list->getMsg());
    }
    if (!is_array($list)) {
        return new GsError('Failed to get LDAP entries.');
    }
    return reset($list);
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:11,代码来源:ldap.php


示例8: unnecessary

			# delete unnecessary (inherited) entries
			$DB->execute(
				'DELETE FROM `softkeys` '.
				'WHERE '.
					'`phone_type`=\''. $DB->escape($phone_type) .'\' AND '.
					'`function`=\'\'' );
		}
		unset($save_keys);
		if (! $ok) {
			echo '<div class="errorbox">', __('Fehler beim Speichern') ,'</div>' ,"\n";
		}
	}
	
	if ($action === 'save-and-resync') {
		$ret = gs_prov_phone_checkcfg_by_user( @$_SESSION['sudo_user']['name'], false );
		if (isGsError($ret) || ! $ret) {
			// does not happen
			echo '<div class="errorbox">', __('Fehler beim Aktualisieren des Telefons') ,'</div>' ,"\n";
		}
	}
	
	$action = '';  # view
}
#####################################################################
# save }
#####################################################################

#####################################################################
# delete {
#####################################################################
if ($action === 'delete') {
开发者ID:netkom,项目名称:GemeinschaftPBX,代码行数:31,代码来源:inc_keyprof.php


示例9: gs_group_members_get_names

function gs_group_members_get_names($group, $includes = true)
{
    $members = gs_group_members_get(array($group), $includes);
    if (isGsError($members)) {
        gs_script_error($members->getMsg());
    }
    if (!$members) {
        return array();
    }
    $db_slave = gs_db_slave_connect();
    if (!$db_slave) {
        return new GsError('Could not connect to database.');
    }
    if (!$members) {
        return array();
    }
    $type = $db_slave->executeGetOne('SELECT `type` FROM `groups` WHERE `id` = ' . $group . ' LIMIT 1');
    switch ($type) {
        case 'user':
            $sql_query = 'SELECT `user` AS `member` FROM `users` WHERE `id` IN (' . implode(',', $members) . ')';
            break;
        case 'queue':
            $sql_query = 'SELECT `name` AS `member` FROM `ast_queues` WHERE `_id` IN (' . implode(',', $members) . ')';
            break;
        case 'host':
            $sql_query = 'SELECT `host` AS `member` FROM `hosts` WHERE `id` IN (' . implode(',', $members) . ')';
            break;
        default:
            $sql_query = false;
            break;
    }
    $members_a = array();
    if ($sql_query === false) {
        foreach ($members as $member) {
            $r = array();
            $r['type'] = $type;
            $r['member'] = $member;
            $members_a[] = $r;
        }
    } else {
        $rs = $db_slave->execute($sql_query);
        if ($rs) {
            while ($r = $rs->fetchRow()) {
                $r['type'] = $type;
                $members_a[] = $r;
            }
        }
    }
    return $members_a;
}
开发者ID:rkania,项目名称:GS3,代码行数:50,代码来源:group-fns.php


示例10: gs_log

    gs_log(GS_LOG_DEBUG, $errmsg ? $errmsg : 'LDAP lookup: User not found');
    exit(1);
}
if (!is_array($_SESSION) || !@array_key_exists('sudo_user', @$_SESSION) || !@array_key_exists('info', @$_SESSION['sudo_user']) || !@array_key_exists('id', @$_SESSION['sudo_user']['info'])) {
    _not_allowed();
}
if ($_SESSION['real_user']['name'] !== 'sysadmin' && !gs_user_is_admin(@$_SESSION['real_user']['name'])) {
    _not_allowed();
}
if (!array_key_exists('u', $_REQUEST)) {
    _not_found('Username not specified.');
}
$user = $_REQUEST['u'];
include_once GS_DIR . 'inc/gs-fns/gs_ldap_user_search.php';
$user_info = gs_ldap_user_search($user);
if (isGsError($user_info)) {
    _server_error($user_info->getMsg());
}
if (!is_array($user_info)) {
    _server_error('Failed to look up user "' . $user . '" in LDAP.');
}
require_once GS_DIR . 'lib/utf8-normalize/gs_utf_normal.php';
@header('Content-Type: application/json');
# RFC 4627
ob_start();
echo "{\n";
$i = 0;
foreach ($user_info as $k => $v) {
    if ($i > 0) {
        echo ",\n";
    }
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:ldap-user-info.php


示例11: gs_user_external_number_add

function gs_user_external_number_add($user, $number)
{
    if (!preg_match('/^[a-z0-9\\-_.]+$/', $user)) {
        return new GsError('User must be alphanumeric.');
    }
    if (!preg_match('/^[\\d]+$/', $number)) {
        return new GsError('Number must be numeric.');
    }
    # 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.');
    }
    # add number
    #
    switch (GS_EXTERNAL_NUMBERS_BACKEND) {
        case 'ldap':
            $ldap = gs_ldap_connect();
            if (!$ldap) {
                return new GsError('Could not connect to LDAP server.');
            }
            # find ldap user name
            #
            if (GS_LDAP_PROP_UID === GS_LDAP_PROP_USER) {
                $ldap_uid = $user;
                if (gs_get_conf('GS_LVM_USER_6_DIGIT_INT')) {
                    $user = preg_replace('/^0+/', '', $user);
                    # if the usernames in your LDAP are integers without
                    # a leading "0"
                }
            } else {
                if (gs_get_conf('GS_LVM_USER_6_DIGIT_INT')) {
                    $user = preg_replace('/^0+/', '', $user);
                    # if the usernames in your LDAP are integers without
                    # a leading "0"
                }
                $userArr = gs_ldap_get_first($ldap, GS_LDAP_SEARCHBASE, GS_LDAP_PROP_USER . '=' . $user, array(GS_LDAP_PROP_UID));
                if (isGsError($userArr)) {
                    return new GsError($userArr->getMsg());
                }
                if (!is_array($userArr)) {
                    return new GsError('Could not find user by "' . GS_LDAP_PROP_USER . '=' . $user . '" in search base "' . GS_LDAP_SEARCHBASE . '" in LDAP.');
                }
                $ldap_uid = @$userArr[strToLower(GS_LDAP_PROP_UID)][0];
                if (strLen($ldap_uid) < 1) {
                    return new GsError('Could not find user by "' . GS_LDAP_PROP_USER . '=' . $user . '" in search base "' . GS_LDAP_SEARCHBASE . '" in LDAP.');
                }
            }
            $dn = GS_LDAP_PROP_UID . '=' . $ldap_uid . ',' . GS_LDAP_SEARCHBASE;
            $ok = @ldap_mod_add($ldap, $dn, array(GS_EXTERNAL_NUMBERS_LDAP_PROP => $number));
            if (!$ok && @ldap_errNo($ldap) != 20) {
                // err #20 is: "Type or value exists"
                return new GsError('Failed to add number to LDAP user "' . $dn . '". - ' . gs_get_ldap_error($ldap));
                return false;
            }
            break;
        case 'db':
        default:
            $ok = $db->execute('REPLACE INTO `users_external_numbers` (`user_id`, `number`) VALUES (' . $user_id . ', \'' . $db->escape($number) . '\')');
            if (!$ok) {
                return new GsError('Failed to add external number.');
            }
            break;
    }
    return true;
}
开发者ID:rkania,项目名称:GS3,代码行数:73,代码来源:gs_user_external_number_add.php


示例12: _gui_monitor_which_peers_lvm

function _gui_monitor_which_peers_lvm($sudo_user)
{
    $kks = @_get_kostenstellen_lvm($sudo_user);
    if ($kks === false || !is_array($kks)) {
        return false;
    }
    $kostenstelle_prop = 'lvmkostenstelle';
    $limit = 100;
    $filter = '';
    foreach ($kks as $ks) {
        $filter .= '(' . $kostenstelle_prop . '=' . subStr($ks, 0, 2) . '*)';
    }
    $filter = '(|' . $filter . ')';
    //echo $filter, "<br />\n";
    $ldap = gs_ldap_connect();
    $matches = gs_ldap_get_list($ldap, GS_LDAP_SEARCHBASE, $filter, array(GS_LDAP_PROP_USER), (int) $limit);
    if (isGsError($matches)) {
        return false;
    }
    if (!is_array($matches)) {
        return false;
    }
    /*
    echo "<pre>";
    print_r($matches);
    echo "</pre>";
    */
    $lc_GS_LDAP_PROP_USER = strToLower(GS_LDAP_PROP_USER);
    $peers = array();
    foreach ($matches as $match) {
        if (!is_array($match[$lc_GS_LDAP_PROP_USER])) {
            continue;
        }
        foreach ($match[$lc_GS_LDAP_PROP_USER] as $mm) {
            //if (gs_get_conf('GS_LVM_USER_6_DIGIT_INT')) {
            // this check is not really needed as this is a custom function anyway
            $mm = str_pad($mm, 6, '0', STR_PAD_LEFT);
            # without leading "0" in their LDAP database
            //}
            $peers[] = $mm;
        }
    }
    /*
    echo "<pre>";
    print_r($peers);
    echo "</pre>";
    */
    return $peers;
}
开发者ID:rkania,项目名称:GS3,代码行数:49,代码来源:permissions.php


示例13: 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']);
                 }
             }
         }
     }
     /*
     # get the pickup groups
     #
     $pgroups = array();
     $rs = $this->_db->execute(
     	'SELECT DISTINCT(`p`.`id`) `id`, `p`.`title` '.
     	'FROM '.
     		'`pickupgroups_users` `pu` JOIN '.
     		'`pickupgroups` `p` ON (`p`.`id`=`pu`.`group_id`) '.
     	'WHERE `pu`.`user_id`='. ((int)$this->_user_id) .' '.
     	'ORDER BY `p`.`id` '.
     	'LIMIT 10' );
     while ($r = $rs->fetchRow()) {
     	$pgroups[$r['id']] = $r['title'];
     }
     */
     # fix some key definitions
     #
     /*
     foreach ($this->_keys as $key_name => $key_defs) {
     foreach ($key_defs as $inh_slf => $key_def) {
     	
     	# make sure the user does not set keys for pickup groups
     	# which he/she does not belong to
     	#
     	if (in_array($key_def['function'], array('dest', 'blf'), true)     //FIXME for Siemens
     	&&  subStr($key_def['data'],0,2) === '*8') {
     		if (preg_match('/(?:^|[:])\*8\*([0-9]+)/S', $key_def['data'], $m)) {
     			$pgrpid = (int)lTrim($m[1],'0');
     		} else {
     			$pgrpid = 0;
     		}
     		if ($pgrpid > 0) {
     			if (! array_key_exists($pgrpid, $pgroups))
     				$pgrpid = 0;
     		}
     		if ($pgrpid < 1) {
     			unset($this->_keys[$key_name][$inh_slf]);
     		} else {
     			$this->_keys[$key_name][$inh_slf]['data' ] =
     				'*8*'. str_pad($pgrpid,5,'0',STR_PAD_LEFT);
     			$title = mb_subStr(trim($pgroups[$pgrpid]),0,20);
     			$this->_keys[$key_name][$inh_slf]['label'] =
     				'Grp. '. ($title != '' ? $title : $pgrpid);
     			unset($pgroups[$pgrpid]);
     		}
     	}
     }
     }
     */
     //FIXME
     # find free keys for the remaining pickup groups (if any)
     #
     //FIXME ?
     return true;
 }
开发者ID:rkania,项目名称:GS3,代码行数:80,代码来源:gs_keys_get_siemens.php


示例14: gs_url

			<img alt=" " src="<?php 
    echo GS_URL_PATH, 'crystal-svg/16/app/yast_route.png';
    ?>
" />&nbsp;
			<a href="<?php 
    echo gs_url('forwards', 'forwards');
    ?>
"><?php 
    echo __('Rufumleitung');
    ?>
</a>
		</div>
		<div class="td" style="padding:0.0em;">
			<?php 
    $callforwards = gs_callforward_get($_SESSION['sudo_user']['name']);
    if (isGsError($callforwards)) {
        echo $callforwards->getMsg();
    } else {
        /*
        echo "<pre>\n";
        print_r($callforwards);
        echo "</pre>\n";
        */
        $actives = array();
        $internal_always = false;
        $external_always = false;
        foreach ($callforwards as $src => $cfs) {
            foreach ($cfs as $case => $cf) {
                if ($cf['active'] == 'no' || $cf['active'] == '') {
                    continue;
                }
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:home_home.php


示例15: htmlEnt

</td>
	<td>
		<input type="text" name="num-var" id="ipt-num-var"<?php 
echo $disabled;
?>
 value="<?php 
echo htmlEnt($number_var);
?>
" size="25" style="width:200px;" maxlength="25" />
		<div id="ext-num-select-var" style="display:none;">
		&larr;<select name="_ignore-2" id="sel-num-var" onchange="gs_num_sel(this);"<?php 
echo $disabled;
?>
>
<?php 
if (!isGsError($e_numbers) && is_array($e_numbers)) {
    echo '<option value="">', __('einf&uuml;gen &hellip;'), '</option>', "\n";
    foreach ($e_numbers as $e_number) {
        //echo '<option value="', htmlEnt($e_number) ,'">', htmlEnt($e_number) ,'</option>' ,"\n";
        echo '<option value="0', htmlEnt($e_number), '">0', htmlEnt($e_number), '</option>', "\n";
    }
}
?>
		</select>
		</div>
	</td>
</tr>
</tbody>
</table>

<script type="text/javascript">
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:31,代码来源:forwards_forwards.php


示例16: gs_queue_add

function gs_queue_add($name, $title, $maxlen, $host_id_or_ip)
{
    if (!preg_match('/^[\\d]+$/', $name)) {
        return new GsError('Queue extension must be numeric.');
    }
    if (!preg_match('/^[1-9][0-9]{1,5}$/', $name)) {
        return new GsError('Please use 2-5 digit extension.');
    }
    $title = trim($title);
    $maxlen = (int) $maxlen;
    if ($maxlen < 0) {
        return new GsError('Maxlen must be 0 or more.');
    }
    if ($maxlen > 255) {
        return new GsError('Maxlen must be 255 or less.');
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # check if queue exists
    #
    $num = (int) $db->executeGetOne('SELECT COUNT(*) FROM `ast_queues` WHERE `name`=\'' . $db->escape($name) . '\'');
    if ($num > 0) {
        return new GsError('A queue with that extension already exists.');
    }
    # check if SIP user with same name exists
    #
    $num = (int) $db->executeGetOne('SELECT COUNT(*) FROM `ast_sipfriends` WHERE `name`=\'' . $db->escape($name) . '\'');
    if ($num > 0) {
        return new GsError('A SIP user with that extension already exists.');
    }
    # check if host exists
    #
    $host = gs_host_by_id_or_ip($host_id_or_ip);
    if (isGsError($host)) {
        return new GsError($host->getMsg());
    }
    if (!is_array($host)) {
        return new GsError('Unknown host.');
    }
    # add queue
    #
    $ok = $db->execute('INSERT INTO `ast_queues` (
	`_id`,
	`name`,
	`_host_id`,
	`_title`,
	`musicclass`,
	`timeout`,
	`autopause`,
	`setinterfacevar`,
	`periodic_announce_frequency`,
	`announce_frequency`,
	`announce_holdtime`,
	`retry`,
	`maxlen`,
	`strategy`,
	`joinempty`,
	`leavewhenempty`,
	`ringinuse`,
	`early_media`
) VALUES (
	NULL,
	\'' . $db->escape($name) . '\',
	' . (int) $host['id'] . ',
	\'' . $db->escape($title) . '\',
	\'default\',
	15,
	\'no\',
	\'yes\',
	60,
	90,
	\'yes\',
	3,
	' . $maxlen . ',
	\'rrmemory\',
	\'strict\',
	\'yes\',
	\'no\',
	\'' . $db->escape($early_media) . '\'
)');
    if (!$ok) {
        return new GsError('Failed to add queue.');
    }
    return true;
}
开发者ID:rkania,项目名称:GS3,代码行数:89,代码来源:gs_queue_add.php


示例17: gs_url

            echo '<a href="', gs_url($SECTION, $MODULE, null, 'page=' . ($page + 1)), '" title="', __('weiterbl&auml;ttern'), '" id="arr-next">', '<img alt="', __('weiter'), '" src="', GS_URL_PATH, 'crystal-svg/16/act/next.png" />', '</a>', "\n";
        } else {
            echo '<img alt="', __('weiter'), '" src="', GS_URL_PATH, 'crystal-svg/16/act/next_notavail.png" />', "\n";
        }
        ?>
	</th>
</tr>
</thead>
<tbody>

<?php 
        foreach ($groups as $key => $group) {
            $sort_key[$key] = $group['name'];
        }
        array_multisort($sort_key, SORT_ASC, SORT_STRING, $groups);
        if (isGsError($groups)) {
            echo '<tr><td colspan="5">', $groups->getMsg(), '</td></tr>';
        } else {
            $i = 1;
            foreach ($groups as $group) {
                if ($i > $per_page * ($page + 1) || $i < $per_page * $page + 1) {
                    $i++;
                    continue;
                }
                $groups_same_type = gs_group_info_get(false, $group['type']);
                $group_includes_ids = gs_group_includes_get(array($group['id']), true, true);
                $group_includes = gs_group_info_get(array_diff($group_includes_ids, array($group['id'])));
                echo '<tr class="', $i % 2 === 0 ? 'odd' : 'even', '">', "\n";
                echo '<td class="l nobr">';
                echo $group['name'], '</td>', "\n";
                echo '<td>', $group['title'], '</td>', "\n";
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:31,代码来源:admin_gui.php


示例18: elseif

        }
        if (isGsError($ok)) {
            $errMsgs[] = $ok->getMsg();
        } elseif (!$ok) {
            $errMsgs[] = __('Fehler beim Setzen des eigenen Klingeltons.');
        }
    }
    if ($action === 'save-and-resync') {
        $ret = gs_prov_phone_checkcfg_by_user(@$_SESSION['sudo_user']['name'], false);
        if (isGsError($ret) || !$ret) {
            $errMsgs[] = __('Fehler beim Aktualisieren des Telefons');
        }
    }
}
$ringtones = gs_ringtones_get($_SESSION['sudo_user']['name']);
if (isGsError($ringtones)) {
    echo __('Fehler beim Abfragen.'), '<br />', $ringtones->getMsg();
    die;
}
//$cur_phone_type = $DB->executeGetOne( 'SELECT `type` FROM `phones` WHERE `user_id`='. (int)@$_SESSION['sudo_user']['info']['id'] );
?>

<div style="max-width:600px;">
	<img alt=" " src="<?php 
echo GS_URL_PATH;
?>
crystal-svg/16/act/info.png" class="fl" />
	<p style="margin-left:22px;">
		<?php 
echo __('Bitte beachten Sie, da&szlig; die unterst&uuml;tzten Klingelt&ouml;ne stark von dem Endger&auml;t abh&auml;ngig sind, auf dem Sie sich anmelden. Ggf. wird also ein anderer als der hier eingestellte Klingelton gespielt.');
?>
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:31,代码来源:ringtones_ringtones.php


示例19: gs_user_rename

function gs_user_rename($username, $new_username)
{
    if (!preg_match('/^[a-z0-9\\-_.]+$/', $username)) {
        return new GsError('Username must be alphanumeric.');
    }
    $ret = gs_user_is_valid_name($new_username);
    if (isGsError($ret)) {
        return $ret;
    } elseif (!$ret) {
        return new GsError('Invalid new username.');
    }
    if ($new_username === $username) {
        //return new GsError( 'New username = old username.' );
        return true;
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # start transaction
    #
    gs_db_start_trans($db);
    # get user_id
    #
    $user_id = (int) $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($username) . '\'');
    if (!$user_id) {
        gs_db_rollback_trans($db);
        return new GsError("Unknown user \"{$username}\".");
    }
    # check if new username exists
    #
    $user_id_new_test = (int) $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($new_username) . '\'');
    if ($user_id_new_test) {
        gs_db_rollback_trans($db);
        return new GsError("A user with username \"{$new_username}\" already exists.");
    }
    # get host
    #
    $host_id = (int) $db->executeGetOne('SELECT `host_id` FROM `users` WHERE `id`=' . $user_id);
    $host = gs_host_by_id_or_ip($host_id);
    if (isGsError($host) || !is_array($host)) {
        gs_db_rollback_trans($db);
        return new GsError('Host not found.');
    }
    # get info needed for foreign users
    #
    if ($host['is_foreign']) {
        # get user's extension and password
        $rs = $db->execute('SELECT `name`, `secret` FROM `ast_sipfriends` WHERE `_user_id`=' . $user_id);
        if (!$rs || !($r = $rs->fetchRow())) {
            gs_db_rollback_trans($db);
            return new GsError('DB error.');
        }
        $ext = $r['name'];
        $sip_pwd = $r['secret'];
        # get user info
        $rs = $db->execute('SELECT `pin`, `firstname`, `lastname`, `email` FROM `users` WHERE `id`=' . $user_id);
        if (!$rs || !($user_info = $rs->fetchRow())) {
            gs_db_rollback_trans($db);
            return new GsError('DB error.');
        }
    } else {
        $ext = null;
    }
    # update user
    #
    $ok = $db->execute('UPDATE `users` SET `user`=\'' . $db->escape($new_username) . '\' WHERE `id`=' . $user_id);
    if (!$ok) {
        @$db->execute('UPDATE `users` SET `user`=\'' . $db->escape($username) . '\' WHERE `id`=' . $user_id);
        gs_db_rollback_trans($db);
        return new GsError('Failed to rename user.');
    }
    # rename user on foreign host
    #
    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 (!extension_loaded('soap')) {
                    @$db->execute('UPDATE `users` SET `user`=\'' . $db->escape($username) . '\' WHERE `id`=' . $user_id);
                    gs_db_rollback_trans($db);
                    return new GsError('Failed to rename 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, $new_username, $sip_pwd, $user_info['pin'], $user_info['firstname'], $user_info['lastname'], $user_info['email'], $soap_faultcode);
                    if (!$ok) {
                        @$db->execute('UPDATE `users` SET `user`=\'' . $db->escape($username) . '\' WHERE `id`=' . $user_id);
                        gs_db_rollback_trans($db);
                        return new GsError('Failed to rename user on foreign host (SOAP error).');
                    }
                }
                break;
//.........这里部分代码省略.........
开发者ID:rkania,项目名称:GS3,代码行数:101,代码来源:gs_user_rename.php


示例20: gs_get_conf

if (gs_get_conf('GS_PB_IMPORTED_ENABLED')) {
    $pos = (int) gs_get_conf('GS_PB_IMPORTED_ORDER', 9) * 10;
    $tmp[$pos] = array('k' => 'imported', 'v' => gs_get_conf('GS_PB_IMPORTED_TITLE', __("Importiert")));
}
kSort($tmp);
foreach ($tmp as $arr) {
    $typeToTitle[$arr['k']] = $arr['v'];
}
$url_snom_extnumbers = GS_PROV_SCHEME . '://' . GS_PROV_HOST . (GS_PROV_PORT == 80 ? '' : ':' . GS_PROV_PORT) . GS_PROV_PATH . 'snom/extnumbers.php';
$url_snom_menu = GS_PROV_SCHEME . '://' . GS_PROV_HOST . (GS_PROV_PORT ? ':' . GS_PROV_PORT : '') . GS_PROV_PATH . 'snom/menu.php';
#################################### INITIAL SCREEN {
if (!$type) {
    $mac = preg_replace('/[^\\dA-Z]/', '', strToUpper(trim(@$_REQUEST['m'])));
    $user_name = $db->executeGetOne('SELECT `user` FROM `users` WHERE `id`=\'' . $db->escape($user_id) . '\'');
    $enumbers = gs_user_external_numbers_get($user_name);
    if (isGsError($enumbers)) {
        _err('Fehler beim Abfragen.');
    }
    ob_start();
    echo '<?', 'xml version="1.0" encoding="utf-8"?', '>', "\n", '<SnomIPPhoneMenu>', "\n", '<Title>' . __("externe Nummern") . '</Title>', "\n\n";
    foreach ($enumbers as $extnumber) {
        echo '<MenuItem>', "\n", '<Name>', snom_xml_esc($extnumber), '</Name>', "\n", '<URL>', $url_snom_menu, '?t=forward&m=', $mac, '&u=', $user, '</URL>', "\n", '</MenuItem>', "\n\n";
        # in XML the & must normally be encoded as &amp; but not for
        # the stupid Snom!
    }
    defineBackMenu();
    echo '</SnomIPPhoneMenu>', "\n";
    _ob_send();
}
#################################### INITIAL SCREEN }
function defineBackMenu()
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:31,代码来源:extnumbers.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP isHiddenPage函数代码示例发布时间:2022-05-15
下一篇:
PHP isForAdminOnly函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap