function get_locale() { global $mibewroot, $locale_cookie_name; $locale = verifyparam("locale", "/./", ""); if ($locale && locale_pattern_check($locale) && locale_exists($locale)) { $_SESSION['locale'] = $locale; } else { if (isset($_SESSION['locale']) && locale_pattern_check($_SESSION['locale']) && locale_exists($_SESSION['locale'])) { $locale = $_SESSION['locale']; } else { $locale = get_user_locale(); } } setcookie($locale_cookie_name, $locale, time() + 60 * 60 * 24 * 1000, "{$mibewroot}/"); return $locale; }
/** * Retrieves locale for the current request. * * @return string Locale code */ function get_current_locale() { static $current_locale = null; if (is_null($current_locale)) { $locale = verify_param("locale", "/./", ""); // Check if locale code passed in as a param is valid $locale_param_valid = $locale && locale_pattern_check($locale) && locale_is_available($locale); // Check if locale code stored in session data is valid $session_locale_valid = isset($_SESSION[SESSION_PREFIX . 'locale']) && locale_pattern_check($_SESSION[SESSION_PREFIX . 'locale']) && locale_is_available($_SESSION[SESSION_PREFIX . 'locale']); if ($locale_param_valid) { $_SESSION[SESSION_PREFIX . 'locale'] = $locale; } elseif ($session_locale_valid) { $locale = $_SESSION[SESSION_PREFIX . 'locale']; } else { $locale = get_user_locale(); } $current_locale = $locale; } return $current_locale; }
require_once 'libs/chat.php'; require_once 'libs/operator.php'; require_once 'libs/groups.php'; $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""; if ($referer && isset($_SESSION['threadid'])) { $link = connect(); $thread = thread_by_id_($_SESSION['threadid'], $link); if ($thread && $thread['istate'] != $state_closed) { $msg = getstring2_("chat.client.visited.page", array($referer), $thread['locale'], true); post_message_($thread['threadid'], $kind_for_agent, $msg, $link); } mysql_close($link); } $image = verifyparam(isset($_GET['image']) ? "image" : "i", "/^\\w+\$/", "mibew"); $lang = verifyparam(isset($_GET['language']) ? "language" : "lang", "/^[\\w-]{2,5}\$/", ""); if (!$lang || !locale_pattern_check($lang) || !locale_exists($lang)) { $lang = $current_locale; } $groupid = verifyparam("group", "/^\\d{1,10}\$/", ""); if ($groupid) { loadsettings(); if ($settings['enablegroups'] == '1') { $group = group_by_id($groupid); if (!$group) { $groupid = ""; } } else { $groupid = ""; } } $image_postfix = has_online_operators($groupid) ? "on" : "off";