/** * Returns information about pagination. * * @param int $items_count Count of items which are separated by pages. * @param int $default_items_per_page Count of items per page. * @return array|boolean Associative array of pagination info or FALSE if the * info array cannot be build. Info array contatins the following keys: * - page: int, number of current page. * - total: int, total pages count. * - items: int, items per page. * - count: int, total items count. * - start: int, index of item to start from. * - end: int, index of item to end at. */ function pagination_info($items_count, $default_items_per_page = 15) { if ($items_count) { $items_per_page = verify_param("items", "/^\\d{1,3}\$/", $default_items_per_page); if ($items_per_page < 2) { $items_per_page = 2; } $total_pages = div($items_count + $items_per_page - 1, $items_per_page); $curr_page = verify_param("page", "/^\\d{1,6}\$/", 1); if ($curr_page < 1) { $curr_page = 1; } if ($curr_page > $total_pages) { $curr_page = $total_pages; } $start_index = ($curr_page - 1) * $items_per_page; $end_index = min($start_index + $items_per_page, $items_count); return array("page" => $curr_page, "items" => $items_per_page, "total" => $total_pages, "count" => $items_count, "start" => $start_index, "end" => $end_index); } else { return false; } }
function setup_pagination($items, $default_items_per_page = 15) { $pagination = array(); if (!empty($items)) { $items_per_page = verify_param("items", "/^\\d{1,3}\$/", $default_items_per_page); if ($items_per_page < 2) { $items_per_page = 2; } $total_pages = div(count($items) + $items_per_page - 1, $items_per_page); $curr_page = verify_param("page", "/^\\d{1,6}\$/", 1); if ($curr_page < 1) { $curr_page = 1; } if ($curr_page > $total_pages) { $curr_page = $total_pages; } $start_index = ($curr_page - 1) * $items_per_page; $end_index = min($start_index + $items_per_page, count($items)); $pagination['pagination_items'] = array_slice($items, $start_index, $end_index - $start_index); $pagination['pagination'] = array("page" => $curr_page, "items" => $items_per_page, "total" => $total_pages, "count" => count($items), "start" => $start_index, "end" => $end_index); } return $pagination; }
function setup_pagination($items, $default_items_per_page = 15) { $pagination = array(); if (!empty($items)) { $items_per_page = verify_param('items', "/^\\d{1,3}\$/", $default_items_per_page); if ($items_per_page < 2) { $items_per_page = 2; } $total_pages = div(count($items) + $items_per_page - 1, $items_per_page); $curr_page = verify_param('page', "/^\\d{1,6}\$/", 1); if ($curr_page < 1) { $curr_page = 1; } if ($curr_page > $total_pages) { $curr_page = $total_pages; } $start_index = ($curr_page - 1) * $items_per_page; $end_index = min($start_index + $items_per_page, count($items)); $pagination['pagination_items'] = array_slice($items, $start_index, $end_index - $start_index); $pagination['pagination'] = array('page' => $curr_page, 'items' => $items_per_page, 'total' => $total_pages, 'count' => count($items), 'start' => $start_index, 'end' => $end_index); } return $pagination; }
/** * Returns name of the style which shoud be used for the current request. * * Result of the method can depends on user role, requested page or any * other criteria. * * @return string Name of a style * @throws \RuntimeException */ public static function getCurrentStyle() { // Ceck if request contains chat style $style_name = verify_param("style", "/^\\w+\$/", ""); if (!$style_name) { // Use the default style $style_name = self::getDefaultStyle(); } // Get all style list and make sure that in has at least one style. $available_styles = self::getAvailableStyles(); if (empty($available_styles)) { throw new \RuntimeException('There are no dialog styles in the system'); } // Check if selected style exists. If it does not exist try to fall back // to "default". Finally, if there is no appropriate style in the system // throw an exception. if (in_array($style_name, $available_styles)) { return $style_name; } elseif (in_array('default', $available_styles)) { return 'default'; } else { throw new \RuntimeException('There is no appropriate dialog style in the system'); } }
/** * Retrieves locale for the current request. * * @return string Locale code */ function get_current_locale() { static $current_locale = null; if (is_null($current_locale)) { $locale = verify_param("locale", "/./", ""); // Check if locale code passed in as a param is valid $locale_param_valid = $locale && locale_pattern_check($locale) && locale_is_available($locale); // Check if locale code stored in session data is valid $session_locale_valid = isset($_SESSION[SESSION_PREFIX . 'locale']) && locale_pattern_check($_SESSION[SESSION_PREFIX . 'locale']) && locale_is_available($_SESSION[SESSION_PREFIX . 'locale']); if ($locale_param_valid) { $_SESSION[SESSION_PREFIX . 'locale'] = $locale; } elseif ($session_locale_valid) { $locale = $_SESSION[SESSION_PREFIX . 'locale']; } else { $locale = get_user_locale(); } $current_locale = $locale; } return $current_locale; }
* Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once 'classes/functions.php'; require_once 'classes/class.thread.php'; require_once 'classes/class.smartyclass.php'; require_once 'classes/class.visitsession.php'; $errors = array(); $page = array(); $token = verify_param("token", "/^\\d{1,8}\$/"); $threadid = verify_param("threadid", "/^\\d{1,8}\$/"); $thread = Thread::getInstance()->GetThreadById($threadid); if (!$thread || !isset($thread['token']) || $token != $thread['token']) { die("wrong thread"); } $email = !empty($_POST['email']) ? trim($_POST['email']) : false; $email_from = !empty($_POST['email_from']) ? trim($_POST['email_from']) : false; $mode = !empty($_POST['mode']) ? trim($_POST['mode']) : false; $dept = !empty($_POST['dept']) ? trim($_POST['dept']) : false; // отправке диалогов из мессенджера ---------- if ($dept && isset($aDko[$dept]['email'])) { $email = $aDko[$dept]['email']; } $TML = new SmartyClass(); $TML->assignCompanyInfoAndTheme(); $has_errors = false;
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'])) { $TML->assign('redir', htmlspecialchars($_REQUEST['redir'])); } $status = verify_param("status", "/^(new)\$/", ""); if ($status == "new") { $introduction = "true"; $TML->assign('introduction', $introduction); } $TML->display('../templates/login.tpl');
$show_empty = isset($_REQUEST['show_empty']) && $_REQUEST['show_empty'] == 1 ? true : false; if (isset($_REQUEST['q'])) { $q = $_REQUEST['q']; $items_per_page = verify_param('items', "/^\\d{1,3}\$/", DEFAULT_ITEMS_PER_PAGE); $op_param = verify_param('operator', "/^\\d+\$/"); // TODO should be operatorid $departmentidParam = verify_param('departmentid', "/^\\d+\$/"); $localeParam = verify_param($_REQUEST['locale'], '/^[a-z]{2}$/'); $rateParam = verify_param('rate', "/^\\w+\$/"); $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; $offlineParam = verify_param('offline', "/^\\d+\$/"); if ($offlineParam !== null) { $offlineParam = $offlineParam == 1 ? 0 : 1; } if ($start > $end) { $errors[] = Resources::Get('search.wrong.dates'); } else { $nTotal = Thread::getInstance()->GetListThreadsAdvCount($operator['operatorid'], $q, $start, $end, $op_param, $show_empty, $departmentidParam, $localeParam, $rateParam, $offlineParam); if ($nTotal) { $pagination = setup_pagination_cnt($nTotal, $items_per_page); $nLimit = $pagination['items']; $nOffset = $pagination['start']; $threads = Thread::getInstance()->GetListThreadsAdv($operator['operatorid'], $q, $start, $end, $op_param, $show_empty, $departmentidParam, $localeParam, $rateParam, $offlineParam, $nLimit, $nOffset); $tmlPage['pagination'] = $pagination; $tmlPage['pagination_items'] = $threads; if (!empty($tmlPage['pagination_items'])) {
* Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once 'classes/functions.php'; require_once 'classes/class.thread.php'; require_once 'classes/class.smartyclass.php'; require_once 'classes/class.visitsession.php'; $errors = array(); $page = array(); $token = verify_param('token', "/^\\d{1,8}\$/"); $threadid = verify_param('threadid', "/^\\d{1,8}\$/"); $thread = Thread::getInstance()->GetThreadById($threadid); if (!$thread || !isset($thread['token']) || $token != $thread['token']) { die('wrong thread'); } $email = !empty($_POST['email']) ? trim($_POST['email']) : false; $email_from = !empty($_POST['email_from']) ? trim($_POST['email_from']) : false; $mode = !empty($_POST['mode']) ? trim($_POST['mode']) : false; $dept = !empty($_POST['dept']) ? trim($_POST['dept']) : false; // отправке диалогов из мессенджера ---------- if ($dept && isset($aDko[$dept]['email'])) { $email = $aDko[$dept]['email']; } $TML = new SmartyClass(); $TML->assignCompanyInfoAndTheme(); $has_errors = false;
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; $nextState = $state; switch ($state) { case INVITATION_UNINITIALIZED: switch ($event) { case "poll": if (VisitedPage::GetInstance()->HasPendingInvitation($pageid)) { $showInvitation = true; $nextState = INVITATION_SENT; } else {
function redirectToPageWithToken($thread, $viewonly, $remote_level) { $token = $thread['token']; $lang = verify_param("lang", "/^[\\w-]{2,5}\$/", ""); $lang_param = !empty($lang) ? "&lang={$lang}" : ""; $viewonly_param = !empty($viewonly) ? "&viewonly=true" : ""; $url = WEBIM_ROOT . "/operator/agent.php?thread=" . $thread['threadid'] . "&token=" . $token . "&level=" . $remote_level . $viewonly_param . $lang_param; header("Location: " . $url); exit; }
* http://webim.ru/license.html * */ $TITLE_KEY = 'page.visit.title'; require_once '../classes/functions.php'; require_once '../classes/class.visitsession.php'; require_once '../classes/class.visitedpage.php'; require_once '../classes/class.pagination.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/class.geoiplookup.php'; $operator = Operator::getInstance()->GetLoggedOperator(); $visitSession = null; if (isset($_GET['visitsessionid'])) { $visitSession = VisitSession::GetInstance()->GetVisitSessionById($_GET['visitsessionid']); } elseif (isset($_GET['pageid'])) { $visitdpageid = verify_param('pageid', '/^[a-z0-9]{32}$/'); $vistedpage = VisitedPage::GetInstance()->GetVisitedPageById($_GET['pageid']); $visitSession = VisitSession::GetInstance()->GetVisitSessionById($vistedpage['visitsessionid']); } if (empty($visitSession)) { die('Invalid or no visitsessionid or pageid'); } $visitedPages = VisitedPage::GetInstance()->enumVisitedPagesByVisitSessionId($visitSession['visitsessionid']); $landingPage = end($visitedPages); $exitPage = reset($visitedPages); $timeend = 0; $timestart = 0; foreach ($visitedPages as $k => $vp) { $timeend = $timeend == 0 ? $vp['updated'] : max($timeend, $vp['updated']); $timestart = $timestart == 0 ? $vp['opened'] : min($timestart, $vp['opened']); $visitedPages[$k]['sessionduration'] = $vp['updated'] - $vp['opened'];
$TML->assign('messages', Thread::getInstance()->GetMessages($threadid, "html", false, $lastid)); $TML->assign('threadid', $threadid); $TML->assign('is_admin', Operator::getInstance()->isCurrentUserAdmin()); if (isset($_REQUEST['act'])) { switch ($_REQUEST['act']) { case 'removerate': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $rateid = verify_param("rateid", "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . "/operator/threadprocessor.php?threadid=" . $threadid; Thread::getInstance()->removeRate($rateid); header("Location: " . $url); exit; break; case 'removethread': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $threadid = verify_param("threadid", "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . "/operator/threadprocessor.php?threadid=" . $threadid; $TML->assign("removed_thread", true); MapperFactory::getMapper("Thread")->delete($threadid); //Thread::getInstance()->removeRate($rateid); //header("Location: ".$url); //exit(); break; case 'removehistory': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $url = WEBIM_ROOT . "/operator/history.php"; // TODO history Thread::getInstance()->removeHistory($threadid); header("Location: " . $url); exit; break;
function redirectToPageWithToken($thread, $viewonly, $remote_level) { $token = $thread['token']; $lang = verify_param('lang', "/^[\\w-]{2,5}\$/", ''); $lang_param = !empty($lang) ? "&lang={$lang}" : ''; $viewonly_param = !empty($viewonly) ? '&viewonly=true' : ''; $url = WEBIM_ROOT . '/operator/agent.php?thread=' . $thread['threadid'] . '&token=' . $token . '&level=' . $remote_level . $viewonly_param . $lang_param; header('Location: ' . $url); exit; }
* Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'topMenu.visitors'; 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'; $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; } $o->UpdateOperatorStatus($operator); $lang = verify_param("lang", "/^[\\w-]{2,5}\$/", ""); if (!empty($lang)) { $TML->assign('lang_param', "?lang={$lang}"); $TML->assign('lang_and_is_operator_param', "?isoperator=true&lang={$lang}"); } else { $TML->assign('lang_and_is_operator_param', "?isoperator=true"); } $TML->display('pending_visitors.tpl'); require_once dirname(__FILE__) . '/inc/admin_epilog.php';
require_once '../classes/functions.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.department.php'; 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');
* Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'topMenu.visitors'; 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'; $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; } $o->UpdateOperatorStatus($operator); $lang = verify_param('lang', "/^[\\w-]{2,5}\$/", ''); if (!empty($lang)) { $TML->assign('lang_param', "?lang={$lang}"); $TML->assign('lang_and_is_operator_param', "?isoperator=true&lang={$lang}"); } else { $TML->assign('lang_and_is_operator_param', '?isoperator=true'); } $TML->display('pending_visitors.tpl'); require_once dirname(__FILE__) . '/inc/admin_epilog.php';
* Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'page_analysis.search.title'; require_once dirname(__FILE__) . '/inc/admin_prolog.php'; require_once '../classes/functions.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/class.pagination.php'; $TML = new SmartyClass($TITLE_KEY); $tmlPage = null; $operator = Operator::getInstance()->GetLoggedOperator(); $items_per_page = verify_param("items", "/^\\d{1,3}\$/", DEFAULT_ITEMS_PER_PAGE); $show_empty = isset($_REQUEST['show_empty']) && $_REQUEST['show_empty'] == 1 ? true : false; if (isset($_REQUEST['q'])) { $nTotal = Thread::getInstance()->GetListThreadsCount($operator['operatorid'], $_REQUEST['q'], $show_empty); if ($nTotal) { $pagination = setup_pagination_cnt($nTotal, $items_per_page); $nLimit = $pagination['items']; $nOffset = $pagination['start']; $res = Thread::getInstance()->GetListThreads($operator['operatorid'], $_REQUEST['q'], $show_empty, $nLimit, $nOffset); $tmlPage['pagination'] = $pagination; $tmlPage['pagination_items'] = $res; } if (!empty($tmlPage['pagination_items'])) { $TML->assign('pagination', generate_pagination($tmlPage['pagination'])); } $tmlPage['formq'] = $_GET['q'];
* * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.threadprocessor.php'; require_once '../classes/class.eventcontroller.php'; require_once '../classes/events_register.php'; ThreadProcessor::getInstance()->ProcessOpenThreads(); $o = Operator::getInstance(); $operator = $o->GetLoggedOperator(false); $f = "i" . "s" . "Op" . "er" . "a" . "to" . "rsL" . "im" . "it" . "E" . "x" . "ce" . "ed" . "ed"; if ($o->{$f}()) { die; } $status = verify_param("status", "/^\\d{1,9}\$/", OPERATOR_STATUS_ONLINE); EventController::getInstance()->dispatchEvent(EventController::EVENT_OPERATOR_STATUS, array($operator)); if ($status != 0) { $since = verify_param("since", "/^\\d{1,9}\$/", 0); $xml = Thread::getInstance()->buildPendingThreadsXml($since, $operator); Browser::SendXmlHeaders(); echo $xml; } exit;
function GetMessages($threadid, $meth, $isvisitor, &$lastid, $forceShowingRates = false) { if ($forceShowingRates || $isvisitor == false && Operator::getInstance()->isCurrentUserAdmin()) { $crm = MapperFactory::getMapper('Rate'); $rates = $crm->getByThreadidWithOperator($threadid); $current_rate = array_shift($rates); } else { $current_rate = null; } $res = MapperFactory::getMapper("Message")->getListMessages($threadid, $lastid, $isvisitor); $messages = array(); foreach ($res as $msg) { $message = ""; switch ($meth) { case 'xml': if ($msg['kind'] == KIND_AVATAR) { $message = "<avatar>" . Browser::AddCdata($msg['message']) . "</avatar>"; } else { $message = "<message>" . Browser::AddCdata($this->messageToHtml($msg)) . "</message>\n"; } break; case 'text': $message = $this->messageToText($msg); break; case 'html': if ($current_rate && $current_rate['date'] < $msg['created']) { $messages[] = $this->rateToHtml($current_rate); $current_rate = array_shift($rates); } $isvisitor = verify_param("visitor", "/^true\$/", "false") == 'true'; $cleanup_special_tags = !$isvisitor; $message = $this->messageToHtml($msg, $cleanup_special_tags); break; } if (!empty($message)) { $messages[] = $message; } if ($msg['messageid'] > $lastid) { $lastid = $msg['messageid']; } } return $messages; }
$TML->assign('messages', Thread::getInstance()->GetMessages($threadid, 'html', false, $lastid)); $TML->assign('threadid', $threadid); $TML->assign('is_admin', Operator::getInstance()->isCurrentUserAdmin()); if (isset($_REQUEST['act'])) { switch ($_REQUEST['act']) { case 'removerate': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $rateid = verify_param('rateid', "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . '/operator/threadprocessor.php?threadid=' . $threadid; Thread::getInstance()->removeRate($rateid); header('Location: ' . $url); exit; break; case 'removethread': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $threadid = verify_param('threadid', "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . '/operator/threadprocessor.php?threadid=' . $threadid; $TML->assign('removed_thread', true); MapperFactory::getMapper('Thread')->delete($threadid); //Thread::getInstance()->removeRate($rateid); //header("Location: ".$url); //exit(); break; case 'removehistory': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $url = WEBIM_ROOT . '/operator/history.php'; // TODO history Thread::getInstance()->removeHistory($threadid); header('Location: ' . $url); exit; break;
$currTime = getCurrentTime(); $tmlPage['availableMonth'] = get_month_selection($currTime - 400 * 24 * 60 * 60, $currTime + 50 * 24 * 60 * 60); $tmlPage['showresults'] = false; $tmlPage['departments'] = MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale()); $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);
* Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once '../classes/functions.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.visitsession.php'; require_once '../classes/class.visitedpage.php'; require_once '../classes/class.invitation.php'; $operator = Operator::getInstance()->GetLoggedOperator(); $pageId = verify_param('pageid', '/^([a-z0-9]{32})?$/', ''); if (empty($pageId)) { die('invalid or absent pageid'); } $visitSession = VisitSession::GetInstance()->GetVisitSessionByPageId($pageId); $remoteLevel = Browser::GetRemoteLevel($visitSession['useragent']); $thread = VisitedPage::GetInstance()->GetInvitationThread($pageId); if (empty($thread) || $thread['state'] == STATE_CLOSED) { $thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_INVITE, array('operatorfullname' => $operator['fullname'], 'operatorid' => $operator['operatorid'], 'visitsessionid' => $visitSession['visitsessionid'])); VisitSession::GetInstance()->UpdateVisitSession($visitSession['visitsessionid'], array('hasthread' => 1)); $introMessage = Resources::Get('invite.intro.message', array($visitSession['visitorname']), WEBIM_CURRENT_LOCALE); Thread::getInstance()->PostMessage($thread['threadid'], KIND_FOR_AGENT, $introMessage); $invitationId = Invitation::getInstance()->CreateInvitation($thread['threadid']); VisitedPage::GetInstance()->UpdateVisitedPage($pageId, array('invitationid' => $invitationId)); } header('Location: ' . WEBIM_ROOT . '/operator/agent.php?thread=' . $thread['threadid'] . '&token=' . $thread['token'] . '&level=' . $remoteLevel . '&force=false');
* * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once 'classes/common.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'; require_once 'classes/class.operator.php'; require_once 'classes/class.smartyclass.php'; $pageId = verify_param('pageid', '/^[a-z0-9]{32}$/'); $isSecure = verify_param('issecure', "/^\\d+\$/", 0) == 1; $visitSession = VisitSession::GetInstance()->GetVisitSessionByPageId($pageId); $invitation = Invitation::GetInstance()->GetInvitationByVisitedPageId($pageId); $thread = Thread::getInstance()->GetThreadById($invitation['threadid']); $message = getInvitationMessage($invitation); // set invitation parameters $p_location = get_app_location(true, $isSecure); $p_theme = Browser::getCurrentTheme(); $p_message = $message . " <img src=\"{$p_location}/themes/{$p_theme}/images/invite/bullet5.gif\"/>"; $p_sound = $p_location . '/sounds/default_invite.wav'; $p_hideanim = $p_location . "/track.php?issecure={$isSecure}&"; $p_level = Browser::GetRemoteLevel($visitSession['useragent']); $p_threadid = $thread['threadid']; $p_token = $thread['token']; $p_pageid = $pageId; $p_lang = WEBIM_CURRENT_LOCALE;
public static function getCurrentTheme() { $theme = verify_param('theme', "/^\\w+\$/", 'default'); return $theme; }
$image = verify_param("image", "/^[\\w\\.]+\$/", "webim"); $theme = verify_param("theme", "/^\\w+\$/", "default"); $TML->assign('theme', $theme); //$TML->assign('availableImages', Button::enumAvailableImages(WEBIM_CURRENT_LOCALE)); //$TML->assign('availableThemes', enumAvailableThemes()); //$TML->assign('availableDepartments', MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale())); $TML->assign('params', Button::getParameters()); $lang = Resources::getCurrentLocale(); $showhost = verify_param("include_host_url", "/^y\$/", "") == "y"; $includeTracker = verify_param("add_track_code", "/^y\$/", "") == "y"; $forcesecure = verify_param("secure", "/^y\$/", "") == "y"; $chooseoperator = verify_param("choose_operator", "/^\\w+\$/", ""); $chatimmediately = verify_param("chat_immediately", "/^y\$/", "") == "y"; $departmentkey = verify_param("department_key", "/^\\w+\$/"); $choosedepartment = verify_param("choose_department", "/^y\$/", "") == "y"; $locale = verify_param("locale", "/^([a-z]{2})\$/", Resources::getCurrentLocale()); $size = array(); if (function_exists('gd_info')) { // TODO: for other file types $info = gd_info(); $filename = dirname(__FILE__) . "/../" . Button::getImageNameFromParam($image, null, $lang, null, true); if (file_exists($filename)) { // isset($info['GIF Read Support']) && $info['GIF Read Support'] && TODO check other file types $size = @getimagesize($filename); } } $location = WEBIM_ROOT; if ($showhost) { $location = ($forcesecure ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . WEBIM_ROOT; } $alt = Resources::Get('webim.online.consultant');
function tryToGetExistingThread() { $threadid = verify_param('thread', "/^\\d{1,8}\$/", ''); $thread = null; if (empty($threadid)) { $visitor = GetVisitorFromRequestAndSetCookie(); $thread = MapperFactory::getMapper('Thread')->getActiveThreadForVisitor($visitor['id']); } else { $thread = Thread::getInstance()->GetThreadById($threadid); $token = verify_param('token', "/^\\d{1,8}\$/"); if ($token != $thread['token'] || $thread['state'] == STATE_CLOSED) { $thread = null; } } if (!empty($thread) && (visitorHasAccess($thread) || empty($threadid))) { ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'ping_visitor'); $thread = Thread::getInstance()->GetThreadById($thread['threadid']); if (empty($thread) || $thread['state'] == STATE_CLOSED) { $thread = null; } } else { $thread = null; } return $thread; }
$image = verify_param('image', "/^[\\w\\.]+\$/", 'webim'); $theme = verify_param('theme', "/^\\w+\$/", 'default'); $TML->assign('theme', $theme); //$TML->assign('availableImages', Button::enumAvailableImages(WEBIM_CURRENT_LOCALE)); //$TML->assign('availableThemes', enumAvailableThemes()); //$TML->assign('availableDepartments', MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale())); $TML->assign('params', Button::getParameters()); $lang = Resources::getCurrentLocale(); $showhost = verify_param('include_host_url', '/^y$/', '') == 'y'; $includeTracker = verify_param('add_track_code', '/^y$/', '') == 'y'; $forcesecure = verify_param('secure', '/^y$/', '') == 'y'; $chooseoperator = verify_param('choose_operator', "/^\\w+\$/", ''); $chatimmediately = verify_param('chat_immediately', '/^y$/', '') == 'y'; $departmentkey = verify_param('department_key', "/^\\w+\$/"); $choosedepartment = verify_param('choose_department', '/^y$/', '') == 'y'; $locale = verify_param('locale', '/^([a-z]{2})$/', Resources::getCurrentLocale()); $size = array(); if (function_exists('gd_info')) { // TODO: for other file types $info = gd_info(); $filename = dirname(__FILE__) . '/../' . Button::getImageNameFromParam($image, null, $lang, null, true); if (file_exists($filename)) { // isset($info['GIF Read Support']) && $info['GIF Read Support'] && TODO check other file types $size = @getimagesize($filename); } } $location = WEBIM_ROOT; if ($showhost) { $location = ($forcesecure ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . WEBIM_ROOT; } $alt = Resources::Get('webim.online.consultant');
} } if (empty($errors)) { $time = strtotime($till); if ($time < 1) { $errors[] = Resources::Get("errors.format", Resources::Get("form.field.till")); } $hashTable = array('till' => date('Y-m-d H:i:s', $time), 'address' => $address, 'comment' => $comment); if ($isCreateMode) { $hashTable['created'] = null; } else { $hashTable['banid'] = $banid; } $banMapper->save($hashTable); header("Location: " . AdminURL::getInstance()->getURL('blocked')); exit; } $TML->assign('address', $address); $TML->assign('till', $till); $TML->assign('comment', $comment); } elseif (isset($_REQUEST['banid'])) { $banid = verify_param('banid', "/^\\d{1,9}\$/"); $ban = $banMapper->getById($banid); $TML->assign('address', $ban['address']); $TML->assign('till', date(getDateTimeFormat(), $ban['till'])); $TML->assign('comment', $ban['comment']); } require_once dirname(__FILE__) . '/inc/admin_prolog_after.php'; $TML->assign('errors', $errors); $TML->display('ban.tpl'); require_once dirname(__FILE__) . '/inc/admin_epilog.php';
* * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ require_once 'classes/common.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'; require_once 'classes/class.operator.php'; require_once 'classes/class.smartyclass.php'; $pageId = verify_param("pageid", "/^[a-z0-9]{32}\$/"); $isSecure = verify_param("issecure", "/^\\d+\$/", 0) == 1; $visitSession = VisitSession::GetInstance()->GetVisitSessionByPageId($pageId); $invitation = Invitation::GetInstance()->GetInvitationByVisitedPageId($pageId); $thread = Thread::getInstance()->GetThreadById($invitation['threadid']); $message = getInvitationMessage($invitation); // set invitation parameters $p_location = get_app_location(true, $isSecure); $p_theme = Browser::getCurrentTheme(); $p_message = $message . " <img src=\"{$p_location}/themes/{$p_theme}/images/invite/bullet5.gif\"/>"; $p_sound = $p_location . "/sounds/default_invite.wav"; $p_hideanim = $p_location . "/track.php?issecure={$isSecure}&"; $p_level = Browser::GetRemoteLevel($visitSession['useragent']); $p_threadid = $thread['threadid']; $p_token = $thread['token']; $p_pageid = $pageId; $p_lang = WEBIM_CURRENT_LOCALE;