function savePassThruToCookie($_fullname, $_email, $_company, $_question, $_phone, $_customs)
{
    global $INPUTS;
    initData(array("INPUTS"));
    if (!empty($_fullname) && $INPUTS[111]->Cookie && $INPUTS[111]->Active) {
        setCookieValue("form_111", cutString(base64UrlDecode($_fullname), 255), true);
    }
    if (!empty($_email) && $INPUTS[112]->Cookie && $INPUTS[112]->Active) {
        setCookieValue("form_112", cutString(base64UrlDecode($_email), 255), true);
    }
    if (!empty($_company) && $INPUTS[113]->Cookie && $INPUTS[113]->Active) {
        setCookieValue("form_113", cutString(base64UrlDecode($_company), 255), true);
    }
    if (!empty($_question) && $INPUTS[114]->Cookie && $INPUTS[114]->Active) {
        setCookieValue("form_114", base64UrlDecode($_question), true);
    }
    if (!empty($_phone) && $INPUTS[116]->Cookie && $INPUTS[116]->Active) {
        setCookieValue("form_116", base64UrlDecode($_phone), true);
    }
    foreach ($INPUTS as $index => $input) {
        if ($input->Custom && $input->Active && !empty($_customs[$index]) && $input->Cookie) {
            setCookieValue("cf_" . $index, $_customs[$index], true);
        }
    }
}
 public function testSignInvoice()
 {
     require_once '_helpers.php';
     $config = (include '_config.php');
     if (!$this->checkConfig($config)) {
         $this->markTestSkipped('Config is empty');
         return;
     }
     $fiscal_verification = new \Neonbug\FiscalVerification\FiscalVerification($config['client_key_filename'], $config['client_key_password'], $config['ca_public_key_filename'], $config['base_url']);
     $header = $this->getTestHeader($fiscal_verification);
     $invoice = $this->getTestInvoice($fiscal_verification, $config['tax_number'], 'premise1');
     $token = $fiscal_verification->signRequest($header, $invoice, false);
     $token_arr = explode('.', $token);
     $this->assertCount(3, $token_arr);
     $signature = $token_arr[2];
     $signature_decoded = base64UrlDecode($signature);
     $sign_data = base64UrlEncode($header) . '.' . base64UrlEncode($invoice);
     $ret = openssl_verify($sign_data, $signature_decoded, openssl_pkey_get_public(file_get_contents($config['client_key_filename'])), 'SHA256');
     $this->assertEquals($ret, 1);
 }
 function CreateChat($_internalUser, $_visitor, $_host = false, $custom = "", $etpl = "", $_customsInTranscript = true, $_externalSelf = true, $pdm = null)
 {
     global $CONFIG;
     if (!empty($CONFIG["gl_sfc"]) && createSPAMFilter() || empty($this->ChatId)) {
         return;
     }
     UserGroup::PersistentJoin($this->UserId, $this->SystemId);
     $this->InternalUser = $_internalUser;
     $this->InternalUser->SetLastChatAllocation();
     $this->SetStatus(CHAT_STATUS_WAITING);
     initData(array("INPUTS"));
     queryDB(false, "INSERT INTO `" . DB_PREFIX . DATABASE_VISITOR_CHAT_OPERATORS . "` (`chat_id`,`user_id`,`jtime`,`status`) VALUES ('" . DBManager::RealEscape($this->ChatId) . "','" . DBManager::RealEscape($this->InternalUser->SystemId) . "'," . time() . "," . ($_host ? 0 : 1) . ");");
     $this->CreateArchiveEntry($_internalUser, $_visitor, $custom, $etpl, $_customsInTranscript, $pdm);
     if ($_internalUser->IsBot) {
         define("CALLER_SYSTEM_ID", $_internalUser->SystemId);
         $this->InternalActivate();
         $this->ExternalActivate();
         $this->SetStatus(CHAT_STATUS_ACTIVE);
     } else {
         if (!empty($_internalUser->AppDeviceId) && $_internalUser->AppBackgroundMode) {
             $name = !empty($this->Fullname) ? $this->Fullname : getNoName($this->UserId . getIP());
             $_internalUser->AddPushMessage($this->ChatId, $this->SystemId, $name, 0);
         }
     }
     if (!empty($_GET["acid"])) {
         $pchatid = base64UrlDecode($_GET["acid"]);
         $result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `visitor_id`='" . DBManager::RealEscape($this->UserId) . "' AND `chat_id`='" . DBManager::RealEscape($pchatid) . "' AND (`exit` > " . (time() - 30) . " OR `exit`=0) LIMIT 1;");
         if ($result && DBManager::GetRowCount($result) == 1) {
             $row = DBManager::FetchArray($result);
             if (empty($row["waiting"])) {
                 $this->RepostChatHistory(2, $pchatid, $this->InternalUser->SystemId, 0, 0, $this->UserId . "~" . $this->UserId . "_OVL", $this->ChatId, $this->SystemId, true, false, $_externalSelf);
             }
         }
     }
 }
Example #4
0
* LiveZilla picture.php
* 
* Copyright 2011 LiveZilla GmbH
* All rights reserved.
* LiveZilla is a registered trademark.
* 
* Improper changes to this file may cause critical errors.
***************************************************************************************/
define("IN_LIVEZILLA", true);
if (!defined("LIVEZILLA_PATH")) {
    define("LIVEZILLA_PATH", "./");
}
require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
require LIVEZILLA_PATH . "_lib/functions.global.inc.php";
require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
header("Content-Type: image/jpg;");
if (isset($_GET["intid"]) && setDataProvider()) {
    getData(true, false, false, false);
    $id = getInternalSystemIdByUserId(base64UrlDecode($_GET["intid"]));
    if (isset($INTERNAL[$id])) {
        if ($INTERNAL[$id]->LoadPictures()) {
            if (!empty($INTERNAL[$id]->WebcamPicture)) {
                exit(base64_decode($INTERNAL[$id]->WebcamPicture));
            } else {
                exit(base64_decode($INTERNAL[$id]->ProfilePicture));
            }
        }
    }
}
exit(getFile("./images/nopic.jpg"));
Example #5
0
 /**
  * Logs in a user if an activation token is provided.
  *
  * @param KCommandContext $context Command chain context
  *
  * @return bool true on success
  */
 protected function _actionTokenlogin(KCommandContext $context)
 {
     if ($this->token == '') {
         throw new AnErrorException(array('No token is provided'), KHttpResponse::FORBIDDEN);
         return false;
     }
     $user = $this->getService('repos://site/users.user')->find(array('activation' => $this->token));
     if (!$user) {
         throw new AnErrorException(array('This token is invalid'), KHttpResponse::NOT_FOUND);
         return false;
     }
     $person = $this->getService('repos://site/people.person')->find(array('userId' => $user->id));
     $newUser = $user->lastvisitDate->compare($user->registerDate) ? true : false;
     $redirectUrl = $person->getURL();
     //if this is a first time user, then unblock them
     if ($newUser) {
         $user->block = 0;
         $person->enable();
         $person->save();
     }
     $user->activation = '';
     $user->save();
     $this->token = null;
     $this->_request->token = null;
     if ($this->reset_password) {
         $redirectUrl .= '&get=settings&edit=account';
         $_SESSION['reset_password_prompt'] = 1;
     }
     $credentials = array('username' => $user->username, 'password' => $user->password, 'remember' => true);
     $this->getService('com:people.helper.person')->login($credentials, $credentials['remember']);
     if ($this->return) {
         $_SESSION['return'] = $this->getService('com://site/people.filter.return')->sanitize($this->return);
         $returnUrl = base64UrlDecode($this->return);
         $this->getResponse()->setRedirect($returnUrl);
     } else {
         $_SESSION['return'] = null;
         $msg = JText::_('COM-PEOPLE-PROMPT-UPDATE-PASSWORD');
         $this->getResponse()->setRedirect(JRoute::_($redirectUrl), $msg);
     }
     $this->getResponse()->status = KHttpResponse::ACCEPTED;
     return true;
 }
 function SetTranscriptEmail()
 {
     global $CONFIG;
     if (isset($_POST["p_tc_declined"])) {
         queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `transcript_receiver`='' WHERE `chat_id`='" . @mysql_real_escape_string($this->ChatId) . "';");
     } else {
         if (isset($_POST["p_tc_email"])) {
             queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `transcript_receiver`='" . @mysql_real_escape_string(base64UrlDecode($_POST["p_tc_email"])) . "' WHERE `chat_id`='" . @mysql_real_escape_string($this->ChatId) . "';");
         }
     }
 }
