Exemplo n.º 1
0
<?php

use App\App;
use Core\Config;
use App\Vendor\InfoUser;
use App\Vendor\User;
use App\Vendor\Follow;
require 'core/init.php';
if (!connect()) {
    User::redirect('/home.php');
}
//On défini le titre
App::setTitle('Profil');
$id_page = "profil";
/* Si le profil selectionné n'est pas le notre */
if (isset($_GET['user']) && $_GET['user'] != $_SESSION['username']) {
    $profil_userid = $_GET['user'];
    $profil_user = InfoUser::getInstance($DB_con, $profil_userid);
} else {
    /* Sinon si c'est le notre */
    $profil_user = InfoUser::getInstance($DB_con, $_SESSION['username']);
}
/* On récupère ensuite les infos */
$info_profil = $profil_user->getInfo();
$follow = Follow::getInstance($DB_con, $info_profil->id);
if (isset($_POST['SubmitFollow'])) {
    $UserToFollow = htmlspecialchars(trim($_POST['ProfilUserid']));
    if (!empty($UserToFollow)) {
        $follow->Follow();
    }
}
Exemplo n.º 2
0
<?php

use App\App;
use App\Vendor\User;
use Core\Config;
require 'core/init.php';
/* On déconnecte l'utilisateur */
User::logout();
//On défini le titre
App::setTitle('Déconnexion');
$id_page = "logout";
//On importe la vue
require Config::get('view.paths') . 'deconnexion.view.php';
Exemplo n.º 3
0
<?php

use App\App;
use Core\Config;
use App\Vendor\InfoUser;
use App\Vendor\User;
use App\Vendor\Image;
require 'core/init.php';
if (!connect()) {
    User::redirect('/home.php');
}
//On défini le titre
App::setTitle('Modification profil');
$id_page = "edit-profil";
$profil_user = InfoUser::getInstance($DB_con, $_SESSION['username']);
$user = User::getInstance($DB_con);
/* On récupère ensuite les infos */
$info_profil = $profil_user->getInfo();
$bio = $info_profil->bio;
/*
 * Si on valide le formulaire sur le profil
 */
if (isset($_POST['SubmitProfil'])) {
    $errors = array();
    $data = array();
    $bio = htmlspecialchars(trim($_POST['inputBio']));
    $imgprofil = $_FILES['inputImg'];
    /* Si la bio a été modifié et fait ne fait pas plus de 160 caractères */
    if ($bio != $info_profil->bio) {
        if (strlen(utf8_decode($bio)) > 160) {
            $errors['LengthBio'] = "Votre bio ne doit pas faire plus de 160 caractères";
Exemplo n.º 4
0
<?php

use App\App;
use Core\Config;
use App\Vendor\InfoUser;
use App\Vendor\User;
require 'core/init.php';
if (!connect()) {
    User::redirect('/home.php');
}
//On défini le titre
App::setTitle('Paramètres');
$id_page = "parametres";
$profil_user = InfoUser::getInstance($DB_con, $_SESSION['username']);
$user = User::getInstance($DB_con);
/* On récupère ensuite les infos */
$info_profil = $profil_user->getInfo();
$email = $info_profil->email;
$pseudo = $info_profil->pseudo;
/*
 * Si on valide le formulaire sur le profil
 */
if (isset($_POST['SubmitProfil'])) {
    $errors = array();
    $data = array();
    $pseudo = htmlspecialchars(trim($_POST['inputUsername']));
    $email = htmlspecialchars(trim($_POST['inputEmail']));
    /* Si un des deux champs est vide */
    if (empty($pseudo) || empty($email)) {
        $errors['EmptyInput'] = "Veuillez remplir tous les champs de texte";
    }
Exemplo n.º 5
0
<?php

use App\App;
use App\Vendor\User;
use Core\Config;
require 'core/init.php';
if (connect()) {
    User::redirect('/');
}
//On défini le titre
App::setTitle('Connexion');
$id_page = "login";
$user = User::getInstance($DB_con);
if (isset($_POST['SubmitButton'])) {
    $errors = null;
    $encoding = 'utf-8';
    $username = htmlspecialchars(trim($_POST['InputUsername']), ENT_QUOTES, $encoding);
    $password = htmlspecialchars(trim($_POST['InputPassword']), ENT_QUOTES, $encoding);
    if (isset($_POST['InputStayOnline'])) {
        $stayonline = htmlspecialchars($_POST['InputStayOnline']);
    } else {
        $stayonline = null;
    }
    /* On vérifie que tous les champs sont saisies */
    if (empty($username) || empty($password)) {
        $errors['FieldsEmpty'] = "Veuillez saisir tous les champs de texte";
    }
    /* On vérifie qu'il n'y a pas d'erreurs */
    if ($errors) {
        $allerror = "<ul>";
        foreach ($errors as $key) {
Exemplo n.º 6
0
<?php

use App\App;
use App\Vendor\User;
use Core\Config;
use Identicon\Identicon;
require 'core/init.php';
if (connect()) {
    User::redirect('/');
}
//On défini le titre
App::setTitle('Inscription');
$id_page = "register";
/*
 * On défini un nouvelle objet user
 */
$user = User::getInstance($DB_con);
/* Si on valide le formulaire */
if (isset($_POST['submitRegister'])) {
    $errors = array();
    $pseudo = htmlspecialchars(trim($_POST['InputPseudo']), ENT_QUOTES);
    $prenom = htmlspecialchars(trim($_POST['InputPrenom']), ENT_QUOTES);
    $nom = htmlspecialchars(trim($_POST['InputNom']), ENT_QUOTES);
    $email = htmlspecialchars(trim($_POST['InputEmail']), ENT_QUOTES);
    $email = mb_strtolower($email);
    $password = htmlspecialchars(trim($_POST['InputPassword']), ENT_QUOTES);
    $confirmpassword = htmlspecialchars(trim($_POST['InputPassword2']), ENT_QUOTES);
    /* On vérifie que tous les champs ont bien été saisis */
    if (empty($pseudo) || empty($nom) || empty($prenom) || empty($email) || empty($password) || empty($confirmpassword)) {
        $errors['EmptyFields'] = "Veuillez remplir tous les champs de texte";
    }
Exemplo n.º 7
0
<?php

use App\App;
use Core\Config;
use App\Vendor\User;
require 'core/init.php';
if (connect()) {
    User::redirect('/');
}
//On défini le titre
App::setTitle('Accueil');
$title_site = Config::get('app.title');
//On importe la vue
require Config::get('view.paths') . 'home.view.php';