summary refs log tree commit diff stats
path: root/pages/blog.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/blog.php')
-rwxr-xr-xpages/blog.php105
1 files changed, 51 insertions, 54 deletions
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 ? '&' : '&');
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