<?php

if($debugMode == 1) { error_reporting(1); }else{ error_reporting(0); }
session_start();

####################################
#   EvilCMS WAS CREATED BY X1M!    #
####################################
# I DONT DEMAND THAT YOU KEEP THE  #
# COPYRIGHT IN THE FOOTER, BUT I   #
# DO DEMAND THAT THIS NOTE IS KEPT #
# IN THE SOURCE CODE. YOU CAN EDIT #
# HOWEVER THE FUCK YOU WANT, JUST  #
# KEEP THIS NOTE. YOU MAY NOT RELE #
# ASE AS YOUR OWN, THIS IS STILL   #
# MADE BY ME.                -X1M! #
####################################

/* Installing and setting up the DCRs.
This method was enhanced from thetrev's installer. */

if(isLoggedIn()) {
if($_SESSION['user_rank'] == "admin") {
$loadVariables = file_get_contents("DCR/external_variables.txt");
$loadTexts = file_get_contents("DCR/external_texts.txt");
if(is("updateShit") && isset($_POST['HotelName']) && isset($_POST['Link'])) {
$loadVariables = str_replace("[REPLACETHIS]", $_POST['HotelName'], $loadVariables);
$loadTexts = str_replace("[REPLACETHIS1]", $_POST['Link'], $loadTexts);
$loadTexts = str_replace("[REPLACETHIS2]", $_POST['Link'], $loadTexts);
editFile("DCR/external_variables.txt", $loadVariables);
editFile("DCR/external_texts.txt", $leadTexts);
echo "Setup is complete, the setup will try to remove the setup itself but if theres an error, you have to do it manually.";
unlink("Install.php") or die("Could'nt remove setup.");
}else{
?>
<form method="post" action="?page=Install&updateShit">
DCR Folder Link: <input type="text" value="http://<?php print $_SERVER['SERVER_NAME']; ?>/DCR/" name="Link"><br />
<em>YOU MUST END THE LINK WITH A SLASH (/)</em><br />
Hotel Name: <input type="text" value="<?php print $hotelTitle; ?>" name="HotelName"><br />
<input type="submit" value="Update DCRs!">
</form>
<?php
}
}else{
echo "You have to be administrator.";
}
}else{
?>
Please login.
<?php
}
?>