function operatorSubmitted() { $operator = Operator::getInstance()->GetLoggedOperator(); $TML = new SmartyClass(); setOperator($TML); $TML->assign('mode', 'profile'); $toCheck = array('login' => 'form.field.login', 'fullname' => 'form.field.agent_name', 'email' => 'form.field.agent_email'); foreach ($toCheck as $field => $res) { if (empty($_REQUEST[$field])) { $errors[] = Resources::Get("errors.required", array(Resources::Get($res))); } } if (empty($errors) && !preg_match("/^[\\w_]+\$/", $_REQUEST['login'])) { $errors[] = Resources::Get("page_agent.error.wrong_login"); } if ($_REQUEST['password'] != $_REQUEST['password_confirm']) { $errors[] = Resources::Get('my_settings.error.password_match'); } if (!empty($_REQUEST['password']) && md5($_REQUEST['password_existing']) != $operator['password']) { $errors[] = Resources::Get('my_settings.error.password_existing'); } $hash = array(); $requestFile = $_FILES['avatarFile']; if (empty($errors) && isset($requestFile) && !empty($requestFile['name']) && $requestFile['size'] > 0 && $requestFile['error'] == 0) { $res = Operator::getInstance()->UploadOperatorAvatar($operator['operatorid'], $requestFile); if (isset($res)) { $errors[] = $res; } if (empty($errors)) { $hash['avatar'] = Operator::getInstance()->getAvatarURL($operator['operatorid'], $requestFile['name']); } } if (empty($errors)) { $hash['login'] = $_REQUEST['login']; $hash['email'] = $_REQUEST['email']; $hash['fullname'] = $_REQUEST['fullname']; if (!empty($_REQUEST['password'])) { $hash['password'] = md5($_REQUEST['password']); } Operator::getInstance()->UpdateOperator($operator['operatorid'], $hash); Operator::getInstance()->RefreshSessionOperator(); header("Location: " . WEBIM_ROOT . "/operator/profile.php"); exit; } foreach (array('login', 'email', 'fullname') as $f) { $TML->assign($f, $_REQUEST[$f]); } $TML->assign('errors', $errors); $TML->display('../templates/operator.tpl'); exit; }
public static function getImageNameFromParam($pImage, $pDepartmentKey = null, $pLang = null, $pImagePostfix = null, $hasOnline = null) { if (!preg_match('/\\.(gif|jpg|png)$/i', $pImage)) { $image = $pImage . '.gif'; } else { $image = $pImage; } if (empty($pLang) || !Resources::IsLocaleAvailable($pLang)) { $lang = Resources::getCurrentLocale(); } else { $lang = $pLang; } if (empty($pImagePostfix)) { if (empty($hasOnline)) { $image_postfix = Operator::getInstance()->hasOnlineOperators($pDepartmentKey, $lang) ? 'on' : 'off'; } else { $image_postfix = $hasOnline ? 'on' : 'off'; } } else { $image_postfix = $pImagePostfix; } $image = preg_replace('/\\.(gif|jpg|png)/i', '_' . $image_postfix . '.\\1', $image); return "/themes/.buttons/{$lang}/{$image}"; }
protected function getReportLostOrInterceptedByOperator($start, $end, $intercepted = false, $departmentid = null, $locale = null) { $afrom = ''; $awhere = ''; $params = array('p_start' => $start, 'p_end' => $end); if ($departmentid !== null || $locale !== null) { $afrom = ' LEFT JOIN "{operatorlastaccess}" o ON lv."operatorid" = o."operatorid" '; if ($departmentid !== null) { $awhere .= ' AND lv."operatorid" IN ( SELECT "operatorid" FROM "{operatordepartment}" WHERE "departmentid" = :departmentid ) '; $params['departmentid'] = $departmentid; } if ($locale !== null) { $awhere .= 'AND (o."locales" LIKE :locale OR o."locales" IS NULL)'; $params['locale'] = '%' . $locale . '%'; } } $sql = 'SELECT lv."operatorid" "opid", COUNT(lv."id") "lost_vistors_count", AVG(lv."waittime") "avg_waittime" FROM "{lostvisitor}" lv LEFT JOIN "{thread}" t ON t."threadid" = lv."threadid" ' . $afrom . ' WHERE WM_UNIX_TIMESTAMP(t."created") >= :p_start AND WM_UNIX_TIMESTAMP(t."created") < :p_end AND lv."anotheroperatorid" IS ' . ($intercepted ? 'NOT' : '') . ' NULL ' . $awhere . ' GROUP BY lv."operatorid"'; try { $this->db->Query($sql, $params); $result = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $result[$row['opid']] = $row; $result[$row['opid']]['avg_waittime_str'] = (int) ($result[$row['opid']]['avg_waittime'] / 60) . ':' . $result[$row['opid']]['avg_waittime'] % 60; } } catch (Exception $e) { } $query = 'SELECT lv."operatorid" FROM "{operatorlastaccess}" lv ' . $afrom . ' WHERE 1=1 ' . $awhere; try { $this->db->Query($query, array_slice($params, 2, 2)); $operators = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $operators[$row['operatorid']] = null; } } catch (Exception $e) { } if (count($operators) == 0) { return; } foreach (array_keys($operators) as $id) { $operator = Operator::getInstance()->GetOperatorById($id); if (!isset($result[$id])) { $result[$id] = array('opid' => $id, 'lost_vistors_count' => 0, 'avg_waittime' => 0, 'dispersion' => 0, 'avg_waittime' => 0, 'st_deviation' => 0); } $result[$id]['name'] = $operator['fullname']; } $sql = 'SELECT lv."operatorid" "opid", lv."waittime" FROM "{lostvisitor}" lv LEFT JOIN "{thread}" t ON t."threadid" = lv."threadid" WHERE WM_UNIX_TIMESTAMP(t."created") >= :p_start AND WM_UNIX_TIMESTAMP(t."created") < :p_end AND lv."anotheroperatorid" IS ' . ($intercepted ? 'NOT' : '') . ' NULL '; try { $this->db->Query($sql, array('p_start' => $start, 'p_end' => $end)); while ($this->db->nextRecord()) { $row = $this->db->getRow(); if ($result[$row['opid']]['lost_vistors_count'] == 0) { continue; } if (!isset($result[$row['opid']]['dispersion'])) { $result[$row['opid']]['dispersion'] = 0; } $result[$row['opid']]['dispersion'] += ($result[$row['opid']]['avg_waittime'] - $row['waittime']) * ($result[$row['opid']]['avg_waittime'] - $row['waittime']) / $result[$row['opid']]['lost_vistors_count']; $result[$row['opid']]['st_deviation'] = sprintf('%.2f', sqrt($result[$row['opid']]['dispersion'])); } } catch (Exception $e) { } return $result; }
function displayChooseOperator($chooseoperator) { $departmentkey = verify_param('departmentkey', "/^\\w+\$/"); $onlineOperators = Operator::getInstance()->getOnlineOperators(null, $departmentkey, Resources::getCurrentLocale()); $TML = new SmartyClass(); // $TML->assign('ismandatory', $isMandatory); if ($chooseoperator == 'optional') { $onlineOperators = array_merge(array(array('operatorid' => '', 'fullname' => Resources::Get('chooseoperator.any'))), $onlineOperators); } else { $onlineOperators = array_merge(array(array('operatorid' => 0, 'fullname' => Resources::Get('chooseoperator.select'))), $onlineOperators); } $TML->assign('mode', $chooseoperator); $TML->assign('onlineOperators', $onlineOperators); showChoose($TML, 'operatorid', 'choose-operator.tpl'); }
<?php /* * * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'leftMenu.auto_invites'; require_once dirname(__FILE__) . '/inc/admin_prolog.php'; require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/models/generic/class.mapperfactory.php'; Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $TML = new SmartyClass($TITLE_KEY); $TML->assign('invites', MapperFactory::getMapper('AutoInvite')->getAll()); $TML->display('auto_invites.tpl');
function get_operators_list() { $operators = Operator::getInstance()->GetAllAccessedOperators(); $result = array(); $result[''] = Resources::Get('search.any.operator'); if (!empty($operators)) { foreach ($operators as $op) { $result[$op['operatorid']] = $op['fullname']; } } return $result; }
<?php /* * * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; Operator::getInstance()->Logout(); header('Location: ' . WEBIM_ROOT . '/operator/login.php'); exit;
public function getAdvancedReport($start, $end, $departmentid = null, $locale = null) { $afrom = ''; $awhere = ''; $params = array('p_start' => $start, 'p_end' => $end); if ($departmentid !== null || $locale !== null) { $afrom = ' LEFT JOIN "{operator}" op ON o."operatorid" = op."operatorid" '; if ($departmentid !== null) { $awhere .= ' WHERE op."operatorid" IN ( SELECT "operatorid" FROM "{operatordepartment}" WHERE "departmentid" = :departmentid ) '; $params['departmentid'] = $departmentid; } if ($locale !== null) { $awhere .= empty($awhere) ? 'WHERE ' : 'AND '; $awhere .= '(o."locales" LIKE :locale OR o."locales" IS NULL)'; $params['locale'] = '%' . $locale . '%'; } } $sql = ' SELECT o."operatorid" "opid", ( SELECT AVG("rate") FROM "{rate}" r WHERE "operatorid" = o."operatorid" AND WM_UNIX_TIMESTAMP(r."date") >= :p_start AND WM_UNIX_TIMESTAMP(r."date") < :p_end AND "deldate" IS NULL ) "rating", ( SELECT COUNT("rate") FROM "{rate}" r WHERE "operatorid" = o."operatorid" AND WM_UNIX_TIMESTAMP(r."date") >= :p_start AND WM_UNIX_TIMESTAMP(r."date") < :p_end AND "deldate" IS NULL ) "rate_count", ( SELECT WM_SEC_TO_TIME(SUM("seconds")) "online_time" FROM "{operatoronline}" WHERE "operatorid" = o."operatorid" and "threadid" = -1 AND WM_UNIX_TIMESTAMP("date") >= :p_start AND WM_UNIX_TIMESTAMP("date") < :p_end GROUP BY "operatorid" ) "online_time", ( SELECT WM_SEC_TO_TIME(SUM("seconds")) "online_time" FROM "{operatoronline}" WHERE "operatorid" = o."operatorid" and "threadid" = -2 AND WM_UNIX_TIMESTAMP("date") >= :p_start AND WM_UNIX_TIMESTAMP("date") < :p_end GROUP BY "operatorid" ) "online_chatting_time", ( SELECT WM_SEC_TO_TIME(SUM("seconds")) "online_time" FROM "{operatoronline}" WHERE "operatorid" = o."operatorid" and "threadid" > 0 AND WM_UNIX_TIMESTAMP("date") >= :p_start AND WM_UNIX_TIMESTAMP("date") < :p_end GROUP BY "operatorid" ) "online_sum_chatting_time", ( SELECT SUM("seconds") "online_time" FROM "{operatoronline}" WHERE "operatorid" = o."operatorid" and "threadid" > 0 AND WM_UNIX_TIMESTAMP("date") >= :p_start AND WM_UNIX_TIMESTAMP("date") < :p_end GROUP BY "operatorid" ) "online_sum_chat_time_seconds", ( SELECT COUNT(i."invitationid") FROM "{invitation}" i INNER JOIN "{thread}" t ON i."threadid" = t."threadid" WHERE t."operatorid" = o."operatorid" AND WM_UNIX_TIMESTAMP(t."created") >= :p_start AND WM_UNIX_TIMESTAMP(t."created") < :p_end ) "invited_users" FROM "{operatorlastaccess}" o ' . $afrom . ' ' . $awhere . ' ORDER BY o.operatorid'; try { $this->db->Query($sql, $params); $result = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $row['online_sum_chatting_time_seconds'] = $row['online_sum_chat_time_seconds']; //Cause indetifiers more than 30 chars not suppoted by Oracle unset($row['online_sum_chat_time_seconds']); $result[$row['opid']] = $row; $result[$row['opid']]['threads'] = 0; $result[$row['opid']]['msgs'] = 0; $result[$row['opid']]['avglen'] = 0; if (!$result[$row['opid']]['online_time']) { $result[$row['opid']]['online_time'] = 0; } if (!$result[$row['opid']]['online_sum_chatting_time']) { $result[$row['opid']]['online_sum_chatting_time'] = 0; } if (!$result[$row['opid']]['online_chatting_time']) { $result[$row['opid']]['online_chatting_time'] = 0; } if (!$result[$row['opid']]['online_sum_chatting_time_seconds']) { $result[$row['opid']]['online_sum_chatting_time_seconds'] = 0; } $result[$row['opid']]['online_avg_chatting_time'] = 0; } } catch (Exception $e) { } if (empty($result)) { return array(); } foreach ($result as $id => $data) { $operator = Operator::getInstance()->GetOperatorById($id); $result[$id]['name'] = $operator['fullname']; } $sql = 'SELECT m."operatorid" "opid", COUNT(DISTINCT(m."threadid")) "threads", SUM( ( SELECT COUNT(*) FROM "{message}" mi WHERE mi."messageid" = m."messageid" AND mi."kind" = :kind ) ) "msgs", AVG(LENGTH(m."message")) "avglen" FROM "{message}" m WHERE m."operatorid" IS NOT NULL AND m."operatorid" IN (' . implode(', ', array_keys($result)) . ') AND WM_UNIX_TIMESTAMP(m."created") >= :p_start AND WM_UNIX_TIMESTAMP(m."created") < :p_end GROUP BY m."operatorid"'; try { $this->db->Query($sql, array('kind' => KIND_AGENT, 'p_start' => $start, 'p_end' => $end)); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $result[$row['opid']] = array_merge($result[$row['opid']], $row); if ($result[$row['opid']]['online_sum_chatting_time_seconds'] != 0) { $online_avg_chatting_time = $result[$row['opid']]['online_sum_chatting_time_seconds'] / $result[$row['opid']]['threads']; $result[$row['opid']]['online_avg_chatting_time'] = sprintf('%02d', (int) ($online_avg_chatting_time / 60)) . ':' . sprintf('%02d', $online_avg_chatting_time % 60); } else { $result[$row['opid']]['online_avg_chatting_time'] = 0; } } } catch (Exception $e) { } /*Среднее время ответа оператора*/ $sql = ' SELECT s.*, (WM_UNIX_TIMESTAMP(s."replied") - WM_UNIX_TIMESTAMP(s."started")) "delta" FROM ( SELECT "threadid" "tid", ( SELECT ti."created" FROM "{thread}" ti WHERE "threadid" = m."threadid" ) "started", ( SELECT MIN("created") FROM "{message}" mi WHERE "kind" = :kind_agent AND "threadid" = m."threadid" AND "operatorid" IS NOT NULL ) "replied", ( SELECT "operatorid" FROM "{message}" WHERE "kind" = :kind_agent AND "threadid" = m."threadid" AND "operatorid" IS NOT NULL AND "created" = ( SELECT MIN("created") FROM "{message}" WHERE "kind" = :kind_agent AND "threadid" = m."threadid" AND "operatorid" IS NOT NULL ) ) "operatorid" FROM "{message}" m WHERE "operatorid" IN (' . implode(', ', array_keys($result)) . ') AND WM_UNIX_TIMESTAMP("created") >= :p_start AND WM_UNIX_TIMESTAMP("created") < :p_end GROUP BY "threadid" ) s'; try { $this->db->Query($sql, array('kind_agent' => KIND_AGENT, 'p_start' => $start, 'p_end' => $end)); $result_deltas = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); if ($row['operatorid'] == null) { continue; } $opid = $row['operatorid']; if (!isset($result_deltas[$opid])) { $result_deltas[$opid]['sum'] = 0; $result_deltas[$opid]['count'] = 0; $result_deltas[$opid]['sum_square'] = 0; $result_deltas[$opid]['values'] = array(); } $result_deltas[$opid]['sum'] += $row['delta']; $result_deltas[$opid]['count'] += 1; $result_deltas[$opid]['sum_square'] += sqrt($row['delta']); $result_deltas[$opid]['values'][] = $row['delta']; } } catch (Exception $e) { } foreach ($result as $k => $v) { $result[$k]['avg_answer_time'] = 0; $result[$k]['answer_time_st_deviation'] = 0; $opid = $v['opid']; if (isset($result_deltas[$opid])) { $avg = $result_deltas[$opid]['sum'] / $result_deltas[$opid]['count']; $avg_ceil = ceil($avg); $result[$k]['avg_answer_time'] = sprintf('%02d', (int) ($avg_ceil / 60)) . ':' . sprintf('%02d', $avg_ceil % 60); $dispersion = 0; foreach ($result_deltas[$opid]['values'] as $v) { $dispersion += ($avg - $v) * ($avg - $v) / $result_deltas[$opid]['count']; } $result[$k]['answer_time_st_deviation'] = sprintf('%.2f', sqrt($dispersion)); } } return $result; }
function handleWithoutToken($threadid, $viewonly) { $TML = new SmartyClass(); $operator = Operator::getInstance()->GetLoggedOperator(); $remote_level = Browser::GetRemoteLevel($_SERVER['HTTP_USER_AGENT']); if ($remote_level != "ajaxed") { die("old browser is used, please update it"); } $thread = Thread::getInstance()->GetThreadById($threadid); if (!$thread || !isset($thread['token'])) { die("wrong thread"); } if ($viewonly && $operator['operatorid'] != $thread['operatorid']) { redirectToPageWithToken($thread, $viewonly, $remote_level); } $forcetake = verify_param("force", "/^true\$/", false); if ($forcetake) { ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'operator_force_join', array("operatorid" => $operator["operatorid"])); redirectToPageWithToken($thread, null, $remote_level); } else { // is taken by another $visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']); if ($thread['state'] != STATE_CLOSED && !empty($thread['operatorid']) && $operator['operatorid'] != $thread['operatorid'] && $operator['operatorid'] != $thread['nextoperatorid']) { $page = array('visitor' => $visitSession['visitorname'], 'agent' => $thread['operatorfullname'], 'force' => true, 'takelink' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&force=true", 'viewlink' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&viewonly=true", 'priority' => $thread['state'] == STATE_QUEUE_EXACT_OPERATOR || $thread['state'] == STATE_CHATTING_OPERATOR_BROWSER_CLOSED_REFRESHED); // TODO get rid of STATE_WAIT_ANOTHER_OPERATOR $TML->assign('link_arguments', "&thread={$threadid}"); $TML->assign('page', $page); $TML->display('confirm.tpl'); exit; } // is closed if ($thread['state'] == STATE_CLOSED) { $page = array('viewlink' => $_SERVER['PHP_SELF'] . "?thread=" . $threadid . "&viewonly=true", 'force' => false, 'thread_id' => $threadid, 'closed' => true); $TML->assign('link_arguments', "&thread={$threadid}"); $TML->assign('page', $page); $TML->display('confirm.tpl'); exit; } } ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'operator_join', array('operatorid' => $operator['operatorid'])); redirectToPageWithToken($thread, $viewonly, $remote_level); }
function sendFormSubmitted() { $login = trim($_REQUEST['login']); if (empty($login)) { return Resources::Get("errors.required", array(Resources::Get('form.field.login'))); } $o = Operator::getInstance()->GetOperatorByLogin($login); if (empty($o)) { return Resources::Get("errors.operator_not_found", array(Resources::Get('form.field.login'))); } Operator::getInstance()->SendRecoverPasswordMail($o['operatorid'], $_SERVER['HTTP_HOST']); }
function UserDelete($id) { Operator::getInstance()->DeleteOperator($id); }
function setAllDepartments() { global $TML; $operator = Operator::getInstance()->GetLoggedOperator(false); $departments = MapperFactory::getMapper("OperatorDepartment")->enumDepartmentsWithOperator($operator['operatorid'], Resources::getCurrentLocale()); $TML->assign('departments', $departments); }
function smarty_block_role_admin($params, $content, &$smarty, &$repeat) { $o = Operator::getInstance()->GetLoggedOperator(false); return $o['role'] == 'admin' ? $content : ''; }
$res = true; } else { $res = false; } $_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT] = $res; setcookie(WEBIM_COOKIE_VISITOR_IN_CHAT, $res, time() + 30, '/'); } $user_in_chat = false; if($_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT]) { $user_in_chat = true; } $invite_image = $location . "/themes/" . Browser::getCurrentTheme() . '/images/default-auto-invite-operator.gif'; if($operators_count == 1) { $operator = Operator::getInstance()->GetOperatorById(array_shift($operators)); if(!empty($operator) && !empty($operator['avatar'])) { $invite_image = $operator['avatar']; } } $json = new Json(SERVICES_JSON_LOOSE_TYPE); $statistics = getUsersStatsFromCookie();//isset($_COOKIE[WEBIM_COOKIE_AUTOINVITE_STATS]) ? $json->decode($_COOKIE[WEBIM_COOKIE_AUTOINVITE_STATS]) : null; $total_time_on_site = isset($_COOKIE[WEBIM_COOKIE_TOTAL_TIME_ON_SITE]) ? intval($_COOKIE[WEBIM_COOKIE_TOTAL_TIME_ON_SITE]) : 0; $visited_pages = array(); if(isset($statistics['visited_pages']) && is_array($statistics['visited_pages'])) { foreach ($statistics['visited_pages'] as $p) { if(isset($p['url'], $p['time'], $p['referrer'])) {
function getAvatar($operatorId) { $operator = Operator::getInstance()->GetOperatorById($operatorId); $avatar = $operator['avatar']; return $avatar; }
* * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once 'classes/functions.php'; require_once 'classes/class.thread.php'; require_once 'classes/class.visitsession.php'; require_once 'classes/class.visitedpage.php'; require_once 'classes/class.invitation.php'; $trackStateStrings = array(INVITATION_UNINITIALIZED => "uninitialized", INVITATION_CAN_BE_SENT => "can-be-sent", INVITATION_SENT => "sent", INVITATION_ACCEPTED => "accepted", INVITATION_REJECTED => "rejected", INVITATION_TIMEOUT => "timeout", INVITATION_MISSED => "missed"); if (!Operator::getInstance()->hasViewTrackerOperators()) { die; } $event = verify_param("event", "/^(init|poll|accept|reject|timeout|left)\$/"); $visitsessionid = VisitSession::GetInstance()->updateCurrentOrCreateSession(); if ($event == "init") { initVisitedPage($visitsessionid, Browser::getCurrentTheme()); exit; } $pageid = verify_param("pageid", "/^[a-z0-9]{32}\$/"); // FIXME: do we really need this udpate? VisitSession::GetInstance()->UpdateVisitSession($visitsessionid); VisitedPage::GetInstance()->UpdateVisitedPage($pageid); $visitedpage = VisitedPage::GetInstance()->GetVisitedPageById($pageid); $state = Invitation::GetInstance()->GetInvitationState($pageid); $showInvitation = NULL;
require_once '../classes/class.smartyclass.php'; $TML = new SmartyClass(); $operator = Operator::getInstance()->GetLoggedOperator(); $threadid = verify_param("thread", "/^\\d{1,8}\$/"); $token = verify_param("token", "/^\\d{1,8}\$/"); $thread = Thread::getInstance()->GetThreadById($threadid); $visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']); $TML->assign('visit_session', $visitSession); if (!$thread || !isset($thread['token']) || $token != $thread['token']) { die("wrong thread"); } $nextid = verify_param("nextoperatorid", "/^\\d{1,8}\$/"); $nextdepartmentid = verify_param("nextdepartmentid", "/^\\d{1,8}\$/"); $page = array(); if (!empty($nextid)) { $nextOperator = Operator::getInstance()->GetOperatorById($nextid); $TML->assign('nextoperator', $nextOperator); } if (!empty($nextdepartmentid)) { $nextdepartment = Department::getInstance()->getById($nextdepartmentid, Resources::getCurrentLocale()); $TML->assign('nextdepartment', $nextdepartment); } $errors = array(); ThreadProcessor::getInstance()->ProcessThread($threadid, 'redirect', array('nextoperatorid' => $nextid, 'nextdepartmentid' => $nextdepartmentid, 'operator' => Operator::getInstance()->GetLoggedOperator())); $TML->assign('page_settings', $page); if (count($errors) > 0) { $TML->assign('errors', $errors); $TML->display('chat_error.tpl'); } else { $TML->display('redirected.tpl'); }
protected function getReportLostOrInterceptedByOperator($start, $end, $intercepted = false, $departmentid = null, $locale = null) { $afrom = ""; $awhere = ""; $params = array($start, $end); if ($departmentid !== null || $locale !== null) { $afrom = "\n\t \t\t\tLEFT JOIN\n\t \t\t\t\t{operatorlastaccess} as ola\n\t \t\t\tON\n\t \t\t\t\tlv.operatorid = ola.operatorid\n\t \t\t "; if ($departmentid !== null) { $awhere .= "\n\t \t\t\t\tAND lv.operatorid IN (\n\t \t\t\t\t\tSELECT operatorid \n\t \t\t\t\t\tFROM {operatordepartment} \n\t \t\t\t\t\tWHERE departmentid = ?\n\t \t\t\t\t)\n\t \t\t\t"; $params[] = $departmentid; } if ($locale !== null) { $awhere .= "AND (ola.locales LIKE ? OR ola.locales IS NULL)"; $params[] = '%' . $locale . '%'; } } $sql = "SELECT\n lv.operatorid as opid,\n \tCOUNT(lv.id) as lost_vistors_count,\n \tAVG(lv.waittime) as avg_waittime\n\t\t\t\tFROM \n\t\t\t\t\t{lostvisitor} as lv\n\t\t\t\tLEFT JOIN \n\t\t\t\t\t{thread} as t\n\t\t\t\tON\n\t\t\t\t\tt.threadid = lv.threadid\n\t\t\t\t{$afrom}\n\t\t\t\tWHERE\n\t\t\t\t\tunix_timestamp(t.created) >= ? \t\n\t\t\t\tAND \n\t\t\t\t\tunix_timestamp(t.created) < ?\n\t\t\t\tAND \n\t\t\t\t\tlv.anotheroperatorid IS " . ($intercepted ? "NOT" : "") . " NULL\n\t\t\t\t{$awhere}\n\t\t\t\tGROUP BY opid"; try { $this->db->Query($sql, $params); $result = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $result[$row['opid']] = $row; $result[$row['opid']]['avg_waittime_str'] = (int) ($result[$row['opid']]['avg_waittime'] / 60) . ":" . $result[$row['opid']]['avg_waittime'] % 60; } } catch (Exception $e) { } $query = "SELECT lv.operatorid FROM {operatorlastaccess} as lv {$afrom} WHERE 1 {$awhere}"; try { $this->db->Query($query, array_slice($params, 2, 2)); $operators = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $operators[$row['operatorid']] = null; } } catch (Exception $e) { } if (count($operators) == 0) { return; } foreach (array_keys($operators) as $id) { $operator = Operator::getInstance()->GetOperatorById($id); if (!isset($result[$id])) { $result[$id] = array("opid" => $id, "lost_vistors_count" => 0, "avg_waittime" => 0, "dispersion" => 0, "avg_waittime" => 0, "st_deviation" => 0); } $result[$id]['name'] = $operator['fullname']; } $sql = "SELECT\n lv.operatorid as opid,\n \tlv.waittime\n\t\t\t\tFROM \n\t\t\t\t\t{lostvisitor} as lv\n\t\t\t\tLEFT JOIN \n\t\t\t\t\t{thread} as t\n\t\t\t\tON\n\t\t\t\t\tt.threadid = lv.threadid\n\t\t\t\t{$afrom}\n\t\t\t\tWHERE\n\t\t\t\t\tunix_timestamp(t.created) >= ?\n\t\t\t\tAND \n\t\t\t\t\tunix_timestamp(t.created) < ?\n\t\t\t\tAND \n\t\t\t\t\tlv.anotheroperatorid IS " . ($intercepted ? "NOT" : "") . " NULL\n\t\t\t\t{$awhere}\n\t\t\t\t"; try { $this->db->Query($sql, $params); while ($this->db->nextRecord()) { $row = $this->db->getRow(); if ($result[$row['opid']]['lost_vistors_count'] == 0) { continue; } if (!isset($result[$row['opid']]['dispersion'])) { $result[$row['opid']]['dispersion'] = 0; } $result[$row['opid']]['dispersion'] += ($result[$row['opid']]['avg_waittime'] - $row['waittime']) * ($result[$row['opid']]['avg_waittime'] - $row['waittime']) / $result[$row['opid']]['lost_vistors_count']; $result[$row['opid']]['st_deviation'] = sprintf("%.2f", sqrt($result[$row['opid']]['dispersion'])); } } catch (Exception $e) { } return $result; }
private function joinThreadAndSendMessage($thread, $operatorId) { $threadid = $thread['threadid']; $operator = Operator::getInstance()->GetOperatorById($operatorId); if ($operatorId != $thread['operatorid']) { $message = Resources::Get("chat.status.operator.joined", array($operator['fullname']), $thread['locale']); Thread::getInstance()->PostMessage($threadid, KIND_EVENTS, $message); // should explicitly send empty string for unset avatar $avatar = isset($operator['avatar']) && !empty($operator['avatar']) ? $operator['avatar'] : ""; Thread::getInstance()->PostMessage($threadid, KIND_AVATAR, $avatar); } $this->joinThread($thread, $operatorId); }
<?php /* * * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_STATUS, array(Operator::getInstance(), "UpdateOperatorStatus")); EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_STATUS, array(Operator::getInstance(), "updateOperatorOnlineStats")); EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_PING, array(Operator::getInstance(), "updateOperatorOnlineStatsForThread")); EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_PING, array(ThreadProcessor::getInstance(), "ProcessThread"));
public function getAdvancedReport($start, $end, $departmentid = null, $locale = null) { $afrom = ""; $awhere = ""; $params = array("start" => $start, "end" => $end); if ($departmentid !== null || $locale !== null) { if ($departmentid !== null) { $awhere .= "\n\t \t\t\t\tWHERE o.operatorid IN (\n\t \t\t\t\t\tSELECT operatorid \n\t \t\t\t\t\tFROM {operatordepartment} \n\t \t\t\t\t\tWHERE departmentid = :departmentid\n\t \t\t\t\t)\n\t \t\t\t"; $params['departmentid'] = $departmentid; } if ($locale !== null) { $awhere .= empty($awhere) ? 'WHERE ' : 'AND '; $awhere .= "(o.locales LIKE :locale OR o.locales IS NULL)"; $params['locale'] = '%' . $locale . '%'; } } $sql = "SELECT\n o.operatorid as opid,\n \t(\n \tSELECT\n \tAVG(rate)\n \tFROM\n \t{rate} as r\n \tWHERE\n \toperatorid = o.operatorid\n \tAND\n \tunix_timestamp(r.date) >= :start\n \tAND\n \tunix_timestamp(r.date) < :end\n \tAND\n \t\tdeldate IS NULL\n \t\t) AS rating, \n \t(\n \tSELECT\n \t\tCOUNT(rate)\n \t \tFROM\n \t {rate} as r\n \tWHERE\n \toperatorid = o.operatorid\n \t\tAND\n \tunix_timestamp(r.date) >= :start\n \tAND\n \tunix_timestamp(r.date) < :end\n \tAND\n \t\tdeldate IS NULL\n ) AS rate_count, \n (\n \tSELECT \n \t\tSEC_TO_TIME(SUM(seconds)) as online_time\n\t\t\t\t\tFROM \n\t\t\t\t\t\t{operatoronline}\n\t\t\t\t\tWHERE \n\t\t\t\t\t\toperatorid = o.operatorid and threadid = -1\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) >= :start \t\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) < :end\n\t\t\t\t\tGROUP BY operatorid\n\t\t\t\t) as online_time,\n\t\t\t\t(\n \tSELECT \n \t\tSEC_TO_TIME(SUM(seconds)) as online_time\n\t\t\t\t\tFROM \n\t\t\t\t\t\t{operatoronline}\n\t\t\t\t\tWHERE \n\t\t\t\t\t\toperatorid = o.operatorid and threadid = -2\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) >= :start \t\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) < :end\n\t\t\t\t\tGROUP BY operatorid\n\t\t\t\t) as online_chatting_time,\n\t\t\t\t(\n \tSELECT \n \t\tSEC_TO_TIME(SUM(seconds)) as online_time\n\t\t\t\t\tFROM \n\t\t\t\t\t\t{operatoronline}\n\t\t\t\t\tWHERE \n\t\t\t\t\t\toperatorid = o.operatorid and threadid > 0\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) >= :start \t\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) < :end\n\t\t\t\t\tGROUP BY operatorid\n\t\t\t\t) as online_sum_chatting_time,\n\t\t\t\t(\n \tSELECT \n \t\tSUM(seconds) as online_time\n\t\t\t\t\tFROM \n\t\t\t\t\t\t{operatoronline}\n\t\t\t\t\tWHERE \n\t\t\t\t\t\toperatorid = o.operatorid and threadid > 0\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) >= :start \t\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(date) < :end\n\t\t\t\t\tGROUP BY operatorid\n\t\t\t\t) as online_sum_chatting_time_seconds,\n\t\t\t\t(\n\t\t\t\t\tSELECT \n\t\t\t\t\t\tCOUNT(i.invitationid)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{invitation} as i\n\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t{thread} as t\n\t\t\t\t\tON\n\t\t\t\t\t\ti.threadid = t.threadid\n\t\t\t\t\tWHERE \n\t\t\t\t\t\tt.operatorid = o.operatorid\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(t.created) >= :start \t\n\t\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(t.created) < :end\n\t\t\t\t) as invited_users\n\t\t\t\tFROM \n\t\t\t\t\t{operatorlastaccess} as o\n\t\t\t\t{$awhere}\n\t\t\t\tORDER BY o.operatorid\n \t "; try { $this->db->Query($sql, $params); $result = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $result[$row['opid']] = $row; $result[$row['opid']]['threads'] = 0; $result[$row['opid']]['msgs'] = 0; $result[$row['opid']]['avglen'] = 0; if (!$result[$row['opid']]['online_time']) { $result[$row['opid']]['online_time'] = 0; } if (!$result[$row['opid']]['online_sum_chatting_time']) { $result[$row['opid']]['online_sum_chatting_time'] = 0; } if (!$result[$row['opid']]['online_chatting_time']) { $result[$row['opid']]['online_chatting_time'] = 0; } if (!$result[$row['opid']]['online_sum_chatting_time_seconds']) { $result[$row['opid']]['online_sum_chatting_time_seconds'] = 0; } $result[$row['opid']]['online_avg_chatting_time'] = 0; } } catch (Exception $e) { } if (empty($result)) { return array(); } foreach ($result as $id => $data) { $operator = Operator::getInstance()->GetOperatorById($id); $result[$id]['name'] = $operator['fullname']; } $sql = "SELECT\n m.operatorid as opid,\n COUNT(DISTINCT(m.threadid)) as threads,\n SUM(m.kind = :kind) as msgs,\n AVG(CHAR_LENGTH(m.message)) as avglen \n FROM\n \t{message} as m\n WHERE\n \tm.operatorid IS NOT NULL\n \t\tAND\n \t\t\tm.operatorid IN (" . implode(", ", array_keys($result)) . ")\n AND\n unix_timestamp(m.created) >= :start\n AND\n unix_timestamp(m.created) < :end \n GROUP BY\n m.operatorid"; try { $this->db->Query($sql, array("kind" => KIND_AGENT, "start" => $start, "end" => $end)); while ($this->db->nextRecord()) { $row = $this->db->getRow(); $result[$row['opid']] = array_merge($result[$row['opid']], $row); if ($result[$row['opid']]['online_sum_chatting_time_seconds'] != 0) { $online_avg_chatting_time = $result[$row['opid']]['online_sum_chatting_time_seconds'] / $result[$row['opid']]['threads']; $result[$row['opid']]['online_avg_chatting_time'] = sprintf("%02d", (int) ($online_avg_chatting_time / 60)) . ":" . sprintf("%02d", $online_avg_chatting_time % 60); } else { $result[$row['opid']]['online_avg_chatting_time'] = 0; } } } catch (Exception $e) { } $sql = "\n \t\tSELECT threadid AS tid, \n \t\t\t(\n\t\t\t\t\tSELECT created\n\t\t\t\t\tFROM {thread}\n\t\t\t\t\tWHERE\n\t\t\t\t\tthreadid = tid\n\t\t\t\t\tLIMIT 1\n\t\t\t\t) AS started, \n\t\t\t\t(\n\t\t\t\t\tSELECT created\n\t\t\t\t\tFROM {message}\n\t\t\t\t\tWHERE kind = ?\n\t\t\t\t\tAND threadid = tid \n\t\t\t\t\tAND operatorid IS NOT NULL \n\t\t\t\t\tORDER BY created ASC \n\t\t\t\t\tLIMIT 1\n\t\t\t\t) AS replied, \n\t\t\t\t(\n\t\t\t\t\tSELECT operatorid\n\t\t\t\t\tFROM {message}\n\t\t\t\t\tWHERE kind = ?\n\t\t\t\t\tAND threadid = tid \n\t\t\t\t\tAND operatorid IS NOT NULL \n\t\t\t\t\tORDER BY created ASC \n\t\t\t\t\tLIMIT 1\n\t\t\t\t) AS operatorid, \n\t\t\t\t(\n\t\t\t\t\tSELECT UNIX_TIMESTAMP(replied) - UNIX_TIMESTAMP(started)\n\t\t\t\t) AS delta\n\t\t\t\tFROM {message}\n\t\t\t\tWHERE\n\t\t\t\t\t\toperatorid IN (" . implode(", ", array_keys($result)) . ")\n\t\t\t\tAND\n\t\t\t\t\t\tunix_timestamp(created) >= ? \t\n\t\t\t\tAND \n\t\t\t\t\t\tunix_timestamp(created) < ?\n\t\t\t\tGROUP BY threadid"; try { $this->db->Query($sql, array(KIND_AGENT, KIND_AGENT, $start, $end)); $result_deltas = array(); while ($this->db->nextRecord()) { $row = $this->db->getRow(); if ($row['operatorid'] == null) { continue; } $opid = $row['operatorid']; if (!isset($result_deltas[$opid])) { $result_deltas[$opid]['sum'] = 0; $result_deltas[$opid]['count'] = 0; $result_deltas[$opid]['sum_square'] = 0; $result_deltas[$opid]['values'] = array(); } $result_deltas[$opid]['sum'] += $row['delta']; $result_deltas[$opid]['count'] += 1; $result_deltas[$opid]['sum_square'] += sqrt($row['delta']); $result_deltas[$opid]['values'][] = $row['delta']; } } catch (Exception $e) { } foreach ($result as $k => $v) { $result[$k]['avg_answer_time'] = 0; $result[$k]['answer_time_st_deviation'] = 0; $opid = $v['opid']; if (isset($result_deltas[$opid])) { $avg = $result_deltas[$opid]['sum'] / $result_deltas[$opid]['count']; $avg_ceil = ceil($avg); $result[$k]['avg_answer_time'] = sprintf("%02d", (int) ($avg_ceil / 60)) . ":" . sprintf("%02d", $avg_ceil % 60); $dispersion = 0; foreach ($result_deltas[$opid]['values'] as $v) { $dispersion += ($avg - $v) * ($avg - $v) / $result_deltas[$opid]['count']; } $result[$k]['answer_time_st_deviation'] = sprintf("%.2f", sqrt($dispersion)); } } return $result; }
private static function getOperatorFullNameToShow($thread) { if (empty($thread['nextoperatorid'])) { return $thread['operatorfullname']; } else { $op = Operator::getInstance()->getOperatorById($thread['nextoperatorid']); return $op['fullname']; } }
* http://webim.ru/license.html * */ $TITLE_KEY = 'page_login.title'; require_once '../classes/functions.php'; require_once '../classes/common.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.browser.php'; $TML = new SmartyClass($TITLE_KEY); $errors = array(); if (isset($_REQUEST['login']) && isset($_REQUEST['password'])) { $login = get_mandatory_param('login'); $password = get_mandatory_param('password'); $remember = isset($_REQUEST['isRemember']) && $_REQUEST['isRemember'] == "on"; $e = Operator::getInstance()->DoLogin($login, $password, $remember); if (isset($e)) { $errors[] = $e; } if (empty($errors)) { if (!empty($_REQUEST['redir'])) { header("Location: " . $_REQUEST['redir']); } else { header("Location: " . WEBIM_ROOT . "/"); } exit; } } $TML->assign('errors', $errors); $TML->assign('isRemember', true); if (!empty($_REQUEST['redir'])) {
$tmlPage['locales'] = getAvailableLocalesForChat(); Operator::getInstance()->ensureOperatorsAreInLastAccess(); $errors = array(); if (isset($_GET['startday'])) { $startday = verify_param("startday", "/^\\d+\$/"); $startmonth = verify_param("startmonth", "/^\\d{2}.\\d{2}\$/"); $endday = verify_param("endday", "/^\\d+\$/"); $endmonth = verify_param("endmonth", "/^\\d{2}.\\d{2}\$/"); $start = get_form_date($startday, $startmonth); $end = get_form_date($endday, $endmonth) + 24 * 60 * 60; $locale = verify_param("locale", "/^(en|ru)\$/"); $departmentid = verify_param("departmentid", "/^\\d+\$/"); if ($start > $end) { $errors[] = Resources::Get("statistics.wrong.dates"); } Operator::getInstance()->loadOnlineStatsIntoDB(); $tmlPage['reportByDate'] = MapperFactory::getMapper("Thread")->getReportByDate($start, $end, $departmentid, $locale); $tmlPage['reportByDateTotal'] = MapperFactory::getMapper("Thread")->getReportTotalByDate($start, $end, $departmentid, $locale); $tmlPage['reportByAgent'] = Thread::getInstance()->GetReportByAgent($start, $end, $departmentid, $locale); $tmlPage['reportLostVisitors'] = MapperFactory::getMapper("LostVisitor")->getReportByOperator($start, $end, $departmentid, $locale); $tmlPage['reportInterceptedVisitors'] = MapperFactory::getMapper("LostVisitor")->getReportInterceptedByOperator($start, $end, $departmentid, $locale); $tmlPage['reportByAgentByDate'] = MapperFactory::getMapper("Operator")->getAdvancedReportByDate($start, $end, $departmentid, $locale); $tmlPage['locale'] = $locale; $tmlPage['departmentid'] = $departmentid; $tmlPage['showresults'] = count($errors) ? 0 : 1; $tmlPage["formstartday"] = date("d", $start); $tmlPage["formstartmonth"] = date("m.y", $start); $tmlPage["formendday"] = date("d", $end - 24 * 60 * 60); $tmlPage["formendmonth"] = date("m.y", $end - 24 * 60 * 60); } else { $curr = getdate($currTime);
<?php /* * * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'active.visits.queue'; require_once dirname(__FILE__) . '/inc/admin_prolog.php'; require_once '../classes/functions.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.smartyclass.php'; $TML = new SmartyClass($TITLE_KEY); $o = Operator::getInstance(); $operator = $o->GetLoggedOperator(); if ($o->isOperatorsLimitExceeded()) { $TML->display('operators_limit.tpl'); require_once dirname(__FILE__) . '/inc/admin_epilog.php'; die; } $TML->assign('visit_details', get_app_location(true, false) . '/operator/visit.php?pageid='); $TML->display('../templates/active_visitors.tpl'); require_once dirname(__FILE__) . '/inc/admin_epilog.php';
<?php /* * * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/models/generic/class.mapperfactory.php'; Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $TML = new SmartyClass(); $TML->assign('operators', Operator::getInstance()->enumOperatorsWithOnlineStatus()); $TML->display('operators.tpl');
require_once '../classes/class.operator.php'; require_once '../classes/class.adminurl.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.visitsession.php'; require_once '../classes/models/generic/class.mapperfactory.php'; $banMapper = MapperFactory::getMapper("Ban"); $TML = new SmartyClass($TITLE_KEY); if (!isset($_REQUEST['submitted'])) { if (isset($_REQUEST['address'])) { $TML->assign('address', $_REQUEST['address']); } $TML->assign('till', date(getDateTimeFormat(), time() + 24 * 60 * 60)); // next day } $operator = Operator::getInstance()->GetLoggedOperator(); $errors = array(); if (isset($_REQUEST['submitted'])) { $banid = verify_param("banid", "/^(\\d{1,9})?\$/", ""); $address = get_mandatory_param("address"); $till = get_mandatory_param("till"); $comment = get_mandatory_param('comment'); if (empty($address)) { $errors[] = Resources::Get("errors.required", Resources::Get('form.field.address')); } elseif (!preg_match("/^(\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3})\$/", $address) && !preg_match("/^([a-z0-9-]+\\.)+[a-z0-9-]+\$/", $address)) { $errors[] = Resources::Get("errors.format", Resources::Get("form.field.address")); } if (empty($till)) { $errors[] = Resources::Get("errors.required", Resources::Get('form.field.till')); } $isCreateMode = empty($banid);
* */ require_once '../classes/functions.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.pagination.php'; require_once '../classes/class.smartyclass.php'; $operator = Operator::getInstance()->GetLoggedOperator(); $TML = new SmartyClass(); $action = $_REQUEST['action']; $TML->assign('action', $action); $threadid = verify_param('thread', "/^\\d{1,8}\$/"); $token = verify_param('token', "/^\\d{1,8}\$/"); $TML->assign('threadid', $threadid); $TML->assign('token', $token); if ($action == 'operators') { $found = Operator::getInstance()->getOnlineOperatorsWithDepartments($operator['operatorid'], Resources::getCurrentLocale()); $TML->assign('operators', $found); // $out = setupPage($found, $action, 'operatorid', 'fullname'); // $TML->assign('out', $out); } elseif ($action == 'visitor_redirected') { $TML->Assign('link', WEBIM_ROOT . '/operator/agent.php?thread=' . $threadid . '&token=' . $token . '&level=ajaxed&viewonly=true'); } elseif ($action == 'chat_closed') { $TML->Assign('link', WEBIM_ROOT . '/operator/agent.php?thread=' . $threadid . '&token=' . $token . '&level=ajaxed&viewonly=true&history=true'); } $TML->display('popup.tpl'); function setupPage($list, $action, $idfield, $valuefield) { global $token, $threadid, $TML; $pagination = setup_pagination($list); if (!empty($pagination)) { $page = array();