Beispiel #1
0
 public function bug($id, $request)
 {
     $ticket = Ticket::find($id);
     $message = "Après étude de votre problème, il en résulte qu'il ne s'agit pas d'un incident isolé mais bien d'un problème technique interne à DreamVids (bug). Nous travaillons actuellement à la détection et à la résolution de ce bug mais nous ne pouvons vous donner de plus amples informations. Nous nous excusons pour la gêne occasionnée et vous remerçions de votre patience.";
     $this->mail($ticket, $message);
     if ($ticket->conv_id != '' && Conversation::exists($ticket->conv_id)) {
         Conversation::find($ticket->conv_id)->removeChannel(User::find(User::getIdByName($ticket->tech))->getMainChannel());
     }
     $ticket->delete();
     return new RedirectResponse(WEBROOT . 'admin/tickets');
 }
 public function destroy($id, $request)
 {
     $req = $request->getParameters();
     if (Session::isActive() && isset($req['channelId']) && ($channel = UserChannel::find($req['channelId']))) {
         $conv = Conversation::exists($id) ? Conversation::find($id) : false;
         if ($conv && $conv->containsChannel($channel)) {
             $conv->removeChannel($channel);
             return new Response(200);
         }
     }
     return new Response(500);
 }
Beispiel #3
0
 public static function generateId($length)
 {
     $idExists = true;
     while ($idExists) {
         $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         $id = '';
         for ($i = 0; $i < $length; $i++) {
             $id .= $chars[rand(0, strlen($chars) - 1)];
         }
         $idExists = Conversation::exists(array('id' => $id));
     }
     return $id;
 }
Beispiel #4
0
<?php

include "../../inc/init.inc";
if (isset($_GET['conversation']) && $_GET['conversation'] != 0 && Follower::isFriend($res->user->id, $_GET['conversation'])) {
    $filename = $res->user->id > $_GET['conversation'] ? 'conversations/' . $_GET['conversation'] . "-" . $res->user->id . ".xml" : 'conversations/' . $res->user->id . "-" . $_GET['conversation'] . ".xml";
    if (!Conversation::exists(array('conditions' => array('filename' => $filename)))) {
        $attributes = array("user_id" => $res->user->id, "filename" => $filename);
        $conversation = Conversation::create($attributes);
    } else {
        $conversation = Conversation::find_by_filename($filename);
    }
    if ($conversation == null) {
        throw new Exception('can not init conversation', 504);
    }
    $xmlfile = VAR_PATH . $conversation->filename;
    // <editor-fold defaultstate="collapsed" desc="creation d'un message">
    if (isset($_GET['msg'])) {
        $msg = $_GET['msg'];
        $userChat = isset($_GET['userChat']) ? $_GET['userChat'] : "Invité";
        //Load it using simpleXML
        $doc = new DOMDocument();
        $doc->load($xmlfile);
        //Add a conversation item
        $item = $doc->createElement("item", $msg);
        //Add the sender's name as an attribute
        $sender = $doc->createAttribute("sender");
        $sender->appendChild($doc->createTextNode($userChat));
        //Add another attribute for time on which the message was added
        $time = $doc->createAttribute("time");
        $time->appendChild($doc->createTextNode(date("H:i", time())));
        //Put it together