Your IP : 216.73.216.68


Current Path : /home/jeromecohp/www/aesecure/dashboard/
Upload File :
Current File : /home/jeromecohp/www/aesecure/dashboard/dashboard.js

// @file : /dashboard/dashboard.js
// @version : 2.0.2
// @author : AVONTURE Christophe - christophe@aesecure.com
// @copyright : (C) 2013-2015 - Christophe Avonture - all right reserved.
// @url : http://www.aesecure.com/
// @package : 2015-02-14 13:37:41
// @license : This program is a commercial software.  You CAN'T redistribute it and/or modify it.
// Source code is the property of Christophe Avonture and can't be reused, in whole or in part, in any programs.
(function ($){
"use strict";
$.fn.exists=function (){ return this.length !==0;}
var urlDashboardSettings='https://www.aesecure.com/aesecure/json.php?task=dashconfig';var aeSecureMasterVersion='';var aeSecureConfig='';var aeSecureIcons='';var aeSecureToolbar='';var aeSecureOptions={isInitialized:false,imgLoading:'',showCountersAlerts:true};var aeCounters={uptodate:0,oldversion:0,nbrSites:0,nbrProcessed:0,nbrErrors:0};
$.fn.aeSecure=function(action,options){
var tblSites=null;
this.each( function(){
switch (action){
case "init": init(options); break;
case "process": process(this); break;}});
if($.fn.popover){ $('[data-toggle="popover"]').popover({trigger:'hover','placement':'top','html':true});}
$( document ).ajaxError(function( XMLHttpRequest, request, settings, errorThrown  ){
console.error('dashboard.js - ajaxError() - An error has been encountered when requesting '+settings.url);});
function init(options){
$.extend(aeSecureOptions, options);
ajaxify(urlDashboardSettings,'','json','ajaxSuccessInit(data)','','','GET', false, true);
return true;}
function ajaxSuccessInit(data){
aeSecureOptions['isInitialized']=true;
aeSecureConfig=data['config'];
aeSecureIcons=data['icons'];
aeSecureToolbar=data['toolbar'];
aeSecureOptions['imgLoading']='<img src="'+aeSecureConfig['ajaxLoading']+'" alt="" />';
DOMSetValue(null,'aeRelease',getText('releaseinfo'));
DOMSetValue(null,'aeSubtitle',getText('subtitle'));
DOMSetValue(null,'aeSubtitleButtons',getText('subtitle_buttons'));
DOMSetValue(null,'aeSecureTitle',getText('footer'));
DOMSetValue(null,'aeSecureBrand',getText('dashboardversion')+aeSecureConfig['version']);
ajaxify(aeSecureConfig['urlMasterVersion'],'','json','ajaxSuccessgetMasterVersion(data)','','','GET', false, true);
return aeSecureOptions['isInitialized'];}
function ajaxSuccessgetMasterVersion(data){
aeSecureMasterVersion=data['aeSecure'];var btnRelease=addButton(0,'releaseinfo',{"url":aeSecureConfig['release']+aeSecureMasterVersion.replace(/\./g,'')});var span=document.createElement("span");
span.innerHTML=getText('masterversion')+':'+aeSecureMasterVersion+'&nbsp;';
span.appendChild(btnRelease);
$('#aeSecureMasterVersion').html(span);
$('#aeSecure_releaseinfo_0').click(function(e){ e.stopImmediatePropagation(); window.open($(this).attr('data-url'));})
return true;}
function tableSort(){
$("table").tablesorter({
theme: "ice",
widthFixed: false,
sortMultiSortKey: "shiftKey",
sortResetKey: 'ctrlKey',
headers: {
0: {sorter: "false", filter:"false"},
1: {sorter: "digit", filter:"false"},
2: {sorter: "url"},
3: {sorter: "text"},
4: {sorter: "text"},
5: {sorter: "text"},
6: {sorter: "text"},
7: {sorter: "false", filter:"false"},
8: {sorter: "false", filter:"false"},
9: {sorter: "false"}},
ignoreCase: true,
headerTemplate: '{content} {icon}',
widgets: ["uitheme", "filter"],
initWidgets: true,
widgetOptions: {
uitheme: 'ice'
},
sortList: [[2,0]]
});
return;}
function process(tbl){
tblSites=tbl;
aeCounters['nbrSites']=$(tbl).find('tr[data-aesecure]').length;var i=0
$(document).ajaxComplete(function(){ processComplete();});
_addTooltip($('#tblaeSecure_thVersion'),'aeSecureInstalledVersion');
_addTooltip($('#tblaeSecure_thPHP'),'PHPVersion');
$('#tblaeSecure > tbody  > tr').each(function(index,row){
var sRowName=$(row).attr('id');var sSiteIndex=$(row).data('id');var imgLoading=document.createElement("img");
imgLoading.setAttribute('src',aeSecureConfig['ajaxLoading']);
$(row).find(sRowName+'_ajax').html(imgLoading);
ajaxify(aeSecureOptions['baseurl'],'task=get&site='+sSiteIndex,'json','ajaxSuccessgetProcess(data,\''+sRowName+'\')','','','GET', true, false);
i+=1;});
return;}
function processComplete(){
if((aeCounters['nbrSites']>0) && (aeCounters['nbrSites']==aeCounters['nbrProcessed']+aeCounters['nbrErrors'])){
tableSort();
if((aeCounters['oldversion']>0) && (aeSecureOptions['showCountersAlerts']==true)){
var sText=getText('sites_with_old_version');
sText=sText.replace('%1',aeCounters['oldversion']);
alertify.error('<span class="lead">'+sText+'</span>');}
if((aeCounters['nbrErrors']>0) && (aeSecureOptions['showCountersAlerts']==true)){
var sText=getText('sites_network_errors');
sText=sText.replace('%1',aeCounters['nbrErrors']);
alertify.error('<span class="lead">'+sText+'</span>');}
instantiateButtons();
if($.fn.popover) $('[data-toggle="popover"]').popover({trigger:'hover','placement':'top','html':true});
aeSecureOptions['showCountersAlerts']=false;}
return true;}
function ajaxSuccessgetProcess(data, sRowName){
var row=$('#'+sRowName);var urls={aeSecure:'',base:'',download:'',json:'',key:''};
if(data.hasOwnProperty('aesecure')) urls.aeSecure=data['aesecure'];
if(urls.aeSecure!=''){
urls.key=$(row).data('key');
urls.base=urls.aeSecure.substring(0,urls.aeSecure.indexOf("/aesecure/setup.php",0));
urls.download=urls.base+"/aesecure/premium/helpers/download.php";
urls.premium_tools=urls.base+"/aesecure/premium/third/tools/";
urls.json=urls.base+'/aesecure/json.php';
ajaxify(urls.json,'key='+urls.key+'&task=dashboard','json','ajaxSuccessgetProcessSiteDetail(data,\''+sRowName+'\',\''+JSON.stringify(data)+'\',\''+JSON.stringify(urls)+'\')','ajaxFailureGetProcessSiteDetail(data,\''+sRowName+'\')','ajaxErrorGetProcessSiteDetail(XMLHttpRequest, textStatus, errorThrown,\''+sRowName+'\',\''+JSON.stringify(data)+'\')','GET', true, false);}
$('#'+sRowName+'_ajax').html('');
return;}
function ajaxSuccessgetProcessSiteDetail(data, sRowName, siteMainData, urls){
siteMainData=JSON.parse(siteMainData);
urls=JSON.parse(urls);var row=$('#'+sRowName);
$(row).addClass('active');var siteID=$(row).data('id');var cms=null;
DOMSetValue(row,sRowName+'_dashboard',getRemoveSiteButton(siteID));
if(data.hasOwnProperty('error')){
var isUpToDate=false;var version='Unknown';var msg=data.error['msg'];
msg=msg.replace(/'/g,'\'');
alertify.error(msg,0);}  else {
var version=data['aeSecure'];var isUpToDate=(version_compare(aeSecureMasterVersion,version,'gt')?false:true);}
if(isUpToDate){
aeCounters['uptodate']+=1;
$(row).removeClass('warning');
$(row).addClass('success');}else{
aeCounters['oldversion']+=1;
$(row).removeClass('success');
$(row).addClass('warning');;}
if(!(data.hasOwnProperty('error'))){
if(data.hasOwnProperty('info')){
var siteInfos=Aes.Ctr.decrypt(data['info'],aeSecureConfig['password'],256);
siteInfos=JSON.parse(siteInfos);
if(siteInfos.hasOwnProperty('sitename')) siteInfos.title=siteInfos.sitename;
DOMSetValue(row,sRowName+'_title',siteInfos.title);
if(siteInfos.hasOwnProperty('php_version')) DOMSetValue(row,sRowName+'_php',siteInfos.php_version);
if(siteInfos.hasOwnProperty('dynamic')){
var dynamic=siteInfos.dynamic;
if(dynamic.hasOwnProperty('package')) version+=' '+dynamic['package'];
if(dynamic.hasOwnProperty('cms')){
cms=dynamic['cms'];var cms_version='';
if(cms.hasOwnProperty('version')){
cms_version=' '+cms['version']['major'];}
DOMSetValue(row,sRowName+'_cms',cms['name']+cms_version);}}
if(siteInfos.hasOwnProperty('mail')) siteInfos.mail_to=siteInfos.mail['to'];var funct=document.createElement("span");
funct.className="functionnalities";
funct.setAttribute('id','funct_'+siteID);var enabled_11=false;
if(siteInfos.hasOwnProperty('functionnalities')){
var value='';var enabled=false;var sTitle='';
for (var key in siteInfos.functionnalities){
if(siteInfos.functionnalities.hasOwnProperty(key)){
value=siteInfos.functionnalities[key];
enabled=(((value=='false')||(value=='0')||(value==''))?false:true);
if(enabled){
if(key=='1.1') enabled_11=true;var type=((siteInfos.functionnalities[key]=='true')||(siteInfos.functionnalities[key]=='1')?'bool':'text');
value="<span class='glyphicon glyphicon-"+(enabled? (type=='bool'?'ok':'zoom-in'):'remove')+"'/>";var fct=document.createElement("span");
fct.className='function';
fct.className+=' '+(enabled?'enabled':'disabled');
fct.innerHTML=key +':'+value;
fct.setAttribute('data-toggle','popover');
sTitle=key+' '+arrSnippets[key];
if(type=='bool'){
fct.setAttribute('data-content',sTitle);}else{
var sText=siteInfos.functionnalities[key];
sText=sText.replace(/(\r\n|\n|\r)/g,"<br />");
fct.setAttribute('data-content',sTitle+'<br/><br/><strong style="color:blue;">'+getText('click_and_modal')+'</strong>');
fct.setAttribute('data-popup-content','<u>'+sTitle+'</u><br/>'+sText);
fct.setAttribute('data-popup','1');;}
funct.appendChild(fct);}}}}
if((version_compare(version,'1.2','ge')) && (enabled_11==false) ){
var fct=document.createElement("span");
fct.className='function disabled'
fct.innerHTML=getText('11_not_installed');
funct.appendChild(fct);
DOMSetValue(row,sRowName+'_config',funct.innerHTML);}else{
DOMSetValue(row,sRowName+'_config',funct.innerHTML);}
if(siteInfos.hasOwnProperty('server')){
var serverinfos=siteInfos['server'];var funct=document.createElement("span");
funct.className="server";
if(serverinfos.hasOwnProperty('os')){
var fct=document.createElement("span");
fct.className='serverinfos';
fct.innerHTML='<span class="title">OS</span>:'+serverinfos['os'];
funct.appendChild(fct);}
if(serverinfos.hasOwnProperty('datetime')){
var fct=document.createElement("span");
fct.className='serverinfos carriagereturn';
fct.innerHTML='<span class="title">Datetime</span>:'+serverinfos['datetime'];
funct.appendChild(fct);}
if(siteInfos.hasOwnProperty('db_version')){
var fct=document.createElement("span");
fct.className='serverinfos carriagereturn';
fct.innerHTML='<span class="title">Database</span>:'+siteInfos['db_version'];
funct.appendChild(fct);}
DOMSetValue(row,sRowName+'_server',funct.innerHTML);}}}
DOMSetValue(row,sRowName+'_version',version);var grpNavig=document.createElement("div");
grpNavig.setAttribute("class","grpButtonsNavig green");
if(!siteMainData.hasOwnProperty('backend') || (siteMainData['backend']=='')){
if((cms!=null) && (cms['name']=='Joomla!')) siteMainData['backend']=urls['base']+'/administrator/index.php';}
if(siteMainData.hasOwnProperty('backend') && (siteMainData['backend']!=='')){
grpNavig.appendChild(addButton(siteID,'backend',{"url":siteMainData['backend']}));}
if(!siteMainData.hasOwnProperty('frontend') || (siteMainData['frontend']=='')) siteMainData['frontend']=urls['base'];
if(siteMainData.hasOwnProperty('frontend')){
if(siteMainData['frontend']!=='') grpNavig.appendChild(addButton(siteID,'frontend',{"url":siteMainData['frontend']}));}
if(siteMainData.hasOwnProperty('aesecure')){
if(siteMainData['aesecure']!=='') grpNavig.appendChild(addButton(siteID,'aesecureSetup',{"url":siteMainData['aesecure']}));}
DOMSetValue(row,sRowName+'_navig',$(grpNavig).html());var grpActions=document.createElement("div");
grpActions.setAttribute("class","grpButtonsActions green");
if(typeof(siteInfos)!=="undefined"){
if(siteInfos.mail_to!=='') grpActions.appendChild(addButton(siteID,'email',{"email":siteInfos.mail_to,"url":urls.base}));}
grpActions.appendChild(addButton(siteID,'log',{"url":urls.aeSecure+"&w=1001"}));
grpActions.appendChild(addButton(siteID,'error_apache',{"url":urls.aeSecure+"&w=1004"}));
grpActions.appendChild(addButton(siteID,'reinstall',{"url":urls.aeSecure+"&w=9999"}));
grpActions.appendChild(addButton(siteID,'eraser',{"url":urls.base},false));
grpActions.appendChild(addButton(siteID,'lastmod',{"url":urls.premium_tools+"lastmodified/lastmod.php?"+urls.key},true));
grpActions.appendChild(addButton(siteID,'exportdb',{"url":urls.base},true));
grpActions.appendChild(addButton(siteID,'zip',{"url":urls.download+"?"+urls.key+"&file=/"},true));
DOMSetValue(row,sRowName+'_actions',$(grpActions).html());
aeCounters['nbrProcessed']+=1;
return true;}
function ajaxFailureGetProcessSiteDetail(data, sRowName){
var row=$('#'+sRowName);
$(row).addClass('danger');var siteID=$(row).data('id');
DOMSetValue(row,sRowName+'_dashboard',getRemoveSiteButton(siteID));
aeCounters['nbrErrors']+=1;
return true;}
function ajaxErrorGetProcessSiteDetail(XMLHttpRequest, textStatus, errorThrown, sRowName, siteMainData){
siteMainData=JSON.parse(siteMainData);var row=$('#'+sRowName);
$(row).addClass('danger');var siteID=$(row).data('id');
DOMSetValue(row,sRowName+'_dashboard',getRemoveSiteButton(siteID));var $moreInfo='';
if(typeof XMLHttpRequest.responseText!='undefined'){
var $script='';
$script='var w=window.open(\''+siteMainData['aesecure']+'\', \'\', \'width=1000, height=800, scrollbars=yes\');';
$moreInfo='<a onclick="javascript:'+$script+'">More info</a>';}
DOMSetValue(row,sRowName+'_title','<span style="font-size:smaller;">'+formatErrorMessage(XMLHttpRequest, errorThrown)+$moreInfo+'</span>');var grpNavig=document.createElement("div");
grpNavig.setAttribute("class","grpButtonsNavig green");
if(siteMainData.hasOwnProperty('backend')){
if(siteMainData['backend']!=='') grpNavig.appendChild(addButton(siteID,'backend',{"url":siteMainData['backend']}));}
if(siteMainData.hasOwnProperty('frontend')){
if(siteMainData['frontend']!=='') grpNavig.appendChild(addButton(siteID,'frontend',{"url":siteMainData['frontend']}));}
if(siteMainData.hasOwnProperty('aesecure')){
if(siteMainData['aesecure']!=='') grpNavig.appendChild(addButton(siteID,'aesecureSetup',{"url":siteMainData['aesecure']}));}
DOMSetValue(row,sRowName+'_navig',$(grpNavig).html());var grpActions=document.createElement("div");
grpActions.setAttribute("class","grpButtonsActions green");
grpActions.appendChild(addButton(siteID,'log',{"url":siteMainData['aesecure']+"&g=1&format=xml"}));
grpActions.appendChild(addButton(siteID,'reinstall',{"url":siteMainData['aesecure']+"&w=9999"}));
DOMSetValue(row,sRowName+'_actions',$(grpActions).html());
aeCounters['nbrErrors']+=1;
return true;}
function getRemoveSiteButton(siteID){
var btnClose=document.createElement("button");
btnClose.type='button';
btnClose.className='close';
btnClose.setAttribute('data-dismiss','alert');
btnClose.setAttribute('aria-hidden','true');
btnClose.innerHTML='&times;';
btnClose.setAttribute('id','aeSecure_removesite_'+siteID);
btnClose.setAttribute("data-container","body");
btnClose.setAttribute("data-toggle","popover");
btnClose.setAttribute("data-placement","top");
btnClose.setAttribute("data-content",getText('removesite_hint'));
return btnClose;}
function ajaxify(sUrl, sParam, sDataType, sSuccessFunction, sFailureFunction, sErrorFunction, sMethod, baSync, bAllowCache){
if(aeSecure.debug===true) sMethod='GET';
if((typeof sUrl==="undefined") || (sUrl==='')){
alertify.alert("Function ajaxify() -  ERROR:The url isn\'t defined<br/><br/>sUrl="+sUrl+"<br/>sParam="+sParam+"<br/>sDataType="+sDataType+"<br/>"+
"sMethod="+sMethod+"<br/>sSuccessFunction="+sSuccessFunction+"<br/>sFailureFunction="+sFailureFunction+"<br/>"+
"sErrorFunction="+sErrorFunction);
return false;}
sParam=(typeof sParam==="undefined")?'':sParam;
sDataType=(typeof sDataType==="undefined")?'json':sDataType;
sSuccessFunction=(typeof sSuccessFunction==="undefined")?'':sSuccessFunction;
sFailureFunction=(typeof sFailureFunction==="undefined")?'':sFailureFunction;
sErrorFunction=(typeof sErrorFunction==="undefined")?'':sErrorFunction;
sMethod=((typeof sMethod==="undefined") || (sMethod===''))? 'GET':sMethod;
baSync=(typeof baSync==="undefined")?true:baSync;
bAllowCache=(typeof bAllowCache==="undefined")?false:bAllowCache;
$.ajaxSetup({ cache: bAllowCache });
if(aeSecureOptions.debug=='1'){ console.log('ajaxify() - requesting '+sUrl+'?'+sParam);}
if((typeof sParam !="undefined") && (sParam.indexOf("key=")<0)){
sParam="key="+getDashboardKey()+"&"+sParam;}
$.ajax({
type: sMethod,
url: sUrl,
async: baSync,
dataType: sDataType,
data: sParam,
success: function(data){
if(sSuccessFunction!='') eval(sSuccessFunction);},
error: function(XMLHttpRequest, textStatus, errorThrown){
if(sErrorFunction!=''){
eval(sErrorFunction);}else{
console.log('dashboard.js ajaxify() network error'); console.log(textStatus);} },
failure: function(data){
if(sFailureFunction!=''){
eval(sFailureFunction);}else{
console.log('dashboard.js ajaxify() failure'); console.log(data);}}});}
function _addTooltip(obj, text, onlyPremium){
if(obj==null) return false;
if(typeof(onlyPremium)==='undefined') onlyPremium=false;
$(obj).attr("data-container","body");
$(obj).attr("data-toggle","popover");
$(obj).attr("data-placement","top");
$(obj).attr("data-content",getText(text)+ (onlyPremium?'<br/><br/>'+getText('onlyIfPremium'):''));
return;}
function addButton(id, icon, data, onlyPremium){
if(typeof(onlyPremium)==='undefined') onlyPremium=false;var span=document.createElement("span");
span.className="aeicons glyphicon "+getIcon(icon);
span.setAttribute("id","aeSecure_"+icon+"_"+id);
span.setAttribute("style","font-size:"+aeSecureToolbar['buttonsize']+"px;width:"+aeSecureToolbar['buttonspacing']+"px;");
if(typeof data !=="undefined"){
for (var key in data){
if(data.hasOwnProperty(key)){ span.setAttribute("data-"+key,data[key]);}}}
_addTooltip(span,icon,onlyPremium);
return span;}
function getDashboardKey(){
var sKey=(typeof options!="undefined"?options.key+'&':'');
if(sKey==''){
var query=window.location.search.substring(1);
if(query.indexOf("&") > 0){
sKey=query.substr(0, query.indexOf("&"));
sKey=sKey.replace("key=","");}else{
sKey=query;}}
return sKey;}
function DOMSetValue(DOMParentObject, DOMObjectID, sValue){
if(DOMObjectID.substring(0, 1)!='#') DOMObjectID="#"+DOMObjectID;var obj=null;
if(DOMParentObject!==null){
if($(DOMParentObject).find(DOMObjectID).exists()==true) obj=$(DOMParentObject).find(DOMObjectID);}else{
if($(DOMObjectID).exists()==true) obj=$(DOMObjectID);}
if(obj!=null) $(obj).html(sValue);}
function formatErrorMessage(jqXHR, exception){
if(exception==='Forbidden (aeSecure)'){
return ('The site has been successfully reached but the request has been blocked by aeSecure.  Please verify that you\'ve enabled the Dashboard configuration option on that site and that you\'re using the correct aeSecure\'s Key.')
} else if(jqXHR.status===0){
return (exception===''?'Not connected.\nPlease verify your network connection.':exception);} else if(jqXHR.status==404){
return ('The requested page not found. [404]');} else if(jqXHR.status==500){
return ('Internal Server Error [500].');} else if(exception==='parsererror'){
return ('Requested JSON parse failed.');} else if(exception==='timeout'){
return ('Time out error.');} else if(exception==='abort'){
return ('Ajax request aborted.');}else{
return ('Uncaught Error.\n' + jqXHR.responseText);}}
function getText(code){
var sReturn='missing';
try{
sReturn=(arrLanguage.hasOwnProperty(code)?arrLanguage[code]:code);} catch (e){
}
return sReturn;}
function isDemoMode(){
if(aeSecureOptions.hasOwnProperty('demo')){
return (aeSecureOptions['demo']==1?true:false);}else{
return false;}}
function getIcon(icon){ return aeSecureIcons[icon];}
function openUrl(obj){
if(!(isDemoMode())){
var url=$(obj).attr('data-url');
if(url!=='') window.open(url);}else{
alertify.error(aeSecureOptions['msgHiddenDemoMode']);}}
function instantiateButtons(){
$( "span[id^='aeSecure_email_']" ).click(function(e){
e.stopImmediatePropagation();
if(!isDemoMode()){
var email=$(this).attr('data-email');
if(email!=''){
var url=$(this).attr('data-url');var subject=getText('mailToWebmaster');
subject=subject.replace('%1',aeSecureMasterVersion);
subject=subject.replace('%2',url);
document.location.href="mailto:"+email+"?subject="+encodeURI(subject);}}else{
alertify.error(aeSecureOptions['msgHiddenDemoMode']);}});
$("span[data-popup=1]").click(function(e){
e.stopImmediatePropagation();var txt=$(this).attr('data-popup-content');
if(txt!='') alertify.alert(txt);});
$("span[id^='aeSecure_backend_']").click(function(e){ e.stopImmediatePropagation(); openUrl(this);});
$("span[id^='aeSecure_frontend_']").click(function(e){ e.stopImmediatePropagation(); openUrl(this);});
$("span[id^='aeSecure_aesecureSetup_']").click(function(e){ e.stopImmediatePropagation(); openUrl(this);});
$("span[id^='aeSecure_zip_']").click(function(e){ e.stopImmediatePropagation(); openUrl(this);});
$("span[id^='aeSecure_lastmod_']").click(function(e){ e.stopImmediatePropagation(); openUrl(this);});
$("span[id^='aeSecure_eraser_']").click(function(e){
e.stopImmediatePropagation();
if(!isDemoMode()){
var siteid=$(this).attr('id');
siteid=siteid.replace('aeSecure_eraser_','');var siteKey=($('#website_'+siteid).attr('data-key'));
$.ajax({
url: $(this).attr('data-url')+'/aesecure/setup.php',
type:(aeSecure.debug===true?'GET':'POST'),
data:'key='+siteKey+'&w=[91,92]',
async: false,
success: function(html){ alertify.log(html);}});}else{
alertify.error(aeSecureOptions['msgHiddenDemoMode']);}});
$("span[id^='aeSecure_configuration_']").click(function(e){
e.stopImmediatePropagation();var span=$(this).attr('data-span');
$("#"+span).toggleClass('display-block');});
$("span[id^='aeSecure_exportdb_']").click(function(e){
e.stopImmediatePropagation();
if(!isDemoMode()){
var siteid=$(this).attr('id');
siteid=siteid.replace('aeSecure_exportdb_','');var siteKey=($('#website_'+siteid).attr('data-key'));
$.ajax({
url: $(this).attr('data-url')+'/aesecure/setup.php',
type:(aeSecure.debug===true?'GET':'POST'),
data:'key='+siteKey+'&w=51',
async: false,
success: function(url){  window.open(url);}});}else{
alertify.error(aeSecureOptions['msgHiddenDemoMode']);}});
$("span[id^='aeSecure_log_']").click(function(e){ e.stopImmediatePropagation(); openUrl(this);});
$("span[id^='aeSecure_error_apache_']").click(function(e){ e.stopImmediatePropagation(); openUrl(this);});
$("span[id^='aeSecure_reinstall_']").click(function(e){
e.stopImmediatePropagation();
if(!isDemoMode()){
var url=$(this).attr('data-url');var url_install=url.substring(0,url.indexOf("/setup.php",0))+".php?Skip=1";
$.ajax({
url: url,
async: false,
success: function(data){ window.open(url_install);},
failure:function (){ }});}else{
alertify.error(aeSecureOptions['msgHiddenDemoMode']);}});
$("button[id^='aeSecure_removesite_']" ).click(function(e){
var siteid=$(this).attr('id');
siteid=siteid.replace('aeSecure_removesite_','');var siteurl=$('#website_'+siteid).data('url');var sitetitle=$('#website_'+siteid+"_title").text();
e.stopImmediatePropagation();
alertify.set({ buttonFocus: "cancel",  buttonReverse: true });var msg=getText('removesite_prompt');
msg=msg.replace('%1','<strong>'+sitetitle+' ('+siteurl+')</strong>');
alertify.confirm(msg, function (e){
if(e){
if(!isDemoMode()){
$('#website_'+siteid).remove();
siteurl=siteurl.replace('http','');
$.ajax({
type:'GET',
url: aeSecureOptions['baseurl'],
data:'task=removesite&value='+encodeURIComponent(siteurl),
async: true,
success: function(){ }});}else{
alertify.error(aeSecureOptions['msgHiddenDemoMode']);}}});});
return true;}
$("#aeSecureRemoveErrorSite").click(function(e){
e.stopImmediatePropagation();
if($('#tblaeSecure').exists()==true){
$('#tblaeSecure > tbody  > tr').each(function(index,row){
if($(row).hasClass('danger')) $(row).remove();});}else{ console.log('ERROR table #tblaeSecure not found');}});
$("#aeSecureAddSite").click(function(e){
e.stopImmediatePropagation();
if(!isDemoMode()){
var urlDefault='http://yoursite/aesecure/setup.php?THE_VERY_LONG_KEY';
alertify.set({ buttonFocus: "cancel",  buttonReverse: true  });
alertify.prompt(getText('addsite_prompt'), function (e, url){
if(e){
if(url!=urlDefault){
url=url.split('#')[0];
url=url.replace('http','');
$.ajax({
type:'GET',
url: aeSecureOptions['baseurl'],
data:'task=addsite&value='+encodeURIComponent(url),
async: true,
success: function(){ window.location.reload();}});}}}, urlDefault);}else{
alertify.error(aeSecureOptions['msgHiddenDemoMode']);}});
function tblExport(FileFormat){
$('#tblaeSecure').tableExport({type:FileFormat,escape:'false',ignoreColumn:'[0,7,8]'});}
$("#tableExportJSON").click(function(e){ e.stopImmediatePropagation(); if(!isDemoMode()){ tblExport('json');}else{ alertify.error(aeSecureOptions['msgHiddenDemoMode']);} });
$("#tableExportCSV").click(function(e){ e.stopImmediatePropagation(); if(!isDemoMode()){ tblExport('csv');}else{ alertify.error(aeSecureOptions['msgHiddenDemoMode']);} });
$("#tableExportDOC").click(function(e){e.stopImmediatePropagation(); if(!isDemoMode()){ tblExport('doc');}else{ alertify.error(aeSecureOptions['msgHiddenDemoMode']);} });
$("#tableExportXLS").click(function(e){ e.stopImmediatePropagation(); if(!isDemoMode()){ tblExport('excel');}else{ alertify.error(aeSecureOptions['msgHiddenDemoMode']);} });};}(jQuery));
function version_compare (v1, v2, operator){
v1=v1.replace(/[^0-9.]/g,'');
if(v2==undefined) return true;
v2=v2.replace(/[^0-9.]/g,'');
this.php_js=this.php_js || {};
this.php_js.ENV=this.php_js.ENV || {};var i=0,
x=0,
compare=0,
vm={
'dev': -6,'alpha': -5,'a': -5,'beta': -4,'b': -4,'RC': -3,'rc': -3,'#': -2,'p': 1,'pl': 1
},
prepVersion=function (v){
v=('' + v).replace(/[_\-+]/g,'.');
v=v.replace(/([^.\d]+)/g,'.$1.').replace(/\.{2,}/g,'.');
return (!v.length?[-8]:v.split('.'));},
numVersion=function (v){
return !v?0:(isNaN(v)?vm[v] || -7:parseInt(v, 10));};
v1=prepVersion(v1);
v2=prepVersion(v2);
x=Math.max(v1.length, v2.length);
for (i=0; i < x; i++){
if(v1[i]==v2[i]){
continue;}
v1[i]=numVersion(v1[i]);
v2[i]=numVersion(v2[i]);
if(v1[i] < v2[i]){
compare=-1;
break;} else if(v1[i] > v2[i]){
compare=1;
break;}}
if(!operator){
return compare;}
switch (operator){
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >=0);
case '<=':
case 'le':
return (compare <=0);
case '==':
case '=':
case 'eq':
return (compare===0);
case '<>':
case '!=':
case 'ne':
return (compare !==0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;}}
$(document).ready(function (){
if($.fn.aeSecure){
if($.fn.Pace){ paceOptions={ajax:true,document:true,eventLag:true}; Pace.start();}
$('#aeSecureMasterVersion').aeSecure('init',options);
$('#tblaeSecure').aeSecure('process');
if($.fn.Pace) Pace.stop();}else{
alertify.error("<strong>The aeSecure JQuery object isn't loaded.</strong>");}});