From 848a7b95597025a4e004743d29cb0c96b55f2743 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 18 Mar 2013 10:32:37 +0100 Subject: [PATCH] Aautoblogs creation generate RSS entries --- 0.3/class_rssfeed.php | 20 ++++++++++++++++++-- 0.3/functions.php | 9 +++++++++ 0.3/index.php | 3 +-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/0.3/class_rssfeed.php b/0.3/class_rssfeed.php index a6a804d..c577c8e 100644 --- a/0.3/class_rssfeed.php +++ b/0.3/class_rssfeed.php @@ -226,7 +226,7 @@ class AutoblogRSS extends FileRSSFeed { $autobHref = 'http'.(!empty($_SERVER['HTTPS'])?'s':'').'://'. $_SERVER["SERVER_NAME"].$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; - parent::addItem( 'L\'autoblog "'. $title.' est de nouveau disponible', $autobHref, + parent::addItem( 'L\'autoblog "'. $title.'" est de nouveau disponible', $autobHref, 'Autoblog : '.$title.'
Site: '. $siteurl .'
RSS: '.$rssurl.'
@@ -242,7 +242,7 @@ class AutoblogRSS extends FileRSSFeed { $autobHref = 'http'.(!empty($_SERVER['HTTPS'])?'s':'').'://'. $_SERVER["SERVER_NAME"].$_SERVER["SERVER_PORT"]. $path['dirname'].'/'.$folder; - parent::addItem( 'L\'autoblog "'. $title.' a renvoyé un code imprévu', $autobHref, + parent::addItem( 'L\'autoblog "'. $title.'" a renvoyé un code imprévu', $autobHref, 'Code: '. $code .'
Autoblog : '.$title.'
Site: '. $siteurl .'
@@ -253,6 +253,22 @@ class AutoblogRSS extends FileRSSFeed { time() ); } + + public function addNewAutoblog($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; + + parent::addItem( 'L\'autoblog "'. $title.'" a été ajouté à la ferme', $autobHref, + 'Autoblog : '.$title.'
+ Site: '. $siteurl .'
+ RSS: '.$rssurl.'
+ Folder: '. $folder , + 'admin', + $autobHref, + time() + ); + } } ?> \ No newline at end of file diff --git a/0.3/functions.php b/0.3/functions.php index 3efb263..c14c11e 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -1,4 +1,5 @@ addNewAutoblog($sitename, $foldername, $siteurl, $rssurl); + $fp = fopen('./'. $foldername .'/index.php', 'w+'); if( !fwrite($fp, "") ) $error[] = "Impossible d'écrire le fichier index.php"; diff --git a/0.3/index.php b/0.3/index.php index b54f919..cf7dc3b 100755 --- a/0.3/index.php +++ b/0.3/index.php @@ -20,7 +20,6 @@ define('XSAF_VERSION', 3); define('ROOT_DIR', __DIR__); -define('RSS_FILE', 'rss.xml'); if(file_exists("config.php")){ include "config.php"; @@ -170,7 +169,7 @@ if (isset($_GET['rss'])) { 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, flux RSS des changements de disponibilité.", serverUrl(true) . '/' . 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); } /**