loadXML($data) or die('xml malformé'); $title = $dom->getElementsByTagName('title'); return $title->item(0)->nodeValue; } function get_link_from_feed($url) { // get site link from feed $data = file_get_contents("$url"); $xml = simplexml_load_string($data); // quick feed check if (isset($xml->entry)) // ATOM feed. {$result="true";} elseif (isset($xml->item)) // RSS 1.0 /RDF {$result="true";} elseif (isset($xml->channel->item)) // RSS 2.0 {$result="true";} else {$result="false";} if($result == "false") { 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 NoProtocolSiteURL($url) { $siteurlnoprototypes = array("http://", "https://"); $siteurlnoproto = str_replace($siteurlnoprototypes, "", $url); return $siteurlnoproto; } function DetectRedirect($url) { $response = get_headers($url, 1); if(!empty($response['Location'])) { $response2 = get_headers($response['Location'], 1); if(!empty($response2['Location'])) {die('too much redirection');} else { return $response['Location']; } } else { return $url; } } if (isset($_GET['check'])) { $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=''; if(strpos($_GET['check'], 'twitter') !== FALSE) { header('Content-type: image/svg+xml');die($svg_twitter); } if(strpos($_GET['check'], 'identica') !== FALSE) { header('Content-type: image/svg+xml');die($svg_identica); } if(strpos($_GET['check'], 'statusnet') !== FALSE) { header('Content-type: image/svg+xml');die($svg_statusnet); } $errorlog="./".$_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 */ { header('Content-type: image/svg+xml'); 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("./".$_GET['check']."/vvb.ini") or die; header('Content-type: image/svg+xml'); $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é) */ } } if (isset($_GET['export'])) // autoblog exporting { 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); $title=$config->site_title; $url=$config->site_url; $feed=$config->feed_url; $reponse[$unit] = array("$title", "$url", "$feed"); } } echo json_encode($reponse); die; } if (isset($_GET['feedexport'])) // autoblog exporting -feed only { header('Content-Type: application/json'); $directory = "./"; $reponse=""; $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; $reponse=$reponse.";$feed"; } } $reponse=substr($reponse, 1); echo json_encode(explode(';', $reponse)); die; } if (isset($_GET['sitemap'])) // url-list sitemap { header('Content-Type: text/plain'); $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"; } } die; } function escape($str) { return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); } $form = '


'; if(!empty($_GET['via_button']) && !empty($_GET['rssurl']) && $_GET['number'] === '17') { if(isset($_GET['add']) && $_GET['add'] === '1' && !empty($_GET['siteurl']) && !empty($_GET['sitename'])) { $rssurl = DetectRedirect(escape($_GET['rssurl'])); $siteurl = escape($_GET['siteurl']); $foldername = sha1(NoProtocolSiteURL($siteurl)); if(substr($siteurl, -1) == '/'){ $foldername2 = sha1(NoProtocolSiteURL(substr($siteurl, 0, -1))); }else{ $foldername2 = sha1(NoProtocolSiteURL($siteurl).'/');} $sitename = escape($_GET['sitename']); $sitedomain1 = preg_split('/\//', $siteurl, 0); $sitedomain2=$sitedomain1[2]; $sitedomain3=explode(".", $sitedomain2); $sitedomain3=array_reverse($sitedomain3); $sitedomain = $sitedomain3[1].'.'.$sitedomain3[0]; if(file_exists($foldername) || file_exists($foldername2)) { die('Erreur: l\'autoblog existe déjà.'); } if ( mkdir('./'. $foldername, 0755, false) ) { $fp = fopen('./'. $foldername .'/index.php', 'w+'); if( !fwrite($fp, "") ) {die("Impossible d'écrire le fichier index.php");} fclose($fp); $fp = fopen('./'. $foldername .'/vvb.ini', 'w+'); if( !fwrite($fp, '[VroumVroumBlogConfig] SITE_TITLE="'. $sitename .'" SITE_DESCRIPTION="Ce site n\'est pas le site officiel de '. $sitename .'
C\'est un blog automatisé qui réplique les articles de '. $sitename .'" SITE_URL="'. $siteurl .'" FEED_URL="'. $rssurl .'" DOWNLOAD_MEDIA_FROM='.$sitedomain) ) {die("Impossible d'écrire le fichier vvb.ini");} fclose($fp); {die('autoblog crée avec succès.afficher l\'autoblog');} } else {die("Impossible de créer le répertoire.");} } else { // checking procedure $rssurl = DetectRedirect($_GET['rssurl']); $siteurl = get_link_from_feed($rssurl); $foldername = sha1(NoProtocolSiteURL($siteurl)); if(substr($siteurl, -1) == '/'){ $foldername2 = sha1(NoProtocolSiteURL(substr($siteurl, 0, -1))); }else{ $foldername2 = sha1(NoProtocolSiteURL($siteurl).'/');} $sitename = get_title_from_feed($rssurl); $sitedomain1 = preg_split('/\//', $siteurl, 0);$sitedomain2=$sitedomain1[2];$sitedomain3=explode(".", $sitedomain2);$sitedomain3=array_reverse($sitedomain3);$sitedomain = $sitedomain3[1].'.'.$sitedomain3[0]; if(file_exists($foldername) || file_exists($foldername2)) { die('Erreur: l\'autoblog existe déjà.'); } $form = 'Merci de vérifier les informations suivantes, corrigez si nécessaire.



'; echo $form; die; } } if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance'])) { $socialaccount = strtolower(escape($_POST['socialaccount'])); if(escape($_POST['socialinstance']) === 'twitter') { $socialinstance = 'twitter'; } if(escape($_POST['socialinstance']) === 'identica') { $socialinstance = 'identica'; } if(escape($_POST['socialinstance']) === 'statusnet') { $socialinstance = 'statusnet'; } $folder = "$socialinstance-$socialaccount";if(file_exists($folder)) { die('Erreur: l\'autoblog existe déjà.'); } if($socialinstance === 'twitter') { $siteurl = "http://twitter.com/$socialaccount"; $rssurl = "http://api.twitter.com.nyud.net/1/statuses/user_timeline.rss?screen_name=$socialaccount"; } if($socialinstance === 'identica') { $siteurl = "http://identi.ca/$socialaccount"; $rssurl = "http://identi.ca.nyud.net/api/statuses/user_timeline/$socialaccount.rss"; } if($socialinstance === 'statusnet' && !empty($_POST['socialurl'])) { $siteurl = "http://".escape($_POST['socialurl'])."/$socialaccount"; $rssurl = "http://".escape($_POST['socialurl'])."/api/statuses/user_timeline/$socialaccount.rss"; } $headers = get_headers($rssurl, 1); if (strpos($headers[0], '200') == FALSE) {$error[] = "Flux inaccessible (compte inexistant ?)";} else { } if( empty($error) ) { if( !preg_match('#\.\.|/#', $folder) ) { if ( mkdir('./'. $folder, 0755, false) ) { $fp = fopen('./'. $folder .'/index.php', 'w+'); if( !fwrite($fp, "") ) $error[] = "Impossible d'écrire le fichier index.php"; fclose($fp); $fp = fopen('./'. $folder .'/vvb.ini', 'w+'); if( !fwrite($fp, '[VroumVroumBlogConfig] SITE_TITLE="'.$socialinstance.'-'.$socialaccount.'" SITE_DESCRIPTION="AutoMicroblog automatisé de " SITE_URL='. $siteurl .' FEED_URL="'. $rssurl .'"') ) $error[] = "Impossible d'écrire le fichier vvb.ini"; fclose($fp); $error[] = 'AutoMicroblog ajouté avec succès.'; } else $error[] = "Impossible de créer le répertoire."; } else $error[] = "Nom de site invalide."; } } if( !empty($_POST) && empty($_POST['socialinstance']) ) { $error = array(); if(empty($_POST['rssurl'])) {$error[] = "Veuillez entrer l'adresse du flux.";} if(empty($_POST['number'])) {$error[] = "Le chiffre. Écrivez le chiffre.";} if($_POST['number'] !== '17') {$error[] = "C'est pas le bon chiffre.";} if(empty($error)) { $rssurl = DetectRedirect(escape($_POST['rssurl'])); if(!empty($_POST['siteurl'])) { // check done, writing out $siteurl = escape($_POST['siteurl']); $foldername = sha1(NoProtocolSiteURL($siteurl));$sitename = get_title_from_feed($rssurl); if(substr($siteurl, -1) == '/'){ $foldername2 = sha1(NoProtocolSiteURL(substr($siteurl, 0, -1))); }else{ $foldername2 = sha1(NoProtocolSiteURL($siteurl).'/');} $sitedomain1 = preg_split('/\//', $siteurl, 0);$sitedomain2=$sitedomain1[2];$sitedomain3=explode(".", $sitedomain2);$sitedomain3=array_reverse($sitedomain3);$sitedomain = $sitedomain3[1].'.'.$sitedomain3[0]; if(file_exists($foldername) || file_exists($foldername2)) { die('Erreur: l\'autoblog existe déjà.'); } if ( mkdir('./'. $foldername, 0755, false) ) { $fp = fopen('./'. $foldername .'/index.php', 'w+'); if( !fwrite($fp, "") ) $error[] = "Impossible d'écrire le fichier index.php"; fclose($fp); $fp = fopen('./'. $foldername .'/vvb.ini', 'w+'); if( !fwrite($fp, '[VroumVroumBlogConfig] SITE_TITLE="'. $sitename .'" SITE_DESCRIPTION="Ce site n\'est pas le site officiel de '. $sitename .'
C\'est un blog automatisé qui réplique les articles de '. $sitename .'" SITE_URL="'. $siteurl .'" FEED_URL="'. $rssurl .'" DOWNLOAD_MEDIA_FROM='.$sitedomain) ) $error[] = "Impossible d'écrire le fichier vvb.ini"; fclose($fp); $error[] = 'autoblog crée avec succès.afficher l\'autoblog'; } else $error[] = "Impossible de créer le répertoire."; } else { // checking procedure $rssurl = DetectRedirect($rssurl); $siteurl = get_link_from_feed($rssurl); $foldername = sha1(NoProtocolSiteURL($siteurl)); $sitename = get_title_from_feed($rssurl); if(substr($siteurl, -1) == '/'){ $foldername2 = sha1(NoProtocolSiteURL(substr($siteurl, 0, -1))); }else{ $foldername2 = sha1(NoProtocolSiteURL($siteurl).'/');} $sitedomain1 = preg_split('/\//', $siteurl, 0);$sitedomain2=$sitedomain1[2];$sitedomain3=explode(".", $sitedomain2);$sitedomain3=array_reverse($sitedomain3);$sitedomain = $sitedomain3[1].'.'.$sitedomain3[0]; if(file_exists($foldername) || file_exists($foldername2)) { die('Erreur: l\'autoblog existe déjà.'); } $form = 'Merci de vérifier les informations suivantes, corrigez si nécessaire.




'; } } } ?> Le Projet Autoblog

LE PROJET AUTOBLOG

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

Autres fermes
Rechercher

Ajouter un compte social


Twitter
Identica


Ajouter un site web
Erreur(s) :

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


Pour ajouter facillement un autoblog, 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

export JSON
$value) { $key = strtolower($key); $config->$key = $value; } $autoblogs[$unit] = '
'; unset($ini); } } } if(!empty($autoblogs)){ sort($autoblogs, SORT_STRING); foreach ($autoblogs as $autoblog) { echo $autoblog; } } ?>
".count($autoblogs)." autoblogs d'hébergés"; ?>
Autoblogs propulsés par VroumVroumBlog 0.2.10 [SQLite] (Domaine Public)
index2 inspiré par Arthur et développé par Mitsu et Oros (Domaine Public)
Code source du projet ".$HTML_footer; } ?>