Exemplo n.º 1
0
<?php

/**
 * Description of connexion:
 * Page de connexion ET déconnexion
 * (dépend de la valeur de "do" qui est envoyée lors de l'appel de cette page php)
 *
 * @author Estelle
 */
require_once 'app/System.class.php';
$sys = new System();
$nom = $_POST['nom'];
$mdp = $_POST['mot_passe'];
if ($_GET["do"] == "login") {
    try {
        $sys->login($nom, $mdp);
        header('Location: index.php');
    } catch (Exception $e) {
        require_once 'smarty/setup.php';
        $smarty = new Smarty_CRETPictures();
        $smarty->assign("connexion", "failed");
        $smarty->display('index.tpl');
    }
} else {
    if ($_GET["do"] == "logout") {
        $sys = new System();
        $sys->logout();
        header('Location: index.php');
    }
}
Exemplo n.º 2
0
                $pics[$i]['title'] = $photos[$i]['title'];
            }
        }
        $smarty->assign('tabPhotos', $photos);
        $smarty->assign('tabPics', $pics);
    } else {
        //on est dans un sous-répertoire
        $dossiers = explode("/", $_GET['currentFolder']);
        for ($i = 1; $i < count($dossiers); $i++) {
            for ($j = 0; $j < count($photos); $j++) {
                if ($photos[$j]['name'] == $dossiers[$i]) {
                    $photos = $photos[$j]['content'];
                    break;
                }
            }
        }
        $pics = array();
        for ($i = 0; $i < count($photos); $i++) {
            if ($photos[$i]['type'] == 'picture') {
                $pics[$i]['id'] = $photos[$i]['pid'];
                $pics[$i]['title'] = $photos[$i]['title'];
            }
        }
        $smarty->assign('tabPics', $pics);
        $smarty->assign('tabPhotos', $photos);
    }
    $smarty->assign('currentFolder', $_GET['currentFolder']);
}
$smarty->assign('perms', $perms);
$smarty->display('mesPhotos.tpl');
Exemplo n.º 3
0
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
$smarty->assign('perms', $perms);
if (isset($_GET['currentFolder'])) {
    $smarty->assign('currentFolder', $_GET['currentFolder']);
}
$smarty->display('ajoutPhoto.tpl');
if (isset($_GET['do']) && $_GET['do'] == 'ajout') {
    require_once '../app/PicturesHandler.class.php';
    $phandler = new PicturesHandler($sys);
    $photo = $_FILES['photoFile']['tmp_name'];
    if (isset($_POST['titlePic']) && $_POST['titlePic'] != "") {
        $extension = strrchr($_POST['titlePic'], ".");
        //vérification de l'extension
        if ($extension == FALSE || $extension != 'jpg' && $extension != 'png' && $extension != 'gif' && $extension != 'bmp') {
            $extensionInit = strrchr($_FILES['photoFile']['name'], ".");
            $POST['titlePic'] = $_POST['titlePic'] . $extensionInit;
            if ($_GET['currentFolder'] == "") {
                $fullname = $_POST['titlePic'];
            } else {
                $fullname = substr($_GET['currentFolder'], 1) . '/' . $_POST['titlePic'];
            }
Exemplo n.º 4
0
require '../smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once '../app/system.class.php';
$sys = new System();
require_once '../app/ProfilesHandler.class.php';
$profiles = new ProfilesHandler($sys);
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
if (isset($_GET['profil'])) {
    $profile = $profiles->profiles_getByID($_GET['profil']);
    $smarty->assign('profil', $profile);
    $smarty->assign('profilID', $_GET['profil']);
}
if (isset($_GET['do']) && $_GET['do'] == "update") {
    echo "modification en cours";
}
$smarty->assign('perms', $perms);
$smarty->display('modifProfil.tpl');
Exemplo n.º 5
0
 * Page d'accueil pour utilisateur non connecté OU connecté
 *
 * @author Madeleine
 * @modifier Estelle
 */
require 'smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once 'app/System.class.php';
$sys = new System();
require_once 'app/ProfilesHandler.class.php';
$profiles = new ProfilesHandler($sys);
require_once 'app/SearchEngine.class.php';
$search = new SearchEngine($sys);
//si l'utilisateur n'est pas connecté
if ($sys->current_user() == null) {
    $smarty->display('index.tpl');
} else {
    require_once 'app/PicturesHandler.class.php';
    $phandler = new PicturesHandler($sys);
    //aller chercher les photos de l'utilisateur connecté
    $usr = $sys->current_user();
    $perms;
    //tableau qui stockera si l'utilisateur a certaines permissions
    $perms[0] = $sys->permissions_test('admin.user.create');
    $perms[1] = $sys->permissions_test('admin.user.read');
    $perms[2] = $sys->permissions_test('admin.user.update');
    $perms[3] = $sys->permissions_test('admin.user.delete');
    $perms[4] = $sys->permissions_test('admin.picture.read');
    $perms[5] = $sys->permissions_test('application.picture.upload');
    $smarty->assign('perms', $perms);
    if (isset($_GET['suppProfil'])) {
Exemplo n.º 6
0
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$Login = $_GET['Login'];
$smarty->assign('Login', $Login);
$user = $sys->user_getByLogin($Login);
$smarty->assign('user', $user);
$users = $sys->user_getAll();
$smarty->assign('users', $users);
$smarty->assign('perms', $perms);
$smarty->display('UserUpdate2.tpl');
if (isset($_GET['do']) && $_GET['do'] == 'ajout') {
    $Login = $_POST['Login2'];
    $user = $sys->user_getByLogin($Login);
    $id = $user['id'];
    $sys->permissions_revoke($id, "admin.permission.grant");
    $sys->permissions_revoke($id, "admin.permission.revoke");
    $sys->permissions_revoke($id, "admin.picture.read");
    $sys->permissions_revoke($id, "admin.user.create");
    $sys->permissions_revoke($id, "admin.user.read");
    $sys->permissions_revoke($id, "admin.user.update");
    $sys->permissions_revoke($id, "admin.user.delete");
    $sys->permissions_revoke($id, "application.login");
    $sys->permissions_revoke($id, "application.picture.upload");
    if (isset($_POST['AdminGrant']) && $_POST['AdminGrant'] == 'on') {
        $permis = "admin.permission.grant";
Exemplo n.º 7
0
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
if ($usr != null) {
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
if (isset($_GET['who']) && $_GET['who'] == 'self') {
    $smarty->assign('who', "self");
} else {
    $smarty->assign('who', NULL);
}
if (isset($_GET['do']) && $_GET['do'] == "create") {
    $profile["gender"] = $_POST['gender'];
    $profile["nickName"] = $_POST['nickname'];
    $profile["firstName"] = $_POST['firstname'];
    $profile["lastName"] = $_POST['lastname'];
    $profile["birth"] = $_POST['birth'];
    $profile["email"] = $_POST['email'];
    $profile["phone"] = $_POST['phone'];
    if (isset($_GET['link']) && $_GET['link'] == "user") {
        $profile["link"] = $usr['id'];
    }
    var_dump($profile);
    $prid = $profiles->profiles_create($profile);
    $smarty->assign('profil', $profile);
    $smarty->assign('profilID', $prid);
    $smarty->display('apercuProfil.tpl');
} else {
    $smarty->display('creerProfil.tpl');
}
Exemplo n.º 8
0
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
$smarty->display('ajoutUser.tpl');
if (isset($_GET['do']) && $_GET['do'] == 'ajout') {
    $Login = $_POST['Login'];
    $Pass = $_POST['Pass'];
    $id = $sys->user_create($Login, $Pass);
    if (isset($_POST['AdminGrant']) && $_POST['AdminGrant'] == 'on') {
        $permis = "admin.permission.grant";
        $sys->permissions_grant($id, $permis);
    }
    if (isset($_POST['AdminRevoke']) && $_POST['AdminRevoke'] == 'on') {
        $permis = "admin.permission.revoke";
        $sys->permissions_grant($id, $permis);
    }
    if (isset($_POST['PictureRead']) && $_POST['PictureRead'] == 'on') {
        $permis = "admin.picture.read";
        $sys->permissions_grant($id, $permis);
Exemplo n.º 9
0
        $req[$i] = $search->filter_size($_POST['paramSize'], $_POST['size']);
        echo 'requete = ' . $req[$i];
        $i++;
    }
    if (isset($_POST['listPersonnes']) && $_POST['listPersonnes'] != "") {
        $listPersonnes = explode(', ', $_POST['listPersonnes']);
        $listParams[$i] = array();
        foreach ($listPersonnes as $personne) {
            $listParams[$i][] = $personne;
        }
        var_dump($listParams[$i]);
        $i++;
    }
    if (isset($_POST['mois']) && $_POST['mois'] != "" && (isset($_POST['annee']) && $_POST['annee'] != "")) {
        $req[$i] = $search->filter_date($_POST['mois'], $_POST['annee']);
        echo 'requete = ' . $req[$i];
        $i++;
    } elseif (isset($_POST['mois']) && $_POST['mois'] != "") {
        $listParams[$i] = array('mois', $_POST['mois']);
        var_dump($listParams[$i]);
        $i++;
    } elseif (isset($_POST['annee']) && $_POST['annee'] != "") {
        $listParams[$i] = array('annee', $_POST['annee']);
        var_dump($listParams[$i]);
        $i++;
    }
    $listPics = $search->pictures_getAll();
    $smarty->assign('tabPics', $listPics);
}
$smarty->display('filtrePhotos.tpl');
Exemplo n.º 10
0
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
if (isset($_GET['profil'])) {
    $profile = $profiles->profiles_getByID($_GET['profil']);
    if (isset($_GET['do']) && $_GET['do'] == "modify") {
        // cas où l'utilisateur veut modifier le profil
        $smarty->assign('profil', $profile);
        $smarty->assign('profilID', $_GET['profil']);
        $smarty->display('modifProfil.tpl');
    } elseif (isset($_GET['do']) && $_GET['do'] == "update" && $_GET['profil']) {
        //validation des modifs
        if (isset($_POST['gender'])) {
            $profile['gender'] = $_POST['gender'];
        }
        if (isset($_POST['nickname'])) {
            $profile['nickName'] = $_POST['nickname'];
        }
        if (isset($_POST['firstname'])) {
            $profile['firstName'] = $_POST['firstname'];
        }
        if (isset($_POST['lastname'])) {
            $profile['lastName'] = $_POST['lastname'];
        }
        if (isset($_POST['birth'])) {
Exemplo n.º 11
0
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
$smarty->display('updateUser.tpl');
if (isset($_GET['do']) && $_GET['do'] == 'ajout') {
    $Login = $_POST['Login'];
    $user = $sys->user_getByLogin($Login);
    $id = $user['id'];
    $sys->permissions_revoke($id, "admin.permission.grant");
    $sys->permissions_revoke($id, "admin.permission.revoke");
    $sys->permissions_revoke($id, "admin.picture.read");
    $sys->permissions_revoke($id, "admin.user.create");
    $sys->permissions_revoke($id, "admin.user.read");
    $sys->permissions_revoke($id, "admin.user.update");
    $sys->permissions_revoke($id, "admin.user.delete");
    $sys->permissions_revoke($id, "application.login");
    $sys->permissions_revoke($id, "application.picture.upload");
    if (isset($_POST['AdminGrant']) && $_POST['AdminGrant'] == 'on') {
        $permis = "admin.permission.grant";
Exemplo n.º 12
0
<?php

/**
 * Page d'ajout d'un user
 *
 * @author Estelle
 */
require '../smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once '../app/system.class.php';
$sys = new System();
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
$smarty->assign('id', $id);
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
$smarty->display('UserAjoute.tpl');
Exemplo n.º 13
0
 * Description of monProfil:
 * Page de visualisation de son profil perso
 *
 * @author Madeleine
 */
require '../smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once '../app/system.class.php';
$sys = new System();
require_once '../app/ProfilesHandler.class.php';
$profiles = new ProfilesHandler($sys);
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
    $profile = $profiles->profiles_getMine();
    $smarty->assign('profil', $profile);
} else {
    $smarty->assign('name', "");
    $smarty->assign('profil', NULL);
}
$smarty->assign('perms', $perms);
$smarty->display('monProfil.tpl');
Exemplo n.º 14
0
<?php

/**
 * Page d'ajout d'un user
 *
 * @author Estelle
 */
require '../smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once '../app/system.class.php';
$sys = new System();
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
}
$users = $sys->user_getAll();
$smarty->assign('users', $users);
$smarty->display('LectureUser.tpl');
Exemplo n.º 15
0
 *
 * @author Estelle
 */
require '../smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once '../app/system.class.php';
$sys = new System();
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
$Login = $_GET['Login'];
echo $Login;
$user = $sys->user_getByLogin($Login);
$id = $user['uid'];
$users = $sys->user_getAll();
$smarty->assign('user', $user);
$smarty->assign('users', $users);
$smarty->display('infoUser.tpl');
Exemplo n.º 16
0
 *
 * @author Estelle
 */
require '../smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once '../app/system.class.php';
$sys = new System();
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$Login = $_GET['Login'];
$smarty->assign('Login', $Login);
$smarty->assign('perms', $perms);
$smarty->display('supprUser.tpl');
if (isset($_GET['do']) && $_GET['do'] == 'ajout') {
    $Login = $_POST['Login'];
    $user = $sys->user_getByLogin($Login);
    $sys->user_delete($user);
    echo "Utilisateur " . $Login . " supprimé.";
}
Exemplo n.º 17
0
 *
 * @author Madeleine
 */
require '../smarty/setup.php';
$smarty = new Smarty_CRETPictures();
require_once '../app/system.class.php';
$sys = new System();
require_once '../app/ProfilesHandler.class.php';
$profiles = new ProfilesHandler($sys);
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
if ($sys->current_user() != null) {
    $usr = $sys->current_user();
    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
if (isset($_GET['suppProfil'])) {
    $profiles->profiles_delete($_GET['suppProfil']);
}
$listprofils = $profiles->profiles_getAll();
$smarty->assign('profils', $listprofils);
$smarty->display('mesProfils.tpl');