summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-11-28 13:47:25 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-11-28 13:47:25 -0500
commite7e54aa96806d55204812f9e6ca5fa06e2943fa2 (patch)
tree83ab29513e2cbe0146edc02d964f913bd77d915b
parentfff164998dfbcb300d27df78ea6f7a5b2aa541cb (diff)
downloadfourisland-e7e54aa96806d55204812f9e6ca5fa06e2943fa2.tar.gz
fourisland-e7e54aa96806d55204812f9e6ca5fa06e2943fa2.tar.bz2
fourisland-e7e54aa96806d55204812f9e6ca5fa06e2943fa2.zip
Organized blog module
Previously, welcome.php was always loaded if no module was specified. Because of this, the index page blog section was there, while the rest of the blog
code (plus archive code) was in blog.php. Now, the all of the blog is in blog.php and all of the archive is in archive.php.
-rwxr-xr-x.htaccess8
-rwxr-xr-xincludes/functions.php11
-rwxr-xr-xindex.php2
-rw-r--r--pages/archive.php99
-rwxr-xr-xpages/blog.php105
-rwxr-xr-xpages/welcome.php105
6 files changed, 164 insertions, 166 deletions
diff --git a/.htaccess b/.htaccess index 1d64272..7304983 100755 --- a/.htaccess +++ b/.htaccess
@@ -7,9 +7,11 @@ RewriteEngine On
7RewriteCond %{HTTP_HOST} ^www.fourisland.com [NC] 7RewriteCond %{HTTP_HOST} ^www.fourisland.com [NC]
8RewriteRule ^(.*)$ http://fourisland.com/$1 [R=301,NC,L] 8RewriteRule ^(.*)$ http://fourisland.com/$1 [R=301,NC,L]
9 9
10RewriteRule ^blog/$ /index.php?area=blog [QSA,L] 10RewriteRule ^blog/$ /index.php?area=archive [QSA,L]
11RewriteRule ^blog/author/(.+).php /index.php?area=blog&author=$1 [QSA,L] 11RewriteRule ^blog/author/(.+).php /index.php?area=archive&author=$1 [QSA,L]
12RewriteRule ^blog/tag/(.+).php /index.php?area=blog&tag=$1 [QSA,L] 12RewriteRule ^blog/tag/(.+).php /index.php?area=archive&tag=$1 [QSA,L]
13
14RewriteRule ^$ /index.php?area=blog [QSA,L]
13RewriteRule ^blog/(.+)/ /index.php?area=blog&post=$1 [QSA,L] 15RewriteRule ^blog/(.+)/ /index.php?area=blog&post=$1 [QSA,L]
14 16
15RewriteRule ^wiki/$ /wiki/Main_Page [QSA] 17RewriteRule ^wiki/$ /wiki/Main_Page [QSA]
diff --git a/includes/functions.php b/includes/functions.php index dc5a549..efb3c13 100755 --- a/includes/functions.php +++ b/includes/functions.php
@@ -399,15 +399,20 @@ function getRewriteURL()
399 } else { 399 } else {
400 if ($_GET['area'] == 'blog') 400 if ($_GET['area'] == 'blog')
401 { 401 {
402 if (isset($_GET['post']))
403 {
404 return '/blog/' . $_GET['post'] . '/';
405 } else {
406 return '/';
407 }
408 } else if ($_GET['area'] == 'archive')
409 {
402 if (isset($_GET['author'])) 410 if (isset($_GET['author']))
403 { 411 {
404 return '/blog/author/' . $_GET['author'] . '.php'; 412 return '/blog/author/' . $_GET['author'] . '.php';
405 } else if (isset($_GET['tag'])) 413 } else if (isset($_GET['tag']))
406 { 414 {
407 return '/blog/tag/' . $_GET['tag'] . '.php'; 415 return '/blog/tag/' . $_GET['tag'] . '.php';
408 } else if (isset($_GET['post']))
409 {
410 return '/blog/' . $_GET['post'] . '/';
411 } else { 416 } else {
412 return '/blog/'; 417 return '/blog/';
413 } 418 }
diff --git a/index.php b/index.php index 83cdd99..79fce10 100755 --- a/index.php +++ b/index.php
@@ -34,7 +34,7 @@ if (strpos($_SERVER['REQUEST_URI'],'index.php'))
34 34
35ob_start(); 35ob_start();
36 36
37$pageName = isset($_GET['area']) ? $_GET['area'] : 'welcome'; 37$pageName = basename($_GET['area']);
38 38
39if (file_exists('pages/' . $pageName . '.php')) 39if (file_exists('pages/' . $pageName . '.php'))
40{ 40{
diff --git a/pages/archive.php b/pages/archive.php new file mode 100644 index 0000000..39a9fa7 --- /dev/null +++ b/pages/archive.php
@@ -0,0 +1,99 @@
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 header.inc
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$template = new FITemplate('archive');
26if (isset($_GET['author']))
27{
28 $title = 'Author: ' . $_GET['author'] . ' - Blog Archive';
29 $template->add('HEADER', 'Posts by ' . $_GET['author']);
30 $getposts = "SELECT * FROM updates AS u WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC";
31 $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\"";
32 $getbio2 = mysql_query($getbio);
33 $getbio3 = mysql_fetch_array($getbio2);
34 if ($getbio3['username'] == $_GET['author'])
35 {
36 $template->adds_block('BIO', array( 'TEXT' => $getbio3['text'],
37 'USERNAME' => $getbio3['username'],
38 'DATE' => date('F jS Y \a\\t g:i:s a',strtotime($getbio3['lastUpdated']))));
39 }
40} elseif (isset($_GET['tag']))
41{
42 $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive';
43 $template->add('HEADER', 'Posts tagged with ' . $_GET['tag']);
44 $getposts = "SELECT * FROM updates AS u, tags AS t WHERE u.id = t.post_id AND t.post_type = \"published\" AND t.tag = \"" . $_GET['tag'] . "\" ORDER BY u.id DESC";
45} else {
46 $title = 'Blog Archive';
47 $template->add('HEADER', 'Blog Archive');
48 $getposts = "SELECT * FROM updates AS u ORDER BY id DESC";
49}
50$getposts2 = mysql_query($getposts);
51$i=0;
52while ($getposts3[$i] = mysql_fetch_array($getposts2))
53{
54 if ((!isset($lastmonth)) || ($lastmonth != date('m-Y',strtotime($getposts3[$i]['pubDate']))))
55 {
56 if (!isset($curID))
57 {
58 $curID = 0;
59 } else {
60 $curID++;
61 }
62 $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getposts3[$i]['pubDate']))));
63 $lastmonth = date('m-Y',strtotime($getposts3[$i]['pubDate']));
64 }
65
66 $page_id = 'updates-' . $getposts3[$i]['id'];
67 $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime";
68 $getcomments2 = mysql_query($getcomments);
69 $total_post=0;
70 while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2))
71 {
72 $total_post++;
73 }
74 if ($total_post >= 2)
75 {
76 $plural = 's';
77 }
78 if ($total_post == 0)
79 {
80 $comText = 'No Comments';
81 } elseif ($total_post == 1)
82 {
83 $comText = '1 Comment';
84 } else {
85 $comText = $total_post . ' Comments';
86 }
87
88 $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])),
89 'CODED' => $getposts3[$i]['slug'],
90 'TITLE' => htmlentities($getposts3[$i]['title'])));
91 $i++;
92}
93if ($i==0)
94{
95 generateError('404');
96}
97$template->display();
98
99?>
diff --git a/pages/blog.php b/pages/blog.php index a96edea..d4e95c1 100755 --- a/pages/blog.php +++ b/pages/blog.php
@@ -25,14 +25,18 @@ require('headerproc.php');
25$pageCategory = 'blog'; 25$pageCategory = 'blog';
26$pageAID = 'archive'; 26$pageAID = 'archive';
27 27
28$hatNav = array( array( 'title' => 'Archive',
29 'url' => 'http://fourisland.com/blog/',
30 'icon' => '16-file-archive'));
31
32$template = new FITemplate('post');
33$template->adds_block('INTERNAL',array('exi'=>1));
34$template->add('IFXAMP', $xhtml ? '&amp;' : '&');
35$template->add('IFXLT', $xhtml ? '&lt;' : '<');
36$template->add('IFXGT', $xhtml ? '&gt;' : '>');
37
28if (isset($_GET['post'])) 38if (isset($_GET['post']))
29{ 39{
30 $template = new FITemplate('post');
31 $template->adds_block('INTERNAL',array('exi'=>1));
32 $template->add('IFXAMP', $xhtml ? '&amp;' : '&');
33 $template->add('IFXLT', $xhtml ? '&lt;' : '<');
34 $template->add('IFXGT', $xhtml ? '&gt;' : '>');
35
36 $getpost = "SELECT * FROM updates WHERE slug = \"" . urldecode($_GET['post']) . "\""; 40 $getpost = "SELECT * FROM updates WHERE slug = \"" . urldecode($_GET['post']) . "\"";
37 $getpost2 = mysql_query($getpost); 41 $getpost2 = mysql_query($getpost);
38 $getpost3 = mysql_fetch_array($getpost2); 42 $getpost3 = mysql_fetch_array($getpost2);
@@ -122,48 +126,21 @@ if (isset($_GET['post']))
122 generateError('404'); 126 generateError('404');
123 } 127 }
124} else { 128} else {
125 $template = new FITemplate('archive'); 129 $curID = 0;
126 if (isset($_GET['author'])) 130
127 { 131 $gettrack = "SELECT * FROM tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\"";
128 $title = 'Author: ' . $_GET['author'] . ' - Blog Archive'; 132 $gettrack2 = mysql_query($gettrack);
129 $template->add('HEADER', 'Posts by ' . $_GET['author']); 133 $gettrack3 = mysql_fetch_array($gettrack2);
130 $getposts = "SELECT * FROM updates AS u WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; 134
131 $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\""; 135 $trackArr = explode(',',$gettrack3['rating']);
132 $getbio2 = mysql_query($getbio); 136
133 $getbio3 = mysql_fetch_array($getbio2); 137 $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,4";
134 if ($getbio3['username'] == $_GET['author']) 138 $getpost2 = mysql_query($getpost);
135 { 139 while ($getpost3 = mysql_fetch_array($getpost2))
136 $template->adds_block('BIO', array( 'TEXT' => $getbio3['text'],
137 'USERNAME' => $getbio3['username'],
138 'DATE' => date('F jS Y \a\\t g:i:s a',strtotime($getbio3['lastUpdated']))));
139 }
140 } elseif (isset($_GET['tag']))
141 {
142 $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive';
143 $template->add('HEADER', 'Posts tagged with ' . $_GET['tag']);
144 $getposts = "SELECT * FROM updates AS u, tags AS t WHERE u.id = t.post_id AND t.post_type = \"published\" AND t.tag = \"" . $_GET['tag'] . "\" ORDER BY u.id DESC";
145 } else {
146 $title = 'Blog Archive';
147 $template->add('HEADER', 'Blog Archive');
148 $getposts = "SELECT * FROM updates AS u ORDER BY id DESC";
149 }
150 $getposts2 = mysql_query($getposts);
151 $i=0;
152 while ($getposts3[$i] = mysql_fetch_array($getposts2))
153 { 140 {
154 if ((!isset($lastmonth)) || ($lastmonth != date('m-Y',strtotime($getposts3[$i]['pubDate'])))) 141 updatePop($getpost3['id'],'home_views');
155 {
156 if (!isset($curID))
157 {
158 $curID = 0;
159 } else {
160 $curID++;
161 }
162 $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getposts3[$i]['pubDate']))));
163 $lastmonth = date('m-Y',strtotime($getposts3[$i]['pubDate']));
164 }
165 142
166 $page_id = 'updates-' . $getposts3[$i]['id']; 143 $page_id = 'updates-' . $getpost3['id'];
167 $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; 144 $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime";
168 $getcomments2 = mysql_query($getcomments); 145 $getcomments2 = mysql_query($getcomments);
169 $total_post=0; 146 $total_post=0;
@@ -185,15 +162,35 @@ if (isset($_GET['post']))
185 $comText = $total_post . ' Comments'; 162 $comText = $total_post . ' Comments';
186 } 163 }
187 164
188 $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), 165 $template->add_ref($curID, 'POST', array( 'ID' => $getpost3['id'],
189 'CODED' => $getposts3[$i]['slug'], 166 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4),
190 'TITLE' => htmlentities($getposts3[$i]['title']))); 167 'DATE' => date('F jS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])),
191 $i++; 168 'MONTH' => date('M',strtotime($getpost3['pubDate'])),
192 } 169 'DAY' => date('d',strtotime($getpost3['pubDate'])),
193 if ($i==0) 170 'CODED' => $getpost3['slug'],
194 { 171 'TITLE' => htmlentities(stripslashes($getpost3['title'])),
195 generateError('404'); 172 'AUTHOR' => $getpost3['author'],
173 'PLURALCOMMENT' => (isset($plural) ? $plural : ''),
174 'COMMENTS' => $comText,
175 'RATING' => $getpost3['rating'],
176 'TEXT' => parseText(stripslashes($getpost3['text']))));
177
178 $tags = getTags($getpost3['id']);
179 foreach ($tags as $tag)
180 {
181 $template->adds_ref_sub($curID, 'TAGS', array('TAG' => $tag));
182 }
183
184 if (($gettrack3['ip'] != $_SERVER['REMOTE_ADDR']) || (array_search($getpost3['id'],$trackArr) === FALSE))
185 {
186 $template->adds_ref_sub($curID, 'CANVOTE', array('exi'=>1));
187 } else {
188 $template->adds_ref_sub($curID, 'NOVOTE', array('exi'=>1));
189 }
190
191 $curID++;
196 } 192 }
193
197 $template->display(); 194 $template->display();
198} 195}
199 196
diff --git a/pages/welcome.php b/pages/welcome.php deleted file mode 100755 index 819420b..0000000 --- a/pages/welcome.php +++ /dev/null
@@ -1,105 +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/welcome.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 = 'blog';
26
27$hatNav = array( array( 'title' => 'Archive',
28 'url' => 'http://fourisland.com/blog/',
29 'icon' => '16-file-archive'));
30
31
32$template = new FITemplate('post');
33$template->adds_block('EXTERNAL',array('exi'=>1));
34$template->add('IFXAMP', $xhtml ? '&amp;' : '&');
35$template->add('IFXLT', $xhtml ? '&lt;' : '<');
36$template->add('IFXGT', $xhtml ? '&gt;' : '>');
37
38$curID = 0;
39
40$gettrack = "SELECT * FROM tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\"";
41$gettrack2 = mysql_query($gettrack);
42$gettrack3 = mysql_fetch_array($gettrack2);
43
44$trackArr = explode(',',$gettrack3['rating']);
45
46$getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,4";
47$getpost2 = mysql_query($getpost);
48while ($getpost3 = mysql_fetch_array($getpost2))
49{
50 updatePop($getpost3['id'],'home_views');
51
52 $page_id = 'updates-' . $getpost3['id'];
53 $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime";
54 $getcomments2 = mysql_query($getcomments);
55 $total_post=0;
56 while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2))
57 {
58 $total_post++;
59 }
60 if ($total_post >= 2)
61 {
62 $plural = 's';
63 }
64 if ($total_post == 0)
65 {
66 $comText = 'No Comments';
67 } elseif ($total_post == 1)
68 {
69 $comText = '1 Comment';
70 } else {
71 $comText = $total_post . ' Comments';
72 }
73
74 $template->add_ref($curID, 'POST', array( 'ID' => $getpost3['id'],
75 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4),
76 'DATE' => date('F jS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])),
77 'MONTH' => date('M',strtotime($getpost3['pubDate'])),
78 'DAY' => date('d',strtotime($getpost3['pubDate'])),
79 'CODED' => $getpost3['slug'],
80 'TITLE' => htmlentities(stripslashes($getpost3['title'])),
81 'AUTHOR' => $getpost3['author'],
82 'PLURALCOMMENT' => (isset($plural) ? $plural : ''),
83 'COMMENTS' => $comText,
84 'RATING' => $getpost3['rating'],
85 'TEXT' => parseText(stripslashes($getpost3['text']))));
86
87 $tags = getTags($getpost3['id']);
88 foreach ($tags as $tag)
89 {
90 $template->adds_ref_sub($curID, 'TAGS', array('TAG' => $tag));
91 }
92
93 if (($gettrack3['ip'] != $_SERVER['REMOTE_ADDR']) || (array_search($getpost3['id'],$trackArr) === FALSE))
94 {
95 $template->adds_ref_sub($curID, 'CANVOTE', array('exi'=>1));
96 } else {
97 $template->adds_ref_sub($curID, 'NOVOTE', array('exi'=>1));
98 }
99
100 $curID++;
101}
102
103$template->display();
104
105?>