function get_locale() { global $webimroot, $locale_pattern; $locale = verifyparam("locale", $locale_pattern, ""); if ($locale && locale_exists($locale)) { $_SESSION['locale'] = $locale; setcookie('webim_locale', $locale, time() + 60 * 60 * 24 * 1000, "{$webimroot}/"); } else { if (isset($_SESSION['locale'])) { $locale = $_SESSION['locale']; } } if (!$locale || !locale_exists($locale)) { $locale = get_user_locale(); } return $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']); post_message_($thread['threadid'], $kind_for_agent, $msg, $link); } mysql_close($link); } $image = verifyparam(isset($_GET['image']) ? "image" : "i", "/^\\w+\$/", "webim"); $lang = verifyparam(isset($_GET['language']) ? "language" : "lang", "/^[\\w-]{2,5}\$/", ""); if (!$lang || !locale_exists($lang)) { $lang = $current_locale; } $groupid = verifyparam("group", "/^\\d{1,8}\$/", ""); 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";
if ($settings["enablecaptcha"] == "1" && can_show_captcha()) { $captcha = getparam('captcha'); $original = isset($_SESSION["mibew_captcha"]) ? $_SESSION["mibew_captcha"] : ""; if (empty($original) || empty($captcha) || $captcha != $original) { $errors[] = getlocal('errors.captcha'); } unset($_SESSION['mibew_captcha']); } if (count($errors) > 0) { setup_leavemessage($visitor_name, $email, $message, $groupid, $groupname, $info, $referrer, can_show_captcha()); setup_logo(); expand("styles", getchatstyle(), "leavemessage.tpl"); exit; } $message_locale = $settings['left_messages_locale']; if (!locale_exists($message_locale)) { $message_locale = $home_locale; } store_message($visitor_name, $email, $info, $message, $groupid, $referrer); $subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale); $body = getstring2_("leavemail.body", array($visitor_name, $email, $message, $info ? "{$info}\n" : ""), $message_locale); if (isset($group) && !empty($group['vcemail'])) { $inbox_mail = $group['vcemail']; } else { $inbox_mail = $settings['email']; } if ($inbox_mail) { $link = connect(); webim_mail($inbox_mail, $email, $subject, $body, $link); mysql_close($link); }
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; }
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";