<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>WorkSimple Blog Installer</title>
        <link href="../themes/grey/grey.css" title="compact" rel="stylesheet" type="text/css">
    </head><body>
        <div id="frame">
            <div id="contentheader"><h1><a href=".">WorkSimple Blog</a>: Wrk smplr thn nrml</h1></div>
            <div id="contentleft">
                <h1>Info</h1>
                <p>Please continue the installer.</p>
            </div>
            <div id="contentcenter">
                <h1>Install</h1>
                <?php
            ########
            //Prerequisites

                $name = $_POST['name']; //Website name
                $tag = $_POST['tag']; //Tagline/Slogan
                $nm = $_POST['nm']; //Posts/page
                $user = $_POST['user']; //Admin username
                $pass = $_POST['pass']; //Admin password
                $ads = $_POST['ads']; //Ads? TRUE is enabled, false otherwise.
                $cal = $_POST['calendar']; //Enable calendar?
                $ws_version = "1.3.5 Thermal "; //Note to self; MUST UPDATE FOR EACH RELEASE
                $lang_i = "langs/en.lang.php"; //Language to start with.
                ########
                
                if ($ads == "on") {
                    $ads = "TRUE";
                } else {
                    $ads = "FALSE";
                }

                if ($cal == "on") {
                    $cal = "TRUE";
                } else {
                    $cal = "FALSE";
                }

                if (!is_numeric($nm)) {
                    die('You must enter a integer for posts/page. Please go back and fix this.');
                }


                $f = "../data/conf.php";
                $fh = fopen("../data/conf.php", 'w') or die("Cannot create data/conf.php, please chmod correctly");
                $uu = '"';
                //Looks inefficient, but it works.
                $a = "<?php";
                $b = '$site_name = ' . "$uu$name$uu; //Site name, also displayed in the title bar";
                $d = '$tagline = ' . "$uu$tag$uu;//Tagline/slogan ";
                $j = '$ad_status = ' . "$ads; //Ads are on, FALSE otherwise";
                $f = '$blog_status = ' . "TRUE; //Blog status, TRUE is on, FALSE is off";
                $g = '$per_page = ' . "$nm; //Blog posts per page. ";
                $p = '$calendar = ' . "$cal; //Enable or disable the calendar.";
                $yu = '$css_theme = ' . "$uu" . 'themes/grey/grey.css' . "$uu; //Current theme.";
                $wsv = '$ws_version = ' . "$uu$ws_version$uu; //Version of WS.";
                $lg = '$lang = ' . "$uu$lang_i$uu; //Language.";
                $c = "?>";

                fwrite($fh, "$a\n$b\n$d\n$j\n$f\n$g\n$p\n$yu\n$wsv\n$lg\n$c");

                echo "'conf.php' created successfully!<br /><br />";

                echo 'Please continue the install by clicking <a href="install2.php">here</a>';
                fclose($fh);
                ?>
            </div>

            <div id="contentright">
                <h1>Links</h1>

                <p><big>The links you specify will show here!

                    </big></p>
            </div>
        </div>
    </body>
</html>
