diff --git a/index.php b/index.php
index f6985df..3cff6fe 100755
--- a/index.php
+++ b/index.php
@@ -21,6 +21,9 @@ function get_title_from_feed($url)
function get_link_from_feed($url)
{
// get site link from feed
+ $validator = "http://validator.w3.org/feed/check.cgi";$validator .= "?url=".$url;$validator .= "&output=soap12";
+ $response = file_get_contents($validator);$a = strpos($response, '', 0)+12;$b = strpos($response, '', $a);$result = substr($response, $a, $b-$a);
+ if($result == "false") { die('le flux n\'a pas une syntaxe valide'); }
$data = file_get_contents("$url");
$check = substr($data, 0, 5);
if($check !== '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.atom"; }
- if($socialinstance === 'statusnet' && !empty($_POST['socialurl'])) { $siteurl = "http://".escape($_POST['socialurl'])."/$socialaccount"; $rssurl = "http://".escape($_POST['socialurl'])."/api/statuses/user_timeline/$socialaccount.atom"; }
+ 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) ) {
diff --git a/xsaf2.php b/xsaf2.php
index 5c29a3e..a0f9ef8 100755
--- a/xsaf2.php
+++ b/xsaf2.php
@@ -37,7 +37,7 @@ function NoProtocolSiteURL($url)
}
function xsafimport($xsafremote)
{
- $json_import = file_get_contents($xsafremote);
+ $json_import = file_get_contents($xsafremote);
if(!empty($json_import)){
$to_update=array();
foreach (json_decode($json_import) as $value) {
@@ -67,8 +67,11 @@ function xsafimport($xsafremote)
if ( mkdir('./'. $foldername, 0755, false) ) {
$fp = fopen('./'. $foldername .'/index.php', 'w+');
+ $validator = "http://validator.w3.org/feed/check.cgi";$validator .= "?url=".$rssurl;$validator .= "&output=soap12";
+ $response = file_get_contents($validator);$a = strpos($response, '', 0)+12;$b = strpos($response, '', $a);$result = substr($response, $a, $b-$a);
+
/* autoblog */
-if($social==FALSE)
+if($social==FALSE and $result!=="false")
{
if( !fwrite($fp, "") ){
$infos = "Impossible d'écrire le fichier index.php dans ".$foldername;
@@ -92,7 +95,7 @@ DOWNLOAD_MEDIA_FROM='.$sitedomain) ){
}
}
/* automicroblog */
-else
+else if($social!==FALSE and $result!=="false")
{
if( !fwrite($fp, "") ){
$infos = "Impossible d'écrire le fichier index.php dans ".$foldername;
@@ -114,12 +117,12 @@ FEED_URL="'. $rssurl .'"') ){
}
}
-}
+} else { $infos = "$rssurl -> flux invalide"; }
/* end of file writing */
}else {
$infos = "Impossible de créer le répertoire ".$foldername;
}
- } /* else { $infos = "Le répertoire ".$foldername." existe déjà ($sitename;$siteurl;$rssurl)"; } */
+ } else { $infos = "Le répertoire ".$foldername." existe déjà ($sitename;$siteurl;$rssurl)"; }
if(DEBUG){ echo $infos."\n"; }
}
}
@@ -135,9 +138,10 @@ FEED_URL="'. $rssurl .'"') ){
}
/* And now, the XSAF links to be imported ! */
-
+xsafimport('https://raw.github.com/mitsukarenai/xsaf-bootstrap/master/2.json');
//xsafimport('https://www.ecirtam.net/autoblogs/?export');
-xsafimport('http://autoblog.suumitsu.eu/?export');
+//xsafimport('http://autoblog.suumitsu.eu/?export');
+
if(DEBUG){ echo "\n\nXSAF import finished\n\n"; }
?>