diff options
Diffstat (limited to 'pages')
-rwxr-xr-x | pages/admin.php | 60 | ||||
-rwxr-xr-x | pages/blog.php | 8 | ||||
-rwxr-xr-x | pages/welcome.php | 2 |
3 files changed, 49 insertions, 21 deletions
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)); |