コード例 #1
0
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
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);
コード例 #2
0
 private function updateThreadState($threadid, $state)
 {
     $hash = array('state' => $state);
     Thread::getInstance()->CommitThread($threadid, $hash);
 }
コード例 #3
0
	}

	VisitSession::GetInstance()->setVisitSessionCurrentPage($visitor['id'], $referer, $referer_title);
	
	if($user_in_chat) { 
	  if(empty($referer_title)) {
    	  $referer_title = Resources::Get("chat.visited_page.no_title");
  	  }
  	  
	  $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "";
	 
	  if (empty($visitor)) {
	    return;
	  }
		
	  Thread::getInstance()->SendVisitedPageForOpenThreads($visitor['id'], $referer, $referer_title);
	}
	
	header('Content-type: text/javascript; charset='.BROWSER_CHARSET);
?>

var rules = [
	<?php 
	  $rules = MapperFactory::getMapper("AutoInvite")->getAll();

	  foreach ($rules as $rule):
	  	if(WEBIM_ENCODING != 'UTF-8') {
	  		$rule['text'] = smarticonv('cp1251', 'utf-8', $rule['text']);
	  	}
	?>
		{
コード例 #4
0
ファイル: invite.php プロジェクト: Nikitian/fl-ru-damp
 * предоставляются на условиях лицензии, доступной по адресу
 * 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;
$p_invitation = getInvitationContent(getAvatar($thread['operatorid']), $message, $isSecure);
$p_amination_duration = INVITE_ANIMATION_DURATION;
header('Content-type: text/javascript; charset=' . BROWSER_CHARSET);
コード例 #5
0
ファイル: invite.php プロジェクト: kapai69/fl-ru-damp
 * 
 * Все права защищены. (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');
exit;
コード例 #6
0
ファイル: onsite.php プロジェクト: Nikitian/fl-ru-damp
<?php

/* 
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (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';
$operator = Operator::getInstance()->GetLoggedOperator(false);
// папка online в мэмкэш --------------------
//touch_online_file(OPERATOR_VIEW_TRACKER_FILE);
$mem_buff->set('OPERATOR_VIEW_TRACKER_FILE', time(), 1800);
if (!$operator) {
    Browser::SendXmlHeaders();
    echo "<error><descr>" . escape_with_cdata(getstring("agent.not_logged_in")) . "</descr></error>";
    exit;
}
$xml = Thread::getInstance()->BuildVisitorsXml();
Browser::SendXmlHeaders();
echo $xml;
コード例 #7
0
ファイル: agent.php プロジェクト: notUserDeveloper/fl-ru-damp
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}&amp;force=true", 'viewlink' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&amp;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 . "&amp;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);
}
コード例 #8
0
ファイル: adv_history.php プロジェクト: kapai69/fl-ru-damp
 $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'])) {
             for ($i = 0; $i < count($tmlPage['pagination_items']); ++$i) {
                 $tmlPage['pagination_items'][$i]['diff'] = webim_date_diff($tmlPage['pagination_items'][$i]['modified'] - $tmlPage['pagination_items'][$i]['created']);
             }
             $TML->assign('pagination', generate_pagination($tmlPage['pagination']));
         }
     }
     $tmlPage['formq'] = $q;
     $tmlPage['formoperator'] = $op_param;
     $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);
コード例 #9
0
ファイル: leavemessage.php プロジェクト: kapai69/fl-ru-damp
    $TML->assign('phone', getSecureText($phone));
    $TML->assign('message', getSecureText($message));
    $TML->assign('canChangeName', getSecureText($canChangeName));
    $TML->assign('captcha_num', '');
    $TML->display('leave-message.tpl');
    exit;
}
$visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession();
$params = array();
$params['visitsessionid'] = $visitSessionId;
$params['lastpingvisitor'] = null;
$params['offline'] = 1;
$threads_count = MapperFactory::getMapper('Thread')->getNonEmptyThreadsCountByVisitorId($visitorid);
$thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_CLOSED, $params);
VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1));
Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread);
Thread::getInstance()->PostMessage($thread['threadid'], KIND_USER, Resources::Get('chat.window.offline_message', array($message)));
MapperFactory::getMapper('Thread')->incrementVisitorMessageCount($thread['threadid']);
$first_message = MapperFactory::getMapper('Message')->getFirstMessage($thread['threadid']);
Visitor::getInstance()->setVisitorNameCookie($visitor_name);
// отправке диалогов из мессенджера
$subject = $dept && isset($aDko[$dept]['subject']) ? $subject = $aDko[$dept]['subject'] : Resources::Get('leavemail.subject', array($visitor_name), WEBIM_CURRENT_LOCALE);
$body = Resources::Get('leavemail.body', array($visitor_name, $email, $message, $phone, Thread::getInstance()->formatOpenerWithTitle(), HTTP_PREFIX . $_SERVER['HTTP_HOST'] . WEBIM_ROOT . '/operator/threadprocessor.php?threadid=' . $thread['threadid'], str_replace("\n", "\n\n", $first_message['message'])), WEBIM_CURRENT_LOCALE);
// отправке диалогов из мессенджера
if ($dept && ($feedback = feedbackAdd($dept, $visitor_name, $email, $body, get_uid(false)))) {
    $body .= "\n" . '[[UCODE::{' . $feedback['uc'] . '},FID::{' . $feedback['id'] . '}]]';
}
// отправке диалогов из мессенджера
$inbox_mail = $dept && isset($aDko[$dept]['email']) ? $aDko[$dept]['email'] : Settings::Get('offline_email');
webim_mail($inbox_mail, $visitor_name . '<' . $email . '>', $subject, $body);
$TML->display('leave-message-sent.tpl');
コード例 #10
0
ファイル: feedback.php プロジェクト: Nikitian/fl-ru-damp
$TML->assign('RAND', rand(1000, 9999));
$args = array();
foreach ($_GET as $key => $item) {
    if ($key != 'action') {
        $args[] = "{$key}={$item}";
    }
}
$TML->assign('chaturi', "./?a=5" . join('&', $args));
$TML->assign('MAX_FILES', feedback::MAX_FILES);
$TML->assign('u_token_key', $_SESSION['rand']);
if ($has_errors) {
    echo "Error:{$errors[0]};{$errors['1']}" . ($errors[2] ? ';' . $errors[2] : '');
    exit;
}
$visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession();
$params = array();
$params['visitsessionid'] = $visitSessionId;
$params['lastpingvisitor'] = null;
$params['offline'] = 1;
$threads_count = MapperFactory::getMapper("Thread")->getNonEmptyThreadsCountByVisitorId($visitorid);
$thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_CLOSED, $params);
VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1));
Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread);
Visitor::getInstance()->setVisitorNameCookie($visitor_name);
$feedback = new feedback();
$uid = get_uid(false);
$login = $_SESSION['webim_uname'];
$email = $_SESSION['webim_email'];
$feedback->Add($uid, $login, $email, $department, iconv("UTF-8", "WINDOWS-1251//IGNORE", $message), $attach);
echo "Success: ok";
exit;
コード例 #11
0
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
require_once '../classes/functions.php';
require_once '../classes/class.thread.php';
require_once '../classes/class.pagination.php';
require_once '../classes/class.smartyclass.php';
require_once '../classes/class.visitsession.php';
$operator = Operator::getInstance()->GetLoggedOperator();
$TML = new SmartyClass();
$items_per_page = verify_param("items", "/^\\d{1,3}\$/", DEFAULT_ITEMS_PER_PAGE);
$visitsessionid = verify_param("visitsessionid", "/^\\d{0,63}\\.?\\d{0,63}\$/", "");
$threadid = verify_param("threadid", "/^\\d{1,8}\$/", "");
$found = Thread::getInstance()->GetThreadsByVisitSessionID($visitsessionid);
$tmlPage = array();
if ($found) {
    $pagination = setup_pagination($found);
    $tmlPage['pagination'] = $pagination['pagination'];
    $tmlPage['pagination_items'] = $pagination['pagination_items'];
    $TML->assign('pagination', generate_pagination($tmlPage['pagination']));
    for ($i = 0; $i < count($tmlPage['pagination_items']); $i++) {
        $tmlPage['pagination_items'][$i]['diff'] = webim_date_diff($tmlPage['pagination_items'][$i]['modified'] - $tmlPage['pagination_items'][$i]['created']);
    }
}
$TML->assign('page_settings', $tmlPage);
$TML->display('visit_info.tpl');
コード例 #12
0
 function GetInvitationThread($visitedpageid)
 {
     $invitation = Invitation::GetInstance()->GetInvitationByVisitedPageId($visitedpageid);
     if (!empty($invitation['threadid'])) {
         return Thread::getInstance()->GetThreadById($invitation['threadid']);
     }
     return NULL;
 }
コード例 #13
0
<?php

/**
 * ManiaLive - TrackMania dedicated server manager in PHP
 *
 * @copyright   Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
 * @license     http://www.gnu.org/licenses/lgpl.html LGPL License 3
 * @version     $Revision$:
 * @author      $Author$:
 * @date        $Date$:
 */
namespace ManiaLive\Threading;

/**
 * This is what is run on each new process
 * that is being created by the ThreadPool.
 */
// include the __autoload function
require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php';
Thread::getInstance()->run();
コード例 #14
0
function updateContacts($name, $email, $phone, $threadid, $visitsessionid)
{
    $visitSession = MapperFactory::getMapper("VisitSession")->getById($visitsessionid);
    if ($visitSession['visitorname'] != $name) {
        Thread::getInstance()->RenameVisitor(array("threadid" => $threadid), $name);
        Visitor::getInstance()->setVisitorNameCookie($name);
        MapperFactory::getMapper("VisitSession")->save(array('visitsessionid' => $visitsessionid, 'visitorname' => $name));
    }
}
コード例 #15
0
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'];
    $tmlPage['show_empty'] = $show_empty;
}
$TML->assign('advanced', false);
$TML->assign('page_settings', $tmlPage);
$TML->display('thread_search.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
コード例 #16
0
ファイル: update.php プロジェクト: Nikitian/fl-ru-damp
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (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;
コード例 #17
0
ファイル: class.thread.php プロジェクト: Nikitian/fl-ru-damp
 public function sendAutoIniviteTextToOperator($thread, $autoinviteid)
 {
     $ainvite = MapperFactory::getMapper("AutoInvite")->getById($autoinviteid);
     if (empty($ainvite)) {
         return;
     }
     $message = Resources::Get("chat.window.auto_invite_text", array($ainvite['text']));
     Thread::getInstance()->PostMessage($thread['threadid'], KIND_FOR_AGENT, $message);
 }
コード例 #18
0
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;
    }
}
$TML->display('thread_log.tpl');
コード例 #19
0
ファイル: statistics.php プロジェクト: Nikitian/fl-ru-damp
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);
    if ($curr['mday'] < 7) {
        // previous month
        if ($curr['mon'] == 1) {
コード例 #20
0
ファイル: mail.php プロジェクト: notUserDeveloper/fl-ru-damp
}
$eHistory = $history = "";
$lastid = -1;
$output = Thread::getInstance()->GetMessages($threadid, "text", true, $lastid);
foreach ($output as $msg) {
    $history .= $msg;
    $eHistory .= $msg;
}
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
$systemInfo = "Системная информация\nимя: " . $visitSession['visitorname'] . "\nсоздан: " . date('Y-m-d', $visitSession['created']) . "\nip: {$visitSession['ip']}\nбраузер: " . get_user_agent($visitSession['useragent']) . "\n\n";
$history = $systemInfo . $history;
$subject = Resources::Get("mail.visitor.history.subject");
// отправке диалогов из мессенджера ------------
if ($dept && isset($aDko[$dept]['subject'])) {
    $subject = $aDko[$dept]['subject'];
}
$visitor_name = $visitSession['visitorname'];
$body = Resources::Get("mail.visitor.history.body", array($visitor_name, $history));
// отправке диалогов из мессенджера
if ($dept && ($feedback = feedbackAdd($dept, $visitor_name, $email_from, $body, 0))) {
    $body .= "\n" . '[[UCODE::{' . $feedback['uc'] . '},FID::{' . $feedback['id'] . '}]]';
}
$webim_from_email = $email_from ? $email_from : Settings::Get("from_email");
$body = Resources::Get("mail.visitor.history.body", array($visitor_name, $history));
webim_mail($email, $webim_from_email, $subject, $body, 0);
// отправке диалогов из мессенджера ------------
if ($dept && isset($aDko[$dept]['option'])) {
    $sMsg = 'Диалог был отправлен в раздел: ' . $aDko[$dept]['option'];
    Thread::getInstance()->PostMessage($threadid, KIND_EVENTS, $sMsg);
}
$TML->display('send-history-sent.tpl');
コード例 #21
0
 private static function formatStatistics($start, $end)
 {
     $result = '';
     $report = MapperFactory::getMapper('Thread')->getReportByDate($start, $end);
     if (count($report) == 0) {
         $report = array(array(date(getDateFormat(), $start), 0, 0, 0));
     }
     if (count($report) > 1) {
         $report_total = MapperFactory::getMapper('Thread')->getReportTotalByDate($start, $end);
         $report_total = array_values($report_total);
         array_unshift($report_total, Resources::Get('report.total'));
         $report[] = $report_total;
         unset($report_total);
     }
     $result .= Resources::Get('report.bydate.title') . "\n";
     $result .= self::formatTable(array(Resources::Get('report.bydate.1'), Resources::Get('report.bydate.2'), Resources::Get('report.bydate.3'), Resources::Get('report.bydate.4')), $report, self::FIELD_LENGTH) . "\n\n";
     $report = MapperFactory::getMapper('Operator')->getAdvancedReportByDate($start, $end);
     $result .= Resources::Get('report.byoperator_date.title') . "\n";
     $result .= Resources::Get('report.no_items');
     $dates_count = count($report);
     if (count($report) > 0) {
         $header = array(Resources::Get('report.byoperator.1'), Resources::Get('report.byoperator.2'), Resources::Get('report.byoperator.3'), Resources::Get('report.byoperator.6'), Resources::Get('report.byoperator.7'), Resources::Get('report.byoperator.11'));
         $field_count = count($header);
         $length_chars = $field_count * self::FIELD_LENGTH + $field_count;
         $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n";
         $result .= self::formatTableLine($header, self::FIELD_LENGTH) . "\n";
         $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n";
         $middle = floor($length_chars / 2);
         foreach ($report as $d => $r) {
             if ($dates_count > 1) {
                 $result .= sprintf('%' . ($middle + strlen($d)) . 's', $d) . "\n";
                 $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n";
             }
             foreach ($r as $v) {
                 $v = array($v['name'], $v['threads'], isset($v['messages']) ? $v['messages'] : '', $v['online_time'], $v['online_chatting_time'], $v['invited_users']);
                 $result .= self::formatTableLine($v, self::FIELD_LENGTH) . "\n";
                 $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n";
             }
         }
     }
     $result .= "\n\n";
     if ($dates_count > 1) {
         $report = Thread::getInstance()->GetReportByAgent($start, $end);
         $data = array();
         foreach ($report as $v) {
             $data[] = array($v['name'], $v['threads'], $v['messages'], $v['online_time'], $v['online_chatting_time'], $v['invited_users']);
         }
         $result .= Resources::Get('report.byoperator.title') . "\n";
         $result .= self::formatTable($header, $data, self::FIELD_LENGTH) . "\n\n";
     }
     $result .= Resources::Get('report.lostvisitors.title') . "\n";
     $report = MapperFactory::getMapper('LostVisitor')->getReportByOperator($start, $end);
     $data = array();
     $header = array(Resources::Get('report.lostvisitors.1'), Resources::Get('report.lostvisitors.2'), Resources::Get('report.lostvisitors.3'));
     if (!empty($report)) {
         foreach ($report as $v) {
             $data[] = array($v['name'], isset($v['lost_vistors_count']) ? $v['lost_vistors_count'] : 0, isset($v['avg_waittime_str']) ? $v['avg_waittime_str'] : 0);
         }
     }
     $result .= self::formatTable($header, $data, self::FIELD_LENGTH) . "\n\n";
     $result .= Resources::Get('report.interceptedvisitors.title') . "\n";
     $report = MapperFactory::getMapper('LostVisitor')->getReportInterceptedByOperator($start, $end);
     $data = array();
     $header = array(Resources::Get('report.interceptedvisitors.1'), Resources::Get('report.interceptedvisitors.2'), Resources::Get('report.interceptedvisitors.3'));
     if (!empty($report)) {
         foreach ($report as $v) {
             $data[] = array($v['name'], isset($v['lost_vistors_count']) ? $v['lost_vistors_count'] : 0, isset($v['avg_waittime_str']) ? $v['avg_waittime_str'] : 0);
         }
     }
     $result .= self::formatTable($header, $data, self::FIELD_LENGTH);
     return $result;
 }
コード例 #22
0
ファイル: client.php プロジェクト: kapai69/fl-ru-damp
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;
}
コード例 #23
0
    //        }
    if ($isvisitor) {
        ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'visitor_browser_unload');
    }
    show_ok_result("closed");
} elseif ($act == 'rate') {
    if (!$isvisitor) {
        show_error("visitor-only operation");
    }
    $rate = verify_param("rate", "/^-?\\d{1,9}\$/", "0");
    Thread::getInstance()->RateOperator($thread, $rate);
    show_ok_result("rate");
} elseif ($act == "contacts") {
    $name = !empty($_REQUEST['name']) ? smarticonv("UTF-8", WEBIM_ENCODING, $_REQUEST['name']) : "";
    $email = !empty($_REQUEST['email']) ? smarticonv("UTF-8", WEBIM_ENCODING, $_REQUEST['email']) : "";
    Thread::getInstance()->PostMessage($thread['threadid'], KIND_INFO, Resources::Get('contacts.submitted', array($name, $email)));
    updateContacts($name, $email, $phone, $threadid, $thread['visitsessionid']);
    show_ok_result("contacts");
}
function show_ok_result($resid)
{
    Browser::SendXmlHeaders();
    echo "<{$resid}></{$resid}>";
    exit;
}
function show_error($message)
{
    Browser::SendXmlHeaders();
    echo "<error><descr>{$message}</descr></error>";
    exit;
}