$project->setState('Extended');
            }
        }
        $project->store();
        $project->submitLog('Status changed to ' . $project->getState(), $user->getId());
        fURL::redirect("/storage/{$project->getId()}");
    } catch (fValidationException $e) {
        echo $e->printMessage();
    } catch (fSQLException $e) {
        echo '<div class="alert alert-danger">An unexpected error occurred, please try again later</div>';
    }
}
// has another member updated the status?
if (isset($_POST['submit']) && ($user->getId() != $project->getUserId() || $user->isAdmin())) {
    try {
        fRequest::validateCSRFToken($_POST['token']);
        if (!isset($_POST['state']) || $_POST['state'] == '') {
            throw new fValidationException('Status field is required.');
        }
        $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
Пример #2
0
        fURL::redirect($manage_url);
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/ackAll_results.php';
} else {
    if ($action == 'notifyAll') {
        try {
            $check = new Check($check_id);
            $subject_mail = fRequest::get('subject_mail');
            $content_mail = fRequest::get('content_mail');
            if (fRequest::isPost()) {
                if (empty($subject_mail) || empty($content_mail)) {
                    fMessaging::create('error', fURL::get(), "You have to fill the subject and the content to send this mail");
                } else {
                    fRequest::validateCSRFToken(fRequest::get('token'));
                    $recipients = array();
                    $id_user_session = fSession::get('user_id');
                    $user_session = new User($id_user_session);
                    $recipients[] = array("mail" => $user_session->getEmail(), "name" => $user_session->getUsername());
                    $alt_ids = array();
                    $subscription_alt = Subscription::findAll($check_id, NULL, NULL, NULL, TRUE);
                    foreach ($subscription_alt as $alt) {
                        $user = new User($alt->getUserId());
                        $recipients[] = array("mail" => usr_var('alt_email', $user->getUserId()), "name" => $user->getUsername());
                        $alt_ids[] = $alt->getUserId();
                    }
                    $subscriptions = $db->query("SELECT DISTINCT user_id,check_id FROM subscriptions WHERE check_id=" . $check_id . ";");
                    foreach ($subscriptions as $sub) {
                        $user_id = $sub['user_id'];
                        if (!in_array($user_id, $alt_ids) && $user_id != $id_user_session) {