Exemplo n.º 1
0
<?php

/* CONTROLEUR D'ACTION */
//Appels au modèle
require MODELES . 'forum/insertTopic.php';
/**** Préparation de la vue ****/
$title = 'Creation de topic';
$styles = ['forum.css', 'search.css', 'form.css'];
/**** Affichage de la page ****/
//Appel de la vue :
if (connected()) {
    if (empty($_POST)) {
        // Le formulaire n'a pas été rempli
        vue(['creation_topic'], $styles, $title);
    } else {
        if ($_POST['titre'] && $_POST['message'] && $_POST['id_section'] != 0) {
            $topicId = insertTopic($_POST['titre'], $_POST['message'], $_POST['id_section'], $_SESSION['id']);
            header('Location: ' . getLink(['forum', 'sujet', $topicId]));
            exit;
        } else {
            alert('error', 'Tous les champs sont requis !');
            vue(['creation_topic'], $styles, $title);
        }
    }
} else {
    alert('info', 'Merci de vous connecter pour créer un topic !');
    header('Location: ' . getLink(['membres', 'connexion']));
    exit;
}
Exemplo n.º 2
0
     $book = getBookByName($name);
     while ($book === NULL) {
         $result = insertBook($name);
         if ($result != 1) {
             $book = getBookByName($name);
         }
     }
     require_once 'model/topics.php';
     if ($new_topic == "true") {
         insertTopic($new_topic_name);
         $topic_names[] = $new_topic_name;
     }
     foreach ($topic_names as $topic_name) {
         $topic = getTopicByName($topic_name);
         while ($topic === NULL) {
             $result = insertTopic($name);
             if ($result != 1) {
                 $topic = getTopicByName($name);
             }
         }
         $topics[] = $topic;
     }
     $scripture["book_id"] = $book["book_id"];
     $scripture["chapter"] = $chapter;
     $scripture["verse"] = $verse;
     $scripture["content"] = $content;
     require_once 'model/scriptures.php';
     insertScripture($scripture, $topics);
     header('location: /?action=searchscriptures');
     break;
 case "scripture_result":