function display($path) { $this->assign('current_locale', WEBIM_CURRENT_LOCALE, false); $this->assign('available_locales', Resources::GetAvailableLocales(), false); $this->assign('webim_root', WEBIM_ROOT, false); $this->assign('whois_url', WEBIM_WHOIS_LINK, false); $this->assign('browser_charset', BROWSER_CHARSET, false); // $this->assign('resources', Resources::GetCurrentSet(), false); TODO do we really need this? $this->assign('product_and_version', Settings::GetProductAndVersion()); $this->assign('product_url', Settings::GetProductURL()); $this->assign('version', WEBIM_VERSION); $op = SilentGetOperator(); if (isset($op)) { $this->Assign('operator_name', $op['fullname']); } Browser::SendHtmlHeaders(); parent::display($path); }
$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'); $departmentParam = !empty($departmentkey) ? '&departmentkey=' . $departmentkey : ''; $button_img = '<img alt="' . $alt . '" src="' . $location . '/button.php?bim=' . $image . '&lang=' . $locale . $departmentParam . '" border="0"'; if (!empty($size)) { $button_img .= ' width="' . $size[0] . '" height="' . $size[1] . '" '; } $button_img .= ' />'; $chooseOperatorParam = !empty($chooseoperator) ? '&chooseoperator=' . $chooseoperator : ''; $chooseDepartmentParam = !empty($choosedepartment) ? '&choosedepartment=1' : ''; $chatimmediatelyParam = !empty($chatimmediately) ? '&chatimmediately=1' : ''; $link = $location . "/client.php?theme={$theme}" . '&lang=' . $locale . $chooseOperatorParam . $chooseDepartmentParam . $departmentParam . $chatimmediatelyParam; $temp = get_popup($link, $button_img, '', 'webim_' . getWindowNameSuffix(), 'toolbar=0, scrollbars=0, location=0, menubar=0, width=540, height=480, resizable=1', empty($chatimmediately)); $buttonCode = '<!-- webim button -->' . $temp . '<!-- /webim button -->'; $trackerCode = getTrackerCode($location, $theme, $forcesecure); $buttonCode .= getAutoInviteCode($location, $theme); $code = $includeTracker ? $trackerCode . $buttonCode : $buttonCode; $TML->assign('code', htmlspecialchars($code)); $TML->assign('code_raw', $code); $TML->assign('image', $image); Browser::SendHtmlHeaders(); $TML->display('gen_button.tpl');
function PrintThreadMessages($thread, $token, $lastid, $isvisitor, $format, $viewonly = false) { $threadid = $thread['threadid']; $istyping = abs($thread['current'] - $thread[$isvisitor ? "lpoperator" : "lpvisitor"]) < WEBIM_CONNECTION_TIMEOUT && $thread[$isvisitor ? "agenttyping" : "visitortyping"] == "1" ? "1" : "0"; $israted = empty($thread['ratedoperatorid']) ? 'false' : 'true'; $visitSession = $isvisitor ? GetVisitorFromRequestAndSetCookie() : MapperFactory::getMapper("VisitSession")->getById($thread['visitsessionid']); $visitorname = $isvisitor ? removeSpecialSymbols($visitSession['name']) : removeSpecialSymbols(htmlspecialchars($visitSession['visitorname'])); $rate = $thread['rate']; if ($format == "xml") { $visitorname = "visitorname=\"{$visitorname}\""; $operatorfullname = "operatorfullname=\"" . $thread['operatorfullname'] . "\""; $fl_login = "******"" . ($isvisitor || empty($visitSession['fl_login']) ? '' : $visitSession['fl_login']) . "\""; $threadstate = "state=\"" . $thread['state'] . "\""; $isHasMessages = true; if ($lastid != 0 && !$viewonly) { $isHasMessages = $isvisitor ? $this->isHasMessagesForVisitor($thread['threadid']) : $this->isHasMessagesForOperator($thread['threadid']); } $haveMessegesToAlert = "needtoalert=\"" . ($isHasMessages ? "true" : "false") . "\""; $output = array(); if ($isHasMessages) { $output = $this->GetMessages($threadid, "xml", $isvisitor, $lastid); if ($thread['state'] !== STATE_CLOSED) { if ($isvisitor) { $this->unsetThreadHasMessagesForVisitor($thread['threadid']); } else { if (!$viewonly) { $this->unsetThreadHasMessagesForOperator($thread['threadid']); } } } } Browser::SendXmlHeaders(); print "<thread lastid=\"{$lastid}\" typing=\"" . $istyping . "\" viewonly=\"" . $viewonly . "\" {$visitorname} {$operatorfullname} {$fl_login} {$haveMessegesToAlert} {$threadstate} israted=\"{$israted}\" rate=\"{$rate}\">"; foreach ($output as $msg) { if (!$isvisitor && strpos($msg, "webimFeedbackBtn") !== false) { continue; } print $msg; } print "</thread>"; } elseif ($format == "html") { $output = $this->GetMessages($threadid, "html", $isvisitor, $lastid); Browser::SendHtmlHeaders(); $url = WEBIM_ROOT . "/thread.php?act=refresh&thread=" . $threadid . "&token=" . $token . "&html=on&visitor=" . ($isvisitor ? "true" : "false"); print "<html><head>\n" . "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . WEBIM_ROOT . "/css/admin_chat.css?" . WEBIM_VERSION . "\" />\n" . "<meta http-equiv=\"Refresh\" content=\"7; URL={$url}&sn=11\">\n" . "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" . "</head>" . "<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400' marginwidth='0' marginheight='0' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0' onload=\"if (location.hash != '#aend') {location.hash='#aend';}\">" . "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>"; foreach ($output as $msg) { if (!$isvisitor && strpos($msg, "webimFeedbackBtn") !== false) { continue; } print $msg; } print "</td></tr></table><a name='aend'>" . "</body></html>"; } }