function addRepMessage($com, $id) { $Messagerie = new Messagerie(); $BD = new BD('messagerie'); $BD->update("luAuteur", 1, "idmessage", $id); $BD->update("luDestinataire", 1, "idmessage", $id); $BD->update("timestamp", time(), "idmessage", $id); $userMessage = $Messagerie->recupUser($_SESSION['iduser']); $message = $Messagerie->infoConvers($_GET['id']); $msg = '<div class="line3 frame white2"> <img class="avatar-com" src="' . $userMessage->avatar . '" alt="default"> <div class="inline-block vt-top"> <p class="line2"> <a class="txt-dec-none c-black1" href="index.php?page=profil&nom=' . $userMessage->pseudo . '"><strong>' . $userMessage->pseudo . '</strong></a> , le <i>' . date('d/m/y H:i', time()) . '</i> </p> <div class="line2"> <p>' . $com . '</p> </div> </div> </div><!-- .frame -->'; $fp = fopen(Config::$path['messagerie'] . $message->link . $message->idauteur . $message->iddestinataire . '.msg', "r+"); $contenu_message = ''; while (($buffer = fgets($fp, 4096)) !== false) { $contenu_message .= $buffer; } fwrite($fp, $msg); fclose($fp); }
function addMessage($nom, $texte) { $Messagerie = new Messagerie(); $file = time(); echo $file; $BD = new BD('topic'); $BD->addMessage($nom, $file); $file .= $_SESSION['iduser'] . $nom . '.msg'; $userMessage = $Messagerie->recupUser($_SESSION['iduser']); $message = '<div class="line3 frame white2"> <img class="avatar-com" src="' . $userMessage->avatar . '" alt="default"> <div class="inline-block vt-top"> <p class="line2"> <a class="txt-dec-none c-black1" href="index.php?page=profil&nom=' . $userMessage->pseudo . '"><strong>' . $userMessage->pseudo . '</strong></a> , le <i>' . date('d/m/y H:i', time()) . '</i> </p> <div class="line2"> <p>' . $texte . '</p> </div> </div> </div><!-- .frame -->'; $fp = fopen(Config::$path['messagerie'] . $file, "w"); fwrite($fp, $message); }
public function annulationTrajet($id_trajet) { $database = UsineBDD::getUsine()->connection(); if (Trajet::trajetExiste($id_trajet)) { $info_trajet = self::getInformationTrajet($id_trajet)[0]; $prix_g = 0; if (Utilisateur::getUtilisateurId() == $info_trajet['id_conducteur'] && $info_trajet['validation'] == 0) { $passagers = Reservation::getUtilisateurReservation($id_trajet); $prix_g += 10; foreach ($passagers as $array => $passager) { Utilisateur::retirerSolde(10, $info_trajet['id_conducteur']); Utilisateur::ajouterSolde(10, $passager['id_membre']); } Messagerie::envoyerMessageA($info_trajet['id']); $sql_update_trajet = "DELETE FROM trajet WHERE id=:idt"; $requete_update = $database->prepare($sql_update_trajet); $requete_update->execute(array(':idt' => $id_trajet)); Utilisateur::ajoutTrajetA(); $this->confirmation = "Le trajet a bien été annulé! " . $prix_g . "€ ont été retiré de votre compte"; } } }
public $isAllowForBlock = true; public $strTemplate = "Messagerie.html5.twig"; public function run() { $templateTop = $this->objTwig->loadTemplate("MessagerieInbox.html5.twig"); $sColumns = ''; $sColumns .= '{ "mData": "compte", "bSortable": true, "className": "all", "sWidth": "130px" },'; $sColumns .= '{ "mData": "objet", "className": "min-tablet", "bSortable": true },'; $sColumns .= '{ "mData": "date", "bSortable": true, "sWidth": "80px" },'; $sColumns .= '{ "mData": "lastMessage", "className": "min-desktop", "bSortable": true, "sWidth": "120px" },'; $sColumns .= '{ "mData": "actions", "className": "all", "bSortable": false, "sWidth": "60px" },'; $sFilterColumns = ''; $sFilterColumns .= '{ type: "text", placeholder: "" },'; $sFilterColumns .= '{ type: "text", placeholder: "" },'; $sFilterColumns .= '{ type: "date-range", withoutCalendar: "1"},'; $sFilterColumns .= '{ type: "date-range", withoutCalendar: "1"},'; $sFilterColumns .= 'null,'; $viewInbox = $templateTop->render(["dtColumns" => rtrim($sColumns, ','), "dtFilterColumns" => rtrim($sFilterColumns, ','), "ajaxSource" => "pages/Messagerie/ajax/listMessagerieInbox.php?sEcho=1", "isAdmin" => $this->isAdmin]); if ($this->HaveTheRight(\DroitsHelper::SUPPORT_TICKET)) { $this->arrayTemplate["isModerateurTicket"] = true; } else { $this->arrayTemplate["isModerateurTicket"] = false; } $this->arrayTemplate["viewInbox"] = $viewInbox; $view = $this->template->render($this->arrayTemplate); $this->response->setContent($view); $this->response->send(); } } $class = new Messagerie(); $class->run();
<?php $message = Messagerie::getMessage($_GET['id_message']); if (!$message) { echo '<div class="erreur"><p>Il semble y avoir un problème</p></div>'; } else { $message = $message[0]; Messagerie::messageLu($message['id']); $html = '<div class="liste_reservation"> <table class="pure-table pure-table-bordered"> <thead> <tr><th colspan="2"> Message Envoyé par ' . Utilisateur::getUsername($message['id_expediteur']) . '</th></thead>'; $html .= '<tbody> <tr><td> Date :</td><td>' . date('d-n-Y H:i', $message['timestamp_message']) . '</td></tr>'; $html .= '<tr><td colspan="2">' . $message['contenu'] . '</td></tr></tbody></table>'; echo $html; }