function getInvitationTemplate($_requestid, $_internid, $_sessid, $_name, $_groupid) { global $CONFIG; $template = !@file_exists(FILE_INVITATIONLOGO) ? getFile(TEMPLATE_SCRIPT_INVITATION) : getFile(TEMPLATE_SCRIPT_INVITATION_LOGO); $template = str_replace("<!--request_id-->", $_requestid, $template); $template = str_replace("<!--site_name-->", $CONFIG["gl_site_name"], $template); $template = str_replace("<!--sess_id-->", $_sessid, $template); $template = str_replace("<!--intern_name-->", $_name, $template); $template = str_replace("<!--group_id-->", base64UrlEncode($_groupid), $template); $template = str_replace("<!--intern_id-->", base64UrlEncode($_internid), $template); $template = str_replace("<!--width-->", $CONFIG["wcl_window_width"], $template); $template = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $template); $template = str_replace("<!--server-->", LIVEZILLA_URL, $template); $template = str_replace("<!--intern_image-->", file_exists(PATH_INTERN_IMAGES . md5($_internid) . FILE_EXTENSION_PROFILE_PICTURE) ? md5($_internid) . FILE_EXTENSION_PROFILE_PICTURE . "?acid=" . uniqid(rand()) : "nopic" . FILE_EXTENSION_PROFILE_PICTURE, $template); return doReplacements($template); }
/** * tokenReplace() takes a string and looks for any {TOKEN:xxxx} variables * which it then, one by one, substitutes the TOKEN code with the relevant token * from the session array containing token information * * The operations of this function were previously in the templatereplace function * but have been moved to a function of their own to make it available * to other areas of the script. * * @param string $line the string to iterate, and then return * @param boolean $anynomized Sets if the underlying token data should be not used * * @return string This string is returned containing the substituted responses * */ function tokenReplace($line, $anonymized=false) { $doTheseReplacements = getAnswerAndTokenMappings(false,$anonymized); return doReplacements($line,$doTheseReplacements); }
@set_error_handler("handleError"); $scheme = getScheme(); if (isset($_GET[GET_INDEX_SERVER_ACTION]) && $_GET[GET_INDEX_SERVER_ACTION] == "addserver") { $html = doReplacements(getFile(TEMPLATE_HTML_ADD_SERVER)); $html = str_replace("<!--lz_add_url-->", getServerAddLink($scheme), $html); exit($html); } else { $html = getFile(TEMPLATE_HTML_INDEX); $errorbox = null; $errors['write'] = getFolderPermissions(); $errors['php_version'] = getPhpVersion(); $errors['mysql'] = getMySQL(); if (!empty($errors['write']) || !empty($errors['php_version']) || !empty($errors['mysql'])) { $errorbox = getFile(TEMPLATE_HTML_INDEX_ERRORS); $errorbox = str_replace("<!--write_access-->", $errors['write'], $errorbox); if (strlen($errors['write']) > 0 && !empty($errors['php_version'])) { $errors['php_version'] = "<br><br>" . $errors['php_version']; } if ((strlen($errors['write']) > 0 || !empty($errors['php_version'])) && !empty($errors['mysql'])) { $errors['mysql'] = "<br><br>" . $errors['mysql']; } $errorbox = str_replace("<!--mysql-->", $errors['mysql'], $errorbox); $errorbox = str_replace("<!--php_version-->", $errors['php_version'], $errorbox); } $html = str_replace("<!--index_errors-->", $errorbox, $html); $html = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $html); $html = str_replace("<!--width-->", $CONFIG["wcl_window_width"], $html); $html = str_replace("<!--lz_add_server-->", $scheme . $CONFIG["gl_host"] . $_SERVER["PHP_SELF"] . "?" . GET_INDEX_SERVER_ACTION . "=addserver", $html); $html = str_replace("<!--lz_version-->", VERSION, $html); echo doReplacements($html); }
function processActions($actionData = "") { global $BROWSER, $CONFIG, $INTERNAL, $EVENTS, $GROUPS; if (!empty($BROWSER->ChatRequest)) { initData(true, true); if ($INTERNAL[$BROWSER->ChatRequest->SenderSystemId]->LastActive < time() - $CONFIG["timeout_clients"] || $INTERNAL[$BROWSER->ChatRequest->SenderSystemId]->Status != USER_STATUS_ONLINE || !$GROUPS[$BROWSER->ChatRequest->SenderGroupId]->IsOpeningHour() || $BROWSER->ChatRequest->Closed) { $BROWSER->ChatRequest->SetStatus(false, false, true, true); $actionData .= "lz_tracking_close_request();"; $BROWSER->ForceUpdate(); } else { if (isset($_GET[GET_TRACK_REQUEST_DECLINED]) || isset($_GET[GET_TRACK_REQUEST_ACCEPTED])) { if (isset($_GET[GET_TRACK_REQUEST_DECLINED])) { $BROWSER->ChatRequest->SetStatus(false, false, true, true); } if (isset($_GET[GET_TRACK_REQUEST_CLOSE])) { if (isset($_GET[GET_TRACK_REQUEST_ACCEPTED])) { $BROWSER->ChatRequest->SetStatus(false, true, false, true); } $actionData .= "lz_tracking_close_request();"; } $BROWSER->ForceUpdate(); } else { if (!$BROWSER->ChatRequest->Accepted && !$BROWSER->ChatRequest->Declined) { if (empty($BROWSER->ChatRequest->EventActionId)) { $invitationHTML = doReplacements($BROWSER->ChatRequest->CreateInvitationTemplate($CONFIG["gl_inv_template"], $CONFIG["gl_site_name"], $CONFIG["wcl_window_width"], $CONFIG["wcl_window_height"], LIVEZILLA_URL, $INTERNAL[$BROWSER->ChatRequest->SenderSystemId], $CONFIG["gl_inv_coc"])); $BROWSER->ChatRequest->Invitation = new Invitation($invitationHTML, $CONFIG["gl_inv_position"], $CONFIG["gl_inv_margin"][0], $CONFIG["gl_inv_margin"][1], $CONFIG["gl_inv_margin"][2], $CONFIG["gl_inv_margin"][3], $CONFIG["gl_inv_scroll_speed"], $CONFIG["gl_inv_template"], empty($CONFIG["gl_inv_no_scroll"]), $BROWSER->ChatRequest->Text, $CONFIG["gl_inv_coc"]); } else { if (!isnull($action = $EVENTS->GetActionById($BROWSER->ChatRequest->EventActionId))) { $invitationHTML = doReplacements($BROWSER->ChatRequest->CreateInvitationTemplate($action->Invitation->Style, $CONFIG["gl_site_name"], $CONFIG["wcl_window_width"], $CONFIG["wcl_window_height"], LIVEZILLA_URL, $INTERNAL[$BROWSER->ChatRequest->SenderSystemId], $action->Invitation->CloseOnClick)); $BROWSER->ChatRequest->Invitation = $action->Invitation; $BROWSER->ChatRequest->Invitation->Text = $BROWSER->ChatRequest->Text; $BROWSER->ChatRequest->Invitation->HTML = $invitationHTML; } } $BROWSER->ChatRequest->SetStatus(true, false, false, false); $actionData .= $BROWSER->ChatRequest->Invitation->GetCommand(); $BROWSER->ForceUpdate(); } } } } if (!empty($BROWSER->WebsitePush)) { if (isset($_GET[GET_TRACK_WEBSITE_PUSH_DECLINED])) { $BROWSER->WebsitePush->SetStatus(false, false, true); } else { if (isset($_GET[GET_TRACK_WEBSITE_PUSH_ACCEPTED]) || !$BROWSER->WebsitePush->Ask && !$BROWSER->WebsitePush->Displayed) { $BROWSER->WebsitePush->SetStatus(false, true, false); $actionData .= $BROWSER->WebsitePush->GetExecCommand(); } else { if ($BROWSER->WebsitePush->Ask && !$BROWSER->WebsitePush->Accepted && !$BROWSER->WebsitePush->Declined) { $BROWSER->WebsitePush->SetStatus(true, false, false); $actionData .= $BROWSER->WebsitePush->GetInitCommand(); } } } } if (!empty($BROWSER->Alert) && !$BROWSER->Alert->Accepted) { if (isset($_GET[GET_TRACK_ALERT_CONFIRMED])) { $BROWSER->Alert->SetStatus(false, true); } else { $actionData .= $BROWSER->Alert->GetCommand(); } } return $actionData; }
require "./_lib/functions.external.inc.php"; $mylang = getBrowserLocalization(); foreach ($LANGUAGES as $iso => $langar) { if ($langar[1]) { $tlanguages .= "<option value=\"" . strtolower($iso) . "\"" . ($mylang[0] == $iso || strtolower($iso) == strtolower($CONFIG["gl_default_language"]) && (empty($mylang[0]) || !empty($mylang[0]) && isset($LANGUAGES[$mylang[0]]) && !$LANGUAGES[$mylang[0]][1]) ? " SELECTED" : "") . ">" . $langar[0] . "</option>"; } } $html = str_replace("<!--translator_api-->", "<script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script><script type=\"text/javascript\">top.lz_translator = google;top.lz_translator.load(\"language\", \"1\");</script>", $html); } $html = str_replace("<!--translation_display-->", $CONFIG["gl_otrs"] ? "" : "none", $html); $html = str_replace("<!--transcript_option_display-->", $CONFIG["gl_uret"] ? "" : "none", $html); $html = str_replace("<!--languages-->", $tlanguages, $html); } else { $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl"); } } } } } } } } } } } } $html = str_replace("<!--server-->", ".", $html); $html = str_replace("<!--url_get_params-->", getParams(), $html); unloadDataProvider(); exit(doReplacements($html));