Пример #1
0
function ajoutPost()
{
    $idFil = $_REQUEST['idFil'];
    $idSection = $_REQUEST['idSection'];
    $texte = convertDataSent($_REQUEST['texte']);
    $intrusion = Securisator::checkIntrusion($texte);
    if ($intrusion) {
        $reponse = array('statut' => 'intrusion');
    } else {
        $reponse = array('statut' => 'ok');
        $arch = new Archiviste();
        $post = new post();
        date_default_timezone_set('Europe/Paris');
        $date = time();
        $post->set('idUser', $_SESSION['id']);
        $post->set('texte', $texte);
        $post->set('idFil', $idFil);
        $post->set('date', $date);
        $idPost = $arch->archiver($post);
        $fil = new Fil();
        $fil->set('id', $idFil);
        $filNew = new Fil();
        $filNew->set('idPost', $idPost);
        $arch->modifier($fil, $filNew);
        $section = new Section();
        $section->set('id', $idSection);
        $sectionNew = new Section();
        $sectionNew->set('idFil', $idFil);
        $arch->modifier($section, $sectionNew);
    }
    return $reponse;
}