Example #1
0
defined('SYSPATH') or exit('Install must be loaded from within index.php!');
//were the install files are located
define('INSTALLROOT', DOCROOT . 'install/');
//we check first short tags if not we can not even load the installer
if (!(bool) ini_get('short_open_tag')) {
    die('<strong><u>OC Installation requirement</u></strong>: Before you proceed with your OC installation: Keep in mind OC uses the short tag "short cut" syntax.<br><br> Thus the <a href="http://php.net/manual/ini.core.php#ini.short-open-tag" target="_blank">short_open_tag</a> directive must be enabled in your php.ini.<br><br><u>Easy Solution</u>:<ol><li>Open php.ini file and look for line short_open_tag = Off</li><li>Replace it with short_open_tag = On</li><li>Restart then your PHP server</li><li>Refresh this page to resume your OC installation</li><li>Enjoy OC ;)</li></ol>');
}
//prevents from new install to be done
if (!file_exists(INSTALLROOT . 'install.lock')) {
    die('Installation seems to be done, please remove /install/ folder');
}
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors', 1);
include 'class.install.php';
//start the install setup
install::initialize();
$is_compatible = install::is_compatible();
//choosing what to display
//execute installation since they are posting data
if (($_POST or isset($_GET['SITE_NAME'])) and $is_compatible === TRUE) {
    if (install::execute() === TRUE) {
        $data = array('site_url' => core::request('SITE_URL'), 'admin_email' => core::request('ADMIN_EMAIL'), 'admin_pwd' => core::request('ADMIN_PWD'));
        header('Content-Type: application/json');
        die(json_encode($data));
    } else {
        $view = 'form';
    }
} elseif ($is_compatible === TRUE) {
    $view = 'form';
} else {
    $view = 'hosting';