-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathintern.php
136 lines (128 loc) · 5.26 KB
/
intern.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/****************************************************************************************
* LiveZilla intern.php
*
* Copyright 2011 LiveZilla GmbH
* All rights reserved.
* 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("SERVERSETUP",(isset($_POST[POST_INTERN_ADMINISTRATE]) || $_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_GET_BANNER_LIST || $_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_DOWNLOAD_TRANSLATION));
define("DB_ACCESS_REQUIRED",(DB_CONNECTION && isset($_POST[POST_INTERN_GET_MANAGEMENT]) && !empty($_POST[POST_INTERN_GET_MANAGEMENT])));
define("NO_CLIPPING",(LOGIN || (isset($_POST[POST_INTERN_XMLCLIP_HASH_TRACKING]) && $_POST[POST_INTERN_XMLCLIP_HASH_TRACKING] == XML_CLIP_NULL)));
getData(true,true,DB_ACCESS_REQUIRED,true,DB_ACCESS_REQUIRED);
require(LIVEZILLA_PATH . "_lib/functions.internal.inc.php");
require(LIVEZILLA_PATH . "_lib/objects.internal.inc.php");
validate();
if(defined("VALIDATED"))
{
if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_LISTEN || $_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_LOGIN)
{
listenXML();
if(STATS_ACTIVE && !LOGIN)
$STATS->ProcessAction(ST_ACTION_LOG_STATUS,array($INTERNAL[CALLER_SYSTEM_ID]));
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_INIT_UPLOAD)
initUpload();
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_SEND_FILE)
receiveFile();
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_REMOVE_FILE)
removeFile();
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_SET_IDLE)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
setIdle($_POST[POST_INTERN_SERVER_IDLE]);
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_SEND_RESOURCES)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.process.inc.php");
processUpdateReport();
processArchiveChats();
processResources();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_REPORTS)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.process.inc.php");
require(LIVEZILLA_PATH . "_lib/functions.internal.build.inc.php");
processUpdateReport();
buildReports();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_DATABASE_TEST)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
dataBaseTest();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_SEND_TEST_MAIL)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
sendTestMail();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_CREATE_TABLES)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
createTables();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_SET_MANAGEMENT)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
setManagement();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_SET_CONFIG)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
setConfig();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_SET_AVAILABILITY)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
setAvailability($_POST[POST_INTERN_SERVER_AVAILABILITY]);
}
else
{
file_put_contents('./_log/a.txt', var_export($_POST, true)."\n", FILE_APPEND);
}
}
else
{
if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_GET_BANNER_LIST)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
getBannerList();
}
else if($_POST[POST_INTERN_SERVER_ACTION]==INTERN_ACTION_DOWNLOAD_TRANSLATION)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
getTranslationData();
}
else
$RESPONSE->SetValidationError(AUTH_RESULT);
}
if(defined("VALIDATED") && LOGOFF)
{
$INTERNAL[CALLER_SYSTEM_ID]->GetExternalObjects();
foreach($INTERNAL[CALLER_SYSTEM_ID]->ExternalChats as $chat)
$chat->InternalClose();
}
if(defined("VALIDATED") && !SERVERSETUP)
{
if(isset($_POST[POST_GLOBAL_TYPING]))
$INTERNAL[CALLER_SYSTEM_ID]->Typing = $_POST[POST_GLOBAL_TYPING];
$INTERNAL[CALLER_SYSTEM_ID]->Save();
}
if(LOGIN && DB_ACCESS_REQUIRED)
{
require(LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php");
$res = testDataBase($CONFIG["gl_db_host"],$CONFIG["gl_db_user"],$CONFIG["gl_db_pass"],$CONFIG["gl_db_name"],$CONFIG["gl_db_prefix"]);
if(!empty($res))
$RESPONSE->SetValidationError(LOGIN_REPLY_DB,$res);
}
$RESPONSE->GlobalHash = (empty($RESPONSE->Messages) && empty($RESPONSE->Ratings) && empty($RESPONSE->Resources) && empty($RESPONSE->Archive)) ? substr(md5($RESPONSE->XML),0,5) : "";
$RESPONSE->XML = (($_POST[POST_INTERN_SERVER_ACTION] != INTERN_ACTION_LISTEN || (isset($_POST[POST_GLOBAL_XMLCLIP_HASH_ALL]) && $_POST[POST_GLOBAL_XMLCLIP_HASH_ALL] != $RESPONSE->GlobalHash)) ? str_replace("<!--gl_all-->",base64_encode(substr(md5($RESPONSE->XML),0,5)),$RESPONSE->XML) : "" );
$response = (strlen($RESPONSE->XML) > 0) ? $RESPONSE->GetXML() : "";
$response = str_replace("<!--execution_time-->",base64_encode(floor(((microtimeFloat(microtime())-microtimeFloat(ACCESSTIME))*1000))),$response);
?>