Aautoblogs creation generate RSS entries
This commit is contained in:
parent
b5cdbebfa3
commit
848a7b9559
3 changed files with 28 additions and 4 deletions
|
@ -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 : <a href="'. $autobHref .'">'.$title.'</a><br>
|
||||
Site: <a href="'. $siteurl .'">'. $siteurl .'</a><br>
|
||||
RSS: <a href="'.$rssurl.'">'.$rssurl.'</a><br>
|
||||
|
@ -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 .'<br>
|
||||
Autoblog : <a href="'. $autobHref .'">'.$title.'</a><br>
|
||||
Site: <a href="'. $siteurl .'">'. $siteurl .'</a><br>
|
||||
|
@ -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 : <a href="'. $autobHref .'">'.$title.'</a><br>
|
||||
Site: <a href="'. $siteurl .'">'. $siteurl .'</a><br>
|
||||
RSS: <a href="'.$rssurl.'">'.$rssurl.'</a><br>
|
||||
Folder: '. $folder ,
|
||||
'admin',
|
||||
$autobHref,
|
||||
time()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
if (!defined('RSS_FILE')) define('RSS_FILE', 'rss.xml');
|
||||
|
||||
function NoProtocolSiteURL($url) {
|
||||
$protocols = array("http://", "https://");
|
||||
|
@ -71,6 +72,14 @@ function createAutoblog($type, $sitename, $siteurl, $rssurl, $error = array()) {
|
|||
$foldername = urlToFolderSlash($siteurl);
|
||||
|
||||
if ( mkdir('./'. $foldername, 0755, false) ) {
|
||||
|
||||
/**
|
||||
* RSS
|
||||
**/
|
||||
require_once('class_rssfeed.php');
|
||||
$rss = new AutoblogRSS(RSS_FILE);
|
||||
$rss->addNewAutoblog($sitename, $foldername, $siteurl, $rssurl);
|
||||
|
||||
$fp = fopen('./'. $foldername .'/index.php', 'w+');
|
||||
if( !fwrite($fp, "<?php require_once dirname(__DIR__) . '/autoblog.php'; ?>") )
|
||||
$error[] = "Impossible d'écrire le fichier 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue