-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
347 lines (310 loc) · 12.9 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<?php
include_once(dirname(__FILE__) . '/smc/core/libraries/Session.php');
SessionManager::sessionStart('SMC');
$filePresent = null;
$configDir = dirname(__FILE__) . '/smc/config/';
$file = 'config.ini.php';
if (!file_exists($configDir . $file)):
$feedback = '<span class="notice warning">' .
'Your smc configuration file is NOT present.<br>' .
'Rename ' . $configDir . '<strong>config.ini.php.default</strong> to ' .
$configDir . '<strong>config.ini.php</strong>' .
'</span>';
die($feedback);
endif;
if(!defined('PRE_FLIGHT')) {
define('PRE_FLIGHT', true);
}
include_once(dirname(__FILE__) . '/smc/config/config.ini.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SimpleMC Setup</title>
<style type="text/css">
body {
font:95%/1.125em "Lucida Grande", "Trebuchet MS", Verdana, san-serif;
text-align: center;
background: #F5F5F5;
margin:0;
padding: 1em
}
a {
color: #006699;
text-decoration: underline
}
a:hover {
text-decoration: none
}
li {
line-height: 1.6em
}
#container {
text-align: left;
width: 890px;
margin-left: auto;
margin-right: auto;
background: #FFF;
color: #000;
padding: 3em;
font-size: 90%;
border: 1px solid #CCC
}
div#logo {
background: #000000 url(smc/core/support/images/bg/login.jpg) no-repeat left top;
height: 8em;
margin-bottom: 2em
}
div#logo * {
display: none
}
h2 {
margin-top: 2em;
margin-bottom: 1em;
color: #355A8C
}
span {
display:block
}
div#auth {
float: right
}
div#auth li {
display: inline;
list-style: none
}
div#auth a {
margin-left: .3em
}
p#firebug {
display:none
}
.error,
.notice,
.success {
padding:.8em;
margin-bottom:1em;
border:2px solid #ddd
}
.error {
background:#FBE3E4;
color:#8a1f11;
border-color:#FBC2C4
}
.notice {
background:#FFF6BF;
color:#514721;
border-color:#FFD324
}
.success {
background:#E6EFC2;
color:#264409;
border-color:#C6D880
}
.error a {
color:#8a1f11
}
.notice a {
color:#514721
}
.success a {
color:#264409
}
.show {display: block}
</style>
</head>
<body>
<div id="container">
<div id="logo"><h1>SimpleMC</h1><p>Simple Managed Content</p></div>
<div id="auth">
<ul>
<?php if($_SESSION['loggedIn'] === false): ?>
<li><a href="/smc/">Login</a></li>
<?php else: ?>
<li><a href="/smc/tmp/demo/">View the Demo</a></li>
<li><a href="/smc/logout.php">Logout</a></li>
<?php endif; ?>
</ul>
</div>
<ul>
<li><strong>Code</strong>:
<a href="http://github.com/leveille/simple-mc/tree/master">
http://github.com/leveille/simplemc/tree/master</a>
</li>
<li><strong>Issue Tracker</strong>:
<a href="http://leveille.lighthouseapp.com/projects/24238-simple-mc/overview">
http://leveille.lighthouseapp.com/projects/24238-simple-mc/overview
</a>
</li>
<li><strong>Live Demo</strong>:
<a href="http://smc.jasonleveille.com/">
http://smc.jasonleveille.com/</a> - <strong>un: admin pw: admin OR un: editor pw: editor</strong>
</li>
<li><strong>Google Group</strong>:
<a href="http://groups.google.com/group/simple_mc">
http://groups.google.com/group/simple_mc</a>
</li>
<li><strong>A product of</strong>:
<a href="http://www.blueatlas.com">Blue Atlas Interactive</a>
</li>
</ul>
<h2>Introduction</h2>
<p>SimpleMC is meant to provide an easy way for content editors
to edit blocks of content. It is meant for smaller sites, where clients
just want to get in, edit some content, and get out.</p>
<h2>Pre-flight Check</h2>
<!--
Pre-flight check inspired by cakephp preflight check
http://cakephp.org/
license: https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/LICENSE.txt
-->
<p>
<?php
if (is_writable(SMC_CACHE)):
echo '<span class="notice success">',
'Your cache directory is writable.',
'</span>';
else:
echo '<span class="notice warning">',
'Your cache directory is NOT writable.<br>',
'<strong>Please:</strong> chmod 777 ', SMC_CACHE,
'</span>';
endif;
?>
</p>
<p>
<?php
if (is_writable(SMC_LOGS)):
echo '<span class="notice success">',
'Your log directory is writable.',
'</span>';
else:
echo '<span class="notice warning">',
'Your log directory is NOT writable.<br>',
'<strong>Please:</strong> chmod 777 ', SMC_LOGS,
'</span>';
endif;
?>
</p>
<p>
<?php
$dir = SMC_HTML_PURIFIER .
'/standalone/HTMLPurifier/DefinitionCache/Serializer';
if (is_writable($dir)):
echo '<span class="notice success">',
'The necessary htmlpurifier directory is writable.',
'</span>';
else:
echo '<span class="notice warning">',
'The necessary htmlpurifier directory is NOT writable.<br>',
'<strong>Please: </strong> chmod 777 -R ', $dir, '</span>';
endif;
?>
</p>
<p>
<?php
$filePresent = null;
if (file_exists(SMC_CONFIG . '/database.config.php')):
echo '<span class="notice success">',
'Your database configuration file is present.';
$filePresent = true;
echo '</span>';
else:
echo '<span class="notice warning">',
'Your database configuration file is NOT present.',
'<br>',
'Rename ', SMC_CONFIG, '/<strong>database.config.php.default</strong> to ',
SMC_CONFIG, '/<strong>database.config.php</strong>',
'</span>';
endif;
?>
</p>
<?php
if (isset($filePresent)):
?>
<p>
<?php
if (Database::isConnected()):
echo '<span class="notice success">',
'SimpleMC is able to connect to the database.',
'</span>';
else:
echo '<span class="notice warning">',
'SimpleMC is NOT able to connect to the database. Please check your ',
'database connection information.',
'</span>';
endif;
?>
</p>
<?php endif;?>
<p id="firebug" class="notice warning"></p>
<h2>Requirements</h2>
<ol>
<li>PHP 5.0.5+</li>
<li>MySQL 5.0+</li>
</ol>
<h2>Simple MC Sample File Setup</h2>
<ol>
<li>Download and unzip SimpleMC to your desired location.</li>
<ul>
<li>At this point you should have a directory structure that
looks similar to:<br>
/root<br>
-index.php<br>
-/smc<br>
</li>
</ul>
<li>Create a mysql database for your project</li>
<li>Import the sql file into your new database, located at
/smc/config/sql/smc.sql</li>
<li>Duplicate the database connection file located at
/smc/config/database.config.php.default. Call it database.config.php.</li>
<li>Modify the database connection information for the database
connection file you just created.</li>
<li>Take a look at /smc/config/config.ini.php and modify it if necessary.</li>
<li><a href="/smc/">Login to the administrator.</a>
<ul>
<li>un1: admin OR un2: editor</li>
<li>pw1: admin OR pw2: editor</li>
</ul>
</li>
<li>Add some content blocks.</li>
<li>Use the <a href="smc/core/docs/usage.txt">sample layout page</a>
as a guide to what you should include and where you should include it.</li>
<li>This project uses FCKEditor. You may need to
<a href="http://www.fckeditor.net/">visit the FCKEditor site</a>
and investigate customizing FCKEditor to allow file uploads, etc.</li>
<li>Have fun!</li>
</ol>
<h2 id="demo-instructions">Running the Demo Application</h2>
<p>This project does come with a (quickly hobbled together) demonstration application.</p>
<ol>
<li><strong>FYI</strong>, even though the demo is located in the smc directory,
it is strongly advised that you do NOT create your site files in the smc directory.
Instead, drop the smc directory in your site root and reference the necessary files. </li>
<li>Import the /smc/config/sql/smc_demo.sql file into the blocks table that
you should have in your SimpleMC database</li>
<li>If you haven't already, <a href="smc/">login to the administrator.</a>
<ul>
<li>un1: admin OR un2: editor</li>
<li>pw1: admin OR pw2: editor</li>
</ul>
</li>
<li><a href="<?php echo SMC_DEMO_REL; ?>">Visit the demo</a>.</li>
</ol>
</div>
<script type="text/javascript">
window.onload = function () {
//check to see if firebug is installed and enabled
if (window.console && console.firebug) {
var firebug = document.getElementById('firebug');
firebug.style.display = 'block';
firebug.innerHTML = 'It appears that <strong>you have firebug' +
' enabled</strong>. Using firebug with SimpleMC will cause' +
' <strong>significant performance degradation</strong>.';
}
}
</script>
</body>
</html>