include_once 'library.php'; include_once 'header.php'; include_once 'user.php'; // Note we are not using $_POST. // http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/ $params = json_decode(file_get_contents('php://input'), true); $request = $params['r']; // should do safety check (null values, user permissions, etc.) if ($request == 'newPost') { //$post_id, $pinned, $board_id, $title, $content, $user_id echo DBSavePost(-1, $params['pinned'], $params['bName'], $params['title'], $params['content'], $_SESSION['UserID'], $params['addedTags'], $params['deletedTags']); //BY: $_SESSION['added/deletedTags'] to $params['added/deletedTags'] } else { if ($request == 'editPost') { if ($params['pId']) { DBSavePost($params['pId'], $params['pinned'], $params['bName'], $params['title'], $params['content'], $_SESSION['UserID'], $params['addedTags'], $params['deletedTags']); //BY: $_SESSION['added/deletedTags'] to $params['added/deletedTags'] } } else { if ($request == 'deletePost') { DBDeletePost($params['pId'], $_SESSION['UserID']); } else { if ($request == 'newComment') { $parentComment = $params['parentComment']; if ($parentComment == null) { $parentComment = -1; } $parentPost = $params['parentPost']; if ($parentPost == null) { $parentPost = -1; }
} else { if ($_GET['t'] == 3) { echo CheckUserName($_GET['UserName']); } else { if ($_GET['t'] == 4) { echo CheckEmailAddress($_GET['EmailAddress']); } else { if ($_GET['t'] == 5) { echo GetLatestFeed(json_decode($_GET['FeedBoard'], true)); //BY: added json_decode } else { if ($_GET['t'] == 6) { for ($i = 0; $i < sizeof($addedTags); $i++) { echo $addedTags[$i] . " "; } echo DBSavePost(-1, $_GET['pinned'], $_GET['bName'], $_GET['title'], $_GET['content'], $_GET['UserID'], $_GET['addedTags'], $_GET['deletedTags']); } else { if ($_GET['t'] == 7) { echo EnableUser(fnDecrypt($_GET['c'])); } else { if ($_GET['t'] == 8) { if ($_GET['c'] == "signup") { FacebookSignUp($_GET['url']); } else { if ($_GET['c'] == "login") { FacebookLogin($_GET['url']); } } } else { if ($_GET['t'] == 9) { echo FacebookUrl($_GET['c'], $_GET['url']);