buckys_redirect('/moderator.php'); } if ($_GET['action'] == 'reset-voting') { //Confirm that the user is administrator if (!buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) { buckys_redirect('/moderator.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } BuckysModerator::resetVotes(); buckys_redirect('/moderator.php'); } } //Process Actions if (isset($_POST['action'])) { if ($_POST['action'] == 'apply_candidate') { if (isset($_POST['candidate_id'])) { BuckysModerator::updateCandidate($_POST['candidate_id'], $userID, $_POST['moderator_text']); buckys_redirect('/moderator.php', MSG_UPDATE_CANDIDATE_SUCCESSFULLY); } else { $newID = BuckysModerator::applyCandidate($userID, $_POST['moderator_text']); buckys_redirect('/moderator.php', MSG_APPLY_JOB_SUCCESSFULLY); } } if ($_POST['action'] == 'thumb-up' || $_POST['action'] == 'thumb-down') { if (!$_POST['candidateID'] || !$_POST['candidateIDHash'] || !buckys_check_id_encrypted($_POST['candidateID'], $_POST['candidateIDHash'])) { $data = ['status' => 'error', 'message' => MSG_INVALID_REQUEST]; } else { $result = BuckysModerator::voteCandidate($userID, $_POST['candidateID'], $_POST['action'] == 'thumb-up' ? true : false); if (is_int($result)) { $data = ['status' => 'success', 'message' => MSG_THANKS_YOUR_VOTE, 'votes' => ($result > 0 ? "+" : "") . $result]; } else { $data = ['status' => 'error', 'message' => $result];