Ejemplo n.º 1
0
}
$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');
Ejemplo n.º 2
0
$page['email'] = $email;
if (!$email) {
    $errors[] = no_field("form.field.email");
} else {
    if (!is_valid_email($email)) {
        $errors[] = wrong_field("form.field.email");
    }
}
if (count($errors) > 0) {
    $page['formemail'] = $email;
    $page['ct.chatThreadId'] = $thread['threadid'];
    $page['ct.token'] = $thread['ltoken'];
    $page['level'] = "";
    setup_logo();
    expand("styles", getchatstyle(), "mail.tpl");
    exit;
}
$history = "";
$lastid = -1;
$output = get_messages($threadid, "text", true, $lastid);
foreach ($output as $msg) {
    $history .= $msg;
}
$subject = getstring("mail.user.history.subject");
$body = getstring2("mail.user.history.body", array($thread['userName'], $history));
$link = connect();
webim_mail($email, $webim_mailbox, $subject, $body, $link);
mysql_close($link);
setup_logo();
expand("styles", getchatstyle(), "mailsent.tpl");
exit;
Ejemplo n.º 3
0
$errors = array();
$page = array('version' => $version);
$loginoremail = "";
if (isset($_POST['loginoremail'])) {
    $loginoremail = getparam("loginoremail");
    $torestore = is_valid_email($loginoremail) ? operator_by_email($loginoremail) : operator_by_login($loginoremail);
    if (!$torestore) {
        $errors[] = getlocal("no_such_operator");
    }
    $email = $torestore['vcemail'];
    if (count($errors) == 0 && !is_valid_email($email)) {
        $errors[] = "Operator hasn't set his e-mail";
    }
    if (count($errors) == 0) {
        $token = md5(time() + microtime() . rand(0, 99999999));
        $link = connect();
        $query = "update {$mysqlprefix}chatoperator set dtmrestore = CURRENT_TIMESTAMP, vcrestoretoken = '{$token}' where operatorid = " . $torestore['operatorid'];
        perform_query($query, $link);
        $href = get_app_location(true, false) . "/operator/resetpwd.php?id=" . $torestore['operatorid'] . "&token={$token}";
        webim_mail($email, $email, getstring("restore.mailsubj"), getstring2("restore.mailtext", array(get_operator_name($torestore), $href)), $link);
        mysql_close($link);
        $page['isdone'] = true;
        require '../view/restore.php';
        exit;
    }
}
$page['formloginoremail'] = topage($loginoremail);
$page['localeLinks'] = get_locale_links("{$webimroot}/operator/restore.php");
$page['isdone'] = false;
start_html_output();
require '../view/restore.php';
Ejemplo n.º 4
0
 public function SendRecoverPasswordMail($operatorid, $host)
 {
     $op = MapperFactory::getMapper('Operator')->getById($operatorid);
     $hash['recoverytoken'] = $this->generateToken(16);
     $hash['recoverytime'] = null;
     // MySQL auto update
     $hash['operatorid'] = $operatorid;
     MapperFactory::getMapper('Operator')->save($hash);
     $link = HTTP_PREFIX . $host . WEBIM_ROOT . '/operator/recover_password.php?act=recover&login='******'login'] . '&token=' . $hash['recoverytoken'];
     $subject = Resources::Get('mail.password_recover.subject', Resources::getCurrentLocale());
     $body = Resources::Get('mail.password_recover.body', array($op['fullname'], $link), Resources::getCurrentLocale());
     webim_mail($op['fullname'] . '<' . $op['email'] . '>', Settings::Get('from_email'), $subject, $body);
     // TODO send link
 }
Ejemplo n.º 5
0
 function RateOperator($thread, $rate)
 {
     $crm = MapperFactory::getMapper("Rate");
     $crate = array('threadid' => $thread['threadid'], 'operatorid' => $thread['operatorid'], 'rate' => $rate, 'date' => null);
     $crm->save($crate);
     // Send an email in case of negative rate
     if ($rate < 0) {
         // TODO i would send all the negative feedback was == -2
         $history = "";
         $lastid = -1;
         $output = $this->GetMessages($thread['threadid'], "text", true, $lastid);
         foreach ($output as $msg) {
             $history .= $msg;
         }
         $visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
         $subject = Resources::Get("mail.visitor.negative.rate.history.subject");
         $body = Resources::Get("mail.visitor.negative.rate.history.body", array($visitSession['visitorname'], $history));
         webim_mail(Settings::Get('superviser_email'), Settings::Get('from_email'), $subject, $body);
     }
 }
Ejemplo n.º 6
0
    $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');
Ejemplo n.º 7
0
    $original = isset($_SESSION["mibew_captcha"]) ? $_SESSION["mibew_captcha"] : "";
    if (empty($original) || empty($captcha) || $captcha != $original) {
        $errors[] = getlocal('errors.captcha');
    }
    unset($_SESSION['mibew_captcha']);
}
if (count($errors) > 0) {
    setup_leavemessage($visitor_name, $email, $message, $groupid, $groupname, $info, $referrer, can_show_captcha());
    setup_logo();
    expand("styles", getchatstyle(), "leavemessage.tpl");
    exit;
}
$message_locale = $settings['left_messages_locale'];
if (!locale_exists($message_locale)) {
    $message_locale = $home_locale;
}
store_message($visitor_name, $email, $info, $message, $groupid, $referrer);
$subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale);
$body = getstring2_("leavemail.body", array($visitor_name, $email, $message, $info ? "{$info}\n" : ""), $message_locale);
if (isset($group) && !empty($group['vcemail'])) {
    $inbox_mail = $group['vcemail'];
} else {
    $inbox_mail = $settings['email'];
}
if ($inbox_mail) {
    $link = connect();
    webim_mail($inbox_mail, $email, $subject, $body, $link);
    mysql_close($link);
}
setup_logo();
expand("styles", getchatstyle(), "leavemessagesent.tpl");