* LiveZilla is a registered trademark.
* 
* Improper changes to this file may cause critical errors.
***************************************************************************************/
if (!defined("IN_LIVEZILLA")) {
    die;
}
define("LOGIN", $_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_LOGIN);
define("LOGOFF", isset($_POST[POST_INTERN_USER_STATUS]) && $_POST[POST_INTERN_USER_STATUS] == USER_STATUS_OFFLINE);
define("DB_ACCESS_REQUIRED", DB_CONNECTION && !empty($_POST[POST_INTERN_GET_MANAGEMENT]));
define("NO_CLIPPING", LOGIN || isset($_POST["p_ext_u"]) && $_POST["p_ext_u"] == XML_CLIP_NULL);
define("SERVERSETUP", Server::IsServerSetup());
define("MANAGEMENT", !empty($_POST[POST_INTERN_GET_MANAGEMENT]) && SERVERSETUP);
Server::InitDataBlock(array("INTERNAL", "GROUPS", "VISITOR", "FILTERS", "INPUTS", "DBCONFIG"));
require LIVEZILLA_PATH . "_lib/objects.internal.inc.php";
OperatorRequest::Validate();
if (OperatorRequest::IsValidated()) {
    CacheManager::GetDataUpdateTimes();
    if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_LISTEN || $_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_LOGIN) {
        Server::$Operators[CALLER_SYSTEM_ID]->SaveMobileParameters();
        OperatorRequest::Listen();
        if (STATS_ACTIVE && !LOGIN) {
            Server::$Statistic->ProcessAction(ST_ACTION_LOG_STATUS, array(Server::$Operators[CALLER_SYSTEM_ID]));
        }
    } else {
        if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SEND_FILE) {
            OperatorRequest::UploadFile();
        } else {
            if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_OPTIMIZE_TABLES) {
                require LIVEZILLA_PATH . "_lib/functions.internal.optimize.inc.php";
                DatabaseMaintenance::Optimize($_POST["p_table"]);
Example #2
0
define("LIVEZILLA_PATH", "../../");
@set_time_limit(30);
require LIVEZILLA_PATH . "_definitions/definitions.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/objects.internal.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");
Server::DefineURL("api.php");
Server::InitDataProvider();
Server::InitDataBlock(array("INTERNAL", "INPUTS", "DBCONFIG"));
OperatorRequest::Validate(true);
if (OperatorRequest::IsValidated() && Is::Defined("CALLER_SYSTEM_ID")) {
    if (Server::$Operators[CALLER_SYSTEM_ID]->GetPermission(46) != PERMISSION_NONE) {
        require "objects.apiv2.inc.php";
        $apiv2 = new ApiV2(isset($_POST["p_json_pretty"]));
        if ($apiv2->RunActions() && empty($apiv2->ErrorField) && !empty($apiv2->JSONOutput)) {
            exit($apiv2->JSONOutput);
        } else {
            APIErrorExit($apiv2->GetErrorCodes());
        }
    } else {
        APIErrorExit("LZAV20002");
    }
} else {
    APIErrorExit("LZAV20001");
}