-
Notifications
You must be signed in to change notification settings - Fork 6
/
blogfile.php
3150 lines (2808 loc) · 125 KB
/
blogfile.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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*******************************************************************************
*******************************************************************************
**
** BlogFile - The blog in a single PHP file
**
** @author Samuel Levy <[email protected]>
**
** @version 1.0
**
** @copyright (C) 2012 Samuel Levy <[email protected]>
**
** @license http://sam.zoy.org/wtfpl/ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
**
*******************************************************************************
******************************************************************************/
// FIRST - define the thing that everyone will want to change... The Templates!
ob_start();
?>
<%%STARTTEMPLATE BLOG_TITLE%%>A Blogfile Blog<%%ENDTEMPLATE BLOG_TITLE%%>
<%%STARTTEMPLATE MAIN_HTML%%>
<!DOCTYPE html>
<html>
<head>
<title><%%OPENSLOT PAGE_TITLE%%></title>
<style type="text/css"><%%USETEMPLATE MAIN_CSS%%></style>
</head>
<body>
<div id="leftcolumn">
<div id="sitetitle"><a href="<%%OPENSLOT SITE_HOME%%>"><%%OPENSLOT SITE_TITLE%%></a></div>
<div id="siteextra"><%%OPENSLOT SITE_EXTRA%%></div>
<div id="sitemenu"><%%USETEMPLATE MAIN_MENU%%></div>
</div>
<div id="rightcolumn">
<div id="maincontent"><%%OPENSLOT MAIN_CONTENT%%></div>
</div>
</body>
</html>
<%%ENDTEMPLATE MAIN_HTML%%>
<!-- style tags are only to help code highlighters. They are not included in the template -->
<style>
<%%STARTTEMPLATE MAIN_CSS%%>
/** CSS reset **/
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* Now the blog's styles! */
body {
font-family: verdana, helvetica, arial, sans-serif;
}
p {
margin: 1.12em 0;
}
p:first-child {
margin-top: 0px;
}
em {
font-style: italic;
}
strong {
font-weight: bold;
}
code {
font-family: monospace;
}
.st {
text-decoration: line-through;
}
a {
color: #666666;
text-decoration: none;
text-shadow:2px 2px 2px #CCCCCC;
}
a:hover {
color: #AAAAAA;
}
/* Layout */
#leftcolumn {
width:300px;
position:absolute;
left: 0px;
top: 0px;
height:100%;
/* IE10 */
background-image: -ms-linear-gradient(left, #FFFFFF 95%, #EEEEEE 100%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(left, #FFFFFF 95%, #EEEEEE 100%);
/* Opera */
background-image: -o-linear-gradient(left, #FFFFFF 95%, #EEEEEE 100%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, right top, color-stop(0.95, #FFFFFF), color-stop(1, #EEEEEE));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(left, #FFFFFF 95%, #EEEEEE 100%);
/* Proposed W3C Markup */
background-image: linear-gradient(left, #FFFFFF 95%, #EEEEEE 100%);
}
#rightcolumn {
position:absolute;
left: 300px;
top: 0px;
right:0px;
height:100%;
background-color: #EEEEEE;
}
/* Left side */
#sitetitle {
font-size: xx-large;
font-weight: bold;
margin:20px 10px 20px 10px;
}
#sitetitle a {
text-shadow:2px 2px 2px #CCCCCC;
}
#siteextra {
margin:20px 10px 20px 30px;
color: #999999;
font-size: medium;
font-style: italic;
text-shadow:2px 2px 2px #EEEEEE;
}
#mainmenu {
width: 290px;
margin-left: 10px;
margin-right: 0px;
margin-top: 50px;
overflow-y: auto;
overflow-x: hidden;
}
.menuitem {
display:block;
width: 100%;
}
.menuitem a {
display: block;
width: 100%;
background: none;
padding: 3px 0px;
}
.menuitem a:hover {
/* IE10 */
background-image: -ms-linear-gradient(left, #FFFFFF 80%, #EEEEEE 85%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(left, #FFFFFF 80%, #EEEEEE 85%);
/* Opera */
background-image: -o-linear-gradient(left, #FFFFFF 80%, #EEEEEE 85%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, right top, color-stop(0.8, #FFFFFF), color-stop(0.85, #EEEEEE));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(left, #FFFFFF 80%, #EEEEEE 85%);
/* Proposed W3C Markup */
background-image: linear-gradient(left, #FFFFFF 80%, #EEEEEE 85%);
}
.menuitem a.current {
/* IE10 */
background-image: -ms-linear-gradient(left, #FFFFFF 0%, #EEEEEE 5%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(left, #FFFFFF 0%, #EEEEEE 5%);
/* Opera */
background-image: -o-linear-gradient(left, #FFFFFF 0%, #EEEEEE 5%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, right top, color-stop(0.0, #FFFFFF), color-stop(0.05, #EEEEEE));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(left, #FFFFFF 0%, #EEEEEE 5%);
/* Proposed W3C Markup */
background-image: linear-gradient(left, #FFFFFF 0%, #EEEEEE 5%);
}
/* Right side */
#maincontent {
margin: 0px 0px 20px 10px;
height: 100%;
overflow-y: auto;
}
.contentwrapper {
margin: 10px 30px 10px 20px;
background: #FFFFFF;
padding: 10px;
border: 1px solid #F7F7F7;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
-khtml-border-radius: 8px;
border-radius: 8px;
}
.blogtitle, .pagetitle {
font-size: x-large;
margin-bottom: 0.8em;
border-bottom: solid #EEEEEE 1px;
color: #333333;
}
.popularitysummary {
border-top: dashed 1px #EEEEEE;
margin-top: 0.3em;
padding-top: 0.3em;
}
.readmore {
float: right;
}
.commentcount {
float: left;
}
.byline {
font-size: x-small;
font-style: italic;
color: #999999;
float:right;
margin-top: -1.5em;
}
.adminlinks {
float:right;
}
.comment {
margin: 3px;
padding: 5px;
background: #F7F7F7;
border: dashed 1px #EEEEEE;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
border-radius: 5px;
}
.commentdate {
float: right;
}
.commentinfo {
border-bottom: dashed 1px #DDDDDD;
padding-bottom: 3px;
margin-bottom: 0.8em;
}
.dead {
color: #AAAAAA;
}
.owner {
background: #EEEEF7;
}
/* common elements */
.visclear {
margin: 0px !important;
padding: 0px !important;
clear: both;
height: 0px;
overflow: hidden;
}
.pglinks {
margin: 10px 30px 10px 20px;
}
.pglinks .pgright {
float: right;
}
.pglinks .pgleft {
float: left;
}
.pglinks a {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
padding: 3px;
border: 1px solid #F7F7F7;
}
.pglinks .pgleft a {
/* IE10 */
background-image: -ms-linear-gradient(left, #FFFFFF 0%, #EEEEEE 85%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(left, #FFFFFF 0%, #EEEEEE 85%);
/* Opera */
background-image: -o-linear-gradient(left, #FFFFFF 0%, #EEEEEE 85%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #FFFFFF), color-stop(0.85, #EEEEEE));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(left, #FFFFFF 0%, #EEEEEE 85%);
/* Proposed W3C Markup */
background-image: linear-gradient(left, #FFFFFF 0%, #EEEEEE 85%);
border-right:none;
}
.pglinks .pgright a {
/* IE10 */
background-image: -ms-linear-gradient(left, #EEEEEE 15%, #FFFFFF 100%);
/* Mozilla Firefox */
background-image: -moz-linear-gradient(left, #EEEEEE 15%, #FFFFFF 100%);
/* Opera */
background-image: -o-linear-gradient(left, #EEEEEE 15%, #FFFFFF 100%);
/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, right top, color-stop(0.15, #EEEEEE), color-stop(1, #FFFFFF));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(left, #EEEEEE 15%, #FFFFFF 100%);
/* Proposed W3C Markup */
background-image: linear-gradient(left, #EEEEEE 15%, #FFFFFF 100%);
border-left:none;
}
/* Forms */
.formfield {
font-weight: bold;
margin-top: 5px;
margin-bottom: 8px;
margin-left: 15px;
text-transform:capitalize;
}
.formfield input {
margin-left: 18px;
width: 300px;
}
.formfield input.shortfield {
width: 50px;
}
.formfield textarea {
margin-left: 18px;
width: 300px;
height: 160px;
}
.formfield textarea.bigfield {
margin-left: 18px;
width: 500px;
height: 360px;
}
.formfield .explain {
font-weight: normal;
font-size: small;
font-style: italic;
color: #AAAAAA;
margin-left: 5px;
display: inline-block;
overflow: hidden;
white-space: nowrap;
width: 3ex;
height: 1.2em;
line-height: 1.2em;
text-transform: none;
background: #FFFFFF;
vertical-align: top;
}
.formfield .explain:before {
content: "(?) ";
font-style: normal;
}
.formfield .explain:hover {
width: auto;
max-width: 300px;
white-space: normal;
overflow: visible;
padding-left: 3ex;
text-indent: -3ex;
}
#whinney{
overflow: hidden;
width:0px;
height:0px;
margin:0px;
padding:0px;
}
.error {
color:#660000;
background-color: #FF9999;
border: 2px #993333 solid;
font-weight: bold;
margin:3px;
padding: 8px;
display: none;
}
.error.visible {
display:block;
}
.mention {
color:#AA6666;
background: #F7F7F7;
border: dashed 1px #AA6666;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
border-radius: 5px;
margin: 8px 3px;
padding: 5px;
display: none;
}
.mention.visible {
display:block;
}
.listtable {
width: 100%;
border-collapse: collapse;
}
.listtable td, .listtable th {
padding: 3px;
width: 200px;
}
.listtable td {
border-top: dashed #EEEEEE 1px;
}
.listtable tr td:first-child, .listtable tr th:first-child {
width: auto;
}
.listtable tr:hover td {
background: #EEEEFF;
}
<%%ENDTEMPLATE MAIN_CSS%%>
</style>
<!-- menu templates -->
<%%STARTTEMPLATE MAIN_MENU%%>
<ol id="mainmenu">
<%%OPENSLOT MENU_ITEMS%%>
</ol>
<%%ENDTEMPLATE MAIN_MENU%%>
<%%STARTTEMPLATE MENU_ITEM%%>
<li class="menuitem"><a href="<%%OPENSLOT LINK_URL%%>" class="<%%OPENSLOT LINK_CLASS%%>"><%%OPENSLOT LINK_TEXT%%></a></li>
<%%ENDTEMPLATE MENU_ITEM%%>
<%%STARTTEMPLATE MENU_TEXT%%>
<li class="menuitem"><%%OPENSLOT LINK_TEXT%%></li>
<%%ENDTEMPLATE MENU_TEXT%%>
<!-- blog templates -->
<%%STARTTEMPLATE BLOG_SUMMARY%%>
<div class="blogsummarywrapper contentwrapper">
<div class="blogsummary">
<h2 class="blogtitle">
<a href="<%%OPENSLOT BLOG_URL%%>"><%%OPENSLOT BLOG_TITLE%%></a>
</h2>
<div class="blogcontent">
<%%OPENSLOT BLOG_SUMMARY%%>
</div>
</div>
<div class="popularitysummary">
<div class="readmore">
<a href="<%%OPENSLOT BLOG_URL%%>">read more…</a>
</div>
<div class="commentcount">
<a href="<%%OPENSLOT BLOG_URL%%>#comments"><%%OPENSLOT COMMENT_COUNT%%></a>
</div>
<div class="visclear"> </div>
</div>
</div>
<%%ENDTEMPLATE BLOG_SUMMARY%%>
<%%STARTTEMPLATE BLOG_FULL%%>
<div class="blogwrapper contentwrapper">
<div class="blog">
<h2 class="blogtitle"><%%OPENSLOT BLOG_TITLE%%></h2>
<div class="byline"><%%OPENSLOT BYLINE%%></div>
<div class="blogcontent">
<%%OPENSLOT BLOG_CONTENT%%>
</div>
<div class="popularitysummary">
<%%OPENSLOT ADMIN_LINKS%%>
<div class="commentcount">
<a href="#comments"><%%OPENSLOT COMMENT_COUNT%%></a>
</div>
<div class="visclear"> </div>
</div>
</div>
<div class="commentswrapper">
<%%OPENSLOT COMMENT_FORM%%>
<a name="comments"></a>
<%%OPENSLOT BLOG_COMMENTS%%>
</div>
</div>
<%%ENDTEMPLATE BLOG_FULL%%>
<%%STARTTEMPLATE POST_EDIT%%>
<form method="POST" class="contentwrapper">
<input type="hidden" name="p" value="savepost" />
<input type="hidden" name="id" value="<%%OPENSLOT POST_ID%%>" />
<input type="hidden" name="type" value="<%%OPENSLOT POST_TYPE%%>" />
<div class="error <%%OPENSLOT POST_ERROR%%>"><%%OPENSLOT ERROR_MESSAGE%%></div>
<div class="formfield">
<%%OPENSLOT POST_TYPE%%> title<br />
<input type="text" name="title" value="<%%OPENSLOT POST_TITLE%%>" />
</div>
<div class="formfield">
<%%OPENSLOT POST_TYPE%%> content<br />
<textarea name="content" class="bigfield"><%%OPENSLOT POST_CONTENT%%></textarea>
<%%USETEMPLATE MARKDOWN_EXPLAIN_FULL%%>
</div>
<div class="formfield">
<input type="checkbox" name="published" class="shortfield"<%%OPENSLOT POST_PUBLISHED%%> />
Published
</div>
<%%OPENSLOT POST_COMMENTS%%>
<input type="submit" value="Save" />
</form>
<%%ENDTEMPLATE POST_EDIT%%>
<%%STARTTEMPLATE BLOG_COMMENTS_LOCKED%%>
<div class="formfield">
<input type="checkbox" name="comments" class="shortfield"<%%OPENSLOT COMMENTS_LOCKED%%> />
Comments Locked
</div>
<%%ENDTEMPLATE BLOG_COMMENTS_LOCKED%%>
<!-- comment templates -->
<%%STARTTEMPLATE BLOG_COMMENT%%>
<div class="comment<%%OPENSLOT EXTRA_CLASS%%>">
<div class="commentinfo">
<a name="comment-<%%OPENSLOT COMMENT_ID%%>"></a>
<div class="commentdate">
<a href="#comment-<%%OPENSLOT COMMENT_ID%%>" title="Comment <%%OPENSLOT COMMENT_ID%%>"><%%OPENSLOT COMMENT_DATE%%></a>
</div>
<div class="commentername"><%%OPENSLOT COMMENTER_NAME%%></div>
</div>
<div class="commentbody">
<%%OPENSLOT COMMENT_BODY%%>
</div>
<%%OPENSLOT ADMIN_LINKS%%>
<div class="visclear"> </div>
</div>
<%%ENDTEMPLATE BLOG_COMMENT%%>
<%%STARTTEMPLATE COMMENTER_ANONYMOUS%%>Anonymous<%%ENDTEMPLATE COMMENTER_ANONYMOUS%%>
<%%STARTTEMPLATE COMMENTER_URL%%>
<a href="<%%OPENSLOT URL%%>"><%%OPENSLOT NAME%%></a>
<%%ENDTEMPLATE COMMENTER_URL%%>
<%%STARTTEMPLATE COMMENT_ADMIN_LINKS%%>
<div class="adminlinks">
<a href="<%%OPENSLOT PAGE_BASE%%>?p=editcomment&id=<%%OPENSLOT COMMENT_ID%%>">edit comment</a> |
<a href="<%%OPENSLOT PAGE_BASE%%>?p=<%%OPENSLOT KILL_OR_REVIVE%%>comment&id=<%%OPENSLOT COMMENT_ID%%>"><%%OPENSLOT KILL_OR_REVIVE%%> comment</a> |
<a href="<%%OPENSLOT PAGE_BASE%%>?p=deletecomment&id=<%%OPENSLOT COMMENT_ID%%>">delete comment</a>
</div>
<%%ENDTEMPLATE COMMENT_ADMIN_LINKS%%>
<%%STARTTEMPLATE BLOG_ADMIN_LINKS%%>
<div class="adminlinks">
<a href="<%%OPENSLOT PAGE_BASE%%>?p=editpost&id=<%%OPENSLOT POST_ID%%>">edit post</a>
</div>
<%%ENDTEMPLATE BLOG_ADMIN_LINKS%%>
<%%STARTTEMPLATE COMMENTS_LOCKED%%>
<div class="mention visible">
Comments have been locked for this post.
</div>
<%%ENDTEMPLATE COMMENTS_LOCKED%%>
<%%STARTTEMPLATE NO_COMMENTS%%>
<div class="mention visible">
There are no comments yet.
</div>
<%%ENDTEMPLATE NO_COMMENTS%%>
<%%STARTTEMPLATE ADMIN_COMMENT_FORM%%>
<form method="POST">
<a name="commentform"></a>
<input type="hidden" name="p" value="comment" />
<input type="hidden" name="blogid" value="<%%OPENSLOT BLOG_ID%%>" />
<div class="formfield">
Comment<br />
<textarea name="cbody" id="commentfield"></textarea>
<%%USETEMPLATE MARKDOWN_EXPLAIN%%>
</div>
<input type="submit" value="Post Comment" />
</form>
<%%ENDTEMPLATE ADMIN_COMMENT_FORM%%>
<%%STARTTEMPLATE COMMENT_FORM%%>
<form method="POST">
<a name="commentform"></a>
<input type="hidden" name="p" value="comment" />
<input type="hidden" name="blogid" value="<%%OPENSLOT BLOG_ID%%>" />
<%%USETEMPLATE ANTI_SPAM%%>
<div class="formfield">
Name<br />
<input type="text" name="cname" value="<%%OPENSLOT COMMENTER_NAME%%>" />
</div>
<div class="formfield">
Web<br />
<input type="url" name="cweb" value="<%%OPENSLOT COMMENTER_URL%%>" />
</div>
<div class="formfield">
Comment<br />
<textarea name="cbody" id="commentfield"></textarea>
<%%USETEMPLATE MARKDOWN_EXPLAIN%%>
</div>
<input type="submit" value="Post Comment" />
</form>
<%%ENDTEMPLATE COMMENT_FORM%%>
<%%STARTTEMPLATE MARKDOWN_EXPLAIN%%>
<div class="explain">
Basic markdown is as follows:<br />
Words _like this_ become itallic<br />
Words *like this* become bold<br />
Words #like this# become mono-spaced<br />
Words -like this- become struck-through
</div>
<%%ENDTEMPLATE MARKDOWN_EXPLAIN%%>
<%%STARTTEMPLATE MARKDOWN_EXPLAIN_FULL%%>
<div class="explain">
Basic markdown is as follows:<br />
Words _like this_ become itallic<br />
Words *like this* become bold<br />
Words #like this# become mono-spaced<br />
Words -like this- become struck-through<br />
Links will be automatically converted<br />
You can name a link [http://example.com like this]
</div>
<%%ENDTEMPLATE MARKDOWN_EXPLAIN_FULL%%>
<%%STARTTEMPLATE EDIT_COMMENT%%>
<form method="POST" class="contentwrapper">
<input type="hidden" name="p" value="savecomment" />
<input type="hidden" name="commentid" value="<%%OPENSLOT COMMENT_ID%%>" />
<div class="error <%%OPENSLOT COMMENT_ERROR%%>"><%%OPENSLOT ERROR_MESSAGE%%></div>
<div class="formfield">
Name<br />
<input type="text" name="name" value="<%%OPENSLOT COMMENTER_NAME%%>" />
</div>
<div class="formfield">
Web<br />
<input type="url" name="web" value="<%%OPENSLOT COMMENTER_URL%%>" />
</div>
<div class="formfield">
Comment<br />
<textarea name="comment"><%%OPENSLOT COMMENT%%></textarea>
<%%USETEMPLATE MARKDOWN_EXPLAIN%%>
</div>
<div class="formfield">
Comment status: <%%OPENSLOT STATUS%%>
</div>
<input type="submit" value="Save Comment" />
</form>
<%%ENDTEMPLATE EDIT_COMMENT%%>
<!-- These are dummy fields which aren't actually visible - they're a honeypot for screen scrapers -->
<%%STARTTEMPLATE ANTI_SPAM%%>
<div id="whinney">
<input type="text" name="name" />
<input type="email" name="email" />
<input type="text" name="url" />
<textarea name="comments"></textarea>
<!-- and some other fields for user verification -->
<input type="hidden" name="ver1" value="<%%OPENSLOT USER_IP%%>" />
<input type="hidden" name="ver2" value="<%%OPENSLOT USER_HASH%%>" />
</div>
<%%ENDTEMPLATE ANTI_SPAM%%>
<!-- Actual pages -->
<%%STARTTEMPLATE LOGIN_PAGE%%>
<form method="POST" class="contentwrapper">
<input type="hidden" name="p" value="login" />
<div class="error <%%OPENSLOT LOGIN_ERROR%%>">Password is incorrect. Try again.</div>
<div class="formfield">
Password<br />
<input type="password" name="password" />
</div>
<input type="submit" value="Log in" />
</form>
<%%ENDTEMPLATE LOGIN_PAGE%%>
<%%STARTTEMPLATE NO_POSTS%%>
<div class="contentwrapper">
<h2>These are not the posts you're looking for...</h2>
<p>Because there's nothing here.</p>
</div>
<%%ENDTEMPLATE NO_POSTS%%>
<%%STARTTEMPLATE PAGE%%>
<div class="pagewrapper contentwrapper">
<div class="page">
<h2 class="pagetitle"><%%OPENSLOT PAGE_TITLE%%></h2>
<div class="pagecontent">
<%%OPENSLOT PAGE_CONTENT%%>
</div>
<%%OPENSLOT ADMIN_LINKS%%>
<div class="visclear"> </div>
</div>
</div>
<%%ENDTEMPLATE PAGE%%>
<%%STARTTEMPLATE PAGE_ADMIN_LINKS%%>
<div class="adminlinks">
<a href="<%%OPENSLOT PAGE_BASE%%>?p=editpage&id=<%%OPENSLOT POST_ID%%>">edit page</a>
</div>
<%%ENDTEMPLATE PAGE_ADMIN_LINKS%%>
<!-- Admin pages -->
<%%STARTTEMPLATE LIST_POSTS%%>
<div class="pagewrapper contentwrapper">
<div class="page">
<h2 class="pagetitle">View all <%%OPENSLOT POST_TYPE%%>s</h2>
<div class="pagecontent">
<%%OPENSLOT PAGE_CONTENT%%>
</div>
</div>
</div>
<%%ENDTEMPLATE LIST_POSTS%%>
<%%STARTTEMPLATE LIST_NO_POSTS%%>
<div class="mention visible">
There are no <%%OPENSLOT POST_TYPE%%>s. Would you like to <a href="<%%OPENSLOT URL_BASE%%>?p=add<%%OPENSLOT POST_TYPE%%>">add one</a>?
</div>
<%%ENDTEMPLATE LIST_NO_POSTS%%>
<%%STARTTEMPLATE LIST_POSTS_TABLE%%>
<table class="listtable">
<tr>
<th>Title</th>
<th>Published?</th>
<th>Permanently Delete</th>
</tr>
<%%OPENSLOT POST_LIST%%>
</table>
<%%ENDTEMPLATE LIST_POSTS_TABLE%%>
<%%STARTTEMPLATE LIST_POSTS_ITEM%%>
<tr>
<td><a href="<%%OPENSLOT URL_BASE%%>?p=edit<%%OPENSLOT POST_TYPE%%>&id=<%%OPENSLOT POST_ID%%>"><%%OPENSLOT POST_TITLE%%></a></td>
<td><%%OPENSLOT POST_PUBLISHED%%></td>
<td>
<form method="POST">
<input type="hidden" name="p" value="delete<%%OPENSLOT POST_TYPE%%>" />
<input type="hidden" name="id" value="<%%OPENSLOT POST_ID%%>" />
<input type="checkbox" name="confirm" />
Confirm
<input type="submit" value="Delete" />
</form>
</td>
</tr>
<%%ENDTEMPLATE LIST_POSTS_ITEM%%>
<%%STARTTEMPLATE SETTINGS_FORM%%>
<form method="POST" class="contentwrapper">
<input type="hidden" name="p" value="savesettings" />
<div class="mention<%%OPENSLOT SETTINGS_SAVED%%>">
Settings saved.
</div>
<div class="formfield">
Password<br />
<input type="text" name="password" />
<div class="explain">Only set this if you want to change settings</div>
</div>
<div class="formfield">
Your Name<br />
<input type="text" name="displayname" value="<%%OPENSLOT SETTING_displayname%%>" />
<div class="explain">This will be shown on your comments and posts. Cannot be blank.</div>
</div>
<div class="formfield">
Site title<br />
<input type="text" name="sitetitle" value="<%%OPENSLOT SETTING_sitetitle%%>" />
<div class="explain">The large text at the top left. Cannot be blank.</div>
</div>
<div class="formfield">
Site extra<br />
<input type="text" name="siteextra" value="<%%OPENSLOT SETTING_siteextra%%>" />
<div class="explain">The smaller text under the site title</div>
</div>
<div class="formfield">
Number of posts on the home page<br />
<input type="number" name="homepage_posts" min="1" step="1" value="<%%OPENSLOT SETTING_homepage_posts%%>" />
<div class="explain">Minimum 1 - anything lower will return to the default</div>
</div>
<div class="formfield">
<input type="checkbox" name="allowcommenturls" class="shortfield"<%%OPENSLOT SETTING_allowcommenturls%%> />
Allow URLs in comments
</div>
<input type="submit" value="Save Settings" />
</form>
<%%ENDTEMPLATE SETTINGS_FORM%%>
<!-- Page helper parts -->
<%%STARTTEMPLATE NEWER_LINK%%>
<a href="?p=<%%OPENSLOT PAGE_TYPE%%>&s=<%%OPENSLOT NEWER_NUMBER%%>">< Newer</a>
<%%ENDTEMPLATE NEWER_LINK%%>
<%%STARTTEMPLATE OLDER_LINK%%>
<a href="?p=<%%OPENSLOT PAGE_TYPE%%>&s=<%%OPENSLOT OLDER_NUMBER%%>">Older ></a>
<%%ENDTEMPLATE OLDER_LINK%%>
<%%STARTTEMPLATE PAGE_LINKS%%>
<div class="pglinks">
<div class="pgright">
<%%OPENSLOT LINK_RIGHT%%>
</div>
<div class="pgleft">
<%%OPENSLOT LINK_LEFT%%>
</div>
<div class="visclear"> </div>
</div>
<%%ENDTEMPLATE PAGE_LINKS%%>
<!-- INSTALLATION -->
<%%STARTTEMPLATE INSTALL_PAGE%%>
<form method="POST" id="installform" class="contentwrapper">
<p>First thing's first - you need to set some database settings</p>
<div class="error <%%OPENSLOT DB_ERROR_CLASS%%>"><%%OPENSLOT DB_ERROR%%></div>
<div class="formfield">
Hostname<br />
<input type="text" name="DB_HOST" value="<%%OPENSLOT DB_HOST%%>" />
</div>
<div class="formfield">
Username<br />
<input type="text" name="DB_USER" value="<%%OPENSLOT DB_USER%%>" />
</div>
<div class="formfield">
Password<br />
<input type="text" name="DB_PASS" value="<%%OPENSLOT DB_PASS%%>" />
</div>
<div class="formfield">
Database<br />
<input type="text" name="DB_BASE" value="<%%OPENSLOT DB_BASE%%>" />
</div>
<div class="formfield">
Table Pre-fix<br />
<input type="text" name="DB_PREF" value="<%%OPENSLOT DB_PREF%%>" />
<div class="explain">To install multiple blogs on one database, change this</div>
</div>
<p>Well that was easy! Now some site settings. These can be changed later.</p>
<div class="formfield">
Password<br />
<input type="text" name="password" value="<%%OPENSLOT password%%>" />
<div class="explain">This is a single-user blog, so a password is all you need. Either write this password down, or change it to something you remember.</div>
</div>
<div class="formfield">
Your Name<br />
<input type="text" name="name" value="<%%OPENSLOT name%%>" />
<div class="explain">This will be shown on your comments.</div>
</div>
<div class="formfield">
Site title<br />
<input type="text" name="sitetitle" value="<%%OPENSLOT sitetitle%%>" />
<div class="explain">The large text at the top left.</div>
</div>
<div class="formfield">
Site extra<br />
<input type="text" name="siteextra" value="<%%OPENSLOT siteextra%%>" />
<div class="explain">The smaller text under the site title</div>
</div>
<input type="submit" name="DO_INSTALL" value="Install" />
</form>
<%%ENDTEMPLATE INSTALL_PAGE%%>
<%%STARTTEMPLATE INSTALL_SQL_COMMENTS%%>
CREATE TABLE IF NOT EXISTS `<%%OPENSLOT DB_PREFIX%%>comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`author_name` varchar(32) NOT NULL,
`author_web` varchar(1024) NOT NULL,
`comment` text NOT NULL,
`time_posted` datetime NOT NULL,
`visible` int(11) NOT NULL,
`author_hash` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
<%%ENDTEMPLATE INSTALL_SQL_COMMENTS%%>
<%%STARTTEMPLATE INSTALL_SQL_POSTS%%>
CREATE TABLE IF NOT EXISTS `<%%OPENSLOT DB_PREFIX%%>posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`content` longtext NOT NULL,
`type` enum('post','page') NOT NULL,
`publish_date` datetime DEFAULT NULL,
`comments_locked` tinyint(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
<%%ENDTEMPLATE INSTALL_SQL_POSTS%%>
<%%STARTTEMPLATE INSTALL_SQL_SETTINGS%%>
CREATE TABLE IF NOT EXISTS `<%%OPENSLOT DB_PREFIX%%>settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`setting` varchar(50) NOT NULL,
`value` text NOT NULL,
`time_set` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
<%%ENDTEMPLATE INSTALL_SQL_SETTINGS%%>
<%%STARTTEMPLATE CONFIG_FILE%%>
// Database settings
define('DB_HOST','<%%OPENSLOT DB_HOST%%>');
define('DB_USER','<%%OPENSLOT DB_USER%%>');
define('DB_PASS','<%%OPENSLOT DB_PASS%%>');
define('DB_BASE','<%%OPENSLOT DB_BASE%%>');
define('DB_PREF','<%%OPENSLOT DB_PREF%%>');
// Connect to the database
$_MYSQLI = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_BASE);
if ($_MYSQLI->connect_errno) {
die("Could not connect to database [".$_MYSQLI->connect_errno."] :: ".$_MYSQLI->connect_error);
}
// Random hash used to salt all other hashes. Keep it secret!
define('SITE_SALT','<%%OPENSLOT SITE_SALT%%>');
// and with this, the site will officially be isntalled!
define('SITE_INSTALLED',true);
<%%ENDTEMPLATE CONFIG_FILE%%>
<%%STARTTEMPLATE CONFIG_FILE_WRITE_ERROR%%>
<div class="contentwrapper">
<p>Your site is almost installed!</p>
<p>Not everything went to plan, however, and the configuration file could not be written.</p>
<p>Copy this text below, and save it as a file called '<%%OPENSLOT CONFIG_FILENAME%%>' in the same folder as this file.</p>
<textarea cols="110" rows="20"><%%OPENSLOT CONFIG_FILE%%></textarea>
</div>
<%%ENDTEMPLATE CONFIG_FILE_WRITE_ERROR%%>
<!-- END INSTALLATION -->
<?php
// Template flags
define('TEMPLATE_OVERWRITE',1);
define('TEMPLATE_IGNORE',2);
// By default, don't render anything
$_DO_RENDER = false;
$_DO_REDIR = false;
// Load the template
$_TEMPLATE = new TemplateEngine();
$_TEMPLATE->parse_templates(ob_get_clean(), TEMPLATE_IGNORE);
// start the user session
session_start();
// initialize the session
if (!isset($_SESSION['LOGGED_IN'])) {
$_SESSION['LOGGED_IN'] = false;
}
// The config file is a hidden file named after the current file; this allows
// multiple installations in a single folder
include_once('.bg-config.'.basename(__FILE__));
#<!-- INSTALLATION -->
/*******************************************************************************
***************************** START SITE INSTALLER ****************************
*******************************************************************************/
// If SITE_INSTALLED isn't defined, then the config file either doesn't exist yet
// or is incomplete. Either way, show the install process
if (!defined('SITE_INSTALLED')) {
// Set up the basics
$page_slots = array();
$page_slots['PAGE_TITLE'] = "Install";
$page_slots['SITE_TITLE'] = "BlogFile";
$page_slots['SITE_EXTRA'] = "A few quick questions, and you're good to go!";
// Are we trying to install, or should we show the install form?
if (isset($_POST['DO_INSTALL'])) {
$INSTALL_ERROR = false;
// bring the post into page slots (just in case there's an error)
foreach($_POST as $k=>$v) {
// ensure that nothing is going to mess up the HTML