Guest User

Untitled

a guest
Jul 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. <?
  2.  
  3. ob_start();
  4. session_start();
  5. include 'include.php';
  6.  
  7. $b = new board;
  8. $t = new Thread;
  9. $p = new post;
  10. $tp = new template;
  11. $u = new user;
  12. $s = new success;
  13.  
  14. $tp->setGlobals(array('userID' => $u->getUserID()));
  15.  
  16. $tp->build('header');
  17. $tp->build('login', $u->checkLogin());
  18. $s->show();
  19.  
  20. if(isset($_GET['post'])) {
  21. if(isset($_GET['edit'])) {
  22. $getPost = $p->getPosts((int) $_GET['postID'], false);
  23. if($getPost != false) {
  24. $tp->build('editpost', $getPost);
  25. } elseif(isset($_POST['postUpdate'])) {
  26. $p->editPost($_POST['postMessage'], $_POST['postID']);
  27. $s->set('Posting edited.');
  28. redirect('?thread&threadID=' .(int)$_POST['threadID']);
  29. } else {
  30. error::show('Posting does not exist.');
  31. }
  32. }
  33. }elseif(isset($_GET['thread'])) {
  34. if(isset($_GET['reply'])) {
  35. if(isset($_POST['replySubmit']) && $t->showThread($_POST['threadID']) != false) {
  36. $postID = $p->addPost($_POST['postMessage'], $_POST['threadID'], $u->getUserID(), "", time());
  37. $s->set('Posting added.');
  38. redirect('?thread&threadID=' .$_POST['threadID']. '#post'. $postID);
  39. } else {
  40. $tp->build('addreply');
  41. }
  42. } elseif(isset($_GET['threadID'])) {
  43. $tp->build('thread', $t->showThread((int) $_GET['threadID']));
  44. } elseif(isset($_GET['new']) && $u->checkLogin()) {
  45. if(isset($_POST['threadSubmit']) && $b->getBoardInfo($_POST['boardID']) != false) {
  46. $threadID = $t->newThread($_POST['threadTopic'], $_POST['threadMessage'], $_POST['boardID']);
  47. $s->set('Thread created.');
  48. redirect('?thread&threadID=' .$threadID);
  49. } else {
  50. $tp->build('newthread');
  51. }
  52. }
  53. } elseif(isset($_GET['board'])) {
  54. if($b->getBoardInfo($_GET['boardID']) != false)
  55. $tp->build('threads', array('boardinfo' => $b->getBoardInfo($_GET['boardID']), 'threads' => $t->getThreadList((int) $_GET['boardID'])));
  56. else
  57. error::show("boardID doesn't exists");
  58. } elseif(isset($_GET['user'])) {
  59. if(isset($_GET['login']) && isset($_POST['loginName'])) {
  60. $u->userLogin($_POST['loginName'], $_POST['loginPass']);
  61. redirect('./');
  62. } elseif(isset($_GET['logout']) && $u->checkLogin()) {
  63. $u->userLogout();
  64. $s->set('Successfully logged out.');
  65. redirect('./');
  66. }
  67. } else {
  68. $tp->build('boards', $b->getBoards());
  69. }
  70.  
  71. $tp->build('footer');
  72.  
  73.  
  74. ?>
Add Comment
Please, Sign In to add comment