function check_for_reassign($thread, $operator) { global $state_waiting, $home_locale, $kind_events, $kind_avatar; $operatorName = $thread['locale'] == $home_locale ? $operator['vclocalename'] : $operator['vccommonname']; if ($thread['istate'] == $state_waiting && ($thread['nextagent'] == $operator['operatorid'] || $thread['agentId'] == $operator['operatorid'])) { do_take_thread($thread['threadid'], $operator['operatorid'], $operatorName); if ($operatorName != $thread['agentName']) { $message_to_post = getstring2_("chat.status.operator.changed", array($operatorName, $thread['agentName']), $thread['locale']); } else { $message_to_post = getstring2_("chat.status.operator.returned", array($operatorName), $thread['locale']); } post_message($thread['threadid'], $kind_events, $message_to_post); post_message($thread['threadid'], $kind_avatar, $operator['vcavatar'] ? $operator['vcavatar'] : ""); } }
function getstring2($text, $params) { global $current_locale; return getstring2_($text, $params, $current_locale); }
$errors[] = getlocal("chat.redirect.unknown_group"); } } else { $nextid = verifyparam("nextAgent", "/^\\d{1,10}\$/"); $nextOperator = operator_by_id($nextid); if ($nextOperator) { $page['message'] = getlocal2("chat.redirected.content", array(safe_htmlspecialchars(topage(get_operator_name($nextOperator))))); if ($thread['istate'] == $state_chatting) { $link = connect(); $threadupdate = array("istate" => intval($state_waiting), "nextagent" => intval($nextid), "agentId" => 0); if ($thread['groupid'] != 0) { if (FALSE === select_one_row("select groupid from {$mysqlprefix}chatgroupoperator where operatorid = " . intval($nextid) . " and groupid = " . intval($thread['groupid']), $link)) { $threadupdate['groupid'] = 0; } } commit_thread($threadid, $threadupdate, $link); post_message_($thread['threadid'], $kind_events, getstring2_("chat.status.operator.redirect", array(get_operator_name($operator)), $thread['locale'], true), $link); mysql_close($link); } else { $errors[] = getlocal("chat.redirect.cannot"); } } else { $errors[] = getlocal("chat.redirect.unknown_operator"); } } setup_logo(); if (count($errors) > 0) { expand("../styles", getchatstyle(), "error.tpl"); } else { expand("../styles", getchatstyle(), "redirected.tpl"); }
* EPL, indicate your decision by deleting the provisions above and replace them * with the notice and other provisions required by the GPL. * * Contributors: * Evgeny Gryaznov - initial API and implementation */ require_once 'libs/common.php'; 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) {
function getstring2($text, $params, $raw = false) { global $current_locale; $string = getstring2_($text, $params, $current_locale, true); return $raw ? $string : sanitize_string($string, 'low', 'moderate'); }
$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); } setup_logo(); expand("styles", getchatstyle(), "leavemessagesent.tpl");
function notify_operators($thread, $firstmessage, $link) { global $settings, $mysqlprefix; if ($settings['enablejabber'] == 1) { $groupid = $thread['groupid']; $query = "select {$mysqlprefix}chatoperator.operatorid as opid, inotify, vcjabbername, vcemail, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from {$mysqlprefix}chatoperator"; if ($groupid) { $query .= ", {$mysqlprefix}chatgroupoperator where groupid = {$groupid} and {$mysqlprefix}chatoperator.operatorid = {$mysqlprefix}chatgroupoperator.operatorid and istatus = 0"; } else { $query .= " where istatus = 0"; } $query .= " and inotify = 1"; $result = select_multi_assoc($query, $link); $text = getstring2_("notify.new.text", array(get_app_location(true, $settings['enablessl'] == '1' && $settings['forcessl'] == '1') . "/operator/agent.php?thread=" . $thread['threadid'], $thread['userName']), $thread['locale']); if ($firstmessage) { $text .= "\n{$firstmessage}"; } foreach ($result as $op) { if ($op['time'] < $settings['online_timeout'] && is_valid_email($op['vcjabbername'])) { webim_xmpp($op['vcjabbername'], getstring2("notify.new.subject", array($thread['userName'])), $text, $link); } } } }