loadXML($data) or die('xml malformé'); $title = $dom->getElementsByTagName('title'); return $title->item(0)->nodeValue; } function get_link_from_feed($url) { return get_link_from_datafeed(file_get_contents($url)); } function get_link_from_datafeed($data) { if($data === false) { return 'url inaccessible'; } $xml = simplexml_load_string($data); // quick feed check // ATOM feed && RSS 1.0 /RDF && RSS 2.0 if (!isset($xml->entry) && !isset($xml->item) && !isset($xml->channel->item)) die('le flux n\'a pas une syntaxe valide'); $check = substr($data, 0, 5); if($check !== 'channel->link; if($channel['link'] === NULL) { $dom = new DOMDocument; $dom->loadXML($data) or die('xml malformé'); $link = $dom->getElementsByTagName('uri'); return $link->item(0)->nodeValue; } else { return $channel['link']; } } function serverUrl() { $https = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS'])=='on')) || $_SERVER["SERVER_PORT"]=='443'; // HTTPS detection. $serverport = ($_SERVER["SERVER_PORT"]=='80' || ($https && $_SERVER["SERVER_PORT"]=='443') ? '' : ':'.$_SERVER["SERVER_PORT"]); return 'http'.($https?'s':'').'://'.$_SERVER["SERVER_NAME"].$serverport; } function objectCmp($a, $b) { return strcasecmp ($a->site_title, $b->site_title); } /** * SVG **/ if (isset($_GET['check'])) { //echo "1"; header('Content-type: image/svg+xml'); $randomtime=rand(86400, 259200); /* intervalle de mise à jour: de 1 à 3 jours (pour éviter que le statut de tous les autoblogs soit rafraichi en bloc et bouffe le CPU) */ $expire=time() -$randomtime ; /* SVG minimalistes */ $svg_vert='OK'; $svg_jaune='mv'; $svg_rouge='err'; $svg_twitter=''; $svg_identica=''; $svg_statusnet=''; $errorlog="./".escape( $_GET['check'] ) ."/error.log"; if(file_exists($errorlog) && filemtime($errorlog) < $expire) { unlink($errorlog); } /* errorlog périmé ? Suppression. */ if(file_exists($errorlog)) /* errorlog existe encore ? se contenter de lire sa taille pour avoir le statut */ { if(filesize($errorlog) == "0") {die($svg_vert);} else if(filesize($errorlog) == "1") {die($svg_jaune);} else {die($svg_rouge);} } else /* ..sinon, lancer la procédure de contrôle */ { $ini = parse_ini_file("./". escape( $_GET['check'] ) ."/vvb.ini") or die; if(strpos(strtolower($ini['SITE_TITLE']), 'twitter') !== FALSE) { die($svg_twitter); } /* Twitter */ if(strpos(strtolower($ini['SITE_TITLE']), 'identica') !== FALSE) { die($svg_identica); } /* Identica */ if(strpos(strtolower($ini['SITE_TYPE']), 'microblog') !== FALSE) { die($svg_statusnet); } /* Statusnet */ $headers = get_headers($ini['FEED_URL']); if(empty($headers)) { file_put_contents($errorlog, '..'); die($svg_rouge); } /* le flux est indisponible (typiquement: erreur DNS ou possible censure) - à vérifier */ $code=explode(" ", $headers[0]); if($code[1] == "200") { file_put_contents($errorlog, ''); die($svg_vert);} /* code retour 200: flux disponible */ else {file_put_contents($errorlog, '.'); die($svg_jaune);} /* autre code retour: un truc a changé (redirection, changement de CMS, .. bref vvb.ini doit être corrigé) */ } } /** * Simple and Full Export **/ if (isset($_GET['export'])) { header('Content-Type: application/json'); $directory = "./"; $subdirs = glob($directory . "*"); foreach($subdirs as $unit) { if(is_dir($unit)) { $unit=substr($unit, 2); $ini = parse_ini_file($unit.'/vvb.ini'); $config = new stdClass; foreach ($ini as $key=>$value) { $key = strtolower($key); $config->$key = $value; } unset($ini); $feed=$config->feed_url; $type=$config->site_type; $title=$config->site_title; $url=$config->site_url; $reponse[$unit] = array("SITE_TYPE"=>"$type", "SITE_TITLE"=>"$title", "SITE_URL"=>"$url", "FEED_URL"=>"$feed"); } } echo json_encode( array( "meta"=> array("xsaf-version"=>XSAF_VERSION,"xsaf-db_transfer"=>"true","xsaf-media_transfer"=>"true"), "autoblogs"=>$reponse)); die; } /** * Site map **/ if (isset($_GET['sitemap'])) { header('Content-Type: application/xml'); echo ''; $directory = "./"; $subdirs = glob($directory . "*"); foreach($subdirs as $unit) { if(is_dir($unit)) { $unit=substr($unit, 2); $proto=$_SERVER['HTTPS']?"https://":"http://"; echo ''.$proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."\n"; echo ''.date('c', filemtime($unit))."\n"; echo 'hourly'; } } echo ''; die; } /** * Update ALL autblogs (except .disabled) * This action can be very slow and consume CPU if you have a lot of autoblogs **/ if( isset($_GET['updateAll']) && ALLOW_FULL_UPDATE) { $expire = time() - 84600 ; // 23h30 en secondes $lockfile = ".updatealllock"; if (file_exists($lockfile) && filemtime($lockfile) > $expire) { echo "too early"; die; } else { if( file_exists($lockfile) ) unlink($lockfile); if( file_put_contents($lockfile, date(DATE_RFC822)) ===FALSE) { echo "Merci d'ajouter des droits d'écriture sur le fichier."; die; } } $directory = "./"; $subdirs = glob($directory . "*"); foreach($subdirs as $unit) { if(is_dir($unit)) { if( !file_exists(ROOT_DIR . '/' . $unit . '/.disabled')) { file_get_contents(serverUrl() . substr($_SERVER['PHP_SELF'], 0, -9) . $unit . '/index.php'); } } } } $form = '


'; /** * ADD BY BOOKMARK BUTTON **/ if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_BUTTON ) { $form = ''; if( empty($_GET['rssurl']) ) { $form .= '

URL du flux RSS incorrect.
Fermer la fenêtre.

'; } else { if(isset($_GET['add']) && $_GET['add'] === '1' && !empty($_GET['siteurl']) && !empty($_GET['sitename'])) { $rssurl = DetectRedirect(escape($_GET['rssurl'])); $siteurl = escape($_GET['siteurl']); $sitename = escape($_GET['sitename']); $sitetype = updateType($_GET['type']); $error = createAutoblog($sitetype, $sitename, $siteurl, $rssurl, $error); if( empty($error)) { $form .= '

'.$sitetype.'

'; $form .= ''; $form .= '

Autoblog '. $sitename .' ajouté avec succès.
'; } else { $form .= '

'; } $form .= 'Fermer la fenêtre.

'; } else { $rssurl = DetectRedirect(escape($_GET['rssurl'])); $datafeed = file_get_contents($rssurl); if( $datafeed !== false ) { $siteurl = get_link_from_datafeed($datafeed); $sitename = get_title_from_datafeed($datafeed); $sitetype = updateType($_GET['type']); $form .= 'Merci de vérifier les informations suivantes, corrigez si nécessaire.




'; } else { $form .= '

URL du flux RSS incorrect.
Fermer la fenêtre.

'; } } } $form .= ''; echo $form; die; } /** * ADD BY SOCIAL / SHAARLI **/ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_SOCIAL) { $socialaccount = strtolower(escape($_POST['socialaccount'])); $socialinstance = strtolower(escape($_POST['socialinstance'])); if($socialinstance === 'twitter') { $sitetype = 'microblog'; $siteurl = "http://twitter.com/$socialaccount"; $rssurl = "http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=$socialaccount"; } elseif($socialinstance === 'identica') { $sitetype = 'microblog'; $siteurl = "http://identi.ca/$socialaccount"; $rssurl = "http://identi.ca/api/statuses/user_timeline/$socialaccount.rss"; } elseif($socialinstance === 'statusnet' && !empty($_POST['statusneturl'])) { $sitetype = 'microblog'; $siteurl= NoProtocolSiteURL(escape($_POST['statusneturl'])); $rssurl = DetectRedirect("http://".$siteurl."/api/statuses/user_timeline/$socialaccount.rss"); $siteurl = DetectRedirect("http://".$siteurl."/$socialaccount"); } elseif($socialinstance === 'shaarli' && !empty($_POST['shaarliurl'])) { $sitetype = 'shaarli'; $siteurl = NoProtocolSiteURL(escape($_POST['shaarliurl'])); $siteurl = DetectRedirect("http://".$siteurl."/"); $rssurl = $siteurl."?do=rss"; $socialaccount = get_title_from_feed($rssurl); } $headers = get_headers($rssurl, 1); if (strpos($headers[0], '200') == FALSE) { $error[] = "Flux inaccessible (compte inexistant ?)"; } if( empty($error) ) { $error = createAutoblog($sitetype, ucfirst($socialinstance) .' - '. $socialaccount, $siteurl, $rssurl, $error); if( empty($error)) $success[] = ''.ucfirst($socialinstance) .' - '. $socialaccount.' ajouté avec succès.'; } } /** * ADD BY GENERIC LINK **/ if( !empty($_POST['generic']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_LINK) { if(empty($_POST['rssurl'])) {$error[] = "Veuillez entrer l'adresse du flux.";} if(empty($_POST['number'])) {$error[] = "Vous êtes un bot ?";} if($_POST['number'] !== '17') {$error[] = "C'est pas le bon nombre.";} if(empty($error)) { $rssurl = DetectRedirect(escape($_POST['rssurl'])); if(!empty($_POST['siteurl'])) { $siteurl = escape($_POST['siteurl']); $sitename = get_title_from_feed($rssurl); $error = createAutoblog('generic', $sitename, $siteurl, $rssurl, $error); if( empty($error)) $success[] = 'autoblog crée avec succès.afficher l\'autoblog'; } else { // checking procedure $rssurl = DetectRedirect($rssurl); $datafeed = file_get_contents($rssurl); $sitetype = 'generic'; $siteurl = get_link_from_datafeed($datafeed); $sitename = get_title_from_datafeed($datafeed); $form = 'Merci de vérifier les informations suivantes, corrigez si nécessaire.





'; } } } /** * ADD BY OPML **/ if( !empty($_POST['opml']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_OPML) { if (is_uploaded_file($_FILES['file']['tmp_name'])) { $opml = null; if( ($opml = simplexml_load_file( $_FILES['file']['tmp_name'])) !== false ) { foreach( $opml->body->outline as $outline ) { if ( !empty( $outline['title'] ) && !empty( $outline['xmlUrl']) && !empty( $outline['htmlUrl'] )) { $siteurl = escape($outline['htmlUrl']); $rssurl = DetectRedirect(escape( $outline['xmlUrl'])); $sitename = escape( $outline['title'] ); $error = createAutoblog( 'generic', $sitename, $siteurl, $rssurl, $error ); if( empty ( $error )) $success[] = 'Autoblog "'. $sitename .'" crée avec succès. → afficher l\'autoblog.'; } } } else $error[] = "Impossible de lire le contenu du fichier OPML."; unlink($_FILES['file']['tmp_name']); } else { $error[] = "Le fichier n'a pas été envoyé."; } } ?> Projet Autoblog<?php if(!empty($head_title)) { echo " | " . escape($head_title); } ?>

