add cms, add todo
[ssproject1617.git] / testcms-final-anon / install / index.php
diff --git a/testcms-final-anon/install/index.php b/testcms-final-anon/install/index.php
new file mode 100644 (file)
index 0000000..4e640d1
--- /dev/null
@@ -0,0 +1,165 @@
+<!doctype html>\r
+<html lang="en-gb">\r
+    <head>\r
+        <meta charset="utf-8">\r
+        <title>Install Test CMS CMS</title>\r
+        <mate name="robots" content="noindex, nofollow">\r
+        \r
+        <link rel="stylesheet" href="assets/css/app.css">\r
+        \r
+        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>\r
+        <script>window.jQuery || document.write('<script src="assets/js/jquery.js"><\/script>');</script>\r
+        <script src="assets/js/app.js"></script>\r
+    </head>\r
+    <body>\r
+    \r
+       <h1><img src="assets/img/logo.gif" alt="Test CMS install logo"></h1>\r
+       \r
+       <?php\r
+       \r
+       /*\r
+               Compatibility checks\r
+       */\r
+       $compat = array();\r
+       \r
+       // php\r
+       if(version_compare(PHP_VERSION, '5.3.0', '<')) {\r
+               $compat[] = 'Test CMS requires PHP 5.3 or newer.<br><em>Your current environment is running PHP ' . PHP_VERSION . '</em>';\r
+       }\r
+       \r
+       // PDO\r
+       if(class_exists('PDO') === false) {\r
+               $compat[] = 'Test CMS requires PDO (PHP Data Objects)<br>\r
+               <em>You can find more about <a href="//php.net/manual/en/book.pdo.php">installing and setting up PHP Data Objects</a> \r
+               on the php.net website</em>';\r
+       } else {\r
+               if(in_array('mysql', PDO::getAvailableDrivers()) === false) {\r
+                       $compat[] = 'Test CMS requires the MySQL PDO Driver<br>\r
+                               <em>You can find more about <a href="//php.net/manual/en/ref.pdo-mysql.php">installing and setting up MySQL PDO Driver</a> \r
+                               on the php.net website</em>';\r
+               }\r
+       }\r
+\r
+        // can we write a config file?\r
+        // note: on win the only way to really test is to try and write a new file to disk.\r
+        if(@file_put_contents('../test.php', '<?php //test') === false) {\r
+            $compat[] = 'It looks like the root directory is not writable, we may not be able to automatically create your config.php file. \r
+                Please make the root directory writable until the installation is complete.';\r
+        } else {\r
+            unlink('../test.php');\r
+        }\r
+\r
+       ?>\r
+       \r
+       <?php if(count($compat)): ?>\r
+    \r
+       <div class="content">\r
+               <h2>Woops.</h2>\r
+               \r
+               <p>Test CMS is missing some requirements:</p>\r
+               \r
+               <ul style="padding-bottom: 1em;">\r
+                       <?php foreach($compat as $item): ?>\r
+                       <li><?php echo $item; ?></li>\r
+                       <?php endforeach; ?>\r
+               </ul>\r
+               \r
+               <p><a href="." class="button" style="float: none; display: inline-block;">Ok, I've fixed these, run the installer.</a></p>\r
+       </div>\r
+    \r
+       <?php elseif(file_exists('../config.php')): ?>\r
+       \r
+       <div class="content">\r
+               <h2>Woops.</h2>\r
+               \r
+               <p>Test CMS is already installed. You should really delete this folder!</p>\r
+               \r
+               <p><a href="../" class="button" style="float: none; display: inline-block;">Return to the main site.</a></p>\r
+       </div>\r
+       \r
+       <?php else: ?>\r
+    \r
+        <p class="nojs error">You will need Javascript enabled for this installation. <em>Sorry :(</em></p>\r
+\r
+        <div class="content">\r
+            <h2>Welcome to Test CMS.</h2>\r
+\r
+            <p>If you were looking for a truly lightweight blogging experience, you&rsquo;ve \r
+            found the right place. Simply fill in the details below, and you&rsquo;ll have your \r
+            new blog set up in no time.</p>\r
+            \r
+            <small>If you want a more custom install, feel free to edit <code>config.default.php</code> \r
+            (before or after this installation, it doesn't really matter, as long as you rename it to \r
+            <code>config.php</code>).</small>\r
+            \r
+            <div class="notes"></div>\r
+            \r
+            <form method="get" novalidate>\r
+                <fieldset id="diagnose">\r
+                    <legend>Your database details</legend>\r
+                    \r
+                    <p>\r
+                        <label for="host">Your database host:</label>\r
+                        <input id="host" name="host" value="localhost">\r
+                    </p>\r
+                    <p>\r
+                        <label for="user">Your database username:</label>\r
+                        <input id="user" autocapitalize="off" name="user" placeholder="root">\r
+                    </p>\r
+                    <p>\r
+                        <label for="pass">Your database password:</label>\r
+                        <input id="pass" autocapitalize="off" name="pass" placeholder="password">\r
+                    </p>\r
+                    <p>\r
+                        <label for="db">Your database name:</label>\r
+                        <input id="db" autocapitalize="off" name="db" placeholder="Test CMS">\r
+                    </p>\r
+                    \r
+                    <a href="#check" class="button">Check database details</a>\r
+                </fieldset>\r
+                \r
+                <fieldset>\r
+                    <legend>About your site</legend>\r
+                    \r
+                    <p>\r
+                        <label for="name">Site name:</label>\r
+                        <input id="name" name="name" placeholder="My awesome Test CMS site">\r
+                    </p>\r
+                    \r
+                    <p>\r
+                        <label for="description">Site description:</label>\r
+                        <textarea id="description" name="description"></textarea>\r
+                    </p>\r
+\r
+                    <p>\r
+                        <label for="theme">Theme:</label>\r
+                        <select id="theme" name="theme">\r
+                            <?php foreach(glob('../themes/*') as $theme): $name = basename($theme); ?>\r
+                            <?php if(file_exists($theme . '/about.txt')): ?>\r
+                            <option value="<?php echo $name; ?>" <?php if($name === 'default') echo 'selected'; ?>><?php echo ucwords($name); ?></option>\r
+                            <?php endif; ?>\r
+                            <?php endforeach; ?>\r
+                        </select>\r
+                    </p>\r
+                    \r
+                    <p>\r
+                        <label for="email">Your Email Address:</label>\r
+                        <input id="email" name="email">\r
+                    </p>\r
+                    \r
+                    <p>\r
+                        <label for="path">Site path:</label>\r
+                        <input id="path" name="path" value="<?php echo dirname(dirname($_SERVER['SCRIPT_NAME'])); ?>">\r
+                    </p>\r
+                    \r
+                </fieldset>\r
+                \r
+                <br style="clear: both;">\r
+                <button type="submit">Install Test CMS</button>\r
+            </form>\r
+        </div>\r
+        \r
+        <?php endif; ?>\r
+\r
+    </body>\r
+</html>\r