tag:%s,%s:%s",$_SERVER['HTTP_HOST'],$date,str_replace('#','/',$perm_url))); } function getAtom1PostEntry($short=false,&$news,$enclosuretype) { $item =''; if ($news->f('post_chapo') != '') { $desc = strip_tags($news->f('post_chapo')); } else { $desc = util::cutString(strip_tags($news->f('post_content')),300).'...'; } if ($short) { $content = $desc; } else { $content = $news->f('post_chapo').' '.$news->f('post_content'); } $enclosure_string=""; $content = $news->f('post_chapo')."
".$news->f('post_content'); if($enclosuretype != 'blog') { if(preg_match_all( "((http://(([[:punct:]]|[[:alnum:]])*))\"(.*)?(rel=\"enclosure\"))" ,$content,$result,PREG_SET_ORDER)) { for ($i=0; $i< count($result); $i++) { $fname = $result[$i][1]; $ext = substr(strtolower(strrchr($fname, '.')), 1); if($ext === $enclosuretype) { $enclosure_string .=""; $item .='f('post_lang')) ? ' xml:lang="'.$news->f('post_lang').'"' : '').'>'."\n"; $item .=' '.$news->blog->toXML($news->f('post_titre'))."\n"; $item .=' '."\n"; $item .=' '.$news->getIsoDate()."\n"; $item .=' '.dt::iso8601(strtotime($news->f('post_upddt')))."\n"; $item .= getAtom1ID($news->getPermURL(), $news->getTS())."\n"; $item .=' '.htmlspecialchars($news->getUserCN())."\n"; $item .=' \n"; $item .=' '.$news->blog->toXML($desc)."\n"; $item .=' '.$enclosure_string."\n"; $item .=' '."\n"; $item .='
'."\n".$content."\n
\n"; $item .='
'."\n"; $item .=''."\n"; }else{ $item .=''; } } } }else{ $item .='f('post_lang')) ? ' xml:lang="'.$news->f('post_lang').'"' :'').'>'."\n"; $item .=' '.$news->blog->toXML($news->f('post_titre'))."\n"; $item .=' '."\n"; $item .=' '.$news->getIsoDate()."\n"; $item .=' '.dt::iso8601(strtotime($news->f('post_upddt')))."\n"; $item .= getAtom1ID($news->getPermURL(), $news->getTS())."\n"; $item .=' '.htmlspecialchars($news->getUserCN())."\n"; $item .=' \n"; $item .=' '.$news->blog->toXML($desc)."\n"; $item .=' '."\n"; $item .='
'."\n".$content."\n
\n"; $item .='
'."\n"; $item .=''."\n"; } return $item; } function getAtom1CommentEntry($short=false) { global $comments; $tb = (boolean) $comments->f('comment_trackback'); if ($short) { $content = util::cutString(strip_tags($comments->getContent()),300).'...'; } else { $content = $comments->getContent(); } return ''."\n". ' '.($tb ? 'trackback - ' : ''). $comments->blog->toXML($comments->f('post_titre')).' - '. $comments->blog->toXML($comments->f('comment_auteur'))."\n". ' '."\n". ' '.$comments->getIsoDate()."\n". ' '.dt::iso8601(strtotime($comments->f('comment_upddt')))."\n". getAtom1ID($comments->getPermURL(), $comments->getTS())."\n". ' '.htmlspecialchars($comments->f('comment_auteur'))."\n". ' '."\n". '
'."\n".$content."\n
\n". "
\n". '
'."\n"; } //fonction récupérant le mime type des fichiers suivant l'extension du fichier function mimetype($filename){ $file2mime = array( 'avi'=>'video/x-msvideo', 'mp3'=>'audio/mpeg', 'mpeg'=>'video/mpeg', 'ogg'=>'audio/ogg', 'torrent'=>'application/x-bittorrent', 'pdf'=>'application/pdf', 'zip'=>'application/zip' ); $filetype = substr(strtolower(strrchr($filename, '.')), 1); return $file2mime[$filetype]; } //function récupérant la taille du fichier function fileLenght($filename) { $filename = path::real($filename); $stat = stat($filename); return $stat[7]; } function remote_filesize($uri) { // start output buffering ob_start(); // initialize curl with given uri $ch = curl_init($uri); // make sure we get the header curl_setopt($ch, CURLOPT_HEADER, 1); // make it a http HEAD request curl_setopt($ch, CURLOPT_NOBODY, 1); $okay = curl_exec($ch); curl_close($ch); // get the output buffer $head = ob_get_contents(); // clean the output buffer and return to previous // buffer settings ob_end_clean(); // gets you the numeric value from the Content-Length // field in the http header $regex = '/Content-Length:\s([0-9].+?)\s/'; $count = preg_match($regex, $head, $matches); // if there was a Content-Length field, its value // will now be in $matches[1] if (isset($matches[1])) { $size = $matches[1]; } else { $size = 'unknown'; } return $size; } $lang = (!empty($_GET['lang'])) ? $_GET['lang'] : ''; $cat = (!empty($_GET['cat'])) ? $_GET['cat'] : ''; # Connexion MySQL $con = new Connection(DB_USER,DB_PASS,DB_HOST,DB_DBASE); if ($con->error()) { exit; } # Création de l'objet de type weblog avec uniquement les billets # publiés $blog = new xblog($con,DB_PREFIX,1,dc_encoding); $blog->rs_blogpost = 'xblogpost'; $blog->rs_blogcomment = 'xblogcomment'; $blog->setURL('post',dc_blog_url.dc_format_post_url); # Si type = co on fait un fil des commentaires if ($type == 'co') { if (!empty($_GET['post'])) { $comments = $blog->getComments($_GET['post'],'DESC',false,$lang); } else { $comments = $blog->getComments('','DESC',20); } $title = dc_blog_name.' - Commentaires'; $ts = time(); $items = $seq = ''; } else { # Dernières nouvelles $news = $blog->getLastNews(10,$cat); $ts = strtotime($blog->getEarlierDate()); $title = dc_blog_name; } # Cache HTTP if (dc_http_cache && defined('DC_UPDATE_FILE_W') && DC_UPDATE_FILE_W) { $mod_files = get_included_files(); $mod_files[] = DC_UPDATE_FILE; $mod_files[] = dirname(__FILE__).'/conf/dotclear.ini'; cache::http($mod_files); } header('Content-Type: application/xml; charset='.dc_encoding); echo ''."\n"; ?> <?php echo $blog->toXML($title); ?> DotClear - toXML($title); ?> DotClear votre_email@votre_fournisseur.com toXML($title); ?> Copyright (C) - toXML($title); ?> lien_vers_son_icon daily 1 EOF()) { echo getAtom1CommentEntry(dc_short_feeds); $comments->moveNext(); } } else { while(!$news->EOF()) { echo getAtom1PostEntry(dc_short_feeds,$news,$type); $news->moveNext(); } } $con->close(); ?>