function replaceLoginDetails($_html)
{
    $data = !isset($_GET[GET_EXTERN_USER_EMAIL]) ? getCookieValue("login_email") : base64UrlDecode($_GET[GET_EXTERN_USER_EMAIL]);
    $_html = str_replace("<!--login_value_email-->", htmlentities($data, ENT_QUOTES, "UTF-8"), $_html);
    $data = !isset($_GET[GET_EXTERN_USER_NAME]) ? getCookieValue("login_name") : base64UrlDecode($_GET[GET_EXTERN_USER_NAME]);
    $_html = str_replace("<!--login_value_name-->", htmlentities($data, ENT_QUOTES, "UTF-8"), $_html);
    $data = !isset($_GET[GET_EXTERN_USER_COMPANY]) ? getCookieValue("login_company") : base64UrlDecode($_GET[GET_EXTERN_USER_COMPANY]);
    $_html = str_replace("<!--login_value_company-->", htmlentities($data, ENT_QUOTES, "UTF-8"), $_html);
    return $_html;
}
Example #8
0
             if (empty($_GET[GET_TRACK_URL])) {
                 abortTracking(3);
             }
         }
         $currentURL = new HistoryURL(substr(base64UrlDecode($_GET[GET_TRACK_URL]), 0, 2083), isset($_GET[GET_TRACK_SPECIAL_AREA_CODE]) ? base64UrlDecode($_GET[GET_TRACK_SPECIAL_AREA_CODE]) : "", base64UrlDecode(@$_GET[GET_EXTERN_DOCUMENT_TITLE]), $referrer, time());
         if ($currentURL->Referrer->IsInternalDomain()) {
             $currentURL->Referrer = new BaseUrl("");
         }
         if ($currentURL->Url->Excluded) {
             abortTracking(4);
         }
         $EXTERNALUSER->Save($CONFIG, array($_GET[GET_TRACK_RESOLUTION_WIDTH], $_GET[GET_TRACK_RESOLUTION_HEIGHT]), $_GET[GET_TRACK_COLOR_DEPTH], $_GET[GET_TRACK_TIMEZONE_OFFSET], isset($_GET[GEO_LATITUDE]) ? $_GET[GEO_LATITUDE] : "", isset($_GET[GEO_LONGITUDE]) ? $_GET[GEO_LONGITUDE] : "", isset($_GET[GEO_COUNTRY_ISO_2]) ? $_GET[GEO_COUNTRY_ISO_2] : "", isset($_GET[GEO_CITY]) ? $_GET[GEO_CITY] : "", isset($_GET[GEO_REGION]) ? $_GET[GEO_REGION] : "", isset($_GET[GEO_TIMEZONE]) ? $_GET[GEO_TIMEZONE] : "", isset($_GET[GEO_ISP]) ? $_GET[GEO_ISP] : "", isset($_GET[GEO_SSPAN]) ? $_GET[GEO_SSPAN] : "", isset($_GET[GEO_RESULT_ID]) ? $_GET[GEO_RESULT_ID] : "");
     }
 } else {
     if (!empty($_SERVER["HTTP_REFERER"])) {
         $currentURL = new HistoryURL(substr($_SERVER["HTTP_REFERER"], 0, 2083), isset($_GET[GET_TRACK_SPECIAL_AREA_CODE]) ? base64UrlDecode($_GET[GET_TRACK_SPECIAL_AREA_CODE]) : "", "", "", time());
         if ($currentURL->Url->Excluded) {
             abortTracking(5);
         } else {
             if (!$currentURL->Url->IsInternalDomain()) {
                 abortTracking(6);
             }
         }
         $EXTERNALUSER->Save($CONFIG, null, "", "", -522, -522, "", "", "", "", "", "", "", false);
     } else {
         abortTracking(-1);
     }
 }
 if ($EXTERNALUSER->IsCrawler) {
     abortTracking(8);
 } else {
 function Generate()
 {
     foreach ($this->InternalUsers as $internaluser) {
         if ($internaluser->LastActive > time() - $this->Config["timeout_clients"] && $internaluser->Status < 2) {
             for ($count = 0; $count < count($internaluser->Groups); $count++) {
                 if (isset($_GET[GET_EXTERN_INTERN_USER_ID]) && !empty($_GET[GET_EXTERN_INTERN_USER_ID]) && $internaluser->UserId == base64URLdecode($_GET[GET_EXTERN_INTERN_USER_ID])) {
                     if (!($this->GroupValues["req_for_group"] && $internaluser->Groups[$count] != base64UrlDecode($_GET[GET_EXTERN_GROUP])) || isset($_GET[GET_EXTERN_PREFERENCE]) && $_GET[GET_EXTERN_PREFERENCE] == "user") {
                         $this->GroupValues["set_by_get_user"] = $internaluser->Groups[$count];
                     }
                 }
                 if (!isset($this->GroupValues["groups_online_amounts"][$internaluser->Groups[$count]])) {
                     $this->GroupValues["groups_online_amounts"][$internaluser->Groups[$count]] = 0;
                 }
                 $this->GroupValues["groups_online_amounts"][$internaluser->Groups[$count]]++;
             }
         }
     }
     $counter = 0;
     foreach ($this->InternalGroups as $id => $group) {
         if (!$group->IsExternal) {
             continue;
         }
         $used = false;
         $amount = isset($this->GroupValues["groups_online_amounts"]) && is_array($this->GroupValues["groups_online_amounts"]) && array_key_exists($id, $this->GroupValues["groups_online_amounts"]) && $group->IsOpeningHour() ? $this->GroupValues["groups_online_amounts"][$id] : 0;
         $transport = base64_encode($id) . "," . base64_encode($amount) . "," . base64_encode($group->Description) . "," . base64_encode($group->Email);
         if ($this->GroupValues["req_for_group"] && $amount > 0 && $id == base64UrlDecode($_GET[GET_EXTERN_GROUP])) {
             $this->GroupValues["set_by_get_group"] = $id;
             $used = true;
         } elseif ($amount > 0 && getCookieValue("login_group") != null && $id == getCookieValue("login_group") && !isset($requested_group)) {
             $this->GroupValues["set_by_cookie"] = $id;
             $used = true;
         } elseif ($amount > 0 && $group->IsStandard) {
             $this->GroupValues["set_by_standard"] = $id;
             $used = true;
         } elseif ($amount > 0 && empty($this->GroupValues["set_by_online"])) {
             $this->GroupValues["set_by_online"] = $id;
             $used = true;
         }
         if (!in_array($id, $this->GroupValues["groups_hidden"]) && ($group->IsExternal || $used)) {
             $counter++;
             if ($amount > 0) {
                 $this->GroupAvailable = true;
                 $this->GroupValues["groups_online"][$id] = $transport;
             } else {
                 $this->GroupValues["groups_offline"][$id] = $transport;
             }
         }
     }
     if (isset($_GET[GET_EXTERN_PREFERENCE]) && $_GET[GET_EXTERN_PREFERENCE] == "group") {
         if (isset($this->GroupValues["groups_online_amounts"][base64UrlDecode($_GET[GET_EXTERN_GROUP])]) && $this->GroupValues["groups_online_amounts"][base64UrlDecode($_GET[GET_EXTERN_GROUP])] > 0) {
             $this->GroupValues["set_by_get_user"] = null;
             $this->GroupValues["req_for_user"] = false;
         }
     }
     if (!empty($this->GroupValues["set_by_get_user"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]])) {
         $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_user"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]];
     } else {
         if (!empty($this->GroupValues["set_by_get_group"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]])) {
             $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_group"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]];
         } else {
             if (!empty($this->GroupValues["set_by_cookie"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]])) {
                 $this->GroupValues["groups_output"][$this->GroupValues["set_by_cookie"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]];
             } else {
                 if (!empty($this->GroupValues["set_by_standard"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]])) {
                     $this->GroupValues["groups_output"][$this->GroupValues["set_by_standard"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]];
                 } else {
                     if (!empty($this->GroupValues["set_by_online"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]])) {
                         $this->GroupValues["groups_output"][$this->GroupValues["set_by_online"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]];
                     }
                 }
             }
         }
     }
     foreach ($this->GroupValues["groups_online"] as $id => $transport) {
         if (!isset($this->GroupValues["groups_output"][$id])) {
             $this->GroupValues["groups_output"][$id] = $transport;
         }
     }
     $result = array_merge($this->GroupValues["groups_output"], $this->GroupValues["groups_offline"]);
     foreach ($result as $key => $value) {
         $chat_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->ChatInputsHidden as $index) {
             if ($count > 0) {
                 $chat_input_fields .= ",";
             }
             $chat_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($chat_input_fields . ");");
         $chat_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->ChatInputsMandatory as $index) {
             if ($count > 0) {
                 $chat_input_fields .= ",";
             }
             $chat_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($chat_input_fields . ");");
         $ticket_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->TicketInputsHidden as $index) {
             if ($count > 0) {
                 $ticket_input_fields .= ",";
             }
             $ticket_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($ticket_input_fields . ");");
         $ticket_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->TicketInputsMandatory as $index) {
             if ($count > 0) {
                 $ticket_input_fields .= ",";
             }
             $ticket_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($ticket_input_fields . ");");
         if (!empty($this->Result)) {
             $this->Result .= ";" . $value;
         } else {
             $this->Result = $value;
         }
     }
     if ($counter == 0) {
         $this->ErrorHTML = "lz_chat_data.Language.ClientErrorGroups";
     }
 }
 function GetServerInput($_default = "", &$_changed = false, $_capitalize = false)
 {
     $rValue = "";
     if (isset($_GET["f" . $this->Index]) && base64UrlDecode($_GET["f" . $this->Index]) != "") {
         $rValue = base64UrlDecode($_GET["f" . $this->Index]);
     } else {
         if (isset($_POST["p_cf" . $this->Index]) && base64UrlDecode($_POST["p_cf" . $this->Index]) != "") {
             $rValue = base64UrlDecode($_POST["p_cf" . $this->Index]);
         } else {
             if (isset($_GET["cf" . $this->Index]) && base64UrlDecode($_GET["cf" . $this->Index]) != "") {
                 $rValue = base64UrlDecode($_GET["cf" . $this->Index]);
             } else {
                 if ($this->GetIndexName() != null && isset($_GET[$this->GetIndexName()]) && base64UrlDecode($_GET[$this->GetIndexName()]) != "") {
                     $rValue = base64UrlDecode($_GET[$this->GetIndexName()]);
                 } else {
                     if ($this->PostIndexName() != null && isset($_POST[$this->PostIndexName()]) && base64UrlDecode($_POST[$this->PostIndexName()]) != "") {
                         $rValue = base64UrlDecode($_POST[$this->PostIndexName()]);
                     }
                 }
             }
         }
     }
     if ($_capitalize) {
         $rValue = ucwords(strtolower($rValue));
     }
     if ($rValue != $_default && !empty($rValue)) {
         $_changed = true;
     }
     return $rValue;
 }
