Ejemplo n.º 1
0
 function LiveZillaAPI()
 {
     require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
     require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php";
     require LIVEZILLA_PATH . "_lib/functions.global.inc.php";
     require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php";
     require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
     initDataProvider();
     @register_shutdown_function('unloadDataProvider');
 }
Ejemplo n.º 2
0
 function LiveZillaAPI()
 {
     global $CONFIG;
     require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
     require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php";
     require LIVEZILLA_PATH . "_lib/functions.global.inc.php";
     require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
     if (!initDataProvider()) {
         exit("Error: Database connection failed.");
     }
     @register_shutdown_function('unloadDataProvider');
 }
Ejemplo n.º 3
0
define("IN_LIVEZILLA", true);
if (!defined("LIVEZILLA_PATH")) {
    define("LIVEZILLA_PATH", "./");
}
require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php";
require LIVEZILLA_PATH . "_lib/functions.global.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php";
require LIVEZILLA_PATH . "_lib/functions.external.inc.php";
@set_error_handler("handleError");
@error_reporting(E_ALL);
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Keep-Alive: timeout=5, max=100");
initDataProvider();
if (!empty($_GET["value"]) && strlen($_GET["value"]) == 16) {
    $ticket = VisitorChat::GetMatchingVoucher($_GET[GET_EXTERN_GROUP], $_GET["value"]);
    if (!empty($ticket) && !$ticket->CheckForVoid() && $ticket->Paid) {
        $ticket->UpdateVoucherChatTime(0, empty($ticket->FirstUsed));
        $sessions = $ticket->ChatSessionsMax < 0 ? 0 : $ticket->ChatSessionsMax;
        if ($result = queryDB(true, "SELECT `exit` FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `chat_ticket_id`='" . DBManager::RealEscape($ticket->Id) . "' AND `exit`=0 LIMIT 1;")) {
            if ($row = DBManager::FetchArray($result)) {
                exit("lz_validate_com_chat_input_result(false,true,1,'',0,0,0,false,false,false);");
            }
        }
        exit("lz_validate_com_chat_input_result(true,false,1,'" . $ticket->Id . "'," . $ticket->ChatTime . "," . $ticket->ChatTimeMax . "," . $ticket->ChatSessions . "," . $ticket->ChatSessionsMax . "," . $ticket->VoucherAutoExpire . "," . parseBool($ticket->VoucherAutoExpire < time()) . ");");
    } else {
        if (!empty($ticket)) {
            exit("lz_validate_com_chat_input_result(false,false,1,'',0,0,0,false,false,false);");
        }
Ejemplo n.º 4
0
/****************************************************************************************
* LiveZilla getfile.php
* 
* 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 . "_definitions/definitions.protocol.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";
if (isset($_GET["id"]) && initDataProvider()) {
    $id = $_GET["id"];
    if (strpos($id, ".") === false && !isnull($res = getResource($id))) {
        if (file_exists("./uploads/" . $res["value"]) && strpos($res["value"], "..") === false) {
            header('Content-Description: File Transfer');
            header('Content-Type: application/octet-stream');
            header('Content-Length: ' . filesize("./uploads/" . $res["value"]));
            header('Content-Disposition: attachment; filename=' . urlencode($res["title"]));
            exit(file_get_contents("./uploads/" . $res["value"]));
        }
    }
}
header("HTTP/1.0 404 Not Found");
function getConfig($xml = "")
{
    global $_CONFIG, $CONFIG, $INTERNAL;
    $skeys = array("gl_db_host", "gl_db_user", "gl_db_pass", "gl_db_name");
    $hashfile = FILE_CONFIG;
    $ms = base64_decode($_CONFIG["gl_lzst"]) == 1;
    $cindex = 0;
    $cfiles = getDirectory(PATH_CONFIG, "config.inc.php");
    foreach ($_CONFIG as $index => $server_val) {
        if (is_array($server_val)) {
            $xml .= "<conf key=\"" . base64_encode($index) . "\">\r\n";
            foreach ($server_val as $skey => $sval) {
                if (!is_array($sval)) {
                    $xml .= "<sub key=\"" . base64_encode($skey) . "\">" . $sval . "</sub>\r\n";
                }
            }
            $xml .= "</conf>\r\n";
        } else {
            if (!(is_int($index) && is_array($server_val))) {
                $xml .= "<conf value=\"" . $server_val . "\" key=\"" . base64_encode($index) . "\" />\r\n";
            }
        }
    }
    if (!empty($CONFIG["gl_root"])) {
        $cfiles = array_merge(array("config.inc.php"), $cfiles);
    }
    $rootBased = $CONFIG["gl_root"];
    foreach ($cfiles as $file) {
        if (substr($file, 0, 7) == "config." && strpos($file, ".inc.php") == strlen($file) - 8) {
            $chost = str_replace("inc.php", "", str_replace("config.", "", $file));
            $chost = strlen($chost) > 0 ? substr($chost, 0, strlen($chost) - 1) : $chost;
            if (!$ms || (empty($_GET["ws"]) && strtolower($_SERVER["HTTP_HOST"]) == strtolower($chost) || empty($chost) && strtolower($_SERVER["HTTP_HOST"]) == strtolower($CONFIG["gl_host"]) || !empty($_GET["ws"]) && base64_decode($_GET["ws"]) == $chost || !empty($rootBased) && SERVERSETUP && !MANAGEMENT || in_array($chost, $INTERNAL[CALLER_SYSTEM_ID]->WebsitesConfig) || in_array($chost, $INTERNAL[CALLER_SYSTEM_ID]->WebsitesUsers))) {
                if (!empty($chost) && file_exists(str_replace("config.inc", "config." . $chost . ".inc", FILE_CONFIG))) {
                    $hashfile = str_replace("config.inc", "config." . $chost . ".inc", FILE_CONFIG);
                    requireDynamic($hashfile, LIVEZILLA_PATH . "_config/");
                    loadConfig(false);
                    initDataProvider();
                }
                foreach ($_CONFIG as $index => $server_val) {
                    if (is_int($index) && is_array($server_val)) {
                        $xml .= "<site index=\"" . base64_encode($cindex) . "\">\r\n";
                        foreach ($server_val as $key => $site_val) {
                            if (is_array($site_val)) {
                                $xml .= "<conf key=\"" . base64_encode($key) . "\">\r\n";
                                foreach ($site_val as $skey => $sval) {
                                    $xml .= "<sub key=\"" . base64_encode($skey) . "\">" . $sval . "</sub>\r\n";
                                }
                                $xml .= "</conf>\r\n";
                            } else {
                                if (!in_array($key, $skeys) || SERVERSETUP) {
                                    $xml .= "<conf value=\"" . $site_val . "\" key=\"" . base64_encode($key) . "\" />\r\n";
                                } else {
                                    $xml .= "<conf value=\"" . base64_encode("") . "\" key=\"" . base64_encode($key) . "\" />\r\n";
                                }
                            }
                        }
                        $cindex++;
                        if ($CONFIG["gl_host"] == base64_decode($server_val["gl_host"])) {
                            $xml .= "<db_conf>\r\n";
                            if (!empty($CONFIG["db"]["cct"])) {
                                $xml .= "<cct>\r\n";
                                foreach ($CONFIG["db"]["cct"] as $cct) {
                                    $xml .= $cct->GetXML();
                                }
                                $xml .= "</cct>\r\n";
                            }
                            if (!empty($CONFIG["db"]["ccpp"])) {
                                $xml .= "<ccpp>\r\n";
                                foreach ($CONFIG["db"]["ccpp"] as $ccpp) {
                                    $xml .= $ccpp->GetXML();
                                }
                                $xml .= "</ccpp>\r\n";
                            }
                            if (!empty($CONFIG["db"]["gl_email"])) {
                                $xml .= "<gl_email>\r\n";
                                foreach ($CONFIG["db"]["gl_email"] as $mb) {
                                    $xml .= $mb->GetXML();
                                }
                                $xml .= "</gl_email>\r\n";
                            }
                            $xml .= "</db_conf>\r\n";
                        }
                        $xml .= "</site>\r\n";
                    }
                }
            }
        }
    }
    if (SERVERSETUP) {
        $xml .= "<translations>\r\n";
        $files = getDirectory("./_language", "index", true);
        foreach ($files as $translation) {
            if (strpos($translation, ".bak.") === false) {
                $lang = str_replace(".php", "", str_replace("lang", "", $translation));
                $parts = explode(".", $lang);
                if (ISSUBSITE && strpos($translation, SUBSITEHOST) !== false || !ISSUBSITE && substr_count($translation, ".") == 1) {
                    $xml .= "<language key=\"" . base64_encode($parts[0]) . "\" blocked=\"" . base64_encode(@filesize("./_language/" . $translation) == 0 ? 1 : "0") . "\" />\r\n";
                } else {
                    if (ISSUBSITE && strpos($translation, SUBSITEHOST) === false && !@file_exists(getLocalizationFileString($parts[0], false))) {
                        $xml .= "<language key=\"" . base64_encode($parts[0]) . "\" derived=\"" . base64_encode(1) . "\" />\r\n";
                    }
                }
            }
        }
        $xml .= "</translations>\r\n";
    }
    $xml .= "<php_cfg_vars post_max_size=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("post_max_size")) ? get_cfg_var("post_max_size") : MAX_POST_SIZE_SAFE_MODE)) . "\" upload_max_filesize=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("upload_max_filesize")) ? get_cfg_var("upload_max_filesize") : MAX_UPLOAD_SIZE_SAFE_MODE)) . "\" />\r\n";
    $xml .= "</gl_c>\r\n";
    return "<gl_c h=\"" . base64_encode(substr(md5file($hashfile), 0, 5)) . "\">\r\n" . $xml;
}