PROJET AUTOBLOG

Présentation

Le Projet Autoblog a pour objectif de répliquer les articles d'un blog ou d'un site site web.
Si l'article source est supprimé, et même si le site d'origine disparaît, les articles restent lisibles sur l'autoblog.
L'objectif premier de ce projet est de lutter contre la censure et toute sorte de pression...

Voici une liste d'autoblogs hébergés sur (plus d'infos sur le projet).

Ajouter un autoblog

Message'. (count($error) ? 's' : '') .' :

'; } ?>

Ajouter un site web

Si vous souhaitez que héberge un autoblog d'un site,
remplissez le formulaire suivant:

Ajouter un compte social


Twitter
Identica

Ajouter un Shaarli


Ajouter par fichier OPML


Marque page

Pour ajouter facilement un autoblog d'un site web, glissez ce bouton dans votre barre de marque-pages → ";var%20popup=window.open("","Add%20autoblog",'height=180,width=670');popup.document.writeln('');popup.document.write('Url%20feed%20%20:%20
');var%20feed_links=new%20Array();var%20links=document.getElementsByTagName('link');if(links.length>0){for(var%20i=0;i'+links[i].title+"%20(%20"+links[i].href+"%20)
");}}}popup.document.writeln("");popup.document.writeln("");popup.document.writeln("
");popup.document.writeln("");})();"> Projet Autoblog

Autoblogs hébergés

Autres fermesRechercher

sitemap | export JSON
$value) { $key = strtolower($key); $config->$key = $value; } $autoblogs[$unit] = $config; unset($ini); } } } } uasort($autoblogs, "objectCmp"); $autoblogs_display = ''; if(!empty($autoblogs)){ foreach ($autoblogs as $key => $autoblog) { $autoblogs_display .= '
config | '.escape($autoblog->site_type).' source: '.escape($autoblog->site_url).'
'; } } echo $autoblogs_display; ?>
".count($autoblogs)." autoblogs hébergés

"; ?>
Propulsé par Projet Autoblog 0.3 de Mitsu, Oros et Arthur Hoaro (Domaine Public) ".$HTML_footer; } ?>