diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 20:25:36 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 20:25:36 -0500 |
commit | 25a101d128ada4cac4e634b1c0fdd881551fd376 (patch) | |
tree | 16189519d01940f01c6a91c4786508c080aefc2f | |
parent | 9a4c37255351aadc223bb9609623888cb01d5fde (diff) | |
download | fourisland-25a101d128ada4cac4e634b1c0fdd881551fd376.tar.gz fourisland-25a101d128ada4cac4e634b1c0fdd881551fd376.tar.bz2 fourisland-25a101d128ada4cac4e634b1c0fdd881551fd376.zip |
Redid multiple tag system
This new tag system has a seperate table for tags. This way, a tag cloud can be made much more easily than if using the previous system. This changeset requires manual maintinence.
-rwxr-xr-x | includes/functions.php | 42 | ||||
-rwxr-xr-x | includes/updatePending.php | 2 | ||||
-rwxr-xr-x | pages/admin.php | 60 | ||||
-rwxr-xr-x | pages/blog.php | 8 | ||||
-rwxr-xr-x | pages/welcome.php | 2 | ||||
-rwxr-xr-x | rss.php | 2 |
6 files changed, 90 insertions, 26 deletions
diff --git a/includes/functions.php b/includes/functions.php index c71e69f..73a6e17 100755 --- a/includes/functions.php +++ b/includes/functions.php | |||
@@ -115,9 +115,15 @@ function postBlogPost($title,$author,$tags,$content) | |||
115 | { | 115 | { |
116 | $slug = generateSlug($title,'updates'); | 116 | $slug = generateSlug($title,'updates'); |
117 | 117 | ||
118 | $inspost = "INSERT INTO updates (title,slug,author,tags,text) VALUES (\"" . $title . "\",\"" . $slug . "\",\"" . $author . "\",\"" . $tags . "\",\"" . addslashes($content) . "\")"; | 118 | $inspost = "INSERT INTO updates (title,slug,author,text) VALUES (\"" . $title . "\",\"" . $slug . "\",\"" . $author . "\",\"" . addslashes($content) . "\")"; |
119 | $inspost2 = mysql_query($inspost); | 119 | $inspost2 = mysql_query($inspost); |
120 | 120 | ||
121 | $getpost = "SELECT * FROM updates WHERE slug = \"" . $slug . "\""; | ||
122 | $getpost2 = mysql_query($getpost); | ||
123 | $getpost3 = mysql_fetch_array($getpost2); | ||
124 | |||
125 | addTags($getpost3['id'], $tags); | ||
126 | |||
121 | $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\""; | 127 | $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\""; |
122 | $upconf2 = mysql_query($upconf); | 128 | $upconf2 = mysql_query($upconf); |
123 | 129 | ||
@@ -144,7 +150,7 @@ function postBlogPost($title,$author,$tags,$content) | |||
144 | if (preg_match('/<LINK REL="pingback" HREF="([^"]+)"/i',$page_data,$server)) | 150 | if (preg_match('/<LINK REL="pingback" HREF="([^"]+)"/i',$page_data,$server)) |
145 | { | 151 | { |
146 | $client = new xmlrpc_client($server[1]); | 152 | $client = new xmlrpc_client($server[1]); |
147 | $msg = new xmlrpcmsg("pingback.ping", array( new xmlrpcval('http://www.fourisland.com/blog/' . $slug . '/', 'string'), | 153 | $msg = new xmlrpcmsg("pingback.ping", array( new xmlrpcval('http://fourisland.com/blog/' . $slug . '/', 'string'), |
148 | new xmlrpcval($link, 'string'))); | 154 | new xmlrpcval($link, 'string'))); |
149 | $client->send($msg); | 155 | $client->send($msg); |
150 | } | 156 | } |
@@ -153,7 +159,7 @@ function postBlogPost($title,$author,$tags,$content) | |||
153 | 159 | ||
154 | $client = new xmlrpc_client('http://rpc.pingomatic.com'); | 160 | $client = new xmlrpc_client('http://rpc.pingomatic.com'); |
155 | $msg = new xmlrpcmsg("weblogUpdates.ping", array( new xmlrpcval('Four Island', 'string'), | 161 | $msg = new xmlrpcmsg("weblogUpdates.ping", array( new xmlrpcval('Four Island', 'string'), |
156 | new xmlrpcval('http://www.fourisland.com/', 'string'))); | 162 | new xmlrpcval('http://fourisland.com/', 'string'))); |
157 | $client->send($msg); | 163 | $client->send($msg); |
158 | } | 164 | } |
159 | 165 | ||
@@ -215,4 +221,34 @@ function verifyUser($username, $password) | |||
215 | return (($_POST['username'] != '') && ($getuser3['username'] == $_POST['username'])); | 221 | return (($_POST['username'] != '') && ($getuser3['username'] == $_POST['username'])); |
216 | } | 222 | } |
217 | 223 | ||
224 | function getTags($id, $type = 'published') | ||
225 | { | ||
226 | $gettags = "SELECT * FROM tags WHERE post_id = " . $id . " AND post_type = \"" . $type . "\""; | ||
227 | $gettags2 = mysql_query($gettags); | ||
228 | $i=0; | ||
229 | $tags = array(); | ||
230 | while ($gettags3[$i] = mysql_fetch_array($gettags2)) | ||
231 | { | ||
232 | $tags[] = $gettags3[$i]['tag']; | ||
233 | $i++; | ||
234 | } | ||
235 | |||
236 | return $tags; | ||
237 | } | ||
238 | |||
239 | function addTags($id, $tags, $type = 'published') | ||
240 | { | ||
241 | foreach ($tags as $tag) | ||
242 | { | ||
243 | $instag = "INSERT INTO tags (post_id,post_type,tag) VALUES (" . $id . ",\"" . $type . "\",\"" . $tag . "\")"; | ||
244 | $instag2 = mysql_query($instag); | ||
245 | } | ||
246 | } | ||
247 | |||
248 | function removeTags($id, $type = 'published') | ||
249 | { | ||
250 | $deltags = "DELETE FROM tags WHERE post_id = " . $id . " AND post_type = \"" . $type . "\""; | ||
251 | $deltags2 = mysql_query($deltags); | ||
252 | } | ||
253 | |||
218 | ?> | 254 | ?> |
diff --git a/includes/updatePending.php b/includes/updatePending.php index 79ab1c4..9a9b508 100755 --- a/includes/updatePending.php +++ b/includes/updatePending.php | |||
@@ -40,7 +40,7 @@ if ((!isset($disablePendingQueue)) && (date('j') != 'Sat')) | |||
40 | $getpost2 = mysql_query($getpost); | 40 | $getpost2 = mysql_query($getpost); |
41 | $getpost3 = mysql_fetch_array($getpost2); | 41 | $getpost3 = mysql_fetch_array($getpost2); |
42 | 42 | ||
43 | postBlogPost($getpost3['title'], $getpost3['author'], $getpost3['tags'], $getpost3['text']); | 43 | postBlogPost($getpost3['title'], $getpost3['author'], explode(',', $getpost3['tags']), $getpost3['text']); |
44 | 44 | ||
45 | $delpost = "DELETE FROM pending WHERE id = " . $getpost3['id']; | 45 | $delpost = "DELETE FROM pending WHERE id = " . $getpost3['id']; |
46 | $delpost2 = mysql_query($delpost); | 46 | $delpost2 = mysql_query($delpost); |
diff --git a/pages/admin.php b/pages/admin.php index 56542f9..1767a83 100755 --- a/pages/admin.php +++ b/pages/admin.php | |||
@@ -37,17 +37,19 @@ if (isLoggedIn()) | |||
37 | { | 37 | { |
38 | $template = new FITemplate('admin/write'); | 38 | $template = new FITemplate('admin/write'); |
39 | } else { | 39 | } else { |
40 | $tags = mysql_real_escape_string(serialize(explode(',', $_POST['tags']))); | 40 | $tags = explode(',', $_POST['tags']); |
41 | 41 | ||
42 | if ($_POST['type'] == 'draft') | 42 | if ($_POST['type'] == 'draft') |
43 | { | 43 | { |
44 | $insdraft = "INSERT INTO drafts (title,author,text,tags,slug) VALUES (\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $tags . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | 44 | $insdraft = "INSERT INTO drafts (title,author,text,slug) VALUES (\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; |
45 | $insdraft2 = mysql_query($insdraft); | 45 | $insdraft2 = mysql_query($insdraft); |
46 | 46 | ||
47 | $getdraft = "SELECT * FROM drafts ORDER BY id DESC LIMIT 0,1"; | 47 | $getdraft = "SELECT * FROM drafts ORDER BY id DESC LIMIT 0,1"; |
48 | $getdraft2 = mysql_query($getdraft); | 48 | $getdraft2 = mysql_query($getdraft); |
49 | $getdraft3 = mysql_fetch_array($getdraft2); | 49 | $getdraft3 = mysql_fetch_array($getdraft2); |
50 | 50 | ||
51 | addTags($getdraft3['id'], $tags, 'draft'); | ||
52 | |||
51 | $template = new FITemplate('admin/draftSuccess'); | 53 | $template = new FITemplate('admin/draftSuccess'); |
52 | $template->add('ID', $getdraft3['id']); | 54 | $template->add('ID', $getdraft3['id']); |
53 | } else if ($_POST['type'] == 'instant') | 55 | } else if ($_POST['type'] == 'instant') |
@@ -88,9 +90,11 @@ if (isLoggedIn()) | |||
88 | generateError(404); | 90 | generateError(404); |
89 | } | 91 | } |
90 | 92 | ||
91 | $inspending = "INSERT INTO pending (id,title,author,text,tags,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $tags . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | 93 | $inspending = "INSERT INTO pending (id,title,author,text,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; |
92 | $inspending2 = mysql_query($inspending); | 94 | $inspending2 = mysql_query($inspending); |
93 | 95 | ||
96 | addTags($id, $tags, 'pending'); | ||
97 | |||
94 | $template = new FITemplate('admin/pendingSuccess'); | 98 | $template = new FITemplate('admin/pendingSuccess'); |
95 | $template->add('ID', $id); | 99 | $template->add('ID', $id); |
96 | } | 100 | } |
@@ -122,16 +126,19 @@ if (isLoggedIn()) | |||
122 | $template = new FITemplate('admin/editDraft'); | 126 | $template = new FITemplate('admin/editDraft'); |
123 | $template->add('ID', $_GET['id']); | 127 | $template->add('ID', $_GET['id']); |
124 | $template->add('TEXT', $getdraft3['text']); | 128 | $template->add('TEXT', $getdraft3['text']); |
125 | $template->add('TAGS', implode(',', unserialize($getdraft3['tags']))); | 129 | $template->add('TAGS', implode(',', getTags($getdraft3['id'], 'draft'))); |
126 | $template->add('TITLE', $getdraft3['title']); | 130 | $template->add('TITLE', $getdraft3['title']); |
127 | } else { | 131 | } else { |
128 | $tags = mysql_real_escape_string(serialize(explode(',', $_POST['tags']))); | 132 | $tags = explode(',', $_POST['tags']); |
133 | removeTags($_GET['id'], 'draft'); | ||
129 | 134 | ||
130 | if ($_POST['type'] == 'draft') | 135 | if ($_POST['type'] == 'draft') |
131 | { | 136 | { |
132 | $setdraft = "UPDATE drafts SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tags = \"" . $tags . "\" WHERE id = " . $_GET['id']; | 137 | $setdraft = "UPDATE drafts SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\" WHERE id = " . $_GET['id']; |
133 | $setdraft2 = mysql_query($setdraft); | 138 | $setdraft2 = mysql_query($setdraft); |
134 | 139 | ||
140 | addTags($_GET['id'], $tags, 'draft'); | ||
141 | |||
135 | $template = new FITemplate('admin/draftSuccess'); | 142 | $template = new FITemplate('admin/draftSuccess'); |
136 | $template->add('ID', $_GET['id']); | 143 | $template->add('ID', $_GET['id']); |
137 | } else if ($_POST['type'] == 'instant') | 144 | } else if ($_POST['type'] == 'instant') |
@@ -178,6 +185,8 @@ if (isLoggedIn()) | |||
178 | $inspending = "INSERT INTO pending (id,title,author,text,tags,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $tags . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | 185 | $inspending = "INSERT INTO pending (id,title,author,text,tags,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $tags . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; |
179 | $inspending2 = mysql_query($inspending); | 186 | $inspending2 = mysql_query($inspending); |
180 | 187 | ||
188 | addTags($id, $tags, 'pending'); | ||
189 | |||
181 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | 190 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; |
182 | $deldraft2 = mysql_query($deldraft); | 191 | $deldraft2 = mysql_query($deldraft); |
183 | 192 | ||
@@ -206,6 +215,8 @@ if (isLoggedIn()) | |||
206 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | 215 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; |
207 | $deldraft2 = mysql_query($deldraft); | 216 | $deldraft2 = mysql_query($deldraft); |
208 | 217 | ||
218 | removeTags($_GET['id'], 'draft'); | ||
219 | |||
209 | $template = new FITemplate('admin/deletedDraft'); | 220 | $template = new FITemplate('admin/deletedDraft'); |
210 | } | 221 | } |
211 | } else { | 222 | } else { |
@@ -234,7 +245,7 @@ if (isLoggedIn()) | |||
234 | 'RATING' => 0, | 245 | 'RATING' => 0, |
235 | 'TEXT' => parseBBCode($getdraft3['text']))); | 246 | 'TEXT' => parseBBCode($getdraft3['text']))); |
236 | 247 | ||
237 | $tags = unserialize($getdraft3['tags']); | 248 | $tags = getTags($getdraft3['id'], 'draft'); |
238 | foreach ($tags as $tag) | 249 | foreach ($tags as $tag) |
239 | { | 250 | { |
240 | $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); | 251 | $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); |
@@ -271,14 +282,17 @@ if (isLoggedIn()) | |||
271 | $template = new FITemplate('admin/editPending'); | 282 | $template = new FITemplate('admin/editPending'); |
272 | $template->add('ID', $_GET['id']); | 283 | $template->add('ID', $_GET['id']); |
273 | $template->add('TEXT', $getpending3['text']); | 284 | $template->add('TEXT', $getpending3['text']); |
274 | $template->add('TAGS', implode(',', unserialize($getdraft3['tags']))); | 285 | $template->add('TAGS', implode(',', getTags($getpending3['id'], 'pending'))); |
275 | $template->add('TITLE', $getpending3['title']); | 286 | $template->add('TITLE', $getpending3['title']); |
276 | } else { | 287 | } else { |
277 | $tags = mysql_real_escape_string(serialize(explode(',', $_POST['tags']))); | 288 | $tags = explode(',', $_POST['tags']); |
278 | 289 | ||
279 | $setpending = "UPDATE pending SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tags = \"" . $tags . "\" WHERE id = " . $_GET['id']; | 290 | $setpending = "UPDATE pending SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\" WHERE id = " . $_GET['id']; |
280 | $setpending2 = mysql_query($setpending); | 291 | $setpending2 = mysql_query($setpending); |
281 | 292 | ||
293 | removeTags($_GET['id'], 'pending'); | ||
294 | addTags($_GET['id'], $tags, 'pending'); | ||
295 | |||
282 | $template = new FITemplate('admin/pendingSuccess'); | 296 | $template = new FITemplate('admin/pendingSuccess'); |
283 | $template->add('ID', $_GET['id']); | 297 | $template->add('ID', $_GET['id']); |
284 | } | 298 | } |
@@ -303,6 +317,8 @@ if (isLoggedIn()) | |||
303 | $delpending = "DELETE FROM pending WHERE id = " . $_GET['id']; | 317 | $delpending = "DELETE FROM pending WHERE id = " . $_GET['id']; |
304 | $delpending2 = mysql_query($delpending); | 318 | $delpending2 = mysql_query($delpending); |
305 | 319 | ||
320 | removeTags($_GET['id'], 'pending'); | ||
321 | |||
306 | $template = new FITemplate('admin/deletedPending'); | 322 | $template = new FITemplate('admin/deletedPending'); |
307 | } | 323 | } |
308 | } else { | 324 | } else { |
@@ -331,7 +347,7 @@ if (isLoggedIn()) | |||
331 | 'RATING' => 0, | 347 | 'RATING' => 0, |
332 | 'TEXT' => parseBBCode($getpending3['text']))); | 348 | 'TEXT' => parseBBCode($getpending3['text']))); |
333 | 349 | ||
334 | $tags = unserialize($getpending3['tags']); | 350 | $tags = getTags($getpending3['id'], 'pending'); |
335 | foreach ($tags as $tag) | 351 | foreach ($tags as $tag) |
336 | { | 352 | { |
337 | $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); | 353 | $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); |
@@ -384,12 +400,19 @@ if (isLoggedIn()) | |||
384 | $delpending = "DELETE FROM pending WHERE id = " . $_GET['id'] . " OR id = " . $otherPending['id']; | 400 | $delpending = "DELETE FROM pending WHERE id = " . $_GET['id'] . " OR id = " . $otherPending['id']; |
385 | $delpending2 = mysql_query($delpending); | 401 | $delpending2 = mysql_query($delpending); |
386 | 402 | ||
387 | $inspending = "INSERT INTO pending (id, title, author, text, tags, slug) VALUES (" . $_GET['id'] . ",\"" . $otherPending['title'] . "\",\"" . $otherPending['author'] . "\",\"" . $otherPending['text'] . "\",\"" . $otherPending['tags'] . "\",\"" . $otherPending['slug'] . "\")"; | 403 | $inspending = "INSERT INTO pending (id, title, author, text, slug) VALUES (" . $_GET['id'] . ",\"" . $otherPending['title'] . "\",\"" . $otherPending['author'] . "\",\"" . $otherPending['text'] . "\",\"" . $otherPending['slug'] . "\")"; |
388 | $inspending2 = mysql_query($inspending); | 404 | $inspending2 = mysql_query($inspending); |
389 | 405 | ||
390 | $ins2pending = "INSERT INTO pending (id, title, author, text, tags, slug) VALUES (" . $otherPending['id'] . ",\"" . $getpending3['title'] . "\",\"" . $getpending3['author'] . "\",\"" . $getpending3['text'] . "\",\"" . $getpending3['tags'] . "\",\"" . $getpending3['slug'] . "\")"; | 406 | $ins2pending = "INSERT INTO pending (id, title, author, text, slug) VALUES (" . $otherPending['id'] . ",\"" . $getpending3['title'] . "\",\"" . $getpending3['author'] . "\",\"" . $getpending3['text'] . "\",\"" . $getpending3['slug'] . "\")"; |
391 | $ins2pending2 = mysql_query($ins2pending); | 407 | $ins2pending2 = mysql_query($ins2pending); |
392 | 408 | ||
409 | $tags1 = getTags($_GET['id'], 'pending'); | ||
410 | $tags2 = getTags($otherPending['id'], 'pending'); | ||
411 | removeTags($_GET['id'], 'pending'); | ||
412 | removeTags($otherPending['id'], 'pending'); | ||
413 | addTags($_GET['id'], $tags2, 'pending'); | ||
414 | addTags($otherPending['id'], $tags1, 'pending'); | ||
415 | |||
393 | $template = new FITemplate('admin/managePending'); | 416 | $template = new FITemplate('admin/managePending'); |
394 | 417 | ||
395 | $getpending = "SELECT * FROM pending ORDER BY id ASC"; | 418 | $getpending = "SELECT * FROM pending ORDER BY id ASC"; |
@@ -436,14 +459,17 @@ if (isLoggedIn()) | |||
436 | $template = new FITemplate('admin/editPost'); | 459 | $template = new FITemplate('admin/editPost'); |
437 | $template->add('ID', $_GET['id']); | 460 | $template->add('ID', $_GET['id']); |
438 | $template->add('TEXT', $getpost3['text']); | 461 | $template->add('TEXT', $getpost3['text']); |
439 | $template->add('TAGS', implode(',', unserialize($getpost3['tags']))); | 462 | $template->add('TAGS', implode(',', getTags($getpost3['id']))); |
440 | $template->add('TITLE', $getpost3['title']); | 463 | $template->add('TITLE', $getpost3['title']); |
441 | } else { | 464 | } else { |
442 | $tags = mysql_real_escape_string(serialize(explode(',', $_POST['tags']))); | 465 | $tags = explode(',', $_POST['tags']); |
443 | 466 | ||
444 | $setpost = "UPDATE updates SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tags = \"" . $tags . "\" WHERE id = " . $_GET['id']; | 467 | $setpost = "UPDATE updates SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\" WHERE id = " . $_GET['id']; |
445 | $setpost2 = mysql_query($setpost); | 468 | $setpost2 = mysql_query($setpost); |
446 | 469 | ||
470 | removeTags($_GET['id']); | ||
471 | addTags($_GET['id'], $tags); | ||
472 | |||
447 | $template = new FITemplate('admin/postSuccess'); | 473 | $template = new FITemplate('admin/postSuccess'); |
448 | $template->add('ID', $_GET['id']); | 474 | $template->add('ID', $_GET['id']); |
449 | $template->add('CODED', $getpost3['slug']); | 475 | $template->add('CODED', $getpost3['slug']); |
@@ -469,6 +495,8 @@ if (isLoggedIn()) | |||
469 | $delpost = "DELETE FROM updates WHERE id = " . $_GET['id']; | 495 | $delpost = "DELETE FROM updates WHERE id = " . $_GET['id']; |
470 | $delpost2 = mysql_query($delpost); | 496 | $delpost2 = mysql_query($delpost); |
471 | 497 | ||
498 | removeTags($_GET['id']); | ||
499 | |||
472 | $template = new FITemplate('admin/deletedPost'); | 500 | $template = new FITemplate('admin/deletedPost'); |
473 | } | 501 | } |
474 | } else { | 502 | } else { |
diff --git a/pages/blog.php b/pages/blog.php index 009326c..879aa0f 100755 --- a/pages/blog.php +++ b/pages/blog.php | |||
@@ -74,7 +74,7 @@ if (isset($_GET['post'])) | |||
74 | 'RATING' => $getpost3['rating'], | 74 | 'RATING' => $getpost3['rating'], |
75 | 'TEXT' => parseBBCode($getpost3['text']))); | 75 | 'TEXT' => parseBBCode($getpost3['text']))); |
76 | 76 | ||
77 | $tags = unserialize($getpost3['tags']); | 77 | $tags = getTags($getpost3['id']); |
78 | foreach ($tags as $tag) | 78 | foreach ($tags as $tag) |
79 | { | 79 | { |
80 | $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); | 80 | $template->adds_ref_sub(0, 'TAGS', array('TAG' => $tag)); |
@@ -135,7 +135,7 @@ if (isset($_GET['post'])) | |||
135 | if (isset($_GET['author'])) | 135 | if (isset($_GET['author'])) |
136 | { | 136 | { |
137 | $title = 'Author: ' . $_GET['author'] . ' - Blog Archive'; | 137 | $title = 'Author: ' . $_GET['author'] . ' - Blog Archive'; |
138 | $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; | 138 | $getposts = "SELECT * FROM updates AS u WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; |
139 | $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\""; | 139 | $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\""; |
140 | $getbio2 = mysql_query($getbio); | 140 | $getbio2 = mysql_query($getbio); |
141 | $getbio3 = mysql_fetch_array($getbio2); | 141 | $getbio3 = mysql_fetch_array($getbio2); |
@@ -148,10 +148,10 @@ if (isset($_GET['post'])) | |||
148 | } elseif (isset($_GET['tag'])) | 148 | } elseif (isset($_GET['tag'])) |
149 | { | 149 | { |
150 | $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive'; | 150 | $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive'; |
151 | $getposts = "SELECT * FROM updates WHERE tags LIKE '%s:" . strlen($_GET['tag']) . ":\"" . $_GET['tag'] . "\"%' ORDER BY id DESC"; | 151 | $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"; |
152 | } else { | 152 | } else { |
153 | $title = 'Blog Archive'; | 153 | $title = 'Blog Archive'; |
154 | $getposts = "SELECT * FROM updates ORDER BY id DESC"; | 154 | $getposts = "SELECT * FROM updates AS u ORDER BY id DESC"; |
155 | } | 155 | } |
156 | $getposts2 = mysql_query($getposts); | 156 | $getposts2 = mysql_query($getposts); |
157 | $i=0; | 157 | $i=0; |
diff --git a/pages/welcome.php b/pages/welcome.php index e267381..6e06006 100755 --- a/pages/welcome.php +++ b/pages/welcome.php | |||
@@ -70,7 +70,7 @@ while ($getpost3 = mysql_fetch_array($getpost2)) | |||
70 | 'RATING' => $getpost3['rating'], | 70 | 'RATING' => $getpost3['rating'], |
71 | 'TEXT' => parseBBCode($getpost3['text']))); | 71 | 'TEXT' => parseBBCode($getpost3['text']))); |
72 | 72 | ||
73 | $tags = unserialize($getpost3['tags']); | 73 | $tags = getTags($getpost3['id']); |
74 | foreach ($tags as $tag) | 74 | foreach ($tags as $tag) |
75 | { | 75 | { |
76 | $template->adds_ref_sub($curID, 'TAGS', array('TAG' => $tag)); | 76 | $template->adds_ref_sub($curID, 'TAGS', array('TAG' => $tag)); |
diff --git a/rss.php b/rss.php index 8dc36b6..1758049 100755 --- a/rss.php +++ b/rss.php | |||
@@ -118,7 +118,7 @@ if (!isset($_GET['mode']) || ($_GET['mode'] == 'blog')) | |||
118 | $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; | 118 | $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; |
119 | } else if ($_GET['blog'] == 'tag') | 119 | } else if ($_GET['blog'] == 'tag') |
120 | { | 120 | { |
121 | $getposts = "SELECT * FROM updates WHERE tags LIKE '%s:" . strlen($_GET['tag']) . ":\"" . $_GET['tag'] . "\"%' ORDER BY id DESC"; | 121 | $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"; |
122 | } else if (!isset($_GET['blog'])) { | 122 | } else if (!isset($_GET['blog'])) { |
123 | $getposts = "SELECT * FROM updates ORDER BY id DESC"; | 123 | $getposts = "SELECT * FROM updates ORDER BY id DESC"; |
124 | } | 124 | } |