Example #11
0
function postHTML($_text, $_translation, $_add, $_operator, $_name)
{
    global $LZLANG;
    $post = $_add ? !$_operator ? getFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_EXTERN) : getFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_OPERATOR) : getFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_ADD);
    $post = str_replace("<!--name-->", $_operator ? $_name : (!empty($_name) ? $_name : $LZLANG["client_guest"]), $post);
    $post = str_replace("<!--time-->", date("H:i"), $post);
    $color = getBrightness(base64UrlDecode($_GET["ovlc"])) > getBrightness(base64UrlDecode($_GET["ovlct"])) ? $_GET["ovlct"] : $_GET["ovlc"];
    $post = str_replace("<!--color-->", $_operator ? hexDarker(str_replace("#", "", base64UrlDecode($color)), 30) : "#000000", $post);
    $_text = preg_replace('/(<(?!img)\\w+[^>]+)(style="[^"]+")([^>]*)(>)/', '${1}${3}${4}', strip_tags($_text, "<a><br><b><ul><li><ol><b><i><u><strong><img>"));
    if (!empty($_translation)) {
        $_translation = preg_replace('/(<(?!img)\\w+[^>]+)(style="[^"]+")([^>]*)(>)/', '${1}${3}${4}', strip_tags($_translation, "<a><br><b><ul><li><ol><b><i><u><strong><img>"));
        $_text = $_translation . "<div class='lz_overlay_translation'>" . $_text . "</div>";
    }
    return str_replace("<!--message-->", $_text, $post);
}
Example #12
0
            $chat->Load();
            $chat->Destroy();
        }
        $TRACKINGSCRIPT .= processActions($BROWSER);
        $TRACKINGSCRIPT .= "lz_tracking_callback(" . $CONFIG["poll_frequency_tracking"] . ",'" . $_GET[GET_TRACK_START] . "');";
        $BROWSER->LastActive = time();
        if (isnull($BROWSER->FirstActive)) {
            $BROWSER->FirstActive = time();
        }
        $BROWSER->Referrer = !isset($BROWSER->Referrer) ? isset($_GET[GET_TRACK_REFERRER]) ? trim(slashesStrip(base64UrlDecode($_GET[GET_TRACK_REFERRER]))) : "" : $BROWSER->Referrer;
        $url = isset($_GET[GET_TRACK_URL]) ? substr(base64UrlDecode($_GET[GET_TRACK_URL]), 0, 1024) : "";
        if (!isset($BROWSER->History)) {
            $BROWSER->History = array();
        }
        if (count($BROWSER->History) == 0 || count($BROWSER->History) > 0 && $BROWSER->History[count($BROWSER->History) - 1][1] != $url) {
            $BROWSER->History[] = array(time(), $url, isset($_GET[GET_TRACK_SPECIAL_AREA_CODE]) ? base64UrlDecode($_GET[GET_TRACK_SPECIAL_AREA_CODE]) : "", false, base64UrlDecode(@$_GET[GET_EXTERN_DOCUMENT_TITLE]));
        }
        if (count($BROWSER->History) > DATA_URL_STORAGE_AMOUNT) {
            array_shift($BROWSER->History);
            define("ARRAY_MAX_SIZE", true);
        }
        if ($count != count($BROWSER->History) || defined("ARRAY_MAX_SIZE")) {
            $BROWSER->Save();
        } else {
            $BROWSER->KeepAlive();
        }
        if (isset($CONFIG["gl_hide_inactive"]) && $CONFIG["gl_hide_inactive"] && $BROWSER->History[count($BROWSER->History) - 1][0] < time() - ACTIVE_TIME) {
            exit("lz_tracking_stop_tracking();");
        }
    }
}
Example #13
0
function postHTML($_text, $_translation, $_add, $_operator, $_name, $_time, $_senderId)
{
    global $LZLANG, $INTERNAL, $USER;
    $post = $_add ? !$_operator ? getFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_EXTERN) : getFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_OPERATOR) : (!$_operator ? getFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_ADD) : getFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_OPERATOR_ADD));
    if ($_operator && !empty($USER->Browsers[0]->DesiredChatPartner) && isset($INTERNAL[$USER->Browsers[0]->DesiredChatPartner]) && isset($INTERNAL[$_senderId])) {
        $image = "<img class=\"lz_overlay_chat_operator_picture\" src=\"" . LIVEZILLA_URL . $INTERNAL[$USER->Browsers[0]->DesiredChatPartner]->GetOperatorPictureFile() . "\" width=\"52\" height=\"39\">";
    } else {
        $image = "";
    }
    $post = str_replace("<!--name-->", $_operator ? $_name : (!empty($_name) ? $_name : $LZLANG["client_guest"]), $post);
    $post = str_replace("<!--time-->", $_time, $post);
    $post = str_replace("<!--picture-->", $image, $post);
    $post = str_replace("<!--lang_client_edit-->", strtoupper($LZLANG["client_edit"]), $post);
    $color = getBrightness(base64UrlDecode($_GET["ovlc"])) > getBrightness(base64UrlDecode($_GET["ovlct"])) ? $_GET["ovlct"] : $_GET["ovlc"];
    $post = str_replace("<!--color-->", $_operator ? hexDarker(str_replace("#", "", base64UrlDecode($color)), 50) : "#000000", $post);
    $_text = preg_replace('/(<(?!img)\\w+[^>]+)(style="[^"]+")([^>]*)(>)/', '${1}${3}${4}', strip_tags($_text, "<a><br><b><ul><li><ol><b><i><u><strong><img>"));
    if (!empty($_translation)) {
        $_translation = preg_replace('/(<(?!img)\\w+[^>]+)(style="[^"]+")([^>]*)(>)/', '${1}${3}${4}', strip_tags($_translation, "<a><br><b><ul><li><ol><b><i><u><strong><img>"));
        $_text = $_translation . "<div class='lz_overlay_translation'>" . $_text . "</div>";
    }
    return str_replace("<!--message-->", $_text, $post);
}
    $html = str_replace("<!--voucher_id-->", base64UrlEncode($ticket->Id), $html);
    $html = str_replace("<!--server-->", LIVEZILLA_URL, $html);
    $ofc = !empty($_POST["form_ofc"]) ? "&amp;ofc=MQ__" : "";
    if (!empty($_POST["form_extends"]) && !empty($_POST["form_group"])) {
        $html = str_replace("<!--co-->", "&amp;co=" . base64UrlEncode($_POST["form_extends"]) . "&amp;intgroup=" . base64UrlEncode($_POST["form_group"]) . $ofc, $html);
    } else {
        if (!empty($_POST["form_group"])) {
            $html = str_replace("<!--co-->", "&amp;intgroup=" . base64UrlEncode($_POST["form_group"]) . $ofc, $html);
        } else {
            $html = str_replace("<!--co-->", $ofc, $html);
        }
    }
    exit($html);
} else {
    if (!empty($_GET["confirm"]) && $_GET["confirm"] == "1" && !empty($_GET["vc"]) && strlen(base64UrlDecode($_GET["vc"])) == 16) {
        require LIVEZILLA_PATH . "_lib/functions.pp.paypal.inc.php";
        $voucher = new CommercialChatVoucher("", base64UrlDecode($_GET["vc"]));
        if ($voucher->Load()) {
            if (PayProvValidatePayment($voucher->Price)) {
                languageSelect($voucher->Language);
                $voucher->SetPaymentDetails(PayProvGetPaymentId(), PayProvGetPayerId(), PayProvGetPaymentDetails());
                if (empty($PAYMENTERROR)) {
                    $voucher->SetVoucherParams(!empty($voucher->Voided), true, false, false, false, true, base64UrlDecode($_GET[GET_EXTERN_GROUP]));
                } else {
                    $voucher->SetVoucherParams(!empty($voucher->Voided), false, false, false, false);
                }
            }
        }
    }
}
unloadDataProvider();
function getChatVoucherTemplate($html = "")
{
    global $CONFIG, $COUNTRIES, $LZLANG;
    if (!is("DB_CONNECTION") || !empty($CONFIG["db"]["ccpp"]["Custom"])) {
        return "";
    }
    if (!empty($CONFIG["gl_ccac"])) {
        foreach ($CONFIG["db"]["cct"] as $type) {
            $html .= $type->GetTemplate();
        }
    }
    $cchtml = getFile(PATH_TEMPLATES . "chat_voucher_checkout.tpl");
    $mycountry = "";
    $replacements = array("<!--lp_company-->" => "", "<!--lp_firstname-->" => "", "<!--lp_email-->" => "", "<!--lp_lastname-->" => "", "<!--lp_taxid-->" => "", "<!--lp_business_type-->" => "", "<!--lp_address_1-->" => "", "<!--lp_address_2-->" => "", "<!--lp_city-->" => "", "<!--lp_state-->" => "", "<!--lp_country-->" => "", "<!--lp_phone-->" => "", "<!--lp_zip-->" => "");
    $prefillco = !empty($_GET["co"]) ? " OR id='" . DBManager::RealEscape(base64URLDecode($_GET["co"])) . "'" : "";
    if (!isnull(getCookieValue("userid")) || !empty($prefillco)) {
        $result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_VOUCHERS . "` WHERE `visitor_id`='" . DBManager::RealEscape(getCookieValue("userid")) . "'" . $prefillco . " ORDER BY `created` DESC LIMIT 1;");
        if ($result) {
            if ($row = DBManager::FetchArray($result)) {
                $replacements = array("<!--lp_company-->" => $row["company"], "<!--lp_firstname-->" => $row["firstname"], "<!--lp_lastname-->" => $row["lastname"], "<!--lp_taxid-->" => $row["tax_id"], "<!--lp_email-->" => $row["email"], "<!--lp_business_type-->" => $row["business_type"], "<!--lp_address_1-->" => $row["address_1"], "<!--lp_address_2-->" => $row["address_2"], "<!--lp_city-->" => $row["city"], "<!--lp_state-->" => $row["state"], "<!--lp_country-->" => $row["country"], "<!--lp_phone-->" => $row["phone"], "<!--lp_zip-->" => $row["zip"]);
                $mycountry = $row["country"];
            }
        }
    }
    $clist = $COUNTRIES;
    asort($clist);
    $countrieshtml = "";
    foreach ($clist as $isokey => $value) {
        if (!empty($isokey)) {
            $countrieshtml .= $isokey == $mycountry ? "<option value=\"" . $isokey . "\" SELECTED>" . utf8_encode($value) . "</option>" : "<option value=\"" . $isokey . "\">" . utf8_encode($value) . "</option>";
        }
    }
    $cchtml = str_replace("<!--countries-->", $countrieshtml, $cchtml);
    foreach ($replacements as $key => $value) {
        $cchtml = str_replace($key, $value, $cchtml);
    }
    $cchtml = str_replace("<!--show_VAT-->", !empty($CONFIG["gl_ccsv"]) ? "''" : "none", $cchtml);
    $cchtml = str_replace("<!--voucher_form-->", $html, $cchtml);
    if (!empty($CONFIG["db"]["ccpp"]["PayPal"]->LogoURL)) {
        $cchtml = str_replace("<!--pp_logo_url-->", " src=\"" . $CONFIG["db"]["ccpp"]["PayPal"]->LogoURL . "\"", $cchtml);
    } else {
        $cchtml = str_replace("<!--pp_logo_url-->", "", $cchtml);
    }
    $cchtml = str_replace("<!--extends_voucher-->", !empty($_GET["co"]) && strlen(base64UrlDecode($_GET["co"])) == 16 ? base64UrlDecode($_GET["co"]) : "", $cchtml);
    $cchtml = str_replace("<!--ofc-->", !empty($_GET["ofc"]) ? "MQ__" : "", $cchtml);
    $cchtml = str_replace("<!--VAT-->", str_replace("<!--VAT-->", $CONFIG["gl_ccva"], $LZLANG["client_voucher_include_vat"]), $cchtml);
    return $cchtml;
}
                    exit;
                }
            }
        }
    }
    if (!isset($_POST[POST_EXTERN_RESOLUTION_WIDTH])) {
        $externalUser->KeepAlive();
    } else {
        $externalUser->Save($CONFIG, array(getOParam(POST_EXTERN_RESOLUTION_WIDTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(POST_EXTERN_RESOLUTION_HEIGHT, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32)), getOParam(POST_EXTERN_COLOR_DEPTH, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(POST_EXTERN_TIMEZONE_OFFSET, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32), getOParam(GEO_LATITUDE, -522, $nu, FILTER_VALIDATE_FLOAT), getOParam(GEO_LONGITUDE, -522, $nu, FILTER_VALIDATE_FLOAT), getOParam(GEO_COUNTRY_ISO_2, "", $nu, null, null, 32), getOParam(GEO_CITY, "", $nu, null, null, 255), getOParam(GEO_REGION, "", $nu, null, null, 255), getOParam(GEO_TIMEZONE, "", $nu, null, null, 24), getOParam(GEO_ISP, "", $nu, null, null, 255), getOParam(GEO_SSPAN, 0, $nu, FILTER_VALIDATE_INT), getOParam(GEO_RESULT_ID, "", $nu, FILTER_SANITIZE_SPECIAL_CHARS, null, 32));
    }
    if ($externalUser->SignatureMismatch) {
        $externalUser->AddFunctionCall("lz_chat_set_signature(\"" . $externalUser->UserId . "\");", true);
        $externalUser->AddFunctionCall("lz_chat_reload_groups();", false);
    } else {
        $externalUser->Browsers[0]->VisitId = $externalUser->VisitId;
        if (isset($_GET[GET_TRACK_SPECIAL_AREA_CODE])) {
            $externalUser->Browsers[0]->Code = base64UrlDecode($_GET[GET_TRACK_SPECIAL_AREA_CODE]);
        }
        if (IS_FILTERED) {
            $externalUser->Browsers[0]->CloseChat(8);
        } else {
            if (!$externalUser->Browsers[0]->Closed) {
                $externalUser->Browsers[0]->Save();
            }
        }
        if (empty($externalUser->Host) && $externalUser->FirstCall) {
            $externalUser->ResolveHost();
        }
    }
    $EXTERNSCRIPT = $externalUser->Response;
}
 function Generate($_user = null, $_allowBots = false)
 {
     global $GROUPS;
     foreach ($this->InternalUsers as $internaluser) {
         if ($internaluser->LastActive > time() - $this->Config["timeout_clients"] && $internaluser->Status < USER_STATUS_OFFLINE && ($_allowBots || !$internaluser->IsBot) && !$internaluser->MobileSleep()) {
             $igroups = $internaluser->GetGroupList(true);
             for ($count = 0; $count < count($igroups); $count++) {
                 if ($internaluser->UserId == $this->ReqOperator) {
                     if (!($this->GroupValues["req_for_group"] && $igroups[$count] != $this->ReqGroup) || isset($_GET[GET_EXTERN_PREFERENCE]) && base64UrlDecode($_GET[GET_EXTERN_PREFERENCE]) == "user") {
                         $this->GroupValues["set_by_get_user"] = $igroups[$count];
                     }
                 }
                 if (!isset($this->GroupValues["groups_online_amounts"][$igroups[$count]])) {
                     $this->GroupValues["groups_online_amounts"][$igroups[$count]] = 0;
                 }
                 if ($internaluser->IsBot) {
                     $this->GroupValues["groups_online_amounts"][$igroups[$count]] += 1;
                 } else {
                     if (isset($GROUPS[$igroups[$count]])) {
                         if (!($GROUPS[$igroups[$count]]->MaxChatAmount > -1 && $GROUPS[$igroups[$count]]->MaxChatsStatus == USER_STATUS_AWAY && $GROUPS[$igroups[$count]]->MaxChatAmount <= $internaluser->GetExternalChatAmount())) {
                             $this->GroupValues["groups_online_amounts"][$igroups[$count]] += 2;
                         }
                     }
                 }
             }
         }
     }
     $counter = 0;
     if (is_array($this->InternalGroups)) {
         foreach ($this->InternalGroups as $id => $group) {
             if (!$group->IsExternal) {
                 continue;
             }
             $used = false;
             $amount = isset($this->GroupValues["groups_online_amounts"]) && is_array($this->GroupValues["groups_online_amounts"]) && array_key_exists($id, $this->GroupValues["groups_online_amounts"]) && $group->IsOpeningHour() ? $this->GroupValues["groups_online_amounts"][$id] : 0;
             $transport = base64_encode($id) . "," . base64_encode($amount) . "," . base64_encode($group->GetDescription($_user != null ? $_user->Language : "")) . "," . base64_encode($group->Email);
             if ($this->GroupValues["req_for_group"] && $id == $this->ReqGroup) {
                 $this->GroupValues["set_by_get_group"] = $id;
                 $used = true;
             } elseif (getCookieValue("login_group") != null && $id == getCookieValue("login_group") && !isset($requested_group)) {
                 $this->GroupValues["set_by_cookie"] = $id;
                 $used = true;
             } elseif ($group->IsStandard) {
                 $this->GroupValues["set_by_standard"] = $id;
                 $used = true;
             } elseif (empty($this->GroupValues["set_by_online"])) {
                 $this->GroupValues["set_by_online"] = $id;
                 $used = true;
             }
             if (!in_array($id, $this->GroupValues["groups_hidden"]) && ($group->IsExternal || $used)) {
                 $counter++;
                 if ($amount > 0) {
                     $this->GroupAvailable = true;
                     $this->GroupValues["groups_online"][$id] = $transport;
                 } else {
                     if ($group->IsStandard) {
                         $na[$id] = $transport;
                         $na = array_merge($na, $this->GroupValues["groups_offline"]);
                         $this->GroupValues["groups_offline"] = $na;
                     } else {
                         $this->GroupValues["groups_offline"][$id] = $transport;
                     }
                 }
             }
         }
     }
     if (isset($_GET[GET_EXTERN_PREFERENCE]) && base64UrlDecode($_GET[GET_EXTERN_PREFERENCE]) == "group") {
         if (isset($this->GroupValues["groups_online_amounts"][$this->ReqGroup]) && $this->GroupValues["groups_online_amounts"][$this->ReqGroup] > 0) {
             $this->GroupValues["set_by_get_user"] = null;
             $this->GroupValues["req_for_user"] = false;
         }
     }
     if (!empty($this->GroupValues["set_by_get_user"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]])) {
         $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_user"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]];
     } else {
         if (!empty($this->GroupValues["set_by_get_group"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]])) {
             $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_group"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]];
         } else {
             if (!empty($this->GroupValues["set_by_cookie"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]])) {
                 $this->GroupValues["groups_output"][$this->GroupValues["set_by_cookie"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]];
             } else {
                 if (!empty($this->GroupValues["set_by_standard"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]])) {
                     $this->GroupValues["groups_output"][$this->GroupValues["set_by_standard"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]];
                 } else {
                     if (!empty($this->GroupValues["set_by_online"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]])) {
                         $this->GroupValues["groups_output"][$this->GroupValues["set_by_online"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]];
                     } else {
                         if (!empty($this->GroupValues["set_by_cookie"]) && empty($this->GroupValues["groups_output"]) && !empty($this->GroupValues["groups_offline"][$this->GroupValues["set_by_cookie"]])) {
                             $this->GroupValues["groups_output"][$this->GroupValues["set_by_cookie"]] = $this->GroupValues["groups_offline"][$this->GroupValues["set_by_cookie"]];
                         } else {
                             if (!empty($this->GroupValues["set_by_get_group"]) && empty($this->GroupValues["groups_output"]) && !empty($this->GroupValues["groups_offline"][$this->GroupValues["set_by_get_group"]])) {
                                 $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_group"]] = $this->GroupValues["groups_offline"][$this->GroupValues["set_by_get_group"]];
                             }
                         }
                     }
                 }
             }
         }
     }
     foreach ($this->GroupValues["groups_online"] as $id => $transport) {
         if (!isset($this->GroupValues["groups_output"][$id])) {
             $this->GroupValues["groups_output"][$id] = $transport;
         }
     }
     if (empty($this->GroupValues["set_by_get_group"]) || empty($this->GroupValues["groups_online_amounts"][$this->GroupValues["set_by_get_group"]])) {
         $ngroups = array();
         foreach ($this->GroupValues["groups_output"] as $id => $group) {
             $ngroups[$id] = !empty($this->GroupValues["groups_online_amounts"][$id]) ? $this->GroupValues["groups_online_amounts"][$id] : 0;
             if ($id == $this->GroupValues["set_by_standard"]) {
                 $ngroups[$id] = 10000;
             }
         }
         arsort($ngroups);
         $nsgroups = array();
         foreach ($ngroups as $id => $amount) {
             $nsgroups[$id] = $this->GroupValues["groups_output"][$id];
         }
         $this->GroupValues["groups_output"] = $nsgroups;
     }
     $result = array_merge($this->GroupValues["groups_output"], $this->GroupValues["groups_offline"]);
     foreach ($result as $key => $value) {
         $chat_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->ChatInputsHidden as $index) {
             if ($count > 0) {
                 $chat_input_fields .= ",";
             }
             $chat_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($chat_input_fields . ");");
         $chat_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->ChatInputsMandatory as $index) {
             if ($count > 0) {
                 $chat_input_fields .= ",";
             }
             $chat_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($chat_input_fields . ");");
         $ticket_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->TicketInputsHidden as $index) {
             if ($count > 0) {
                 $ticket_input_fields .= ",";
             }
             $ticket_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($ticket_input_fields . ");");
         $ticket_input_fields = "new Array(";
         $count = 0;
         foreach ($this->InternalGroups[$key]->TicketInputsMandatory as $index) {
             if ($count > 0) {
                 $ticket_input_fields .= ",";
             }
             $ticket_input_fields .= "'" . $index . "'";
             $count++;
         }
         $value .= "," . base64_encode($ticket_input_fields . ");");
         $mes = getPredefinedMessage($this->InternalGroups[$key]->PredefinedMessages, $_user != null ? $_user->Language : "");
         if ($mes != null) {
             $value .= "," . base64_encode($mes->ChatInformation);
             $value .= "," . base64_encode($mes->CallMeBackInformation);
             $value .= "," . base64_encode($mes->TicketInformation);
         } else {
             $value .= "," . base64_encode("");
             $value .= "," . base64_encode("");
             $value .= "," . base64_encode("");
         }
         $count = 0;
         $com_tickets_allowed = "new Array(";
         foreach ($this->InternalGroups[$key]->ChatVouchersRequired as $cttid) {
             if ($count > 0) {
                 $com_tickets_allowed .= ",";
             }
             $com_tickets_allowed .= "'" . $cttid . "'";
             $count++;
         }
         $value .= "," . base64_encode($com_tickets_allowed . ");");
         if (!empty($this->Result)) {
             $this->Result .= ";" . $value;
         } else {
             $this->Result = $value;
         }
     }
     if ($counter == 0) {
         $this->ErrorHTML = "lz_chat_data.Language.ClientErrorGroups";
     }
 }
