(j'espère je casse rien)

This commit is contained in:
Mitsukarenai 2013-04-22 11:59:04 +02:00
parent 2c11dfcb4d
commit b0fb1a8d70
16 changed files with 17 additions and 3088 deletions

14
.gitignore vendored
View file

@ -1,8 +1,8 @@
0.3/config.php config.php
0.3/.versionlock .versionlock
0.3/.xsaflock .xsaflock
0.3/resources/rss.xml resources/rss.xml
.project .project
0.3/resources/user.css resources/user.css
0.3/autoblogs/* autoblogs/*
!0.3/autoblogs/autoblog.php !autoblogs/autoblog.php

View file

@ -1,138 +0,0 @@
<?php
$dir="./";
$liste_blog = scandir($dir);
unset($liste_blog[0]);
unset($liste_blog[1]);
foreach($liste_blog as $blog) {
if(is_dir($dir.$blog) && is_file($dir.$blog."/vvb.ini")) {
$articles = new SQLite3($dir.$blog."/articles.db");
$articles->exec('
CREATE TABLE update_log (
date INT PRIMARY KEY,
success INT,
log TEXT
);
');
$vals=array();
$ini = parse_ini_file($dir.$blog."/vvb.ini");
if(is_dir(urlToFolderWithTrailingSlash( $ini['SITE_URL'] )) || is_dir(urlToFolder( $ini['SITE_URL'] )))
continue;
$foldername = urlToFolderWithTrailingSlash($ini['SITE_URL']);
mkdir( $dir . $foldername );
mkdir( $dir . $foldername . '/media');
recursiveMove( $dir . $blog . '/media', $dir . $foldername .'/media' );
copy($dir . $blog . '/index.php', $dir . $foldername .'/index.php');
copy($dir . $blog . '/articles.db', $dir . $foldername .'/articles.db');
deleteDir($dir . $blog );
if( strpos($ini['SITE_TITLE'], 'Autoblog de') !== false ) {
$ini['SITE_TITLE'] = preg_replace('#^Autoblog de (.*)$#', '$1', $ini['SITE_TITLE']);
}
switch(substr($ini['SITE_TITLE'], 0, 7)) {
case 'twitter':
case 'statusn':
case 'identic':
$ini['SITE_TYPE']="microblog";
$ini['ARTICLES_PER_PAGE'] = "20";
$ini['UPDATE_INTERVAL'] = "300";
$ini['UPDATE_TIMEOUT'] = "30";
break;
default:
$ini['SITE_TYPE']="generic";
$ini['ARTICLES_PER_PAGE'] = "5";
$ini['UPDATE_INTERVAL'] = "3600";
$ini['UPDATE_TIMEOUT'] = "30";
break;
}
$fp = fopen($dir.$foldername."/vvb.ini", 'w+');
fwrite($fp, <<<EOF
[VroumVroumBlogConfig]
SITE_TYPE="{$ini['SITE_TYPE']}"
SITE_TITLE="{$ini['SITE_TITLE']}"
SITE_DESCRIPTION="source: <a href='{$ini['SITE_URL']}'>{$ini['SITE_TITLE']}</a>"
SITE_URL="{$ini['SITE_URL']}"
FEED_URL="{$ini['FEED_URL']}"
ARTICLES_PER_PAGE="{$ini['ARTICLES_PER_PAGE']}"
UPDATE_INTERVAL="{$ini['UPDATE_INTERVAL']}"
UPDATE_TIMEOUT="{$ini['UPDATE_TIMEOUT']}"
EOF
);
fclose($fp);
}
}
echo "\nend ".date("d/m/Y H:i:s")."\n\n";
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);
// Remove index.php/html at the end of string
if( strpos($url, 'index.php') || strpos($url, 'index.html') ) {
$siteurlnoproto = preg_replace('#(.*)/index\.(html|php)$#', '$1', $siteurlnoproto);
}
return $siteurlnoproto;
}
function urlToFolderWithTrailingSlash($url) {
return sha1(NoProtocolSiteURL($url).'/');
}
function urlToFolder($url) {
return sha1(NoProtocolSiteURL($url));
}
/* http://stackoverflow.com/questions/2082138/move-all-files-in-a-folder-to-another */
function recursiveMove($source, $dest) {
// Get array of all source files
$files = scandir($source);
$delete = array();
if(substr($source, strlen($source) - 1, 1) != '/')
$source .= '/';
if(substr($dest, strlen($dest) - 1, 1) != '/')
$dest .= '/';
// Cycle through all source files
foreach ($files as $file) {
if (in_array($file, array(".",".."))) continue;
// If we copied this successfully, mark it for deletion
if (copy($source.$file, $dest.$file)) {
$delete[] = $source.$file;
}
}
// Delete all successfully-copied files
foreach ($delete as $file) {
unlink($file);
}
}
/* http://stackoverflow.com/questions/3349753/delete-directory-with-files-in-it */
function deleteDir($dirPath) {
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
deleteDir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}
?>

View file

@ -1,18 +0,0 @@
Projet Autoblog serie 0.3
==============
- version VroumVroumBlog 0.3.0 BETA
Auteurs: Mitsu (https://www.suumitsu.eu/), Oros (https://www.ecirtam.net/) et Arthur Hoaro (http://hoa.ro)
Licence: Domaine Public
- À propos du Projet Autoblog
lire: http://sebsauvage.net/streisand.me/fr/
Instructions
- uploader les fichiers sur un serveur avec PHP 5.3+
- ..c'est tout. Hackez le code pour apprendre comment ça marche et comment le personnaliser :)

View file

@ -1,908 +0,0 @@
<?php
/*
VroumVroumBlog 0.3.0
This blog automatically publishes articles from an external RSS 2.0 or ATOM feed.
Requirement for the source RSS feed:
- Source feed MUST be a valid RSS 2.0, RDF 1.0 or ATOM 1.0 feed.
- Source feed MUST be valid UTF-8
- Source feed MUST contain article body
This program is public domain. COPY COPY COPY !
*/
$vvbversion = '0.3.0';
if (!version_compare(phpversion(), '5.3.0', '>='))
die("This software requires PHP version 5.3.0 at least, yours is ".phpversion());
if (!class_exists('SQLite3'))
die("This software requires the SQLite3 PHP extension, and it can't be found on this system!");
libxml_disable_entity_loader(true);
// Config and data file locations
if (file_exists(__DIR__ . '/../config.php')) {
require_once __DIR__ . '/../config.php';
}
//else die("Configuration file not found.");
if (file_exists(__DIR__ . '/../functions.php')){
require_once __DIR__ . '/../functions.php';
}
else die("Functions file not found.");
if (!defined('ROOT_DIR'))
define('ROOT_DIR', __DIR__);
if (!defined('CONFIG_FILE')) define('CONFIG_FILE', ROOT_DIR . '/vvb.ini');
if (!defined('ARTICLES_DB_FILE')) define('ARTICLES_DB_FILE', ROOT_DIR . '/articles.db');
if (!defined('MEDIA_DIR')) define('MEDIA_DIR', ROOT_DIR . '/media');
if (!defined('LOCAL_URL'))
{
// Automagic URL discover
define('LOCAL_URL', 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '')."://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
}
if (!defined('LOCAL_URI'))
{
// filename
define('LOCAL_URI', (basename($_SERVER['SCRIPT_FILENAME']) == 'index.php' ? '' : basename($_SERVER['SCRIPT_FILENAME'])) . '?');
}
if (!function_exists('__'))
{
// Translation?
function __($str)
{
if ($str == '_date_format')
return '%A %e %B %Y at %H:%M';
else
return $str;
}
}
// ERROR MANAGEMENT
class VroumVroum_User_Exception extends Exception {}
class VroumVroum_Feed_Exception extends Exception
{
static public function getXMLErrorsAsString($errors)
{
$out = array();
foreach ($errors as $error)
{
$return = $xml[$error->line - 1] . "\n";
$return .= str_repeat('-', $error->column) . "^\n";
switch ($error->level) {
case LIBXML_ERR_WARNING:
$return .= "Warning ".$error->code.": ";
break;
case LIBXML_ERR_ERROR:
$return .= "Error ".$error->code.": ";
break;
case LIBXML_ERR_FATAL:
$return .= "Fatal Error ".$error->code.": ";
break;
}
$return .= trim($error->message) .
"\n Line: ".$error->line .
"\n Column: ".$error->column;
if ($error->file) {
$return .= "\n File: ".$error->file;
}
$out[] = $return;
}
return $out;
}
}
error_reporting(E_ALL);
function exception_error_handler($errno, $errstr, $errfile, $errline )
{
// For @ ignored errors
if (error_reporting() === 0) return;
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
function exception_handler($e)
{
if ($e instanceOf VroumVroum_User_Exception)
{
echo '<h3>'.$e->getMessage().'</h3>';
exit;
}
$error = "Error happened !\n\n".
$e->getCode()." - ".$e->getMessage()."\n\nIn: ".
$e->getFile() . ":" . $e->getLine()."\n\n";
if (!empty($_SERVER['HTTP_HOST']))
$error .= 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n";
$error .= $e->getTraceAsString();
//$error .= print_r($_SERVER, true);
echo $error;
exit;
}
set_error_handler("exception_error_handler");
set_exception_handler("exception_handler");
// CONFIGURATION
class VroumVroum_Config
{
public $site_type = '';
public $site_title = '';
public $site_description = '';
public $site_url = '';
public $feed_url = '';
public $articles_per_page = 10;
public $update_interval = 3600;
public $update_timeout = 10;
public function __construct()
{
if (!file_exists(CONFIG_FILE))
throw new VroumVroum_User_Exception("Missing configuration file '".basename(CONFIG_FILE)."'.");
$ini = parse_ini_file(CONFIG_FILE);
foreach ($ini as $key=>$value)
{
$key = strtolower($key);
if (!property_exists($this, $key))
continue; // Unknown config
if (is_string($this->$key) || is_null($this->$key))
$this->$key = trim((string) $value);
elseif (is_int($this->$key))
$this->$key = (int) $value;
elseif (is_bool($this->$key))
$this->$key = (bool) $value;
}
// Check that all required values are filled
$check = array('site_type', 'site_title', 'site_url', 'feed_url', 'update_timeout', 'update_interval', 'articles_per_page');
foreach ($check as $c)
{
if (!trim($this->$c))
throw new VroumVroum_User_Exception("Missing or empty configuration value '".$c."' which is required!");
}
}
public function __set($key, $value)
{
return;
}
}
// BLOG
class VroumVroum_Blog
{
protected $articles = null;
protected $local = null;
public $config = null;
static public function removeHTML($str)
{
$str = strip_tags($str);
$str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
return $str;
}
static public function toURI($str)
{
$uri = self::removeHTML(trim($str));
$uri = substr($uri, 0, 70);
$uri = preg_replace('/[^\w\d()\p{L}]+/u', '-', $uri);
$uri = preg_replace('/-{2,}/', '-', $uri);
$uri = preg_replace('/^-|-$/', '', $uri);
return $uri;
}
public function __construct()
{
$this->config = new VroumVroum_Config;
$create_articles_db = file_exists(ARTICLES_DB_FILE) ? false : true;
$this->articles = new SQLite3(ARTICLES_DB_FILE);
if ($create_articles_db)
{
$this->articles->exec('
CREATE TABLE articles (
id INTEGER PRIMARY KEY,
feed_id TEXT,
title TEXT,
uri TEXT,
url TEXT,
date INT,
content TEXT
);
CREATE TABLE update_log (
date INT PRIMARY KEY,
success INT,
log TEXT
);
CREATE UNIQUE INDEX feed_id ON articles (feed_id);
CREATE INDEX date ON articles (date);
');
}
$this->articles->createFunction('countintegers', array($this, 'sql_countintegers'));
}
public function getLocalURL($in)
{
return "./?".(is_array($in) ? $in['uri'] : $in);
}
protected function log_update($success, $log = '')
{
$this->articles->exec('INSERT INTO update_log (date, success, log) VALUES (\''.time().'\', \''.(int)(bool)$success.'\',
\''.$this->articles->escapeString($log).'\');');
// Delete old log
$this->articles->exec('DELETE FROM update_log WHERE date > (SELECT date FROM update_log ORDER BY date DESC LIMIT 100,1);');
return true;
}
public function insertOrUpdateArticle($feed_id, $title, $url, $date, $content)
{
$exists = $this->articles->querySingle('SELECT date, id, title, content FROM articles WHERE feed_id = \''.$this->articles->escapeString($feed_id).'\';', true);
if (empty($exists))
{
$uri = self::toURI($title);
if ($this->articles->querySingle('SELECT 1 FROM articles WHERE uri = \''.$this->articles->escapeString($uri).'\';'))
{
$uri = date('Y-m-d-') . $uri;
}
$content = $this->mirrorMediasForArticle($content, $url);
$this->articles->exec('INSERT INTO articles (id, feed_id, title, uri, url, date, content) VALUES (NULL,
\''.$this->articles->escapeString($feed_id).'\', \''.$this->articles->escapeString($title).'\',
\''.$this->articles->escapeString($uri).'\', \''.$this->articles->escapeString($url).'\',
\''.(int)$date.'\', \''.$this->articles->escapeString($content).'\');');
$id = $this->articles->lastInsertRowId();
$title = self::removeHTML($title);
$content = self::removeHTML($content);
}
else
{
// Doesn't need update
if ($date == $exists['date'] && $content == $exists['content'] && $title == $exists['title'])
{
return false;
}
$id = $exists['id'];
if ($content != $exists['content'])
$content = $this->mirrorMediasForArticle($content, $url);
$this->articles->exec('UPDATE articles SET title=\''.$this->articles->escapeString($title).'\',
url=\''.$this->articles->escapeString($url).'\', content=\''.$this->articles->escapeString($content).'\',
date=\''.(int)$date.'\' WHERE id = \''.(int)$id.'\';');
$title = self::removeHTML($title);
$content = self::removeHTML($content);
}
return $id;
}
public function mustUpdate()
{
if (isset($_GET['update']))
return true;
$last_update = $this->articles->querySingle('SELECT date FROM update_log ORDER BY date DESC LIMIT 1;');
if (!empty($last_update) && (int) $last_update > (time() - $this->config->update_interval))
return false;
return true;
}
protected function _getStreamContext()
{
return stream_context_create(
array(
'http' => array(
'method' => 'GET',
'timeout' => $this->config->update_timeout,
'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0; Autoblogs; +https://github.com/mitsukarenai/Projet-Autoblog/) Gecko/20100101 Firefox/20.0\r\n",
)
)
);
}
public function update()
{
if (!$this->mustUpdate())
return false;
try {
$body = file_get_contents($this->config->feed_url, false, $this->_getStreamContext());
}
catch (ErrorException $e)
{
$this->log_update(false, $e->getMessage() . "\n\n" . (!empty($http_response_header) ? implode("\n", $http_response_header) : ''));
throw new VroumVroum_Feed_Exception("Can't retrieve feed: ".$e->getMessage());
}
libxml_use_internal_errors(true);
$xml = @simplexml_load_string($body);
if (!$xml)
{
$errors = VroumVroum_Feed_Exception::getXMLErrorsAsString(libxml_get_errors());
$this->log_update(false, implode("\n", $errors) . "\n\n" . $body);
throw new VroumVroum_Feed_Exception("Feed is invalid - XML error: ".implode(" - ", $errors));
}
$updated = 0;
$this->articles->exec('BEGIN TRANSACTION;');
if (isset($xml->entry)) // ATOM feed
{
foreach ($xml->entry as $item)
{
$date = isset($item->published) ? (string) $item->published : (string) $item->updated;
$guid = !empty($item->id) ? (string)$item->id : (string)$item->link['href'];
$id = $this->insertOrUpdateArticle($guid, (string)$item->title,
(string)$item->link['href'], strtotime($date), (string)$item->content);
if ($id !== false)
$updated++;
}
}
elseif (isset($xml->item)) // RSS 1.0 /RDF
{
foreach ($xml->item as $item)
{
$guid = (string) $item->attributes('http://www.w3.org/1999/02/22-rdf-syntax-ns#')->about ?: (string)$item->link;
$date = (string) $item->children('http://purl.org/dc/elements/1.1/')->date;
$id = $this->insertOrUpdateArticle($guid, (string)$item->title, (string)$item->link,
strtotime($date), (string) $item->children('http://purl.org/rss/1.0/modules/content/'));
if ($id !== false)
$updated++;
}
}
elseif (isset($xml->channel->item)) // RSS 2.0
{
foreach ($xml->channel->item as $item)
{
$content = (string) $item->children('http://purl.org/rss/1.0/modules/content/');
$guid = !empty($item->guid) ? (string) $item->guid : (string) $item->link;
if (empty($content) && !empty($item->description))
$content = (string) $item->description;
$id = $this->insertOrUpdateArticle($guid, (string)$item->title, (string)$item->link,
strtotime((string) $item->pubDate), $content);
if ($id !== false)
$updated++;
}
}
else
{
throw new VroumVroum_Feed_Exception("Unknown feed type?!");
}
$this->log_update(true, $updated . " elements updated");
$this->articles->exec('END TRANSACTION;');
return $updated;
}
public function listArticlesByPage($page = 1)
{
$nb = $this->config->articles_per_page;
$begin = ($page - 1) * $nb;
$res = $this->articles->query('SELECT * FROM articles ORDER BY date DESC LIMIT '.(int)$begin.','.(int)$nb.';');
$out = array();
while ($row = $res->fetchArray(SQLITE3_ASSOC))
{
$out[] = $row;
}
return $out;
}
public function listLastArticles()
{
return array_merge($this->listArticlesByPage(1), $this->listArticlesByPage(2));
}
public function countArticles()
{
return $this->articles->querySingle('SELECT COUNT(*) FROM articles;');
}
public function getArticleFromURI($uri)
{
return $this->articles->querySingle('SELECT * FROM articles WHERE uri = \''.$this->articles->escapeString($uri).'\';', true);
}
public function sql_countintegers($in)
{
return substr_count($in, ' ');
}
public function searchArticles($query)
{
$res = $this->articles->query('SELECT id, uri, title, content
FROM articles
WHERE content LIKE \'%'.$this->articles->escapeString($query).'%\'
ORDER BY id DESC
LIMIT 0,100;');
$out = array();
while ($row = $res->fetchArray(SQLITE3_ASSOC))
{
$row['url'] = $this->getLocalURL($this->articles->querySingle('SELECT uri FROM articles WHERE id = \''.(int)$row['id'].'\';'));
$out[] = $row;
}
return $out;
}
public function mirrorMediasForArticle($content, $url)
{
if (!file_exists(MEDIA_DIR))
{
mkdir(MEDIA_DIR);
}
$schemes = array('http', 'https');
$extensions = explode(',', preg_quote('jpg,jpeg,png,apng,gif,svg,pdf,odt,ods,epub,webp,wav,mp3,ogg,aac,wma,flac,opus,mp4,webm', '!'));
$extensions = implode('|', $extensions);
$from = parse_url($url);
if( isset($from['path']) ) { // not exist if http://exemple.com
$from['path'] = preg_replace('![^/]*$!', '', $from['path']);
}else{
$from['path'] = '';
}
preg_match_all('!(src|href)\s*=\s*[\'"]?([^"\'<>\s]+\.(?:'.$extensions.'))[\'"]?!i', $content, $match, PREG_SET_ORDER);
foreach ($match as $m)
{
$url = parse_url($m[2]);
if (empty($url['scheme']))
$url['scheme'] = $from['scheme'];
if (empty($url['host']))
$url['host'] = $from['host'];
if (!in_array(strtolower($url['scheme']), $schemes))
continue;
if ($url['path'][0] != '/')
$url['path'] = $from['path'] . $url['path'];
$filename = basename($url['path']);
$url = $url['scheme'] . '://' . $url['host'] . $url['path'];
$filename = substr(sha1($url), -8) . '.' . substr(preg_replace('![^\w\d_.-]!', '', $filename), -64);
$copied = false;
if (!file_exists(MEDIA_DIR . '/' . $filename))
{
try {
$copied = $this->_copy($url, MEDIA_DIR . '/' . $filename);
}
catch (ErrorException $e)
{
// Ignore copy errors
}
}
$content = str_replace($m[0], $m[1] . '="'.'media/'.$filename.'" data-original-source="'.$url.'"', $content);
}
return $content;
}
/* copy() is buggy with http streams and safe_mode enabled (which is bad), so here's a workaround */
protected function _copy($from, $to)
{
$in = fopen($from, 'r', false, $this->_getStreamContext());
$out = fopen($to, 'w', false);
$size = stream_copy_to_stream($in, $out);
fclose($in);
fclose($out);
return $size;
}
}
// DISPLAY AND CONTROLLERS
$vvb = new VroumVroum_Blog;
$config = $vvb->config;
$site_type = escape($config->site_type);
if (isset($_GET['feed'])) // FEED
{
header('Content-Type: application/atom+xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xml:lang="fr-FR">
<title type="text">'.escape($config->site_title).'</title>
<subtitle type="text">'.escape(html_entity_decode(strip_tags($config->site_description), ENT_COMPAT, 'UTF-8')).'</subtitle>
<updated>'.date(DATE_ATOM, filemtime(ARTICLES_DB_FILE)).'</updated>
<link rel="alternate" type="text/html" href="'.str_replace('?feed./', '', LOCAL_URL).'" />
<id>'.LOCAL_URL.'</id>
<link rel="self" type="application/atom+xml" href="'.LOCAL_URL.'" />
<generator uri="https://github.com/mitsukarenai/Projet-Autoblog" version="3">Projet Autoblog</generator>';
foreach($vvb->listLastArticles() as $art)
{
echo '
<entry>
<author>
<name>'.escape($config->site_title).'</name>
<uri>'.escape($config->site_url).'</uri>
</author>
<title type="html"><![CDATA['.escape($art['title']).']]></title>
<link rel="alternate" type="text/html" href="'.str_replace('?feed', '?', LOCAL_URL).urlencode(str_replace('./?', '', $vvb->getLocalURL($art))).'" />
<id>'.str_replace('?feed', '?', LOCAL_URL).urlencode(str_replace('./?', '', $vvb->getLocalURL($art))).'</id>
<updated>'.date(DATE_ATOM, $art['date']).'</updated>
<content type="html">
<![CDATA[(<a href="'.escape($art['feed_id']).'">source</a>)<br />'.escape_content($art['content']).']]>
</content>
</entry>';
}
echo '
</feed>';
exit;
}
if (isset($_GET['opml'])) // OPML
{
//header('Content-Type: application/octet-stream');
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="'.escape($config->site_title).'.xml"');
$opmlfile = new SimpleXMLElement('<opml></opml>');
$opmlfile->addAttribute('version', '1.0');
$opmlhead = $opmlfile->addChild('head');
$opmlhead->addChild('title', escape($config->site_title));
$opmlhead->addChild('dateCreated', date('r', time()));
$opmlbody = $opmlfile->addChild('body');
$outline = $opmlbody->addChild('outline');
$outline->addAttribute('title', escape($config->site_title));
$outline->addAttribute('text', escape($config->site_type));
$outline->addAttribute('htmlUrl', escape($config->site_url));
$outline->addAttribute('xmlUrl', escape($config->feed_url));
echo $opmlfile->asXML();
exit;
}
if (isset($_GET['media'])) // MEDIA
{
header('Content-Type: application/json');
if(is_dir(MEDIA_DIR))
{
$url = str_replace('?media', 'media/', LOCAL_URL);
$files = scandir(MEDIA_DIR);
unset($files[0]); // .
unset($files[1]); // ..
echo json_encode(array("url"=> $url, "files" => $files));
}
exit;
}
if (isset($_GET['update']))
{
$_SERVER['QUERY_STRING'] = '';
}
// CONTROLLERS
$search = !empty($_GET['q']) ? trim($_GET['q']) : '';
$article = null;
if (!$search && !empty($_SERVER['QUERY_STRING']) && !is_numeric($_SERVER['QUERY_STRING']))
{
$uri = rawurldecode($_SERVER['QUERY_STRING']);
$article = $vvb->getArticleFromURI($uri);
if (!$article)
{
header('HTTP/1.1 404 Not Found', true, 404);
}
}
// common CSS
$css=' * { margin: 0; padding: 0; }
body { font-family:sans-serif; background-color: #efefef; padding: 1%; color: #333; }
img { max-width: 100%; height: auto; }
a { text-decoration: none; color: #000;font-weight:bold; }
.header a { text-decoration: none; color: #000;font-weight:bold; }
.header { text-align:center; padding: 30px 3%; max-width:70em;margin:0 auto; }
.article .title { margin-bottom: 1em; }
.article .title h2 a:hover { color:#403976; }
.article h4 { font-weight: normal; font-size: small; color: #666; }
.article .source a { color: #666; }
.searchForm { float:right; }
.searchForm input { }
.pagination { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; }
.pagination b { font-size: 1.2em; color: #333; }
.pagination a { color:#000; margin: 0 0.5em; }
.pagination a:hover { color:#333; }
.footer a { color:#000; }
.footer a:hover { color:#333; }
.content ul, .content ol { margin-left: 2em; }
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6,
.content ul, .content ol, .content p, .content object, .content div, .content blockquote,
.content dl, .content pre { margin-bottom: 0.8em; }
.content pre, .content blockquote { background: #ddd; border: 1px solid #999; padding: 0.2em; max-width: 100%; overflow: auto; }
.content h1 { font-size: 1.5em; }
.content h2 { font-size: 1.4em;color:#000; }
.result h3 a { color: darkblue; text-decoration: none; text-shadow: 1px 1px 1px #fff; }
#error { position: fixed; top: 0; left: 0; right: 0; padding: 1%; background: #fff; border-bottom: 2px solid red; color: darkred; }
';
if($site_type == 'generic') // custom CSS for generic
{
$css = $css.'.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px;text-transform:uppercase; }
.article .title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; }
.article .title h2 a { color:#000; text-decoration:none; }
.article .source { font-size: 0.8em; color: #666; }
.article { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; }
.footer { text-align:center; font-size: small; color:#333; clear: both; }';
}
else if($site_type == 'microblog' || $site_type == 'twitter' || $site_type == 'identica') // custom CSS for microblog
{
$css = $css.'.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; }
.article .title h2 { width: 10em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 0.7em;margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; }
.article .title h2 a { color:#333; text-decoration:none; }
.article { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:0 auto;box-shadow:0px 5px 7px #aaa; }
.article .source { font-size: 0.8em; color: #666; }
.footer { margin-top:1em;text-align:center; font-size: small; color:#333; clear: both; }
.content {font-size:0.9em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}';
}
else if($site_type == 'shaarli') // custom CSS for shaarli
{
$css = $css.'.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; }
.article .title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; }
.article .title h2 a { color:#000; text-decoration:none; }
.article { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; }
.article .source { margin-top:1em;font-size: 0.8em; color: #666; }
.footer { text-align:center; font-size: small; color:#333; clear: both; }';
}
// HTML HEADER
echo '
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>'.escape($config->site_title).'</title>
<link rel="canonical" href="'.escape($config->site_url).'">
<link rel="alternate" type="application/atom+xml" title="'.__('ATOM Feed').'" href="?feed">
<style type="text/css" media="screen,projection">
'.$css.'
</style>
</head>
<body>
<div class="header">
<h1><a href="../../" style="font-size:0.8em;">PROJET AUTOBLOG'. (strlen(HEAD_TITLE) > 0 ? ' ~ '. HEAD_TITLE : '') .'</a></h1>
<hr>
<h1><a href="./">'.escape($config->site_title).'</a></h1>';
if (!empty($config->site_description))
echo '<p>'.$config->site_description.'<br><a href="../../">&lArr; retour index</a></p>';
echo '
<form method="get" action="'.escape(LOCAL_URL).'" class="searchForm">
<div>
<input type="text" name="q" value="'.escape($search).'">
<input type="submit" value="'.__('Search').'">
</div>
</form>
</div>
';
if ($vvb->mustUpdate())
{
echo '
<div class="article">
<div class="title">
<h2>'.__('Update').'</h2>
</div>
<div class="content" id="update">
'.__('Updating database... Please wait.').'
</div>
</div>';
}
if (!empty($search))
{
$results = $vvb->searchArticles($search);
$text = sprintf(__('<b>%d</b> results for <i>%s</i>'), count($results), escape($search));
echo '
<div class="article">
<div class="title">
<h2>'.__('Search').'</h2>
'.$text.'
</div>
</div>';
foreach ($results as $art)
{
echo '
<div class="article result">
<h3><a href="./?'.escape($art['uri']).'">'.escape($art['title']).'</a></h3>
<p>'.$art['content'].'</p>
</div>';
}
}
elseif (!is_null($article))
{
if (!$article)
{
echo '
<div class="article">
<div class="title">
<h2>'.__('Not Found').'</h2>
'.(!empty($uri) ? '<p><tt>'.escape($vvb->getLocalURL($uri)) . '</tt></p>' : '').'
'.__('Article not found.').'
</div>
</div>';
}
else
{
display_article($article);
}
}
else
{
if (!empty($_SERVER['QUERY_STRING']) && is_numeric($_SERVER['QUERY_STRING']))
$page = (int) $_SERVER['QUERY_STRING'];
else
$page = 1;
$list = $vvb->listArticlesByPage($page);
foreach ($list as $article)
{
display_article($article);
}
$max = $vvb->countArticles();
if ($max > $config->articles_per_page)
{
echo '<div class="pagination">';
if ($page > 1)
echo '<a href="'.$vvb->getLocalURL($page - 1).'">&larr; '.__('Newer').'</a> ';
$last = ceil($max / $config->articles_per_page);
for ($i = 1; $i <= $last; $i++)
{
echo '<a href="'.$vvb->getLocalURL($i).'">'.($i == $page ? '<b>'.$i.'</b>' : $i).'</a> ';
}
if ($page < $last)
echo '<a href="'.$vvb->getLocalURL($page + 1).'">'.__('Older').' &rarr;</a> ';
echo '</div>';
}
}
echo '
<div class="footer">
<p>Propulsé par <a href="https://github.com/mitsukarenai/Projet-Autoblog">Projet Autoblog '.$vvbversion.'</a> - <a href="?feed">'.__('ATOM Feed').'</a></p>
<p>'.__('Download:').' <a href="./'.basename(CONFIG_FILE).'">'.__('configuration').'</a> (<a href="?opml">OPML</a>)
- <a href="./'.basename(ARTICLES_DB_FILE).'">'.__('articles').'</a><p/>
<p><a href="./?media">'.__('Media export').' <sup> JSON</sup></a></p>
</div>';
if ($vvb->mustUpdate())
{
try {
ob_end_flush();
flush();
}
catch (Exception $e)
{
// Silent, not critical
}
try {
$updated = $vvb->update();
}
catch (VroumVroum_Feed_Exception $e)
{
echo '
<div id="error">
'.escape($e->getMessage()).'
</div>';
$updated = 0;
}
if ($updated > 0)
{
echo '
<script type="text/javascript">
window.onload = function () {
document.getElementById("update").innerHTML = "'.__('Update complete!').' <a href=\\"#reload\\" onclick=\\"window.location.reload();\\">'.__('Click here to reload this webpage.').'</a>";
};
</script>';
}
else
{
echo '
<script type="text/javascript">
window.onload = function () {
document.body.removeChild(document.getElementById("update").parentNode);
};
</script>';
}
}
echo '
</body>
</html>';
function escape_content($str)
{
$str = preg_replace('!<\s*(style|script|link)!', '&lt;\\1', $str);
$str = str_replace('="media/', '="./media/', $str);
return $str;
}
// ARTICLE HTML CODE
function display_article($article)
{
global $vvb, $config;
echo '
<div class="article">
<div class="title">
<h2><a href="'.$vvb->getLocalURL($article).'">'.escape($article['title']).'</a></h2>
'.strftime(__('_date_format'), $article['date']).'
</div>
<div class="content">'.escape_content($article['content']).'</div>
<p class="source">'.__('Source:').' <a href="'.escape($article['url']).'">'.escape($article['url']).'</a></p>
<br style="clear: both;" />
</div>';
}
?>

View file

@ -1,277 +0,0 @@
<?php
/**
* class_rssfeed.php uses:
* RSSFeed: This class has methods for making a RSS 2.0 feed.
* RSSMerger: This class has the ability to merge different RSS feeds and sort them after the date the feed items were posted.
* @author David Laurell <david.laurell@gmail.com>
*
* + 03/2013
* Few changes, AutoblogRSS and FileRSSFeed
* @author Arthur Hoaro <http://hoa.ro>
*/
class RSSFeed {
protected $xml;
/**
* Construct a RSS feed
*/
public function __construct() {
$template = <<<END
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
</channel>
</rss>
END;
$this->xml = new SimpleXMLElement($template);
}
/**
* Set RSS Feed headers
* @param $title the title of the feed
* @param $link link to the website where you can find the RSS feed
* @param $description a description of the RSS feed
* @param $rsslink the link to this RSS feed
*/
public function setHeaders($title, $link, $description, $rsslink) {
$atomlink = $this->xml->channel->addChild("atom:link","","http://www.w3.org/2005/Atom");
$atomlink->addAttribute("href",$rsslink);
$atomlink->addAttribute("rel","self");
$atomlink->addAttribute("type","application/rss+xml");
$this->xml->channel->title = $title;
$this->xml->channel->link = $link;
$this->xml->channel->description = $description;
}
/**
* Set the language of the RSS feed
* @param $lang the language of the RSS feed
*/
public function setLanguage($lang) {
$this->xml->channel->addChild("language",$lang);
}
/**
* Adds a picture to the RSS feed
* @param $url URL to the image
* @param $title The image title. Usually same as the RSS feed's title
* @param $link Where the image should link to. Usually same as the RSS feed's link
*/
public function setImage($url, $title, $link) {
$image = $this->xml->channel->addChild("image");
$image->url = $url;
$image->title = $title;
$image->link = $link;
}
/**
* Add a item to the RSS feed
* @param $title The title of the RSS feed
* @param $link Link to the item's url
* @param $description The description of the item
* @param $author The author who wrote this item
* @param $guid Unique ID for this post
* @param $timestamp Unix timestamp for making a date
*/
public function addItem($title, $link, $description, $author, $guid, $timestamp) {
$item = $this->xml->channel->addChild("item");
$item->title = $title;
$item->description = $description;
$item->link = $link;
$item->guid = $guid;
if( isset($guid['isPermaLink']))
$item->guid['isPermaLink'] = $guid['isPermaLink'];
if( !empty( $author) )
$item->author = $author;
$item->pubDate = date(DATE_RSS,intval($timestamp));
}
/**
* Displays the RSS feed
*/
public function displayXML() {
header('Content-type: application/rss+xml; charset=utf-8');
echo $this->xml->asXML();
exit;
}
public function getXML() {
return $this->xml;
}
}
class RSSMerger {
private $feeds = array();
/**
* Constructs a RSSmerger object
*/
function __construct() {
}
/**
* Populates the feeds array from the given url which is a rss feed
* @param $url
*/
function add($xml) {
foreach($xml->channel->item as $item) {
$item->sitetitle = $xml->channel->title;
$item->sitelink = $xml->channel->link;
preg_match("/^[A-Za-z]{3}, ([0-9]{2}) ([A-Za-z]{3}) ([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2}) ([\+|\-]?[0-9]{4})$/", $item->pubDate, $match);
$item->time = time($match[4]+($match[6]/100),$match[5],$match[6],date("m",strtotime($match[2])),$match[1],$match[3]);
$this->feeds[] = $item;
}
}
/**
* Comparing function for sorting the feeds
* @param $value1
* @param $value2
*/
function feeds_cmp($value1,$value2) {
if(intval($value1->time) == intval($value2->time))
return 0;
return (intval($value1->time) < intval($value2->time)) ? +1 : -1;
}
/**
* Sorts the feeds array using the Compare function feeds_cmp
*/
function sort() {
usort($this->feeds,Array("RssMerger","feeds_cmp"));
}
/**
* This function return the feed items.
* @param $limit how many feed items that should be returned
* @return the feeds array
*/
function getFeeds($limit) {
return array_slice($this->feeds,0,$limit);
}
}
class FileRSSFeed extends RSSFeed {
protected $filename;
public function __construct($filename) {
parent::__construct();
$this->filename = $filename;
$this->load();
}
public function load() {
if ( file_exists( $this->filename )) {
$this->xml = simplexml_load_file($this->filename);
}
}
public function create($title, $link, $description, $rsslink) {
parent::setHeaders($title, $link, $description, $rsslink);
$this->write();
}
public function addItem($title, $link, $description, $author, $guid, $timestamp) {
parent::addItem($title, $link, $description, $author, $guid, $timestamp);
$this->write();
}
private function write() {
if ( file_exists( $this->filename )) {
unlink($this->filename);
}
$outputXML = new RSSFeed();
foreach($this->xml->channel->item as $f) {
$item = $outputXML->addItem($f->title,$f->link,$f->description,$f->author,$f->guid, strtotime($f->pubDate));
}
$merger = new RssMerger();
$merger->add($outputXML->getXML());
$merger->sort();
unset($this->xml->channel->item);
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(), LOCK_EX );
}
}
class AutoblogRSS extends FileRSSFeed {
public function __construct($filename) {
parent::__construct($filename);
}
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;
parent::addItem( 'L\'autoblog "'. $title.'" est indisponible', $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@'.$_SERVER['SERVER_NAME'],
$autobHref,
time()
);
}
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;
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>
Folder: '. $folder ,
'admin@'.$_SERVER['SERVER_NAME'],
$autobHref,
time()
);
}
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;
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>
RSS: <a href="'.$rssurl.'">'.$rssurl.'</a><br>
Folder: '. $folder ,
'admin@'.$_SERVER['SERVER_NAME'],
$autobHref,
time()
);
}
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;
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@'.$_SERVER['SERVER_NAME'],
$autobHref,
time()
);
}
}
?>

View file

@ -1,43 +0,0 @@
<?php
/**
* config.php - User configuration file
* ---
* If you uncomment a setting in this file, it will override default option
*
* See how to configure your Autoblog farm at
* https://github.com/mitsukarenai/Projet-Autoblog/wiki/Configuration
**/
// define( 'LOGO', 'icon-logo.svg' );
// define( 'HEAD_TITLE', '');
// define( 'FOOTER', 'D\'après les premières versions de <a href="http://sebsauvage.net">SebSauvage</a> et <a href="http://bohwaz.net/">Bohwaz</a>.');
// define( 'ALLOW_FULL_UPDATE', TRUE );
// define( 'ALLOW_CHECK_UPDATE', TRUE );
/**
* If you set ALLOW_NEW_AUTOBLOGS to FALSE, the following options do not matter.
**/
// define( 'ALLOW_NEW_AUTOBLOGS', TRUE );
// 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 );
/**
* More about TwitterBridge : https://github.com/mitsukarenai/twitterbridge
**/
// define( 'API_TWITTER', FALSE );
/**
* 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',
);
?>

View file

@ -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.

View file

@ -1,302 +0,0 @@
<?php
/**
* DO NOT EDIT THESE LINES
* You can override these options by setting them in config.php
**/
if(!defined('ROOT_DIR'))
{
define('ROOT_DIR', dirname($_SERVER['SCRIPT_FILENAME']));
}
define('LOCAL_URI', '');
if (!defined('AUTOBLOGS_FOLDER')) define('AUTOBLOGS_FOLDER', './autoblogs/');
if (!defined('DOC_FOLDER')) define('DOC_FOLDER', './docs/');
if (!defined('RESOURCES_FOLDER')) define('RESOURCES_FOLDER', './resources/');
if (!defined('RSS_FILE')) define('RSS_FILE', RESOURCES_FOLDER.'rss.xml');
date_default_timezone_set('Europe/Paris');
setlocale(LC_TIME, 'fr_FR.UTF-8', 'fr_FR', 'fr');
if( !defined('ALLOW_FULL_UPDATE')) define( 'ALLOW_FULL_UPDATE', TRUE );
if( !defined('ALLOW_CHECK_UPDATE')) define( 'ALLOW_CHECK_UPDATE', TRUE );
// If you set ALLOW_NEW_AUTOBLOGS to FALSE, the following options do not matter.
if( !defined('ALLOW_NEW_AUTOBLOGS')) define( 'ALLOW_NEW_AUTOBLOGS', TRUE );
if( !defined('ALLOW_NEW_AUTOBLOGS_BY_LINKS')) define( 'ALLOW_NEW_AUTOBLOGS_BY_LINKS', TRUE );
if( !defined('ALLOW_NEW_AUTOBLOGS_BY_SOCIAL')) define( 'ALLOW_NEW_AUTOBLOGS_BY_SOCIAL', TRUE );
if( !defined('ALLOW_NEW_AUTOBLOGS_BY_BUTTON')) define( 'ALLOW_NEW_AUTOBLOGS_BY_BUTTON', TRUE );
if( !defined('ALLOW_NEW_AUTOBLOGS_BY_OPML_FILE')) define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML_FILE', TRUE );
if( !defined('ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK')) define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK', TRUE );
if( !defined('ALLOW_NEW_AUTOBLOGS_BY_XSAF')) define( 'ALLOW_NEW_AUTOBLOGS_BY_XSAF', TRUE );
// More about TwitterBridge : https://github.com/mitsukarenai/twitterbridge
if( !defined('API_TWITTER')) define( 'API_TWITTER', FALSE );
if( !defined('LOGO')) define( 'LOGO', 'icon-logo.svg' );
if( !defined('HEAD_TITLE')) define( 'HEAD_TITLE', '');
if( !defined('FOOTER')) define( 'FOOTER', 'D\'après les premières versions de <a href="http://sebsauvage.net">SebSauvage</a> et <a href="http://bohwaz.net/">Bohwaz</a>.');
// Functions
function NoProtocolSiteURL($url) {
$protocols = array("http://", "https://");
$siteurlnoproto = str_replace($protocols, "", $url);
// Remove the / at the end of string
if ( $siteurlnoproto[strlen($siteurlnoproto) - 1] == '/' )
$siteurlnoproto = substr($siteurlnoproto, 0, -1);
// Remove index.php/html at the end of string
if( strpos($url, 'index.php') || strpos($url, 'index.html') ) {
$siteurlnoproto = preg_replace('#(.*)/index\.(html|php)$#', '$1', $siteurlnoproto);
}
return $siteurlnoproto;
}
function DetectRedirect($url)
{
if(parse_url($url, PHP_URL_HOST)==FALSE) {
//die('Not a URL');
throw new Exception('Not a URL: '. escape ($url) );
}
$response = get_headers($url, 1);
if(!empty($response['Location'])) {
$response2 = get_headers($response['Location'], 1);
if(!empty($response2['Location'])) {
//die('too much redirection');
throw new Exception('too much redirection: '. escape ($url) );
}
else { return $response['Location']; }
}
else {
return $url;
}
}
function urlToFolder($url) {
return sha1(NoProtocolSiteURL($url));
}
function urlToFolderSlash($url) {
return sha1(NoProtocolSiteURL($url).'/');
}
function folderExists($url) {
return file_exists(AUTOBLOGS_FOLDER . urlToFolder($url)) || file_exists(AUTOBLOGS_FOLDER . urlToFolderSlash($url));
}
function escape($str) {
return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false);
}
function createAutoblog($type, $sitename, $siteurl, $rssurl, $error = array()) {
if( $type == 'generic' || empty( $type )) {
$var = updateType( $siteurl );
$type = $var['type'];
if( !empty( $var['name']) ) {
if( !stripos($siteurl, $var['name'] === false) )
$sitename = ucfirst($var['name']) . ' - ' . $sitename;
}
}
if(folderExists($siteurl)) {
$error[] = 'Erreur : l\'autoblog '. $sitename .' existe déjà.';
return $error;
}
$foldername = AUTOBLOGS_FOLDER . urlToFolderSlash($siteurl);
if ( mkdir($foldername, 0755, false) ) {
/**
* RSS
**/
try { // à déplacer après la tentative de création de l'autoblog crée avec succès ?
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, "<?php require_once '../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="'. getArticlesPerPage( $type ) .'"
UPDATE_INTERVAL="'. getInterval( $type ) .'"
UPDATE_TIMEOUT="'. getTimeout( $type ) .'"') )
$error[] = "Impossible d'écrire le fichier vvb.ini";
fclose($fp);
}
else
$error[] = "Impossible de créer le répertoire.";
updateXML('new_autoblog_added', 'new', $foldername, $sitename, $siteurl, $rssurl); /* éventuellement une conditionnelle ici: if(empty($error)) ? */
return $error;
}
function getArticlesPerPage( $type ) {
switch( $type ) {
case 'microblog':
return 20;
case 'shaarli':
return 20;
default:
return 5;
}
}
function getInterval( $type ) {
switch( $type ) {
case 'microblog':
return 300;
case 'shaarli':
return 1800;
default:
return 3600;
}
}
function getTimeout( $type ) {
switch( $type ) {
case 'microblog':
return 30;
case 'shaarli':
return 30;
default:
return 30;
}
}
function updateType($siteurl) {
if( strpos($siteurl, 'twitter.com') !== FALSE ) {
return array('type' => 'twitter', 'name' => 'twitter');
}
elseif ( strpos( $siteurl, 'identi.ca') !== FALSE ) {
return array('type' => 'identica', 'name' => 'identica');
}
elseif( strpos( $siteurl, 'shaarli' ) !== FALSE ) {
return array('type' => 'shaarli', 'name' => 'shaarli');
}
else
return array('type' => 'generic', 'name' => '');
}
function debug($data)
{
echo '<pre>';
var_dump($data);
echo '</pre>';
}
function __($str)
{
switch ($str)
{
case 'Search':
return 'Recherche';
case 'Update':
return 'Mise à jour';
case 'Updating database... Please wait.':
return 'Mise à jour de la base de données, veuillez patienter...';
case '<b>%d</b> results for <i>%s</i>':
return '<b>%d</b> résultats pour la recherche <i>%s</i>';
case 'Not Found':
return 'Introuvable';
case 'Article not found.':
return 'Cet article n\'a pas été trouvé.';
case 'Older':
return 'Plus anciens';
case 'Newer':
return 'Plus récents';
case 'ATOM Feed':
return 'Flux ATOM';
case 'Update complete!':
return 'Mise à jour terminée !';
case 'Click here to reload this webpage.':
return 'Cliquez ici pour recharger cette page.';
case 'Source:':
return 'Source :';
case '_date_format':
return '%A %e %B %Y à %H:%M';
case 'configuration':
case 'articles':
return $str;
case 'Media export':
return 'Export fichiers media';
default:
return $str;
}
}
function updateXML($status, $response_code, $autoblog_url, $autoblog_title, $autoblog_sourceurl, $autoblog_sourcefeed)
{
$json = json_decode(file_get_contents(RESOURCES_FOLDER.'rss.json'), true);
$json[] = array(
'timestamp'=>time(),
'autoblog_url'=>$autoblog_url,
'autoblog_title'=>$autoblog_title,
'autoblog_sourceurl'=>$autoblog_sourceurl,
'autoblog_sourcefeed'=>$autoblog_sourcefeed,
'status'=>$status,
'response_code'=>$response_code
);
file_put_contents(RESOURCES_FOLDER.'rss.json', json_encode($json), LOCK_EX);
}
function displayXMLstatus_tmp($status, $response_code, $autoblog_url, $autoblog_title, $autoblog_sourceurl, $autoblog_sourcefeed) {
switch ($status)
{
case 'unavailable':
return 'Autoblog "'.$autoblog_title.'": site distant inaccessible (code '.$response_code.')<br>Autoblog: <a href="'. serverUrl(false).AUTOBLOGS_FOLDER.$autoblog_url.'">'.$autoblog_title.'</a><br>Site: <a href="'. $autoblog_sourceurl .'">'. $autoblog_sourceurl .'</a><br>RSS: <a href="'.$autoblog_sourcefeed.'">'.$autoblog_sourcefeed.'</a>';
case 'moved':
return 'Autoblog "'.$autoblog_title.'": site distant redirigé (code '.$response_code.')<br>Autoblog: <a href="'. serverUrl(false).AUTOBLOGS_FOLDER.$autoblog_url.'">'.$autoblog_title.'</a><br>Site: <a href="'. $autoblog_sourceurl .'">'. $autoblog_sourceurl .'</a><br>RSS: <a href="'.$autoblog_sourcefeed.'">'.$autoblog_sourcefeed.'</a>';
case 'not_found':
return 'Autoblog "'.$autoblog_title.'": site distant introuvable (code '.$response_code.')<br>Autoblog: <a href="'. serverUrl(false).AUTOBLOGS_FOLDER.$autoblog_url.'">'.$autoblog_title.'</a><br>Site: <a href="'. $autoblog_sourceurl .'">'. $autoblog_sourceurl .'</a><br>RSS: <a href="'.$autoblog_sourcefeed.'">'.$autoblog_sourcefeed.'</a>';
case 'remote_error':
return 'Autoblog "'.$autoblog_title.'": site distant a problème serveur (code '.$response_code.')<br>Autoblog: <a href="'. serverUrl(false).AUTOBLOGS_FOLDER.$autoblog_url.'">'.$autoblog_title.'</a><br>Site: <a href="'. $autoblog_sourceurl .'">'. $autoblog_sourceurl .'</a><br>RSS: <a href="'.$autoblog_sourcefeed.'">'.$autoblog_sourcefeed.'</a>';
case 'available':
return 'Autoblog "'.$autoblog_title.'": site distant à nouveau opérationnel (code '.$response_code.')<br>Autoblog: <a href="'. serverUrl(false).AUTOBLOGS_FOLDER.$autoblog_url.'">'.$autoblog_title.'</a><br>Site: <a href="'. $autoblog_sourceurl .'">'. $autoblog_sourceurl .'</a><br>RSS: <a href="'.$autoblog_sourcefeed.'">'.$autoblog_sourcefeed.'</a>';
case 'new_autoblog_added':
return 'Autoblog "'.$autoblog_title.'" ajouté (code '.$response_code.')<br>Autoblog: <a href="'. serverUrl(false).AUTOBLOGS_FOLDER.$autoblog_url.'">'.$autoblog_title.'</a><br>Site: <a href="'. $autoblog_sourceurl .'">'. $autoblog_sourceurl .'</a><br>RSS: <a href="'.$autoblog_sourcefeed.'">'.$autoblog_sourcefeed.'</a>';
}
}
function displayXML_tmp() {
header('Content-type: application/rss+xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><link>'.serverUrl(true).'</link>';
echo '<atom:link href="'.serverUrl(false) . '/?rss_tmp" rel="self" type="application/rss+xml"/><title>Projet Autoblog'. ((strlen(HEAD_TITLE)>0) ? ' | '. HEAD_TITLE : '').'</title><description>'.serverUrl(true),"Projet Autoblog - RSS : Ajouts et changements de disponibilité.".'</description>';
if(file_exists(RESOURCES_FOLDER.'rss.json'))
{
$json = json_decode(file_get_contents(RESOURCES_FOLDER.'rss.json'), true);
foreach ($json as $item)
{
$description = displayXMLstatus_tmp($item['status'],$item['response_code'],$item['autoblog_url'],$item['autoblog_title'],$item['autoblog_sourceurl'],$item['autoblog_sourcefeed']);
$link = serverUrl(true).AUTOBLOGS_FOLDER.$item['autoblog_url'];
$date = date("r", $item['timestamp']);
print <<<EOT
<item>
<title>{$item['autoblog_title']}</title>
<description><![CDATA[{$description}]]></description>
<link>{$link}</link>
<guid isPermaLink="false">{$item['timestamp']}</guid>
<author>admin@{$_SERVER['SERVER_NAME']}</author>
<pubDate>{$date}</pubDate>
</item>
EOT;
}
}
echo '</channel></rss>';
}
?>

View file

@ -1,926 +0,0 @@
<?php
/*
Projet Autoblog 0.3-beta
Code: https://github.com/mitsukarenai/Projet-Autoblog
Authors:
Mitsu https://www.suumitsu.eu/
Oros https://www.ecirtam.net/
Arthur Hoaro http://hoa.ro
License: Public Domain
Instructions:
(by default, autoblog creation is allowed: you can set this to "FALSE" in config.php)
(by default, Cross-Site Autoblog Farming [XSAF] imports a few autoblogs from https://github.com/mitsukarenai/xsaf-bootstrap/blob/master/3.json you can uncomment and add xsafimports in xsaf3.php (jump at end of file) )
(by default, database and media transfer via XSAF is allowed)
- upload all files on your server (PHP 5.3+ required)
- PROFIT !
*/
define('XSAF_VERSION', 3);
define('ROOT_DIR', __DIR__);
$error = array();
$success = array();
if(file_exists("config.php")){
require_once "config.php";
}else{
$error[] = "config.php not found !";
}
if(file_exists("functions.php")){
require_once "functions.php";
}else{
echo "functions.php not found !";
die;
}
function get_title_from_feed($url) {
return get_title_from_datafeed(file_get_contents($url));
}
function get_title_from_datafeed($data) {
if($data === false) { return 'url inaccessible'; }
$dom = new DOMDocument;
$dom->loadXML($data) or die('xml malformé');
$title = $dom->getElementsByTagName('title');
return $title->item(0)->nodeValue;
}
function get_link_from_feed($url) {
return get_link_from_datafeed(file_get_contents($url));
}
function get_link_from_datafeed($data) {
if($data === false) { return 'url inaccessible'; }
$xml = simplexml_load_string($data); // quick feed check
// ATOM feed && RSS 1.0 /RDF && RSS 2.0
if (!isset($xml->entry) && !isset($xml->item) && !isset($xml->channel->item))
die('le flux n\'a pas une syntaxe valide');
$check = substr($data, 0, 5);
if($check !== '<?xml') {
die('n\'est pas un flux valide');
}
$xml = new SimpleXmlElement($data);
$channel['link'] = $xml->channel->link;
if($channel['link'] === NULL) {
$dom = new DOMDocument;
$dom->loadXML($data) or die('xml malformé');
$link = $dom->getElementsByTagName('uri');
return $link->item(0)->nodeValue;
}
else {
return $channel['link'];
}
}
function serverUrl($return_subfolder = false)
{
$https = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS'])=='on')) || $_SERVER["SERVER_PORT"]=='443'; // HTTPS detection.
$serverport = ($_SERVER["SERVER_PORT"]=='80' || ($https && $_SERVER["SERVER_PORT"]=='443') ? '' : ':'.$_SERVER["SERVER_PORT"]);
if($return_subfolder === true) {
$path = pathinfo( $_SERVER['PHP_SELF'] );
$subfolder = $path['dirname'] .'/';
} else $subfolder = '';
return 'http'.($https?'s':'').'://'.$_SERVER["SERVER_NAME"].$serverport.$subfolder;
}
function objectCmp($a, $b) {
return strcasecmp ($a->site_title, $b->site_title);
}
function generate_antibot() {
$letters = array('zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf', 'vingt');
return $letters[mt_rand(1, 20)];
}
function check_antibot($number, $text_number) {
$letters = array('zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf', 'vingt');
return ( array_search( $text_number, $letters ) === intval($number) ) ? true : false;
}
function create_from_opml($opml) {
global $error, $success;
foreach( $opml->body->outline as $outline ) {
if ( !empty( $outline['title'] ) && !empty( $outline['text'] ) && !empty( $outline['xmlUrl']) && !empty( $outline['htmlUrl'] )) {
try {
$rssurl = DetectRedirect(escape( $outline['xmlUrl']));
$sitename = escape( $outline['title'] );
$siteurl = escape($outline['htmlUrl']);
$sitetype = escape($outline['text']); if ( $sitetype == 'generic' or $sitetype == 'microblog' or $sitetype == 'shaarli') { } else { $sitetype = 'generic'; }
$error = array_merge( $error, createAutoblog( $sitetype, $sitename, $siteurl, $rssurl, $error ) );
if( empty ( $error ))
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. AUTOBLOGS_FOLDER . urlToFolderSlash( $siteurl ) .'/index.php"></iframe>Autoblog "'. $sitename .'" crée avec succès. &rarr; <a target="_blank" href="'. AUTOBLOGS_FOLDER . urlToFolderSlash( $siteurl ) .'">afficher l\'autoblog</a>.';
}
catch (Exception $e) {
$error[] = $e->getMessage();
}
}
}
}
/**
* Simple version check
**/
function versionCheck() {
$versionfile = 'version';
$lastestUrl = 'https://raw.github.com/mitsukarenai/Projet-Autoblog/master/0.3/version';
$expire = time() - 84600 ; // 23h30 en secondes
$lockfile = '.versionlock';
if (file_exists($lockfile) && filemtime($lockfile) > $expire) {
if( file_get_contents($lockfile) == 'NEW' ) {
// No new version installed
if( filemtime( $lockfile ) > filemtime( $versionfile ) )
return true;
else unlink($lockfile);
}
else return false;
}
if (file_exists($lockfile) && filemtime($lockfile) < $expire) { unlink($lockfile); }
if( file_get_contents($versionfile) != file_get_contents($lastestUrl) ) {
file_put_contents($lockfile, 'NEW');
return true;
}
file_put_contents($lockfile, '.');
return false;
}
$update_available = (ALLOW_CHECK_UPDATE) ? versionCheck() : false;
/**
* RSS Feed
**/
if( !file_exists(RSS_FILE)) {
require_once('class_rssfeed.php');
$rss = new AutoblogRSS(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');
$rss = new AutoblogRSS(RSS_FILE);
$rss->displayXML();
die;
}
if( !file_exists(RESOURCES_FOLDER.'rss.json')) {
file_put_contents(RESOURCES_FOLDER.'rss.json', '', LOCK_EX);
}
if (isset($_GET['rss_tmp'])) {
displayXML_tmp();
die;
}
/**
* SVG
**/
if (isset($_GET['check']))
{
//echo "1";
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_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_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_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>';
$errorlog="./".escape( $_GET['check'] ) ."/error.log";
$oldvalue = null;
if(file_exists($errorlog)) { $oldvalue = file_get_contents($errorlog); };
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(filesize($errorlog) == "0") {die($svg_vert);}
else if(filesize($errorlog) == "1") {die($svg_jaune);}
else {die($svg_rouge);}
}
else /* ..sinon, lancer la procédure de contrôle */
{
$ini = parse_ini_file("./". escape( $_GET['check'] ) ."/vvb.ini") or die;
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_TYPE']), 'microblog') !== FALSE) { die($svg_statusnet); } /* Statusnet */
$headers = get_headers($ini['FEED_URL']);
/* le flux est indisponible (typiquement: erreur DNS ou possible censure) - à vérifier */
if(empty($headers) || $headers === FALSE ) {
if( $oldvalue !== null && $oldvalue != '..' ) {
require_once('class_rssfeed.php');
$rss = new AutoblogRSS(RSS_FILE);
$rss->addUnavailable($ini['SITE_TITLE'], escape($_GET['check']), $ini['SITE_URL'], $ini['FEED_URL']);
updateXML('unavailable', 'nxdomain', escape($_GET['check']), $ini['SITE_TITLE'], $ini['SITE_URL'], $ini['FEED_URL']);
}
file_put_contents($errorlog, '..');
die($svg_rouge);
}
$code=explode(" ", $headers[0]);
/* code retour 200: flux disponible */
if($code[1] == "200") {
if( $oldvalue !== null && $oldvalue != '' ) {
require_once('class_rssfeed.php');
$rss = new AutoblogRSS(RSS_FILE);
$rss->addAvailable($ini['SITE_TITLE'], escape($_GET['check']), $ini['SITE_URL'], $ini['FEED_URL']);
updateXML('available', '200', escape($_GET['check']), $ini['SITE_TITLE'], $ini['SITE_URL'], $ini['FEED_URL']);
}
file_put_contents($errorlog, '');
die($svg_vert);
}
/* autre code retour: un truc a changé (redirection, changement de CMS, .. bref vvb.ini doit être corrigé) */
else {
if( $oldvalue !== null && $oldvalue != '.' ) {
require_once('class_rssfeed.php');
$rss = new AutoblogRSS(RSS_FILE);
$rss->addCodeChanged($ini['SITE_TITLE'], escape($_GET['check']), $ini['SITE_URL'], $ini['FEED_URL'], $code[1]);
updateXML('moved', '3xx', escape($_GET['check']), $ini['SITE_TITLE'], $ini['SITE_URL'], $ini['FEED_URL']);
}
file_put_contents($errorlog, '.');
die($svg_jaune);
}
}
}
/**
* JSON Export
**/
if (isset($_GET['export'])) {
header('Content-Type: application/json');
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
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;
$type=$config->site_type;
$title=$config->site_title;
$url=$config->site_url;
$reponse[$unit] = array("SITE_TYPE"=>"$type", "SITE_TITLE"=>"$title", "SITE_URL"=>"$url", "FEED_URL"=>"$feed");
}
}
echo json_encode( array( "meta"=> array("xsaf-version"=>XSAF_VERSION,"xsaf-db_transfer"=>"true","xsaf-media_transfer"=>"true"),
"autoblogs"=>$reponse));
die;
}
/**
* JSON Allowed Twitter accounts export
**/
if (isset($_GET['export_twitter'])) {
header('Content-Type: application/json');
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
$response = array();
foreach($subdirs as $unit) {
if(is_dir($unit)) {
$unit=substr($unit, 2);
$ini = parse_ini_file($unit.'/vvb.ini');
if( $ini['SITE_TYPE'] == 'twitter' ) {
preg_match('#twitter\.com/(.+)#', $ini['SITE_URL'], $username);
$response[] = $username[1];
}
unset($ini);
}
}
echo json_encode( $response );
die;
}
/**
* OPML Full Export
**/
if (isset($_GET['exportopml'])) // OPML
{
//header('Content-Type: application/octet-stream');
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="autoblogs-'. $_SERVER['SERVER_NAME'] .'.xml"');
$opmlfile = new SimpleXMLElement('<opml></opml>');
$opmlfile->addAttribute('version', '1.0');
$opmlhead = $opmlfile->addChild('head');
$opmlhead->addChild('title', 'Autoblog OPML export from '. $_SERVER['SERVER_NAME'] );
$opmlhead->addChild('dateCreated', date('r', time()));
$opmlbody = $opmlfile->addChild('body');
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
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);
$outline = $opmlbody->addChild('outline');
$outline->addAttribute('title', escape($config->site_title));
$outline->addAttribute('text', escape($config->site_type));
$outline->addAttribute('htmlUrl', escape($config->site_url));
$outline->addAttribute('xmlUrl', escape($config->feed_url));
}
}
echo $opmlfile->asXML();
exit;
}
/**
* Site map
* NEW AUTOBLOG FOLDER - Need update
**/
if (isset($_GET['sitemap']))
{
header('Content-Type: application/xml');
$proto=(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?"https://":"http://";
echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
echo '<url><loc>'.$proto."{$_SERVER['HTTP_HOST']}".str_replace('?sitemap', '', $_SERVER['REQUEST_URI'])."</loc>\n";
echo '<lastmod>'.date('c', time())."</lastmod>\n";
echo '<changefreq>daily</changefreq></url>';
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
foreach($subdirs as $unit) {
if(is_dir($unit)) {
$unit=substr($unit, 2);
echo '<url><loc>'.$proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."</loc>\n";
echo '<lastmod>'.date('c', filemtime($unit))."</lastmod>\n";
echo '<changefreq>hourly</changefreq></url>';
}
}
echo '</urlset>';
die;
}
/**
* Update ALL autblogs (except .disabled)
* 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;
}
}
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
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');
}
}
}
}
$antibot = generate_antibot();
$form = '<form method="POST"><input type="hidden" name="generic" value="1" />
<input placeholder="Adresse du flux RSS/ATOM" type="text" name="rssurl" id="rssurl"><br>
<input placeholder="Antibot : Ecrivez '. $antibot .' en chiffre" type="text" name="number"><br>
<input type="hidden" name="antibot" value="'. $antibot .'" />
<input type="submit" value="Vérifier">
</form>';
/**
* ADD BY BOOKMARK BUTTON
**/
if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_BUTTON )
{
$form = '<html><head></head><body>';
if( empty($_GET['rssurl']) ) {
$form .= '<p>URL du flux RSS incorrect.<br><a href="#" onclick="window.close()">Fermer la fenêtre.</a></p>';
}
else {
if(isset($_GET['add']) && $_GET['add'] === '1' && !empty($_GET['siteurl']) && !empty($_GET['sitename'])) {
try {
$rssurl = DetectRedirect(escape($_GET['rssurl']));
$siteurl = escape($_GET['siteurl']);
$sitename = escape($_GET['sitename']);
$sitetype = updateType($siteurl); // Disabled input doesn't send POST data
$sitetype = $sitetype['type'];
$error = array_merge( $error, createAutoblog($sitetype, $sitename, $siteurl, $rssurl, $error));
if( empty($error)) {
$form .= '<iframe width="1" height="1" frameborder="0" src="'. AUTOBLOGS_FOLDER . urlToFolderSlash($siteurl) .'/index.php"></iframe>';
$form .= '<p><span style="color:darkgreen">Autoblog <a href="'. AUTOBLOGS_FOLDER . urlToFolderSlash($siteurl) .'">'. $sitename .'</a> ajouté avec succès.</span><br>';
}
else {
$form .= '<ul>';
foreach ( $error AS $value )
$form .= '<li>'. $value .'</li>';
$form .= '</ul>';
}
}
catch (Exception $e) {
$form .= $e->getMessage();
}
$form .= '<a href="#" onclick="window.close()">Fermer la fenêtre.</a></p>';
}
else {
try {
$rssurl = DetectRedirect(escape($_GET['rssurl']));
$datafeed = file_get_contents($rssurl);
if( $datafeed !== false ) {
$siteurl = get_link_from_datafeed($datafeed);
$sitename = get_title_from_datafeed($datafeed);
$sitetype = updateType($siteurl);
$sitetype = $sitetype['type'];
$form .= '<span style="color:blue">Merci de vérifier les informations suivantes, corrigez si nécessaire.</span><br>
<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 style="width:30em;" type="text" name="sitename" id="sitename" value="'.$sitename.'"><label for="sitename">&larr; titre du site (auto)</label><br>
<input style="width:30em;" placeholder="Adresse du site" type="text" name="siteurl" id="siteurl" value="'.$siteurl.'"><label for="siteurl">&larr; page d\'accueil (auto)</label><br>
<input style="width:30em;" placeholder="Adresse du flux RSS/ATOM" type="text" name="rssurl" id="rssurl" value="'.$rssurl.'"><label for="rssurl">&larr; adresse du flux</label><br>
<input style="width:30em;" type="text" name="sitetype" id="sitetype" value="'.$sitetype.'" disabled><label for="sitetype">&larr; type de site</label><br>
<input type="submit" value="Créer"></form>';
}
else {
$form .= '<p>URL du flux RSS incorrecte.<br><a href="#" onclick="window.close()">Fermer la fenêtre.</a></p>';
}
}
catch (Exception $e) {
$form .= $e->getMessage() .'<br><a href="#" onclick="window.close()">Fermer la fenêtre.</a></p>';
}
}
}
$form .= '</body></html>';
echo $form; die;
}
/**
* ADD BY SOCIAL / SHAARLI
**/
if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_SOCIAL)
{
if( !empty($_POST['number']) && !empty($_POST['antibot']) && check_antibot($_POST['number'], $_POST['antibot']) ) {
$socialaccount = strtolower(escape($_POST['socialaccount']));
$socialinstance = strtolower(escape($_POST['socialinstance']));
if($socialinstance === 'twitter') {
if( API_TWITTER !== FALSE ) {
$sitetype = 'twitter';
$siteurl = "http://twitter.com/$socialaccount";
$rssurl = API_TWITTER.$socialaccount;
}
else
$error[] = "Twitter veut mettre à mort son API ouverte. Du coup on peut plus faire ça comme ça.";
}
elseif($socialinstance === 'identica') {
$sitetype = 'identica';
$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']));
try {
$rssurl = DetectRedirect("http://".$siteurl."/api/statuses/user_timeline/$socialaccount.rss");
$siteurl = DetectRedirect("http://".$siteurl."/$socialaccount");
}
catch (Exception $e) {
echo $error[] = $e->getMessage();
}
}
elseif($socialinstance === 'shaarli' && !empty($_POST['shaarliurl'])) {
$sitetype = 'shaarli';
$siteurl = NoProtocolSiteURL(escape($_POST['shaarliurl']));
try {
$siteurl = DetectRedirect("http://".$siteurl."/");
}
catch (Exception $e) {
echo $error[] = $e->getMessage();
}
$rssurl = $siteurl."?do=rss";
$socialaccount = get_title_from_feed($rssurl);
}
if( empty($error) ) {
// Twitterbridge do NOT allow this user yet => No check
if( $sitetype != 'twitter' ) {
$headers = get_headers($rssurl, 1);
if (strpos($headers[0], '200') == FALSE) {
$error[] = "Flux inaccessible (compte inexistant ?)";
}
}
if( empty($error) ) {
$error = array_merge( $error, createAutoblog($sitetype, ucfirst($socialinstance) .' - '. $socialaccount, $siteurl, $rssurl, $error));
if( empty($error))
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. AUTOBLOGS_FOLDER . urlToFolderSlash( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">'.ucfirst($socialinstance) .' - '. $socialaccount.' <a href="'. AUTOBLOGS_FOLDER .urlToFolderSlash( $siteurl ).'">ajouté avec succès</a>.</b>';
}
}
}
else
$error[] = 'Antibot : Chiffres incorrects.';
}
/**
* ADD BY GENERIC LINK
**/
if( !empty($_POST['generic']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_LINKS) {
if(empty($_POST['rssurl']))
{$error[] = "Veuillez entrer l'adresse du flux.";}
if(empty($_POST['number']) || empty($_POST['antibot']) )
{$error[] = "Vous êtes un bot ?";}
elseif(! check_antibot($_POST['number'], $_POST['antibot']))
{$error[] = "Antibot : Ce n'est pas le bon nombre.";}
if(empty($error)) {
try {
$rssurl = DetectRedirect(escape($_POST['rssurl']));
if(!empty($_POST['siteurl'])) {
$siteurl = escape($_POST['siteurl']);
$sitename = get_title_from_feed($rssurl);
$error = array_merge( $error, createAutoblog('generic', $sitename, $siteurl, $rssurl, $error));
if( empty($error))
$success[] = '<iframe width="1" height="1" frameborder="0" src="'. AUTOBLOGS_FOLDER . urlToFolderSlash( $siteurl ) .'/index.php"></iframe><b style="color:darkgreen">Autoblog '. $sitename .' crée avec succès.</b> &rarr; <a target="_blank" href="'. AUTOBLOGS_FOLDER . urlToFolderSlash( $siteurl ) .'">afficher l\'autoblog</a>';
}
else {
// checking procedure
$datafeed = file_get_contents($rssurl);
if( $datafeed === false ) {
$error[] = 'URL "'. $rssurl .'" inaccessible.';
}
$sitetype = 'generic';
$siteurl = get_link_from_datafeed($datafeed);
$sitename = get_title_from_datafeed($datafeed);
$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.'" '.( $datafeed === false?'':'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.'" '.( $datafeed === false?'':'disabled').'><label for="sitetype">&larr; type de site</label><br>
<input placeholder="Antibot: '. escape($_POST['antibot']) .' en chiffre" type="text" name="number" value="'. escape($_POST['number']) .'"><label for="number">&larr; antibot</label><br>
<input type="hidden" name="antibot" value="'. escape($_POST['antibot']) .'" /><input type="submit" value="Créer"></form>';
}
}
catch (Exception $e) {
echo $error[] = $e->getMessage();
}
}
}
/**
* ADD BY OPML File
**/
if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_OPML_FILE) {
if(empty($_POST['number']) || empty($_POST['antibot']) )
{$error[] = "Vous êtes un bot ?";}
elseif(! check_antibot($_POST['number'], $_POST['antibot']))
{$error[] = "Antibot : Ce n'est pas le bon nombre.";}
if( empty( $error)) {
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
$opml = null;
if( ($opml = simplexml_load_file( $_FILES['file']['tmp_name'])) !== false ) {
create_from_opml($opml);
}
else
$error[] = "Impossible de lire le contenu du fichier OPML.";
unlink($_FILES['file']['tmp_name']);
} else {
$error[] = "Le fichier n'a pas été envoyé.";
}
}
}
/**
* ADD BY OPML Link
**/
if( !empty($_POST['opml_link']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK) {
if(empty($_POST['number']) || empty($_POST['antibot']) )
{$error[] = "Vous êtes un bot ?";}
elseif(! check_antibot($_POST['number'], $_POST['antibot']))
{$error[] = "Antibot : Ce n'est pas le bon nombre.";}
if( empty( $_POST['opml_url'] ))
{$error[] = 'Le lien est incorrect.';}
if( empty( $error)) {
$opml_url = escape($_POST['opml_url']);
if(parse_url($opml_url, PHP_URL_HOST)==FALSE) {
$error[] = "URL du fichier OPML non valide.";
} else {
if ( ($opml = simplexml_load_file( $opml_url )) !== false ) {
create_from_opml($opml);
} else {
$error[] = "Impossible de lire le contenu du fichier OPML ou d'accéder à l'URL donnée.";
}
}
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Projet Autoblog<?php if(strlen(HEAD_TITLE)>0) echo " | " . HEAD_TITLE; ?></title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo serverUrl(true) . RSS_FILE;?>" />
<link href="<?php echo RESOURCES_FOLDER; ?>autoblog.css" rel="stylesheet" type="text/css">
<?php
if(file_exists(RESOURCES_FOLDER .'user.css')){
echo '<link href="'. RESOURCES_FOLDER .'user.css" rel="stylesheet" type="text/css">';
}
?>
</head>
<body>
<h1><a href="<?php echo serverUrl(true); ?>">
PROJET AUTOBLOG
<?php if(strlen(HEAD_TITLE)>0) echo " | " . HEAD_TITLE; ?>
</a></h1>
<div class="pbloc">
<?php
if (defined('LOGO'))
echo '<img id="logo" src="'. RESOURCES_FOLDER . LOGO .'" alt="">';
?>
<h2>Présentation</h2>
<p>
Le Projet Autoblog a pour objectif de répliquer les articles d'un blog ou d'un site site web.<br/>
Si l'article source est supprimé, et même si le site d'origine disparaît, les articles restent lisibles sur l'autoblog. <br/>
L'objectif premier de ce projet est de lutter contre la censure et toute sorte de pression...
</p>
<p>
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>).
</p>
</div>
<?php if( $update_available ) { ?>
<div class="pbloc">
<h2>Mise à jour</h2>
<p>
Une mise à jour du Projet Autoblog est disponible !<br>
&rarr; <a href="https://github.com/mitsukarenai/Projet-Autoblog/archive/master.zip">Télécharger la dernière version</a><br>
&rarr; <strong>Important : </strong><a href="https://github.com/mitsukarenai/Projet-Autoblog/wiki/Mettre-%C3%A0-jour">Consulter la documentation - mise à jour</a>
</p>
</div>
<?php } ?>
<?php if(ALLOW_NEW_AUTOBLOGS == TRUE) { ?>
<div class="pbloc">
<h2>Ajouter un autoblog</h2>
<?php
if( !empty( $error ) || !empty( $success )) {
echo '<p>Message'. (count($error) ? 's' : '') .' :</p><ul>';
foreach ( $error AS $value ) {
echo '<li class="error">'. $value .'</li>';
}
foreach ( $success AS $value ) {
echo '<li class="success">'. $value .'</li>';
}
echo '</ul>';
}
$button_list = '<p id="button_list">Ajouter un autoblog via : ';
if(ALLOW_NEW_AUTOBLOGS_BY_LINKS)
$button_list .= '<a href="#add_generic" class="button" id="button_generic" onclick="show_form(\'generic\');return false;">Flux RSS</a> ';
if(ALLOW_NEW_AUTOBLOGS_BY_SOCIAL) {
$button_list .= '<a href="#add_social" class="button" id="button_social" onclick="show_form(\'social\');return false;">Compte réseau social</a> ';
$button_list .= '<a href="#add_shaarli" class="button" id="button_shaarli" onclick="show_form(\'shaarli\');return false;">Shaarli</a> ';
}
if(ALLOW_NEW_AUTOBLOGS_BY_OPML_FILE)
$button_list .= '<a href="#add_opmlfile" class="button" id="button_opmlfile" onclick="show_form(\'opmlfile\');return false;">Fichier OPML</a> ';
if(ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK)
$button_list .= '<a href="#add_opmllink" class="button" id="button_opmllink" onclick="show_form(\'opmllink\');return false;">Lien vers OPML</a> ';
if(ALLOW_NEW_AUTOBLOGS_BY_BUTTON)
$button_list .= '<a href="#add_bookmark" class="button" id="button_bookmark" onclick="show_form(\'bookmark\');return false;">Marque page</a> ';
$button_list .= '</p>';
echo $button_list;
if(ALLOW_NEW_AUTOBLOGS_BY_LINKS == TRUE) { ?>
<div class="form" id="add_generic">
<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:
</p>
<?php echo $form; ?>
</div>
<?php }
if(ALLOW_NEW_AUTOBLOGS_BY_SOCIAL == TRUE) { ?>
<div class="form" id="add_social">
<h3>Ajouter un compte social</h3>
<form method="POST">
<input placeholder="Identifiant du compte" type="text" name="socialaccount" id="socialaccount"><br>
<?php
if( API_TWITTER !== FALSE )
echo '<input type="radio" name="socialinstance" value="twitter">Twitter<br>';
else echo '<s>Twitter</s><br>'; ?>
<input type="radio" name="socialinstance" value="identica">Identica<br>
<input type="radio" name="socialinstance" value="statusnet">
<input placeholder="statusnet.personnel.com" type="text" name="statusneturl" id="statusneturl"><br>
<input placeholder="Antibot : Ecrivez '<?php echo $antibot; ?>' en chiffres" type="text" name="number" class="smallinput"><br>
<input type="hidden" name="antibot" value="<?php echo $antibot; ?>" />
<input type="submit" value="Créer">
</form>
</div>
<div class="form" id="add_shaarli">
<h3>Ajouter un Shaarli</h3>
<form method="POST">
<input type="hidden" name="socialaccount" value="shaarli">
<input placeholder="shaarli.personnel.com" type="text" name="shaarliurl" id="shaarliurl"><br>
<input placeholder="Antibot : Ecrivez '<?php echo $antibot; ?>' en chiffres" type="text" name="number" class="smallinput"><br>
<input type="hidden" name="antibot" value="<?php echo $antibot; ?>" />
<input type="submit" value="Créer">
</form>
</div>
<?php }
if(ALLOW_NEW_AUTOBLOGS_BY_OPML_FILE == TRUE) { ?>
<div class="form" id="add_opmlfile">
<h3>Ajouter par fichier OPML</h3>
<form enctype='multipart/form-data' method='POST'>
<input type='hidden' name='opml_file' value='1' />
<input type='file' name='file' /><br>
<input placeholder="Antibot : Ecrivez '<?php echo $antibot; ?>' en chiffres" type="text" name="number" class="smallinput"><br>
<input type="hidden" name="antibot" value="<?php echo $antibot; ?>" />
<input type='submit' value='Importer' />
</form>
</div>
<?php }
if(ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK == TRUE) { ?>
<div class="form" id="add_opmllink">
<h3>Ajouter par lien OPML</h3>
<form method="POST">
<input type="hidden" name="opml_link" value="1">
<input placeholder="Lien vers OPML" type="text" name="opml_url" id="opml_url" class="smallinput"><br>
<input placeholder="Antibot : Ecrivez '<?php echo $antibot; ?>' en chiffres" type="text" name="number" class="smallinput"><br>
<input type="hidden" name="antibot" value="<?php echo $antibot; ?>" />
<input type="submit" value="Envoyer">
</form>
</div>
<?php }
if(ALLOW_NEW_AUTOBLOGS_BY_BUTTON == TRUE) { ?>
<div class="form" id="add_bookmark">
<h3>Marque page</h3>
<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>
</div>
<?php } ?>
</div>
<?php } ?>
<?php
$directory = DOC_FOLDER;
$docs = array();
if( is_dir($directory) && !file_exists($directory . '.disabled') ) {
$subdirs = glob($directory . "*");
foreach($subdirs as $unit)
{
if(!is_dir($unit) || file_exists( $unit . '/index.html' ) || file_exists( $unit . '/index.htm' ) || file_exists( $unit . '/index.php' ) ) {
$docs[] = '<a href="'. $unit . '">'. substr($unit, (strrpos($unit, '/')) + 1 ) .'</a>';
}
}
}
if(!empty( $docs )) {
echo '<div class="pbloc"><h2>Autres documents</h2><ul>';
foreach( $docs as $value )
echo '<li>'. $value .'</li>';
echo '</ul></div>';
}
?>
<div class="pbloc">
<h2>Autoblogs hébergés <a href="?rss" title="RSS des changements"><img src="<?php echo RESOURCES_FOLDER; ?>rss.png" alt="rss"/></a></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="?sitemap">sitemap</a> | <a href="?export">export<sup> JSON</sup></a> | <a href="?exportopml">export<sup> OPML</sup></a></div>
<div id="contentVignette">
<?php
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
$autoblogs = array();
foreach($subdirs as $unit)
{
if(is_dir($unit))
{
if( !file_exists(ROOT_DIR . '/' . $unit . '/.disabled')) {
if( file_exists(ROOT_DIR . '/' . $unit . '/vvb.ini')) {
$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) {
$opml_link='<a href="'.$key.'/?opml">opml</a>';
$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">config <sup><a href="'.$key.'/vvb.ini">ini</a> '.$opml_link.'</sup> | '.escape($autoblog->site_type).' source: <a href="'.escape($autoblog->site_url).'">'.escape($autoblog->site_url).'</a></div>
</div>';
}
}
echo $autoblogs_display;
?>
</div>
<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://hoa.ro">Arthur Hoaro</a> (Domaine Public)
<?php if(defined('FOOTER') && strlen(FOOTER)>0 ){ echo "<br/>".FOOTER; } ?>
<iframe width="1" height="1" style="display:none" src="xsaf3.php"></iframe>
<script type="text/javascript">
<?php if( !empty($_POST['generic']) && !empty($_POST['siteurl']) || empty($_POST['generic']) )
echo "document.getElementById('add_generic').style.display = 'none';"; ?>
if(document.getElementById('add_social') != null) { document.getElementById('add_social').style.display = 'none'; }
if(document.getElementById('add_shaarli') != null) { document.getElementById('add_shaarli').style.display = 'none'; }
if(document.getElementById('add_opmlfile') != null) { document.getElementById('add_opmlfile').style.display = 'none'; }
if(document.getElementById('add_bookmark') != null) { document.getElementById('add_bookmark').style.display = 'none'; }
if(document.getElementById('add_opmllink') != null) { document.getElementById('add_opmllink').style.display = 'none'; }
if(document.getElementById('button_list') != null) { document.getElementById('button_list').style.display = 'block'; }
function show_form(str){
document.getElementById('add_'+str).style.display = (document.getElementById('add_'+str).style.display != 'block' ? 'block' : 'none' );
document.getElementById('button_'+str).className = (document.getElementById('button_'+str).className != 'buttonactive' ? 'buttonactive' : 'button' );
}
</script>
</body>
</html>

View file

@ -1,48 +0,0 @@
/**
* autoblog.css
* ------------
* Please do NOT edit this file. Updating your Autoblogs farm will be easier.
* If you want to add your own CSS, use the file user.css
*
*/
body {background-color:#efefef;text-align:center;color:#333;font-family:sans-serif;}
a {color:black;text-decoration:none;font-weight:bold;}
a:hover {color:darkred;}
h1 {text-align:center;font-size:40pt;text-shadow: #ccc 0px 5px 5px;}
h2 {text-align:center;font-size: 16pt;margin:0 0 1em 0;font-style:italic;text-shadow: #ccc 0px 5px 5px; }
.pbloc {background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;text-align:justify;box-shadow:0px 5px 7px #aaa;}
input[type="text"]{width:20em;}
input[type="radio"] {width:1em;}
input[type="submit"] {width:8em;}
div.form {padding:0.2em;border:1px solid #fff;}
div.form:hover {background-color:#FAF4DA;border:1px dotted;}
#contentVignette {text-align: center;}
.vignette {width:27%;height:2em;display: inline-block;text-align:justify;margin:0; padding:20px;background-color:#eee;border: 1px solid #888;}
.vignette:hover {background-color:#fff;}
.vignette .title {font-size: 14pt;text-shadow: #ccc 0px 5px 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.vignette .title a:hover {color:darkred; text-decoration:none;}
.vignette .source {font-size:x-small;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.vignette .source a:hover {color:darkred; text-decoration:none;}
.clear {clear:both;text-align:right;font-size:small;}
#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;}
.success {color: green;}
.error {color: red;}
.button_list{display:none;}
.button{-moz-box-shadow:inset 0 1px 0 0 #d9fbbe;-webkit-box-shadow:inset 0 1px 0 0 #d9fbbe;box-shadow:inset 0 1px 0 0 #d9fbbe;background:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#b8e356',endColorstr='#a5cc52');background-color:#b8e356;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:1px solid #83c41a;display:inline-block;color:#fff;font-family:arial;font-size:14px;font-weight:700;text-decoration:none;text-shadow:1px 1px 0 #86ae47;padding:6px 24px;}
.button:hover{background:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#a5cc52',endColorstr='#b8e356');background-color:#a5cc52;}
.button:active{position:relative;top:1px;}
.buttonactive{background-color:#aaa;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:1px solid #83c41a;display:inline-block;color:#fff;font-family:arial;font-size:14px;font-weight:700;text-decoration:none;text-shadow:1px 1px 0 #86ae47;padding:6px 24px;}
@media screen and (max-width:1024px) {
.vignette { width: 40%; }
}
@media screen and (max-width:640px) {
h1 { font-size:20pt; }
.button, .button:hover, .button:active, .buttonactive { display: block; margin: auto; text-align:center; }
.vignette { width: 80%; }
}
@media screen and (max-width:480px) {
#logo { max-width: 250px; }
input[type="text"]{width:15em;}
}

View file

@ -1,218 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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="300"
height="180"
id="svg2">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer5">
<g
id="text2990-7"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 106.42552,68.920204 -1.71775,0 0,-8.910788 c 0,-0.793795 0.026,-1.968235 0.0781,-3.523323 -0.25376,0.279795 -0.64741,0.647418 -1.18095,1.102868 l -1.4347,1.180948 -0.94671,-1.200468 3.73804,-2.91821 1.46399,0 0,14.268973"
id="path3056" />
</g>
<g
transform="matrix(-0.96800707,0.25092291,-0.25092291,-0.96800707,0,0)"
id="text2990-7-4"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m -83.665748,-114.1049 -1.717742,0 0,-8.91078 c -6e-6,-0.7938 0.02602,-1.96824 0.07808,-3.52333 -0.253763,0.2798 -0.647411,0.64742 -1.180947,1.10287 l -1.434706,1.18095 -0.94671,-1.20047 3.738042,-2.91821 1.463984,0 0,14.26897"
id="path3059" />
</g>
<g
transform="matrix(0.91697723,-0.39893955,0.39893955,0.91697723,0,0)"
id="text2990-7-9"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 63.170327,105.14977 -1.717742,0 0,-8.910785 c -6e-6,-0.793796 0.02602,-1.968236 0.07808,-3.523324 -0.253763,0.279796 -0.647412,0.647418 -1.180948,1.102869 l -1.434705,1.180947 -0.94671,-1.200467 3.738041,-2.91821 1.463985,0 0,14.26897"
id="path3062" />
</g>
<g
transform="matrix(-0.59314555,-0.80509524,0.80509524,-0.59314555,0,0)"
id="text2990-7-5"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m -126.66057,27.239197 -1.71775,0 0,-8.910788 c 0,-0.793796 0.026,-1.968236 0.0781,-3.523324 -0.25376,0.279796 -0.64741,0.647419 -1.18095,1.102869 l -1.4347,1.180948 -0.94671,-1.200468 3.73804,-2.91821 1.46399,0 0,14.268973"
id="path3065" />
</g>
<g
transform="matrix(0.31319215,-0.94968978,0.94968978,0.31319215,0,0)"
id="text2990-7-81"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m -41.445109,113.0434 -1.717743,0 0,-8.91078 c -5e-6,-0.7938 0.02602,-1.96824 0.07808,-3.52333 -0.253763,0.2798 -0.647412,0.64742 -1.180948,1.10287 l -1.434705,1.18095 -0.946711,-1.20047 3.738042,-2.918209 1.463985,0 0,14.268969"
id="path3068" />
</g>
<g
transform="matrix(-0.26611424,-0.9639415,0.9639415,-0.26611424,0,0)"
id="text2990-7-99"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m -101.83545,68.705475 -1.71774,0 0,-8.910788 c -1e-5,-0.793796 0.026,-1.968236 0.0781,-3.523324 -0.25376,0.279796 -0.64741,0.647419 -1.18095,1.102869 l -1.4347,1.180948 -0.94671,-1.200468 3.73804,-2.91821 1.46398,0 0,14.268973"
id="path3071" />
</g>
<g
transform="matrix(-0.66389743,0.74782364,-0.74782364,-0.66389743,0,0)"
id="text2990-7-0"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m -10.770921,-142.41505 -1.717742,0 0,-8.91079 c -6e-6,-0.7938 0.02602,-1.96824 0.07808,-3.52333 -0.253763,0.2798 -0.647412,0.64742 -1.180948,1.10287 l -1.434705,1.18095 -0.94671,-1.20047 3.738041,-2.91821 1.463985,0 0,14.26898"
id="path3074" />
</g>
<g
transform="matrix(0.61642924,0.78741031,-0.78741031,0.61642924,0,0)"
id="text2990-7-47"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 122.52353,-67.256531 -1.71774,0 0,-8.910788 c -1e-5,-0.793795 0.026,-1.968235 0.0781,-3.523323 -0.25377,0.279796 -0.64741,0.647418 -1.18095,1.102868 l -1.43471,1.180948 -0.94671,-1.200468 3.73805,-2.918209 1.46398,0 0,14.268972"
id="path3077" />
</g>
<g
transform="matrix(0.03313105,0.99945102,-0.99945102,0.03313105,0,0)"
id="text2990-7-50"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 86.240953,-144.46338 -1.717743,0 0,-8.91079 c -5e-6,-0.79379 0.02602,-1.96823 0.07808,-3.52332 -0.253762,0.2798 -0.647411,0.64742 -1.180947,1.10287 l -1.434706,1.18095 -0.94671,-1.20047 3.738042,-2.91821 1.463985,0 0,14.26897"
id="path3080" />
</g>
<g
transform="matrix(0.56201745,0.82712538,-0.82712538,0.56201745,0,0)"
id="text2990-7-6"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 141.46955,-115.26434 -1.71774,0 0,-8.91079 c -1e-5,-0.7938 0.026,-1.96824 0.0781,-3.52332 -0.25376,0.27979 -0.64741,0.64741 -1.18095,1.10286 l -1.4347,1.18095 -0.94671,-1.20047 3.73804,-2.91821 1.46398,0 0,14.26898"
id="path3083" />
</g>
<g
transform="matrix(0.41026184,0.91196777,-0.91196777,0.41026184,0,0)"
id="text2990-7-68"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 106.62199,-165.76779 -1.71774,0 0,-8.91079 c -1e-5,-0.7938 0.026,-1.96824 0.0781,-3.52332 -0.25376,0.27979 -0.64741,0.64742 -1.18094,1.10287 l -1.43471,1.18094 -0.94671,-1.20046 3.73804,-2.91821 1.46399,0 0,14.26897"
id="path3086" />
</g>
<g
transform="matrix(-0.23609203,0.9717307,-0.9717307,-0.23609203,0,0)"
id="text2990-7-07"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 21.373971,-224.19429 -1.717742,0 0,-8.91079 c -6e-6,-0.79379 0.02602,-1.96823 0.07808,-3.52332 -0.253763,0.27979 -0.647412,0.64742 -1.180948,1.10287 l -1.434705,1.18094 -0.94671,-1.20046 3.738041,-2.91821 1.463985,0 0,14.26897"
id="path3089" />
</g>
<g
transform="matrix(0.26029759,0.96552844,-0.96552844,0.26029759,0,0)"
id="text2990-7-1"
style="font-size:19.98827362px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 109.52001,-224.81616 -1.71774,0 0,-8.91079 c -10e-6,-0.7938 0.026,-1.96824 0.0781,-3.52332 -0.25376,0.27979 -0.64741,0.64741 -1.18095,1.10286 l -1.4347,1.18095 -0.94671,-1.20046 3.73804,-2.91821 1.46398,0 0,14.26897"
id="path3092" />
</g>
</g>
<g
id="layer3">
<g
transform="matrix(-0.72542887,-0.29673984,-0.48305239,1.1809002,0,0)"
id="text2985-0-36"
style="font-size:13.06711483px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
<path
d="m -165.36303,43.093833 c -0.97408,0 -1.71208,-0.410474 -2.21401,-1.231422 -0.50193,-0.8252 -0.75289,-2.016212 -0.75289,-3.573039 0,-3.198713 0.98896,-4.798072 2.9669,-4.798082 0.98683,1e-5 1.73122,0.41261 2.23315,1.237803 0.50617,0.820956 0.75926,2.007714 0.75927,3.560279 -1e-5,3.202975 -0.99748,4.804461 -2.99242,4.804461 m 0,-0.988966 c 0.62528,1e-6 1.08467,-0.297752 1.37817,-0.89326 0.29349,-0.599758 0.44024,-1.573835 0.44025,-2.922235 -1e-5,-1.339884 -0.14676,-2.307581 -0.44025,-2.903095 -0.2935,-0.599752 -0.75289,-0.899632 -1.37817,-0.89964 -0.61678,8e-6 -1.06979,0.297761 -1.35903,0.89326 -0.285,0.59126 -0.42749,1.561084 -0.42749,2.909475 0,1.352653 0.14249,2.326731 0.42749,2.922235 0.28924,0.595508 0.74225,0.893261 1.35903,0.89326"
id="path3029"
style="font-variant:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" />
</g>
<g
transform="matrix(-0.7582023,-0.19857197,-0.32324835,1.234251,0,0)"
id="text2985-0-5-3"
style="font-size:13.06711483px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
<path
d="m -151.53292,77.359611 c -0.97408,0 -1.71209,-0.410474 -2.21401,-1.231423 -0.50193,-0.8252 -0.75289,-2.016212 -0.75289,-3.573039 0,-3.198713 0.98896,-4.798072 2.9669,-4.798081 0.98683,9e-6 1.73121,0.41261 2.23315,1.237803 0.50617,0.820956 0.75926,2.007714 0.75927,3.560278 -1e-5,3.202976 -0.99748,4.804462 -2.99242,4.804462 m 0,-0.988966 c 0.62527,0 1.08466,-0.297753 1.37817,-0.89326 0.29349,-0.599758 0.44024,-1.573836 0.44025,-2.922236 -1e-5,-1.339884 -0.14676,-2.307581 -0.44025,-2.903094 -0.29351,-0.599752 -0.7529,-0.899632 -1.37817,-0.89964 -0.61678,8e-6 -1.06979,0.297761 -1.35903,0.893259 -0.285,0.59126 -0.42749,1.561084 -0.42749,2.909475 0,1.352654 0.14249,2.326732 0.42749,2.922236 0.28924,0.595507 0.74225,0.89326 1.35903,0.89326"
id="path3032"
style="font-variant:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" />
</g>
<g
transform="matrix(-0.76749141,-0.15892919,-0.25871525,1.2493724,0,0)"
id="text2985-0-5-3-4"
style="font-size:13.06711483px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
<path
d="m -143.35433,102.91132 c -0.97409,0 -1.71209,-0.41048 -2.21401,-1.23143 -0.50193,-0.8252 -0.75289,-2.016209 -0.75289,-3.573036 0,-3.198713 0.98896,-4.798072 2.9669,-4.798082 0.98683,10e-6 1.73121,0.41261 2.23315,1.237803 0.50617,0.820956 0.75926,2.007714 0.75927,3.560279 -1e-5,3.202976 -0.99748,4.804466 -2.99242,4.804466 m 0,-0.98897 c 0.62527,0 1.08466,-0.29775 1.37817,-0.89326 0.29349,-0.59976 0.44024,-1.573836 0.44025,-2.922236 -1e-5,-1.339884 -0.14676,-2.307581 -0.44025,-2.903095 -0.29351,-0.599752 -0.7529,-0.899632 -1.37817,-0.89964 -0.61678,8e-6 -1.06979,0.297761 -1.35903,0.89326 -0.285,0.59126 -0.4275,1.561084 -0.42749,2.909475 -1e-5,1.352653 0.14249,2.326736 0.42749,2.922236 0.28924,0.59551 0.74225,0.89326 1.35903,0.89326"
id="path3035"
style="font-variant:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" />
</g>
<g
transform="matrix(-0.77762174,-0.09801014,-0.15954727,1.2658632,0,0)"
id="text2985-0-5-3-3"
style="font-size:13.06711483px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
<path
d="m -128.43879,130.7428 c -0.97408,0 -1.71208,-0.41048 -2.21401,-1.23143 -0.50193,-0.8252 -0.75289,-2.01621 -0.75289,-3.57303 0,-3.19872 0.98896,-4.79808 2.9669,-4.79809 0.98683,1e-5 1.73122,0.41261 2.23315,1.23781 0.50617,0.82095 0.75926,2.00771 0.75927,3.56028 -1e-5,3.20297 -0.99748,4.80446 -2.99242,4.80446 m 0,-0.98897 c 0.62528,0 1.08467,-0.29775 1.37817,-0.89326 0.2935,-0.59976 0.44024,-1.57383 0.44025,-2.92223 -1e-5,-1.33989 -0.14675,-2.30759 -0.44025,-2.9031 -0.2935,-0.59975 -0.75289,-0.89963 -1.37817,-0.89964 -0.61678,1e-5 -1.06979,0.29776 -1.35903,0.89326 -0.285,0.59126 -0.42749,1.56108 -0.42749,2.90948 0,1.35265 0.14249,2.32673 0.42749,2.92223 0.28924,0.59551 0.74225,0.89326 1.35903,0.89326"
id="path3038"
style="font-variant:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" />
</g>
<g
transform="matrix(1.2224283,0.19806604,-0.31571913,0.76688897,0,0)"
id="text2990-7-14"
style="font-size:17.2256794px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 108.4038,118.44056 -1.48033,0 0,-7.67922 c 0,-0.68409 0.0224,-1.69621 0.0673,-3.03636 -0.21869,0.24112 -0.55793,0.55793 -1.01773,0.95044 l -1.23641,1.01772 -0.81587,-1.03455 3.22141,-2.51488 1.26164,0 0,12.29685"
id="path3041" />
</g>
<g
transform="matrix(1.2380995,-0.02589828,-0.17206885,0.81128882,0,0)"
id="text2990-7-14-7"
style="font-size:17.2256794px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 95.070558,172.14899 -1.480332,0 0,-7.67922 c -5e-6,-0.68409 0.02242,-1.69621 0.06729,-3.03637 -0.21869,0.24113 -0.557933,0.55794 -1.017728,0.95044 l -1.236414,1.01773 -0.815864,-1.03455 3.221403,-2.51488 1.261647,0 0,12.29685"
id="path3044" />
</g>
<g
transform="matrix(1.2383695,-0.00147106,-0.18803848,0.80773681,0,0)"
id="text2990-7-14-3"
style="font-size:17.2256794px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">
<path
d="m 97.014077,203.21602 -1.480331,0 0,-7.67922 c -5e-6,-0.68409 0.02242,-1.69621 0.06729,-3.03637 -0.21869,0.24113 -0.557932,0.55794 -1.017728,0.95045 l -1.236413,1.01772 -0.815865,-1.03455 3.221404,-2.51488 1.261646,0 0,12.29685"
id="path3047" />
</g>
<g
transform="matrix(-1.2360182,0.04170273,-0.03045568,0.81007712,0,0)"
id="text2985-0-5-3-7"
style="font-size:13.94503117px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
<path
d="m -87.840912,107.61557 c -1.039525,0 -1.82711,-0.43805 -2.362757,-1.31415 -0.53565,-0.88064 -0.803474,-2.15167 -0.803473,-3.8131 -10e-7,-3.413614 1.055408,-5.120426 3.16623,-5.120436 1.053135,1e-5 1.847529,0.440331 2.383184,1.320964 0.540181,0.876112 0.810275,2.142602 0.810283,3.799472 -8e-6,3.41817 -1.064496,5.12725 -3.193467,5.12725 m 0,-1.05541 c 0.667287,1e-5 1.157541,-0.31775 1.470765,-0.95327 0.313213,-0.64005 0.469822,-1.67957 0.469828,-3.11857 -6e-6,-1.4299 -0.156615,-2.46261 -0.469828,-3.098135 -0.313224,-0.640046 -0.803478,-0.960073 -1.470765,-0.960082 -0.658216,9e-6 -1.141662,0.317766 -1.450338,0.953273 -0.304142,0.630984 -0.456212,1.665964 -0.456209,3.104944 -3e-6,1.44354 0.152067,2.48306 0.456209,3.11857 0.308676,0.63552 0.792122,0.95328 1.450338,0.95327"
id="path3050"
style="font-variant:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" />
</g>
</g>
<g
id="layer4">
<g
transform="scale(1.3546944,0.73817387)"
id="text2985-04"
style="font-size:29.82770729px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans">
<path
d="m 77.811338,118.12566 c -2.223492,0 -3.908095,-0.93697 -5.053816,-2.81091 -1.145729,-1.88365 -1.718591,-4.60232 -1.718589,-8.15602 -2e-6,-7.301552 2.257464,-10.952336 6.772405,-10.952357 2.252602,2.1e-5 3.95177,0.941846 5.097508,2.825476 1.15542,1.873961 1.733137,4.582921 1.733153,8.126881 -1.6e-5,7.31129 -2.276901,10.96693 -6.830661,10.96693 m 0,-2.25747 c 1.427292,0 2.475921,-0.67966 3.145891,-2.039 0.669945,-1.36904 1.004924,-3.59252 1.004937,-6.67046 -1.3e-5,-3.05849 -0.334992,-5.26741 -1.004937,-6.62676 -0.66997,-1.369024 -1.718599,-2.053545 -3.145891,-2.053565 -1.407891,2e-5 -2.441956,0.679687 -3.102198,2.039005 -0.650545,1.34964 -0.975814,3.56341 -0.975809,6.64132 -5e-6,3.08765 0.325264,5.31113 0.975809,6.67046 0.660242,1.35934 1.694307,2.039 3.102198,2.039"
id="path3053"
style="font-variant:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

View file

@ -1,10 +0,0 @@
/**
* user.css
* ------------
* Feel free to add your custom CSS and override original CSS in this file.
* Don't forget to rename user.css.example to user.css to make it works.
*/
body {
background-color: red;
}

View file

@ -1 +0,0 @@
0.3.0-DEV Build 0

View file

@ -1,169 +0,0 @@
<?php
define('DEBUG', false);
define('XSAF_VERSION', 3);
define('AUTOBLOG_FILE_NAME', 'autoblog.php');
define('ALLOW_REMOTE_DB_DL', false);
define('ALLOW_REMOTE_MEDIA_DL', false);
define('EXEC_TIME', 5);
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('Content-type: text/plain');
$expire = time() -7200 ;
$lockfile = ".xsaflock"; /* defaut delay: 7200 (2 hours) */
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 dossier.";
die;
}
}
define('ROOT_DIR', __DIR__);
if(file_exists("functions.php")){
include "functions.php";
}else{
echo "functions.php not found !";
die;
}
if(file_exists("config.php")){
include "config.php";
}else{
echo "config.php not found !";
die;
}
function serverUrl() {
$https = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS'])=='on')) || $_SERVER["SERVER_PORT"]=='443'; // HTTPS detection.
$serverport = ($_SERVER["SERVER_PORT"]=='80' || ($https && $_SERVER["SERVER_PORT"]=='443') ? '' : ':'.$_SERVER["SERVER_PORT"]);
return 'http'.($https?'s':'').'://'.$_SERVER["SERVER_NAME"].$serverport;
}
libxml_use_internal_errors(true);
// $max_exec_time = temps max d'exécution en seconde
function xsafimport($xsafremote, $max_exec_time) {
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
/* détection de ferme autoblog */
$json_import = file_get_contents($xsafremote);
if(!empty($json_import)) {
$to_update=array();
$json_import = json_decode($json_import, true);
if(!isset($json_import['meta']) || !isset($json_import['meta']['xsaf-version']) || $json_import['meta']['xsaf-version'] != XSAF_VERSION){
if(DEBUG){
echo "\nxsaf-version différentes !";
}
return false;
}
$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'])) {
foreach ($json_import['autoblogs'] as $value) {
if(count($value)==4 && !empty($value['SITE_TYPE']) && !empty($value['SITE_TITLE']) && !empty($value['SITE_URL']) && !empty($value['FEED_URL'])) {
$sitetype = escape($value['SITE_TYPE']);
$sitename = escape($value['SITE_TITLE']);
$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']);
}
/* 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 = urlToFolderSlash($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;
}
}
return;
}
if( DEBUG ) echo '<html><body>';
if( ALLOW_NEW_AUTOBLOGS and ALLOW_NEW_AUTOBLOGS_BY_XSAF && !empty($friends_autoblog_farm) ) {
foreach( $friends_autoblog_farm AS $value ) {
if( !empty($value) )
xsafimport($value, EXEC_TIME);
}
if(DEBUG) echo "<p>XSAF import finished</p>";
}
elseif( DEBUG )
echo "<p>XSAF désactivé. Positionnez les variables ALLOW_NEW_AUTOBLOGS et ALLOW_NEW_AUTOBLOGS_BY_XSAF à TRUE dans le fichier config.php pour l'activer.</p>";
if( DEBUG ) echo '</body></html>';
?>

29
README.md Normal file → Executable file
View file

@ -1,27 +1,18 @@
Projet Autoblog Projet Autoblog serie 0.3
=============== ==============
Création, gestion et échange de blogs automatiques contre la censure (à propos: http://sebsauvage.net/streisand.me/fr/ ) - version VroumVroumBlog 0.3.0 BETA
Branche MASTER: Auteurs: Mitsu (https://www.suumitsu.eu/), Oros (https://www.ecirtam.net/) et Arthur Hoaro (http://hoa.ro)
- script de migration 0.2 to 0.3 par Arthur Hoaro Licence: Domaine Public
- Autoblog Project serie 0.3 par Mitsu, Oros, Arthur Hoaro - À propos du Projet Autoblog
Nouveautés majeures lire: http://sebsauvage.net/streisand.me/fr/
===================
- "ferme" d'autoblogs avec ajout facile par différents formulaires (générique, microblogging, OPML, marque-pages) Instructions
- échange de références entre fermes avec XSAF (Cross-Site Autoblog Farming)
- vérification du statut des sites distants, et flux de suivi des changements
- export facile des références, articles et médias
- contrôle de version et alerte de mise à jour
- apparence de l'autoblog selon son type
- CSS utilisateur personnalisable
- hébergement de documents spécifiques
Pré-requis techniques - uploader les fichiers sur un serveur avec PHP 5.3+
=====================
- serveur web avec PHP 5.3 et son support SQLite - ..c'est tout. Hackez le code pour apprendre comment ça marche et comment le personnaliser :)