//--------------------------------------------------------------------------- if (!gs_get_conf('GS_POLYCOM_PROV_ENABLED')) { gs_log(GS_LOG_DEBUG, 'Polycom provisioning not enabled'); _err('Not enabled.'); } $type = trim(@$_REQUEST['t']); if (!in_array($type, array('forward'), true)) { $type = false; } $user = trim(@$_REQUEST['u']); if (!preg_match('/^\\d+$/', $user)) { _err('Not a valid SIP user.'); } $db = gs_db_slave_connect(); // setup i18n stuff gs_setlang(gs_get_lang_user($db, $user, GS_LANG_FORMAT_GS)); gs_loadtextdomain('gemeinschaft-gui'); gs_settextdomain('gemeinschaft-gui'); $url_polycom_provdir = GS_PROV_SCHEME . '://' . GS_PROV_HOST . (GS_PROV_PORT ? ':' . GS_PROV_PORT : '') . GS_PROV_PATH . 'polycom/'; $url_polycom_menu = $url_polycom_provdir . 'configmenu.php'; #################################### INITIAL SCREEN { if (!$type) { $mac = preg_replace('/[^\\dA-Z]/', '', strtoupper(trim(@$_REQUEST['m']))); $user = trim(@$_REQUEST['u']); ob_start(); echo $phonemenu_doctype . "\n"; echo '<html>', "\n"; echo "<head><title>" . htmlEnt(__("Konfigurationsmenü")) . "</title></head>\n"; echo '<body><br />', "\n"; echo '- <a href="' . $url_polycom_menu . '?m=' . $mac . '&u=' . $user . '&t=forward">' . htmlEnt(__("Rufumleitung")) . '</a><br />', "\n"; echo '- <a href="' . $url_polycom_provdir . 'features.php?m=' . $mac . '&u=' . $user . '&t=forward">' . htmlEnt(__("Dienstmerkmale")) . '</a><br />', "\n";
# superglobal session_name('gemeinschaft-setup'); session_start(); # set language # /* if (array_key_exists('setlang', $_REQUEST)) { $setlang = preg_replace('/[^a-z\d_]/i', '', @$_REQUEST['setlang']); @$_SESSION['lang'] = $setlang; } */ if (array_key_exists('lang', $_SESSION)) { $ret = gs_setlang($_SESSION['lang']); } else { #$ret = gs_setlang( GS_INTL_LANG ); $ret = gs_setlang('de'); } if ($ret) { $_SESSION['lang'] = $ret; } $_SESSION['isolang'] = str_replace('_', '-', $_SESSION['lang']); gs_loadtextdomain('gemeinschaft-gui'); gs_settextdomain('gemeinschaft-gui'); # get step # $step = preg_replace('/[^a-z0-9\\-_]/', '', @$_REQUEST['step']); if ($step == '') { switch ($GS_INSTALLATION_TYPE) { # "system-check" unnecessary for the GPBX case 'gpbx': $step = 'network';
if ($user_id < 1) { snom_textscreen(__('Fehler'), __('Unbekannter Benutzer')); } return $user_id; } if (!gs_get_conf('GS_SNOM_PROV_ENABLED')) { gs_log(GS_LOG_DEBUG, "Snom provisioning not enabled"); snom_textscreen(__('Fehler'), __('Nicht aktiviert')); } $type = trim(@$_REQUEST['t']); if (!in_array($type, array('gs', 'prv', 'imported'), true)) { $type = false; } $db = gs_db_slave_connect(); // setup i18n stuff gs_setlang(gs_get_lang_user($db, trim($_REQUEST['u']), GS_LANG_FORMAT_GS)); gs_loadtextdomain('gemeinschaft-gui'); gs_settextdomain('gemeinschaft-gui'); /* $typeToTitle = array( 'imported' => "Firma (aus LDAP)", 'gs' => "Firma", # should normally be "Gemeinschaft" 'prv' => "Pers\xC3\xB6nlich", ); */ $tmp = array(15 => array('k' => 'gs', 'v' => gs_get_conf('GS_PB_INTERNAL_TITLE', __("Intern"))), 25 => array('k' => 'prv', 'v' => gs_get_conf('GS_PB_PRIVATE_TITLE', __("Persönlich")))); 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', __("Extern"))); } kSort($tmp);
case "500": $phone_has_microbrowser = FALSE; break; default: $phone_has_microbrowser = TRUE; break; } $db = gs_db_slave_connect(); //---debug $user_id = @gs_prov_user_id_by_mac_addr($db, $mac); if (!$user_id) { die; } $userinfo = @gs_prov_get_user_info($db, $user_id); // setup i18n stuff gs_setlang(gs_lang_ast2gs($userinfo["language"])); gs_loadtextdomain('gemeinschaft-gui'); gs_settextdomain('gemeinschaft-gui'); //--- echo the phone directory echo '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . "\n"; if (!$phone_has_microbrowser) { //--- this phone does not have microbrowser capabilities, so create //--- a company directory based on the local users table $query = 'SELECT ' . ' `u`.`lastname` `ln`, `u`.`firstname` `fn`, `s`.`name` `ext` ' . 'FROM ' . ' `users` `u` ' . 'JOIN ' . ' `ast_sipfriends` `s` ON (`s`.`_user_id`=`u`.`id`) ' . 'WHERE ' . ' `u`.`pb_hide` = 0 ' . ' AND `u`.`nobody_index` IS NULL ' . 'ORDER BY `u`.`lastname`, `u`.`firstname`'; $rs = $db->execute($query); if ($rs->numRows() !== 0) { echo '<directory>', "\n"; echo ' <item_list>', "\n"; while ($r = $rs->fetchRow()) { echo ' <item>', "\n"; echo ' <fn>' . $r['fn'] . '</fn>', "\n";
//FIXME - works for "de-de" but not for "de" - fix gs_setlang()? if ($ret) { $_SESSION['lang'] = $ret; //echo " worked ($ret) "; break; } } } unset($accept_langs, $accept_lang, $qval, $ret); } } } if (!array_key_exists('lang', $_SESSION)) { $_SESSION['lang'] = GS_INTL_LANG; } $ret = gs_setlang($_SESSION['lang']); if ($ret) { $_SESSION['lang'] = $ret; } $_SESSION['isolang'] = gs_lang_name_internal($_SESSION['lang']); gs_loadtextdomain('gemeinschaft-gui'); gs_settextdomain('gemeinschaft-gui'); # functions to map from some legacy user name to the current one # //FIXME - this custom function should probably somehow be moved to // /etc/gemeinschaft/custom-functions.php or // /etc/gemeinschaft/custom-functions.examples.php function _gs_legacy_user_map_lvm($user) { global $dispatcher_errors_html; if (!$user) {