Esempio n. 1
0
<?php

require_once "../private/config.php";
require_once "../views/ErrorOrSuccessView.class.php";
require_once "../models/UserManager.class.php";
$userManager = new UserManager($db);
$infView = new ErrorOrSuccessView();
$ok = true;
$idActivity = htmlspecialchars($_GET['idActivity']);
$idUtilisateur = htmlspecialchars($_GET['idUtilisateur']);
$note = htmlspecialchars($_GET['note']);
//if notation don't exist > insert / else update
if (!$userManager->notationExist($idUtilisateur, $idActivite, $note)) {
    $ok = $userManager->addNotation($note);
} else {
    $ok = $userManager->updateNotation($note);
}
//show activity
if ($ok) {
    $infView->successSubscribe();
}
Esempio n. 2
0
<?php

require_once "private/config.php";
require_once "views/GeneralView.class.php";
require_once "views/ErrorOrSuccessView.class.php";
require_once "models/Agenda.class.php";
require_once "models/AgendaManager.class.php";
$agendaManager = new AgendaManager($db);
$viewG = new GeneralView();
$errorView = new ErrorOrSuccessView();
$viewG->header("Creation d'agenda ou d'activité");
$viewG->navBar("Creation d'agenda ou d'activité");
if (isset($_SESSION['login'])) {
    if (isset($_POST['createAgenda'])) {
        $nomAgenda = htmlspecialchars($_POST['nomAgenda']);
        $prioriteAgenda = htmlspecialchars($_POST['prioriteAgenda']);
        if ($nomAgenda == '' && $priorite == '') {
            $errorView->errorNeedToCompleteForm();
        } else {
            //isSuperposable checked
            if (isset($_POST['isSuperposable'])) {
                if (htmlspecialchars($_POST['isSuperposable']) == "isSuperposable") {
                    $data['isSuperposable'] = true;
                }
            } else {
                //isSuperposable not checked
                $data['isSuperposable'] = false;
            }
            $data['id'] = null;
            $data['nom'] = $nomAgenda;
            $data['priorite'] = $prioriteAgenda;
Esempio n. 3
0
<?php

require_once "private/config.php";
require_once "views/GeneralView.class.php";
require_once "views/ErrorOrSuccessView.class.php";
require_once "models/Commentaire.class.php";
require_once "models/CommentaireManager.class.php";
$manager = new CommentaireManager($db);
$errV = new ErrorOrSuccessView();
$viewG = new GeneralView();
$viewG->header("Ajout d'un commentaire");
$viewG->navBar("Ajout d'un commentaire");
if (isset($_POST['commenter'])) {
    if ($_POST['commenter'] == "") {
        $data["commentaire"] = htmlspecialchars($_POST["commentUser"]);
        $data["dateCommentaire"] = date("Y-n-j");
        $data["heureCommentaire"] = date("G:i:s");
        $data["idCommentaireParent"] = '';
        $data["idUtilisateur"] = $_SESSION["idUser"];
        $data["idActivite"] = 2;
        $com = new Commentaire($data);
        $manager->add($com);
        $errV->successCreateComment();
    }
    /*$commentaire = new Commentaire($_POST);
    		$manager->add($commentaire);
    		echo('Votre commentaire a bien été crée <br/>');*/
}
$viewG->footer();
Esempio n. 4
0
<?php

require_once "views/GeneralView.class.php";
$viewG = new GeneralView();
$viewG->header("Connexion");
require_once "views/ErrorOrSuccessView.class.php";
$errorView = new ErrorOrSuccessView();
if (isset($_SESSION['pseudo'])) {
    $errorView->alreadyConnected();
} else {
    //the user has not click on the connexion button => redirect and display error
    if (!isset($_POST['connexion'])) {
        $errorView->errorButtonNotClicked();
        $errorView->redirection(1);
        header('Refresh: 1; url=index.php');
    }
    //Check if the user have complete the form
    if (isset($_POST['login']) && $_POST['login'] != '' && (isset($_POST['pwd']) && $_POST['pwd'] != '')) {
        //force login with uppercase
        $login = htmlspecialchars(ucfirst($_POST['login']));
        $pass = htmlspecialchars($_POST['pwd']);
        $passCrypt = sha1($pass);
        require_once "private/config.php";
        require_once "models/UserManager.class.php";
        $userManager = new UserManager($db);
        //verif if the user exist
        if (!($currentUser = $userManager->verifConnexion($login, $passCrypt))) {
            $errorView->errorUserDoesntExist();
            $errorView->redirection(5);
            header('Refresh: 5; url=index.php');
        } else {
Esempio n. 5
0
<?php

require_once "views/GeneralView.class.php";
require_once "views/ErrorOrSuccessView.class.php";
require_once "private/config.php";
require_once "models/AgendaManager.class.php";
$viewG = new GeneralView();
$errorView = new ErrorOrSuccessView();
$agendaManager = new AgendaManager($db);
$viewG->header("CalendarFactory");
$viewG->navBar("Mes agendas");
if (isset($_SESSION['login'])) {
    $tabInfoAgenda = $agendaManager->getAllAgendaIdOfUser($_SESSION['idUser']);
    $tabAgendaAndFollow = $agendaManager->getAllAgenda($_SESSION['idUser']);
    $viewG->body($tabInfoAgenda, $tabAgendaAndFollow);
} else {
    $errorView->errorNotConnected();
}
$viewG->footer();
Esempio n. 6
0
<?php

require_once "views/GeneralView.class.php";
require_once "views/ErrorOrSuccessView.class.php";
$viewG = new GeneralView();
$errorView = new ErrorOrSuccessView();
$viewG->header("Inscription");
//if we dont have already complete the form, show it
if (!isset($_POST['inscription'])) {
    $viewG->inscriptionPage();
    //since here we will check all fields in the form
} elseif (!isset($_POST['login']) && $_POST['login'] == '') {
    $errorView->errorCompleteForm("login");
    $errorView->redirection(5);
    header('Refresh: 5; url=inscription.php');
} elseif (!isset($_POST['pwd']) && $_POST['pwd'] == '') {
    $errorView->errorCompleteForm("mot de passe");
    $errorView->redirection(5);
    header('Refresh: 5; url=inscription.php');
} elseif (!isset($_POST['nom']) && $_POST['nom'] == '') {
    $errorView->errorCompleteForm("nom");
} elseif (!isset($_POST['prenom']) && $_POST['prenom'] == '') {
    $errorView->errorCompleteForm("prenom");
    $errorView->redirection(5);
    header('Refresh: 5; url=inscription.php');
} elseif (!isset($_POST['adresse']) && $_POST['adresse'] == '') {
    $errorView->errorCompleteForm("adresse");
    $errorView->redirection(5);
    header('Refresh: 5; url=inscription.php');
    //last check if the two password are the same
} elseif ($_POST['pwd'] != $_POST['pwdConfirm']) {
Esempio n. 7
0
<?php

/*
	deconnexion.php : deconnexion controller

	Author : Karakayn
*/
require_once './views/GeneralView.class.php';
$viewG = new GeneralView();
require_once "views/ErrorOrSuccessView.class.php";
$errorView = new ErrorOrSuccessView();
$viewG->header("KreaturWorld - Deconnexion");
//destroy session variable => deconnexion
$_SESSION = array();
session_destroy();
$errorView->successDeconnexion();
$errorView->redirection(5);
header('Refresh: 5; url=index.php');
$viewG->footer();