diff options
Diffstat (limited to 'pages/archive.php')
-rw-r--r-- | pages/archive.php | 99 |
1 files changed, 99 insertions, 0 deletions
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 | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 header.inc | ||
12 | 4444444444:::::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 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $template = new FITemplate('archive'); | ||
26 | if (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; | ||
52 | while ($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 | } | ||
93 | if ($i==0) | ||
94 | { | ||
95 | generateError('404'); | ||
96 | } | ||
97 | $template->display(); | ||
98 | |||
99 | ?> | ||