| Current Path : /home/jeromecohp/www/aesecure/premium/filereader/ |
| Current File : /home/jeromecohp/www/aesecure/premium/filereader/filereader.php |
<?php
// @file : /premium/filereader/filereader.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
defined( '_AESECURE') or die('No direct access allowed');
class aeCRf{
var $root=null;var $aesC = null;var $aesL = null;var $aecPe = null;var $aeSt = null;static $tlttH = '';
function __construct(){
$this->root=dirname(dirname(dirname(__FILE__)));require_once ($this->root.'/helpers/configuration.php');$this->aesC = aeSecureConfiguration::getInstance();require_once ($this->root.'/helpers/language.php');$this->aesL = aecLa::getInstance();if(file_exists($this->root.'/premium/helpers/aesecure.php')){
require_once($this->root.'/premium/helpers/aesecure.php');$this->aecPe = aecPe::getInstance();} else{
$this->aecPe=null;}
require_once($this->root.'/helpers/settings.php');$this->aeSt = aecSt::getInstance();self::$tlttH = $this->root.'/template/';
return true;} function __destruct(){
unset($this->aesC);
unset($this->aesL);
unset($this->aecPe);} public function read($filename,$aIgpT=null){
$html=file_get_contents(self::$tlttH.'filereader.default.aec', FILE_USE_INCLUDE_PATH);$html=str_replace('%AESECURESITEURL%',$this->aeSt->siUl(),$html);$html=str_replace('%AESECUREFILENAME%',$filename,$html);$html=str_replace('%AESECUREREALFILENAME%',realpath($filename),$html);$html=str_replace('%AESECUREKEY%',$this->aesC->get('key'),$html);$html=str_replace('%AESECUREMSGSPECIFYSOMETHING%',str_replace("'","'\'",$this->aesL->getTools('fileread_specify_something')),$html);$html=str_replace('%AESECUREMSGFILENOTFOUND%',str_replace("'","'\'",$this->aesL->getTools('fileread_notfound')),$html);$html=str_replace('%AESECUREMSGLASTMODEHIDE%',$this->aesL->getTools('lastmod-hide'),$html);$html=str_replace('%AESECUREFILEREADPLACEHOLDER%',$this->aesL->getTools('fileread_placeholder'),$html);if(file_exists($filename)){
$tmp=rtrim(file_get_contents($filename, FILE_USE_INCLUDE_PATH), "\n");
$tmp=preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n",$tmp);
$ignore='<pre id="IgnoreItems" class="ignore" style="display:%s;">'.$this->aesL->getTools('fileread_ignore').'<ul class="list-inline" id="IgnoreItems">%s</ul></pre>';if($aIgpT==null){
$fileContent="<ol><li class='lineContent'>".str_replace("\n","</li><li class='lineContent'>",$tmp)."</li></ol>";
$ignore=sprintf($ignore,'none','');} else{
$fileContent="<ol>";
$GeoCoding=str_replace('json','xml',$this->aesC->get('urls','geocoding'));
$GeoCoding=aecFt::link($GeoCoding,'%s','target="_blank"');
foreach(preg_split("/((\r?\n)|(\r\n?))/",$tmp) as $line){
$line=trim($line);if((trim($line)!='')&&(preg_match("/($aIgpT)/",$line))) $line='';if(trim($line)!=''){
$line=preg_replace('/([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)/', str_replace('%s','$1',$GeoCoding),$line);
$fileContent .='<li class="lineContent">'.$line.'</li>';}}
$fileContent .='</ol>';
$ignore=sprintf($ignore, 'visible','<li>"'.str_replace('|','"</li><li>"',$aIgpT).'"</li>');}
$html=str_replace('%AESECUREIGNORE%',$ignore,$html);$html=str_replace('%AESECUREFILECONTENT%',$fileContent,$html);} else{ $error=aecFt::feck('failure').sprintf($this->aesL->gRrs('filenotfound'),str_replace('/',DIRECTORY_SEPARATOR,$filename));$html=str_replace('%AESECUREIGNORE%','',$html);$html=str_replace('%AESECUREFILECONTENT%',$error,$html);} return $html;}}