<?php session_start(); use App\Tools\Request; require "vendor/autoload.php"; if (isset($_POST['email'])) { $userlist = Request::perform("userlist"); $mail = $_POST['email']; foreach ($userlist as $user) { if ($user->email === $mail) { $_SESSION['me'] = $user; session_write_close(); if (isset($_POST['callback_url'])) { $url = $_POST['callback_url']; } else { $url = "message.php"; } header("Location: {$url}"); exit; break; } } echo "email inconnu, veuillez recommencer"; } include 'header.inc.php'; ?> <section id="content"> <?php include 'sidebar.inc.php'; ?> <div class="container">
<?php use App\Tools\Request; require "vendor/autoload.php"; $data = ["userid" => $_POST["user_id"], "chatid" => $_POST['chat_id']]; echo Request::perform("chat/add", $data, "POST");
session_start(); require "vendor/autoload.php"; use App\Tools\Gravatar; use App\Tools\Request; function getUser($id, $list) { foreach ($list->users as $user) { if ($user->id == $id) { return $user; } } return null; } $id = $_GET['id']; $me = $_SESSION['me']; $chatinfos = Request::perform("chat/{$id}"); if ($chatinfos === null) { die("Pas de conversation pour le moment"); } if (count($chatinfos->users) <= 2 && count($chatinfos->users) > 0) { $convpic = Gravatar::get($chatinfos->users[0]->email); } else { $convpic = "img/profile-pics/2.jpg"; } foreach ($chatinfos->users as $user) { $user->pic = Gravatar::get($user->email); } $mypic = Gravatar::get($me->email); ?> <!-- Listview HEADER --> <div class="lv-header-alt clearfix">
<?php use App\Tools\Request; require "vendor/autoload.php"; $data = ["userid" => $_POST["user_id"], "text" => $_POST['text']]; $id = $_POST['chat_id']; echo Request::perform("message/{$id}", $data, "POST");