<?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);
$mod_rewrite=apache_is_module_loaded('mod_rewrite');
$mod_auth_basic=apache_is_module_loaded('mod_auth_basic');
if(!$mod_auth_basic)
$mod_auth_basic=apache_is_module_loaded('mod_auth');
$mod_dir=apache_is_module_loaded('mod_dir');
// $is_Magic_coat_gpc_enabled=get_magic_quotes_gpc();
//$is_zend_optimizer_supported=extension_loaded('Zend Optimizer');
$is_mysql_supported=extension_loaded('mysql');
$msg=null;
$i=1;
if(!$mod_rewrite or !$mod_auth_basic or !$mod_dir)
$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 modules.</b></div><br>" ;
if(!$mod_rewrite)
{
$msg.="<div style='text-align:left;padding-left:10px;'>$i.mod_rewrite</div><br>";
$i++;
}
if(!$mod_auth_basic)
{
$msg.="<div style='text-align:left;padding-left:10px;'>$i.mod_auth_basic</div><br>";
$i++;
}
if(!$mod_dir)
{
$msg.="<div style='text-align:left;padding-left:10px;'>$i.mod_dir</div>";
$i++;
}
/* if($is_Magic_coat_gpc_enabled!=0)
{
$msg.="<hr><div style='text-align:left;'><b style='font-size:12px;'>Please set the following setting into php configuration.</b></div><br>
<div style='text-align:left;padding-left:10px;'>1. magic_quotes_gpc=Off</div>";
} */
if(!$is_zend_optimizer_supported or !$is_mysql_supported )
$msg.="<hr><div style='text-align:left;'><b style='font-size:12px;'>Please enable the following extensions into php configuration.</b></div><br>" ;
$k=1;
if(!$is_zend_optimizer_supported)
{
$msg.="<div style='text-align:left;padding-left:10px;'>$k.Zend Optimizer</div><br>";
$k++;
}
if(!$is_mysql_supported)
{
$msg.="<div style='text-align:left;padding-left:10px;'>$k.mysql</div>";
$k++;
}
if($msg==null)
$msg="<a href='installation/index.php'>Click here to continue..</a>";
$smarty_error->assign('msg',$msg);
$smarty_error->display('installation_error.tpl');
exit();
function apache_is_module_loaded($mod_name)
{
$modules = apache_get_modules();
return in_array($mod_name, $modules);
}
?>