-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathimage.php
142 lines (122 loc) · 5.19 KB
/
image.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
137
138
139
140
141
142
<?php
/****************************************************************************************
* LiveZilla image.php
*
* Copyright 2018 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","./");
@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/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");
Server::InitDataProvider();
$html = "";
if(!empty($_GET["id"]) && is_numeric($_GET["id"]))
{
$prefix = ((!empty($_GET["type"]) && $_GET["type"] == "overlay") ? "overlay" : "inlay");
if(isChat())
exit(getFileById($_GET["id"],true,$prefix));
else
{
if(!empty($_GET["cboo"]))
{
header('Content-Type: image/gif');
exit(base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw=='));
/*
header("Content-Type: image/png;");
exit(file_get_contents(PATH_IMAGES . "avatar.png"));
*/
}
else
exit(getFileById($_GET["id"],false,$prefix));
}
}
else if(!empty($_GET["tl"]) && !empty($_GET["srv"]))
{
$html = "<a href=\\\"javascript:void(window.open('<!--server-->','','width=".Server::$Configuration->File["wcl_window_width"].",height=".Server::$Configuration->File["wcl_window_height"].",left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes'))\\\" <!--class--><!--css-->><!--text--></a>";
$html = str_replace("<!--server-->",htmlentities(Encoding::Base64UrlDecode($_GET["srv"]),ENT_QUOTES,"UTF-8"),$html);
if(!empty($_GET["tlont"]) && isChat())
{
if(!empty($_GET["tlonc"]))
$html = str_replace("<!--class-->","class=\\\"".htmlentities(Encoding::Base64UrlDecode($_GET["tlonc"]),ENT_QUOTES,"UTF-8")."\\\"",$html);
else
$html = str_replace("<!--class-->","",$html);
if(!empty($_GET["tlons"]))
$html = str_replace("<!--css-->","style=\\\"".htmlentities(Encoding::Base64UrlDecode($_GET["tlons"]),ENT_QUOTES,"UTF-8")."\\\"",$html);
else
$html = str_replace("<!--css-->","",$html);
//$html = processPlaceholders($html);
$html = str_replace("<!--text-->",htmlentities(Encoding::Base64UrlDecode($_GET["tlont"]),ENT_QUOTES,"UTF-8"),$html);
}
else if(!empty($_GET["tloft"]) && empty($_GET["tloo"]))
{
if(!empty($_GET["tlofc"]))
$html = str_replace("<!--class-->","class=\\\"".htmlentities(Encoding::Base64UrlDecode($_GET["tlofc"]),ENT_QUOTES,"UTF-8")."\\\"",$html);
else
$html = str_replace("<!--class-->","",$html);
if(!empty($_GET["tlofs"]))
$html = str_replace("<!--css-->","style=\\\"".htmlentities(Encoding::Base64UrlDecode($_GET["tlofs"]),ENT_QUOTES,"UTF-8")."\\\"",$html);
else
$html = str_replace("<!--css-->","",$html);
$html = str_replace("<!--text-->",htmlentities(Encoding::Base64UrlDecode($_GET["tloft"]),ENT_QUOTES,"UTF-8"),$html);
}
else
$html = "";
if(!empty($html))
{
header("Content-Type: application/javascript;");
$sid = (isset($_GET["sid"]) && strlen($_GET["sid"])==32) ? $_GET["sid"] : "lz_textlink";
exit("var nc = document.createElement('div');nc.style.padding=0;nc.style.margin=0;nc.innerHTML=\"".$html."\";var tlscr = document.getElementById('".$sid."');tlscr.parentNode.insertBefore(nc, tlscr);");
}
}
function processPlaceholders($html)
{
/*
$params = array("el","en","ee","ec","code","eq","eh");
$placeholders = array("language","name","email","company","code","question","header_url");
foreach($params as $key => $value)
{
if(!empty($_GET[$value]))
$html = str_replace("<!--replace_me_with_b64url_".$placeholders[$key]."-->",Encoding::Base64UrlEncode(Encoding::Base64UrlDecode($_GET[$value])),$html);
else
$html = str_replace("<!--replace_me_with_b64url_".$placeholders[$key]."-->","",$html);
}
for($i=0;$i<10;$i++)
{
if(!empty($_GET["cf".$i]))
$html = str_replace("<!--replace_me_with_b64url_custom_".$i."-->",Encoding::Base64UrlEncode(Encoding::Base64UrlDecode($_GET["cf".$i])),$html);
else
$html = str_replace("<!--replace_me_with_b64url_custom_".$i."-->","",$html);
}
return $html;
*/
}
function getFileById($_id,$_online,$_type)
{
$result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_IMAGES . "` WHERE `id`='" . DBManager::RealEscape($_id) . "' AND `button_type`='" . DBManager::RealEscape($_type) . "' AND `online`='" . DBManager::RealEscape(($_online) ? "1" : "0") . "' LIMIT 1;");
if($result && $row = DBManager::FetchArray($result))
{
header("Content-Type: image/".$row["image_type"].";");
return base64_decode($row["data"]);
}
else
{
header("Content-Type: image/gif;");
return file_get_contents(PATH_IMAGES . "chat_blank.gif");
}
}
?>