Your IP : 216.73.216.229


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

<?php
   // @file : /premium/helpers/aesecure.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:44
   // @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
error_reporting(E_NONE);
defined( '_AESECURE') or die('No direct access allowed');
class aecPe{
protected static $instance = null;var $aeSt = null;var $aesC = null;var $aesL = null;var $aesS = null;var $aesD = null;static $SnippetsPath = '';static $templateFreePath = '';static $tlttH = '';static $layout='default';static $arrText=array('.htaccess','.htpasswd','.css','.html','.htm','.ini','.json','.js','.log','.php','.sql','.svg','.txt','.xml','.xsl');static $arrImages=array('.gif','.ico','.jpg','.jpeg','.png');
function __construct(){
require_once(dirname(dirname(dirname(__FILE__))).'/helpers/error.php');require_once (dirname(dirname(dirname(__FILE__))).'/helpers/functions.php');require_once (dirname(dirname(dirname(__FILE__))).'/helpers/settings.php');$this->aeSt = aecSt::getInstance();require_once (dirname(dirname(dirname(__FILE__))).'/helpers/configuration.php');$this->aesC = aeSecureConfiguration::getInstance();require_once (dirname(dirname(dirname(__FILE__))).'/helpers/session.php');$this->aesS = aecS::getInstance();require_once (dirname(dirname(dirname(__FILE__))).'/helpers/debug.php');$this->aesD = aecDb::getInstance();
aecFt::$rootFolder=$this->aeSt->siOt();require_once (dirname(dirname(dirname(__FILE__))).'/helpers//language.php');$this->aesL = aecLa::getInstance($this->aesC->Language());
aecFt::$Sce=$this->aesL->getMain('success');
aecFt::$flUe=$this->aesL->getMain('failure');
aecFt::$iain=$this->aesL->getMain('information');
aecFt::$wing=$this->aesL->getMain('warning');self::$templateFreePath = dirname(dirname(dirname(__FILE__))).'/template/';self::$tlttH = dirname(dirname(__FILE__)).'/template/';self::$SnippetsPath = dirname(dirname(__FILE__)).'/setup/snippets/';
return;}  public static function getInstance(){
if(self::$instance === null) self::$instance = new aecPe;
return self::$instance;}
function __destruct(){
unset($this->aesD);
unset($this->aesL);
unset($this->aeSt);} public function Maintenance(){
$html=file_get_contents(self::$tlttH.'maintenance.'.self::$layout.'.aec', FILE_USE_INCLUDE_PATH);$html=aecFt::rphl('%AESECUREMAINTENANCEPAGETITLE%',$this->aesL->getMaintenancePageTitle(),$html);$html=aecFt::rphl('%AESECUREMAINTENANCECOMEBACK%',$this->aesL->Option19_getMaintenance('comeback'),$html);$html=aecFt::rphl('%AESECUREMAINTENANCECONTACT%',$this->aesL->getMaintenanceContact(),$html);if(class_exists('aeSecure')){
$aesecure=aeSecure::getInstance();$html=$aesecure->rpVs($html);
unset($aesecure);}
header('aeSecure: maintenance enabled');header($_SERVER['SERVER_PROTOCOL'].' 503 Service Unavailable', true, 503);header('Retry-After: 3600');
return $html;} public function runTools($params){
$wTask=aecFt::gRvl($param=$this->aeSt->Params('setuptask'),$default='0',$maxlen=50,$type='int',$where='GET');
$filename=$this->aeSt->spts($wTask,'filename','');if(trim($filename)!=''){
if(file_exists(aecFt::$rootFolder.'/aesecure/premium/third/tools/'.$filename)){
$url='premium/third/tools/'.$filename;$this->aesS->set('CheckToken',0);header('Location: '.$url.($this->aesC->mo()?'':'?'.$this->aesC->get('key')));$return=true;} else{ $return=aecFt::SeAD(sprintf($this->aesL->gRrs('filenotfound'),str_replace('/',DIRECTORY_SEPARATOR,$filename)));}} else{ $return=false;} return $return;} public function RobotsTxt(){
if(file_exists('../robots.txt')){
header("Content-type: text/plain");
$bAllow = $this->aesC->get('robots-txt','block',true)?false:true;if($bAllow!==true){
$useragent = $_SERVER['HTTP_USER_AGENT'];
$arrAllowed=$this->aeSt->get('robots-txt','allowed');
$arr=$this->aesC->get('robots-txt','allowed');if(count($arr)>0) $arrAllowed=array_merge($arrAllowed,$arr);
$bAllow=false;foreach ($arrAllowed as $bot){
if(trim($bot)!=''){
if(preg_match('/'.str_replace('/','\/',$bot).'/',$useragent)){$bAllow=true; break;}}}
if($bAllow!==true){
require_once(dirname(dirname(dirname(__FILE__))).'/helpers/aesecure.php');
$setup=aeSecure::getInstance();
$tmp=$setup->getCode();
$setup->setCode(423);
$setup->waDlg();
$setup->setCode($tmp);
unset($setup);$this->aesD->log('Robots.txt blocked for:'.$useragent);$file=dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.'robots.txt';if(file_exists($file)&&is_readable($file)){
header('HTTP/1.1 200 OK');echo "# This file is forbidden for browser access\n\n";
$content=file_get_contents($file, FILE_USE_INCLUDE_PATH);
die($content);} else{
header('HTTP/1.0 403');
die('Error 403: This file is forbidden for browser access.');}}}
header('HTTP/1.1 200 OK');
$content=file_get_contents('../robots.txt', FILE_USE_INCLUDE_PATH);echo $content;
die();}} public function Geshi($wTask,$filename,$content='',$format=''){
if(trim($content)==''){
if((file_exists($filename))&&(is_readable($filename))){
$content=file_get_contents($filename, FILE_USE_INCLUDE_PATH);}}
if(trim($content)!==''){
$geshi=$this->aeSt->aERot().'/premium/third/geshi/geshi.php';if(file_exists($geshi)){
require_once($geshi);
try{
$arr=array('css'=>'css','htm'=>'html4strict','html'=>'html4strict','htaccess'=>'apache','json'=>'ini','log'=>'text','sql'=>'mysql','txt'=>'text','xml'=>'xml');
$fileext=(trim($filename)!=''?pathinfo($filename, PATHINFO_EXTENSION):'text');if(trim($format)==''){
$lUA=key_exists($fileext,$arr)?$arr[$fileext]:'text';} else{
if($format=='txt') $format='text';
$lUA=$format;}
$geshi = new GeSHi($content,$lUA);} catch(Exception $e){}
$geshi->set_header_type(GESHI_HEADER_PRE_VALID);if(($tmz=ini_get('date.timezone'))=='') $tmz='Europe/Brussels';
date_default_timezone_set($tmz);
$geshi->set_header_content('<h5>File ['.realpath($filename).'] (last mod. '.date ("Y-m-d H:i:s", filemtime($filename)).')</h5>');
$geshi->set_header_content_style('font-family:sans-serif;color:#FDFDFD;font-size:1.2em;background-color:#23234C;height:22px;');
$content='<style>'.$geshi->get_stylesheet(true).'</style>';
$content.= $geshi->parse_code();$html=$content;} else{
$html='<h5>File '.$filename.' (last mod. '.date ("Y-m-d H:i:s", filemtime($filename)).')</h5><hr/><pre>'.str_replace('>','&gt;',str_replace('<','&lt;',$content)).'</pre>';}} else{
$html='';} return $html;} public function Option1_checkPHPVersion(){
$phpNetVersions='';$html='';if($this->aesC->get('phpautocheck')==true){
$html=file_get_contents(self::$tlttH.'phpver.default.aec', FILE_USE_INCLUDE_PATH);
$ver=phpversion();$this->aesD->log('Installed PHP version:'.$ver);
$major=substr($ver,0,3);
$more='';
$phpNetVersions = unserialize(@file_get_contents($this->aeSt->php('url')));
$phpVersions=array();if(count($phpNetVersions)>0){
foreach($phpNetVersions as $version=>$data){
if(!isset($phpVersions[substr($version,0,3)])){
$phpVersions[substr($version,0,3)]=$version;} else{
if(version_compare($phpVersions[substr($version,0,3)],$version,'gt')===-1) $phpVersions[substr($version,0,3)]=$version;}}
$latest=(isset($phpVersions[$major])?$phpVersions[$major]:$this->aeSt->php($major));
switch ($major){
case '5.2':$more='5.3.x'; break;case '5.3':$more='5.4.x'; break;case '5.4':$more='5.5.x'; break;case '5.5':$more='5.6.x'; break;case '5.6':$more=''; break;}} else{
switch ($major){
case '5.2':$latest=$this->aeSt->php($major); $more='5.3.x'; break;case '5.3':$latest=$this->aeSt->php($major); $more='5.4.x'; break;case '5.4':$latest=$this->aeSt->php($major); $more=''; break;case '5.5':$latest=$this->aeSt->php($major); $more=''; break;case '5.6':$latest=$this->aeSt->php($major); $more=''; break;}}
$msg='';if(version_compare($ver,$latest)==-1){
$msg.= '<li><span class="glyphicon glyphicon-star"></span>&nbsp;'.sprintf($this->aesL->gRrs('old_php'),$ver,$latest).'</li>';} else{
$html=str_replace('alert-warning','alert-success',$html);
$msg.= '<li><span class="glyphicon glyphicon-star"></span>&nbsp;'.sprintf($this->aesL->getMain('uptodate_php'),$ver).'</li>';}
if(trim($more)!==''){
$url=$this->aeSt->php('url');
$style=($major=='5.2'?'style="margin-top:10px;padding:10px;border:1px solid red;':'');if(strpos($url,'?')>0) $url=substr($url,0,strpos($url,'?')-1);
$msg.= '<li '.$style.'><span class="glyphicon glyphicon-star"></span>&nbsp;'.sprintf($this->aesL->gRrs('old_php_major'),$major.'.x',$more).'&nbsp;'.
aecFt::link($url,$this->aesL->getMain('readmore'),'title="'.$url.'" target="_blank")').'.</li>';}
if(trim($msg)!='') $msg='<ul class="list-unstyled">'.$msg.'</ul>';$html=str_replace('%PHPVER%',$msg,$html);} return $html;} public function Option16_getTabBlockPartURL($wTask,$html){
$lUA=$this->aeSt->spts($wTask,'language');
$tag=$this->aeSt->spts($wTask,'tag');$html=str_replace('%URL_TITLE%',$this->aesL->$lUA('url'),$html);$html=str_replace('%URL_SAMPLE%',$this->aesL->$lUA('url_sample'),$html);$html=str_replace('%PLACEHOLDER1%',$this->aesL->$lUA('placeholder1'),$html);$html=str_replace('%PLACEHOLDER2%',$this->aesL->$lUA('placeholder2'),$html);$html=str_replace('%QUERTYSTRING_TITLE%',$this->aesL->$lUA('querystring'),$html);$html=str_replace('%QUERTYSTRING_SAMPLE%',$this->aesL->$lUA('querystring_sample'),$html);$html=str_replace('%ADD%',$this->aesL->getMain('add'),$html);$html=aecFt::rphl('%SAVEDMSG%', str_replace("'", "\'",$this->aesL->$lUA('saved')),$html);if((strpos($html,'%RESTOREFROMCONFIG%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIG%',$this->aesL->getMain('restorefromconfig'),$html);if((strpos($html,'%RESTOREFROMCONFIGHINT%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIGHINT%',$this->aesL->getMain('restorefromconfig_hint'),$html);if((strpos($html,'%BACKUPVALUES_URL%'))!==false) $html=str_replace('%BACKUPVALUES_URL%',$this->aesC->gtTy($wTask,'url',''),$html);$html=str_replace('%VALUES_URL%',$this->aesC->gtTy($wTask,'url',''),$html);if((strpos($html,'%BACKUPVALUES_QUERYSTRING%'))!==false) $html=str_replace('%BACKUPVALUES_QUERYSTRING%',$this->aesC->gtTy($wTask,'querystring',''),$html);$html=str_replace('%VALUES_QUERYSTRING%',$this->aesC->gtTy($wTask,'querystring',''),$html);
return $html;} public function Option16_BlockURLS($wTask,$value=null){
$lUA=$this->aeSt->spts($wTask,'language');
$code=$this->aeSt->spts($wTask,'filename');
$code=file_get_contents(self::$SnippetsPath.$code, FILE_USE_INCLUDE_PATH);
$tag=$this->aeSt->spts($wTask,'tag');
$lines='';
$block_url=aecFt::gRvl($param='edt'.$wTask.'_url',$default='---',$maxlen=0,$type='string',$method='POST');
$block_url=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$block_url);if(($block_url=='---')&&($this->aesC->dbu()===true)) $block_url=aecFt::gRvl($param='edt'.$wTask.'_url',$default='---',$maxlen=0,$type='string',$method='GET');if($block_url=='---') $block_url=trim(trim($this->aesC->gtTy($wTask,'url',''),PHP_EOL));
$block_query=aecFt::gRvl($param='edt'.$wTask.'_querystring',$default='---',$maxlen=0,$type='string',$method='POST');
$block_query=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$block_query);if(($block_query=='---')&&($this->aesC->dbu()===true)) $block_query=aecFt::gRvl($param='edt'.$wTask.'_querystring',$default='---',$maxlen=0,$type='string',$method='GET');if($block_query=='---') $block_query=trim(trim($this->aesC->gtTy($wTask,'querystring',''),PHP_EOL));
$block_url=str_replace('\\\\','\\',$block_url);
$block_query=str_replace('\\\\','\\',$block_query);$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'url',trim($block_url));$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'querystring',trim($block_query));if(trim($block_url)!=''){
if(trim($block_url)!=''){
$arr=explode(PHP_EOL,$block_url);
$j=count($arr);
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;
$lines.='RewriteCond %{REQUEST_URI} '.rtrim($arr[$i],"\r\n\t").' [NC,OR]'.PHP_EOL;}}}
if(trim($block_query)!=''){
if(trim($block_query)!=''){
$arr=explode(PHP_EOL,$block_query);
$j=count($arr);
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;
$lines.= 'RewriteCond %{QUERY_STRING} '.rtrim($arr[$i],"\r\n\t").' [NC,OR]'.PHP_EOL;}}}
if((trim($block_url)=='')&&(trim($block_query)=='')){
$code='';$return=$this->aesL->getMain('feature_disabled');} else{
$lines=rtrim($lines, '[NC,OR]'.PHP_EOL).'[NC]'.PHP_EOL;
$code=str_replace('%LINES%',$lines,$code);if($this->aeSt->Website()!='/'){
$code=str_replace('%AESECURE_SITEROOT%',rtrim($this->aeSt->Website(),'/').'/',$code);} else{
$code=str_replace('%AESECURE_SITEROOT%','',$code);}
$return=$return=$this->aesL->getMain('feature_enabled');}
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$aeSu->eShtc('#'.$tag,$code, '', null);
unset($aeSu);
return $return;} public function Option19_PutOffLine($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$action=aecFt::gRvl($param='a',$default='1',$maxlen=1,$type='bool');$this->aesD->log('Task '.$wTask.' - Updating state to '.($action==1?'offline':'online'));
try{
$fname=$this->aeSt->siOt().'/configuration.php';if(file_exists($fname)&&is_readable($fname)){
list($release,$version)=$aeSu->Option41_getJoomlaVersion();if(trim($release)!=''){
if($action==1){
$arr=array(array('search'=>"/offline = '(?!1)'/",'replace'=>"offline = '1'"));} else{
$arr=array(array('search'=>"/offline = '(?!0)'/",'replace'=>"offline = '0'"));}
$aeSu->uJCfg($arr);} }} catch (Exception $e){} return $aeSu->eDFcy(array('id'=>$wTask));
unset($aeSu);}} public function Option21_limitIP($wTask,$value=null){
$html='';if($this->aesC->mo()==false){
$IPs=trim(aecFt::gRvl($param='ips',$default='',$maxlen=5000,$type='string',$method='POST'));if(trim($IPs)=='') $IPs=trim(aecFt::gRvl($param='ips',$default='',$maxlen=5000,$type='string',$method='GET'));
$IPs=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$IPs);if(trim($IPs)!=''){
$IPs=str_replace(',',';',str_replace(PHP_EOL,';',$IPs));
$IPs==preg_replace("/[^0-9.;\/]/","",$IPs);}
$cty=aecFt::gRvl($param='folder',$default='',$maxlen=50,$type='string',$method='POST');if($cty==null) $cty=aecFt::gRvl($param='folder',$default='',$maxlen=50,$type='string',$method='GET');if(trim($cty)!=''){
$cty='/'.ltrim($cty,'/');require_once (dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$setup=aeCtu::getInstance();if(is_dir($this->aeSt->siOt().$cty)){
$html='<h3>'.$this->aesL->Option21_getProtectFolderIp('restrict').'</h3><ul>';
$target=$this->aeSt->siOt().$cty.'/.htaccess';if((!file_exists($target))||(file_exists($target)&&is_readable($target))){
$htaccess=(file_exists($target)?file_get_contents($target, FILE_USE_INCLUDE_PATH):'');
$block=aecFt::isTRls($htaccess, '#AESECURE_IPRESTRICT');$this->aesC->sWLedi($cty,$IPs);if(trim($IPs)==''){
$code='#AESECURE_IPRESTRICT_START'.PHP_EOL.'#AESECURE_IPRESTRICT_END';
$msg=$this->aesL->Option21_getProtectFolderIp('removed');$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'','false');} else{
$code=$this->aeSt->spts($wTask,'filename');
$code=file_get_contents(self::$SnippetsPath.$code, FILE_USE_INCLUDE_PATH);
$IPs=rtrim($IPs,';');
$arr=explode(';',$IPs);
$j=count($arr);
$tmp='';
$lines='';
for ($i=0;$i<$j;$i++){
$tmp.=$arr[$i].' ';if(($i % 10)==9){ $lines.='Allow from '.rtrim($tmp,' ').''.PHP_EOL;
$tmp='';}}
if(trim($tmp)!='') $lines.='Allow from '.rtrim($tmp,' ').''.PHP_EOL;
$code=str_replace('%LINES%',rtrim($lines,PHP_EOL),$code);
$code='#AESECURE_IPRESTRICT_START'.PHP_EOL.$code.PHP_EOL.'#AESECURE_IPRESTRICT_END';
$msg = sprintf($this->aesL->Option21_getProtectFolderIp('done'),$cty,$IPs);$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'','true');}
if(trim($block)==''){
$htaccess=rtrim($htaccess, PHP_EOL).PHP_EOL.PHP_EOL.$code;} else{
$htaccess=str_replace($block,$code,$htaccess);}
$html.=$setup->upfle($htaccess,$target);$html.='<li>'.$msg.'&nbsp;'.aecFt::feck('success').'</li>';}
if(trim($IPs)!==''){
$html='<pre>'.$html.'</ul></pre>';} else{
$html=sprintf($this->aesL->getMain('unprotected'),$cty);}} else{
$html=aecFt::feck('danger',sprintf($this->aesL->gRrs('siteroot_foldernotfound'),$cty));}} else{
$html=aecFt::feck('danger',sprintf($this->aesL->gRrs('invalid_params')));}} return $html;} public function Option2199_getWhiteListedIP($wTask,$value=null){
$cty=rtrim(aecFt::gRvl($param='folder',$default='',$maxlen=50,$type='string',$method='POST'));if(trim($cty)!==''){
return $this->aesC->getWhiteListedIP($cty,''); } else{
return ''; } } public function Option21_getProtectFolderIp($action,$tmpl_html){
$allowed_ip = '';
$tmpl_html=aecFt::rphl('%VALUES%',$allowed_ip,$tmpl_html);
return $tmpl_html;} public function Option24_BlockFileUpload($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
$action=aecFt::gRvl($param='a',$default=NULL,$maxlen=1,$type='int',$method='POST');
$action=aecFt::gRvl($param='a',$default='0',$maxlen=1,$type='int');if($action!=1) $action=0;require_once (dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=new aeCtu(null);
$msg=$aeSu->etPni('file_uploads',($action==0)?'on':'off');$return=$aeSu->eDFcy(array('id'=>'24','extra_msg'=>$msg));
unset($aeSu);
return $return;}} public function Option25_Index($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$bReturn=$aeSu->eDFcy(array('id'=>$wTask));
unset($aeSu);
return $bReturn;}}   public function Option27_Robots($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$bReturn=$aeSu->eDFcy(array('id'=>$wTask));
unset($aeSu);
return $bReturn;}} public function Option28_getTabBlockUserAgent($action,$html){
$this->aesD->log('Task '.$action.' - Showing');
$target=$this->aeSt->siOt().'/.htaccess';$this->aesD->log('File:'.$target);if(file_exists($target)){
$htaccess=file_get_contents($target, FILE_USE_INCLUDE_PATH);
$tag=$this->aeSt->spts($action,'tag');$value=$this->aesC->gtTy(substr($action,0,1).'.'.substr($action,-1),'');
$type=$this->aeSt->spts($action,'type');
$lUA=$this->aeSt->spts($action,'language');$html=aecFt::rphl('%ID%',$action,$html);$html=aecFt::rphl('%EXPLAIN%',$this->aesL->$lUA('explain'),$html);$html=aecFt::rphl('%PLACEHOLDER%',$this->aesL->$lUA('placeholder'),$html);$html=aecFt::rphl('%SAVEDMSG%', str_replace("'", "\'",$this->aesL->$lUA('saved')),$html);$html=str_replace('%VALUES%',$value,$html);if((strpos($html,'%BACKUPVALUES%'))!==false){
$html=str_replace('%BACKUPVALUES%',$this->aesC->gtTy($action),$html);}
if((strpos($html,'%RESTOREFROMCONFIG%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIG%',$this->aesL->getMain('restorefromconfig'),$html);if((strpos($html,'%RESTOREFROMCONFIGHINT%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIGHINT%',$this->aesL->getMain('restorefromconfig_hint'),$html);} else{
$html=aecFt::feck('failure').sprintf($this->aesL->gRrs('filenotfound'),str_replace('/',DIRECTORY_SEPARATOR,$target));} return $html;} public function Option28_BlockUserAgent($wTask,$value=null){
$this->aesD->log('Task '.$wTask.' - Submitting');
$tag=$this->aeSt->spts($wTask,'tag');
$lUA=$this->aeSt->spts($wTask,'language');
$code=$this->aeSt->spts($wTask,'filename');
$code=file_get_contents(self::$SnippetsPath.$code, FILE_USE_INCLUDE_PATH);if($value===null){
$useragents=aecFt::gRvl($param='edt'.$wTask,$default='',$maxlen=0,$type='string',$method='POST');} else{
$this->aesD->log('Task '.$wTask.' - Value taken from the $value function parameter; not from posted data');
$useragents=$value;}
$useragents=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$useragents);$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'',$useragents);if(trim($useragents)!=''){
$lines='';if(trim($useragents)!=''){
$arr=explode(PHP_EOL,$useragents);
$j=count($arr);
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;
$useragent=html_entity_decode($arr[$i]);
$useragent='"'.rtrim(ltrim(trim($useragent),'"'),'"').'"';
$lines.=' RewriteCond %{HTTP_USER_AGENT} '.$useragent.' [NC,OR]'.PHP_EOL;} }
$lines=rtrim(ltrim($lines), '[NC,OR]'.PHP_EOL).'[NC]'.PHP_EOL;
$code=str_replace('%LINES%',$lines,$code);} else{
$code='';}
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$setup=aeCtu::getInstance();$html=$setup->eShtc('#'.$tag,$code,'','/.htaccess');
unset($setup);
return $html;} public function Option29_getTabBlockReferrer($action,$html){
$this->aesD->log('Task '.$action.' - Showing');
$target=$this->aeSt->siOt().'/.htaccess';$this->aesD->log('File:'.$target);if(file_exists($target)){
$htaccess=file_get_contents($target, FILE_USE_INCLUDE_PATH);
$tag=$this->aeSt->spts($action,'tag');$value=$this->aesC->gtTy(substr($action,0,1).'.'.substr($action,-1),'');$value=str_replace('\.','.',$value);
$type=$this->aeSt->spts($action,'type');
$lUA=$this->aeSt->spts($action,'language');$html=aecFt::rphl('%ID%',$action,$html);$html=aecFt::rphl('%PLACEHOLDER%',$this->aesL->$lUA('placeholder'),$html);$html=aecFt::rphl('%EXPLAIN%',$this->aesL->$lUA('explain'),$html);$html=aecFt::rphl('%SAVEDMSG%', str_replace("'", "\'",$this->aesL->$lUA('saved')),$html);$html=str_replace('%VALUES%',$value,$html);if((strpos($html,'%BACKUPVALUES%'))!==false){
$html=str_replace('%BACKUPVALUES%',$this->aesC->gtTy($action),$html);}
if((strpos($html,'%RESTOREFROMCONFIG%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIG%',$this->aesL->getMain('restorefromconfig'),$html);if((strpos($html,'%RESTOREFROMCONFIGHINT%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIGHINT%',$this->aesL->getMain('restorefromconfig_hint'),$html);} else{
$html=aecFt::feck('failure').sprintf($this->aesL->gRrs('filenotfound'),str_replace('/',DIRECTORY_SEPARATOR,$target));} return $html;} public function Option29_BlockReferrer($wTask,$value=null){
$tag=$this->aeSt->spts($wTask,'tag');
$lUA=$this->aeSt->spts($wTask,'language');
$code=$this->aeSt->spts($wTask,'filename');
$code=file_get_contents(self::$SnippetsPath.$code, FILE_USE_INCLUDE_PATH);$this->aesD->log('Task '.$wTask.' - Submitting');if($value===null){
$referrer=aecFt::gRvl($param='edt'.$wTask,$default='',$maxlen=0,$type='string',$method='POST');} else{
$this->aesD->log('Task '.$wTask.' - Value taken from the $value function parameter; not from posted data');
$referrer=$value;}
$referrer=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$referrer);$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'',$referrer);
$lines='';if(trim($referrer)!=''){
$arr=explode(PHP_EOL,$referrer);
$j=count($arr);
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;
$referrer=html_entity_decode($arr[$i]);
$referrer=rtrim(ltrim(trim($referrer),'"'),'"');
$referrer=str_replace('\.','§',$referrer);
$referrer=str_replace('.','§',$referrer);
$referrer=str_replace('§','\.',$referrer);
$lines.=' RewriteCond %{HTTP_REFERER} '.$referrer.' [NC,OR]'.PHP_EOL;} }
if(trim($lines)!=''){
$lines=rtrim(ltrim($lines), '[NC,OR]'.PHP_EOL).'[NC]'.PHP_EOL;
$code=str_replace('%LINES%',$lines,$code);} else{
$code='';}
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$setup=aeCtu::getInstance();$html=$setup->eShtc('#'.$tag,$code,'','/.htaccess');
unset($setup);
return $html;} public function Option31_getTabProtectFilesFolders($action,$tmpl_html){
$lUA=$this->aeSt->spts($action,'language');$html='<div style="font-size:0.8em;" class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'.'<div class="row " >'.'<div class="col-md-6">'.$this->aesL->$lUA('chmodinfo_group').'</div>'.'<div class="col-md-5">'.$this->aesL->$lUA('chmodinfo_sec').'</div>'.'</div>'.$this->aesL->$lUA('chmodinfo').'<br/><br/>'.
$this->aesL->$lUA('chmodinfo_best').'<br/>'.
$this->aesL->$lUA('chmodinfo_min').'<br/><br/>'.$this->aesL->$lUA('chmodinfo_na').
'</div>';$folder=str_replace('§','.',aecFt::gRvl($param='f',$default='',$maxlen=50,$type='string',$where='POST'));
$dir=rtrim($this->aeSt->siOt().'/'.$this->aesS->get('foldername',''),'/').'/';
$url=rtrim($this->aeSt->siUl().'/'.$this->aesS->get('foldername',''),'/').'/';if(trim($folder)!=''){
if($folder!='..'){
$dir.=$folder.'/';$this->aesS->set('foldername', rtrim($this->aesS->get('foldername',''),'/').'/'.$folder.'/');} else{
$dir=dirname(rtrim($dir,'/'));$this->aesS->set('foldername', rtrim(ltrim(str_replace($this->aeSt->siOt(),'',$dir),'/'),'/'));}} else{}
$dir=str_replace('//','/',$dir);
$relativeFolder=str_replace($this->aeSt->siOt(), '',$dir);
$arr=aecFt::directoryToArray($cty=$dir,$recursive = false,
$listDirs=true,$listFiles=true,$arrIgnore = array('.'));
$download='<input type="hidden" name="download_weburl" value="premium/helpers/download.php?'.
($this->aesC->mo()?'':$this->aesC->get('key')).'&file='.$relativeFolder.'" />';$html.='<div class="chmodroot">'.str_replace('/',DIRECTORY_SEPARATOR,$dir).'</div>'.'<div class="chmodtoolbar btn-group">'.'<button id="chmodfilesfoldersmakezip" type="button" class="glyphicon glyphicon-download-alt" '.'data-toggle="popover" data-content="'.$this->aesL->$lUA('makezip_hint').'"></button>'.
$download.
'</div>';$html.='<table id="chmodfilesfolders" class="tablesorter">'.'<thead><tr><th class="chmodfiles_icon">&nbsp;</th><th class="chmodfiles_name">File</th>';
$arrChmod=array('400','440','444','500','555','604','640','644','666','750','755','777');foreach ($arrChmod as $value){
$html.='<th class="chmodfiles_perm">'.$value.'</th>';}
$html.='<th class="chmodfiles_result">&nbsp;</th></tr></thead><tbody>';
$tr='<tr id="chmod%OPTNAME%">
				<td class="chmodfiles_icon"><span class="glyphicon glyphicon-%TYPE%"></span>&nbsp;%KILLFILE%&nbsp;%DOWNLOAD%&nbsp;%VIEWFILE%</td>
<td class="chmod%OPTNAME%">%NAME%<input type="hidden" size="3" name="chmod%OPTNAME%_current" value="%OPTNAME_CURRENT%"/>'.'<input type="hidden" size="1" name="chmod%OPTNAME%_confirm" value="%OPTNAME_CONFIRM%"/>%MSG%</td>';foreach ($arrChmod as $value){
$tr.='<td class="chmodfiles_perm chmod'.$value.' %BEST'.$value.'% %MIN'.$value.'%" '.($value=='777'?'%STYLE777%':'').'>'.'<input title="'.$value.'" type="radio" name="chmod%OPTNAME%" id="chmod%OPTNAME%_'.$value.'" value="'.$value.'" %'.$value.'%/></td>';}
$tr.='<td id="chmod%OPTNAME%_result">&nbsp;</td></tr>';
$arrBestChmod=$this->aeSt->get('best_chmod');
$arrDefaultChmod=$this->aeSt->get('default_chmod');foreach ($arr as $entry){
if(($dir==$this->aeSt->siOt())&&($entry['name']=='..')) continue;
$url=rtrim($this->aesS->get('foldername',''),'/').'/'.$entry['name'];
$download='<input type="hidden" name="download_url_'.str_replace('.','§',$entry['name']).'" value="premium/helpers/download.php?'.($this->aesC->mo()?'':$this->aesC->get('key')).'&file='.$url.'" />';
$bViewIcon=false;if($entry['type']=='file'){
$fileext='.'.pathinfo($entry['name'], PATHINFO_EXTENSION);if(in_array($fileext, self::$arrText)||in_array($fileext, self::$arrImages)) $bViewIcon=true;}
$tmp=aecFt::rphl('%KILLFILE%',($entry['type']=='file'?'<span style="cursor:pointer" class="text-danger glyphicon glyphicon-remove" id="kill%OPTNAME%" title="'.$this->aesL->$lUA('killfile').'"></span>':''),$tr);
$tmp=aecFt::rphl('%DOWNLOAD%','<span style="cursor:pointer" class="text-info glyphicon glyphicon-download" id="download%OPTNAME%" title="'.$this->aesL->getMain('downloadfile').'"></span>',$tmp);
$tmp=aecFt::rphl('%VIEWFILE%',($bViewIcon?'<span style="cursor:pointer" class="text-info glyphicon glyphicon-eye-open" id="view%OPTNAME%" title="'.$this->aesL->$lUA('seefile').'"></span>':''),$tmp);
$tmp=aecFt::rphl('%OPTNAME%',str_replace('.','§',$entry['name']),$tmp);
$name=$entry['name'];
$name='<span class="'.($entry['type']=='folder'?'chmodaefolder':'chmodaefile').'" '.
($entry['type']=='folder'?'id="aefolder_'.$name.'"':'').'>'.$name.$download.'<span>';
$tmp=aecFt::rphl('%NAME%',$name,$tmp);
$tmp=aecFt::rphl('%TYPE%',($entry['type']=='folder'?'folder-close':'file'),$tmp);
$msg='';if(array_key_exists($entry['name'],$arrBestChmod)){
if(array_key_exists('msg',$arrBestChmod[$entry['name']])){
$msg=str_replace('"','\"',$this->aesL->$lUA($arrBestChmod[$entry['name']]['msg']));
$msg='&nbsp;<span class="label label-info" data-toggle="popover" data-content="<span class=\'text-info\'>'.$msg.'</span>">?</span>';}}
$tmp=str_replace('%MSG%',$msg,$tmp);
$confirm=false;if(array_key_exists($entry['name'],$arrBestChmod)){
if(array_key_exists('confirm',$arrBestChmod[$entry['name']])){
$confirm=($arrBestChmod[$entry['name']]['confirm']=='true'?true:false);}}
$tmp=aecFt::rphl('%OPTNAME_CONFIRM%',($confirm==true?'1':'0'),$tmp);
$chmod=substr(sprintf('%o', fileperms($dir.'/'.$entry['name'])),-3);
$tmp=aecFt::rphl('%OPTNAME_CURRENT%',$chmod,$tmp);if(array_key_exists($entry['name'],$arrBestChmod)){
$best=0;$min=0;if(array_key_exists('best',$arrBestChmod[$entry['name']])) $best=$arrBestChmod[$entry['name']]['best'];if(array_key_exists('min',$arrBestChmod[$entry['name']])) $min=$arrBestChmod[$entry['name']]['min'];if(($best!=0)&&($min!=0)){
if($best!=$min){
$tmp=str_replace('%BEST'.$best.'%','chmodbest',$tmp);
$tmp=str_replace('%MIN'.$min.'%','chmodmin',$tmp);} else{
$tmp=str_replace('%BEST'.$best.'%','chmodbestmin',$tmp);}}} else{
$best=$arrDefaultChmod[$entry['type']];
$tmp=str_replace('%BEST'.$best.'%','chmodbest',$tmp);}
foreach ($arrChmod as $value){
if($chmod==$value) $tmp=str_replace('%'.$value.'','checked="checked"',$tmp);if($value=='777') $tmp=str_replace('%STYLE777%',($chmod=='777'?'style="background-color:red;" title="'.$this->aesL->$lUA('chmod777').'"':''),$tmp);
$tmp=aecFt::rphl('%MIN'.$value.'%','',$tmp);
$tmp=aecFt::rphl('%BEST'.$value.'%','',$tmp);
$tmp=aecFt::rphl('%BEST'.$value.'TIP%','',$tmp);
$tmp=aecFt::rphl('%MIN'.$value.'TIP%','',$tmp);
$tmp=aecFt::rphl('%'.$value.'%','',$tmp);}
$html.=$tmp;}
$html.='';$html.='</tbody></table>';$html=aecFt::rphl('%PROTECTHTML%',$html,$tmpl_html);
return $html;} public function Option31_ManageFilesFolders($wTask,$value=null){
$html='';
$kill=aecFt::gRvl($param='k',$default='0', null,$type='bool',$where='POST');
$view=aecFt::gRvl($param='v',$default='0', null,$type='bool',$where='POST');$file=str_replace('§','.',aecFt::gRvl($param='f',$default='',$maxlen=50,$type='string',$where='POST'));
$dir=rtrim($this->aeSt->siOt(),'/').'/'.$this->aesS->get('foldername','');
$perm=aecFt::gRvl($param='c',$default='',$maxlen=3,$type='int',$where='POST');if($this->aesC->mo()==false){
$target=str_replace('//','/',$dir.'/'.ltrim($file,'/'));  $target=str_replace('/',DIRECTORY_SEPARATOR,$target);if($kill===true){
try{
if(is_file($target)&&is_writable($target)){
unlink($target);$html=sprintf($this->aesL->Option31_getPermissions('file_removed'),$target);} else{
$html=sprintf($this->aesL->gRrs('cantkill'),$target);}} catch (Exception $e){
$html=sprintf($this->aesL->gRrs('cantkill'),$target);$this->aesD->log('Impossible to kill file '.$target.' - '.$e->getMessage());}} elseif($view===true){
if(is_file($target)){
$format=aecFt::gRvl($param='format',$default=NULL,$maxlen=4,$type='string',$where='POST');if(($format=='text')||(in_array('.'.pathinfo($target, PATHINFO_EXTENSION), self::$arrText))){
$html=self::Geshi($task='',$filename=$target,$content='',$format=$format);} else if(in_array('.'.pathinfo($target, PATHINFO_EXTENSION), self::$arrImages)){
$img=str_replace($this->aeSt->siOt().DIRECTORY_SEPARATOR,$this->aeSt->siUl(),$target);
$img=str_replace(DIRECTORY_SEPARATOR,'/',$img);$html='<img src="'.$img.'" title="'.$img.'"/>';} else{
$html='Unsupported file '.$target;}} else{
$html='Missing file ['.$target.']';}} else{
if($perm!=0){
if(file_exists($target)){
$this->aesD->alDg($msg=__METHOD__.' - Change chmod of '.$target.' to '.$perm);if(chmod($target, octdec($perm))){
$html=aecFt::feck('success'); } else{
$html=aecFt::feck('failure').sprintf($this->$span_error,$file).sprintf($this->$span_error,$perm);}} else{
$html=aecFt::feck('failure').sprintf($this->aesL->gRrs('filenotfound'),str_replace('/',DIRECTORY_SEPARATOR,$file));}}}} else{
$html='&nbsp;<span class="label label-info">'.$this->aesL->getMain('demo').'</span>';} return $html;} public function Option41_getJVersion($wTask,$value=null){
$html='';
$Joomla=$this->aeSt->get("joomla");
$files=$Joomla['version']['files'];
$currentver='';
$version='';foreach ($files as $file){
$filename=$this->aeSt->siOt().$file;if(file_exists($filename)){
$root=$this->aeSt->siOt();if(!defined('DS')) define('_JEXEC',1);if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);if(!defined('JPATH_BASE')) define('JPATH_BASE',$root);if(!defined('JPATH_PLATFORM')) define('JPATH_PLATFORM',$root.DS.'libraries');if(file_exists(JPATH_BASE.'/includes/defines.php')) JPATH_BASE.'/includes/defines.php';if(file_exists(JPATH_BASE.'/includes/framework.php')) JPATH_BASE.'/includes/framework.php';if(file_exists(JPATH_BASE.'/libraries/joomla/factory.php')) JPATH_BASE.'/libraries/joomla/factory.php';require_once ($filename);
$jver=new JVersion();
$currentver=$jver->getShortVersion();
$version=$jver->getLongVersion();
unset($jver);break;}} return array($currentver,$version);} public function Option41_checkJVersion($wTask){
$html='';if(($wTask==2)&&($this->aesC->get('cms','autocheck',false)!==true)) return;if(!(aecFt::iJaSt($this->aeSt->siOt()))) return;
list($currentver,$version)=self::Option41_getJVersion($wTask);
$old=false;if(trim($version)!=''){
if(!defined('_JEXEC')) define('_JEXEC',1);
$updater=$this->aeSt->siOt().'/libraries/joomla/updater/update.php';
$msg='';if(file_exists($updater)){
$root=$this->aeSt->siOt();if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);if(!defined('JPATH_BASE')) define('JPATH_BASE',$root);if(!defined('JPATH_PLATFORM')) define('JPATH_PLATFORM',$root.DS.'libraries');require_once  JPATH_BASE.'/includes/defines.php';require_once  JPATH_BASE.'/includes/framework.php';require_once (JPATH_BASE.'/libraries/joomla/factory.php');require_once ($updater);
$update = new JUpdate;
try{
$Joomla=$this->aeSt->get("joomla");
@$update->loadFromXML($Joomla['version']['xml']);} catch (Exception $e){
$update=null;}
if(($update)&&(is_object($update))){
try{
$newver=@$update->get('version','')->_data;} catch (Exception $e){
$newver='unknown';}
if($newver!='unknown'){
$old=(version_compare($currentver,$newver)===-1);if($old==0){
$msg='<li><span class="glyphicon glyphicon-star"></span>&nbsp;'.
sprintf($this->aesL->Option41_getJoomlaVersion('youvethelast'),$currentver).'</li>';} else{
$msg='<li><span class="glyphicon glyphicon-star"></span>&nbsp;'.
sprintf($this->aesL->Option41_getJoomlaVersion('current'),$version).'</li>';
$msg.='<li><span class="glyphicon glyphicon-star"></span>&nbsp;'.
sprintf($this->aesL->Option41_getJoomlaVersion('updated'),$newver).'</li>';if($old){
$url=trim($update->get('downloadurl', false)->_data);
$url=aecFt::link($url,$url,'target="_blank"');
$msg.='<li><span class="glyphicon glyphicon-star"></span>&nbsp;'.
sprintf($this->aesL->Option41_getJoomlaVersion('url_package'),$url).'</li>';} }} else{
$msg='<li><span class="glyphicon glyphicon-star-empty"></span>&nbsp;'.
sprintf($this->aesL->Option41_getJoomlaVersion('unknown'),$currentver).'</li>';}}
unset ($update);}
$template=aecFt::gRvl($param='tmpl',$default='1',$maxlen=1,$type='bool');if($template!=0) $template=1;if($template==1){
$html=file_get_contents(self::$tlttH.'joomlaver.default.aec', FILE_USE_INCLUDE_PATH);if($old) $html=str_replace('alert-success','alert-danger',$html);$html=str_replace('%JOOMLAVER%',$msg,$html);} else{
$html=$msg;}} else{
$html=aecFt::feck('failure',$this->aesL->gRrs('impossible_check_jversion'));}
if(trim($html)!='')$html='<ul class="list-unstyled">'.$html.'</ul>';
return $html;} public function Option44_getTabBlockComponents($wTask,$html){
try{
$fname=$this->aeSt->siOt().'/configuration.php';
$iJaSt=(is_file($fname)&&is_readable($fname));if(!$iJaSt) return aecFt::feck('info',$this->aesL->getMain('not_joomla'));} catch (Exception $e){}
$tag=$this->aeSt->spts($wTask,'tag');if((strpos($html,'%BACKUPVALUES%'))!==false){
if(trim($this->aesC->get(strtolower($tag)))!=''){
$data=$this->aesC->get(strtolower($tag));$this->aesC->Sfcy(substr($action,0,1).'.'.substr($action,-1),'',$data);}
$html=str_replace('%BACKUPVALUES%',$this->aesC->gtTy($wTask),$html);}
if((strpos($html,'%RESTOREFROMCONFIG%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIG%',$this->aesL->getMain('restorefromconfig'),$html);if((strpos($html,'%RESTOREFROMCONFIGHINT%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIGHINT%',$this->aesL->getMain('restorefromconfig_hint'),$html);
$lUA=$this->aeSt->spts($wTask,'language');$html=str_replace('%VALUES%',$this->aesC->gtTy($wTask),$html);$html=str_replace('%EXPLAIN%',$this->aesL->$lUA('explain'),$html);$html=aecFt::rphl('%PLACEHOLDER%',$this->aesL->$lUA('placeholder'),$html);
return $html;} public function Option44_BlockJoomlaComponents($wTask,$value=null){
$lUA=$this->aeSt->spts($wTask,'language');
$code=$this->aeSt->spts($wTask,'filename');
$code=file_get_contents(self::$SnippetsPath.$code, FILE_USE_INCLUDE_PATH);
$tag=$this->aeSt->spts($wTask,'tag');if($value==null){
$comps=trim(trim(aecFt::gRvl($param='edt'.$wTask,$default='',$maxlen=0,$type='string',$method='POST'),' '),PHP_EOL);} else{
$this->aesD->log('Task '.$wTask.' - Value taken from the $value function parameter; not from posted data');
$comps=$value;}
$comps=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$comps);if((trim($comps)==='')&&($this->aesC->dbu()===true)) $comps=aecFt::gRvl($param='edt'.$wTask,$default='',$maxlen=0,$type='string',$method='GET');if(trim($comps)!=''){
$comps = preg_replace('/[ ;,|]+/', ';',$comps);
$comps=rtrim($comps,';');
$arr=explode(';',$comps);
$j=count($arr);
$tmpComponents='';
$tmpModules='';
$tmp='';
$linesOptions='';
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;if(substr($arr[$i],0,4)=='com_'){
$tmpComponents.=$arr[$i].';';} else if(substr($arr[$i],0,4)=='mod_'){
$tmpModules.=$arr[$i].';';}}
$tmpComponents=rtrim($tmpComponents,';');
$tmpModules=rtrim($tmpModules,';');
$linesSEF='';if(trim($tmpComponents)!=''){
$arr=explode(';',$tmpComponents);
$j=count($arr);
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;
$tmp.=$arr[$i].'|';if(($i % 5)==4){
$linesOptions.=' RewriteCond %{QUERY_STRING} option=('.rtrim($tmp,"|\r\n\t").')&(.*)$ [NC,OR]'.PHP_EOL;
$tmp='';}}
if(trim($tmp)!=''){
$linesOptions.=' RewriteCond %{QUERY_STRING} option=('.rtrim($tmp,"|\r\n\t").')&(.*)$ [NC,OR]'.PHP_EOL;}
$linesSEF='';
$tmp='';
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;
$tmp.=$arr[$i].'|';if(($i % 5)==4){
$linesSEF.=' RewriteCond %{REQUEST_URI} /components/('.rtrim($tmp,"|\r\n\t").')\/(.*)$ [NC,OR]'.PHP_EOL;
$tmp='';}}
if(trim($tmp)!=''){
$linesSEF.=' RewriteCond %{REQUEST_URI} /components/('.rtrim($tmp,"|\r\n\t").')\/(.*)$ [NC,OR]'.PHP_EOL;}}
if(trim($tmpModules)!=''){
$arr=explode(';',$tmpModules);
$j=count($arr);
$tmp='';
for ($i=0;$i<$j;$i++){
if(trim($arr[$i])=='') continue;
$tmp.=$arr[$i].'|';if(($i % 5)==4){
$linesSEF.=' RewriteCond %{REQUEST_URI} /modules/('.rtrim($tmp,"|\r\n\t").')\/(.*)$ [NC,OR]'.PHP_EOL;
$tmp='';}}
if(trim($tmp)!=''){
$linesSEF.=' RewriteCond %{REQUEST_URI} /modules/('.rtrim($tmp,"|\r\n\t").')\/(.*)$ [NC,OR]'.PHP_EOL;}}
$linesSEF=rtrim($linesSEF, '[NC,OR]'.PHP_EOL).'[NC]'.PHP_EOL;
$lines=$linesOptions.$linesSEF;
$code=str_replace('%LINES%',$lines,$code);if($this->aeSt->Website()!='/'){
$code=str_replace('%AESECURE_SITEROOT%',rtrim($this->aeSt->Website(),'/').'/',$code);} else{
$code=str_replace('%AESECURE_SITEROOT%','',$code);}
$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'',$comps);} else{
$code='';$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'','');}
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$setup=aeCtu::getInstance();
$setup->eShtc('#'.$tag,$code, '', null);
unset($setup);
return ($comps==''?$this->aesL->getMain('feature_disabled'):sprintf($this->aesL->$lUA('blocked'),str_replace(';',', ',$comps)));} public function Option45_checkDBAdmin($action,$value=null){
if($this->aesC->mo()===true){
return $this->aesL->getMain('hiddenindemo');} elseif(!(aecFt::iJaSt($this->aeSt->siOt()))){
return '<span class="error">'.$this->aesL->getMain('not_joomla').'</span>';} else{
$lUA=$this->aeSt->spts($action,'language');
$adminDbLogin=rtrim(aecFt::gRvl($param='login',$default='',$maxlen=50,$type='string',$method='POST'));$html='';if(trim($adminDbLogin)!=''){
$dbhost=$this->aesC->get('db','host');
$dbuser=$this->aesC->get('db','user');
try{
if($this->aesC->dbu()===true) mysqli_report(MYSQLI_REPORT_ALL);
$mysqli = new mysqli($dbhost,$dbuser,$this->aesC->get('db','password'));if(!(mysqli_connect_errno())){
$mysqli->query("USE `".$this->aesC->get('db','name')."`");
$tablename=$this->aesC->get('db','prefix').'users';
$where='WHERE (`username`=\''.$mysqli->real_escape_string($adminDbLogin).'\') AND (`block`=0)';
$result = $mysqli->query('SELECT `id` FROM `'.$tablename.'` '.$where.';');
$i=0;if($result){
$accounts='(';
while ($row = mysqli_fetch_assoc($result)){
$i++;
$accounts.=$row['id'].' ,';}
$accounts=rtrim($accounts,' ,').')';}
if($i==0){
$html.=sprintf($this->aesL->$lUA('congrats'),$adminDbLogin);} else{
$html.=sprintf($this->aesL->$lUA('failure'),$adminDbLogin);}
$mysqli->close();
unset($mysqli);} else{
aecFt::SeAD(sprintf($this->aesL->gRrs('dberror'),mysqli_connect_errno()));}} catch (Exception $ex){
aecFt::SeAD(sprintf($this->aesL->gRrs('dberror'),$ex->getMessage()));}} else{
$html=$this->aesL->$lUA('nologinprovided');} return $html;}}  public function Option49_getTabJoomlaRedirection($action,$html){
if($this->aesC->mo()==true){
return 'This functionnality is disabled in the demo mode.';}
try{
$iJaSt=aecFt::iJaSt($this->aeSt->siOt());if(!$iJaSt) return aecFt::feck('info',$this->aesL->getMain('not_joomla'));} catch (Exception $e){}
$lUA=$this->aeSt->spts($action,'language');
$table='';
try{
$dbhost=$this->aesC->get('db','host');
$dbuser=$this->aesC->get('db','user');if((trim($dbhost)!='')&&(trim($dbuser)!='')){
mysqli_report(MYSQLI_REPORT_STRICT);
$mysqli = new mysqli($dbhost,$dbuser,$this->aesC->get('db','password'));if(!(mysqli_connect_errno())){
$mysqli->query("USE `".$this->aesC->get('db','name')."`");
$tablename=$this->aesC->get('db','prefix').'redirect_links';if($result = $mysqli->query("SHOW TABLES IN `".$this->aesC->get('db','name')."` LIKE '".$tablename."'")){
$wMax=250;
$sSQL='SELECT `id`, `old_url`, `hits`, `created_date`, `modified_date` FROM `'.$tablename.'` WHERE (coalesce(new_url,\'\')=\'\') ORDER BY Hits DESC LIMIT '.$wMax;
$result = $mysqli->query($sSQL);
$i=0;if($result){
while ($row = mysqli_fetch_assoc($result)){
$i++;
$table.='<tr id="row"'.$row['id'].'>'.'<td class="chk"><input type="checkbox" id="chkOldUrl_'.$row['id'].'"/></td>'.'<td class="id">'.$row['id'].'</td>'.'<td class="oldurl">'.aecFt::link($row['old_url'],$row['old_url'], 'title="'.str_replace("'", "\'",$this->aesL->$lUA('tryit')).'" target="_blank"').'</td>'.'<td class="hits">'.$row['hits'].'</td>'.'<td class="createddate">'.$row['created_date'].'</td>'.'<td class="nbr">'.$i.'</td></tr>';}
$html=str_replace('%MSGRECORDS%',($i==0?$this->aesL->$lUA('norecords'):sprintf($this->aesL->$lUA('onlyfirstrows'),$wMax)),$html);} else{
$html=str_replace('%MSGRECORDS%',$this->aesL->$lUA('tablenotfound'),$html);}}}
$mysqli->close();}} catch (Exception $ex){
$html=str_replace('%MSGRECORDS%','Connect failed '.$ex->getMessage(),$html);}
$html=str_replace('%MSGREMOVESELECTED%',str_replace('"', '\"',$this->aesL->$lUA('deleterows')),$html);$html=str_replace('%MSGREMOVEALL%',str_replace('"', '\"',$this->aesL->$lUA('truncatetable')),$html);$html=str_replace('%MSGCONFIRMDELETE%',str_replace('"', '\"',$this->aesL->$lUA('delete_confirm')),$html);$html=str_replace('%MSGCONFIRMTRUNCATE%',str_replace('"', '\"',$this->aesL->$lUA('truncatetable_confirm')),$html);$html=str_replace('%MSGINFORMATION%',str_replace('"', '\"',$this->aesL->getMain('information')),$html);$html=str_replace('%TITLEOLDURL%',str_replace('"', '\"',$this->aesL->$lUA('column_oldurl')),$html);$html=str_replace('%TITLEHITS%',str_replace('"', '\"',$this->aesL->$lUA('column_hits')),$html);
return str_replace('%TABLE%',$table,$html);} public function Option49_CleanJoomlaRedirectTable($wTask,$value=null){
$html='';$this->aesD->log('Task '.$wTask.' - Clean Joomla redirection table');if(!($this->aesC->mo())){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$setup=aeCtu::getInstance();
list($release,$version)=$setup->Option41_getJoomlaVersion();if((trim($release)!='')&&(version_compare($version,'1.7.','>='))){
$json=aecFt::gRvl($param='i',$default='',$maxlen=0,$type='string',$method='POST');
$json=str_ireplace('&#39;','"',str_ireplace('&#34;', '',$json));if(trim($json)!=''){
$arr=json_decode($json,true);if(key_exists('ids',$arr)){
$arr=$arr['ids'];
$dbhost=$this->aesC->get('db','host');
$dbuser=$this->aesC->get('db','user');if((trim($dbhost)!='')&&(trim($dbuser)!='')){
mysqli_report(MYSQLI_REPORT_STRICT);
$mysqli = new mysqli($dbhost,$dbuser,$this->aesC->get('db','password'));if(!(mysqli_connect_errno())){
$mysqli->query("USE `".$this->aesC->get('db','name')."`");
$lUA=$this->aeSt->spts($wTask,'language');
$sSQL='DELETE FROM `'.$this->aesC->get('db','prefix').'redirect_links` WHERE (id=%d);';foreach ($arr as $key){
if($key['id']==='all'){
$tmp='TRUNCATE TABLE `'.$this->aesC->get('db','prefix').'redirect_links`;';} else{
$tmp=sprintf($sSQL,$mysqli->real_escape_string($key['id']));}
$status = $mysqli->query($tmp);if($status){
$html.=sprintf($this->aesL->$lUA('deleted'),$key['id']).'<br/>';} else{
$html.=sprintf($this->aesL->$lUA('error_deleted'),$key['id']).'<br/>'.$sSQL;}}}}}}}
unset($setup);} else{
$html='This functionnality is not enabled during the demo mode.';} return $html;} public function Option51_BackupDB($action,$value=null){
if($this->aesC->mo()==true) return $this->aesL->getMain('hiddenindemo');
$lgFl = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.str_replace('/',DIRECTORY_SEPARATOR,$this->aesC->Log('folder'));if(!is_dir($lgFl)) $lgFl=dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'logs';$return=false;if($this->aesC->dbu()===true) mysqli_report(MYSQLI_REPORT_ALL);
$dbhost=$this->aesC->get('db','host');
$dbuser=$this->aesC->get('db','user');
try{
mysqli_report(MYSQLI_REPORT_OFF);
$mysqli = new mysqli($dbhost,$dbuser,$this->aesC->get('db','password'));if(!(mysqli_connect_errno())){
$mysqli->query("USE `".$this->aesC->get('db','name')."`");
$mysqli->query("SET NAMES 'utf8'");
$tables = array();
$sSQL = "SHOW TABLES FROM `".$this->aesC->get('db','name')."` LIKE '".$this->aesC->get('db','prefix')."%'";
$result = $mysqli->query($sSQL);
while($row = mysqli_fetch_array($result)) $tables[] = $row[0];if(($time = $_SERVER['REQUEST_TIME']) == '') $time = time();
$date = @date("Ymd-His",$time);$return="/*\n   http://www.aesecure.com - aeSecure, optimizing and securing your web Apache sites\n";$return.="   Website :".$this->aeSt->siUl()."\n";$return.="   Database:".$this->aesC->get('db','name')." (". @date("Y-m-d H:i:s",$time).")\n*/\n\n";$return.="SET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";\n";$return.="SET time_zone = \"+00:00\";\n";$return.="\n\n";
foreach($tables as $table){
$result = $mysqli->query('SELECT * FROM '.$table);
$num_fields = mysqli_num_fields($result);$return.='DROP TABLE '.$table.';';
$row2 = mysqli_fetch_row($mysqli->query('SHOW CREATE TABLE '.$table));$return.="\n\n".$row2[1].";\n\n";
for ($i = 0; $i < $num_fields; $i++){
while($row = mysqli_fetch_row($result)){
$return.='INSERT INTO '.$table.' VALUES(';
for($j=0; $j<$num_fields; $j++){
$row[$j] = addslashes($row[$j]);
$row[$j] = str_replace("\n","\\n",$row[$j]);if(isset($row[$j])){$return.='"'.$row[$j].'"' ;} else{$return.='""';}
if($j<($num_fields-1)){$return.=',';}}
$return.=");\n";}}
$return.="\n";}
$mysqli->close();
unset($mysqli);$file=rtrim($lgFl,'/').'/db-backup-'.$date.'-'.$this->aesC->get('db','name').'.sql';if((!file_exists($file)&&(is_writable(dirname($file))))||( is_writable($file)) ){
$handle = fopen($file,'w+');
fwrite($handle,$return);
fclose($handle);$return=$this->aeSt->siUl().'aesecure/premium/helpers/download.php?'.
($this->aesC->mo()?'':$this->aesC->get('key')).'&file='.aecFt::hPh($file).'&zip=1&kill=1';} else{
die('BackupDB - File not found '.$file);$return='';}}} catch (Exception $ex){
$return=aecFt::SeAD(sprintf($this->aesL->gRrs('dberror'),$ex->getMessage()));} return $return;} public function Option73_getTabManualEditRobots($action,$html){
$target=$this->aeSt->siOt().'/robots.txt';$this->aesD->log('File:'.$target);
$robots=(file_exists($target)?file_get_contents($target, FILE_USE_INCLUDE_PATH):'');
$type=$this->aeSt->spts($action,'type');
$lUA=$this->aeSt->spts($action,'language');$html=aecFt::rphl('%ID%',$action,$html);$html=aecFt::rphl('%EXPLAIN%',$this->aesL->$lUA('explain'),$html);$html=aecFt::rphl('%SAVEDMSG%', str_replace("'", "\'",$this->aesL->$lUA('saved')),$html);$html=str_replace('%VALUES%',$robots,$html);if((strpos($html,'%BACKUPVALUES%'))!==false) $html=str_replace('%BACKUPVALUES%',$this->aesC->gtTy($action),$html);if((strpos($html,'%RESTOREFROMCONFIG%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIG%',$this->aesL->getMain('restorefromconfig'),$html);if((strpos($html,'%RESTOREFROMCONFIGHINT%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIGHINT%',$this->aesL->getMain('restorefromconfig_hint'),$html);
return $html;} public function Option73_ManualEditRobots($wTask,$value=null){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$setup=aeCtu::getInstance();
$lines=aecFt::gRvl($param='edt'.$wTask,$default='',$maxlen=0,$type='string',$method='POST');
$lines=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$lines);$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'',$lines);
$target=$this->aeSt->siOt().'/robots.txt';$html=$setup->upfle($lines,$target);
unset($setup);
return $html;} public function Option74_getManualEditRedirection($action,$html){
$target=$this->aeSt->siOt().'/.htaccess';$this->aesD->log('File:'.$target);if(file_exists($target)){
$htaccess=file_get_contents($target, FILE_USE_INCLUDE_PATH);
$tag=$this->aeSt->spts($action,'tag');
$OHtc=aecFt::isTRls($htaccess, '#'.$tag);
$type=$this->aeSt->spts($action,'type');
$lUA=$this->aeSt->spts($action,'language');$html=aecFt::rphl('%ID%',$action,$html);$html=aecFt::rphl('%EXPLAIN%',$this->aesL->$lUA('explain'),$html);$html=aecFt::rphl('%SAVEDMSG%', str_replace("'", "\'",$this->aesL->$lUA('saved')),$html);
$OHtc=aecFt::rphl('#'.$this->aeSt->spts($action,'tag').'_START','',$OHtc);
$OHtc=aecFt::rphl('#'.$this->aeSt->spts($action,'tag').'_END','',$OHtc);$html=str_replace('%VALUES%',$OHtc,$html);if((strpos($html,'%BACKUPVALUES%'))!==false){
if(trim($this->aesC->get(strtolower($tag)))!=''){
$data=$this->aesC->get(strtolower($tag));$this->aesC->Sfcy(substr($action,0,1).'.'.substr($action,-1),'',$data);}
$html=str_replace('%BACKUPVALUES%',$this->aesC->gtTy($action),$html);}
if((strpos($html,'%RESTOREFROMCONFIG%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIG%',$this->aesL->getMain('restorefromconfig'),$html);if((strpos($html,'%RESTOREFROMCONFIGHINT%'))!==false) $html=aecFt::rphl('%RESTOREFROMCONFIGHINT%',$this->aesL->getMain('restorefromconfig_hint'),$html);} else{
$html=aecFt::feck('failure').sprintf($this->aesL->gRrs('filenotfound'),str_replace('/',DIRECTORY_SEPARATOR,$target));} return $html;} public function Option74_ManualEditRedirection($wTask,$value=null){
$lUA=$this->aeSt->spts($wTask,'language');
$tag=$this->aeSt->spts($wTask,'tag');if($value==null){
$edt=trim(aecFt::gRvl($param='edt'.$wTask,$default='',$maxlen=0,$type='rules',$method='POST'));} else{
$this->aesD->log('Task '.$wTask.' - Value taken from the $value function parameter; not from posted data');
$edt=$value;}
$edt=str_replace('#aeSecure '.substr($wTask,0,1).'.'.substr($wTask,-1),'',$edt);$this->aesC->Sfcy(substr($wTask,0,1).'.'.substr($wTask,-1),'',$edt);require_once (dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$setup=aeCtu::getInstance();
$setup->eShtc('#'.$tag,$edt, '', null);
unset($setup);
return '';} public function Option81_ModPageSpeed($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$bReturn=$aeSu->eDFcy(array('id'=>$wTask));
unset($aeSu);
return $bReturn;}} public function Option82_getTabCompression($wTask,$value=null){
$html='';
$lUA=$this->aeSt->spts($wTask,'language');
$arrModules=null;
try{
if(function_exists('apache_get_modules')) $arrModules=apache_get_modules();} catch (Exception $e){}
if( function_exists('ob_gzhandler')||(in_array('mod_deflate',$arrModules)) ||
(in_array('mod_gzip',$arrModules))){} else{
$lUA=$this->aeSt->spts($wTask,'language');$html.=aecFt::feck('failure',$this->aesL->$lUA('notsupported'));} return $html;} public function Option82_ServerCompression($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$action=aecFt::gRvl($param='a',$default='0',$maxlen=1,$type='int');if($action!=1) $action=0;
list($release,$version)=$aeSu->Option41_getJoomlaVersion();if(trim($release)!=''){
if($action==1){
$arr=array(array('search'=>"/gzip = '(?!1)'/",'replace'=>"gzip = '1'"));} else{
$arr=array(array('search'=>"/gzip = '(?!0)'/",'replace'=>"gzip = '0'"));}
$aeSu->uJCfg($arr);}
$msg=$aeSu->etPni('zlib.output_compression',($action==1)?'on':'off');
$msg.=$aeSu->etPni('zlib.output_compression_level',($action==1)?'9':'0');$return= $aeSu->eDFcy(array('id'=>'82','extra_msg'=>$msg));
unset($aeSu);
return $return;}}  public function Option83_ETags($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$bReturn=$aeSu->eDFcy(array('id'=>$wTask));
unset($aeSu);
return $bReturn;}} public function Option84_getTabMinify($wTask,$html){
$html=aecFt::rphl('%MINIFYCSSCHECKED%', ($this->aesC->getMinify('css', '1')=='1'?'checked':''),$html);$html=aecFt::rphl('%MINIFYJSCHECKED%', ($this->aesC->getMinify('js', '0')=='1'?'checked':''),$html);$html=aecFt::rphl('%MINIFYHTMLCHECKED%', ($this->aesC->getMinify('html', '1')=='1'?'checked':''),$html);
$lUA=$this->aeSt->spts($wTask,'language');$html=aecFt::rphl('%ADVANCEDOPTIONS%',$this->aesL->getMain('advancedoptions'),$html);$html=aecFt::rphl('%MINIFYCSS%',$this->aesL->$lUA('minifycss'),$html);$html=aecFt::rphl('%MINIFYJS%',$this->aesL->$lUA('minifyjs'),$html);$html=aecFt::rphl('%MINIFYJSWARNING%',$this->aesL->$lUA('minifyjswarning'),$html);$html=aecFt::rphl('%MINIFYHTML%',$this->aesL->$lUA('minifyhtml'),$html);$html=aecFt::rphl('%EXPLAIN%',$this->aesL->$lUA('explain'),$html);
return $html;} public function Option84_Minify($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
$return=null;require_once (dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$action=aecFt::gRvl($param='a',$default=NULL,$maxlen=1,$type='bool_NULL',$method='POST');if(($action===NULL)&&($this->aesC->dbu()===true)) $action=aecFt::gRvl($param='a',$default=NULL,$maxlen=1,$type='bool_NULL',$method='GET');if($action!=true) $action=false;if($action===true){
$arrchk=array('css'=>'chkCSS','js'=>'chkJS','html'=>'chkHTML');foreach ($arrchk as $key=>$chk){
$value=aecFt::gRvl($param=$chk,$default=NULL,$maxlen=1,$type='bool',$method='POST');$this->aesC->SetMinify($key,(int)$value);}}
$return=$aeSu->eDFcy(array('id'=>$wTask));$return.=$aeSu->Option92_CleanCacheDirectory(92);
unset($aeSu);
return $return;}}  public function Option89_HotLinking($wTask,$value=null){
$bnUe=true;if(class_exists('aeCtu')){$aeSu=aeCtu::getInstance(); $bnUe=$aeSu->rtSp($wTask);}
if($bnUe){
require_once(dirname(dirname(dirname(__FILE__))).'/setup/setup.php');
$aeSu=aeCtu::getInstance();
$bReturn=$aeSu->eDFcy(array('id'=>$wTask));
unset($aeSu);
return $bReturn;}} public function Option1003_getQuickInfo(){
$html='';if($this->aesC->mo()==true){
$html='--hidden in demo mode--';
return $html;}
$html='<link href="../aesecure/third/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">';$html.='<link href="assets/aesecure.css" rel="stylesheet" media="screen">';
$licence=is_dir(dirname(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'dashboard'))?'Pro':'Premium';$html.='<h2>aeSecure '.'v'.$this->aeSt->get('version'). ' '.$licence.' on PHP v'.phpversion().'</h2>';$html.='<div id="ConfigTitle" class="bg-primary lead">'.$this->aesL->getConfigTitle().'</div><hr/>';
$json=file_get_contents(dirname(dirname(dirname(__FILE__))).'/configuration/configuration.json', FILE_USE_INCLUDE_PATH);
$arr=json_decode($json,true);if(isset($arr)){if(isset($arr['functionnalities'])) ksort($arr['functionnalities']);}
require_once(dirname(dirname(dirname(__FILE__))).'/helpers/aesecure.php');
$setup=aeSecure::getInstance();
$actions=$this->aeSt->spts();
$arrQuickContent['options']=array();foreach ($actions as $action=>$data){
$tag=$this->aeSt->spts($action,'tag');
$target=$this->aeSt->spts($action,'htaccess');if(trim($target)!='') $target=$this->aeSt->siOt().$target;if(trim($tag)!==''){
list($bBle,$block)=$setup->cOeld($action,false,$target);if($bBle===true) $arrQuickContent['options'][substr($action,0,1).'.'.substr($action,-1)]=$bBle;} }
unset($setup);
$arrContent=array();
$arrContent[$this->aesL->gtOns('misc')][$this->aesL->gtOns('key')]=($this->aesC->mo()?'':$arr['key']);
$arrContent[$this->aesL->gtOns('misc')][$this->aesL->gtOns('foldertmp')]=$arr['tmp'];
$arrContent[$this->aesL->gtOns('db')][$this->aesL->gtOns('dbname')]=$arr['db']['name'];
$arrContent[$this->aesL->gtOns('db')][$this->aesL->gtOns('dbtype')]=$arr['db']['type'];
$arrContent[$this->aesL->gtOns('db')][$this->aesL->gtOns('dbhost')]=$arr['db']['host'];
$arrContent[$this->aesL->gtOns('db')][$this->aesL->gtOns('dbuser')]=$arr['db']['user'];
$arrContent[$this->aesL->gtOns('db')][$this->aesL->gtOns('dbpassword')]=$arr['db']['password'];
$arrContent[$this->aesL->gtOns('db')][$this->aesL->gtOns('dbprefix')]=$arr['db']['prefix'];
$arrContent[$this->aesL->gtOns('logging')][$this->aesL->gtOns('folderlog')]=$arr['log']['folder'];
$arrContent[$this->aesL->gtOns('logging')][$this->aesL->gtOns('logwrite')]=$arr['log']['write']?'true':'false';
$arrContent[$this->aesL->gtOns('logging')][$this->aesL->gtOns('logtype')]=$arr['log']['type'];
$arrContent['emails'][$this->aesL->gtOns('sendemail')]=$arr['mail']['send']?'true':'false';
$arrContent['emails'][$this->aesL->gtOns('emailfrom')]=$arr['mail']['from'];
$arrContent['emails'][$this->aesL->gtOns('emailfromname')]=$arr['mail']['fromName'];
$arrContent['emails'][$this->aesL->gtOns('email')]=$arr['mail']['to'];
$arrContent['emails'][$this->aesL->gtOns('emailsubject')]=$arr['mail']['subject'];if(isset($arr['functionnalities'])>0){
foreach ($arr['functionnalities'] as $func=>$value){
if($value!==false){
if(in_array($func, array('7.4'))){
if($func=='7.4'){
$arrTmp=explode(PHP_EOL,$arr['functionnalities']['7.4']);
$sTemp='';
foreach($arrTmp as $url){
if(trim($url)!=='') $sTemp.=$url.'<br/>';}
$status=$sTemp;} } else{
$status=($value===true?$this->aesL->getMain('state_enabled'):($value===false?$this->aesL->getMain('state_disabled'):$value));}
$arrContent['function'][$func]=$status;} } }
$content='<div class="bg-info aeSecureQuickInfoFuncs"><h3>'.$this->aesL->getQuickInfo('quickoverview').'</h3>';
foreach($arrQuickContent as $key=>$data){
foreach($data as $config=>$value){
$action=str_replace('.','',$config);
$glyph='<span class="glyphicon glyphicon-'.($value==true?'ok':'remove').'"/>';
$lUA=$this->aeSt->spts($action,'language');
$text=$this->aesL->$lUA('title');
$content.='<div class="aeSecureQuickInfoFunc '.($value==true?'green':'red').'">'.$glyph.' '.$config.' '.$text.'</div>';}}
$content.='</div><span class="aeSecureQuickInfoRemark">'.$this->aesL->getQuickInfo('remarkversion').'</span><hr/>';
$content.='<h3>'.$this->aesL->getQuickInfo('fullreport').'</h3>';
$content.='<table class="table table-striped"><thead><tr><th width="15%">Category</th>'.'<th>Subcategory</th><th>'.$this->aesL->getQuickInfo('value').'</th></tr></thead><tbody>';
foreach($arrContent as $key=>$data){
foreach($data as $config=>$value){
if($key==='function'){
if(is_array($value)) $value=implode($value,'<br/>');
$content.='<tr><td>'.$config.'</td><td colspan="2">'.$value.'</td></tr>';} else{
$content.='<tr><td>'.$key.'</td><td>'.$config.'</td><td>'.$value.'</td></tr>';}}}
$content.='</tbody></table>';$file=dirname(dirname(dirname(dirname(__FILE__)))).DIRECTORY_SEPARATOR.'.htaccess';if((file_exists($file))&&(is_readable($file))) $content.='<hr/><h3>'.$file.'</h3>'.self::Geshi('',$file);$file=dirname(dirname(dirname(dirname(__FILE__)))).DIRECTORY_SEPARATOR.'administrator'.DIRECTORY_SEPARATOR.'.htaccess';if((file_exists($file))&&(is_readable($file))) $content.='<hr/><h3>'.$file.'</h3>'.self::Geshi('',$file);$file=dirname(dirname(dirname(dirname(__FILE__)))).DIRECTORY_SEPARATOR.'php.ini';if((file_exists($file))&&(is_readable($file))) $content.='<hr/><h3>'.$file.'</h3>'.self::Geshi('',$file);$html.=$content;$html.=sprintf($this->aesL->getQuickInfo('generatedon'),date('Y/m/d h:i:s a', time()).' ('.ini_get('date.timezone').')');
return $html;} public function Option1004_seeApacheErrorLog(){
$return='';$html=file_get_contents(self::$tlttH.'showerrorlog.'.self::$layout.'.aec', FILE_USE_INCLUDE_PATH);$html=str_replace('%AESECURESITEURL%',$this->aeSt->siUl(),$html);if($this->aesC->mo()==false){
$arrStyle=array(
'PHP Strict Standards'=>'<span style="color: #A9A9A9;">%s</span>','PHP Deprecated'=>'<span style="color: red;">%s</span>','PHP Parse error'=>'<span style="color: red;">%s</span>','PHP Fatal error'=>'<span style="background-color:#e6c0c0;color:#c00;border-top:3px solid #DE7A7B;border-bottom:3px solid #DE7A7B;display:inline-block;margin:10px 0 10px 0;font-weight:bold;">%s</span>'
);$file=ini_get('error_log');$file=str_replace('/',DIRECTORY_SEPARATOR,$file);if(realpath($file)===false) $file=rtrim($this->aeSt->siOt(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.ltrim($file,DIRECTORY_SEPARATOR);if(is_readable($file)){
$handle = fopen($file, 'r');
$maxChar=$this->aesC->get('apache_error_log','maxchartoread',500000);
fseek($handle, -1 * $maxChar, SEEK_END);
while(!feof($handle)){$return.=fgets($handle);}
$sPartial='';if(filesize($file)>$maxChar){
$sPartial=' <strong>Only the last '.$maxChar.' characters are displayed.</strong>';}
$final='';
$arr=$this->aesC->get('apache_error_log','skip',array());if(count($arr)>0){
$arrSkip=array();
foreach($arr as $skip){$arrSkip[$skip]=0;}}
if(($firstline=strpos($return,"\n"))!==false) $return=substr($return,$firstline);
foreach(preg_split("/((\r?\n)|(\r\n?))/",$return) as $line){
$line=rtrim(ltrim($line,' '),' ');
$bSkip=((trim($line)=='')||($line==null)||($line=="\n")||($line=="\r")||($line==PHP_EOL));if(!$bSkip){
if(count($arr)>0){
foreach($arrSkip as $key=>$counter){
$bSkip=(strpos($line,$key)>0);if($bSkip){$arrSkip[$key]=$arrSkip[$key]+1; break;}}}}
if(!$bSkip){
foreach ($arrStyle as $key=>$value){
if(strpos($line,$key)) $line=sprintf($arrStyle[$key],$line);}
$final.=$line.'<br/>';}}
unset($return);
$skipMsg='';if(count($arrSkip)>0){
foreach($arrSkip as $key=>$counter){
$skipped=sprintf($this->aesL->getTools('apache_error_log_skip_short'),$counter);
$skipMsg.='<li>'.$key.' ('.$skipped.')</li>';}}
if(trim($skipMsg)!=='') $skipMsg='<h5>'.$this->aesL->getTools('apache_error_log_skip').'</h5><ul>'.$skipMsg.'</ul>';$html=str_replace('%AESECUREREALFILENAME%',realpath($file),$html);$html=str_replace('%AESECUREFILELASTMOD%',date ("Y-m-d H:i:s", filemtime($file)),$html);$html=str_replace('%AESECUREFILESIZE%',number_format(filesize($file)),$html);$html=str_replace('%AESECUREFILEPARTIAL%',$sPartial,$html);$html=str_replace('%AESECURESKIP%',$skipMsg,$html);$html=str_replace('%AESECURECONTENT%',$final,$html);$html=str_replace('%AESECUREEXTRAMSG%','',$html);
fclose($handle);} else{
$html=str_replace('%AESECUREREALFILENAME%',$file,$html);$html=str_replace('%AESECUREFILELASTMOD%','1970-01-01',$html);$html=str_replace('%AESECUREFILESIZE%',0,$html);$html=str_replace('%AESECUREFILEPARTIAL%','',$html);$html=str_replace('%AESECURESKIP%','',$html);
$tmp=sprintf($this->aesL->gRrs('filenotfound'),str_replace('/',DIRECTORY_SEPARATOR,$file));$html=str_replace('%AESECURECONTENT%',$tmp,$html);$html=str_replace('%AESECUREEXTRAMSG%',aecFt::feck('info',$this->aesL->getTools('see_apache_error_log_notfound')),$html);}} else{ $final='--hidden in demo mode--';} return $html;}}