$page['email'] = $email; if (!$email) { $errors[] = no_field("form.field.email"); } else { if (!is_valid_email($email)) { $errors[] = wrong_field("form.field.email"); } } if (count($errors) > 0) { $page['formemail'] = $email; $page['ct.chatThreadId'] = $thread['threadid']; $page['ct.token'] = $thread['ltoken']; $page['level'] = ""; setup_logo(); expand("styles", getchatstyle(), "mail.tpl"); exit; } $history = ""; $lastid = -1; $output = get_messages($threadid, "text", true, $lastid); foreach ($output as $msg) { $history .= $msg; } $subject = getstring("mail.user.history.subject"); $body = getstring2("mail.user.history.body", array($thread['userName'], $history)); $link = connect(); webim_mail($email, $webim_mailbox, $subject, $body, $link); mysql_close($link); setup_logo(); expand("styles", getchatstyle(), "mailsent.tpl"); exit;
$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"); }
$level = get_remote_level($_SERVER['HTTP_USER_AGENT']); $chatstyle = verifyparam("style", "/^\\w+\$/", ""); header("Location: {$mibewroot}/client.php?thread={$threadid}&token={$token}&level={$level}" . ($chatstyle ? "&style={$chatstyle}" : "")); exit; } $token = verifyparam("token", "/^\\d{1,10}\$/"); $threadid = verifyparam("thread", "/^\\d{1,10}\$/"); $level = verifyparam("level", "/^(ajaxed|simple|old)\$/"); // We have to check that the thread is owned by the user. $is_own_thread = isset($_SESSION['own_threads']) && in_array($threadid, $_SESSION['own_threads']); $thread = thread_by_id($threadid); if (!$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] || !$is_own_thread) { die("wrong thread"); } setup_chatview_for_user($thread, $level); $pparam = verifyparam("act", "/^(mailthread)\$/", "default"); if ($pparam == "mailthread") { expand("styles", getchatstyle(), "mail.tpl"); } else { if ($level == "ajaxed") { expand("styles", getchatstyle(), "chat.tpl"); } else { if ($level == "simple") { expand("styles", getchatstyle(), "chatsimple.tpl"); } else { if ($level == "old") { expand("styles", getchatstyle(), "nochat.tpl"); } } } }
if (!is_capable($can_viewthreads, $operator)) { $errors = array("Cannot view threads"); start_html_output(); expand("../styles", getchatstyle(), "error.tpl"); exit; } } $token = $thread['ltoken']; header("Location: {$mibewroot}/operator/agent.php?thread=" . intval($threadid) . "&token=" . intval($token) . "&level=" . urlencode($remote_level)); exit; } $token = verifyparam("token", "/^\\d{1,10}\$/"); $thread = thread_by_id($threadid); if (!$thread || !isset($thread['ltoken']) || $token != $thread['ltoken']) { die("wrong thread"); } if ($thread['agentId'] != $operator['operatorid'] && !is_capable($can_viewthreads, $operator)) { $errors = array("Cannot view threads"); start_html_output(); expand("../styles", getchatstyle(), "error.tpl"); exit; } setup_chatview_for_operator($thread, $operator); start_html_output(); $pparam = verifyparam("act", "/^(redirect)\$/", "default"); if ($pparam == "redirect") { setup_redirect_links($threadid, $token); expand("../styles", getchatstyle(), "redirect.tpl"); } else { expand("../styles", getchatstyle(), "chat.tpl"); }
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");