コード例 #1
0
ファイル: pb.php プロジェクト: hehol/GemeinschaftPBX
    $xml .= '</SoftKey>' . "\n";
    $xml .= '<SoftKey index="4">' . "\n";
    $xml .= '	<Label>' . __('Abbrechen') . '</Label>' . "\n";
    $xml .= '	<URI>SoftKey:Exit</URI>' . "\n";
    $xml .= '</SoftKey>' . "\n";
    $xml .= '<SoftKey index="3">' . "\n";
    $xml .= '	<Label>&lt;&lt;</Label>' . "\n";
    $xml .= '	<URI>' . $url_aastra_pb . '?t=gs</URI>' . "\n";
    $xml .= '</SoftKey>' . "\n";
    $xml .= '<SoftKey index="6">' . "\n";
    $xml .= '	<Label>&gt;&gt;</Label>' . "\n";
    $xml .= '	<URI>SoftKey:Select</URI>' . "\n";
    $xml .= '</SoftKey>' . "\n";
    $xml .= '</AastraIPPhoneFormattedTextScreen>' . "\n";
} elseif ($type === 'importeds') {
    $user_id = _get_userid();
    $user_groups = gs_group_members_groups_get(array($user_id), 'user');
    $xml = '<AastraIPPhoneFormattedTextScreen destroyOnExit="yes" cancelAction="' . $url_aastra_pb . '?t=prv">' . "\n";
    $query = 'SELECT
	`id`, `lastname` `ln`, `firstname` `fn`, `number`
FROM
	`pb_ldap`
WHERE
	`group_id` IN (' . implode(',', $user_groups) . ') AND
	`id`=' . $entry;
    $rs = $db->execute($query);
    if ($rs->numRows() !== 0) {
        $r = $rs->fetchRow();
        $xml .= '<Line Align="left">' . $r['ln'] . ' ' . $r['fn'] . '</Line>' . "\n";
        $xml .= '<Line Align="right" Size="double">' . $r['number'] . '</Line>' . "\n";
    }
コード例 #2
0
ファイル: dnd.php プロジェクト: rkania/GS3
        _err('Unknown user.');
    }
    return $user_id;
}
if (!gs_get_conf('GS_AASTRA_PROV_ENABLED')) {
    gs_log(GS_LOG_NOTICE, 'Aastra provisioning not enabled');
    _err('Not enabled.');
}
$db = gs_db_master_connect();
$prov_url_aastra = GS_PROV_SCHEME . '://' . GS_PROV_HOST . (GS_PROV_PORT ? ':' . GS_PROV_PORT : '') . GS_PROV_PATH . 'aastra/';
$ua = trim(@$_SERVER['HTTP_USER_AGENT']);
if (preg_match('/\\sMAC:(00-08-5D-\\w{2}-\\w{2}-\\w{2})\\s/', $ua, $m)) {
    $mac = preg_replace('/[^0-9A-F]/', '', strToUpper($m[1]));
}
$user = trim(@$_REQUEST['u']);
$user_id = _get_userid($user);
$user_id_check = $db->executeGetOne("SELECT `user_id` FROM `phones` WHERE `mac_addr`='" . $db->escape($mac) . "'");
if ($user_id != $user_id_check) {
    _err("Not authorized");
}
$remote_addr = @$_SERVER["REMOTE_ADDR"];
$remote_addr_check = $db->executeGetOne("SELECT `current_ip` FROM `users` WHERE `id`='" . $user_id . "'");
if ($remote_addr != $remote_addr_check) {
    _err("Not authorized");
}
$current_dndstate = $db->executeGetOne("SELECT `active` FROM `dnd` WHERE `_user_id`=" . $user_id);
if ($current_dndstate == 'yes') {
    $check = $db->execute("INSERT INTO `dnd`\n\t\t(`_user_id`, `active`) VALUES\n\t\t(" . $user_id . ", 'no') \n\t\tON DUPLICATE KEY UPDATE `active` = 'no'");
    if (!$check) {
        _err('Failed to set new DND state.');
    }