add cms, add todo
[ssproject1617.git] / testcms-final-anon / install / index.php
1 <!doctype html>
2 <html lang="en-gb">
3 <head>
4 <meta charset="utf-8">
5 <title>Install Test CMS CMS</title>
6 <mate name="robots" content="noindex, nofollow">
7
8 <link rel="stylesheet" href="assets/css/app.css">
9
10 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
11 <script>window.jQuery || document.write('<script src="assets/js/jquery.js"><\/script>');</script>
12 <script src="assets/js/app.js"></script>
13 </head>
14 <body>
15
16 <h1><img src="assets/img/logo.gif" alt="Test CMS install logo"></h1>
17
18 <?php
19
20 /*
21 Compatibility checks
22 */
23 $compat = array();
24
25 // php
26 if(version_compare(PHP_VERSION, '5.3.0', '<')) {
27 $compat[] = 'Test CMS requires PHP 5.3 or newer.<br><em>Your current environment is running PHP ' . PHP_VERSION . '</em>';
28 }
29
30 // PDO
31 if(class_exists('PDO') === false) {
32 $compat[] = 'Test CMS requires PDO (PHP Data Objects)<br>
33 <em>You can find more about <a href="//php.net/manual/en/book.pdo.php">installing and setting up PHP Data Objects</a>
34 on the php.net website</em>';
35 } else {
36 if(in_array('mysql', PDO::getAvailableDrivers()) === false) {
37 $compat[] = 'Test CMS requires the MySQL PDO Driver<br>
38 <em>You can find more about <a href="//php.net/manual/en/ref.pdo-mysql.php">installing and setting up MySQL PDO Driver</a>
39 on the php.net website</em>';
40 }
41 }
42
43 // can we write a config file?
44 // note: on win the only way to really test is to try and write a new file to disk.
45 if(@file_put_contents('../test.php', '<?php //test') === false) {
46 $compat[] = 'It looks like the root directory is not writable, we may not be able to automatically create your config.php file.
47 Please make the root directory writable until the installation is complete.';
48 } else {
49 unlink('../test.php');
50 }
51
52 ?>
53
54 <?php if(count($compat)): ?>
55
56 <div class="content">
57 <h2>Woops.</h2>
58
59 <p>Test CMS is missing some requirements:</p>
60
61 <ul style="padding-bottom: 1em;">
62 <?php foreach($compat as $item): ?>
63 <li><?php echo $item; ?></li>
64 <?php endforeach; ?>
65 </ul>
66
67 <p><a href="." class="button" style="float: none; display: inline-block;">Ok, I've fixed these, run the installer.</a></p>
68 </div>
69
70 <?php elseif(file_exists('../config.php')): ?>
71
72 <div class="content">
73 <h2>Woops.</h2>
74
75 <p>Test CMS is already installed. You should really delete this folder!</p>
76
77 <p><a href="../" class="button" style="float: none; display: inline-block;">Return to the main site.</a></p>
78 </div>
79
80 <?php else: ?>
81
82 <p class="nojs error">You will need Javascript enabled for this installation. <em>Sorry :(</em></p>
83
84 <div class="content">
85 <h2>Welcome to Test CMS.</h2>
86
87 <p>If you were looking for a truly lightweight blogging experience, you&rsquo;ve
88 found the right place. Simply fill in the details below, and you&rsquo;ll have your
89 new blog set up in no time.</p>
90
91 <small>If you want a more custom install, feel free to edit <code>config.default.php</code>
92 (before or after this installation, it doesn't really matter, as long as you rename it to
93 <code>config.php</code>).</small>
94
95 <div class="notes"></div>
96
97 <form method="get" novalidate>
98 <fieldset id="diagnose">
99 <legend>Your database details</legend>
100
101 <p>
102 <label for="host">Your database host:</label>
103 <input id="host" name="host" value="localhost">
104 </p>
105 <p>
106 <label for="user">Your database username:</label>
107 <input id="user" autocapitalize="off" name="user" placeholder="root">
108 </p>
109 <p>
110 <label for="pass">Your database password:</label>
111 <input id="pass" autocapitalize="off" name="pass" placeholder="password">
112 </p>
113 <p>
114 <label for="db">Your database name:</label>
115 <input id="db" autocapitalize="off" name="db" placeholder="Test CMS">
116 </p>
117
118 <a href="#check" class="button">Check database details</a>
119 </fieldset>
120
121 <fieldset>
122 <legend>About your site</legend>
123
124 <p>
125 <label for="name">Site name:</label>
126 <input id="name" name="name" placeholder="My awesome Test CMS site">
127 </p>
128
129 <p>
130 <label for="description">Site description:</label>
131 <textarea id="description" name="description"></textarea>
132 </p>
133
134 <p>
135 <label for="theme">Theme:</label>
136 <select id="theme" name="theme">
137 <?php foreach(glob('../themes/*') as $theme): $name = basename($theme); ?>
138 <?php if(file_exists($theme . '/about.txt')): ?>
139 <option value="<?php echo $name; ?>" <?php if($name === 'default') echo 'selected'; ?>><?php echo ucwords($name); ?></option>
140 <?php endif; ?>
141 <?php endforeach; ?>
142 </select>
143 </p>
144
145 <p>
146 <label for="email">Your Email Address:</label>
147 <input id="email" name="email">
148 </p>
149
150 <p>
151 <label for="path">Site path:</label>
152 <input id="path" name="path" value="<?php echo dirname(dirname($_SERVER['SCRIPT_NAME'])); ?>">
153 </p>
154
155 </fieldset>
156
157 <br style="clear: both;">
158 <button type="submit">Install Test CMS</button>
159 </form>
160 </div>
161
162 <?php endif; ?>
163
164 </body>
165 </html>