Merge Arthur Hoaro changes (OPML, updateAll, and minor changes)

This commit is contained in:
ArthurHoaro 2013-02-18 19:42:10 +01:00
parent 21b15b025b
commit bc0f6fa285
5 changed files with 685 additions and 518 deletions

View file

@ -697,6 +697,8 @@ echo '
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<h1><a href="'. LOCAL_URL .'.." style="font-size:0.8em;">PROJET AUTOBLOG ~ '. $head_title .'</a></h1>
<hr>
<h1><a href="'.escape(LOCAL_URL).'">'.escape($config->site_title).'</a></h1>'; <h1><a href="'.escape(LOCAL_URL).'">'.escape($config->site_title).'</a></h1>';
if (!empty($config->site_description)) if (!empty($config->site_description))

View file

@ -47,15 +47,28 @@ function __($str)
} }
} }
// Autoriser la création d'autoblogs ? define( 'ALLOW_NEW_AUTOBLOGS', TRUE );
$allow_new_autoblogs=TRUE; // If you set ALLOW_NEW_AUTOBLOGS to FALSE, the following options do not matter.
// Generic RSS
define( 'ALLOW_NEW_AUTOBLOGS_BY_LINKS', TRUE );
// Twitter, Identica, Statusnet, Shaarli
define( 'ALLOW_NEW_AUTOBLOGS_BY_SOCIAL', TRUE );
// Bookmark button
define( 'ALLOW_NEW_AUTOBLOGS_BY_BUTTON', TRUE );
// OPML file
define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML', TRUE );
define( 'ALLOW_FULL_UPDATE', TRUE );
// Logo à utiliser // Logo à utiliser
$logo="./icon-logo.svg"; //$logo="./icon-logo.svg";
$logo = '';
// Marquez ici votre propre message qui apparaîtra en bas de page. // Marquez ici votre propre message qui apparaîtra en bas de page.
// exemple : // exemple :
// $HTML_footer="<br/><a href='http://datalove.me/'>Love data</a><br/>Data is essential<br/>Data must flow<br/>Data must be used<br/>Data is neither good nor bad<br/>There is no illegal data<br/>Data is free<br/>Data can not be owned<br/>No man, machine or system shall interrupt the flow of data<br/>Locking data is a crime against datanity"; //$HTML_footer="<br/><a href='http://datalove.me/'>Love data</a><br/>Data is essential<br/>Data must flow<br/>Data must be used<br/>Data is neither good nor bad<br/>There is no illegal data<br/>Data is free<br/>Data can not be owned<br/>No man, machine or system shall interrupt the flow of data<br/>Locking data is a crime against datanity";
$HTML_footer=""; $HTML_footer='D\'après les premières versions de <a href="sebsauvage.net">SebSauvage</a> et <a href="http://bohwaz.net/">Bohwaz</a>.';
$head_title = "Arthur HOARO";
?> ?>

100
0.3/functions.php Executable file
View file

