$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"); }
function reopen_thread($threadid) { global $state_queue, $state_loading, $state_waiting, $state_chatting, $state_closed, $state_left, $kind_events; $link = connect(); $thread = thread_by_id_($threadid, $link); if (!$thread) { return FALSE; } if ($thread['istate'] == $state_closed || $thread['istate'] == $state_left) { return FALSE; } if ($thread['istate'] != $state_chatting && $thread['istate'] != $state_queue && $thread['istate'] != $state_loading) { commit_thread($threadid, array("istate" => $state_waiting, "nextagent" => 0), $link); } post_message_($thread['threadid'], $kind_events, getstring_("chat.status.user.reopenedthread", $thread['locale']), $link); mysql_close($link); return $thread; }
} $_SESSION['own_threads'][] = $thread['threadid']; if ($referrer) { post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.came.from', array($referrer), true), $link); } post_message_($thread['threadid'], $kind_info, getstring('chat.wait', true), $link); if ($email) { post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.visitor.email', array($email), true), $link); } if ($info) { post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.visitor.info', array($info), true), $link); } if ($firstmessage) { $postedid = post_message_($thread['threadid'], $kind_user, $firstmessage, $link, $visitor['name']); if ($postedid) { commit_thread($thread['threadid'], array('shownmessageid' => intval($postedid)), $link); } } notify_operators($thread, $firstmessage, $link); mysql_close($link); } $threadid = $thread['threadid']; $token = $thread['ltoken']; $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)\$/");