summary refs log tree commit diff stats
path: root/pages/wiki.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/wiki.php')
-rwxr-xr-xpages/wiki.php179
1 files changed, 0 insertions, 179 deletions
diff --git a/pages/wiki.php b/pages/wiki.php deleted file mode 100755 index 3e5a410..0000000 --- a/pages/wiki.php +++ /dev/null
@@ -1,179 +0,0 @@
1<?php
2/*
3 444444444
4 4::::::::4
5 4:::::::::4
6 4::::44::::4
7 4::::4 4::::4 Four Island
8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444
114::::::::::::::::4 pages/wiki.php
124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit
15 4::::4 permission from Hatkirby.
16 44::::::44
17 4::::::::4
18 4444444444
19*/
20
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24
25$pageCategory = 'wiki';
26
27$page = (isset($_GET['page']) ? $_GET['page'] : '');
28
29if (!isset($_GET['action']))
30{
31 $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $page . "\"";
32 $getpage2 = mysql_query($getpage);
33 $getpage3 = mysql_fetch_array($getpage2);
34
35 if ($getpage3['slug'] == $page)
36 {
37 $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision'];
38 $getrev2 = mysql_query($getrev);
39 $getrev3 = mysql_fetch_array($getrev2);
40
41 $title = $getpage3['title'] . ' - Wiki';
42
43 $template = new FITemplate('wiki/page');
44 $template->add('TITLE', $getpage3['title']);
45 $template->add('CONTENT', parseBBCode($getrev3['text']));
46 $template->display();
47 } else {
48 if (isLoggedIn())
49 {
50 header('Location: ./?action=create');
51 exit;
52 } else {
53 $template = new FITemplate('msg');
54 $template->add('MSG', "The wiki page you are trying to access does not yet exist, and as you are not logged in, you cannot create it. If you would like to, why not log in and create this page?");
55 $template->add('BACK', "the previous page");
56 $template->display();
57 }
58 }
59} else if ($_GET['action'] == 'create')
60{
61 if (isLoggedIn())
62 {
63 $template = new FITemplate('wiki/create');
64 $template->display();
65 } else {
66 $template = new FITemplate('msg');
67 $template->add('MSG', "I'm sorry, but you are attempting to create a wiki page while you aren't logged in. Please log in and then return.");
68 $template->add('BACK', "the previous page");
69 $template->display();
70 }
71} else if ($_GET['action'] == 'edit')
72{
73 if (isLoggedIn())
74 {
75 $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $page . "\"";
76 $getpage2 = mysql_query($getpage);
77 $getpage3 = mysql_fetch_array($getpage2);
78
79 if ($getpage3['slug'] == $page)
80 {
81 $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision'];
82 $getrev2 = mysql_query($getrev);
83 $getrev3 = mysql_fetch_array($getrev2);
84
85 $template = new FITemplate('wiki/edit');
86 $template->add('PAGENAME', $getpage3['title']);
87 $template->add('PAGETEXT', $getrev3['text']);
88 $template->display();
89 } else {
90 header('Location: ./?action=create');
91 exit;
92 }
93 } else {
94 $template = new FITemplate('msg');
95 $template->add('MSG', "I'm sorry, but you are attempting to edit a wiki page while you aren't logged in. Please log in and then return.");
96 $template->add('BACK', "the previous page");
97 $template->display();
98 }
99} else if ($_GET['action'] == 'submit')
100{
101 if (isLoggedIn())
102 {
103 if ($_GET['submit'] == 'create')
104 {
105 $insrev = "INSERT INTO wiki_revisions (author,text) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\")";
106 $insrev2 = mysql_query($insrev);
107
108 $getrev = "SELECT * FROM wiki_revisions WHERE author = \"" . sess_get('uname') . "\" AND text = \"" . addslashes($_POST['text']) . "\" ORDER BY id DESC LIMIT 0,1";
109 $getrev2 = mysql_query($getrev);
110 $getrev3 = mysql_fetch_array($getrev2);
111
112 $slug = generateSlug($_POST['title'],'wiki-pages');
113
114 $inspage = "INSERT INTO wiki_pages (title,slug,revision) VALUES (\"" . $_POST['title'] . "\",\"" . $slug . "\"," . $getrev3['id'] . ")";
115 $inspage2 = mysql_query($inspage);
116
117 $template = new FITemplate('msg2');
118 $template->add('MSG', 'YAY! You\'ve just created a page!');
119 $template->add('LINK', '/wiki/' . $slug . '/');
120 $template->add('BACK', 'View the page you just created');
121 $template->display();
122 } else if ($_GET['submit'] == 'edit')
123 {
124 $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $_GET['page'] . "\"";
125 $getpage2 = mysql_query($getpage);
126 $getpage3 = mysql_fetch_array($getpage2);
127
128 $insrev = "INSERT INTO wiki_revisions (author,text,previous) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\"," . $getpage3['revision'] . ")";
129 $insrev2 = mysql_query($insrev);
130
131 $getrev4 = "SELECT * FROM wiki_revisions WHERE author = \"" . sess_get('uname') . "\" AND text = \"" . addslashes($_POST['text']) . "\" AND previous = " . $getpage3['revision'] . " ORDER BY id DESC LIMIT 0,1";
132 $getrev5 = mysql_query($getrev4);
133 $getrev6 = mysql_fetch_array($getrev5);
134
135 $setpage = "UPDATE wiki_pages SET revision = " . $getrev6['id'] . " WHERE revision = " . $getpage3['revision'];
136 $setpage2 = mysql_query($setpage);
137
138 $template = new FITemplate('msg2');
139 $template->add('MSG', 'YAY! You\'ve just edited a page!');
140 $template->add('LINK', './');
141 $template->add('BACK', 'View the page you just edited');
142 $template->display();
143 }
144 } else {
145 $template = new FITemplate('msg');
146 $template->add('MSG', "I'm sorry, but you are attempting to edit a wiki page while you aren't logged in. Please log in and then return.");
147 $template->add('BACK', "the previous page");
148 $template->display();
149 }
150} else if ($_GET['action'] == 'index')
151{
152 $template = new FITemplate('wiki/index');
153 $getpages = "SELECT * FROM wiki_pages, wiki_revisions WHERE wiki_revisions.id = wiki_pages.revision ORDER BY title ASC";
154 $getpages2 = mysql_query($getpages);
155 $i=0;
156 $lastLetter='';
157 while ($getpages3[$i] = mysql_fetch_array($getpages2))
158 {
159 if (substr($getpages3[$i]['title'],0,1) != $lastLetter)
160 {
161 if (!isset($curID))
162 {
163 $curID = 0;
164 } else {
165 $curID++;
166 }
167 $template->add_ref($curID, 'LETTER', array('TITLE' => substr($getpages3[$i]['title'],0,1)));
168 $lastLetter = substr($getpages3[$i]['title'],0,1);
169 }
170
171 $template->adds_ref_sub($curID, 'PAGE', array( 'TITLE' => $getpages3[$i]['title'],
172 'CODED' => ($getpages3[$i]['slug'] != '' ? $getpages3[$i]['slug'] . '/' : ''),
173 'DATE' => date('m-d-y',strtotime($getpages3[$i]['pubDate']))));
174 $i++;
175 }
176 $template->display();
177}
178
179?>