| Server IP : 172.67.216.113 / Your IP : 172.71.28.146 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/2388322/cwd/3rdparty/cloudlinux/ |
Upload File : |
/**
* Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
*
* Licensed under CLOUD LINUX LICENSE AGREEMENT
* http://cloudlinux.com/docs/LICENSE.TXT
*/
function convert_to_base64(input) { // fn BLOB => Binary => Base64 ?
var uInt8Array = new Uint8Array(input),
i = uInt8Array.length;
var biStr = []; //new Array(i);
while (i--) { biStr[i] = String.fromCharCode(uInt8Array[i]); }
var base64 = window.btoa(biStr.join(''));
return base64;
}
function readByText(input) { // fn BLOB to text
var uInt8Array = new Uint8Array(input);
var biStr = []; //new Array(i);
for (var i=0;i<uInt8Array.length;i++) {
biStr[i] = String.fromCharCode(uInt8Array[i]);
}
return biStr.join('');
}
function create_data_uri(mime_, data){
var base64data = convert_to_base64(data); // convert BLOB to base64
return 'data:' + mime_ + ';base64,' + base64data
}
function insertImage(url, id_) {
// function for getting (from "url") and inserting image to element id "id_"
var xhr = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
xhr.open('GET', url, true); // url is the url of a PNG/SVG image.
xhr.responseType = 'arraybuffer';
xhr.onload = function(){
var mime_ = this.getResponseHeader('Content-type');
if (mime_ == 'image/png' ) {
document.getElementById(id_).innerHTML = '<img src="' + create_data_uri(mime_, this.response) + '">';
} else if ( mime_ == 'image/svg+xml' ) {
var chartContainer = document.getElementById(id_);
chartContainer.innerHTML = readByText(this.response);
runScripts(chartContainer);
} else {
document.getElementById(id_).innerHTML = '[ERROR: Can not show image]'
}
};
//detect error obtaining image
xhr.onreadystatechange = function(){
if ( xhr.readyState == 4 && xhr.status != 200) {
document.getElementById(id_).innerHTML = '[ERROR: Can not obtain image from server]'
}
};
xhr.onerror = function(){
document.getElementById(id_).innerHTML = '[ERROR: Can not obtain image from server]'
};
document.getElementById(id_).innerHTML = '[Charts loading...]';
xhr.send();
}
function runScripts(parentItem) {
var scripts = parentItem.getElementsByTagName('script');
for(var i = 0;i < scripts.length; i++) {
eval(scripts[0].innerHTML.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"));
}
}