Your IP : 216.73.216.68


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

<?php
   // @file : /dashboard/dashboard.php
   // @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:42
   // @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.
?>
<?php
if(!defined('_AESECURE')) define('_AESECURE',1);
class aeSecureDashboard{
private $_config=null;  private $_sites=null;  private $_path='';private $_homeurl='';private $root;private $aesC;private $aesL;private $aesS;private $aeSt;
function __construct(){
$this->root=dirname(dirname(__FILE__)).'/';require_once  ($this->root.'helpers/session.php');$this->aesS = aecS::getInstance();$this->aesS->isValid();require_once  ($this->root.'helpers/settings.php');$this->aeSt = aecSt::getInstance();require_once  ($this->root.'helpers/configuration.php');$this->aesC = aeSecureConfiguration::getInstance();require_once  ($this->root.'helpers/language.php');$this->aesL = aecLa::getInstance($this->aesS->get('language'));$this->_path=rtrim(dirname(__FILE__),DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;if(!file_exists($this->_path.'sites.json')){
$urlMe=$this->aeSt->siUl().'aesecure/setup.php?'.$this->aesC->get('key');
$arr=array(
'config'=>array('language'=>str_replace('-','_',$this->aesC->Language()),'aesecure'=>$this->aeSt->aeWbt()),
'sites'=>array(
array('backend'=>'','aesecure'=>$urlMe,'enabled'=>'1')
)
);
$file = fopen($this->_path.'sites.json', 'w');
fwrite($file, json_encode($arr));
fclose($file);}
$this->_sites = (file_exists($this->_path.'sites.json')?json_decode(file_get_contents($this->_path.'sites.json', FILE_USE_INCLUDE_PATH),true):null);if(isset($this->_sites)){
$this->_config=$this->_sites['config'];$this->_homeurl=$this->_config['aesecure'];$this->_sites=isset($this->_sites['sites'])?$this->_sites['sites']:null;foreach ($this->_sites as $key=>$site){
$bBle = ((array_key_exists('enabled',$site)&&($site['enabled']===0)?0:1));if($bBle===1){
$this->_sites[$key]['aesecure'] = strtok($site['aesecure'], "#");} else{
unset($this->_sites[$key]);}}
self::aasort($this->_sites,"aesecure");}}  function __destruct(){
unset($this->_config);
unset($this->_sites);
unset($aesC);
unset($aeSt);}
function mo(){
if(!isset($aesC)){
require_once('../helpers/configuration.php');
$aesC = new aeSecureConfiguration();}
$html=($aesC->mo()?'<span class="blink btn btn-warning pull-right" style="display:inline;cursor:default;">'.$this->aesL->getMain('demo').'</span>':'');
return $html;}
function homeurl(){return $this->_homeurl;}
function sites($site){
$return=null;if($site===null){
$return=$this->_sites;} else{
$i=0;foreach ($this->_sites as $entry){
if($i===intval($site)){$return=$entry; break;}
$i++;}} return $return;}  public function getJSSettings(){
if(!isset($aesC)){
require_once('../helpers/configuration.php');
$aesC = new aeSecureConfiguration();}
$script="var options ={}\n".
"options.baseurl= '".self::cPgRL()."',".
"options.language= '".str_replace('-','_',$this->_config['language'])."',".
"options.key= '".(($aesC->mo()==true)?'NoKeyDuringDemoMode':$aesC->get('key'))."',".
"options.debug='".($aesC->get('debug')?1:0)."',".
"options.demo='".($aesC->mo()?1:0)."',".
"options.msgHiddenDemoMode='".str_replace("'",'\"',$this->aesL->getMain('hiddenindemo'))."';";
$script.="var aeSecure={}\nshowUseKey='false';\n";
return $script;} public function gItULK($url){
$url = strtok($url, "#");
$wpos=strpos($url,'aesecure/setup.php');
$key=substr($url,strpos($url,'.php?')+strlen('.php?'));
$url=substr($url,0,strpos($url,'aesecure/setup.php'));
return array($url,$key);}  private function aasort (&$array,$key){
if(count($array)>0){
$sorter=array();
$ret=array();
reset($array);foreach ($array as $ii => $va) $sorter[$ii]=$va[$key];
asort($sorter);foreach ($sorter as $ii => $va) $ret[$ii]=$array[$ii];
$array=$ret;}}  public function gLoFts(){
$i=0;
$wSiteIndex=0;$return='';if(count($this->_sites)>0){
foreach ($this->_sites as $entry){
$bBle=(key_exists('enabled',$entry)?$entry['enabled']:1);if( $bBle&&(key_exists('aesecure',$entry))){
list($url,$key)=self::gItULK($entry['aesecure']);if($this->aesC->mo()==true) $key='NoKeyDuringDemoMode';
$i+=1;$return.=
'<tr id="website_'.$wSiteIndex.'"  data-aesecure="true" data-key="'.$key.'" data-id="'.$wSiteIndex.'" data-url="'.$url.'">'.'<td id="website_'.$wSiteIndex.'_dashboard"></td>'.'<td id="website_'.$wSiteIndex.'_id">'.$i.'</td>'.'<td id="website_'.$wSiteIndex.'_url" class="colURL">'.$url.'</td>'.'<td id="website_'.$wSiteIndex.'_title" class="colTitle"></td>'.'<td id="website_'.$wSiteIndex.'_version" class="colVersionaeSecure"></td>'.'<td id="website_'.$wSiteIndex.'_php" class="colPHP"></td>'.'<td id="website_'.$wSiteIndex.'_cms" class="colCMS"></td>'.'<td id="website_'.$wSiteIndex.'_navig" class="colNavig"></td>'.'<td id="website_'.$wSiteIndex.'_actions" class="colActions"></td>'.'<td id="website_'.$wSiteIndex.'_config" class="colConfig"></td>'.'<td id="website_'.$wSiteIndex.'_server" class="colServer"></td>'.'</tr>';}
$wSiteIndex+=1;} } return $return;} public function gRvl($param,$default='',$maxlen=50,$type='string',$where='GET'){
if($maxlen===null) $maxlen=50;if(in_array($type,array('bool','boolean'))) $maxlen=1;if($where=='GET'){
$return=(isset($_GET[$param])?$_GET[$param]:$default);} else{
if(isset($_POST[$param])){
$return=$_POST[$param];} else{
if($aesC->get('debug')&&isset($_GET[$param])){
$return=$_GET[$param];} else{
$return=$default;}}}
if($maxlen!==0){
if(strlen($return)>$maxlen) $return=substr($return,0,$maxlen);}
if($type=='boolean') $type='bool';
try{
switch ($type){
case 'bool':
if(($return=='true')||($return=='on')) $return=1;$return=(trim($return)==''?0:(filter_var($return, FILTER_VALIDATE_BOOLEAN)?intval($return):0));if($return!=1) $return=0;break;case 'int':$return=(trim($return)==''?0:(filter_var($return, FILTER_VALIDATE_INT)?intval($return):0)); break;case 'ip':$return=(filter_var($return, FILTER_VALIDATE_IP)?$return:''); break;case 'file':
$return=filter_var($return, FILTER_SANITIZE_STRING);$return=preg_replace("([^\.\w\s\d\-_~,;:\[\]\(\]]|[\.]{2,})", '',$return);$return=str_replace('..','', str_replace('\\','',str_replace('/','',$return)));break;case 'rules':
break;
default:$return=filter_var($return, FILTER_SANITIZE_STRING);}} catch (Exception $exc){
$return=0;} return $return;} public function addSite($siteurl){
$bReturn=false;if(trim($siteurl)!=''){
if(substr($siteurl,4)!='http') $siteurl='http'.ltrim($siteurl,'http');if(is_writable($this->_path.'sites.json')){
$siteurl = strtok($siteurl, '#');
$arr=array('backend'=>'','aesecure'=>$siteurl,'enabled'=>'1');$this->_sites=json_decode(file_get_contents($this->_path.'sites.json', FILE_USE_INCLUDE_PATH),true);if(!isset($this->_sites['sites'])) $this->_sites['sites']=array();
array_push($this->_sites['sites'],$arr);
$file = fopen($this->_path.'sites.json', 'w');
fwrite($file, json_encode($this->_sites));
fclose($file);
$bReturn=true;} else{
die('File sites.json not writable.');}} else{
die('Invalid request; missing "value" parameter');} return $bReturn;} public function getJSLanguage(){
$sJS="";
$snippets=$this->aeSt->spts();foreach ($snippets as $key=>$value){
$lUA=$this->aeSt->spts($key,'language','');if(trim($lUA)!=''){
$title=$this->aesL->$lUA('title');if(trim($title)!==''){
$sJS.="arrSnippets['".substr($key,0,1).'.'.substr($key,-1)."']='".str_replace("'","\'",$title)."';\n";}}}
if(trim($sJS)!=='') $sJS = "var arrSnippets = new Array()\n".$sJS;
$sLangJS="";
$arr=$this->aesL->gDhrd();foreach ($arr as $key=>$value){
$sLangJS.="arrLanguage['".$key."']='".str_replace("'","\'",$value)."';\n";}
if(trim($sLangJS)!=='') $sLangJS = "var arrLanguage = new Array()\n".$sLangJS;
return $sJS.$sLangJS;}  public function getText($text){return $this->aesL->gDhrd($text);} public function removeSite($siteurl){
$bReturn=false;if(trim($siteurl)!=''){
if(substr($siteurl,4)!='http') $siteurl='http'.ltrim($siteurl,'http');if(is_writable($this->_path.'sites.json')){
$site = strtok($site, "#");
$json=json_decode(file_get_contents($this->_path.'sites.json', FILE_USE_INCLUDE_PATH),true);$this->_sites=$json['sites'];foreach ($this->_sites as $key=>$site){
list($url,$aekey)=self::gItULK($site['aesecure']);if($url===$siteurl){
$this->_sites[$key]['enabled']=(int) 0;
$bReturn=true;}}
if($bReturn===true){
$json['sites']=$this->_sites;
$file = fopen($this->_path.'sites.json', 'w');
fwrite($file, json_encode($json));
fclose($file);} else{ die ('Site not found');}} else{
die('File sites.json not writable.');}} return $bReturn;}
private function cPgRL(){
$pageURL = 'http';if(isset($_SERVER["HTTPS"])&&($_SERVER["HTTPS"] == "on")){$pageURL .= "s";}
$pageURL .= "://";if($_SERVER["SERVER_PORT"] != "80"){
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];} else{
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];} return $pageURL;}}
$dashboard=new aeSecureDashboard();
$task=$dashboard->gRvl($param='task',$default='list',$maxlen='10',$type='string',$where='GET');
$site=$dashboard->gRvl($param='site',$default='',$maxlen='10',$type='int',$where='GET');$value=$dashboard->gRvl($param='value',$default='',$maxlen='150',$type='string',$where='GET');if(!in_array($task, array('','list'))){
switch($task){
case 'addsite': $bReturn=$dashboard->addSite($value); break;case 'removesite': $bReturn=$dashboard->removeSite($value); break;case 'get':die(json_encode($dashboard->sites($site)));}}
?>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="author" content="aeSecure (c) Christophe Avonture" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<link href="../third/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="../third/alertify/themes/alertify.core.css" rel="stylesheet" media="screen">
<link href="../third/alertify/themes/alertify.bootstrap.css" rel="stylesheet" media="screen">
<link href="../third/pace/pace.css" rel="stylesheet" media="screen">
<link href="../third/tablesorter/css/theme.ice.css" rel="stylesheet" media="screen">
<link href="../assets/icomoon/style.css" rel="stylesheet" media="screen">
<link href="../assets/aesecure.css" rel="stylesheet" media="screen">
<link href="dashboard.css" rel="stylesheet" media="screen">
<script type="text/javascript">
<?php  echo $dashboard->getJSLanguage();?>
</script>
</head>
<body id="aeSecureBody">
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-full">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo $dashboard->homeurl();?>" target="_blank">aeSecure</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#"><?php echo $dashboard->getText("title"); ?></a></li>
<li><a href="http://www.aesecure.com/fr/accueil/contact.html" target="_blank"><?php echo $dashboard->getText("contact"); ?></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $dashboard->getText("actions"); ?><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a id="aeSecureAddSite" href="#"><?php echo $dashboard->getText("addsite"); ?></a></li>
<li class="divider"></li>
<li><a id="aeSecureRemoveErrorSite" href="#"><?php echo $dashboard->getText("hideerrorsiste"); ?></a></li>
<li class="divider"></li>
<li><a href="#" id="tableExportJSON"><img width="16" height="16" src="../third/htmltable_export/icons/json.png"/><?php echo rtrim($dashboard->getText("download_as")); ?>&nbsp;JSON</a></li>
<li><a href="#" id="tableExportCSV"><img width="16" height="16" src="../third/htmltable_export/icons/csv.png"/><?php echo rtrim($dashboard->getText("download_as")); ?>&nbsp;CSV</a></li>
<li><a href="#" id="tableExportDOC"><img width="16" height="16" src="../third/htmltable_export/icons/word.png"/><?php echo rtrim($dashboard->getText("download_as")); ?>&nbsp;Winword</a></li>
<li><a href="#" id="tableExportXLS"><img width="16" height="16" src="../third/htmltable_export/icons/xls.png"/><?php echo rtrim($dashboard->getText("download_as")); ?>&nbsp;Excel</a></li>
</ul>
</li>
</ul>
<?php echo $dashboard->mo(); ?></div>
</div>
</div>
<div class="container-full"><div style="min-height:60px;">&nbsp;</div>
<div class="page-header"><h1 id="aeSecureMasterVersion"></h1></div>
<div class="row">
<p class="well"><span id="aeSubtitle"></span><br/><span id="aeSubtitleButtons"></span></p>
<div id="websites">
<div class="table-responsive">
<table id="tblaeSecure" class="table table-hover tablesorter">
<thead>
<tr>
<th width="10px"></th>
<th>#</th>
<th class="colURL">URL</th>
<th class="colTitle">Title</th>
<th class="colVersionaeSecure filter-select filter-exact" data-placeholder="---" id="tblaeSecure_thVersion" class="colVersionaeSecure">aeSecure</th>
<th class="filter-select filter-exact" data-placeholder="---"  id="tblaeSecure_thPHP" class="colPHP">PHP</th>
<th class="filter-select filter-exact" data-placeholder="---"  id="tblaeSecure_thCMS" class="colCMS">CMS</th>
<th class="colNavig">Navig</th>
<th class="colAction">Actions</th>
<th class="colConfig">Config</th>
<th class="colServer">Server</th>
</tr>
</thead>
<tbody>
<?php echo $dashboard->gLoFts();?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div style="min-height:70px;">&nbsp;</div>
<div class="container">
<footer>
<div class="row"><div class="col-lg-12"><a href="<?php echo $dashboard->homeurl();?>" target="_blank" id="aeSecureTitle"></a></div></div>
</footer>
</div>
</body>
<script type="text/javascript"><?php echo $dashboard->getJSSettings(); ?></script>
<script type="text/javascript" src="../third/bootstrap/js/jquery.min.js"></script>
<script type="text/javascript" src="../third/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../third/pace/pace.js"></script>
<script type="text/javascript" src="../third/tablesorter/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="../third/tablesorter/js/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript" src="../assets/aes.min.js"></script>
<script type="text/javascript" src="../third/alertify/lib/alertify.min.js" defer></script>
	<script type="text/javascript" src="../third/htmltable_export/tableExport.js"></script>
	<script type="text/javascript" src="../third/htmltable_export/jquery.base64.js"></script>
	<script type="text/javascript" src="../third/htmltable_export/html2canvas.js"></script>
<script type="text/javascript" src="dashboard.js"></script>
<?php unset($dashboard); ?>
</html>