}
        $newStatus = filter_var($_POST['state'], FILTER_SANITIZE_STRING);
        $reason = filter_var($_POST['reason'], FILTER_SANITIZE_STRING);
        if ($newStatus != $project->getState() && $project->canTransitionStates($project->getState(), $newStatus)) {
            $project->setState($newStatus);
            $project->store();
            if ($reason != '') {
                $reason = ' with the reason \'' . $reason . "'";
            }
            // log the update
            $project->submitLog('Status changed to ' . $project->getState() . $reason, $user->getId());
            if ($project->getState() != 'Archived') {
                // send to mailing list
                $project->submitMailingList('Status changed to ' . $project->getState() . $reason . " by " . htmlspecialchars($user->getFullName()));
                // inform the owner
                $project->submitEmailToOwner("Dear {$projectUser->getFullName()},<br/><br/>" . "This is an automatic email to let you know your project {$project->getName()} has been updated with status {$project->getState()}{$reason}.<br/><br/>" . "If you have any questions or concerns regarding this change you can discuss this with members on the <a href=\"{$project->getMailingListURL()}\">Mailing List</a>.<br/><br/>" . "Best,<br/>Monkeys in the machine");
            }
        }
        fURL::redirect("/storage/list.php");
    } catch (fValidationException $e) {
        echo $e->printMessage();
    } catch (fSQLException $e) {
        echo '<div class="alert alert-danger">An unexpected error occurred, please try again later</div>';
    }
}
?>

<?php 
if ($user->getId() == $project->getUserId() && ($project->getState() == 'Pending Approval' || $project->getState() == 'Unapproved')) {
    ?>
	<small class="edit_bttn">