diff --git a/.gitignore b/.gitignore index edae11c..ec73431 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +0.3/config.php 0.3/.versionlock 0.3/.xsaflock 0.3/resources/rss.xml diff --git a/0.3/autoblogs/autoblog.php b/0.3/autoblogs/autoblog.php index ddcecd0..a19e146 100644 --- a/0.3/autoblogs/autoblog.php +++ b/0.3/autoblogs/autoblog.php @@ -24,7 +24,7 @@ libxml_disable_entity_loader(true); if (file_exists(__DIR__ . '/../config.php')) { require_once __DIR__ . '/../config.php'; } -else die("Configuration file not found."); +//else die("Configuration file not found."); if (file_exists(__DIR__ . '/../functions.php')){ require_once __DIR__ . '/../functions.php'; @@ -723,7 +723,7 @@ echo '
-

PROJET AUTOBLOG'. (!empty($head_title) ? ' ~ '. escape($head_title) : '') .'

+

PROJET AUTOBLOG'. (strlen(HEAD_TITLE) > 0 ? ' ~ '. HEAD_TITLE : '') .'


'.escape($config->site_title).'

'; diff --git a/0.3/class_rssfeed.php b/0.3/class_rssfeed.php index dfb724d..59fd431 100755 --- a/0.3/class_rssfeed.php +++ b/0.3/class_rssfeed.php @@ -198,8 +198,8 @@ class FileRSSFeed extends RSSFeed { foreach($merger->getFeeds(20) as $f) { parent::addItem($f->title,$f->link,$f->description,$f->author,$f->guid,$f->time); } - - file_put_contents( $this->filename, $this->xml->asXML() ); + + file_put_contents( $this->filename, $this->xml->asXML(), LOCK_EX ); } } @@ -211,7 +211,7 @@ class AutoblogRSS extends FileRSSFeed { public function addUnavailable($title, $folder, $siteurl, $rssurl) { $path = pathinfo( $_SERVER['PHP_SELF'] ); $autobHref = 'http'.(!empty($_SERVER['HTTPS'])?'s':'').'://'. - $_SERVER["SERVER_NAME"].$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; + $_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; parent::addItem( 'L\'autoblog "'. $title.'" est indisponible', $autobHref, 'Autoblog: '.$title.'
@@ -227,7 +227,7 @@ class AutoblogRSS extends FileRSSFeed { public function addAvailable($title, $folder, $siteurl, $rssurl) { $path = pathinfo( $_SERVER['PHP_SELF'] ); $autobHref = 'http'.(!empty($_SERVER['HTTPS'])?'s':'').'://'. - $_SERVER["SERVER_NAME"].$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; + $_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; parent::addItem( 'L\'autoblog "'. $title.'" est de nouveau disponible', $autobHref, 'Autoblog : '.$title.'
@@ -243,7 +243,7 @@ class AutoblogRSS extends FileRSSFeed { public function addCodeChanged($title, $folder, $siteurl, $rssurl, $code) { $path = pathinfo( $_SERVER['PHP_SELF'] ); $autobHref = 'http'.(!empty($_SERVER['HTTPS'])?'s':'').'://'. - $_SERVER["SERVER_NAME"].$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; + $_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; parent::addItem( 'L\'autoblog "'. $title.'" a renvoyé un code imprévu', $autobHref, 'Code: '. $code .'
@@ -260,7 +260,7 @@ class AutoblogRSS extends FileRSSFeed { public function addNewAutoblog($title, $folder, $siteurl, $rssurl) { $path = pathinfo( $_SERVER['PHP_SELF'] ); $autobHref = 'http'.(!empty($_SERVER['HTTPS'])?'s':'').'://'. - $_SERVER["SERVER_NAME"].$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; + $_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; parent::addItem( 'L\'autoblog "'. $title.'" a été ajouté à la ferme', $autobHref, 'Autoblog : '.$title.'
diff --git a/0.3/config.php b/0.3/config.php index 8d10a51..b4991e1 100755 --- a/0.3/config.php +++ b/0.3/config.php @@ -1,57 +1,46 @@ SebSauvage et Bohwaz.'); define( 'ALLOW_FULL_UPDATE', TRUE ); -// Check new version on Github define( 'ALLOW_CHECK_UPDATE', TRUE ); -define( '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_FILE', TRUE ); -// OPML Link -define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK', TRUE ); -// XSAF -define( 'ALLOW_NEW_AUTOBLOGS_BY_XSAF', TRUE ); +/** + * If you set ALLOW_NEW_AUTOBLOGS to FALSE, the following options do not matter. + **/ +define( 'ALLOW_NEW_AUTOBLOGS', FALSE ); +// define( 'ALLOW_NEW_AUTOBLOGS_BY_LINKS', TRUE ); +// define( 'ALLOW_NEW_AUTOBLOGS_BY_SOCIAL', TRUE ); +// define( 'ALLOW_NEW_AUTOBLOGS_BY_BUTTON', TRUE ); +// define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML_FILE', TRUE ); +// define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK', TRUE ); +// define( 'ALLOW_NEW_AUTOBLOGS_BY_XSAF', TRUE ); -// URL to Twitterbridge API - Set FALSE to disable Twitter (default). -$apitwitter = FALSE; +/** + * More about TwitterBridge : https://github.com/mitsukarenai/twitterbridge + **/ +// define( 'API_TWITTER', FALSE ); -// Logo à utiliser -$logo=RESOURCES_FOLDER .'icon-logo.svg'; - -// Marquez ici votre propre message qui apparaîtra en bas de page. -// exemple : -//$HTML_footer="
Love data
Data is essential
Data must flow
Data must be used
Data is neither good nor bad
There is no illegal data
Data is free
Data can not be owned
No man, machine or system shall interrupt the flow of data
Locking data is a crime against datanity"; -$HTML_footer='D\'après les premières versions de SebSauvage et Bohwaz.'; - -$head_title = ""; - -/* And now, the XSAF links to be imported, with maximal execusion time for import in second ! -You should add only trusted sources. */ -$autoblog_farm = array( - 'https://raw.github.com/mitsukarenai/xsaf-bootstrap/master/3.json' , - 'https://www.ecirtam.net/autoblogs/?export', - 'http://autoblog.suumitsu.eu/?export' +/** + * Import autoblogs from friend's autoblog farm - Add a link to the JSON export + **/ +$friends_autoblog_farm = array( + 'https://raw.github.com/mitsukarenai/xsaf-bootstrap/master/3.json', + 'https://www.ecirtam.net/autoblogs/?export', + 'https://autoblog.suumitsu.eu/?export', + 'http://streisand.hoa.ro/?export' ); -// personnal option $myOptions['enableThumbShot'] = true; -$myOptions['externalThumbSdhot'] = ''; -?> +$myOptions['externalThumbSdhot'] = 'http://soshot.local/?key=a2b860fcd656&&s=m&url='; +?> \ No newline at end of file diff --git a/0.3/docs/docs.txt b/0.3/docs/docs.txt deleted file mode 100644 index a4c763e..0000000 --- a/0.3/docs/docs.txt +++ /dev/null @@ -1,4 +0,0 @@ -You can manually add files in the /docs/ directory, such as PDF, docs, images, etc. -You can also add subfolders in /docs/ for website mirroring. Be sure that your subfolder contains a file named index.html. - -Delete this file to hide the 'Autres documents' block in your autoblogs homepage. diff --git a/0.3/functions.php b/0.3/functions.php index 83605d8..03f446e 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -1,6 +1,41 @@ SebSauvage et Bohwaz.'); + +// Functions function NoProtocolSiteURL($url) { $protocols = array("http://", "https://"); $siteurlnoproto = str_replace($protocols, "", $url); @@ -47,7 +82,7 @@ function urlToFolderSlash($url) { } function folderExists($url) { - return file_exists(urlToFolder($url)) || file_exists(urlToFolderSlash($url)); + return file_exists(AUTOBLOGS_FOLDER . urlToFolder($url)) || file_exists(AUTOBLOGS_FOLDER . urlToFolderSlash($url)); } function escape($str) { @@ -92,9 +127,14 @@ function createAutoblog($type, $sitename, $siteurl, $rssurl, $siteDesc, $error = /** * RSS **/ - require_once('class_rssfeed.php'); - $rss = new AutoblogRSS(RSS_FILE); - $rss->addNewAutoblog($sitename, $foldername, $siteurl, $rssurl); + try { + require_once('class_rssfeed.php'); + $rss = new AutoblogRSS(RSS_FILE); + $rss->addNewAutoblog($sitename, $foldername, $siteurl, $rssurl); + } + catch (Exception $e) { + ; + } $fp = fopen($foldername .'/index.php', 'w+'); if( !fwrite($fp, "") ) diff --git a/0.3/index.php b/0.3/index.php index 6364c70..da10c02 100755 --- a/0.3/index.php +++ b/0.3/index.php @@ -21,22 +21,21 @@ define('XSAF_VERSION', 3); define('ROOT_DIR', __DIR__); +$error = array(); +$success = array(); + if(file_exists("config.php")){ - include "config.php"; + require_once "config.php"; }else{ - echo "config.php not found !"; - die; + $error[] = "config.php not found !"; } if(file_exists("functions.php")){ - include "functions.php"; + require_once "functions.php"; }else{ echo "functions.php not found !"; die; } -$error = array(); -$success = array(); - function get_title_from_feed($url) { return get_title_from_datafeed(file_get_contents($url)); } @@ -120,7 +119,7 @@ function create_from_opml($opml) { $error = array_merge( $error, createAutoblog( $sitetype, $sitename, $siteurl, $rssurl, $siteDesc, $error ) ); if( empty ( $error )) - $success[] = 'Autoblog "'. $sitename .'" crée avec succès. → afficher l\'autoblog.'; + $success[] = 'Autoblog "'. $sitename .'" crée avec succès. → afficher l\'autoblog.'; } catch (Exception $e) { $error[] = $e->getMessage(); @@ -166,7 +165,7 @@ function versionCheck() { if( !file_exists(RSS_FILE)) { require_once('class_rssfeed.php'); $rss = new AutoblogRSS(RSS_FILE); - $rss->create('Projet Autoblog'. ((!empty($head_title)) ? ' | '. $head_title : ''), serverUrl(true),"Projet Autoblog - RSS : Ajouts et changements de disponibilité.", serverUrl(true) . RSS_FILE); + $rss->create('Projet Autoblog'. ((strlen(HEAD_TITLE)>0) ? ' | '. HEAD_TITLE : ''), serverUrl(true),"Projet Autoblog - RSS : Ajouts et changements de disponibilité.", serverUrl(true) . RSS_FILE); } if (isset($_GET['rss'])) { require_once('class_rssfeed.php'); @@ -350,15 +349,15 @@ if (isset($_GET['exportopml'])) // OPML if (isset($_GET['sitemap'])) { header('Content-Type: application/xml'); + $proto=(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?"https://":"http://"; echo ''; - echo ''.'http' . (!empty($_SERVER['HTTPS']) ? 's' : '')."://{$_SERVER['HTTP_HOST']}".str_replace('?sitemap', '', $_SERVER['REQUEST_URI'])."\n"; + echo ''.$proto."{$_SERVER['HTTP_HOST']}".str_replace('?sitemap', '', $_SERVER['REQUEST_URI'])."\n"; echo ''.date('c', time())."\n"; echo 'daily'; $subdirs = glob(AUTOBLOGS_FOLDER . "*"); foreach($subdirs as $unit) { if(is_dir($unit)) { $unit=substr($unit, 2); - $proto=(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?"https://":"http://"; echo ''.$proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."\n"; echo ''.date('c', filemtime($unit))."\n"; echo 'hourly'; @@ -431,8 +430,8 @@ if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOG $error = array_merge( $error, createAutoblog($sitetype, $sitename, $siteurl, $rssurl, $siteDesc, $error)); if( empty($error)) { - $form .= ''; - $form .= '

Autoblog '. $sitename .' ajouté avec succès.
'; + $form .= ''; + $form .= '

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

    '; @@ -491,10 +490,10 @@ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_ $socialinstance = strtolower(escape($_POST['socialinstance'])); if($socialinstance === 'twitter') { - if( $apitwitter !== FALSE ) { + if( API_TWITTER !== FALSE ) { $sitetype = 'twitter'; $siteurl = "http://twitter.com/$socialaccount"; - $rssurl = $apitwitter.$socialaccount; + $rssurl = API_TWITTER.$socialaccount; } else $error[] = "Twitter veut mettre à mort son API ouverte. Du coup on peut plus faire ça comme ça."; @@ -539,7 +538,7 @@ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_ if( empty($error) ) { $error = array_merge( $error, createAutoblog($sitetype, ucfirst($socialinstance) .' - '. $socialaccount, $siteurl, $rssurl,$siteDesc, $error)); if( empty($error)) - $success[] = ''.ucfirst($socialinstance) .' - '. $socialaccount.' ajouté avec succès.'; + $success[] = ''.ucfirst($socialinstance) .' - '. $socialaccount.' ajouté avec succès.'; } } } @@ -571,7 +570,7 @@ if( !empty($_POST['generic']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_L $error = array_merge( $error, createAutoblog('generic', $sitename, $siteurl, $rssurl, $siteDesc, $error)); if( empty($error)) - $success[] = 'Autoblog '. $sitename .' crée avec succès.afficher l\'autoblog'; + $success[] = 'Autoblog '. $sitename .' crée avec succès.afficher l\'autoblog'; } else { // checking procedure @@ -658,7 +657,7 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY - Projet Autoblog<?php if(!empty($head_title)) { echo " | " . escape($head_title); } ?> + Projet Autoblog<?php if(strlen(HEAD_TITLE)>0) echo " | " . HEAD_TITLE; ?> -

    PROJET AUTOBLOG

    +

    + PROJET AUTOBLOG + 0) echo " | " . HEAD_TITLE; ?> +

    - - + '; + ?>

    Présentation

    @@ -750,7 +754,7 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY


    Twitter
    '; else echo 'Twitter
    '; ?> Identica
    @@ -900,7 +904,7 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY ".count($autoblogs)." autoblogs hébergés

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