private static function setLanguage() { if (!Session::get('application-language')) { $lang = get_browser_language(); # Set the language in_array($lang, Config::get('language')['allowed-languages']) ? Session::set('application-language', $lang) : Session::set('application-language', Config::get('language')['default-language']); } include_once ROOT . DS . 'app' . DS . 'languages' . DS . Session::get('application-language') . '.php'; Lang::set($marianaFrameworkLanguageArray); }
/** * @brief Returns the best language for which also a translation exists. * * This function takes the results from get_browser_language() and compares it * with the available translations and returns the best fitting language for * which there exists a translation. * * If there is no match fall back to config['system']['language'] * * @return Language code in 2-letter ISO 639-1 (en). */ function get_best_language() { $langs = get_browser_language(); if (isset($langs) && count($langs)) { foreach ($langs as $lang => $v) { $lang = strtolower($lang); if (file_exists("view/{$lang}") && is_dir("view/{$lang}")) { $preferred = $lang; break; } } } if (isset($preferred)) { return $preferred; } $a = get_app(); return isset($a->config['system']['language']) ? $a->config['system']['language'] : 'en'; }
/** * @brief Returns the best language for which also a translation exists. * * This function takes the results from get_browser_language() and compares it * with the available translations and returns the best fitting language for * which there exists a translation. * * If there is no match fall back to config['system']['language'] * * @return Language code in 2-letter ISO 639-1 (en). */ function get_best_language() { $langs = get_browser_language(); if (isset($langs) && count($langs)) { foreach ($langs as $lang => $v) { $lang = strtolower($lang); if (is_dir("view/{$lang}")) { $preferred = $lang; break; } } } if (!isset($preferred)) { $preferred = 'unset'; } $arr = array('langs' => $langs, 'preferred' => $preferred); call_hooks('get_best_language', $arr); if ($arr['preferred'] !== 'unset') { return $arr['preferred']; } return isset(App::$config['system']['language']) ? App::$config['system']['language'] : 'en'; }
<select name="admin_LANGUAGE" id="admin_language"> <?php reset($languages); while (list($key, $val) = each($languages)) { echo "<option value=\"" . $val . "\""; if ($val == $s['LANGUAGE']) { echo " selected=\"selected\""; } echo ">" . $key . "</option>\n"; } ?> </select><br /> <?php etranslate("Your browser default language is"); echo " "; etranslate(get_browser_language()); echo "."; ?> </td></tr> <tr><td class="tooltip" title="<?php etooltip("fonts-help"); ?> "> <label for="admin_fonts"><?php etranslate("Fonts"); ?> :</label></td><td> <input type="text" size="40" name="admin_FONTS" id="admin_fonts" value="<?php echo htmlspecialchars($FONTS); ?> " />
/** * Creates a new user. * * @param string $login * @param string $password * @param string $mail_adress * @param bool $notify_admin * @param array &$errors populated with error messages * @param bool $notify_user * @return int|false user id or false */ function register_user($login, $password, $mail_address, $notify_admin = true, &$errors = array(), $notify_user = false) { global $conf; if ($login == '') { $errors[] = l10n('Please, enter a login'); } if (preg_match('/^.* $/', $login)) { $errors[] = l10n('login mustn\'t end with a space character'); } if (preg_match('/^ .*$/', $login)) { $errors[] = l10n('login mustn\'t start with a space character'); } if (get_userid($login)) { $errors[] = l10n('this login is already used'); } if ($login != strip_tags($login)) { $errors[] = l10n('html tags are not allowed in login'); } $mail_error = validate_mail_address(null, $mail_address); if ('' != $mail_error) { $errors[] = $mail_error; } if ($conf['insensitive_case_logon'] == true) { $login_error = validate_login_case($login); if ($login_error != '') { $errors[] = $login_error; } } $errors = trigger_change('register_user_check', $errors, array('username' => $login, 'password' => $password, 'email' => $mail_address)); // if no error until here, registration of the user if (count($errors) == 0) { $insert = array($conf['user_fields']['username'] => pwg_db_real_escape_string($login), $conf['user_fields']['password'] => $conf['password_hash']($password), $conf['user_fields']['email'] => $mail_address); single_insert(USERS_TABLE, $insert); $user_id = pwg_db_insert_id(); // Assign by default groups $query = ' SELECT id FROM ' . GROUPS_TABLE . ' WHERE is_default = \'' . boolean_to_string(true) . '\' ORDER BY id ASC ;'; $result = pwg_query($query); $inserts = array(); while ($row = pwg_db_fetch_assoc($result)) { $inserts[] = array('user_id' => $user_id, 'group_id' => $row['id']); } if (count($inserts) != 0) { mass_inserts(USER_GROUP_TABLE, array('user_id', 'group_id'), $inserts); } $override = array(); if ($language = get_browser_language()) { $override['language'] = $language; } create_user_infos($user_id, $override); if ($notify_admin and $conf['email_admin_on_new_user']) { include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php'; $admin_url = get_absolute_root_url() . 'admin.php?page=user_list&username='******'User: %s', stripslashes($login)), get_l10n_args('Email: %s', $mail_address), get_l10n_args(''), get_l10n_args('Admin: %s', $admin_url)); pwg_mail_notification_admins(get_l10n_args('Registration of %s', stripslashes($login)), $keyargs_content); } if ($notify_user and email_check_format($mail_address)) { include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php'; $keyargs_content = array(get_l10n_args('Hello %s,', stripslashes($login)), get_l10n_args('Thank you for registering at %s!', $conf['gallery_title']), get_l10n_args('', ''), get_l10n_args('Here are your connection settings', ''), get_l10n_args('', ''), get_l10n_args('Link: %s', get_absolute_root_url()), get_l10n_args('Username: %s', stripslashes($login)), get_l10n_args('Password: %s', stripslashes($password)), get_l10n_args('Email: %s', $mail_address), get_l10n_args('', ''), get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address())); pwg_mail($mail_address, array('subject' => '[' . $conf['gallery_title'] . '] ' . l10n('Registration'), 'content' => l10n_args($keyargs_content), 'content_format' => 'text/plain')); } trigger_notify('register_user', array('id' => $user_id, 'username' => $login, 'email' => $mail_address)); return $user_id; } else { return false; } }
function authenticate_success($user_record, $login_initial = false, $interactive = false, $login_refresh = false) { $a = get_app(); $_SESSION['uid'] = $user_record['uid']; $_SESSION['theme'] = $user_record['theme']; $_SESSION['mobile-theme'] = get_pconfig($user_record['uid'], 'system', 'mobile_theme'); $_SESSION['authenticated'] = 1; $_SESSION['page_flags'] = $user_record['page-flags']; $_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $user_record['nickname']; $_SESSION['my_address'] = $user_record['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(), '://') + 3); $_SESSION['addr'] = $_SERVER['REMOTE_ADDR']; $a->user = $user_record; if ($interactive) { if ($a->user['login_date'] === '0000-00-00 00:00:00') { $_SESSION['return_url'] = 'profile_photo/new'; $a->module = 'profile_photo'; info(t("Welcome ") . $a->user['username'] . EOL); info(t('Please upload a profile photo.') . EOL); } else { info(t("Welcome back ") . $a->user['username'] . EOL); } } $member_since = strtotime($a->user['register_date']); if (time() < $member_since + 60 * 60 * 24 * 14) { $_SESSION['new_member'] = true; } else { $_SESSION['new_member'] = false; } if (strlen($a->user['timezone'])) { date_default_timezone_set($a->user['timezone']); $a->timezone = $a->user['timezone']; } $master_record = $a->user; if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { $r = q("select * from user where uid = %d limit 1", intval($_SESSION['submanage'])); if (count($r)) { $master_record = $r[0]; } } $r = q("SELECT `uid`,`username`,`nickname` FROM `user` WHERE `password` = '%s' AND `email` = '%s' AND `account_removed` = 0 ", dbesc($master_record['password']), dbesc($master_record['email'])); if ($r && count($r)) { $a->identities = $r; } else { $a->identities = array(); } $r = q("select `user`.`uid`, `user`.`username`, `user`.`nickname`\n\t\tfrom manage INNER JOIN user on manage.mid = user.uid where `user`.`account_removed` = 0\n\t\tand `manage`.`uid` = %d", intval($master_record['uid'])); if ($r && count($r)) { $a->identities = array_merge($a->identities, $r); } if ($login_initial) { logger('auth_identities: ' . print_r($a->identities, true), LOGGER_DEBUG); } if ($login_refresh) { logger('auth_identities refresh: ' . print_r($a->identities, true), LOGGER_DEBUG); } $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($_SESSION['uid'])); if (count($r)) { $a->contact = $r[0]; $a->cid = $r[0]['id']; $_SESSION['cid'] = $a->cid; } header('X-Account-Management-Status: active; name="' . $a->user['username'] . '"; id="' . $a->user['nickname'] . '"'); if ($login_initial || $login_refresh) { $l = get_browser_language(); q("UPDATE `user` SET `login_date` = '%s', `language` = '%s' WHERE `uid` = %d", dbesc(datetime_convert()), dbesc($l), intval($_SESSION['uid'])); // Set the login date for all identities of the user q("UPDATE `user` SET `login_date` = '%s' WHERE `password` = '%s' AND `email` = '%s' AND `account_removed` = 0", dbesc(datetime_convert()), dbesc($master_record['password']), dbesc($master_record['email'])); } if ($login_initial) { call_hooks('logged_in', $a->user); if ($a->module !== 'home' && isset($_SESSION['return_url'])) { goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); } } }
function load_user_preferences() { global $login, $browser, $views, $prefarray, $is_assistant, $has_boss, $user; $lang_found = false; $browser = get_web_browser(); $browser_lang = get_browser_language(); $prefarray = array(); // Note: default values are set in config.php $res = dbi_query("SELECT cal_setting, cal_value FROM webcal_user_pref " . "WHERE cal_login = '******'"); if ($res) { while ($row = dbi_fetch_row($res)) { $setting = $row[0]; $value = $row[1]; $sys_setting = "sys_" . $setting; // save system defaults if (!empty($GLOBALS[$setting])) { $GLOBALS["sys_" . $setting] = $GLOBALS[$setting]; } $GLOBALS[$setting] = $value; $prefarray[$setting] = $value; if ($setting == "LANGUAGE") { $lang_found = true; } } dbi_free_result($res); } // get views for this user $res = dbi_query("SELECT cal_view_id, cal_name, cal_view_type FROM webcal_view " . "WHERE cal_owner = '{$login}'"); if ($res) { $views = array(); while ($row = dbi_fetch_row($res)) { $v = array("cal_view_id" => $row[0], "cal_name" => $row[1], "cal_view_type" => $row[2]); $views[] = $v; } dbi_free_result($res); } // If user has not set a language preference, then use their browser // settings to figure it out, and save it in the database for future // use (email reminders). if (!$lang_found && strlen($login) && $login != "__public__") { $LANGUAGE = $browser_lang; dbi_query("INSERT INTO webcal_user_pref " . "( cal_login, cal_setting, cal_value ) VALUES " . "( '{$login}', 'LANGUAGE', '{$LANGUAGE}' )"); } if (empty($GLOBALS["DATE_FORMAT_MY"])) { $GLOBALS["DATE_FORMAT_MY"] = "__month__ __yyyy__"; } if (empty($GLOBALS["DATE_FORMAT_MD"])) { $GLOBALS["DATE_FORMAT_MD"] = "__month__ __dd__"; } $is_assistant = user_is_assistant($login, $user); $has_boss = user_has_boss($login); }
<?php $languages = array(); $langnames = array(); // Always load English, as this will be used for defaults when the // translations don't have anything. include 'international/en.php'; $translations = $languages['en']; $browser_language = get_browser_language(); $interface_language = array_key_exists("language", $prefs) ? $prefs["language"] : $browser_language; if ($interface_language != "en") { if (file_exists('international/' . $interface_language . '.php')) { include 'international/' . $interface_language . '.php'; $translations = array_merge($languages['en'], $languages[$interface_language]); } else { debuglog("Translation " . $interface_language . " does not exist", "INTERNATIONAL"); $interface_language = "en"; } } function get_int_text($key, $sub = null) { global $translations; if (array_key_exists($key, $translations)) { if (is_array($sub)) { return htmlspecialchars(vsprintf($translations[$key], $sub), ENT_QUOTES); } else { return htmlspecialchars($translations[$key], ENT_QUOTES); } } else { debuglog("ERROR! Translation key " . $key . " not found!", "INTERNATIONAL"); return "UNKNOWN KEY";
// a language so that when we send reminders (done without the benefit // of a browser-preferred language), we'll know which language to use. // DO let them select browser-defined for the public user or NUC. if ($key != 'Browser-defined' || $updating_public || $is_admin || $is_nonuser_admin) { echo '<option value="' . $val . '"'; if ($val == $prefarray['LANGUAGE']) { echo $selected; } echo '>' . $key . "</option>\n"; } } ?> </select> <br /> <?php echo translate('Your browser default language is') . ' ' . translate(get_browser_language(true)) . '.'; ?> </td></tr> </table> </fieldset> <fieldset> <legend><?php etranslate('Date and Time'); ?> </legend> <table cellspacing="1" cellpadding="2" border="0"> <?php if ($can_set_timezone == true) { ?> <tr><td class="tooltipselect" title="<?php etooltip('tz-help');
<TD><SELECT NAME="admin_LANGUAGE"> <?php reset($languages); while (list($key, $val) = each($languages)) { echo "<OPTION VALUE=\"" . $val . "\""; if ($val == $LANGUAGE) { echo " SELECTED"; } echo "> " . $key . "\n"; } ?> </SELECT> <BR> <?php etranslate("Your browser default language is"); echo " " . get_browser_language() . "."; ?> </TD></TR> <TR><TD><B CLASS="tooltip" TITLE="<?php etooltip("fonts-help"); ?> "><?php etranslate("Fonts"); ?> :</B></TD> <TD><INPUT SIZE="40" NAME="admin_FONTS" VALUE="<?php echo htmlspecialchars($FONTS); ?> " </TD></TR>
function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) { $a = get_app(); // First day of the week (0 = Sunday) $firstDay = get_pconfig(local_user(), 'system', 'first_day_of_week'); if ($firstDay === false) { $firstDay = 0; } $lang = substr(get_browser_language(), 0, 2); // Check if the detected language is supported by the picker if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"))) { $lang = isset($a->config['system']['language']) ? $a->config['system']['language'] : 'en'; } $o = ''; $dateformat = ''; if ($pickdate) { $dateformat .= 'Y-m-d'; } if ($pickdate && $picktime) { $dateformat .= ' '; } if ($picktime) { $dateformat .= 'H:i'; } $minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : ''; $maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : ''; $input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : ''; $defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : ''; $pickers = ''; if (!$pickdate) { $pickers .= ',datepicker: false'; } if (!$picktime) { $pickers .= ',timepicker: false'; } $extra_js = ''; $pickers .= ",dayOfWeekStart: " . $firstDay . ",lang:'" . $lang . "'"; if ($minfrom != '') { $extra_js .= "\$('#{$minfrom}').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#{$id}').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})"; } if ($maxfrom != '') { $extra_js .= "\$('#{$maxfrom}').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#{$id}').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})"; } $readable_format = $dateformat; $readable_format = str_replace('Y', 'yyyy', $readable_format); $readable_format = str_replace('m', 'mm', $readable_format); $readable_format = str_replace('d', 'dd', $readable_format); $readable_format = str_replace('H', 'HH', $readable_format); $readable_format = str_replace('i', 'MM', $readable_format); $o .= "<div class='date'><input type='text' placeholder='{$readable_format}' name='{$id}' id='{$id}' {$input_text} />"; $o .= '</div>'; $o .= "<script type='text/javascript'>"; $o .= "\$(function () {var picker = \$('#{$id}').datetimepicker({step:5,format:'{$dateformat}' {$minjs} {$maxjs} {$pickers} {$defaultdatejs}}); {$extra_js}})"; $o .= "</script>"; return $o; }
function reset_language($new_language) { global $fullname, $lang, $lang_file, $PUBLIC_ACCESS_FULLNAME, $translation_loaded, $translations; if ($new_language == 'none') { $new_language = get_browser_language(); } if ($new_language != $lang || !$translation_loaded) { $lang = $new_language; $lang_file = 'translations/' . $lang . '.txt'; $translation_loaded = false; load_translation_text(); } $PUBLIC_ACCESS_FULLNAME = translate('Public Access'); if ($fullname == 'Public Access') { $fullname = $PUBLIC_ACCESS_FULLNAME; } }
*/ require_once "include/dba.php"; if (!$install) { $db = new dba($db_host, $db_user, $db_pass, $db_data, $install); unset($db_host, $db_user, $db_pass, $db_data); /** * Load configs from db. Overwrite configs from .htconfig.php */ load_config('config'); load_config('system'); require_once "include/session.php"; load_hooks(); call_hooks('init_1'); $maintenance = get_config('system', 'maintenance'); } $lang = get_browser_language(); load_translation_table($lang); /** * * Important stuff we always need to do. * * The order of these may be important so use caution if you think they're all * intertwingled with no logical order and decide to sort it out. Some of the * dependencies have changed, but at least at one time in the recent past - the * order was critical to everything working properly * */ session_start(); /** * Language was set earlier, but we can over-ride it in the session. * We have to do it here because the session was just now opened.
/** * setLanguage - Set the current user-language. * * @return void * @access private */ private function setLanguage() { global $db; //The database connection if (!empty($_GET['lang'])) { $this->lang = $_GET['lang']; $_SESSION['lang'] = $_GET['lang']; } elseif (!empty($_SESSION['lang'])) { $this->lang = $_SESSION['lang']; } elseif ($this->logged_in) { $lang = $db->getUserInfo($this->username, 'lang_id'); if (!empty($lang[0])) { $this->lang = $lang[0]; } } else { $allowed_langs = array('de', 'en'); $this->lang = get_browser_language($allowed_langs, DEFAULT_LANGUAGE, null, false); } }
function load_user_preferences($guest = '') { global $ALLOW_COLOR_CUSTOMIZATION, $browser, $DATE_FORMAT, $DATE_FORMAT_MD, $DATE_FORMAT_MY, $DATE_FORMAT_TASK, $has_boss, $is_assistant, $is_nonuser, $is_nonuser_admin, $lang_file, $LANGUAGE, $login, $prefarray, $user, $views; $browser = get_web_browser(); $browser_lang = get_browser_language(); $colors = array('BGCOLOR' => 1, 'CELLBG' => 1, 'H2COLOR' => 1, 'HASEVENTSBG' => 1, 'MYEVENTS' => 1, 'OTHERMONTHBG' => 1, 'POPUP_BG' => 1, 'POPUP_FG' => 1, 'TABLEBG' => 1, 'TEXTCOLOR' => 1, 'THBG' => 1, 'THFG' => 1, 'TODAYCELLBG' => 1, 'WEEKENDBG' => 1, 'WEEKNUMBER' => 1); $lang_found = false; $prefarray = array(); // Allow __public__ pref to be used if logging in or user not validated. $tmp_login = empty($guest) ? $login : ($guest == 'guest' ? '__public__' : $guest); $rows = dbi_get_cached_rows('SELECT cal_setting, cal_value FROM webcal_user_pref WHERE cal_login = ?', array($tmp_login)); if ($rows) { for ($i = 0, $cnt = count($rows); $i < $cnt; $i++) { $row = $rows[$i]; $setting = $row[0]; $value = $row[1]; if ($setting == 'LANGUAGE') { $lang_found = true; } if ($ALLOW_COLOR_CUSTOMIZATION == 'N' && isset($colors[$setting])) { continue; } // $sys_setting = 'sys_' . $setting; // Save system defaults. if (!empty($GLOBALS[$setting])) { $GLOBALS['sys_' . $setting] = $GLOBALS[$setting]; } $GLOBALS[$setting] = $prefarray[$setting] = $value; } } // Set users timezone. if (isset($GLOBALS['TIMEZONE'])) { set_env('TZ', $GLOBALS['TIMEZONE']); } // Get views for this user and global views. // If NUC and not authorized by UAC, disallow global views. $rows = dbi_get_cached_rows('SELECT cal_view_id, cal_name, cal_view_type, cal_is_global, cal_owner FROM webcal_view WHERE cal_owner = ? ' . ($is_nonuser && (!access_is_enabled() || access_is_enabled() && !access_can_access_function(ACCESS_VIEW, $guest)) ? '' : ' OR cal_is_global = \'Y\' ') . 'ORDER BY cal_name', array($tmp_login)); if ($rows) { $views = array(); for ($i = 0, $cnt = count($rows); $i < $cnt; $i++) { $row = $rows[$i]; $url = 'view_'; if ($row[2] == 'E') { $url .= 'r.php?'; } elseif ($row[2] == 'S') { $url .= 't.php?'; } elseif ($row[2] == 'T') { $url .= 't.php?'; } else { $url .= strtolower($row[2]) . '.php?'; } $v = array('cal_view_id' => $row[0], 'cal_name' => $row[1], 'cal_view_type' => $row[2], 'cal_is_global' => $row[3], 'cal_owner' => $row[4], 'url' => $url . 'id=' . $row[0]); $views[] = $v; } } // If user has not set a language preference and admin has not specified a // language, then use their browser settings to figure it out // and save it in the database for future use (email reminders). $lang = 'none'; if (!$lang_found && strlen($tmp_login) && $tmp_login != '__public__') { if ($LANGUAGE == 'none') { $lang = $browser_lang; } dbi_execute('INSERT INTO webcal_user_pref ( cal_login, cal_setting, cal_value ) VALUES ( ?, ?, ? )', array($tmp_login, 'LANGUAGE', $lang)); } reset_language(!empty($LANGUAGE) && $LANGUAGE != 'none' ? $LANGUAGE : $browser_lang); if (empty($DATE_FORMAT) || $DATE_FORMAT == 'LANGUAGE_DEFINED') { $DATE_FORMAT = translate('__month__ __dd__, __yyyy__'); } if (empty($DATE_FORMAT_MY) || $DATE_FORMAT_MY == 'LANGUAGE_DEFINED') { $DATE_FORMAT_MY = translate('__month__ __yyyy__'); } if (empty($DATE_FORMAT_MD) || $DATE_FORMAT_MD == 'LANGUAGE_DEFINED') { $DATE_FORMAT_MD = translate('__month__ __dd__'); } if (empty($DATE_FORMAT_TASK) || $DATE_FORMAT_TASK == 'LANGUAGE_DEFINED') { $DATE_FORMAT_TASK = translate('__mm__/__dd__/__yyyy__'); } $has_boss = user_has_boss($tmp_login); $is_assistant = empty($user) ? false : user_is_assistant($tmp_login, $user); $is_nonuser_admin = $user ? user_is_nonuser_admin($tmp_login, $user) : false; // if ( $is_nonuser_admin ) load_nonuser_preferences ($user); }
/** * Loads the current user's preferences as global variables from the webcal_user_pref table. * * Also loads the list of views for this user (not really a preference, but * this is a convenient place to put this...) * * <b>Notes:</b> * - If <var>$allow_color_customization</var> is set to 'N', then we ignore any * color preferences. * - Other default values will also be set if the user has not saved a * preference and no global value has been set by the administrator in the * system settings. */ function load_user_preferences() { global $login, $browser, $views, $prefarray, $is_assistant, $has_boss, $user, $is_nonuser_admin, $allow_color_customization; $lang_found = false; $colors = array("BGCOLOR" => 1, "H2COLOR" => 1, "THBG" => 1, "THFG" => 1, "CELLBG" => 1, "TODAYCELLBG" => 1, "WEEKENDBG" => 1, "POPUP_BG" => 1, "POPUP_FG" => 1); $browser = get_web_browser(); $browser_lang = get_browser_language(); $prefarray = array(); // Note: default values are set in config.php $res = dbi_query("SELECT cal_setting, cal_value FROM webcal_user_pref " . "WHERE cal_login = '******'"); if ($res) { while ($row = dbi_fetch_row($res)) { $setting = $row[0]; $value = $row[1]; if ($allow_color_customization == 'N') { if (isset($colors[$setting])) { continue; } } $sys_setting = "sys_" . $setting; // save system defaults if (!empty($GLOBALS[$setting])) { $GLOBALS["sys_" . $setting] = $GLOBALS[$setting]; } $GLOBALS[$setting] = $value; $prefarray[$setting] = $value; if ($setting == "LANGUAGE") { $lang_found = true; } } dbi_free_result($res); } // get views for this user and global views $res = dbi_query("SELECT cal_view_id, cal_name, cal_view_type, cal_is_global " . "FROM webcal_view " . "WHERE cal_owner = '{$login}' OR cal_is_global = 'Y' " . "ORDER BY cal_name"); if ($res) { $views = array(); while ($row = dbi_fetch_row($res)) { if ($row[2] == 'S') { $url = "view_t.php?timeb=1&id={$row['0']}"; } else { if ($row[2] == 'T') { $url = "view_t.php?timeb=0&id={$row['0']}"; } else { $url = "view_" . strtolower($row[2]) . ".php?id={$row['0']}"; } } $v = array("cal_view_id" => $row[0], "cal_name" => $row[1], "cal_view_type" => $row[2], "cal_is_global" => $row[3], "url" => $url); $views[] = $v; } dbi_free_result($res); } // If user has not set a language preference, then use their browser // settings to figure it out, and save it in the database for future // use (email reminders). if (!$lang_found && strlen($login) && $login != "__public__") { $LANGUAGE = $browser_lang; dbi_query("INSERT INTO webcal_user_pref " . "( cal_login, cal_setting, cal_value ) VALUES " . "( '{$login}', 'LANGUAGE', '{$LANGUAGE}' )"); } if (empty($GLOBALS["DATE_FORMAT_MY"])) { $GLOBALS["DATE_FORMAT_MY"] = "__month__ __yyyy__"; } if (empty($GLOBALS["DATE_FORMAT_MD"])) { $GLOBALS["DATE_FORMAT_MD"] = "__month__ __dd__"; } $is_assistant = empty($user) ? false : user_is_assistant($login, $user); $has_boss = user_has_boss($login); $is_nonuser_admin = $user ? user_is_nonuser_admin($login, $user) : false; if ($is_nonuser_admin) { load_nonuser_preferences($user); } }
// logout logout_user(); redirect(get_gallery_home_url()); } elseif (!empty($_SESSION['pwg_uid'])) { $user['id'] = $_SESSION['pwg_uid']; } } // Now check the auto-login if ($user['id'] == $conf['guest_id']) { auto_login(); } // using Apache authentication override the above user search if ($conf['apache_authentication']) { $remote_user = null; foreach (array('REMOTE_USER', 'REDIRECT_REMOTE_USER') as $server_key) { if (isset($_SERVER[$server_key])) { $remote_user = $_SERVER[$server_key]; break; } } if (isset($remote_user)) { if (!($user['id'] = get_userid($remote_user))) { $user['id'] = register_user($remote_user, '', '', false); } } } $user = build_user($user['id'], (defined('IN_ADMIN') and IN_ADMIN) ? false : true); if ($conf['browser_language'] and (is_a_guest() or is_generic())) { get_browser_language($user['language']); } trigger_notify('user_init', $user);
} } /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))) { msg_dialog::display(_("Smarty"), sprintf(_("Compile directory %s is not accessible!"), bold('/var/spool/gosa/')), FATAL_ERROR_DIALOG); exit; } /* Get posted language */ if (!session::global_is_set('lang')) { session::global_set('lang', get_browser_language()); } if (isset($_POST['lang_selected'])) { if ($_POST['lang_selected'] != "") { session::global_set('lang', $_POST['lang_selected']); } else { session::global_set('lang', get_browser_language()); } } /* Check for js */ if (!isset($_GET['js']) && !session::global_is_set('js')) { echo '<script language="JavaScript" type="text/javascript">'; echo ' location = "setup.php?js=true";'; echo '</script>'; session::global_set('js', FALSE); } elseif (isset($_GET['js'])) { session::global_set('js', TRUE); } $lang = session::global_get('lang'); /* Append .UTF-8 to language string if necessary */ if (!preg_match("/utf(-)8\$/i", $lang)) { $lang .= ".UTF-8";
<?php /* $Id: help_bug.php,v 1.29.2.2 2007/08/06 02:28:30 cknudsen Exp $ */ include_once 'includes/init.php'; include_once 'includes/help_list.php'; if (empty($SERVER_SOFTWARE)) { $SERVER_SOFTWARE = $_SERVER['SERVER_SOFTWARE']; } if (empty($HTTP_USER_AGENT)) { $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; } print_header('', '', '', true); ob_start(); echo $helpListStr . ' <h2>' . translate('Report Bug') . '</h2> <p>' . translate('Please include all the information below when reporting a bug.') . ($LANGUAGE != 'English-US' ? ' ' . str_replace('XXX', translate(get_browser_language(true)), translate('Also, please use English rather than XXX.')) : '') . '</p> <form action="http://sourceforge.net/tracker/" target="_new"> <input type="hidden" name="func" value="add" /> <input type="hidden" name="group_id" value="3870" /> <input type="hidden" name="atid" value="103870" /> <input type="submit" value="' . translate('Report Bug') . '" /> </form> <h3>' . translate('System Settings') . '</h3> <div>'; $tmp_arr = array('PROGRAM_NAME' => $PROGRAM_NAME, 'SERVER_SOFTWARE' => $SERVER_SOFTWARE, 'Web Browser' => $HTTP_USER_AGENT, 'PHP Version' => phpversion(), 'Default Encoding' => ini_get('default_charset'), 'db_type' => $db_type, 'readonly' => $readonly, 'single_user' => $single_user, 'single_user_login' => $single_user_login, 'use_http_auth' => $use_http_auth ? 'Y' : 'N', 'user_inc' => $user_inc); $res = dbi_execute('SELECT cal_setting, cal_value FROM webcal_config ORDER BY cal_setting'); if ($res) { while ($row = dbi_fetch_row($res)) { $tmp_arr[$row[0]] = $row[1]; }
// *** Query delimiter treatment added // *** Only list SQL, GZ and CSV files // *** Sort the file listing A-Z // *** Add string quotes setting // Database configuration chdir(".."); require "include/classes/db/config_db.php"; $db_server = DB_SERVER; $db_name = DB_NAME; $db_username = DB_USER; $db_password = DB_PASS; // Other settings (optional) include "locale/localization.php"; include "include/functions/common.php"; $allowed_langs = array('de', 'en'); $lang = get_browser_language($allowed_langs, 'de', null, false); $filename = 'sql/OpenHomeopath.sql.gz'; // Specify the dump filename to suppress the file selection dialog $ajax = true; // AJAX mode: import will be done without refreshing the website $linespersession = 3000; // Lines to be executed per one import session $delaypersession = 0; // You can specify a sleep time in milliseconds after each session // Works only if JavaScript is activated. Use to reduce server overrun // CSV related settings (only if you use a CSV dump) $csv_insert_table = ''; // Destination table for CSV files $csv_preempty_table = false; // true: delete all entries from table specified in $csv_insert_table before processing $csv_delimiter = ',';
$user['id'] = $_SESSION['pwg_uid']; } } // Now check the auto-login if ($user['id'] == $conf['guest_id']) { auto_login(); } // using Apache authentication override the above user search if ($conf['apache_authentication']) { $remote_user = null; foreach (array('REMOTE_USER', 'REDIRECT_REMOTE_USER') as $server_key) { if (isset($_SERVER[$server_key])) { $remote_user = $_SERVER[$server_key]; break; } } if (isset($remote_user)) { if (!($user['id'] = get_userid($remote_user))) { $user['id'] = register_user($remote_user, '', '', false); } } } // automatic login by authentication key if (isset($_GET['auth'])) { auth_key_login($_GET['auth']); } $user = build_user($user['id'], (defined('IN_ADMIN') and IN_ADMIN) ? false : true); if ($conf['browser_language'] and (is_a_guest() or is_generic()) and $language = get_browser_language()) { $user['language'] = $language; } trigger_notify('user_init', $user);
// a language so that when we send reminders (done without the benefit // of a browser-preferred language), we'll know which language to use. // DO let them select browser-defined for the public user. if ($key != "Browser-defined" || $updating_public) { echo "<option value=\"" . $val . "\""; if ($val == $prefarray["LANGUAGE"]) { echo " selected=\"selected\""; } echo ">" . translate($key) . "</option>\n"; } } ?> </select> <br /> <?php echo translate("Your browser default language is") . " " . translate(get_browser_language()) . "."; ?> </td></tr> <tr><td class="tooltipselect" title="<?php etooltip("tz-help"); ?> "> <label for="pref_tz"><?php etranslate("Timezone Offset"); ?> :</label></td><td> <select name="pref_TZ_OFFSET" id="pref_tz"> <?php $text_add = translate("Add N hours to"); $text_sub = translate("Subtract N hours from"); if (empty($prefarray["TZ_OFFSET"])) {