try { $message = $post['message']; } catch (Exception $e) { $message = ""; } $node = $xml->createElement('message', $message); $postXml->appendChild($node); $node = $xml->createElement('id', $post['id']); $postXml->appendChild($node); $node = $xml->createElement('time', Date::easy((int) $post['time'])); $postXml->appendChild($node); $MainNode->appendChild($postXml); // Si on demande un post en particulier,on va chercher en envoyer les medias attachés if (isset($_GET['id']) && $_GET['id'] != "-1") { $Medias = new Media_Model(); $MediasTableau = $Medias->getPhotos(); $attachments = DB::select(' SELECT post_id, id, name, ext FROM attachments WHERE post_id IN (' . $post['id'] . ') ORDER BY ext, id ASC '); $nb = 0; foreach ($attachments as $media) { $mediaXml = $xml->createElement('media'); $media['thumb'] = getAttachedFileURL((int) $media['id'], 'jpg', 'thumb'); $media['url'] = getAttachedFileURL((int) $media['id'], $media['ext']); $node = $xml->createElement('path', $media['url']); $mediaXml->appendChild($node); $node = $xml->createElement('type', "image"); $mediaXml->appendChild($node);