<?php
//#################################################################################################
// Installation site
//#################################################################################################
define('DOIT',true);
require_once('../core/session.install.include.php');
require_once(PATH.'/installation/install.include.php');
//check permissions
//echo "Permissions for installation folder: ".substr(decoct(fileperms('.')),2)."<br>";
//echo "Permissions for config file: ".substr(decoct(fileperms('../config.php')),3)."<br>";
//If one of the files is not writable
if (!is_readable("../config.php") or !is_writable(".")) {
//Try to change permissions
if (!set_permissions()) {
$msg=array($l_inst["msg_perms_err"],"bad");
}
}
//read last used language from config file
$mylanguage=false;
$handle=@fopen("./language.txt", "r");
if ($handle) {
//read first line only
$line=fgets($handle);
$mylanguage = only_text($line);
fclose($handle);
}
//choose language
if (!$mylanguage or $mylanguage=="") {
require_once("languages/en.php");
} else {
require_once("languages/$mylanguage.php");
}
//make form
$msg = false;
$recoveryform = make_recoveryform($msg);
if ($recoveryform===true) {
$pagetitle = 'Recovery complete!';
$pagecontent = '<p>Congratulations, your website has been completely restored.</p>
<p>Now you can log in using your old admin username and password.</p><br />
<a class="button" href="'.URL.'/admin/index.php">Go to the chillyCMS backend</a>';
} else {
$pagetitle = 'chillyCMS Recovery';
$pagecontent = '<p>To recover your website, please enter the new database details. That\'s all!</p>'.
'<p>This process might take a while depending on the number of modules and the amount of content. Please be patient and do not refresh the page!.</p><br /><br />'.
$recoveryform;
}
$output = '<h1>'.$pagetitle.'</h1><br /><br />'.$pagecontent;
if (get_class($page)!='Installpage') {
unset($page);
$page = new Installpage();
}
$page->pagetitle = $pagetitle;
$page->print_head();
$page->add($output);
$page->print_body($msg);
?>