public function ViewCalendar($blogID, $year, $month) { $postsarray = BusinessLogic_Post_Post::GetInstance()->GetDatesWithPostsForMonth($blogID, $year, $month); return new Presentation_View_ViewCalendarView($blogID, $postsarray, $year, $month); }
public function HandleRequest() { $request = $_GET['Action']; switch ($request) { case 'EditUserData': return $this->EditUserData(); break; case 'ProcessEditUserData': $newPasswordsSame = $_POST['newPassword'] == $_POST['confirmNewPassword']; if ($_POST['email'] != '') { if ($_POST['oldPassword'] == '') { //want to change email but not password if ($_POST['newPassword'] == '' and $newPasswordsSame) { return $this->ProcessEditUserData($_POST['email'], '', ''); } elseif ($_POST['newPassword'] != '' and $newPasswordsSame) { return new Presentation_View_ViewEditUserDataView($_GET['blogID'], $this->userInfo['Email'], 'Old Password cannot be blank.'); } else { return new Presentation_View_ViewEditUserDataView($_GET['blogID'], $this->userInfo['Email'], 'New Password and Confirmation Password do not match.'); } } elseif ($_POST['newPassword'] != '' and $newPasswordsSame) { if ($this->VerifyPassword($_POST['newPassword'])) { return $this->ProcessEditUserData($_POST['email'], $_POST['oldPassword'], $_POST['newPassword']); } else { return new Presentation_View_ViewEditUserDataView($_GET['blogID'], $this->userInfo['Email'], 'New Password must be between 6 and 20 characters.'); } } elseif ($_POST['newPassword'] == $_POST['confirmNewPassword']) { return new Presentation_View_ViewEditUserDataView($_GET['blogID'], $this->userInfo['Email'], 'All password fields must be entered in.'); } else { return new Presentation_View_ViewEditUserDataView($_GET['blogID'], $this->userInfo['Email'], 'New Password and Confirmation Password do not match.'); } } else { return new Presentation_View_ViewEditUserDataView($_GET['blogID'], $this->userInfo['Email'], 'Email cannot be blank'); } break; case 'ViewRegister': return $this->ViewRegister(); break; case 'ProcessRegister': //Form filled in if ($_POST['username'] != '' and $_POST['email'] != '' and $_POST['password'] != '' and $_POST['confirmPassword'] != '') { if ($_POST['password'] == $_POST['confirmPassword']) { //Enforce length requirements if ($this->VerifyUsername($_POST['username'])) { if ($this->VerifyPassword($_POST['password'])) { return $this->ProcessRegister($_POST['username'], $_POST['email'], $_POST['password']); } else { return new Presentation_View_ViewRegisterView($_POST['username'], $_POST['email'], 'Password must be between 6 and 20 characters and contain no spaces.'); } } else { return new Presentation_View_ViewRegisterView($_POST['username'], $_POST['email'], 'Username must be between 5 and 15 characters and contain no spaces.'); } } else { return new Presentation_View_ViewRegisterView($_POST['username'], $_POST['email'], 'Password and Confirmation Password do not match.'); } } else { return new Presentation_View_ViewRegisterView($_POST['username'], $_POST['email'], 'You must fill in the entire form.'); } break; case 'ViewSignIn': return $this->ViewSignIn(); break; case 'ProcessSignIn': if ($_POST['username'] != '' and $_POST['password'] != '') { return $this->ProcessSignIn($_POST['username'], $_POST['password']); } else { return new Presentation_View_ViewSignInView('You must fill in the entire form.'); } break; case 'ProcessSignOut': return $this->ProcessSignOut(); break; case 'AcceptInvitation': if (isset($_GET['invitingBlogID'])) { return $this->AcceptInvitation($_GET['invitingBlogID']); } else { throw new Exception('Malformed Action Request.'); } break; case 'DeclineInvitation': if (isset($_GET['invitingBlogID'])) { return $this->DeclineInvitation($_GET['invitingBlogID']); } else { throw new Exception('Malformed Action Request.'); } break; case 'ViewInvitation': return $this->ViewInvitation($_GET['blogID']); break; case 'AddInvitation': return $this->AddInvitation($_GET['blogID'], ''); break; case 'ProcessAddInvitation': if (isset($_POST['username']) and $_POST['rank']) { return $this->ProcessAddInvitation($_GET['blogID'], $_POST['username'], $_POST['rank']); } else { return $this->AddInvitation($_GET['blogID'], 'Form not filled in completely.'); } break; case 'RemoveInvitation': return $this->RemoveInvitation($_GET['blogID']); break; case 'ProcessRemoveInvitation': return $this->ProcessRemoveInvitation($_GET['blogID']); break; case 'ChangeMemberRank': return $this->ChangeMemberRank($_GET['blogID']); break; case 'ProcessChangeMemberRank': return $this->ProcessChangeMemberRank($_GET['blogID']); break; case 'RemoveMember': return $this->RemoveMember($_GET['blogID']); break; case 'ProcessRemoveMember': return $this->ProcessRemoveMember($_GET['blogID']); break; case 'LeaveBlog': if (isset($_GET['leavingBlogID'])) { return $this->LeaveBlog($_GET['blogID'], $_GET['leavingBlogID']); } else { throw new Exception('Malformed Action.'); } break; case 'ProcessLeaveBlog': if (isset($_GET['leavingBlogID'])) { return $this->ProcessLeaveBlog($_GET['blogID'], $_GET['leavingBlogID']); } else { throw new Exception('Malformed Action.'); } break; case 'DeleteBlog': if (isset($_GET['deleteBlogID'])) { return $this->DeleteBlog($_GET['blogID'], $_GET['deleteBlogID']); } else { throw new Exception('Malformed Action.'); } break; case 'ProcessDeleteBlog': if (isset($_GET['deleteBlogID'])) { return $this->ProcessDeleteBlog($_GET['deleteBlogID']); } else { throw new Exception('Malformed Action.'); } break; default: return BusinessLogic_Post_Post::GetInstance()->HandleRequest(); } }
public function ViewRSS($blogID) { $rssView = BusinessLogic_Post_Post::GetInstance()->ViewRSS($blogID, 10); $blogData = BusinessLogic_Blog_BlogDataAccess::GetInstance()->GetBlogInfo($blogID); $blogurl = $_SERVER['SCRIPT_URI'] . '?Action=ViewBlog&blogID=' . $blogID; $posturlprefix = $_SERVER['SCRIPT_URI'] . '?Action=ViewPost&blogID=' . $blogID . '&postID='; $rssView->AddBlogInfo($blogData[0], $blogData[1], $blogurl, $posturlprefix); return $rssView; }