Example #1
0
 function authentifier()
 {
     $this->vue = new V_Vue("../vues/templates/template.inc.php");
     $daoCateg = new M_DaoCategorie();
     $daoCateg->connecter();
     $this->vue->ajouter('listeCateg', $daoCateg->getAll());
     $daoCateg->deconnecter();
     $this->vue->ajouter('titreVue', "LAFLEUR : Accueil");
     //------------------------------------------------------------------------
     // VUE CENTRALE
     //------------------------------------------------------------------------
     $daoClient = new M_DaoClient();
     $daoClient->connecter();
     // Vérifier login et mot de passe saisis dans la formulaire d'authentification
     if (isset($_POST['login']) && isset($_POST['mdp'])) {
         $login = $_POST['login'];
         $mdp = $_POST['mdp'];
         if ($daoClient->verifierLogin($login, $mdp)) {
             // Si le login et le mot de passe sont valides, ouvrir une nouvelle session
             Session::authentifier(array('login' => $login));
             // service minimum
             $this->vue->ajouter('message', "Authentification réussie");
             $this->vue->ajouter('centre', "../vues/includes/accueil/centre.inc.php");
         } else {
             $this->vue->ajouter('message', "ECHEC d'identification : login ou mot de passe inconnus ");
             $this->vue->ajouter('centre', "../vues/includes/accueil/centre.seConnecter.inc.php");
         }
     } else {
         $this->vue->ajouter('message', "Attention : le login ou le mot de passe ne sont pas renseignés");
         $this->vue->ajouter('centre', "../vues/includes/accueil/centre.seConnecter.inc.php");
     }
     //------------------------------------------------------------------------
     $this->vue->ajouter('loginAuthentification', Session::getAuth('login'));
     $daoClient->deconnecter();
     $this->vue->afficher();
 }
Example #2
0
<?php