Example #18
0
* Copyright 2014 LiveZilla GmbH
* All rights reserved.
* LiveZilla is a registered trademark.
* 
* Improper changes to this file may cause critical errors.
***************************************************************************************/
define("IN_LIVEZILLA", true);
if (!defined("LIVEZILLA_PATH")) {
    define("LIVEZILLA_PATH", "./");
}
require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
require LIVEZILLA_PATH . "_lib/functions.global.inc.php";
require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php";
header("Content-Type: image/jpg;");
@set_error_handler("handleError");
if (isset($_GET["intid"]) && initDataProvider()) {
    initData(array("INTERNAL"));
    $id = Operator::GetSystemId(base64UrlDecode($_GET["intid"]));
    if (isset($INTERNAL[$id])) {
        if (!empty($INTERNAL[$id]->WebcamPicture)) {
            exit(base64_decode($INTERNAL[$id]->WebcamPicture));
        } else {
            if (!empty($INTERNAL[$id]->ProfilePicture)) {
                exit(base64_decode($INTERNAL[$id]->ProfilePicture));
            }
        }
    }
}
exit(getFile("./images/nopic.jpg"));
function getBrowserLocalization($country = "")
{
    global $LANGUAGES, $COUNTRIES;
    initData(array("LANGUAGES", "COUNTRIES"));
    $base = @$_SERVER["HTTP_ACCEPT_LANGUAGE"];
    $language = str_replace(array(",", "_", " "), array(";", "-", ""), !empty($_GET[GET_EXTERN_USER_LANGUAGE]) ? strtoupper(base64UrlDecode($_GET[GET_EXTERN_USER_LANGUAGE])) : (!empty($base) ? strtoupper($base) : ""));
    if (strlen($language) > 5 || strpos($language, ";") !== false) {
        $parts = explode(";", $language);
        if (count($parts) > 0) {
            $language = $parts[0];
        } else {
            $language = substr($language, 0, 5);
        }
    }
    if (strlen($language) >= 2) {
        $parts = explode("-", $language);
        if (!isset($LANGUAGES[$language])) {
            $language = $parts[0];
            if (!isset($LANGUAGES[$language])) {
                $language = "";
            }
        }
        if (count($parts) > 1 && isset($COUNTRIES[$parts[1]])) {
            $country = $parts[1];
        }
    } else {
        if (strlen($language) < 2) {
            $language = "";
        }
    }
    return array($language, $country);
}
Example #20
0
             if (!empty($_GET["tlofc"])) {
                 $html = str_replace("<!--class-->", "class=\\\"" . htmlentities(base64UrlDecode($_GET["tlofc"]), ENT_QUOTES, "UTF-8") . "\\\"", $html);
             } else {
                 $html = str_replace("<!--class-->", "", $html);
             }
             $html = str_replace("<!--text-->", htmlentities(base64UrlDecode($_GET["tloft"]), ENT_QUOTES, "UTF-8"), $html);
         } else {
             $html = "";
         }
     }
     if (!empty($html)) {
         exit("document.write(\"" . $html . "\");");
     }
 } else {
     if (!empty($_GET["v"])) {
         $parts = explode("<!>", base64UrlDecode(str_replace(" ", "+", $_GET["v"])));
         if (count($parts) > 3 && strlen($parts[3]) > 0) {
             $parts[0] = str_replace("<!--class-->", "class=\\\"" . $parts[3] . "\\\"", $parts[0]);
         } else {
             if (count($parts) > 0) {
                 $parts[0] = str_replace("<!--class-->", "", $parts[0]);
             }
         }
         if (count($parts) > 1 && operatorsAvailable(0, $parameters["exclude"], $parameters["include_group"], $parameters["include_user"]) > 0) {
             $html = str_replace("<!--text-->", $parts[1], $parts[0]);
         } else {
             if (count($parts) > 2) {
                 $html = str_replace("<!--text-->", $parts[2], $parts[0]);
             }
         }
         exit("document.write(\"" . $html . "\");");
Example #21
0
 function Generate()
 {
     foreach ($this->InternalUsers as $internaluser) {
         if ($internaluser->LastActive > time() - $this->Config["timeout_clients"] && $internaluser->Status < 2) {
             for ($count = 0; $count < count($internaluser->Groups); $count++) {
                 if (isset($_GET[GET_EXTERN_INTERN_USER_ID]) && !isnull($_GET[GET_EXTERN_INTERN_USER_ID]) && $internaluser->UserId == base64URLdecode($_GET[GET_EXTERN_INTERN_USER_ID])) {
                     if ($this->InternalGroups[$internaluser->Groups[$count]]["gr_extern"]) {
                         if (!($this->GroupValues["req_for_group"] && $internaluser->Groups[$count] != base64UrlDecode($_GET[GET_EXTERN_GROUP])) || isset($_GET[GET_EXTERN_PREFERENCE]) && $_GET[GET_EXTERN_PREFERENCE] == "user") {
                             $this->GroupValues["set_by_get_user"] = $internaluser->Groups[$count];
                         }
                     }
                 }
                 if (!isset($this->GroupValues["groups_online_amounts"][$internaluser->Groups[$count]])) {
                     $this->GroupValues["groups_online_amounts"][$internaluser->Groups[$count]] = 0;
                 }
                 $this->GroupValues["groups_online_amounts"][$internaluser->Groups[$count]]++;
             }
         }
     }
     $counter = 0;
     foreach ($this->InternalGroups as $id => $group) {
         $used = false;
         $amount = isset($this->GroupValues["groups_online_amounts"]) && is_array($this->GroupValues["groups_online_amounts"]) && array_key_exists($id, $this->GroupValues["groups_online_amounts"]) ? $this->GroupValues["groups_online_amounts"][$id] : 0;
         $transport = base64_encode($id) . "," . base64_encode($amount) . "," . base64_encode($group["gr_desc"]) . "," . base64_encode($group["gr_email"]);
         if ($this->GroupValues["req_for_group"] && $amount > 0 && $id == base64UrlDecode($_GET[GET_EXTERN_GROUP])) {
             $this->GroupValues["set_by_get_group"] = $id;
             $used = true;
         } elseif ($amount > 0 && getCookieValue("login_group") != null && $id == getCookieValue("login_group") && !isset($requested_group) && $group["gr_extern"]) {
             $this->GroupValues["set_by_cookie"] = $id;
             $used = true;
         } elseif ($amount > 0 && !isnull($group["gr_standard"])) {
             $this->GroupValues["set_by_standard"] = $id;
             $used = true;
         } elseif ($amount > 0 && isnull($this->GroupValues["set_by_online"]) && $group["gr_extern"]) {
             $this->GroupValues["set_by_online"] = $id;
             $used = true;
         }
         if (!in_array($id, $this->GroupValues["groups_hidden"]) && ($group["gr_extern"] || $used)) {
             $counter++;
             if ($amount > 0) {
                 $this->GroupAvailable = true;
                 $this->GroupValues["groups_online"][$id] = $transport;
             } else {
                 $this->GroupValues["groups_offline"][$id] = $transport;
             }
         }
     }
     if (isset($_GET[GET_EXTERN_PREFERENCE]) && $_GET[GET_EXTERN_PREFERENCE] == "group") {
         if (isset($this->GroupValues["groups_online_amounts"][base64UrlDecode($_GET[GET_EXTERN_GROUP])]) && $this->GroupValues["groups_online_amounts"][base64UrlDecode($_GET[GET_EXTERN_GROUP])] > 0) {
             $this->GroupValues["set_by_get_user"] = null;
             $this->GroupValues["req_for_user"] = false;
         }
     }
     if (!isnull($this->GroupValues["set_by_get_user"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]])) {
         $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_user"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_user"]];
     } else {
         if (!isnull($this->GroupValues["set_by_get_group"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]])) {
             $this->GroupValues["groups_output"][$this->GroupValues["set_by_get_group"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_get_group"]];
         } else {
             if (!isnull($this->GroupValues["set_by_cookie"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]])) {
                 $this->GroupValues["groups_output"][$this->GroupValues["set_by_cookie"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_cookie"]];
             } else {
                 if (!isnull($this->GroupValues["set_by_standard"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]])) {
                     $this->GroupValues["groups_output"][$this->GroupValues["set_by_standard"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_standard"]];
                 } else {
                     if (!isnull($this->GroupValues["set_by_online"]) && isset($this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]])) {
                         $this->GroupValues["groups_output"][$this->GroupValues["set_by_online"]] = $this->GroupValues["groups_online"][$this->GroupValues["set_by_online"]];
                     }
                 }
             }
         }
     }
     foreach ($this->GroupValues["groups_online"] as $id => $transport) {
         if (!isset($this->GroupValues["groups_output"][$id])) {
             $this->GroupValues["groups_output"][$id] = $transport;
         }
     }
     $result = array_merge($this->GroupValues["groups_output"], $this->GroupValues["groups_offline"]);
     foreach ($result as $key => $value) {
         if (!isnull($this->Result)) {
             $this->Result .= ";" . $value;
         } else {
             $this->Result = $value;
         }
     }
     if ($counter == 0) {
         $this->ErrorHTML = "lz_chat_data.Language.ClientErrorGroups";
     }
 }