@ -0,0 +1,100 @@
<?php
function NoProtocolSiteURL($url) {
$siteurlnoprototypes = array("http://", "https://");
$siteurlnoproto = str_replace($siteurlnoprototypes, "", $url);
// Remove the / at the end of string
if ( $siteurlnoproto[strlen($siteurlnoproto) - 1] == '/' )
$siteurlnoproto = substr($siteurlnoproto, 0, -1);
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;
}
}
function urlToFolder($url) {
return sha1(NoProtocolSiteURL($url));
}
function escape($str) {
return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false);
}
function createAutoblog($type, $sitename, $siteurl, $rssurl, $error = array()) {
if( $type == 'generic' ) {
$var = updateType( $siteurl );
$type = $var['type'];
if( !empty( $var['name']) )
$sitename = ucfirst($var['name']) . ' - ' . $sitename;
}
$foldername = urlToFolder($siteurl);
if(file_exists($foldername)) {
$error[] = 'Erreur: l\'autoblog <a href="./'.$foldername.'/">'. $sitename .'</a> existe déjà.';
return $error;
}
if ( mkdir('./'. $foldername, 0755, false) ) {
$fp = fopen('./'. $foldername .'/index.php', 'w+');
if( !fwrite($fp, "<?php require_once dirname(__DIR__) . '/autoblog.php'; ?>") )
$error[] = "Impossible d'écrire le fichier index.php";
fclose($fp);
$fp = fopen('./'. $foldername .'/vvb.ini', 'w+');
if( !fwrite($fp, '[VroumVroumBlogConfig]
SITE_TYPE="'. $type .'"
SITE_TITLE="'. $sitename .'"
SITE_DESCRIPTION="Site original : <a href=\''. $siteurl .'\'>'. $sitename .'</a>"
SITE_URL="'. $siteurl .'"
FEED_URL="'. $rssurl .'"
ARTICLES_PER_PAGE="5"
UPDATE_INTERVAL="'. getInterval( $type ) .'"
UPDATE_TIMEOUT="30"') )
$error[] = "Impossible d'écrire le fichier vvb.ini";
fclose($fp);
}
else
$error[] = "Impossible de créer le répertoire.";
return $error;
}
function getInterval( $type ) {
switch( $type ) {
case 'microblog':
return 300;
case 'shaarli':
return 1800;
default:
return 3600;
}
}
function updateType($siteurl) {
if( strpos($siteurl, 'twitter.com') !== FALSE ) {
return array('type' => 'microblog', 'name' => 'twitter');
}
elseif ( strpos( $siteurl, 'identi.ca') !== FALSE ) {
return array('type' => 'microblog', 'name' => 'identica');
}
elseif( strpos( $siteurl, 'shaarli' ) !== FALSE ) {
return array('type' => 'shaarli', 'name' => 'shaarli');
}
else
return array('type' => 'generic', 'name' => '');
}
?>

View file

@ -1,8 +1,11 @@
<?php <?php
/* /*
Projet Autoblog 0.3-beta Projet Autoblog 0.3-beta-fah
Code: https://github.com/mitsukarenai/Projet-Autoblog Code: https://github.com/mitsukarenai/Projet-Autoblog
Authors: Mitsu https://www.suumitsu.eu/ & Oros https://www.ecirtam.net/ Authors:
Mitsu https://www.suumitsu.eu/
Oros https://www.ecirtam.net/
Arthur Hoaro http://aryo.fr
License: Public Domain License: Public Domain
Instructions: Instructions:
@ -14,49 +17,59 @@
- PROFIT ! - PROFIT !
*/ */
define('XSAF_VERSION', 3);
define('XSAF_VERSION', 3);
define('ROOT_DIR', __DIR__); define('ROOT_DIR', __DIR__);
if(file_exists("config.php")){ if(file_exists("config.php")){
include "config.php"; include "config.php";
} }
if(file_exists("functions.php")){
include "functions.php";
}
function get_title_from_feed($url) $error = array();
{ $success = array();
// get site title from feed
$data = file_get_contents("$url"); function get_title_from_feed($url) {
return get_title_from_datafeed(file_get_contents($url));
}
function get_title_from_datafeed($data) {
if($data === false) { die('url inaccessible'); } if($data === false) { die('url inaccessible'); }
$dom = new DOMDocument; $dom = new DOMDocument;
$dom->loadXML($data) or die('xml malformé'); $dom->loadXML($data) or die('xml malformé');
$title = $dom->getElementsByTagName('title'); $title = $dom->getElementsByTagName('title');
return $title->item(0)->nodeValue; return $title->item(0)->nodeValue;
} }
function get_link_from_feed($url) function get_link_from_feed($url) {
{ return get_link_from_datafeed(file_get_contents($url));
// get site link from feed }
$data = file_get_contents("$url");
function get_link_from_datafeed($data) {
$xml = simplexml_load_string($data); // quick feed check $xml = simplexml_load_string($data); // quick feed check
// ATOM feed && RSS 1.0 /RDF && RSS 2.0 // ATOM feed && RSS 1.0 /RDF && RSS 2.0
if (!isset($xml->entry) && !isset($xml->item) && !isset($xml->channel->item)) if (!isset($xml->entry) && !isset($xml->item) && !isset($xml->channel->item))
{ die('le flux n\'a pas une syntaxe valide'); } die('le flux n\'a pas une syntaxe valide');
$check = substr($data, 0, 5);
if($check !== '<?xml') {
die('n\'est pas un flux valide');
}
$check = substr($data, 0, 5);
if($check !== '<?xml') { die('n\'est pas un flux valide'); }
$xml = new SimpleXmlElement($data); $xml = new SimpleXmlElement($data);
$channel['link'] = $xml->channel->link; $channel['link'] = $xml->channel->link;
if($channel['link'] === NULL) if($channel['link'] === NULL) {
{ $dom = new DOMDocument;
$dom = new DOMDocument; $dom->loadXML($data) or die('xml malformé');
$dom->loadXML($data) or die('xml malformé'); $link = $dom->getElementsByTagName('uri');
$link = $dom->getElementsByTagName('uri'); return $link->item(0)->nodeValue;
return $link->item(0)->nodeValue;
}
else
{
return $channel['link'];
}
} }
else {
return $channel['link'];
}
}
function serverUrl() function serverUrl()
{ {
@ -65,197 +78,173 @@ function serverUrl()
return 'http'.($https?'s':'').'://'.$_SERVER["SERVER_NAME"].$serverport; return 'http'.($https?'s':'').'://'.$_SERVER["SERVER_NAME"].$serverport;
} }
function NoProtocolSiteURL($url) function objectCmp($a, $b) {
{ return strcasecmp ($a->site_title, $b->site_title);
$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;
}
} }
/**
* SVG
**/
if (isset($_GET['check'])) 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) */ //echo "1";
$expire=time() -$randomtime ; 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 minimalistes */
$svg_vert='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><g><rect width="15" height="15" x="0" y="0" style="fill:#00ff00;stroke:#008000"/></g><text style="font-size:10px;font-weight:bold;text-anchor:middle;font-family:Arial"><tspan x="7" y="11">OK</tspan></text></svg>'; $svg_vert='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><g><rect width="15" height="15" x="0" y="0" style="fill:#00ff00;stroke:#008000"/></g><text style="font-size:10px;font-weight:bold;text-anchor:middle;font-family:Arial"><tspan x="7" y="11">OK</tspan></text></svg>';
$svg_jaune='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><g><rect width="15" height="15" x="0" y="0" style="fill:#ffff00;stroke:#ffcc00"/></g><text style="font-size:10px;font-weight:bold;text-anchor:middle;font-family:Arial"><tspan x="7" y="11">mv</tspan></text></svg>'; $svg_jaune='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><g><rect width="15" height="15" x="0" y="0" style="fill:#ffff00;stroke:#ffcc00"/></g><text style="font-size:10px;font-weight:bold;text-anchor:middle;font-family:Arial"><tspan x="7" y="11">mv</tspan></text></svg>';
$svg_rouge='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><g><rect width="15" height="15" x="0" y="0" style="fill:#ff0000;stroke:#800000"/></g><text style="font-size:10px;font-weight:bold;text-anchor:middle;font-family:Arial"><tspan x="7" y="11">err</tspan></text></svg>'; $svg_rouge='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><g><rect width="15" height="15" x="0" y="0" style="fill:#ff0000;stroke:#800000"/></g><text style="font-size:10px;font-weight:bold;text-anchor:middle;font-family:Arial"><tspan x="7" y="11">err</tspan></text></svg>';
$svg_twitter='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><path d="m 11.679889,7.6290431 a 4.1668792,3.7091539 0 1 1 -8.3337586,0 4.1668792,3.7091539 0 1 1 8.3337586,0 z" style="fill:none;stroke:#3aaae1;stroke-width:4;stroke-miterlimit:4" /></svg>'; $svg_twitter='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><path d="m 11.679889,7.6290431 a 4.1668792,3.7091539 0 1 1 -8.3337586,0 4.1668792,3.7091539 0 1 1 8.3337586,0 z" style="fill:none;stroke:#3aaae1;stroke-width:4;stroke-miterlimit:4" /></svg>';
$svg_identica='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><path d="m 11.679889,7.6290431 a 4.1668792,3.7091539 0 1 1 -8.3337586,0 4.1668792,3.7091539 0 1 1 8.3337586,0 z" style="fill:none;stroke:#a00000;stroke-width:4;stroke-miterlimit:4" /></svg>'; $svg_identica='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><path d="m 11.679889,7.6290431 a 4.1668792,3.7091539 0 1 1 -8.3337586,0 4.1668792,3.7091539 0 1 1 8.3337586,0 z" style="fill:none;stroke:#a00000;stroke-width:4;stroke-miterlimit:4" /></svg>';
$svg_statusnet='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><path d="m 11.679889,7.6290431 a 4.1668792,3.7091539 0 1 1 -8.3337586,0 4.1668792,3.7091539 0 1 1 8.3337586,0 z" style="fill:none;stroke:#ff6a00;stroke-width:4;stroke-miterlimit:4" /></svg>'; $svg_statusnet='<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="15" height="15"><path d="m 11.679889,7.6290431 a 4.1668792,3.7091539 0 1 1 -8.3337586,0 4.1668792,3.7091539 0 1 1 8.3337586,0 z" style="fill:none;stroke:#ff6a00;stroke-width:4;stroke-miterlimit:4" /></svg>';
$errorlog="./".$_GET['check']."/error.log"; $errorlog="./".escape( $_GET['check'] ) ."/error.log";
if(file_exists($errorlog) && filemtime($errorlog) < $expire) { unlink($errorlog); } /* errorlog périmé ? Suppression. */ 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(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);} if(filesize($errorlog) == "0") {die($svg_vert);}
else if(filesize($errorlog) == "1") {die($svg_jaune);} else if(filesize($errorlog) == "1") {die($svg_jaune);}
else {die($svg_rouge);} else {die($svg_rouge);}
} }
else /* ..sinon, lancer la procédure de contrôle */ else /* ..sinon, lancer la procédure de contrôle */
{ {
$ini = parse_ini_file("./".$_GET['check']."/vvb.ini") or die; $ini = parse_ini_file("./". escape( $_GET['check'] ) ."/vvb.ini") or die;
header('Content-type: image/svg+xml');
if(strpos(strtolower($ini[SITE_TITLE]), 'twitter') !== FALSE) { die($svg_twitter); } /* Twitter */ 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_TITLE']), 'identica') !== FALSE) { die($svg_identica); } /* Identica */
if(strpos(strtolower($ini[SITE_TYPE]), 'microblog') !== FALSE) { die($svg_statusnet); } /* Statusnet */ if(strpos(strtolower($ini['SITE_TYPE']), 'microblog') !== FALSE) { die($svg_statusnet); } /* Statusnet */
$headers = get_headers("$ini[FEED_URL]");
$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 */ 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]); $code=explode(" ", $headers[0]);
if($code[1] == "200") { file_put_contents($errorlog, ''); die($svg_vert);} /* code retour 200: flux disponible */ 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é) */ 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 * Simple and Full Export
{ **/
header('Content-Type: application/json'); if (isset($_GET['export']) || isset($_GET['feedexport'])) {
$directory = "./"; header('Content-Type: application/json');
$subdirs = glob($directory . "*"); $directory = "./";
foreach($subdirs as $unit) $subdirs = glob($directory . "*");
{
if(is_dir($unit)) foreach($subdirs as $unit) {
{ if(is_dir($unit)) {
$unit=substr($unit, 2); $unit=substr($unit, 2);
$ini = parse_ini_file($unit.'/vvb.ini'); $ini = parse_ini_file($unit.'/vvb.ini');
$config = new stdClass; $config = new stdClass;
foreach ($ini as $key=>$value)
{ foreach ($ini as $key=>$value) {
$key = strtolower($key); $key = strtolower($key);
$config->$key = $value; $config->$key = $value;
} }
unset($ini); unset($ini);
$type=$config->site_type;
$title=$config->site_title; $feed=$config->feed_url;
$url=$config->site_url;
$feed=$config->feed_url; if( isset($_GET['export']) ) {
$reponse[$unit] = array("SITE_TYPE"=>"$type", "SITE_TITLE"=>"$title", "SITE_URL"=>"$url", "FEED_URL"=>"$feed"); $type=$config->site_type;
} $title=$config->site_title;
} $url=$config->site_url;
echo json_encode( array( "meta"=> array("xsaf-version"=>XSAF_VERSION,"xsaf-db_transfer"=>"true","xsaf-media_transfer"=>"true"), $reponse[$unit] = array("SITE_TYPE"=>"$type", "SITE_TITLE"=>"$title", "SITE_URL"=>"$url", "FEED_URL"=>"$feed");
}
// export feed only
else
$reponse=$reponse.";$feed";
}
}
if( isset($_GET['export']) )
echo json_encode( array( "meta"=> array("xsaf-version"=>XSAF_VERSION,"xsaf-db_transfer"=>"true","xsaf-media_transfer"=>"true"),
"autoblogs"=>$reponse)); "autoblogs"=>$reponse));
die; else
} echo json_encode(explode(';', substr($reponse, 1)));
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;
} }
/**
* Site map
**/
if (isset($_GET['sitemap'])) if (isset($_GET['sitemap']))
// url-list sitemap // url-list sitemap
{ {
header('Content-Type: text/plain'); header('Content-Type: text/plain');
$directory = "./"; $directory = "./";
$subdirs = glob($directory . "*"); $subdirs = glob($directory . "*");
foreach($subdirs as $unit)
{ foreach($subdirs as $unit) {
if(is_dir($unit)) if(is_dir($unit)) {
{
$unit=substr($unit, 2); $unit=substr($unit, 2);
$proto=$_SERVER['HTTPS']?"https://":"http://"; $proto=$_SERVER['HTTPS']?"https://":"http://";
echo $proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."\n"; echo $proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."\n";
} }
} }
die; die;
} }
function escape($str) /**
{ * Update ALL autblogs (except .disabled)
return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); * 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 = '<form method="POST"><input placeholder="Adresse du flux RSS/ATOM" type="text" name="rssurl" id="rssurl"><br> $form = '<form method="POST"><input type="hidden" name="generic" value="1" />
<input placeholder="Antibot: \'dix sept\' en chiffre" type="text" name="number" id="number"><br><input type="submit" value="Vérifier"></form>'; <input placeholder="Adresse du flux RSS/ATOM" type="text" name="rssurl" id="rssurl"><br>
<input placeholder="Antibot: \'dix-sept\' en chiffre" type="text" name="number" id="number"><br>
<input type="submit" value="Vérifier">
</form>';
if(!empty($_GET['via_button']) && !empty($_GET['rssurl']) && $_GET['number'] === '17' && $allow_new_autoblogs == TRUE) /**
* ADD BY BOOKMARK BUTTON
**/
if(!empty($_GET['via_button']) && !empty($_GET['rssurl']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_BUTTON )
{ {
if(isset($_GET['add']) && $_GET['add'] === '1' && !empty($_GET['siteurl']) && !empty($_GET['sitename'])) if(isset($_GET['add']) && $_GET['add'] === '1' && !empty($_GET['siteurl']) && !empty($_GET['sitename'])) {
{
$rssurl = DetectRedirect(escape($_GET['rssurl'])); $rssurl = DetectRedirect(escape($_GET['rssurl']));
$siteurl = escape($_GET['siteurl']); $siteurl = escape($_GET['siteurl']);
$sitetype = 'generic'; $sitename = escape($_GET['sitename']);
$foldername = sha1(NoProtocolSiteURL($siteurl));
if(substr($siteurl, -1) == '/'){ $foldername2 = sha1(NoProtocolSiteURL(substr($siteurl, 0, -1))); }else{ $foldername2 = sha1(NoProtocolSiteURL($siteurl).'/');} $error = createAutoblog($sitetype, $sitename, $siteurl, $rssurl, $error);
$sitename = escape($_GET['sitename']); if( empty($error))
if(file_exists($foldername) || file_exists($foldername2)) { die('Erreur: l\'autoblog <a target="_blank" href="./'.$foldername.'/">existe déjà</a>.'); } $success[] = '<iframe width="1" height="1" frameborder="0" src="'. $foldername .'/index.php"></iframe><b style="color:darkgreen">AutoMicroblog <a href="'.$foldername.'">ajouté avec succès</a>.</b>';
if ( mkdir('./'. $foldername, 0755, false) ) {
$fp = fopen('./'. $foldername .'/index.php', 'w+');
if( !fwrite($fp, "<?php require_once dirname(__DIR__) . '/autoblog.php'; ?>") )
{die("Impossible d'écrire le fichier index.php");}
fclose($fp);
$fp = fopen('./'. $foldername .'/vvb.ini', 'w+');
if( !fwrite($fp, '[VroumVroumBlogConfig]
SITE_TYPE="'. $sitetype .'"
SITE_TITLE="'. $sitename .'"
SITE_DESCRIPTION="source: <a href=\''. $siteurl .'\'>'. $sitename .'</a>"
SITE_URL="'. $siteurl .'"
FEED_URL="'. $rssurl .'"
ARTICLES_PER_PAGE="5"
UPDATE_INTERVAL="3600"
UPDATE_TIMEOUT="30"') )
{die("Impossible d'écrire le fichier vvb.ini");}
fclose($fp);
{die('<iframe width="1" height="1" frameborder="0" src="'.$foldername.'"></iframe><b style="color:darkgreen">autoblog crée avec succès.</b> &rarr; <a target="_blank" href="'.$foldername.'">afficher l\'autoblog</a>');}
} }
else else {
{die("Impossible de créer le répertoire.");} $rssurl = DetectRedirect(escape($_GET['rssurl']));
$datafeed = file_get_contents($rssurl);
} $siteurl = get_link_from_datafeed($datafeed);
else $sitename = get_title_from_datafeed($datafeed);
{
// checking procedure
$sitetype = $_GET['sitetype'];
$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 <a href="./'.$foldername.'/">existe déjà</a>.'); }
$form = '<html><head></head><body><span style="color:blue">Merci de vérifier les informations suivantes, corrigez si nécessaire.</span><br> $form = '<html><head></head><body><span style="color:blue">Merci de vérifier les informations suivantes, corrigez si nécessaire.</span><br>
<form method="GET"> <form method="GET">
<input type="hidden" name="via_button" value="1"><input type="hidden" name="add" value="1"><input type="hidden" name="number" value="17"> <input type="hidden" name="via_button" value="1"><input type="hidden" name="add" value="1"><input type="hidden" name="number" value="17">
@ -267,122 +256,132 @@ else
echo $form; die; echo $form; die;
} }
} }
$error = array();
$infos = array();
if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && $allow_new_autoblogs == TRUE)
{
$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'; }
if(escape($_POST['socialinstance']) === 'shaarli') { $socialinstance = 'shaarli'; }
if($socialinstance === 'twitter') { $sitetype = 'microblog'; $update_interval='300'; $siteurl = "http://twitter.com/$socialaccount"; $rssurl = "http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=$socialaccount"; }
if($socialinstance === 'identica') { $sitetype = 'microblog'; $update_interval='300'; $siteurl = "http://identi.ca/$socialaccount"; $rssurl = "http://identi.ca/api/statuses/user_timeline/$socialaccount.rss"; }
if($socialinstance === 'statusnet' && !empty($_POST['statusneturl'])) { $sitetype = 'microblog'; $update_interval='300'; $siteurl=NoProtocolSiteURL(escape($_POST['statusneturl'])); if(substr($siteurl, -1) == '/'){ $siteurl = substr($siteurl, 0, -1); } $rssurl = DetectRedirect("http://".$siteurl."/api/statuses/user_timeline/$socialaccount.rss"); $siteurl = DetectRedirect("http://".$siteurl."/$socialaccount"); }
if($socialinstance === 'shaarli' && !empty($_POST['shaarliurl'])) { $sitetype = 'shaarli'; $update_interval='1800'; $siteurl = NoProtocolSiteURL(escape($_POST['shaarliurl'])); if(substr($siteurl, -1) == '/'){ $siteurl = substr($siteurl, 0, -1); } $siteurl = DetectRedirect("http://".$siteurl."/"); $rssurl = $siteurl."?do=rss";$socialaccount = get_title_from_feed($rssurl); }
$foldername = sha1(NoProtocolSiteURL($siteurl));if(file_exists($foldername)) { die('Erreur: l\'autoblog <a href="./'.$foldername.'/">existe déjà</a>.'); }
$rssurl=DetectRedirect($rssurl); $headers = get_headers($rssurl, 1);
if (strpos($headers[0], '200') == FALSE) {$error[] = "Flux inaccessible (compte inexistant ?)";} else { }
if( empty($error) ) {
if( !preg_match('#\.\.|/#', $foldername) ) {
if ( mkdir('./'. $foldername, 0755, false) ) {
$fp = fopen('./'. $foldername .'/index.php', 'w+');
if( !fwrite($fp, "<?php require_once dirname(__DIR__).'/autoblog.php'; ?>") )
$error[] = "Impossible d'écrire le fichier index.php";
fclose($fp);
$fp = fopen('./'. $foldername .'/vvb.ini', 'w+');
if( !fwrite($fp, '[VroumVroumBlogConfig]
SITE_TYPE="'.$sitetype.'"
SITE_TITLE="'.$socialinstance.'-'.$socialaccount.'"
SITE_DESCRIPTION="source: <a href=\''. $siteurl .'\'>'. $socialaccount .'</a>"
SITE_URL="'. $siteurl .'"
FEED_URL="'. $rssurl .'"
ARTICLES_PER_PAGE="20"
UPDATE_INTERVAL="'.$update_interval.'"
UPDATE_TIMEOUT="30"') )
$error[] = "Impossible d'écrire le fichier vvb.ini";
fclose($fp);
$infos[] = '<iframe width="1" height="1" frameborder="0" src="'.$foldername.'"></iframe><b style="color:darkgreen">AutoMicroblog <a href="'.$foldername.'">ajouté avec succès</a>.</b>';
}
else
$error[] = "Impossible de créer le répertoire.";
}
else
$error[] = "Nom de site invalide.";
}
/**
* 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[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolder( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">AutoMicroblog <a href="'.$foldername.'">ajouté avec succès</a>.</b>';
}
} }
if( !empty($_POST) && empty($_POST['socialinstance']) && $allow_new_autoblogs == TRUE) { /**
* ADD BY GENERIC LINK
**/
if( !empty($_POST['generic']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_LINK) {
if(empty($_POST['rssurl'])) if(empty($_POST['rssurl']))
{$error[] = "Veuillez entrer l'adresse du flux.";} {$error[] = "Veuillez entrer l'adresse du flux.";}
if(empty($_POST['number'])) if(empty($_POST['number']))
{$error[] = "Le chiffre. Écrivez le chiffre.";} {$error[] = "Vous êtes un bot ?";}
if($_POST['number'] !== '17') if($_POST['number'] !== '17')
{$error[] = "C'est pas le bon chiffre.";} {$error[] = "C'est pas le bon nombre.";}
if(empty($error)) if(empty($error)) {
{
$rssurl = DetectRedirect(escape($_POST['rssurl'])); $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 <a href="./'.$foldername.'/">existe déjà</a>.'); }
if ( mkdir('./'. $foldername, 0755, false) ) {
$fp = fopen('./'. $foldername .'/index.php', 'w+');
if( !fwrite($fp, "<?php require_once dirname(__DIR__) . '/autoblog.php'; ?>") )
$error[] = "Impossible d'écrire le fichier index.php";
fclose($fp);
$fp = fopen('./'. $foldername .'/vvb.ini', 'w+');
if( !fwrite($fp, '[VroumVroumBlogConfig]
SITE_TYPE="generic"
SITE_TITLE="'. $sitename .'"
SITE_DESCRIPTION="source: <a href=\''. $siteurl .'\'>'. $sitename .'</a>"
SITE_URL="'. $siteurl .'"
FEED_URL="'. $rssurl .'"
ARTICLES_PER_PAGE="5"
UPDATE_INTERVAL="3600"
UPDATE_TIMEOUT="30"') )
$error[] = "Impossible d'écrire le fichier vvb.ini";
fclose($fp);
$infos[] = '<iframe width="1" height="1" frameborder="0" src="'.$foldername.'"></iframe><b style="color:darkgreen">autoblog crée avec succès.</b> &rarr; <a target="_blank" href="'.$foldername.'">afficher l\'autoblog</a>';
}
else
$error[] = "Impossible de créer le répertoire.";
if(!empty($_POST['siteurl'])) {
} $siteurl = escape($_POST['siteurl']);
else
{
// checking procedure
$rssurl = DetectRedirect($rssurl);
$sitetype = 'generic';
$siteurl = get_link_from_feed($rssurl);
$foldername = sha1(NoProtocolSiteURL($siteurl));
$sitename = get_title_from_feed($rssurl); $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 <a href="./'.$foldername.'/">existe déjà</a>.'); }
$form = '<span style="color:blue">Merci de vérifier les informations suivantes, corrigez si nécessaire.</span><br>
<form method="POST"><input style="color:black" type="text" id="sitename" value="'.$sitename.'" disabled><label for="sitename">&larr; titre du site (auto)</label><br>
<input placeholder="Adresse du site" type="text" name="siteurl" id="siteurl" value="'.$siteurl.'"><label for="siteurl">&larr; page d\'accueil (auto)</label><br>
<input placeholder="Adresse du flux RSS/ATOM" type="text" name="rssurl" id="rssurl" value="'.$rssurl.'"><label for="rssurl">&larr; adresse du flux</label><br>
<input placeholder=""Type de site" type="text" name="sitetype" id="sitetype" value="'.$sitetype.'" disabled><label for="sitetype">&larr; type de site</label><br>
<input placeholder="Antibot: \'dix sept\' en chiffre" type="text" name="number" id="number" value="17"><label for="number">&larr; antibot</label><br><input type="submit" value="Créer"></form>';
}
} $error = createAutoblog('generic', $sitename, $siteurl, $rssurl, $error);
if( empty($error))
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolder( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">autoblog crée avec succès.</b> &rarr; <a target="_blank" href="'. urlToFolder( $siteurl ) .'">afficher l\'autoblog</a>';
}
else {
// checking procedure
$rssurl = DetectRedirect($rssurl);
$datafeed = file_get_contents($rssurl);
$sitetype = 'generic';
$siteurl = get_link_from_datafeed($datafeed);
$foldername = urlToFolder($siteurl);
$sitename = get_title_from_datafeed($datafeed);
if(file_exists($foldername)) {
$error[] = 'Erreur: l\'autoblog <a href="./'.$foldername.'/">existe déjà</a>.';
}
else {
$form = '<span style="color:blue">Merci de vérifier les informations suivantes, corrigez si nécessaire.</span><br>
<form method="POST"><input type="hidden" name="generic" value="1" />
<input style="color:black" type="text" id="sitename" value="'.$sitename.'" disabled><label for="sitename">&larr; titre du site (auto)</label><br>
<input placeholder="Adresse du site" type="text" name="siteurl" id="siteurl" value="'.$siteurl.'"><label for="siteurl">&larr; page d\'accueil (auto)</label><br>
<input placeholder="Adresse du flux RSS/ATOM" type="text" name="rssurl" id="rssurl" value="'.$rssurl.'"><label for="rssurl">&larr; adresse du flux</label><br>
<input placeholder=""Type de site" type="text" name="sitetype" id="sitetype" value="'.$sitetype.'" disabled><label for="sitetype">&larr; type de site</label><br>
<input placeholder="Antibot: \'dix sept\' en chiffre" type="text" name="number" id="number" value="17"><label for="number">&larr; antibot</label><br><input type="submit" value="Créer"></form>';
}
}
}
} }
/**
* 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[] = '<iframe width="1" height="1" frameborder="0" src="'. urlToFolder( $siteurl ) .'/index.php"></iframe>Autoblog "'. $sitename .'" crée avec succès. &rarr; <a target="_blank" href="'. urlToFolder( $siteurl ) .'">afficher l\'autoblog</a>.';
}
}
}
else
$error[] = "Impossible de lire le contenu du fichier OPML.";
unlink($_FILES['file']['tmp_name']);
} else {
$error[] = "Le fichier n'a pas été envoyé.";
}
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" dir="ltr"> <html lang="en" dir="ltr">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Le Projet Autoblog</title> <title>Projet Autoblog | <?php echo $head_title; ?></title>
<style type="text/css"> <style type="text/css">
body {background-color:#efefef;text-align:center;color:#333;font-family:sans-serif} body {background-color:#efefef;text-align:center;color:#333;font-family:sans-serif}
a {color:black;text-decoration:none;font-weight:bold;} a {color:black;text-decoration:none;font-weight:bold;}
@ -404,96 +403,165 @@ UPDATE_TIMEOUT="30"') )
.clear {clear:both;text-align:right;font-size:small;} .clear {clear:both;text-align:right;font-size:small;}
#logo {float: right;} #logo {float: right;}
.bouton{background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;border: 1px none;padding: 10px;border: 1px solid #7777777;border-radius: 8px 8px 8px 8px;box-shadow: 0 1px 0 0 #FFFFFF inset;display: inline-block;} .bouton{background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;border: 1px none;padding: 10px;border: 1px solid #7777777;border-radius: 8px 8px 8px 8px;box-shadow: 0 1px 0 0 #FFFFFF inset;display: inline-block;}
.success {color: green;}
.error {color: red;}
</style> </style>
</head> </head>
<body> <body>
<h1>LE PROJET AUTOBLOG</h1> <h1>PROJET AUTOBLOG | <?php echo $head_title; ?></h1>
<div class="pbloc"> <div class="pbloc">
<img id="logo" src="<?php if(isset($logo)) { echo $logo; }else{ echo './icon-logo.svg'; } ?>" alt=""> <img id="logo" src="<?php if(isset($logo)) { echo $logo; }else{ echo './icon-logo.svg'; } ?>" alt="">
<b>Note</b><br>
Voici une liste d'autoblogs hébergés sur <i><?php echo $_SERVER['SERVER_NAME']; ?></i> (<a href="http://sebsauvage.net/streisand.me/fr/">plus d'infos sur le projet</a>).<br><br> <h2>Présentation</h2>
<b>Autres fermes</b><br>
&rarr; <a href="https://duckduckgo.com/?q=!g%20%22Voici%20une%20liste%20d'autoblogs%20hébergés%22">Rechercher</a><br><br> <p>
<?php if($allow_new_autoblogs == TRUE) { ?> La Projet Autoblog a pour objectif de répliquer les articles d'un blog ou d'un site site web.
<div class="form"><b>Ajouter un compte social</b><br><br> Si l'article source est supprimé, et même si le site d'origine disparaît, les articles restent lisibles sur l'autoblog.
<form method="POST"> L'objectif premier de ce projet est de lutter contre la censure et toute sorte de pression...
<input class="text" placeholder="identifiant compte" type="text" name="socialaccount" id="socialaccount"><br> </p>
<input type="radio" name="socialinstance" value="twitter">Twitter<br> <p>
<input type="radio" name="socialinstance" value="identica">Identica<br> Voici une liste d'autoblogs hébergés sur <i><?php echo $_SERVER['SERVER_NAME']; ?></i>
<input type="radio" name="socialinstance" value="statusnet"><input placeholder="statusnet.personnel.com" type="text" name="statusneturl" id="statusneturl"><br> (<a href="http://sebsauvage.net/streisand.me/fr/">plus d'infos sur le projet</a>).
<input id="socialsub" type="submit" value="Créer"> </p>
</form></div><br> </div>
<div class="form"><b>Ajouter un Shaarli</b><br><br>
<form method="POST"> <?php if(ALLOW_NEW_AUTOBLOGS == TRUE) { ?>
<input class="text" placeholder="identifiant compte" type="hidden" name="socialaccount" id="socialaccount" value="shaarli"> <div class="pbloc">
<input type="hidden" name="socialinstance" value="shaarli"><input placeholder="shaarli.personnel.com" type="text" name="shaarliurl" id="shaarliurl"><br>
<input id="socialsub" type="submit" value="Créer"> <h2>Ajouter un autoblog</h2>
</form></div><br>
<div class="form"><b>Ajouter un site web</b><br> <?php
<?php if( !empty( $error ) || !empty( $success )) {
if( !empty( $error )) { echo '<p>Message'. (count($error) ? 's' : '') .' :</p><ul>';
echo '<p>Erreur(s) :</p><ul>'; foreach ( $error AS $value ) {
foreach ( $error AS $value ) { echo '<li class="error">'. $value .'</li>';
echo '<li>'. $value .'</li>'; }
} foreach ( $success AS $value ) {
echo '</ul>'; echo '<li class="success">'. $value .'</li>';
} }
if( !empty( $infos )) { echo '</ul>';
echo '<p>Info(s) :</p><ul>'; }
foreach ( $infos AS $value ) { ?>
echo '<li>'. $value .'</li>';
} <?php if(ALLOW_NEW_AUTOBLOGS_BY_LINKS == TRUE) { ?>
echo '</ul>'; <div class="form">
} <h3>Ajouter un site web</h3>
?> <p>
Si vous souhaitez que <i><?php echo $_SERVER['SERVER_NAME']; ?></i> héberge un autoblog d'un site,<br/>remplissez le formulaire suivant:<br><br> Si vous souhaitez que <i><?php echo $_SERVER['SERVER_NAME']; ?></i> héberge un autoblog d'un site,<br>
<?php echo $form; ?> remplissez le formulaire suivant:
</div><br>Pour ajouter facillement un autoblog d'un site web, glissez ce bouton dans votre barre de marque-pages =&gt; <a class="bouton" onclick="alert('Glissez ce bouton dans votre barre de marque-pages (ou clic-droit > marque-page sur ce lien)');return false;" href="javascript:(function(){var%20autoblog_url=&quot;<?php echo serverUrl().$_SERVER["REQUEST_URI"]; ?>&quot;;var%20popup=window.open(&quot;&quot;,&quot;Add%20autoblog&quot;,'height=180,width=670');popup.document.writeln('<html><head></head><body><form%20action=&quot;'+autoblog_url+'&quot;%20method=&quot;GET&quot;>');popup.document.write('Url%20feed%20%20:%20<br/>');var%20feed_links=new%20Array();var%20links=document.getElementsByTagName('link');if(links.length>0){for(var%20i=0;i<links.length;i++){if(links[i].rel==&quot;alternate&quot;){popup.document.writeln('<label%20for=&quot;feed_'+i+'&quot;><input%20id=&quot;feed_'+i+'&quot;%20type=&quot;radio&quot;%20name=&quot;rssurl&quot;%20value=&quot;'+links[i].href+'&quot;/>'+links[i].title+&quot;%20(%20&quot;+links[i].href+&quot;%20)</label><br/>&quot;);}}}popup.document.writeln(&quot;<input%20id='number'%20type='hidden'%20name='number'%20value='17'>&quot;);popup.document.writeln(&quot;<input%20type='hidden'%20name='via_button'%20value='1'>&quot;);popup.document.writeln(&quot;<br/><input%20type='submit'%20value='Vérifier'%20name='Ajouter'%20>&quot;);popup.document.writeln(&quot;</form></body></html>&quot;);})();">Projet Autoblog</a> </p>
<?php } ?>
<br></div> <?php echo $form; ?>
<div class="pbloc"> </div>
<h2>Autoblogs hébergés</h2> <?php }
<div class="clear"><a href="?export">export<sup> JSON</sup></a></div>
<?php if(ALLOW_NEW_AUTOBLOGS_BY_SOCIAL == TRUE) { ?>
$directory = "./"; <div class="form">
$subdirs = glob($directory . "*"); <h3>Ajouter un compte social</h3>
$autoblogs = array();
foreach($subdirs as $unit) <form method="POST">
{ <input class="text" placeholder="Identifiant du compte" type="text" name="socialaccount" id="socialaccount"><br>
if(is_dir($unit)) <input type="radio" name="socialinstance" value="twitter">Twitter<br>
{ <input type="radio" name="socialinstance" value="identica">Identica<br>
$ini = parse_ini_file(ROOT_DIR . '/' . $unit . '/vvb.ini'); <input type="radio" name="socialinstance" value="statusnet">
if($ini) <input placeholder="statusnet.personnel.com" type="text" name="statusneturl" id="statusneturl"><br>
{
$config = new stdClass; <input id="socialsub" type="submit" value="Créer">
$unit=substr($unit, 2); </form>
foreach ($ini as $key=>$value) </div>
{
$key = strtolower($key); <div class="form">
$config->$key = $value; <h3>Ajouter un Shaarli</h3>
}
$autoblogs[$unit] = ' <form method="POST">
<div class="vignette"> <input class="text" placeholder="identifiant compte" type="hidden" name="socialaccount" id="socialaccount" value="shaarli">
<div class="title"><a title="'.escape($config->site_title).'" href="'.$unit.'/"><img width="15" height="15" alt="" src="./?check='.$unit.'"> '.escape($config->site_title).'</a></div> <input type="hidden" name="socialinstance" value="shaarli"><input placeholder="shaarli.personnel.com" type="text" name="shaarliurl" id="shaarliurl"><br>
<div class="source"><a href="'.$unit.'/vvb.ini">config</a> | '.escape($config->site_type).' source: <a href="'.escape($config->site_url).'">'.escape($config->site_url).'</a></div> <input id="socialsub" type="submit" value="Créer">
</div>'; </form>
unset($ini); </div>
} <?php }
}
} if(ALLOW_NEW_AUTOBLOGS_BY_OPML == TRUE) { ?>
if(!empty($autoblogs)){ <div class="form">
sort($autoblogs, SORT_STRING); <h3>Ajout par fichier OPML</h3>
foreach ($autoblogs as $autoblog) {
echo $autoblog; <form enctype='multipart/form-data' method='POST'>
} <input type='hidden' name='opml' value='1' />
} <input type='file' name='file' /><br>
?> <input type='submit' value='Importer' />
<div class="clear"></div> </form>
<?php echo "<br/>".count($autoblogs)." autoblogs hébergés"; ?> </div>
</div>
Propulsé par <a href="https://github.com/mitsukarenai/Projet-Autoblog">Projet Autoblog 0.3</a> de Mitsu et Oros (Domaine Public) <?php }
<?php if(isset($HTML_footer)){ echo "<br/>".$HTML_footer; } ?>
<iframe width="1" height="1" style="display:none" src="xsaf3.php"></iframe> if(ALLOW_NEW_AUTOBLOGS_BY_BUTTON == TRUE) { ?>
</body> <h3>Marque page</h3>
</html> <p>Pour ajouter facilement un autoblog d'un site web, glissez ce bouton dans votre barre de marque-pages &rarr;
<a class="bouton" onclick="alert('Glissez ce bouton dans votre barre de marque-pages (ou clic-droit > marque-page sur ce lien)');return false;"
href="javascript:(function(){var%20autoblog_url=&quot;<?php echo serverUrl().$_SERVER["REQUEST_URI"]; ?>&quot;;var%20popup=window.open(&quot;&quot;,&quot;Add%20autoblog&quot;,'height=180,width=670');popup.document.writeln('<html><head></head><body><form%20action=&quot;'+autoblog_url+'&quot;%20method=&quot;GET&quot;>');popup.document.write('Url%20feed%20%20:%20<br/>');var%20feed_links=new%20Array();var%20links=document.getElementsByTagName('link');if(links.length>0){for(var%20i=0;i<links.length;i++){if(links[i].rel==&quot;alternate&quot;){popup.document.writeln('<label%20for=&quot;feed_'+i+'&quot;><input%20id=&quot;feed_'+i+'&quot;%20type=&quot;radio&quot;%20name=&quot;rssurl&quot;%20value=&quot;'+links[i].href+'&quot;/>'+links[i].title+&quot;%20(%20&quot;+links[i].href+&quot;%20)</label><br/>&quot;);}}}popup.document.writeln(&quot;<input%20id='number'%20type='hidden'%20name='number'%20value='17'>&quot;);popup.document.writeln(&quot;<input%20type='hidden'%20name='via_button'%20value='1'>&quot;);popup.document.writeln(&quot;<br/><input%20type='submit'%20value='Vérifier'%20name='Ajouter'%20>&quot;);popup.document.writeln(&quot;</form></body></html>&quot;);})();">
Projet Autoblog
</a>
<?php } ?>
</div>
<?php } ?>
<div class="pbloc">
<h2>Autoblogs hébergés</h2>
<p>
<b>Autres fermes</b>
&rarr; <a href="https://duckduckgo.com/?q=!g%20%22Voici%20une%20liste%20d'autoblogs%20hébergés%22">Rechercher</a>
</p>
<div class="clear"><a href="?export">export<sup> JSON</sup></a></div>
<?php
$directory = "./";
$subdirs = glob($directory . "*");
$autoblogs = array();
foreach($subdirs as $unit)
{
if(is_dir($unit))
{
if( !file_exists(ROOT_DIR . '/' . $unit . '/.disabled')) {
$ini = parse_ini_file(ROOT_DIR . '/' . $unit . '/vvb.ini');
if($ini)
{
$config = new stdClass;
$unit=substr($unit, 2);
foreach ($ini as $key=>$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 .= '<div class="vignette">
<div class="title"><a title="'.escape($autoblog->site_title).'" href="'.$key.'/"><img width="15" height="15" alt="" src="./?check='.$key.'"> '.escape($autoblog->site_title).'</a></div>
<div class="source"><a href="'.$key.'/vvb.ini">config</a> | '.escape($autoblog->site_type).' source: <a href="'.escape($autoblog->site_url).'">'.escape($autoblog->site_url).'</a></div>
</div>';
}
}
echo $autoblogs_display;
?>
<div class="clear"></div>
<?php echo "<p>".count($autoblogs)." autoblogs hébergés</p>"; ?>
</div>
Propulsé par <a href="https://github.com/mitsukarenai/Projet-Autoblog">Projet Autoblog 0.3</a> de <a href="https://www.suumitsu.eu/">Mitsu</a>, <a href="https://www.ecirtam.net/">Oros</a> et <a href="http://aryo.fr">Arthur Hoaro</a> (Domaine Public)
<?php if(isset($HTML_footer)){ echo "<br/>".$HTML_footer; } ?>
<iframe width="1" height="1" style="display:none" src="xsaf3.php"></iframe>
</body>
</html>

View file

@ -3,33 +3,35 @@
define('DEBUG', true); define('DEBUG', true);
define('XSAF_VERSION', 3); define('XSAF_VERSION', 3);
define('AUTOBLOG_FILE_NAME', 'autoblog.php'); define('AUTOBLOG_FILE_NAME', 'autoblog.php');
define('ALLOW_REMOTE_DB_DL', false);
define('ALLOW_REMOTE_MEDIA_DL', false);
define('EXEC_TIME', 5);
define( 'ALLOW_XSAF', TRUE );
header("HTTP/1.0 403 Forbidden"); /* Uncivilized method to prevent bot indexing, huh :) */ header("HTTP/1.0 403 Forbidden"); /* Uncivilized method to prevent bot indexing, huh :) */
header('X-Robots-Tag: noindex'); /* more civilized method, but bots may not all take into account */ header('X-Robots-Tag: noindex'); /* more civilized method, but bots may not all take into account */
header('Content-type: text/plain'); //header('Content-type: text/plain');
$expire = time() -7200 ; $lockfile = ".xsaflock"; /* defaut delay: 7200 (2 hours) */
if (file_exists($lockfile)) { $expire = time() -7200 ;
if (filemtime($lockfile) > $expire) { $lockfile = ".xsaflock"; /* defaut delay: 7200 (2 hours) */
if (file_exists($lockfile) && filemtime($lockfile) > $expire) {
echo "too early"; echo "too early";
die; die;
}else{ }
unlink($lockfile); else {
if( file_put_contents($lockfile, '') ===FALSE) { if( file_exists($lockfile) )
echo "Merci d'ajouter des droits d'écriture sur le dossier."; unlink($lockfile);
die;
} if( file_put_contents($lockfile, date(DATE_RFC822)) ===FALSE) {
} echo "Merci d'ajouter des droits d'écriture sur le dossier.";
}else{
if( file_put_contents($lockfile, '') ===FALSE) {
echo "Merci d'ajouter des droits d'écriture sur le dossier.";
die; die;
} }
} }
define('ROOT_DIR', __DIR__); define('ROOT_DIR', __DIR__);
function escape($str) { if(file_exists("functions.php")){
return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); include "functions.php";
} }
function serverUrl() { function serverUrl() {
@ -38,18 +40,16 @@ function serverUrl() {
return 'http'.($https?'s':'').'://'.$_SERVER["SERVER_NAME"].$serverport; return 'http'.($https?'s':'').'://'.$_SERVER["SERVER_NAME"].$serverport;
} }
function NoProtocolSiteURL($url) {
$siteurlnoprototypes = array("http://", "https://");
$siteurlnoproto = str_replace($siteurlnoprototypes, "", $url);
return $siteurlnoproto;
}
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
// $max_exec_time = temps max d'exécution en seconde // $max_exec_time = temps max d'exécution en seconde
function xsafimport($xsafremote, $max_exec_time) { function xsafimport($xsafremote, $max_exec_time) {
echo "\n*Traitement $xsafremote en maximum $max_exec_time secondes"; if( DEBUG )
echo "\n*Traitement $xsafremote en maximum $max_exec_time secondes";
$max_exec_time+=time()-1; // -1 car l'import prend environ 1 seconde $max_exec_time+=time()-1; // -1 car l'import prend environ 1 seconde
/* détection de ferme autoblog */
/* détection de ferme autoblog */
$json_import = file_get_contents($xsafremote); $json_import = file_get_contents($xsafremote);
if(!empty($json_import)) { if(!empty($json_import)) {
$to_update=array(); $to_update=array();
@ -61,143 +61,127 @@ function xsafimport($xsafremote, $max_exec_time) {
} }
return false; return false;
} }
if($json_import['meta']['xsaf-db_transfer'] != "true") {$get_remote_db="0";} else {$get_remote_db="1";}
if($json_import['meta']['xsaf-media_transfer'] != "true") {$get_remote_media="0";} else {$get_remote_media="1";} $get_remote_db = ($json_import['meta']['xsaf-db_transfer'] == "true") ? true : false;
$get_remote_media = ($json_import['meta']['xsaf-media_transfer'] == "true") ? true : false;
if(!empty($json_import['autoblogs'])) { if(!empty($json_import['autoblogs'])) {
foreach ($json_import['autoblogs'] as $value) { foreach ($json_import['autoblogs'] as $value) {
$infos="";
if(count($value)==4 && !empty($value['SITE_TYPE']) && !empty($value['SITE_TITLE']) && !empty($value['SITE_URL']) && !empty($value['FEED_URL'])) { if(count($value)==4 && !empty($value['SITE_TYPE']) && !empty($value['SITE_TITLE']) && !empty($value['SITE_URL']) && !empty($value['FEED_URL'])) {
$sitetype = $value['SITE_TYPE']; $sitetype = escape($value['SITE_TYPE']);
$sitename = $value['SITE_TITLE']; $sitename = escape($value['SITE_TITLE']);
$siteurl = escape($value['SITE_URL']); $siteurl = escape($value['SITE_URL']);
// Do not use DetectRedirect because it's slow and it has been used when the feed was added
//$rssurl = DetectRedirect(escape($value['FEED_URL']));
$rssurl = escape($value['FEED_URL']); $rssurl = escape($value['FEED_URL']);
if($sitetype == 'shaarli') { $articles_per_page = "20"; $update_interval = "1800"; $update_timeout = "30"; }
else if($sitetype == 'microblog') { $articles_per_page = "20"; $update_interval = "300"; $update_timeout = "30"; }
else { $articles_per_page = "5"; $update_interval = "3600"; $update_timeout = "30"; }
// $foldername = $sitename;$foldername2 = $sitename; if($sitetype == 'shaarli') {
$foldername = sha1(NoProtocolSiteURL($siteurl)); $articles_per_page = "20";
if(substr($siteurl, -1) == '/'){ $foldername2 = sha1(NoProtocolSiteURL(substr($siteurl, 0, -1))); }else{ $foldername2 = sha1(NoProtocolSiteURL($siteurl).'/');} $update_interval = "1800";
$update_timeout = "30";
if(!file_exists($foldername) && !file_exists($foldername2)) {
if ( mkdir('./'. $foldername, 0755, false) ) {
$fp = fopen('./'. $foldername .'/index.php', 'w+');
$response = get_headers($rssurl, 1); // check for redirections
if(!empty($response['Location'])) {
$result="false";
}else{
$xml = simplexml_load_file($rssurl); // quick feed check
if($xml === FALSE){
$result="false";
}elseif (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";
}
}
/* autoblog */
if($result!=="false") {
if( !fwrite($fp, "<?php require_once dirname(__DIR__) . '/".AUTOBLOG_FILE_NAME."'; ?>") ) {
$infos = "\nImpossible d'écrire le fichier index.php dans ".$foldername;
fclose($fp);
}else{
fclose($fp);
$fp = fopen('./'. $foldername .'/vvb.ini', 'w+');
if( !fwrite($fp, <<<EOF
[VroumVroumBlogConfig]
SITE_TYPE="$sitetype"
SITE_TITLE="$sitename"
SITE_DESCRIPTION="source: <a href='$siteurl'>$sitename</a>"
SITE_URL="$siteurl"
FEED_URL="$rssurl"
ARTICLES_PER_PAGE="$articles_per_page"
UPDATE_INTERVAL="$update_interval"
UPDATE_TIMEOUT="$update_timeout"
EOF
) ){
fclose($fp);
$infos = "\nImpossible d'écrire le fichier vvb.ini dans ".$foldername;
}else{
fclose($fp);
/* ============================================================================================================================================================================== */
/* récupération de la DB distante */
if($get_remote_db == "1") { $remote_db=str_replace("?export", $foldername."/articles.db", $xsafremote); copy($remote_db, './'. $foldername .'/articles.db'); }
if($get_remote_media == "1")
{
$remote_media=str_replace("?export", $foldername."/?media", $xsafremote);
$json_media_import = file_get_contents($remote_media);
if(!empty($json_media_import))
{
mkdir('./'.$foldername.'/media/');
$json_media_import = json_decode($json_media_import, true);
$media_path=$json_media_import['url'];
if(!empty($json_media_import['files']))
{
foreach ($json_media_import['files'] as $value)
{
copy($media_path.$value, './'.$foldername.'/media/'.$value);
} }
else if( $sitetype == 'microblog' ) {
$articles_per_page = "20";
$update_interval = "300";
$update_timeout = "30";
}
else {
$articles_per_page = "5";
$update_interval = "3600";
$update_timeout = "30";
}
$foldername = urlToFolder($siteurl);
}
/* TOO SLOW
$xml = simplexml_load_file($rssurl); // quick feed check
// ATOM feed && RSS 1.0 /RDF && RSS 2.0
$result = (!isset($xml->entry) && !isset($xml->item) && !isset($xml->channel->item)) ? false : true; */
$result = true;
/* autoblog */
if( $result === true ) {
$foldername = urlToFolder($siteurl);
$errors = createAutoblog($sitetype, $sitename, $siteurl, $rssurl);
foreach( $errors AS $value) {
if( DEBUG )
echo '<p>'. $value .'</p>';
}
if( empty($errors) && DEBUG ) {
echo '<p>autoblog '. $sitename .' crée avec succès (DL DB : '. var_dump($get_remote_db) .' - DL media : '. var_dump($get_remote_media) .') : '. $foldername .'</p>';
if( !ALLOW_REMOTE_DB_DL && !ALLOW_REMOTE_MEDIA_DL )
echo '<iframe width="1" height="1" frameborder="0" src="'. $foldername .'/index.php"></iframe>';
}
/* ============================================================================================================================================================================== */
/* récupération de la DB distante */
if($get_remote_db == true && ALLOW_REMOTE_DB_DL ) {
$remote_db = str_replace("?export", $foldername."/articles.db", $xsafremote);
copy($remote_db, './'. $foldername .'/articles.db');
}
if($get_remote_media == true && ALLOW_REMOTE_MEDIA_DL ) {
$remote_media=str_replace("?export", $foldername."/?media", $xsafremote);
$json_media_import = file_get_contents($remote_media);
if(!empty($json_media_import))
{
mkdir('./'.$foldername.'/media/');
$json_media_import = json_decode($json_media_import, true);
$media_path=$json_media_import['url'];
if(!empty($json_media_import['files'])) {
foreach ($json_media_import['files'] as $value) {
copy($media_path.$value, './'.$foldername.'/media/'.$value);
}
}
}
}
/* ============================================================================================================================================================================== */
//TODO : tester si articles.db est une DB valide
//$to_update[] = serverUrl().preg_replace("/(.*)\/(.*)$/i","$1/".$foldername , $_SERVER['SCRIPT_NAME']); // url of the new autoblog
}
if( DEBUG )
echo '<p>time : '.($max_exec_time - time()) .'</p>';
if(time() >= $max_exec_time) {
if( DEBUG )
echo "<p>Time out !</p>";
break;
} }
} }
}
else {
if( DEBUG )
echo "Format JSON incorrect.";
return false;
} }
/* ============================================================================================================================================================================== */
//TODO : tester si articles.db est une DB valide
$infos = "\nautoblog crée avec succès (DB:$get_remote_db media:$get_remote_media) : $foldername";
$to_update[]=serverUrl().preg_replace("/(.*)\/(.*)$/i","$1/".$foldername , $_SERVER['SCRIPT_NAME']); // url of the new autoblog
}
}
} else {
$infos = "\n$rssurl -> flux invalide"; unlink("./$foldername/index.php"); rmdir($foldername);
}
/* end of file writing */
}else {
$infos = "\nImpossible de créer le répertoire ".$foldername;
}
} else {
/*$infos = "\nFin d'itération ou Le répertoire ".$foldername." existe déjà ($sitename;$siteurl;$rssurl)";*/
}
if(DEBUG){
echo $infos;
}
}
echo "\n time : ".(time() - $max_exec_time);
if(time() >= $max_exec_time){
break;
}
}
}
/*if(!empty($to_update)){
if(DEBUG){
echo "\nupdate of autoblogs ...";
}
// because it's could be very long, we finish by updating new autoblogs
foreach ($to_update as $url) {
get_headers($url);
}
if(DEBUG){
echo "done\n\n";
}
}*/
} }
return; return;
} }
/* And now, the XSAF links to be imported, with maximal execusion time for import in second ! */ /* And now, the XSAF links to be imported, with maximal execusion time for import in second !
xsafimport('https://raw.github.com/mitsukarenai/xsaf-bootstrap/master/3.json', 5); You should add only trusted sources. */
//xsafimport('https://www.ecirtam.net/autoblogs/?export', 5); $autoblog_farm = array(
//xsafimport('https://autoblog.suumitsu.eu/?export', 5); 'https://raw.github.com/mitsukarenai/xsaf-bootstrap/master/3.json',
'https://www.ecirtam.net/autoblogs/?export',
'https://autoblog.suumitsu.eu/?export',
);
if( DEBUG ) echo '<html><body>';
if( ALLOW_XSAF ) {
foreach( $autoblog_farm AS $value ) {
if( !empty($value) )
xsafimport($value, EXEC_TIME);
}
}
elseif( DEBUG )
echo "<p>XSAF désactivé. Positionnez la variable ALLOW_XSAF à TRUE dans le fichier xsaf3.php pour l'activer.</p>";
if(DEBUG) { if(DEBUG) {
echo "\n\nXSAF import finished\n\n"; echo "<p>XSAF import finished</p>";
} }
die; if( DEBUG ) echo '</body></html>';
?> ?>