<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | File name : index.php                                                |
// | PHP version >= 5.2                                                   |
// +----------------------------------------------------------------------+
// | Author: BINU CHANDRAN.E<binu.chandran@armiasystems.com>              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems � 2010                                      |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+

ini_set('display_errors', 0);
ini_set( 'magic_quotes_gpc', 0 );

//die('Create a virtual domain');

/**
* Base path is the directory in which 
* your index.php file is located.
**/
define('BASE_PATH', getcwd() . '/');


if(get_magic_quotes_gpc())
{

    function stripslashes_deep($value)
    {
       $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
       return $value;
    }

     $_POST   = array_map('stripslashes_deep', $_POST);
     $_GET    = array_map('stripslashes_deep', $_GET);
     $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
 
}


 
       

$url = '';
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]), 0, strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "/")) . $s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);

$fPath = explode('index.php',$_SERVER['SCRIPT_NAME']);

$url = $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $fPath[0];

define('BASE_URL', $url);

/*
 * check if the application has been installed
 */
$configfile = "easyindex_config.php";
$configcontents = @fread(@fopen($configfile, 'r'), @filesize($configfile));
$pos = strpos($configcontents,"INSTALLED");
$param	=	$_REQUEST["param"];
if($pos === false){
    if(!file_exists('config.php')){
	header("Location: {$url}install/index.php");
        exit;
    }
    else{
        header("Location: {$url}upgrade2.0/index.php");
        exit;
    }
}
/*$configcontents = @fread(@fopen($configfile, 'r'), @filesize($configfile));
$version = strpos($configcontents, "2.1");
if ($version === false) {
    header("Location: {$url}upgrade2.1/index.php");
        exit;
}*/

/**
* Load the core application file 
**/

require_once('config/application.php');
require_once('lib/pagecontext.php');
require_once('lib/globalutils.php');

/**
* Create object of bootstrap.
**/
$bootstrap = new ConfigBootstrap;

/**
* Framework will sart when call the function run
**/




$bootstrap->run();


?>