-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathprint.php
52 lines (49 loc) · 2.13 KB
/
print.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
<?php
/****************************************************************************************
* LiveZilla print.php
*
* Copyright 2017 LiveZilla GmbH
* All rights reserved.
* LiveZilla is a registered trademark.
*
* Improper changes to this file may cause critical errors.
***************************************************************************************/
define("IN_LIVEZILLA",true);
header('Content-Type: text/html; charset=utf-8');
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 . "_definitions/definitions.dynamic.inc.php");
require(LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php");
$print = "";
@set_error_handler("handleError");
if(Server::InitDataProvider())
{
Server::DefineURL("print.php");
if(!empty($_GET[GET_TRACK_CHATID]) && !empty($_GET[GET_TRACK_BROWSERID]) && !empty($_GET[GET_TRACK_USERID]))
{
$archive = new Chat();
$archive->ChatId = intval(Communication::GetParameter("c",""));
$archive->Load();
$chat = VisitorChat::GetByChatId($archive->ChatId);
if($chat != null)
{
$chat->LastActive = time();
if($chat->BrowserId == Communication::GetParameter(GET_TRACK_BROWSERID,"") && $chat->UserId == Communication::GetParameter(GET_TRACK_USERID,"") && $chat->LastActive > (time()-3600))
{
LocalizationManager::AutoLoad();
$visitor = new Visitor($chat->UserId);
$visitor->LoadVisitorData();
$print = IOStruct::GetFile(PATH_TEMPLATES . "print.tpl");
$archive->Generate($archive->ChatId,$visitor->VisitorData->Fullname,true,true);
$print = str_replace("<!--chat_id-->",$archive->ChatId,$print);
$print = str_replace("<!--transcript-->",nl2br($archive->PlainText),$print);
$print = Mailbox::FinalizeDataBlock($print,true);
$print = Server::Replace($print,true,true,false,false,false);
}
}
exit($print);
}
}
?>