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


PHP isGsError函数代码示例

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


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


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