Ejemplo n.º 1
0
 public static function setVal($champ, $valeur)
 {
     $arch = new Archiviste();
     $conf = new Archivable('Config');
     $conf->set('nom', $champ);
     $newConf = new Archivable('Config');
     $newConf->set('val', $valeur);
     $confs = $arch->modifier($conf, $newConf);
 }
Ejemplo n.º 2
0
function editEntite($login)
{
    $idEntite = "rien";
    $nom = $_POST['nom'];
    $data = $_POST['data'];
    $id = $_POST['idEntite'];
    $arch = new Archiviste();
    $entite = new Entite();
    $entite->set('nom', $nom);
    $entite->set('data', $data);
    $entite->set('userName', $login);
    $entite->set('date', time());
    $entiteOld = new Entite();
    $entiteOld->set('id', $id);
    if ($id && $id != "" && $nom && $nom != "") {
        $arch->modifier($entiteOld, $entite);
    }
    return array('idEntite' => $id);
}
Ejemplo n.º 3
0
function majOptions(&$vueAgenda, $idUser)
{
    $arch = new Archiviste();
    $userMAJ = new User();
    $user = new User();
    $user->set('id', $idUser);
    if (isset($_REQUEST['notifEvent'])) {
        $userMAJ->set('notifEvent', 'x');
    } else {
        $userMAJ->set('notifEvent', 'n');
    }
    if (isset($_REQUEST['notifComEvent'])) {
        $userMAJ->set('notifComEvent', 'x');
    } else {
        $userMAJ->set('notifComEvent', 'n');
    }
    $arch->modifier($user, $userMAJ);
    $message = 'Mise a jour effectuée. <a href="./?mod=raidplanner">Retour au raidplanner</a>';
    $users = $arch->restituer($user);
    $user = $users[0];
    $vueAgenda->pageOptions($user, $message);
}
Ejemplo n.º 4
0
function deplacerFil()
{
    $reponse = array('statut' => 'ok');
    $idFil = convertDataSent($_REQUEST['idFil']);
    $idNouvelleSec = convertDataSent($_REQUEST['idNouvelleSec']);
    $arch = new Archiviste();
    $testSection = new Section();
    $testSection->set('id', $idNouvelleSec);
    $blobSection = $arch->restituer($testSection);
    if (count($blobSection) == 1) {
        $filAncien = new Fil();
        $filAncien->set('id', $idFil);
        $filNouveau = new Fil();
        $filNouveau->set('idSection', $idNouvelleSec);
        $arch->modifier($filAncien, $filNouveau);
    } else {
        $reponse = array('statut' => 'nok');
    }
    return $reponse;
}
Ejemplo n.º 5
0
function majProfil(&$vueForum)
{
    $auth = new Auth();
    $user = $auth->infoUser();
    if ($user) {
        $traitementOk = true;
        $message = '';
        $arch = new Archiviste();
        $userMAJ = new User();
        //recuperation de la requete
        $urlAvatar = '';
        $signature = '';
        if (isset($_REQUEST['urlAvatar']) && !Securisator::checkIntrusion($_REQUEST['urlAvatar'])) {
            $urlAvatar = $_REQUEST['urlAvatar'];
        }
        if (isset($_REQUEST['signature']) && !Securisator::checkIntrusion($_REQUEST['signature'])) {
            $signature = $_REQUEST['signature'];
        }
        if (isset($_REQUEST['notifMP'])) {
            $userMAJ->set('notifMP', 'x');
        } else {
            $userMAJ->set('notifMP', 'n');
        }
        if ($urlAvatar) {
            $userMAJ->set('avatar', $urlAvatar);
        }
        if ($signature) {
            $userMAJ->set('sign', $signature);
        }
        $arch->modifier($user, $userMAJ);
        $message = '<div class="alert alert-success" role="alert">Mise a jour effectuée.</div>';
        $ariane = '
		<ol class="breadcrumb">
		  <li><a href="./?mod=forum"> Forum </a></li>
		  <li>Profil</li>
		</ol>';
        $vueForum->setBreadCrumb($ariane);
        $user = $auth->infoUser();
        $vueForum->pageProfil($user, $message);
    }
}
Ejemplo n.º 6
0
function validRecupPass()
{
    $cleToken = $_REQUEST['token'];
    $auth = new Auth();
    $arch = new Archiviste($dbPath);
    $token = new Archivable('Token');
    $token->set('cle', $cleToken);
    $tokens = $arch->restituer($token);
    if (count($tokens) == 1) {
        $token = $tokens[0];
        $newPass = $auth->genererToken(12);
        $user = new Archivable('User');
        $userNew = new Archivable('User');
        $user->set('mail', $token->get('mail'));
        $userNew->set('pass', md5($newPass));
        $nomSite = Config::get('nomSite');
        $adresseSite = Config::get('adresseSite');
        $expediteur = '"' . $nomSite . '"<robot@' . $adresseSite . '>';
        $sujet = "Votre nouveau mot de passe";
        $message = 'Bonjour ' . $token->get('login') . ', <br />' . PHP_EOL . '<br />' . PHP_EOL . 'Suite a votre demande de récupération, voici votre nouveau de mot de passe : <b>' . $newPass . '</b><br />' . PHP_EOL . '<br />' . PHP_EOL . 'Ceci est un message automatique. Merci de ne pas y repondre.';
        Mail::envoyer($token->get('mail'), $expediteur, $sujet, $message);
        $arch->modifier($user, $userNew);
        $arch->supprimer($token);
        $retour = ['etatReinit' => 'ok'];
    } else {
        $retour = ['etatReinit' => 'noToken'];
    }
    return $retour;
}
Ejemplo n.º 7
0
function validConfTemplate()
{
    $retour = array('statut' => 'ok');
    $nomTemplate = $_REQUEST['nomTemplate'];
    $arch = new Archiviste('../../../core/data/');
    $config = new Archivable('Config');
    $config->set('nom', 'template');
    $newConfig = new Archivable('Config');
    $newConfig->set('val', $nomTemplate);
    $arch->modifier($config, $newConfig);
    return $retour;
}
Ejemplo n.º 8
0
function majProfil(&$vueAuth)
{
    $auth = new Auth();
    $user = $auth->infoUser();
    if ($user) {
        $traitementOk = true;
        $message = '';
        $arch = new Archiviste();
        $userMAJ = new User();
        //recuperation de la requete
        $passAncien = '';
        $pass1 = '';
        $pass2 = '';
        $adresseMail = '';
        if (isset($_REQUEST['passAncien'])) {
            $passAncien = $_REQUEST['passAncien'];
        }
        if (isset($_REQUEST['pass1'])) {
            $pass1 = $_REQUEST['pass1'];
        }
        if (isset($_REQUEST['pass2'])) {
            $pass2 = $_REQUEST['pass2'];
        }
        if (isset($_REQUEST['adresseMail'])) {
            $adresseMail = $_REQUEST['adresseMail'];
        }
        if ($pass1 && $pass2 == $pass1) {
            if (md5($passAncien) == $user->get('pass')) {
                $userMAJ->set('pass', md5($pass1));
            } else {
                $message = '<div class="alert alert-danger" role="alert">Votre ancien mot de passe n\'est pas bon.</pdiv>';
                $traitementOk = false;
            }
        } else {
            if ($pass1) {
                $message = '<div class="alert alert-warning" role="alert">Les deux nouveaux mots de passes ne correspondent pas.</div>';
                $traitementOk = false;
            }
        }
        if ($adresseMail && $traitementOk) {
            if (Mail::checkMail($adresseMail) == 'ok') {
                $userMAJ->set('mail', $adresseMail);
            } else {
                $traitementOk = false;
                $message = '<div class="alert alert-danger" role="alert">Adresse mail non valide.</div>';
            }
        }
        if ($traitementOk) {
            $arch->modifier($user, $userMAJ);
            $message = '<div class="alert alert-success" role="alert">Mise a jour effectuée.</div>';
        }
        $user = $auth->infoUser();
        $vueAuth->pageProfil($user, $message);
    }
}