function _get_userid() { global $_SERVER, $db; $remote_addr = @$_SERVER['REMOTE_ADDR']; $user_id = (int) $db->executeGetOne('SELECT `id` FROM `users` WHERE `current_ip`=\'' . $db->escape($remote_addr) . '\''); if ($user_id < 1) { snom_textscreen(__('Fehler'), __('Unbekannter Benutzer')); } return $user_id; }
function _get_user_ext($user_id) { $db = gs_db_slave_connect(); $user_ext = $db->executeGetOne('SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`=\'' . $db->escape($user_id) . '\''); if (!$user_ext) { snom_textscreen(__('Fehler'), __('Unbekannter Benutzer.')); return false; } return $user_ext; }
function getUserID($ext) { global $db; if (!preg_match('/^\\d+$/', $ext)) { snom_textscreen(__('Fehler'), snom_xml_esc(__('Ungültiger Benutzername'))); } $user_id = (int) $db->executeGetOne('SELECT `_user_id` FROM `ast_sipfriends` WHERE `name`=\'' . $db->escape($ext) . '\''); if ($user_id < 1) { snom_textscreen(__('Fehler'), __('Benutzer unbekannt')); } return $user_id; }
function _err($msg = '') { snom_textscreen('Error', $msg != '' ? $msg : 'Unknown error'); exit(1); }
$db = gs_db_slave_connect(); # get user_id # $user_id = (int) $db->executeGetOne('SELECT `_user_id` FROM `ast_sipfriends` WHERE `name`=\'' . $db->escape($user) . '\''); if ($user_id < 1) { snom_textscreen(__('Fehler'), __('Unbekannter Benutzer')); } # user/ip/mac check $user_id_check = $db->executeGetOne('SELECT `user_id` FROM `phones` WHERE `mac_addr`=\'' . $db->escape($mac) . '\''); if ($user_id != $user_id_check) { snom_textscreen(__('Fehler'), __('Keine Berechtigung')); } $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) { snom_textscreen(__('Fehler'), __('Keine Berechtigung')); } unset($remote_addr_check); unset($remote_addr); unset($user_id_check); // setup i18n stuff gs_setlang(gs_get_lang_user($db, $user, GS_LANG_FORMAT_GS)); gs_loadtextdomain('gemeinschaft-gui'); gs_settextdomain('gemeinschaft-gui'); $typeToTitle = array('out' => __("Gewählt"), 'missed' => __("Verpasst"), 'in' => __("Angenommen"), 'qmissed' => __("WS Verpasst"), 'qin' => __("WS Angenommen")); if ($type == 'qin' || $type == 'qmissed') { $is_queue = true; } else { $is_queue = false; } ob_start();