From 24503e3abe705acde2df159aeae61be0d009f92e Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 19 Nov 2008 17:27:03 -0500 Subject: Imported sources --- pages/addresses.php | 74 ++++++ pages/admin.php | 661 ++++++++++++++++++++++++++++++++++++++++++++++++ pages/blog.php | 197 +++++++++++++++ pages/comic.php | 177 +++++++++++++ pages/error.php | 84 ++++++ pages/fourm.php | 27 ++ pages/holidates.php | 10 + pages/login.php | 64 +++++ pages/logout.php | 28 ++ pages/poll.php | 85 +++++++ pages/polloftheweek.php | 73 ++++++ pages/post.php | 107 ++++++++ pages/projects.php | 94 +++++++ pages/quotes.php | 166 ++++++++++++ pages/splash.php | 28 ++ pages/vote.php | 115 +++++++++ pages/welcome.php | 81 ++++++ pages/wiki.php | 179 +++++++++++++ 18 files changed, 2250 insertions(+) create mode 100644 pages/addresses.php create mode 100644 pages/admin.php create mode 100644 pages/blog.php create mode 100644 pages/comic.php create mode 100644 pages/error.php create mode 100644 pages/fourm.php create mode 100644 pages/holidates.php create mode 100644 pages/login.php create mode 100644 pages/logout.php create mode 100644 pages/poll.php create mode 100644 pages/polloftheweek.php create mode 100644 pages/post.php create mode 100644 pages/projects.php create mode 100644 pages/quotes.php create mode 100644 pages/splash.php create mode 100644 pages/vote.php create mode 100644 pages/welcome.php create mode 100644 pages/wiki.php (limited to 'pages') diff --git a/pages/addresses.php b/pages/addresses.php new file mode 100644 index 0000000..c97dfad --- /dev/null +++ b/pages/addresses.php @@ -0,0 +1,74 @@ +adds_block('ADDRESS', array('ADDY' => $addy)); +} + +$template->display(); + +?> diff --git a/pages/admin.php b/pages/admin.php new file mode 100644 index 0000000..ca7a7fa --- /dev/null +++ b/pages/admin.php @@ -0,0 +1,661 @@ +add('ID', $getdraft3['id']); + } else if ($_POST['type'] == 'instant') + { + postBlogPost($_POST['title'], sess_get('uname'), $_POST['tag1'], $_POST['tag2'], $_POST['tag3'], $_POST['text']); + + $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,1"; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + $template = new FITemplate('admin/postSuccess'); + $template->add('ID', $getpost3['id']); + $template->add('CODED', $getpost3['slug']); + } else { + if ($_POST['type'] == 'normal') + { + $getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1"; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + if (isset($getpending3['id']) === FALSE) + { + $id = 50; + } else { + $id = $getpending3['id']+1; + } + } else if ($_POST['type'] == 'priority') + { + $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + if (isset($getpending3['id']) === FALSE) + { + $id = 50; + } else { + $id = $getpending3['id']-1; + } + } else { + generateError(404); + } + + $inspending = "INSERT INTO pending (id,title,author,text,tag1,tag2,tag3,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; + $inspending2 = mysql_query($inspending); + + $template = new FITemplate('admin/pendingSuccess'); + $template->add('ID', $id); + } + } + } else if ($_GET['page'] == 'manageDrafts') + { + $template = new FITemplate('admin/manageDrafts'); + + $getdrafts = "SELECT * FROM drafts ORDER BY id ASC"; + $getdrafts2 = mysql_query($getdrafts); + $i=0; + while ($getdrafts3[$i] = mysql_fetch_array($getdrafts2)) + { + $template->adds_block('DRAFT', array( 'TITLE' => $getdrafts3[$i]['title'], + 'AUTHOR' => $getdrafts3[$i]['author'], + 'ID' => $getdrafts3[$i]['id'])); + $i++; + } + } else if ($_GET['page'] == 'editDraft') + { + $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; + $getdraft2 = mysql_query($getdraft); + $getdraft3 = mysql_fetch_array($getdraft2); + + if ($getdraft3['id'] == $_GET['id']) + { + if (!isset($_GET['submit'])) + { + $template = new FITemplate('admin/editDraft'); + $template->add('ID', $_GET['id']); + $template->add('TEXT', $getdraft3['text']); + $template->add('TAG1', $getdraft3['tag1']); + $template->add('TAG2', $getdraft3['tag2']); + $template->add('TAG3', $getdraft3['tag3']); + $template->add('TITLE', $getdraft3['title']); + } else { + if ($_POST['type'] == 'draft') + { + $setdraft = "UPDATE drafts SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; + $setdraft2 = mysql_query($setdraft); + + $template = new FITemplate('admin/draftSuccess'); + $template->add('ID', $_GET['id']); + } else if ($_POST['type'] == 'instant') + { + postBlogPost($_POST['title'], sess_get('uname'), $_POST['tag1'], $_POST['tag2'], $_POST['tag3'], $_POST['text']); + + $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; + $deldraft2 = mysql_query($deldraft); + + $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,1"; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + $template = new FITemplate('admin/postSuccess'); + $template->add('ID', $getpost3['id']); + $template->add('CODED', $getpost3['slug']); + } else { + if ($_POST['type'] == 'normal') + { + $getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1"; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + if (isset($getpending3['id']) === FALSE) + { + $id = 50; + } else { + $id = $getpending3['id']+1; + } + } else if ($_POST['type'] == 'priority') + { + $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + if (isset($getpending3['id']) === FALSE) + { + $id = 50; + } else { + $id = $getpending3['id']-1; + } + } else { + generateError(404); + } + + $inspending = "INSERT INTO pending (id,title,author,text,tag1,tag2,tag3,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; + $inspending2 = mysql_query($inspending); + + $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; + $deldraft2 = mysql_query($deldraft); + + $template = new FITemplate('admin/pendingSuccess'); + $template->add('ID', $id); + } + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); + } + } else if ($_GET['page'] == 'deleteDraft') + { + $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; + $getdraft2 = mysql_query($getdraft); + $getdraft3 = mysql_fetch_array($getdraft2); + + if ($getdraft3['id'] == $_GET['id']) + { + if (!isset($_GET['submit'])) + { + $template = new FITemplate('admin/deleteDraft'); + $template->add('ID', $_GET['id']); + } else { + $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; + $deldraft2 = mysql_query($deldraft); + + $template = new FITemplate('admin/deletedDraft'); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); + } + } else if ($_GET['page'] == 'viewDraft') + { + $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; + $getdraft2 = mysql_query($getdraft); + $getdraft3 = mysql_fetch_array($getdraft2); + + if ($getdraft3['id'] == $_GET['id']) + { + $template = new FITemplate('post'); + $template->adds_block('INTERNAL',array('exi'=>1)); + $template->adds_block('POST', array( 'ID' => $getdraft3['id'], + 'YEARID' => ((date('Y')-2006) % 4), + 'DATE' => date('F dS Y \a\\t g:i:s a'), + 'MONTH' => date('M'), + 'DAY' => date('d'), + 'CODED' => $getdraft3['slug'], + 'TITLE' => $getdraft3['title'], + 'AUTHOR' => $getdraft3['author'], + 'TAG1' => $getdraft3['tag1'], + 'TAG2' => $getdraft3['tag2'], + 'TAG3' => $getdraft3['tag3'], + 'RATING' => 0, + 'TEXT' => parseBBCode($getdraft3['text']))); + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); + } + } else if ($_GET['page'] == 'managePending') + { + $template = new FITemplate('admin/managePending'); + + $getpending = "SELECT * FROM pending ORDER BY id ASC"; + $getpending2 = mysql_query($getpending); + $i=0; + while ($getpending3[$i] = mysql_fetch_array($getpending2)) + { + $template->adds_block('PENDING', array( 'TITLE' => $getpending3[$i]['title'], + 'AUTHOR' => $getpending3[$i]['author'], + 'ID' => $getpending3[$i]['id'])); + $i++; + } + } else if ($_GET['page'] == 'editPending') + { + $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + + if ($getpending3['id'] == $_GET['id']) + { + if (!isset($_GET['submit'])) + { + $template = new FITemplate('admin/editPending'); + $template->add('ID', $_GET['id']); + $template->add('TEXT', $getpending3['text']); + $template->add('TAG1', $getpending3['tag1']); + $template->add('TAG2', $getpending3['tag2']); + $template->add('TAG3', $getpending3['tag3']); + $template->add('TITLE', $getpending3['title']); + } else { + $setpending = "UPDATE pending SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; + $setpending2 = mysql_query($setpending); + + $template = new FITemplate('admin/pendingSuccess'); + $template->add('ID', $_GET['id']); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); + } + } else if ($_GET['page'] == 'deletePending') + { + $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + + if ($getpending3['id'] == $_GET['id']) + { + if (!isset($_GET['submit'])) + { + $template = new FITemplate('admin/deletePending'); + $template->add('ID', $_GET['id']); + } else { + $delpending = "DELETE FROM pending WHERE id = " . $_GET['id']; + $delpending2 = mysql_query($delpending); + + $template = new FITemplate('admin/deletedPending'); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); + } + } else if ($_GET['page'] == 'viewPending') + { + $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + + if ($getpending3['id'] == $_GET['id']) + { + $template = new FITemplate('post'); + $template->adds_block('INTERNAL',array('exi'=>1)); + $template->adds_block('POST', array( 'ID' => $getpending3['id'], + 'YEARID' => ((date('Y')-2006) % 4), + 'DATE' => date('F dS Y \a\\t g:i:s a'), + 'MONTH' => date('M'), + 'DAY' => date('d'), + 'CODED' => $getpending3['slug'], + 'TITLE' => $getpending3['title'], + 'AUTHOR' => $getpending3['author'], + 'TAG1' => $getpending3['tag1'], + 'TAG2' => $getpending3['tag2'], + 'TAG3' => $getpending3['tag3'], + 'RATING' => 0, + 'TEXT' => parseBBCode($getpending3['text']))); + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); + } + } else if ($_GET['page'] == 'managePosts') + { + $template = new FITemplate('admin/managePosts'); + + $getposts = "SELECT * FROM updates ORDER BY id ASC"; + $getposts2 = mysql_query($getposts); + $i=0; + while ($getposts3[$i] = mysql_fetch_array($getposts2)) + { + $template->adds_block('POST', array( 'TITLE' => $getposts3[$i]['title'], + 'AUTHOR' => $getposts3[$i]['author'], + 'ID' => $getposts3[$i]['id'], + 'CODED' => $getposts3[$i]['slug'])); + $i++; + } + } else if ($_GET['page'] == 'editPost') + { + $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + if ($getpost3['id'] == $_GET['id']) + { + if (!isset($_GET['submit'])) + { + $template = new FITemplate('admin/editPost'); + $template->add('ID', $_GET['id']); + $template->add('TEXT', $getpost3['text']); + $template->add('TAG1', $getpost3['tag1']); + $template->add('TAG2', $getpost3['tag2']); + $template->add('TAG3', $getpost3['tag3']); + $template->add('TITLE', $getpost3['title']); + } else { + $setpost = "UPDATE updates SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; + $setpost2 = mysql_query($setpost); + + $template = new FITemplate('admin/postSuccess'); + $template->add('ID', $_GET['id']); + $template->add('CODED', $getpost3['slug']); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); + } + } else if ($_GET['page'] == 'deletePost') + { + $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + if ($getpost3['id'] == $_GET['id']) + { + if (!isset($_GET['submit'])) + { + $template = new FITemplate('admin/deletePost'); + $template->add('ID', $_GET['id']); + } else { + $delpost = "DELETE FROM updates WHERE id = " . $_GET['id']; + $delpost2 = mysql_query($delpost); + + $template = new FITemplate('admin/deletedPost'); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); + } + } else if ($_GET['page'] == 'moderateComments') + { + $template = new FITemplate('admin/moderateComments'); + + $getcomments = "SELECT * FROM moderation ORDER BY id ASC"; + $getcomments2 = mysql_query($getcomments); + $i=0; + while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) + { + $comType = substr($getcomments3[$i]['page_id'],0,strpos($getcomments3[$i]['page_id'],'-')); + $comID = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); + + if ($comType == 'updates') + { + $getpost = "SELECT * FROM updates WHERE id = " . $comID; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + $title = $getpost3['title']; + } else if ($comType = 'polloftheweek') + { + $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $comID; + $getpoll2 = mysql_query($getpoll); + $getpoll3 = mysql_fetch_array($getpoll2); + $title = $getpoll3['question']; + } else if ($comType = 'quotes') + { + $getquote = "SELECT * FROM rash_quotes WHERE id = " . $comID; + $getquote2 = mysql_query($getquote); + $getquote3 = mysql_fetch_array($getquote2); + $title = '#' . $getquote3['id']; + } + + $template->adds_block('COMMENT', array( 'TITLE' => $title, + 'AUTHOR' => $getcomments3[$i]['author'], + 'ID' => $getcomments3[$i]['id'])); + $i++; + } + } else if ($_GET['page'] == 'viewComment') + { + $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; + $getcomment2 = mysql_query($getcomment); + $getcomment3 = mysql_fetch_array($getcomment2); + + if ($getcomment3['id'] == $_GET['id']) + { + $getuser = "SELECT * FROM users WHERE username = \"" . $getcomment3['author'] . "\""; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); + + $template = new FITemplate('admin/viewComment'); + $template->add('ID', $_GET['id']); + $template->add('USERNAME', $getcomment3['author']); + $template->add('CODEDEMAIL', md5(strtolower($getuser3['email']))); + $template->add('TEXT', parseBBCode($getcomment3['comment'])); + $template->add('DATE', date("F dS Y \a\\t g:i:s a",strtotime($getcomment3['pubDate']))); + $template->add('CODEDDEF',urlencode('http://www.fourisland.com/images/error404.png')); + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); + } + } else if ($_GET['page'] == 'actionComment') + { + $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; + $getcomment2 = mysql_query($getcomment); + $getcomment3 = mysql_fetch_array($getcomment2); + + if ($getcomment3['id'] == $_GET['id']) + { + if (isset($_GET['approve'])) + { + $insanon = "INSERT INTO anon_commenters (username,email,website) VALUES (\"" . $getcomment3['author'] . "\",\"" . $getcomment3['email'] . "\",\"" . $getcomment3['website'] . "\")"; + $insanon2 = mysql_query($insanon); + + $inscomment = "INSERT INTO comments (page_id,username,comment) VALUES (\"" . $getcomment3['page_id'] . "\",\"" . $getcomment3['author'] . "\",\"" . $getcomment3['comment'] . "\")"; + $inscomment2 = mysql_query($inscomment); + + $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; + $delcomment2 = mysql_query($delcomment); + + $template = new FITemplate('msg'); + $template->add('BACK', 'Comment Moderation'); + $template->add('MSG', 'You\'ve successfully approved this comment.'); + } else if (isset($_GET['deny'])) + { + $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; + $delcomment2 = mysql_query($delcomment); + + $template = new FITemplate('msg'); + $template->add('BACK', 'Comment Moderation'); + $template->add('MSG', 'You\'ve successfully denied this comment.'); + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', "Um, what on earth are you doing?"); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); + } + } else if ($_GET['page'] == 'managePages') + { + $template = new FITemplate('admin/managePages'); + + $getpages = "SELECT wiki_pages.*, wiki_revisions.author FROM wiki_pages, wiki_revisions WHERE wiki_revisions.id = wiki_pages.revision ORDER BY id ASC"; + $getpages2 = mysql_query($getpages); + $i=0; $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, but this page doesn\'t exist.'); + while ($getpages3[$i] = mysql_fetch_array($getpages2)) + { + $template->adds_block('PAGE', array( 'TITLE' => $getpages3[$i]['title'], + 'AUTHOR' => $getpages3[$i]['author'], + 'ID' => $getpages3[$i]['id'], + 'CODED' => $getpages3[$i]['slug'])); + $i++; + } + } else if ($_GET['page'] == 'pageHistory') + { + $getpage = "SELECT * FROM wiki_pages WHERE id = " . $_GET['id'] . " ORDER BY id ASC"; + $getpage2 = mysql_query($getpage); + $getpage3 = mysql_fetch_array($getpage2); + + if ($getpage3['id'] == $_GET['id']) + { + $template = new FITemplate('admin/pageHistory'); + + $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision']; + $getrev2 = mysql_query($getrev); + $getrev3 = mysql_fetch_array($getrev2); + + $template->adds_block('REV', array( 'AUTHOR' => $getrev3['author'], + 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrev3['pubDate'])), + 'ID' => $getrev3['id'])); + + while ($getrev3['previous'] != 0) + { + $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getrev3['previous']; + $getrev2 = mysql_query($getrev); + $getrev3 = mysql_fetch_array($getrev2); + + $template->adds_block('REV', array( 'AUTHOR' => $getrev3['author'], + 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrev3['pubDate'])), + 'ID' => $getrev3['id'])); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, but this page doesn\'t exist.'); + } + } else if ($_GET['page'] == 'viewRevision') + { + $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $_GET['id']; + $getrev2 = mysql_query($getrev); + $getrev3 = mysql_fetch_array($getrev2); + + if ($getrev3['id'] == $_GET['id']) + { + $template = new FITemplate('admin/viewRevision'); + $template->add('TEXT', $getrev3['text']); + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, but this revision doesn\'t exist.'); + } + } else if ($_GET['page'] == 'pollProcess') + { + if (!isset($_GET['step'])) + { + $template = new FITemplate('admin/pollrss'); + } else if ($_GET['step'] == 2) + { + $insrss = "INSERT INTO pollrss (author,rss) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\")"; + $insrss2 = mysql_query($insrss); + + $template = new FITemplate('admin/newPoll'); + } else if ($_GET['step'] == 3) + { + $inspoll = "INSERT INTO polloftheweek (question,option1,option2,option3,option4) VALUES (\"" . addslashes($_POST['question']) . "\",\"" . $_POST['option1'] . "\",\"" . $_POST['option2'] . "\",\"" . $_POST['option3'] . "\",\"" . $_POST['option4'] . "\")"; + $inspoll2 = mysql_query($inspoll); + + $cleardid = "TRUNCATE TABLE didpollalready"; + $cleardid2 = mysql_query($cleardid); + + $template = new FITemplate('msg2'); + $template->add('BACK', 'Back to the Admin Panel'); + $template->add('LINK', '/admin/'); + $template->add('MSG', "You've successfully created a poll!"); + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', "Um, what on earth are you doing?"); + } + } else if ($_GET['page'] == 'managePendingQuotes') + { + $template = new FITemplate('admin/managePendingQuotes'); + + $getpending = "SELECT * FROM rash_queue ORDER BY id ASC"; + $getpending2 = mysql_query($getpending); + $i=0; + while ($getpending3[$i] = mysql_fetch_array($getpending2)) + { + $template->adds_block('QUOTE', array( 'ID' => $getpending3[$i]['id'], + 'TEXT' => $getpending3[$i]['quote'])); + $i++; + } + } else if ($_GET['page'] == 'actionPendingQuotes') + { + $getpending = "SELECT * FROM rash_queue WHERE id = " . $_GET['id']; + $getpending2 = mysql_query($getpending); + $getpending3 = mysql_fetch_array($getpending2); + + if ($getpending3['id'] == $_GET['id']) + { + if (isset($_GET['approve'])) + { + $insquote = "INSERT INTO rash_quotes (quote) VALUES (\"" . addslashes($getpending3['quote']) . "\")"; + $insquote2 = mysql_query($insquote); + + $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; + $delpending2 = mysql_query($delpending); + + $template = new FITemplate('msg2'); + $template->add('BACK', 'Back to the Admin Panel'); + $template->add('LINK', '/admin/'); + $template->add('MSG', "You've successfully approved this quote."); + } else if (isset($_GET['deny'])) + { + $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; + $delpending2 = mysql_query($delpending); + + $template = new FITemplate('msg2'); + $template->add('BACK', 'Back to the Admin Panel'); + $template->add('LINK', '/admin/'); + $template->add('MSG', "You've successfully denied this quote."); + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', "Um, what on earth are you doing?"); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK', 'the previous page'); + $template->add('MSG', 'I\'m sorry, but this pending quote doesn\'t exist.'); + } + } else { + generateError(404); + } + @$template->display(); + } else { + generateError(404); + } +} else { + generateError(404); +} + +?> 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 @@ +adds_block('INTERNAL',array('exi'=>1)); + + $getpost = "SELECT * FROM updates WHERE slug = \"" . urldecode($_GET['post']) . "\""; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + if ($getpost3['slug'] == urldecode($_GET['post'])) + { + updatePop($getpost3['id'],'views'); + + $title = stripslashes($getpost3['title']) . ' - Blog Archive'; + + $getback = "SELECT * FROM updates WHERE id = " . ($getpost3['id']-1); + $getback2 = mysql_query($getback); + $getback3 = mysql_fetch_array($getback2); + if (isset($getback3['title'])) + { + $template->adds_block('BACK', array( 'CODED' => $getback3['slug'], + 'TITLE' => $getback3['title'])); + } + + $getnext = "SELECT * FROM updates WHERE id = " . ($getpost3['id']+1); + $getnext2 = mysql_query($getnext); + $getnext3 = mysql_fetch_array($getnext2); + if (isset($getnext3['title'])) + { + $template->adds_block('NEXT', array( 'CODED' => $getnext3['slug'], + 'TITLE' => $getnext3['title'])); + } + + $template->adds_block('POST', array( 'ID' => $getpost3['id'], + 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4), + 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])), + 'MONTH' => date('M',strtotime($getpost3['pubDate'])), + 'DAY' => date('d',strtotime($getpost3['pubDate'])), + 'CODED' => $getpost3['slug'], + 'TITLE' => $getpost3['title'], + 'AUTHOR' => $getpost3['author'], + 'TAG1' => $getpost3['tag1'], + 'TAG2' => $getpost3['tag2'], + 'TAG3' => $getpost3['tag3'], + 'RATING' => $getpost3['rating'], + 'TEXT' => parseBBCode($getpost3['text']))); + + $template->display(); + $page_id = 'updates-' . $getpost3['id']; + include('includes/comments.php'); + + $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"; + $getrelated2 = mysql_query($getrelated); + $i=0; + while ($getrelated3[$i] = mysql_fetch_array($getrelated2)) + { + if ($i==0) + { + $template = new FITemplate('related'); + } + + $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], + 'CODED' => $getrelated3[$i]['slug'], + 'AUTHOR' => $getrelated3[$i]['author'], + 'DATE' => date('F d<\S\U\P>S Y',strtotime($getrelated3[$i]['pubDate'])))); + $i++; + } + + if ($i > 0) + { + $template->display(); + } + } else { + generateError('404'); + } +} else { + $template = new FITemplate('archive'); + if (isset($_GET['author'])) + { + $title = 'Author: ' . $_GET['author'] . ' - Blog Archive'; + $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; + $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\""; + $getbio2 = mysql_query($getbio); + $getbio3 = mysql_fetch_array($getbio2); + if ($getbio3['username'] == $_GET['author']) + { + $template->adds_block('BIO', array( 'TEXT' => $getbio3['text'], + 'USERNAME' => $getbio3['username'], + 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getbio3['lastUpdated'])))); + } + } elseif (isset($_GET['tag'])) + { + $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive'; + $getposts = "SELECT * FROM updates WHERE tag1 = \"" . $_GET['tag'] . "\" OR tag2 = \"" . $_GET['tag'] . "\" OR tag3 = \"" . $_GET['tag'] . "\" ORDER BY id DESC"; + } else { + $title = 'Blog Archive'; + $getposts = "SELECT * FROM updates ORDER BY id DESC"; + } + $getposts2 = mysql_query($getposts); + $i=0; + while ($getposts3[$i] = mysql_fetch_array($getposts2)) + { + if ((!isset($lastmonth)) || ($lastmonth != date('m-Y',strtotime($getposts3[$i]['pubDate'])))) + { + if (!isset($curID)) + { + $curID = 0; + } else { + $curID++; + } + $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getposts3[$i]['pubDate'])))); + if ($curID == 0) + { + $template->adds_ref_sub($curID, 'BIGEND',array('exi'=>1)); + } + $lastmonth = date('m-Y',strtotime($getposts3[$i]['pubDate'])); + } + + $page_id = 'updates-' . $getposts3[$i]['id']; + $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; + $getcomments2 = mysql_query($getcomments); + $total_post=0; + while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2)) + { + $total_post++; + } + if ($total_post >= 2) + { + $plural = 's'; + } + if ($total_post == 0) + { + $comText = 'No Comments'; + } elseif ($total_post == 1) + { + $comText = '1 Comment'; + } else { + $comText = $total_post . ' Comments'; + } + + if ($curID == 0) + { + $template->adds_ref_sub($curID, 'BIG',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), + 'CODED' => $getposts3[$i]['slug'], + 'TITLE' => $getposts3[$i]['title'], + 'ID' => $getposts3[$i]['id'], + 'YEARID' => ((date('Y',strtotime($getposts3[$i]['pubDate']))-2006) % 4), + 'MONTH' => date('M',strtotime($getposts3[$i]['pubDate'])), + 'DAY' => date('d',strtotime($getposts3[$i]['pubDate'])), + 'AUTHOR' => $getposts3[$i]['author'], + 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), + 'COMMENTS' => $comText, + 'TAG1' => $getposts3[$i]['tag1'], + 'TAG2' => $getposts3[$i]['tag2'], + 'TAG3' => $getposts3[$i]['tag3'])); + } else { + $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), + 'CODED' => $getposts3[$i]['slug'], + 'TITLE' => $getposts3[$i]['title'])); + } + $i++; + } + if ($i==0) + { + generateError('404'); + } + $template->display(); +} + +?> diff --git a/pages/comic.php b/pages/comic.php new file mode 100644 index 0000000..103cb17 --- /dev/null +++ b/pages/comic.php @@ -0,0 +1,177 @@ +adds_block('INTERNAL',array('exi'=>1)); + + $getcomic = "SELECT * FROM comic WHERE slug = \"" . urldecode($_GET['comic']) . "\""; + $getcomic2 = mysql_query($getcomic); + $getcomic3 = mysql_fetch_array($getcomic2); + + if ($getcomic3['slug'] == urldecode($_GET['comic'])) + { + $title = stripslashes($getcomic3['title']) . ' - Kirby Fan Mail'; + + $getback = "SELECT * FROM comic WHERE id = " . ($getcomic3['id']-1); + $getback2 = mysql_query($getback); + $getback3 = mysql_fetch_array($getback2); + if (isset($getback3['title'])) + { + $template->adds_block('BACK', array( 'CODED' => $getback3['slug'], + 'TITLE' => $getback3['title'])); + } + + $getnext = "SELECT * FROM comic WHERE id = " . ($getcomic3['id']+1); + $getnext2 = mysql_query($getnext); + $getnext3 = mysql_fetch_array($getnext2); + if (isset($getnext3['title'])) + { + $template->adds_block('NEXT', array( 'CODED' => $getnext3['slug'], + 'TITLE' => $getnext3['title'])); + } + + if (stripos($getcomic3['image'], 'gif') !== FALSE) + { + $mode = 'scalegif'; + } else { + $mode = 'scale'; + } + + $template->adds_block('COMIC', array( 'ID' => $getcomic3['id'], + 'YEARID' => ((date('Y',strtotime($getcomic3['pubDate']))-2006) % 4), + 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getcomic3['pubDate'])), + 'MONTH' => date('M',strtotime($getcomic3['pubDate'])), + 'DAY' => date('d',strtotime($getcomic3['pubDate'])), + 'CODED' => $getcomic3['slug'], + 'TITLE' => $getcomic3['title'], + 'RATING' => $getcomic3['rating'], + 'TEXT' => parseBBCode($getcomic3['text']), + 'IMAGE' => $getcomic3['image'], + 'MODE' => $mode)); + + $template->display(); + $page_id = 'kfm-' . $getcomic3['id']; + include('includes/comments.php'); + + $getrelated = "SELECT *, MATCH (title, text) AGAINST (\"" . addslashes($getcomic3['title']) . "\") AS score FROM comic WHERE MATCH (title, text) AGAINST (\"" . addslashes($getcomic3['title']) . "\") AND id <> " . $getcomic3['id'] . " LIMIT 0,5"; + $getrelated2 = mysql_query($getrelated); + $i=0; + while ($getrelated3[$i] = mysql_fetch_array($getrelated2)) + { + if ($i==0) + { + $template = new FITemplate('related'); + } + + $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], + 'CODED' => $getrelated3[$i]['slug'], + 'AUTHOR' => 'Hatkirby', + 'DATE' => date('F d<\S\U\P>S Y',strtotime($getrelated3[$i]['pubDate'])))); + $i++; + } + + if ($i > 0) + { + $template->display(); + } + } else { + generateError('404'); + } +} else { + $template = new FITemplate('comicarchive'); + $title = 'Kirby Fan Mail'; + $getcomics = "SELECT * FROM comic ORDER BY id DESC"; + $getcomics2 = mysql_query($getcomics); + $i=0; + while ($getcomics3[$i] = mysql_fetch_array($getcomics2)) + { + if ((!isset($lastmonth)) || ($lastmonth != date('m-Y',strtotime($getcomics3[$i]['pubDate'])))) + { + if (!isset($curID)) + { + $curID = 0; + } else { + $curID++; + } + $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getcomics3[$i]['pubDate'])))); + if ($curID == 0) + { + $template->adds_ref_sub($curID, 'BIGEND',array('exi'=>1)); + } + $lastmonth = date('m-Y',strtotime($getcomics3[$i]['pubDate'])); + } + + $page_id = 'kfm-' . $getcomics3[$i]['id']; + $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; + $getcomments2 = mysql_query($getcomments); + $total_post=0; + while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2)) + { + $total_post++; + } + if ($total_post >= 2) + { + $plural = 's'; + } + if ($total_post == 0) + { + $comText = 'No Comments'; + } elseif ($total_post == 1) + { + $comText = '1 Comment'; + } else { + $comText = $total_post . ' Comments'; + } + + if ($curID == 0) + { + $template->adds_ref_sub($curID, 'BIG',array( 'DATE' => date('m-d-Y',strtotime($getcomics3[$i]['pubDate'])), + 'CODED' => $getcomics3[$i]['slug'], + 'TITLE' => $getcomics3[$i]['title'], + 'ID' => $getcomics3[$i]['id'], + 'YEARID' => ((date('Y',strtotime($getcomics3[$i]['pubDate']))-2006) % 4), + 'MONTH' => date('M',strtotime($getcomics3[$i]['pubDate'])), + 'DAY' => date('d',strtotime($getcomics3[$i]['pubDate'])), + 'AUTHOR' => 'Hatkirby', + 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), + 'COMMENTS' => $comText)); + } else { + $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getcomics3[$i]['pubDate'])), + 'CODED' => $getcomics3[$i]['slug'], + 'TITLE' => $getcomics3[$i]['title'])); + } + $i++; + } + if ($i==0) + { + generateError('404'); + } + $template->display(); +} + +?> diff --git a/pages/error.php b/pages/error.php new file mode 100644 index 0000000..7f6c505 --- /dev/null +++ b/pages/error.php @@ -0,0 +1,84 @@ +adds_block('NOREFERER',array('exi'=>1)); + } else { + if ((strpos($strReferer,".looksmart.co")>0) || (strpos($strReferer,".ifind.freeserve")>0) || (strpos($strReferer,".ask.co")>0) || (strpos($strReferer,"google.co")>0) || (strpos($strReferer,"altavista.co")>0) || (strpos($strReferer,"msn.co")>0) || (strpos($strReferer,"yahoo.co")>0)) + { + $arrSite = split("/",$strReferer); + $arrParams = split("?",$strReferer); + $strSearchTerms = $arrParams[1]; + $arrParams = split("&",$strSearchTerms); + $strSite = $arrSite[2]; + $sQryStr=""; + $arrQueryStrings = array("q=","p=","ask=","key="); + + for ($i=0;$iadds_block('SEARCHREF',array( 'REF' => $strReferer, + 'SITE' => $strSite, + 'TERMS' => $strSearchTerms)); + } else { + $strSite = $strReferer; + $strSite = split("/",$strSite); + $strSite = $strSite[2]; + + if (preg_match('/fourisland\.com/',$strSite) == 1) + { + $template->adds_block('OURBAD',array('exi'=>1)); + } + $template->adds_block('NORMALREF',array( 'REF' => $strReferer, + 'SITE' => $strSite)); + } + } + + $template->display(); +} diff --git a/pages/fourm.php b/pages/fourm.php new file mode 100644 index 0000000..41ae0a1 --- /dev/null +++ b/pages/fourm.php @@ -0,0 +1,27 @@ + diff --git a/pages/holidates.php b/pages/holidates.php new file mode 100644 index 0000000..29b0ca4 --- /dev/null +++ b/pages/holidates.php @@ -0,0 +1,10 @@ + $val) +{ + $date = sd_clearDate(); + $date += ($num*60*60*24); + echo(''); +} + +?>
IDDateHolidate
' . $num . '' . date('F jS',$date) . '' . $val . '
diff --git a/pages/login.php b/pages/login.php new file mode 100644 index 0000000..6270502 --- /dev/null +++ b/pages/login.php @@ -0,0 +1,64 @@ +add('REDIRECT',$_GET['redirect']); + + $template->add('RECAPTCHA',recaptcha_get_html($publickey)); +} else { + $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); + if (!$resp->is_valid) + { + $template = new FITemplate('login'); + $template->add('REDIRECT',$_GET['redirect']); + $template->adds_block('ERROR',array('msg' => "The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")")); + + $template->add('RECAPTCHA',recaptcha_get_html($publickey)); + } else { + if (verifyUser($_POST['username'], $_POST['password'])) + { + sess_set('uname',$_POST['username']); + header('Location: ' . rawurldecode($_POST['redirect'])); + exit; + } else { + $template = new FITemplate('login'); + $template->add('REDIRECT',$_POST['redirect']); + $template->adds_block('ERROR',array('MSG' => "The username/password pair didn't resolve to a real user. Try logging on again, spelling the password right, or making sure you actually have an a account.")); + + $template->add('RECAPTCHA',recaptcha_get_html($publickey)); + } + } +} + +$template->display(); + +?> diff --git a/pages/logout.php b/pages/logout.php new file mode 100644 index 0000000..69b9386 --- /dev/null +++ b/pages/logout.php @@ -0,0 +1,28 @@ + diff --git a/pages/poll.php b/pages/poll.php new file mode 100644 index 0000000..67f51a8 --- /dev/null +++ b/pages/poll.php @@ -0,0 +1,85 @@ +adds_block('POLL', array( 'ID' => $getpolls3[$i]['id'], + 'QUESTION' => $getpolls3[$i]['question'], + 'WEEK' => date('F jS Y', strtotime($getpolls3[$i]['week'])))); + $i++; + } + + include('pages/polloftheweek.php'); + + $template->display(); +} else { + $template = new FITemplate('poll'); + + $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $_GET['id']; + $getpoll2 = mysql_query($getpoll); + $getpoll3 = mysql_fetch_array($getpoll2); + + $template->add('QUESTION', $getpoll3['question']); + + $getrss = "SELECT * FROM pollrss WHERE id = " . $_GET['id']; + $getrss2 = mysql_query($getrss); + $getrss3 = mysql_fetch_array($getrss2); + + if ($getrss3['id'] == $_GET['id']) + { + $template->adds_block('COMPLETE', array( 'RSS' => parseBBCode($getrss3['rss']), + 'AUTHOR' => $getrss3['author'], + 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrss3['date'])), + 'OPTION1' => $getpoll3['option1'], + 'OPTION2' => $getpoll3['option2'], + 'OPTION3' => $getpoll3['option3'], + 'OPTION4' => $getpoll3['option4'], + 'CLICKS1' => $getpoll3['clicks1'], + 'CLICKS2' => $getpoll3['clicks2'], + 'CLICKS3' => $getpoll3['clicks3'], + 'CLICKS4' => $getpoll3['clicks4'])); + } else { + $template->adds_block('INCOMPLETE', array('exi'=>1)); + } + + $forceDisplay = $_GET['id']; + include('pages/polloftheweek.php'); + unset($forceDisplay); + + $template->display(); + + $page_id = 'polloftheweek-' . $getpoll3['id']; + include('includes/comments.php'); +} + +?> diff --git a/pages/polloftheweek.php b/pages/polloftheweek.php new file mode 100644 index 0000000..930f346 --- /dev/null +++ b/pages/polloftheweek.php @@ -0,0 +1,73 @@ +add('QUESTION', $getpoll3['question']); + $template->add('OPTION1', $getpoll3['option1']); + $template->add('OPTION2', $getpoll3['option2']); + $template->add('OPTION3', $getpoll3['option3']); + $template->add('OPTION4', $getpoll3['option4']); + + $getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; + $getip2 = mysql_query($getip); + $getip3 = mysql_fetch_array($getip2); + + if (($getip3['ip'] != $_SERVER['REMOTE_ADDR']) && (!isset($forceDisplay))) + { + $template->adds_block('FORM',array('exi'=>1)); + } else { + $template->adds_block('DISPLAY',array('exi'=>1)); + + $template->add('PERCENT1', getpercent($getpoll3,'1')); + $template->add('PERCENT2', getpercent($getpoll3,'2')); + $template->add('PERCENT3', getpercent($getpoll3,'3')); + $template->add('PERCENT4', getpercent($getpoll3,'4')); + } +} else { + $setip = "INSERT INTO didpollalready SET ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; + $setip2 = mysql_query($setip); + $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; + $getpoll2 = mysql_query($getpoll); + $getpoll3 = mysql_fetch_array($getpoll2); + $setpoll = "UPDATE polloftheweek SET clicks" . $_POST['options'] . " = " . ($getpoll3['clicks' . $_POST['options']]+1) . " WHERE id = " . $getpoll3['id']; + $setpoll2 = mysql_query($setpoll); + + $template = new FITemplate('msg'); + + $template->add('MSG','

' . $getpoll3['question'] . '

Thank you for voting on the Poll of the Week!
Click here to visit the page for this poll.'); + + $template->display(); +} + +?> diff --git a/pages/post.php b/pages/post.php new file mode 100644 index 0000000..f7990bd --- /dev/null +++ b/pages/post.php @@ -0,0 +1,107 @@ +add('BACK','the previous page'); + +if (!isset($_GET['id'])) +{ + $template->add('MSG','I\'m sorry, but there\'s no page-id set here, so sadly you can\'t comment yet. Why not contact the administratior (link on the HatBar) and tell him that you saw this error?'); +} else { + if ($_POST['comment'] == "") + { + $template->add('MSG','I\'m sorry, but you didn\'t enter a comment!'); + } else { + if (!isLoggedIn()) + { + $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); + if (!$resp->is_valid) + { + $template->add('MSG',"The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")"); + } else { + if (preg_match('/^[A-Za-z0-9!#$&\'*+-\/=?^_`{|}~]+@[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+[A-Za-z]$/', $_POST['email'])) + { + $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $_POST['username'] . "\""; + $getanon2 = mysql_query($getanon); + $getanon3 = mysql_fetch_array($getanon2); + + if ($getanon3['username'] == $_POST['username']) + { + if ($getanon3['email'] == $_POST['email']) + { + $setcomment = "INSERT INTO comments SET page_id = \"" . $_GET['id'] . "\", username = \"" . $_POST['username'] . "\", comment = \"" . $_POST['comment'] . "\""; + $setcomment2 = mysql_query($setcomment); + + $page_id = $_GET['id']; + $comType = substr($page_id,0,strpos($page_id,'-')); + $comID = substr($page_id,strpos($page_id,'-')+1); + if ($comType == 'updates') + { + recalcPop($comID); + } + + $template->add('MSG',"Thank you, " . $getanon3['username'] . ", for posting your valuable comment!"); + } else { + $template->add('MSG',"I'm sorry, but this anonymous username is already in use. If this is in fact you, please verify that you have entered the same email address that you entered the first time you commented here."); + } + } else { + $setcomment = "INSERT INTO moderation SET page_id = \"" . $_GET['id'] . "\", author = \"" . $_POST['username'] . "\", email = \"" . $_POST['email'] . "\", comment = \"" . $_POST['comment'] . "\", website = \"" . $_POST['website'] . "\""; + $setcomment2 = mysql_query($setcomment); + + mail('hatkirby@fourisland.com', 'New comment to moderate on Four Island', 'Some one has anonymously left a comment on Four Island and it will require moderation.'); + + $template->add('MSG',"Thank you for posting your valuable comment!

However, as you aren't logged in, your comment will have to be verified by a moderator before it appears. Sorry!"); + } + } else { + $template->add('MSG',"I'm sorry, but you've entered an invalid email address."); + } + } + } else { + $setcomment = "INSERT INTO comments SET page_id = \"" . $_GET['id'] . "\", username = \"" . sess_get('uname') . "\", comment = \"" . $_POST['comment'] . "\""; + $setcomment2 = mysql_query($setcomment); + + mail('hatkirby@fourisland.com', 'New comment on Four Island!', sess_get('uname') . ' has posted a comment on Four Island under the "page id" ' . $_GET['id']); + + $page_id = $_GET['id']; + $comType = substr($page_id,0,strpos($page_id,'-')); + $comID = substr($page_id,strpos($page_id,'-')+1); + if ($comType == 'updates') + { + recalcPop($comID); + } + + $template->add('MSG',"Thank you, " . sess_get('uname') . ", for posting your valuable comment!"); + } + } +} + +$template->display(); + +?> diff --git a/pages/projects.php b/pages/projects.php new file mode 100644 index 0000000..4129cdf --- /dev/null +++ b/pages/projects.php @@ -0,0 +1,94 @@ +setRespository('http://svn.fourisland.com/' . $_GET['project']); + $svn->setAuth('hatkirby','popstartwo506'); + $data = $svn->getFile($path,$rev); + + if (substr($path,strlen($path)-1,1) != '/') + { + $template->add('DATA', str_replace(' ','      ',str_replace(' ','  ',nl2br(htmlentities($data))))); + $template->adds_block('FILE', array('NAME' => $path)); + } else { + $template->add('DATA', $data); + } + + $logs = $svn->getFileLogs($path); + $template->add('LOGDATA', str_replace("\n\n",'

',htmlentities($logs[count($logs)-1]['comment']))); + $template->add('AUTHOR', $logs[count($logs)-1]['author']); + $template->add('DATE', date('F dS Y \a\\t g:i:s a',strtotime($logs[count($logs)-1]['date']))); + + if ($rev != -1) + { + $template->adds_block('FORWARD', array( 'URL' => ('/projects/' . $_GET['project'] . '/browse' . $path . '?rev=' . ($rev+1)), + 'NUM' => ($rev+1))); + } + + if ($rev == -1) + { + $rev = $svn->getVersion(); + } + + if ($rev != 1) + { + $template->adds_block('BACK', array( 'URL' => ('/projects/' . $_GET['project'] . '/browse' . $path . '?rev=' . ($rev-1)), + 'NUM' => ($rev-1))); + } + } + } else if (isset($_GET['file'])) + { + } +} + +$template->display(); + +?> diff --git a/pages/quotes.php b/pages/quotes.php new file mode 100644 index 0000000..78cd543 --- /dev/null +++ b/pages/quotes.php @@ -0,0 +1,166 @@ +adds_block('SUBMITTED',array('QUOTE' => (nl2br(htmlspecialchars($_POST['rash_quote'])) . "\n"))); + if (!isLoggedIn()) + { + $insquote = "INSERT INTO rash_queue (quote) VALUES(\"" . addslashes(htmlspecialchars($_POST['rash_quote'])) . "\")"; + } else { + $today = mktime(date('G'),date('i'),date('s'),date('m'),date('d'),date('Y')); + $insquote = "INSERT INTO rash_quotes (quote, rating, flag, date) VALUES (\"" . addslashes($_POST['rash_quote']) . "\", 0, 0, \"" . $today . "\")"; + } + $insquote2 = mysql_query($insquote); + } + $template->display(); +} elseif ($_GET['act'] == 'bottom') +{ + $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE rating < 0 ORDER BY rating ASC LIMIT 50"; + quote_generation($query, "Bottom", -1); +} elseif ($_GET['act'] == 'browse') +{ + $query = "SELECT id, quote, rating, flag FROM rash_quotes ORDER BY id ASC "; + quote_generation($query, "Browse", (isset($_GET['page']) ? $_GET['page'] : 1), 10, 5); +} elseif ($_GET['act'] == 'flag') +{ + $template = new FITemplate('msg'); + $tracking_verdict = user_quote_status('flag', $quote_num, $template); + if ($tracking_verdict < 3) + { + $getfla = "SELECT flag FROM rash_quotes WHERE id = " . $quote_num . " LIMIT 0,1"; + $getfla2 = mysql_query($getfla); + $getfla3 = mysql_fetch_array($getfla2); + + if ($getfla3['flag'] == 2) + { + $template->add('MSG',"This quote has been flagged and rechecked by a moderator already."); + } elseif ($getfla3['flag'] == 1) + { + $template->add('MSG',"This quote is currently pending deletion."); + } else { + $template->add('MSG',"You have marked this quote for deletion."); + $setfla = "UPDATE rash_quotes SET flag = 1 WHERE id = " . $quote_num; + $setfla2 = mysql_query($setfla); + } + } + $template->add('BACK','Quote #' . $quote_num); + $template->display(); +} elseif ($_GET['act'] == 'latest') +{ + $query = "SELECT id, quote, rating, flag FROM rash_quotes ORDER BY id DESC LIMIT 50"; + quote_generation($query, "Latest", -1); +} elseif ($_GET['act'] == 'random') +{ + $query = "SELECT id, quote, rating, flag FROM rash_quotes ORDER BY rand() LIMIT 50"; + quote_generation($query, "Random", -1); +} elseif ($_GET['act'] == 'random2') +{ + $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE rating > 1 ORDER BY rand() LIMIT 50"; + quote_generation($query, "Random2", -1); +} elseif ($_GET['act'] == 'search') +{ + if (isset($_GET['fetch'])) + { + if ($_POST['sortby'] == 'rating') + { + $how = 'desc'; + } else { + $how = 'asc'; + } + $getquotes = "SELECT id, quote, rating, flag FROM rash_quotes WHERE quote LIKE \"%" . $_POST['search'] . "%\" ORDER BY " . $_POST['sortby'] . " " . $how . " LIMIT 0," . $_POST['number']; + quote_generation($getquotes, "Query Results", -1); + } + $template = new FITemplate('quotes/search'); + $template->display(); +} elseif ($_GET['act'] == 'top') +{ + $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE rating > 0 ORDER BY rating DESC LIMIT 50"; + quote_generation($query, "Top", -1); +} elseif ($_GET['act'] == 'vote') +{ + $template = new FITemplate('msg'); + $tracking_verdict = user_quote_status('vote', $quote_num,$template); + $template->add('BACK','Quote #' . $quote_num); + $template->display(); + if ($tracking_verdict < 3) + { + if ($_GET['dir'] == "plus") + { + $setquote = "UPDATE rash_quotes SET rating = rating+1 WHERE id = " . $quote_num; + $setquote2 = mysql_query($setquote); + } elseif($_GET['dir'] == "minus") + { + $setquote = "UPDATE rash_quotes SET rating = rating-1 WHERE id = " . $quote_num; + $setquote2 = mysql_query($setquote); + } + } +} else { + if ((is_int($_GET['act']) || ($_GET['act'] != false)) && (verify_int($_GET['act']))) + { + $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE id = " . $_GET['act']; + quote_generation($query, "#" . $_GET['act'], -1); + $page_id = 'quote-' . $_GET['act']; + } else { + $template = new FITemplate('post'); + $template->adds_block('INTERNAL',array('exi'=>1)); + + $getpost = "SELECT * FROM updates WHERE tag1 = \"quotes\" OR tag2 = \"tag2\" OR tag3 = \"tag3\" ORDER BY id DESC LIMIT 0,1"; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + $title = $getpost3['title'] . ' - Blog Archive'; + + $template->adds_block('POST', array( 'ID' => $getpost3['id'], + 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4), + 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])), + 'MONTH' => date('M',strtotime($getpost3['pubDate'])), + 'DAY' => date('d',strtotime($getpost3['pubDate'])), + 'CODED' => urlencode($getpost3['title']), + 'TITLE' => $getpost3['title'], + 'AUTHOR' => $getpost3['author'], + 'TAG1' => $getpost3['tag1'], + 'TAG2' => $getpost3['tag2'], + 'TAG3' => $getpost3['tag3'], + 'TEXT' => parseBBCode($getpost3['text']))); + + $template->display(); + $page_id = 'updates-' . $getpost3['id']; + } + include('includes/comments.php'); +} + +?> diff --git a/pages/splash.php b/pages/splash.php new file mode 100644 index 0000000..0a9ca89 --- /dev/null +++ b/pages/splash.php @@ -0,0 +1,28 @@ +display(); + +?> diff --git a/pages/vote.php b/pages/vote.php new file mode 100644 index 0000000..890b379 --- /dev/null +++ b/pages/vote.php @@ -0,0 +1,115 @@ +add('BACK','Back to ' . stripslashes($getpost3['title'])); + $template->add('LINK','/blog/' . $getpost3['slug'] . '/'); + + if ($_GET['dir'] == 'plus') + { + if (updatePop($_GET['id'],'rating')) + { + $template->add('MSG','Thank you for voting!'); + } else { + $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); + } + } else if ($_GET['dir'] == 'minus') + { + if (updatePop($_GET['id'],'rating',-1)) + { + $template->add('MSG','Thank you for voting!'); + } else { + $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK','the previous page'); + $template->add('MSG','Um, what on earth are you doing?'); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK','the previous page'); + $template->add('MSG','Um, what on earth are you doing?'); + } +} else if ($_GET['mode'] == 'comment') +{ + $getcomment = "SELECT * FROM comments WHERE id = " . $_GET['id']; + $getcomment2 = mysql_query($getcomment); + $getcomment3 = mysql_fetch_array($getcomment2); + + if ($getcomment3['id'] == $_GET['id']) + { + $page_id = $getcomment3['page_id']; + $comID = substr($page_id,strpos($page_id,'-')+1); + + $getpost = "SELECT * FROM updates WHERE id = " . $comID; + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + $template = new FITemplate('msg2'); + $template->add('BACK','Back to ' . stripslashes($getpost3['title'])); + $template->add('LINK','/blog/' . $getpost3['slug'] . '/'); + + if ($_GET['dir'] == 'plus') + { + if (updateCommentPop($_GET['id'])) + { + $template->add('MSG','Thank you for voting!'); + } else { + $template->add('MSG','I\'m sorry, but you\'ve already voted on this comment.'); + } + } else if ($_GET['dir'] == 'minus') + { + if (updateCommentPop($_GET['id'],-1)) + { + $template->add('MSG','Thank you for voting!'); + } else { + $template->add('MSG','I\'m sorry, but you\'ve already voted on this comment.'); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK','the previous page'); + $template->add('MSG','Um, what on earth are you doing?'); + } + } else { + $template = new FITemplate('msg'); + $template->add('BACK','the previous page'); + $template->add('MSG','Um, what on earth are you doing?'); + } +} + +$template->display(); + +?> diff --git a/pages/welcome.php b/pages/welcome.php new file mode 100644 index 0000000..24fd7ad --- /dev/null +++ b/pages/welcome.php @@ -0,0 +1,81 @@ +adds_block('EXTERNAL',array('exi'=>1)); + +$curID = 0; + +$getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,4"; +$getpost2 = mysql_query($getpost); +while ($getpost3 = mysql_fetch_array($getpost2)) +{ + updatePop($getpost3['id'],'home_views'); + + $page_id = 'updates-' . $getpost3['id']; + $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; + $getcomments2 = mysql_query($getcomments); + $total_post=0; + while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2)) + { + $total_post++; + } + if ($total_post >= 2) + { + $plural = 's'; + } + if ($total_post == 0) + { + $comText = 'No Comments'; + } elseif ($total_post == 1) + { + $comText = '1 Comment'; + } else { + $comText = $total_post . ' Comments'; + } + + $template->add_ref($curID, 'POST', array( 'ID' => $getpost3['id'], + 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4), + 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])), + 'MONTH' => date('M',strtotime($getpost3['pubDate'])), + 'DAY' => date('d',strtotime($getpost3['pubDate'])), + 'CODED' => $getpost3['slug'], + 'TITLE' => $getpost3['title'], + 'AUTHOR' => $getpost3['author'], + 'TAG1' => $getpost3['tag1'], + 'TAG2' => $getpost3['tag2'], + 'TAG3' => $getpost3['tag3'], + 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), + 'COMMENTS' => $comText, + 'RATING' => $getpost3['rating'], + 'TEXT' => parseBBCode($getpost3['text']))); + + $curID++; +} + +$template->display(); + +?> diff --git a/pages/wiki.php b/pages/wiki.php new file mode 100644 index 0000000..3e5a410 --- /dev/null +++ b/pages/wiki.php @@ -0,0 +1,179 @@ +add('TITLE', $getpage3['title']); + $template->add('CONTENT', parseBBCode($getrev3['text'])); + $template->display(); + } else { + if (isLoggedIn()) + { + header('Location: ./?action=create'); + exit; + } else { + $template = new FITemplate('msg'); + $template->add('MSG', "The wiki page you are trying to access does not yet exist, and as you are not logged in, you cannot create it. If you would like to, why not log in and create this page?"); + $template->add('BACK', "the previous page"); + $template->display(); + } + } +} else if ($_GET['action'] == 'create') +{ + if (isLoggedIn()) + { + $template = new FITemplate('wiki/create'); + $template->display(); + } else { + $template = new FITemplate('msg'); + $template->add('MSG', "I'm sorry, but you are attempting to create a wiki page while you aren't logged in. Please log in and then return."); + $template->add('BACK', "the previous page"); + $template->display(); + } +} else if ($_GET['action'] == 'edit') +{ + if (isLoggedIn()) + { + $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $page . "\""; + $getpage2 = mysql_query($getpage); + $getpage3 = mysql_fetch_array($getpage2); + + if ($getpage3['slug'] == $page) + { + $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision']; + $getrev2 = mysql_query($getrev); + $getrev3 = mysql_fetch_array($getrev2); + + $template = new FITemplate('wiki/edit'); + $template->add('PAGENAME', $getpage3['title']); + $template->add('PAGETEXT', $getrev3['text']); + $template->display(); + } else { + header('Location: ./?action=create'); + exit; + } + } else { + $template = new FITemplate('msg'); + $template->add('MSG', "I'm sorry, but you are attempting to edit a wiki page while you aren't logged in. Please log in and then return."); + $template->add('BACK', "the previous page"); + $template->display(); + } +} else if ($_GET['action'] == 'submit') +{ + if (isLoggedIn()) + { + if ($_GET['submit'] == 'create') + { + $insrev = "INSERT INTO wiki_revisions (author,text) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\")"; + $insrev2 = mysql_query($insrev); + + $getrev = "SELECT * FROM wiki_revisions WHERE author = \"" . sess_get('uname') . "\" AND text = \"" . addslashes($_POST['text']) . "\" ORDER BY id DESC LIMIT 0,1"; + $getrev2 = mysql_query($getrev); + $getrev3 = mysql_fetch_array($getrev2); + + $slug = generateSlug($_POST['title'],'wiki-pages'); + + $inspage = "INSERT INTO wiki_pages (title,slug,revision) VALUES (\"" . $_POST['title'] . "\",\"" . $slug . "\"," . $getrev3['id'] . ")"; + $inspage2 = mysql_query($inspage); + + $template = new FITemplate('msg2'); + $template->add('MSG', 'YAY! You\'ve just created a page!'); + $template->add('LINK', '/wiki/' . $slug . '/'); + $template->add('BACK', 'View the page you just created'); + $template->display(); + } else if ($_GET['submit'] == 'edit') + { + $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $_GET['page'] . "\""; + $getpage2 = mysql_query($getpage); + $getpage3 = mysql_fetch_array($getpage2); + + $insrev = "INSERT INTO wiki_revisions (author,text,previous) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\"," . $getpage3['revision'] . ")"; + $insrev2 = mysql_query($insrev); + + $getrev4 = "SELECT * FROM wiki_revisions WHERE author = \"" . sess_get('uname') . "\" AND text = \"" . addslashes($_POST['text']) . "\" AND previous = " . $getpage3['revision'] . " ORDER BY id DESC LIMIT 0,1"; + $getrev5 = mysql_query($getrev4); + $getrev6 = mysql_fetch_array($getrev5); + + $setpage = "UPDATE wiki_pages SET revision = " . $getrev6['id'] . " WHERE revision = " . $getpage3['revision']; + $setpage2 = mysql_query($setpage); + + $template = new FITemplate('msg2'); + $template->add('MSG', 'YAY! You\'ve just edited a page!'); + $template->add('LINK', './'); + $template->add('BACK', 'View the page you just edited'); + $template->display(); + } + } else { + $template = new FITemplate('msg'); + $template->add('MSG', "I'm sorry, but you are attempting to edit a wiki page while you aren't logged in. Please log in and then return."); + $template->add('BACK', "the previous page"); + $template->display(); + } +} else if ($_GET['action'] == 'index') +{ + $template = new FITemplate('wiki/index'); + $getpages = "SELECT * FROM wiki_pages, wiki_revisions WHERE wiki_revisions.id = wiki_pages.revision ORDER BY title ASC"; + $getpages2 = mysql_query($getpages); + $i=0; + $lastLetter=''; + while ($getpages3[$i] = mysql_fetch_array($getpages2)) + { + if (substr($getpages3[$i]['title'],0,1) != $lastLetter) + { + if (!isset($curID)) + { + $curID = 0; + } else { + $curID++; + } + $template->add_ref($curID, 'LETTER', array('TITLE' => substr($getpages3[$i]['title'],0,1))); + $lastLetter = substr($getpages3[$i]['title'],0,1); + } + + $template->adds_ref_sub($curID, 'PAGE', array( 'TITLE' => $getpages3[$i]['title'], + 'CODED' => ($getpages3[$i]['slug'] != '' ? $getpages3[$i]['slug'] . '/' : ''), + 'DATE' => date('m-d-y',strtotime($getpages3[$i]['pubDate'])))); + $i++; + } + $template->display(); +} + +?> -- cgit 1.4.1