diff options
Diffstat (limited to 'pages/blog.php')
| -rw-r--r-- | pages/blog.php | 197 |
1 files changed, 197 insertions, 0 deletions
| diff --git a/pages/blog.php b/pages/blog.php new file mode 100644 index 0000000..93d5dc6 --- /dev/null +++ b/pages/blog.php | |||
| @@ -0,0 +1,197 @@ | |||
| 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 pages/blog.php | ||
| 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 | $pageCategory = 'home'; | ||
| 26 | $pageAID = 'archive'; | ||
| 27 | |||
| 28 | if (isset($_GET['post'])) | ||
| 29 | { | ||
| 30 | $template = new FITemplate('post'); | ||
| 31 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
| 32 | |||
| 33 | $getpost = "SELECT * FROM updates WHERE slug = \"" . urldecode($_GET['post']) . "\""; | ||
| 34 | $getpost2 = mysql_query($getpost); | ||
| 35 | $getpost3 = mysql_fetch_array($getpost2); | ||
| 36 | |||
| 37 | if ($getpost3['slug'] == urldecode($_GET['post'])) | ||
| 38 | { | ||
| 39 | updatePop($getpost3['id'],'views'); | ||
| 40 | |||
| 41 | $title = stripslashes($getpost3['title']) . ' - Blog Archive'; | ||
| 42 | |||
| 43 | $getback = "SELECT * FROM updates WHERE id = " . ($getpost3['id']-1); | ||
| 44 | $getback2 = mysql_query($getback); | ||
| 45 | $getback3 = mysql_fetch_array($getback2); | ||
| 46 | if (isset($getback3['title'])) | ||
| 47 | { | ||
| 48 | $template->adds_block('BACK', array( 'CODED' => $getback3['slug'], | ||
| 49 | 'TITLE' => $getback3['title'])); | ||
| 50 | } | ||
| 51 | |||
| 52 | $getnext = "SELECT * FROM updates WHERE id = " . ($getpost3['id']+1); | ||
| 53 | $getnext2 = mysql_query($getnext); | ||
| 54 | $getnext3 = mysql_fetch_array($getnext2); | ||
| 55 | if (isset($getnext3['title'])) | ||
| 56 | { | ||
| 57 | $template->adds_block('NEXT', array( 'CODED' => $getnext3['slug'], | ||
| 58 | 'TITLE' => $getnext3['title'])); | ||
| 59 | } | ||
| 60 | |||
| 61 | $template->adds_block('POST', array( 'ID' => $getpost3['id'], | ||
| 62 | 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4), | ||
| 63 | 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])), | ||
| 64 | 'MONTH' => date('M',strtotime($getpost3['pubDate'])), | ||
| 65 | 'DAY' => date('d',strtotime($getpost3['pubDate'])), | ||
| 66 | 'CODED' => $getpost3['slug'], | ||
| 67 | 'TITLE' => $getpost3['title'], | ||
| 68 | 'AUTHOR' => $getpost3['author'], | ||
| 69 | 'TAG1' => $getpost3['tag1'], | ||
| 70 | 'TAG2' => $getpost3['tag2'], | ||
| 71 | 'TAG3' => $getpost3['tag3'], | ||
| 72 | 'RATING' => $getpost3['rating'], | ||
| 73 | 'TEXT' => parseBBCode($getpost3['text']))); | ||
| 74 | |||
| 75 | $template->display(); | ||
| 76 | $page_id = 'updates-' . $getpost3['id']; | ||
| 77 | include('includes/comments.php'); | ||
| 78 | |||
| 79 | $getrelated = "SELECT *, MATCH (title, text) AGAINST (\"" . addslashes($getpost3['title']) . "\") AS score FROM updates WHERE MATCH (title, text) AGAINST (\"" . addslashes($getpost3['title']) . "\") AND id <> " . $getpost3['id'] . " LIMIT 0,5"; | ||
| 80 | $getrelated2 = mysql_query($getrelated); | ||
| 81 | $i=0; | ||
| 82 | while ($getrelated3[$i] = mysql_fetch_array($getrelated2)) | ||
| 83 | { | ||
| 84 | if ($i==0) | ||
| 85 | { | ||
| 86 | $template = new FITemplate('related'); | ||
| 87 | } | ||
| 88 | |||
| 89 | $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], | ||
| 90 | 'CODED' => $getrelated3[$i]['slug'], | ||
| 91 | 'AUTHOR' => $getrelated3[$i]['author'], | ||
| 92 | 'DATE' => date('F d<\S\U\P>S</\S\U\P> Y',strtotime($getrelated3[$i]['pubDate'])))); | ||
| 93 | $i++; | ||
| 94 | } | ||
| 95 | |||
| 96 | if ($i > 0) | ||
| 97 | { | ||
| 98 | $template->display(); | ||
| 99 | } | ||
| 100 | } else { | ||
| 101 | generateError('404'); | ||
| 102 | } | ||
| 103 | } else { | ||
| 104 | $template = new FITemplate('archive'); | ||
| 105 | if (isset($_GET['author'])) | ||
| 106 | { | ||
| 107 | $title = 'Author: ' . $_GET['author'] . ' - Blog Archive'; | ||
| 108 | $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; | ||
| 109 | $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\""; | ||
| 110 | $getbio2 = mysql_query($getbio); | ||
| 111 | $getbio3 = mysql_fetch_array($getbio2); | ||
| 112 | if ($getbio3['username'] == $_GET['author']) | ||
| 113 | { | ||
| 114 | $template->adds_block('BIO', array( 'TEXT' => $getbio3['text'], | ||
| 115 | 'USERNAME' => $getbio3['username'], | ||
| 116 | 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getbio3['lastUpdated'])))); | ||
| 117 | } | ||
| 118 | } elseif (isset($_GET['tag'])) | ||
| 119 | { | ||
| 120 | $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive'; | ||
| 121 | $getposts = "SELECT * FROM updates WHERE tag1 = \"" . $_GET['tag'] . "\" OR tag2 = \"" . $_GET['tag'] . "\" OR tag3 = \"" . $_GET['tag'] . "\" ORDER BY id DESC"; | ||
| 122 | } else { | ||
| 123 | $title = 'Blog Archive'; | ||
| 124 | $getposts = "SELECT * FROM updates ORDER BY id DESC"; | ||
| 125 | } | ||
| 126 | $getposts2 = mysql_query($getposts); | ||
| 127 | $i=0; | ||
| 128 | while ($getposts3[$i] = mysql_fetch_array($getposts2)) | ||
| 129 | { | ||
| 130 | if ((!isset($lastmonth)) || ($lastmonth != date('m-Y',strtotime($getposts3[$i]['pubDate'])))) | ||
| 131 | { | ||
| 132 | if (!isset($curID)) | ||
| 133 | { | ||
| 134 | $curID = 0; | ||
| 135 | } else { | ||
| 136 | $curID++; | ||
| 137 | } | ||
| 138 | $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getposts3[$i]['pubDate'])))); | ||
| 139 | if ($curID == 0) | ||
| 140 | { | ||
| 141 | $template->adds_ref_sub($curID, 'BIGEND',array('exi'=>1)); | ||
| 142 | } | ||
| 143 | $lastmonth = date('m-Y',strtotime($getposts3[$i]['pubDate'])); | ||
| 144 | } | ||
| 145 | |||
| 146 | $page_id = 'updates-' . $getposts3[$i]['id']; | ||
| 147 | $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; | ||
| 148 | $getcomments2 = mysql_query($getcomments); | ||
| 149 | $total_post=0; | ||
| 150 | while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2)) | ||
| 151 | { | ||
| 152 | $total_post++; | ||
| 153 | } | ||
| 154 | if ($total_post >= 2) | ||
| 155 | { | ||
| 156 | $plural = 's'; | ||
| 157 | } | ||
| 158 | if ($total_post == 0) | ||
| 159 | { | ||
| 160 | $comText = 'No Comments'; | ||
| 161 | } elseif ($total_post == 1) | ||
| 162 | { | ||
| 163 | $comText = '1 Comment'; | ||
| 164 | } else { | ||
| 165 | $comText = $total_post . ' Comments'; | ||
| 166 | } | ||
| 167 | |||
| 168 | if ($curID == 0) | ||
| 169 | { | ||
| 170 | $template->adds_ref_sub($curID, 'BIG',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), | ||
| 171 | 'CODED' => $getposts3[$i]['slug'], | ||
| 172 | 'TITLE' => $getposts3[$i]['title'], | ||
| 173 | 'ID' => $getposts3[$i]['id'], | ||
| 174 | 'YEARID' => ((date('Y',strtotime($getposts3[$i]['pubDate']))-2006) % 4), | ||
| 175 | 'MONTH' => date('M',strtotime($getposts3[$i]['pubDate'])), | ||
| 176 | 'DAY' => date('d',strtotime($getposts3[$i]['pubDate'])), | ||
| 177 | 'AUTHOR' => $getposts3[$i]['author'], | ||
| 178 | 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), | ||
| 179 | 'COMMENTS' => $comText, | ||
| 180 | 'TAG1' => $getposts3[$i]['tag1'], | ||
| 181 | 'TAG2' => $getposts3[$i]['tag2'], | ||
| 182 | 'TAG3' => $getposts3[$i]['tag3'])); | ||
| 183 | } else { | ||
| 184 | $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), | ||
| 185 | 'CODED' => $getposts3[$i]['slug'], | ||
| 186 | 'TITLE' => $getposts3[$i]['title'])); | ||
| 187 | } | ||
| 188 | $i++; | ||
| 189 | } | ||
| 190 | if ($i==0) | ||
| 191 | { | ||
| 192 | generateError('404'); | ||
| 193 | } | ||
| 194 | $template->display(); | ||
| 195 | } | ||
| 196 | |||
| 197 | ?> | ||