function replaceLoginDetails($_html)
{
    global $CONFIG;
    $data = isset($_GET[GET_EXTERN_USER_EMAIL]) && !empty($_GET[GET_EXTERN_USER_EMAIL]) ? base64UrlDecode($_GET[GET_EXTERN_USER_EMAIL]) : getCookieValue("form_112");
    $_html = str_replace("<!--login_value_112-->", htmlentities($data, ENT_QUOTES, "UTF-8"), $_html);
    $data = isset($_GET[GET_EXTERN_USER_NAME]) && !empty($_GET[GET_EXTERN_USER_NAME]) ? base64UrlDecode($_GET[GET_EXTERN_USER_NAME]) : getCookieValue("form_111");
    $_html = str_replace("<!--login_value_111-->", htmlentities($data, ENT_QUOTES, "UTF-8"), $_html);
    $data = isset($_GET[GET_EXTERN_USER_COMPANY]) && !empty($_GET[GET_EXTERN_USER_COMPANY]) ? base64UrlDecode($_GET[GET_EXTERN_USER_COMPANY]) : getCookieValue("form_113");
    $_html = str_replace("<!--login_value_113-->", htmlentities($data, ENT_QUOTES, "UTF-8"), $_html);
    $_html = str_replace("<!--login_value_114-->", !isset($_GET[GET_EXTERN_USER_QUESTION]) ? !isset($_POST["form_114"]) ? "" : $_POST["form_114"] : base64UrlDecode($_GET[GET_EXTERN_USER_QUESTION]), $_html);
    $_html = str_replace("<!--login_value_customs-->", getJSCustomArray(), $_html);
    $customFields = getCustomArray();
    for ($i = 0; $i <= 9; $i++) {
        $_html = str_replace("<!--login_value_" . $i . "-->", htmlentities($customFields[$i], ENT_QUOTES, "UTF-8"), $_html);
    }
    return $_html;
}
function getTargetParameters()
{
    $parameters = array("exclude" => null, "include_group" => null, "include_user" => null);
    if (isset($_GET[GET_EXTERN_HIDDEN_GROUPS])) {
        $groups = base64UrlDecode($_GET[GET_EXTERN_HIDDEN_GROUPS]);
        if (strlen($groups) > 1) {
            $parameters["exclude"] = explode("?", $groups);
        } else {
            if (isset($_GET[GET_EXTERN_GROUP])) {
                $parameters["include_group"] = array(base64UrlDecode($_GET[GET_EXTERN_GROUP]));
            } else {
                if (isset($_GET[GET_EXTERN_INTERN_USER_ID])) {
                    $parameters["include_user"] = base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]);
                }
            }
        }
    }
    return $parameters;
}
function processPlaceholders($html)
{
    $params = array(GET_EXTERN_USER_LANGUAGE, GET_EXTERN_USER_NAME, GET_EXTERN_USER_EMAIL, GET_EXTERN_USER_COMPANY, GET_TRACK_SPECIAL_AREA_CODE, GET_EXTERN_USER_QUESTION, GET_EXTERN_USER_HEADER);
    $placeholders = array("language", "name", "email", "company", "code", "question", "header_url");
    foreach ($params as $key => $value) {
        if (!empty($_GET[$value])) {
            $html = str_replace("&lt;!--replace_me_with_b64url_" . $placeholders[$key] . "--&gt;", base64UrlEncode(base64UrlDecode($_GET[$value])), $html);
        } else {
            $html = str_replace("&lt;!--replace_me_with_b64url_" . $placeholders[$key] . "--&gt;", "", $html);
        }
    }
    for ($i = 0; $i < 10; $i++) {
        if (!empty($_GET["cf" . $i])) {
            $html = str_replace("&lt;!--replace_me_with_b64url_custom_" . $i . "--&gt;", base64UrlEncode(base64UrlDecode($_GET["cf" . $i])), $html);
        } else {
            $html = str_replace("&lt;!--replace_me_with_b64url_custom_" . $i . "--&gt;", "", $html);
        }
    }
    return $html;
}
Example #25
0
     $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl");
     $html = str_replace("<!--intgroup-->", base64UrlEncode($_POST[GET_EXTERN_GROUP]), $html);
 } else {
     if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.mail.1.0") {
         initData(array("INTERNAL", "GROUPS", "INPUTS"));
         $groupbuilder = new GroupBuilder($INTERNAL, $GROUPS, NULL);
         $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl");
         $html = getChatLoginInputs($html, MAX_INPUT_LENGTH);
         $html = str_replace("<!--alert-->", getAlertTemplate(), $html);
         $html = str_replace("<!--ssl_secured-->", getScheme() == SCHEME_HTTP_SECURE && !empty($CONFIG["gl_sssl"]) ? "" : "display:none;", $html);
         $html = str_replace("<!--groups-->", $groupbuilder->GetHTML($DEFAULT_BROWSER_LANGUAGE), $html);
     } else {
         if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.1.1") {
             $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl");
             if (isset($_GET[GET_EXTERN_USER_HEADER]) && !empty($_GET[GET_EXTERN_USER_HEADER])) {
                 $html = str_replace("<!--logo-->", "<img src=\"" . base64UrlDecode($_GET[GET_EXTERN_USER_HEADER]) . "\" border=\"0\"><br>", $html);
             } else {
                 if (!empty($CONFIG["gl_cali"])) {
                     $html = str_replace("<!--logo-->", "<img src=\"" . $CONFIG["gl_cali"] . "\" border=\"0\"><br>", $html);
                 }
             }
             if (!empty($CONFIG["gl_cahi"])) {
                 $html = str_replace("<!--background-->", "<img src=\"" . $CONFIG["gl_cahi"] . "\" border=\"0\"><br>", $html);
             }
         } else {
             if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame.3.2.chat.0.0" && isset($_GET[GET_EXTERN_GROUP])) {
                 initData(array("GROUPS"));
                 $groupid = base64_decode($_GET[GET_EXTERN_GROUP]);
                 if (!empty($groupid) && isset($GROUPS[$groupid])) {
                     $html = getFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl");
                     $html = str_replace("<!--SM_HIDDEN-->", empty($GROUPS[$groupid]->ChatFunctions[0]) ? "none" : "", $html);
Example #26
0
 }
 $BROWSER->LoadWebsitePush();
 $EXTERNALUSER->LoadChatRequests();
 $BROWSER->LoadAlerts();
 $BROWSER->LoadOverlayBoxes();
 $TRACKINGSCRIPT .= triggerEvents();
 $TRACKINGSCRIPT .= processActions("", $openChatExternal);
 $ACTIVE_OVLC = false;
 if (!empty($_GET["fbpos"]) && !empty($_GET["fbw"]) && is_numeric(base64UrlDecode($_GET["fbw"]))) {
     $shadow = !empty($_GET["fbshx"]) ? "true," . base64UrlDecode($_GET["fbshb"]) . "," . base64UrlDecode($_GET["fbshx"]) . "," . base64UrlDecode($_GET["fbshy"]) . ",'" . base64UrlDecode($_GET["fbshc"]) . "'" : "false,0,0,0,''";
     $margin = !empty($_GET["fbmt"]) ? "," . base64UrlDecode($_GET["fbml"]) . "," . base64UrlDecode($_GET["fbmt"]) . "," . base64UrlDecode($_GET["fbmr"]) . "," . base64UrlDecode($_GET["fbmb"]) : ",0,0,0,0";
     if (!(!$conline && !empty($_GET["fboo"]))) {
         $TRACKINGSCRIPT .= "lz_tracking_add_floating_button(" . base64UrlDecode($_GET["fbpos"]) . "," . $shadow . $margin . "," . base64UrlDecode($_GET["fbw"]) . "," . base64UrlDecode($_GET["fbh"]) . ");";
     }
 }
 if (!empty($_GET["ovlc"]) && strlen(base64UrlDecode($_GET["ovlc"])) == 7) {
     require LIVEZILLA_PATH . "ovl.php";
     $TRACKINGSCRIPT .= @$OVLPAGE;
 }
 if (!empty($_GET["cboo"]) && !operatorsAvailable(0, $parameters["exclude"], $parameters["include_group"], $parameters["include_user"], false)) {
     $TRACKINGSCRIPT .= "lz_tracking_remove_buttons();";
 }
 $hidevisitor = empty($CONFIG["gl_vmac"]) || !empty($CONFIG["gl_hide_inactive"]) && !$EXTERNALUSER->IsActivity($BROWSER);
 if (!empty($_SERVER['HTTP_DNT']) && $CONFIG["gl_dnt"] && empty($_GET["ovlc"])) {
     $BROWSER->Destroy();
     $TRACKINGSCRIPT .= "lz_tracking_stop_tracking(10);";
 }
 if ($monitoringActive || !empty($ACTIVE_OVLC)) {
     if (!getAvailability()) {
         $BROWSER->Destroy();
         abortTracking(12);
Example #27
0
 /**
  * Authenticate a person and create a new session If a username password is passed then the user is first logged in. 
  * 
  * @param KCommandContext $context Command chain context 
  * 
  * @return void
  * 
  * @throws LibBaseControllerExceptionUnauthorized If authentication failed
  * @throws LibBaseControllerExceptionForbidden    If person is authenticated but forbidden
  * @throws RuntimeException for unkown error
  */
 protected function _actionAdd(KCommandContext $context)
 {
     $data = $context->data;
     //if there's a sign up then
     //change the redirect url
     if ($data->return) {
         $_SESSION['return'] = $this->getService('com://site/people.filter.return')->sanitize($data->return);
         $url = base64UrlDecode($data->return);
         $this->registerCallback('after.login', array($this, 'redirect'), array('url' => $url));
     }
     jimport('joomla.user.authentication');
     $authentication =& JAuthentication::getInstance();
     $credentials = KConfig::unbox($data);
     $options = array();
     $authResponse = $authentication->authenticate($credentials, $options);
     if ($authResponse->status === JAUTHENTICATE_STATUS_SUCCESS && $this->login((array) $authResponse, (bool) $data->remember)) {
         $this->getResponse()->status = KHttpResponse::CREATED;
         $_SESSION['return'] = null;
     } else {
         $this->setMessage('COM-PEOPLE-AUTHENTICATION-FAILED', 'error');
         JFactory::getApplication()->triggerEvent('onLoginFailure', array((array) $authResponse));
         throw new LibBaseControllerExceptionUnauthorized('Authentication Failed. Check username/password');
     }
     return;
 }