require_once dirname(__FILE__) . "/config.inc.php";
require_once dirname(__FILE__) . "/classes/session.class.php";
$session = new Session($config);
$template = $config->getTemplate($session->getAuth());
$boardid = !empty($_REQUEST["boardid"]) ? $_REQUEST["boardid"] : null;
try {
    $board = $config->getBoard($boardid);
    if (!$board->mayRead($session->getAuth())) {
        throw new Exception("Keine Berechtigung!");
    }
    $connection = $board->getConnection();
    if ($connection !== null) {
        $connection->open($session->getAuth());
        $group = $connection->getGroup();
        $connection->close();
        // Erzwinge mindestens eine Seite
        $pages = max(ceil($group->getThreadCount() / $config->getThreadsPerPage()), 1);
        $page = 0;
        if (isset($_REQUEST["page"])) {
            $page = intval($_REQUEST["page"]);
        }
        // Vorsichtshalber erlauben wir nur Seiten, auf dennen auch Nachrichten stehen
        if ($page < 0 || $page > $pages) {
            $page = 0;
        }
        $threads = array();
        /** getThreadIDs() gibt alle ThreadIDs in der Reihenfolge Alt => Neu
         * zurueck. In der Forendarstellung wollen wir die neuesten x Threads
         * von Neu => Alt. */
Example #3
0
<?php

require_once dirname(__FILE__) . "/config.inc.php";
require_once dirname(__FILE__) . "/classes/session.class.php";
$session = new Session($config);
$template = $config->getTemplate($session->getAuth());
$boardid = $_REQUEST["boardid"];
$messageid = isset($_REQUEST["messageid"]) ? $config->decodeMessageID($_REQUEST["messageid"]) : null;
$wertung = isset($_REQUEST["wertung"]) ? intval($_REQUEST["wertung"]) : +1;
try {
    $board = $config->getBoard($boardid);
    if (!$board->mayAcknowledge($session->getAuth())) {
        throw new Exception("Keine Berechtigung!");
    }
    $connection = $board->getConnection();
    if ($connection === null) {
        throw new Exception("Board enthaelt keine Group!");
        exit;
    }
    /* Thread laden */
    // Sobald die Verbindung geoeffnet ist, beginnen wir einen Kritischen Abschnitt!
    $connection->open($session->getAuth());
    $group = $connection->getGroup();
    $connection->close();
    $message = $group->getMessage($messageid);
    $thread = $group->getThread($messageid);
    if (!$message instanceof Message) {
        throw new Exception("Message konnte nicht zugeordnet werden.");
        exit;
    }
    // TODO mehrfache zustimmungen?
Example #4
0
<?php

require_once dirname(__FILE__) . "/config.inc.php";
require_once dirname(__FILE__) . "/classes/session.class.php";
require_once dirname(__FILE__) . "/classes/cancel.class.php";
$session = new Session($config);
$template = $config->getTemplate($session->getAuth());
function recurseMarkRead($board, $auth)
{
    if ($board->hasThreads()) {
        $connection = $board->getConnection();
        $connection->open($auth);
        $auth->markReadGroup($connection->getGroup());
        $connection->close();
    }
    foreach ($board->getSubBoardIDs() as $boardid) {
        recurseMarkRead($board->getSubBoard($boardid), $auth);
    }
}
if (isset($_REQUEST["markread"])) {
    $boardid = is_numeric($_REQUEST["markread"]) ? intval($_REQUEST["markread"]) : null;
    $board = $config->getBoard($boardid);
    recurseMarkRead($board, $session->getAuth());
}
if (isset($_SERVER["HTTP_REFERER"])) {
    header("Location: " . $_SERVER["HTTP_REFERER"]);
} else {
    header("Location: /");
}
Example #5
0
<?php

require_once dirname(__FILE__) . "/config.inc.php";
require_once dirname(__FILE__) . "/classes/session.class.php";
$session = new Session($config);
$boardid = $_REQUEST["boardid"];
$messageid = $config->decodeMessageID($_REQUEST["messageid"]);
$partid = $_REQUEST["partid"];
try {
    $board = $config->getBoard($boardid);
    if (!$board->mayRead($session->getAuth())) {
        throw new Exception("Keine Berechtigung!");
        exit;
    }
    $connection = $board->getConnection();
    if ($connection === null) {
        throw new Exception("Board enthaelt keine Group!");
    }
    $connection->open($session->getAuth());
    $group = $connection->getGroup();
    $connection->close();
    $message = $group->getMessage($messageid);
    if ($message === false) {
        $attachment = $session->getAttachment($partid);
    } else {
        $attachment = $message->getAttachment($partid);
    }
    if ($attachment === null) {
        throw new Exception("Attachment ungueltig!");
    }
    $disposition = $attachment->getDisposition();
Example #6
0
<?php

require_once dirname(__FILE__) . "/config.inc.php";
require_once dirname(__FILE__) . "/classes/session.class.php";
$session = new Session($config);
$template = $config->getTemplate($session->getAuth());
try {
    if ($config->getIndexer() == null) {
        throw new Exception("Search not available: No indexer used.");
    }
    if (isset($_REQUEST["term"])) {
        $term = $_REQUEST["term"];
        $_results = $config->getIndexer()->getResults($term);
        // Erzwinge mindestens eine Seite
        $pages = max(ceil(count($_results) / $config->getMessagesPerPage()), 1);
        $page = 0;
        if (isset($_REQUEST["page"])) {
            $page = intval($_REQUEST["page"]);
        }
        // Vorsichtshalber erlauben wir nur Seiten, auf dennen auch Nachrichten stehen
        if ($page < 0 || $page > $pages) {
            $page = 0;
        }
        $_results = array_slice($_results, $page * $config->getMessagesPerPage(), $config->getMessagesPerPage());
        $results = array();
        foreach ($_results as $result) {
            $board = $config->getBoard($result->getBoardID());
            if (!$board->mayRead($session->getAuth())) {
                continue;
            }
            $connection = $board->getConnection();
Example #7
0
// Test de session
echo "<h4>Test de la classe Session implémentant IAuthentifiable</h4>";
// Ouverture d'une nouvelle session;
Session::demarrer();
echo "<p>Session ouverte</p>";
// Test de valeur simple
$valTest = '999';
Session::set('donnee1', $valTest);
$val = Session::get('donnee1');
echo "<p>----> test de get - donnee1 : " . $val . " - ";
echo $val == $valTest ? " test REUSSI </p>" : " *** ECHEC du test *** </p>";
// test de d'écriture des valeurs d'authentification
Session::authentifier(array('auth1' => 'valeur1', 'auth2' => 'valeur2'));
echo "<p>Session authentifiée</p>";
// test de récupération d'une valeur d'authentification
$val = Session::getAuth('auth2');
echo "<p>----> test de getAuth - auth2 : " . $val . "</p>";
// test de vérification de l'ensemble des valeurs d'authentification
// cas nominal
if (Session::estAuthentifie(array('auth1', 'auth2'))) {
    echo "<p>----> test d'authentification correcte REUSSI </p>";
} else {
    echo "<p>----> *** ECHEC du test d'authentification correcte *** </p>";
}
// cas d'échec
if (!Session::estAuthentifie(array('data1', 'auth2'))) {
    echo "<p>----> test d'authentification <b><i>incorrecte</i></b> REUSSI </p>";
} else {
    echo "<p>----> *** ECHEC du test d'authentification <b><i>incorrecte</i></b> *** </p>";
}
// test de fermeture de la session
Example #8
0
<?php

require_once dirname(__FILE__) . "/config.inc.php";
require_once dirname(__FILE__) . "/classes/session.class.php";
$session = new Session($config);
$template = $config->getTemplate($session->getAuth());
$session->logout();
$template->viewlogoutsuccess();
Example #9
0
<?php

require_once dirname(__FILE__) . "/config.inc.php";
require_once dirname(__FILE__) . "/classes/session.class.php";
$session = new Session($config);
$template = $config->getTemplate($session->getAuth());
$boardid = $_REQUEST["boardid"];
$threadid = isset($_REQUEST["threadid"]) ? $config->decodeMessageID($_REQUEST["threadid"]) : null;
$messageid = isset($_REQUEST["messageid"]) ? $config->decodeMessageID($_REQUEST["messageid"]) : null;
try {
    $board = $config->getBoard($boardid);
    if (!$board->mayRead($session->getAuth())) {
        throw new Exception("Keine Berechtigung!");
    }
    $connection = $board->getConnection();
    if ($connection === null) {
        throw new Exception("Board enthaelt keine Group!");
    }
    /* Thread laden */
    // Sobald die Verbindung geoeffnet ist, beginnen wir einen Kritischen Abschnitt!
    $connection->open($session->getAuth());
    $group = $connection->getGroup();
    $connection->close();
    if ($threadid === null && $messageid !== null) {
        $message = $group->getMessage($messageid);
        if (!$message instanceof Message) {
            throw new Exception("Message konnte nicht zugeordnet werden.");
        }
        $thread = $group->getThread($messageid);
        $template->viewmessage($board, $thread, $message, $board->mayPost($session->getAuth()), $board->mayAcknowledge($session->getAuth()));
    }
Example #10
-1
 function afficherUneCateg()
 {
     $this->vue = new V_Vue("../vues/templates/template.inc.php");
     $daoCateg = new M_DaoCategorie();
     $daoCateg->connecter();
     $this->vue->ajouter('listeCateg', $daoCateg->getAll());
     $this->vue->ajouter('loginAuthentification', Session::getAuth('login'));
     $this->vue->ajouter('titreVue', "LAFLEUR : Produits par catégorie");
     $this->vue->ajouter('centre', "../vues/includes/accueil/centre.inc.php");
     if (Session::estAuthentifie(array('login'))) {
         $daoProduit = new M_DaoProduit();
         $daoProduit->connecter();
         $id = getParametre("id", "bul");
         // récupérer le libellé de la catégorie de produits
         $categ = $daoCateg->getOneById($id);
         $this->vue->ajouter('libelleCateg', $categ->getLibelle());
         $this->vue->ajouter('listeProduits', $daoProduit->getListeProduitsParCateg($id));
         $this->vue->ajouter('centre', "../vues/includes/produit/centreListe.inc.php");
         $daoProduit->deconnecter();
     } else {
         $this->vue->ajouter('message', "Vous n'êtes pas authentifié");
         $this->vue->ajouter('centre', "../vues/includes/accueil/centre.inc.php");
     }
     $daoCateg->deconnecter();
     $this->vue->afficher();
 }