Ejemplo n.º 1
0
function generate_button($title, $locale, $style, $group, $inner, $showhost, $forcesecure, $modsecurity)
{
    $link = get_app_location($showhost, $forcesecure) . "/client.php";
    if ($locale) {
        $link = append_query($link, "locale={$locale}");
    }
    if ($style) {
        $link = append_query($link, "style={$style}");
    }
    if ($group) {
        $link = append_query($link, "group={$group}");
    }
    $modsecfix = $modsecurity ? ".replace('http://','').replace('https://','')" : "";
    $jslink = append_query("'" . $link, "url='+escape(document.location.href{$modsecfix})+'&referrer='+escape(document.referrer{$modsecfix})");
    $temp = get_popup($link, "{$jslink}", $inner, $title, "webim", "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1");
    return "<!-- webim button -->" . $temp . "<!-- / webim button -->";
}
Ejemplo n.º 2
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.º 3
0
<?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';
Ejemplo n.º 4
0
$stylelist = get_style_list("../styles");
$style = verifyparam("style", "/^\\w*\$/", "");
if ($style && !in_array($style, $stylelist)) {
    $style = "";
}
$groupid = verifyparam_groupid("group");
$showhost = verifyparam("hostname", "/^on\$/", "") == "on";
$forcesecure = verifyparam("secure", "/^on\$/", "") == "on";
$modsecurity = verifyparam("modsecurity", "/^on\$/", "") == "on";
$lang = verifyparam("lang", "/^[\\w-]{2,5}\$/", "");
if (!$lang || !in_array($lang, $image_locales)) {
    $lang = in_array($current_locale, $image_locales) ? $current_locale : $image_locales[0];
}
$file = "../locales/{$lang}/button/{$image}_on.gif";
$size = get_gifimage_size($file);
$imagehref = get_app_location($showhost, $forcesecure) . "/b.php?i={$image}&amp;lang={$lang}";
if ($groupid) {
    $imagehref .= "&amp;group={$groupid}";
}
$message = get_image($imagehref, $size[0], $size[1]);
$page = array();
$page['buttonCode'] = generate_button("", $lang, $style, $groupid, $message, $showhost, $forcesecure, $modsecurity);
$page['availableImages'] = array_keys($imageLocales);
$page['availableLocales'] = $image_locales;
$page['availableStyles'] = $stylelist;
$page['groups'] = get_groups_list();
$page['formgroup'] = $groupid;
$page['formstyle'] = $style;
$page['formimage'] = $image;
$page['formlang'] = $lang;
$page['formhostname'] = $showhost;
Ejemplo n.º 5
0
function setup_chatview_for_operator($thread, $operator)
{
    global $page, $webimroot, $company_logo_link, $company_name, $settings;
    loadsettings();
    $page = array();
    $page['agent'] = true;
    $page['user'] = false;
    $page['canpost'] = $thread['agentId'] == $operator['operatorid'];
    $page['ct.chatThreadId'] = $thread['threadid'];
    $page['ct.token'] = $thread['ltoken'];
    $page['ct.user.name'] = htmlspecialchars(topage(get_user_name($thread['userName'], $thread['remote'], $thread['userid'])));
    $page['chat.title'] = topage($settings['chattitle']);
    setup_logo();
    if ($settings['sendmessagekey'] == 'enter') {
        $page['send_shortcut'] = "Enter";
        $page['ignorectrl'] = 1;
    } else {
        $page['send_shortcut'] = is_mac_opera() ? "&#8984;-Enter" : "Ctrl-Enter";
        $page['ignorectrl'] = 0;
    }
    if ($settings['enablessl'] == "1" && !is_secure_request()) {
        $page['sslLink'] = get_app_location(true, true) . "/operator/agent.php?thread=" . $thread['threadid'] . "&amp;token=" . $thread['ltoken'];
    }
    $page['isOpera95'] = is_agent_opera95();
    $page['neediframesrc'] = needsFramesrc();
    $page['historyParams'] = array("userid" => "" . $thread['userid']);
    $page['historyParamsLink'] = add_params($webimroot . "/operator/userhistory.php", $page['historyParams']);
    $predefinedres = "";
    $canned_messages = load_canned_messages($thread['locale'], $thread['groupid']);
    foreach ($canned_messages as $answer) {
        $predefinedres .= "<option>" . htmlspecialchars(topage($answer['vcvalue'])) . "</option>";
    }
    $page['predefinedAnswers'] = $predefinedres;
    $params = "thread=" . $thread['threadid'] . "&amp;token=" . $thread['ltoken'];
    $page['redirectLink'] = "{$webimroot}/operator/agent.php?" . $params . "&amp;act=redirect";
    $page['namePostfix'] = "";
    $page['frequency'] = $settings['updatefrequency_chat'];
}
Ejemplo n.º 6
0
 */
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);
require 'js/invite/invitation.js';
function getAvatar($operatorId)
{
Ejemplo n.º 7
0
Archivo: agent.php Proyecto: kuell/chat
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once '../libs/common.php';
require_once '../libs/chat.php';
require_once '../libs/groups.php';
require_once '../libs/operator.php';
require_once '../libs/pagination.php';
require_once '../libs/expand.php';
$operator = check_login();
loadsettings();
if ($settings['enablessl'] == "1" && $settings['forcessl'] == "1") {
    if (!is_secure_request()) {
        $requested = $_SERVER['PHP_SELF'];
        if ($_SERVER['REQUEST_METHOD'] == 'GET' && $_SERVER['QUERY_STRING']) {
            header("Location: " . get_app_location(true, true) . "/operator/agent.php?" . $_SERVER['QUERY_STRING']);
        } else {
            die("only https connections are handled");
        }
        exit;
    }
}
$threadid = verifyparam("thread", "/^\\d{1,10}\$/");
if (!isset($_GET['token'])) {
    $remote_level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
    if ($remote_level != "ajaxed") {
        die("old browser is used, please update it");
    }
    $thread = thread_by_id($threadid);
    if (!$thread || !isset($thread['ltoken'])) {
        die("wrong thread");
Ejemplo n.º 8
0
function initVisitedPage($visitsessionid, $theme)
{
    $url = $_GET['url'];
    // TODO why we use _GET?
    $referrer = $_GET['from'];
    // TODO let's call referer 'referer' buy not from?
    $isSecure = isset($_GET['issecure']) ? $_GET['issecure'] : FALSE;
    // TODO, can we use false? hope so ...
    $title = isset($_GET['title']) ? $_GET['title'] : null;
    if (WEBIM_ENCODING != 'UTF-8') {
        $title = smarticonv('utf-8', WEBIM_ENCODING, $title);
    }
    $title = removeSpecialSymbols($title);
    $p_pageid = VisitedPage::GetInstance()->CreateVisitedPage($visitsessionid, $url, $referrer, $title);
    $p_location = get_app_location(true, $isSecure);
    $p_invitescript = $p_location . "/invite.php?pageid=" . $p_pageid . "&theme=" . $theme . "&issecure={$isSecure}";
    $p_issecure = $isSecure;
    require 'js/invite/tracking.js';
}
Ejemplo n.º 9
0
function notify_operators($thread, $firstmessage, $link)
{
    global $settings, $mysqlprefix;
    if ($settings['enablejabber'] == 1) {
        $groupid = $thread['groupid'];
        $query = "select {$mysqlprefix}chatoperator.operatorid as opid, inotify, vcjabbername, vcemail, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from {$mysqlprefix}chatoperator";
        if ($groupid) {
            $query .= ", {$mysqlprefix}chatgroupoperator where groupid = {$groupid} and {$mysqlprefix}chatoperator.operatorid = {$mysqlprefix}chatgroupoperator.operatorid and istatus = 0";
        } else {
            $query .= " where istatus = 0";
        }
        $query .= " and inotify = 1";
        $result = select_multi_assoc($query, $link);
        $text = getstring2_("notify.new.text", array(get_app_location(true, $settings['enablessl'] == '1' && $settings['forcessl'] == '1') . "/operator/agent.php?thread=" . $thread['threadid'], $thread['userName']), $thread['locale']);
        if ($firstmessage) {
            $text .= "\n{$firstmessage}";
        }
        foreach ($result as $op) {
            if ($op['time'] < $settings['online_timeout'] && is_valid_email($op['vcjabbername'])) {
                webim_xmpp($op['vcjabbername'], getstring2("notify.new.subject", array($thread['userName'])), $text, $link);
            }
        }
    }
}