<?php
error_reporting(0);
$currentPath= $_SERVER['SCRIPT_FILENAME'] ;
$phydir= str_replace('\\','/', $currentPath);
$currentpathRev=strrev($currentPath);
$phydirrev=strchr($currentpathRev,"/");
$phydirrev= strrev($phydirrev);
require_once($phydirrev.'smarty/libs/Smarty.class.php');
$smarty_error = new Smarty;
$smarty_error->template_dir = $phydirrev.'templates/';
$smarty_error->compile_dir = $phydirrev.'templates_c/';
$smarty_error->cache_dir = $phydirrev.'smarty_cache/';
$smarty_error->debug_dir = $phydirrev.'debug/';
$smarty_error->config_dir = $phydirrev.'config/smarty_configs/';
$EROOR_HEADER = $smarty_error->fetch('error_header.php');
$EROOR_FOOTER = $smarty_error->fetch('installation_footer.php');
$smarty_error->assign('header', $EROOR_HEADER);
$smarty_error->assign('ERROR_FOOTER', $EROOR_FOOTER);
$msg=null;
$memConfig=$phydirrev."config/do_not_delete.txt";
$installation_folder=$phydirrev."installation";
$decripted="";
if(!file_exists($installation_folder) && file_exists($memConfig))
{
$fileContent=file_get_contents($memConfig) ;
$decripted=decrypt_admin($fileContent);
}
$adminlink=$decripted."/admin/index.php";
if(isset($_GET['check'] )) {
$msg="<div style='text-align:left;'><b style='font-size:12px;'>In order to run Membersite on your server, Please enable the following apache server's module.</b></div><br>" ;
if($_GET['check'] == 'mod_dir') {
$msg.="<div style='text-align:left;padding-left:10px;'>mod_dir";
}else if($_GET['check'] == 'mod_rewrite'){
$msg.="<div style='text-align:left;padding-left:10px;'>mod_rewrite";
}
else if($_GET['check'] == 'mysql'){
$msg.="<div style='text-align:left;padding-left:10px;'>mysql";
}
if(file_exists($installation_folder))
$msg.="<a href='installation/index.php' style='padding-left:150px;'>Click here to continue..</a></div>";
else
$msg.="<a href='$adminlink' style='padding-left:150px;'>Click here to continue..</a></div>";
$smarty_error->assign('msg',$msg);
$smarty_error->display('installation_error.tpl');
}
exit();
function decrypt_admin($string,$pkey='MEMBERSITEENCRYPTEDKEY') {
$key = $pkey;
if(!isset($key) or $key=="")
$key='MEMBERSITEENCRYPTEDKEY';
$result = '';
$string = base64_decode(urldecode($string));
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)-ord($keychar));
$result.=$char;
}
return $result;
}
?>