Merge branch 'master' into myAutoBlog

Conflicts:
	autoblogs/autoblog.php
	config.php.example
	functions.php
	index.php
	xsaf3.php
This commit is contained in:
Knah Tsaeb 2014-04-11 17:00:48 +02:00
commit 897f3db53c
19 changed files with 1188 additions and 816 deletions

6
.gitignore vendored
View file

@ -1,9 +1,15 @@
config.php config.php
.versionlock .versionlock
.xsaflock .xsaflock
.updatealllock
resources/rss.xml resources/rss.xml
resources/rss.json resources/rss.json
.project .project
resources/user.css resources/user.css
autoblogs/* autoblogs/*
!autoblogs/autoblog.php !autoblogs/autoblog.php
docs/*
!docs/docs.txt
robots.txt
.idea
cache_*

34
LICENSE.md Normal file
View file

@ -0,0 +1,34 @@
LICENCE
===============
- domaine public
LICENSE
===============
- public domain
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

View file

@ -1,23 +1,42 @@
Projet Autoblog Projet Autoblog
=============== ===============
Création, gestion et échange de blogs automatiques contre la censure (à propos: http://sebsauvage.net/streisand.me/fr/ ). > This project is historically in French. See [our english README](https://github.com/mitsukarenai/Projet-Autoblog/wiki/Autoblog-Project).
Réplication automatique de contenu à partir de flux RSS/Atom, avec partage des ajouts entre les fermes d'Autoblog.
L'objectif premier du projet Autoblog est de lutter contre la censure et toute autre forme de pression allant à l'encontre de la liberté d'expression en favorisant l'[effet Streisand](http://fr.wikipedia.org/wiki/Effet_Streisand).
Le projet a été initialement lancé par Sébastien Sauvage : [plus d'info par ici](http://sebsauvage.net/streisand.me/fr/).
Exemples d'instances :
- [autoblog.suumitsu.eu](http://autoblog.suumitsu.eu/)
- [streisand.hoa.ro](http://streisand.hoa.ro/)
- [ecirtam.net](https://ecirtam.net/autoblogs/)
- [autoblog.ohax.fr](http://autoblog.ohax.fr/)
- [flamby.aldarone.fr](http://flamby.aldarone.fr/)
- [tcit.fr](http://www.tcit.fr/streisand/)
- [kaelsitoo.fr](http://kaelsitoo.fr/autoblog/)
- [autoblog.postblue.info](http://autoblog.postblue.info/)
Serie 0.3 par [Mitsu](https://github.com/mitsukarenai/), [Oros](https://github.com/Oros42), [Arthur Hoaro](https://github.com/ArthurHoaro). Serie 0.3 par [Mitsu](https://github.com/mitsukarenai/), [Oros](https://github.com/Oros42), [Arthur Hoaro](https://github.com/ArthurHoaro).
Nouveautés majeures ![logo](https://raw.github.com/mitsukarenai/Projet-Autoblog/master/resources/icon-logo.png)
Fonctionnalités majeures
=================== ===================
- "ferme" d'autoblogs avec ajout facile par différents formulaires (générique, microblogging, OPML, marque-pages) - Ferme d'autoblogs avec ajout facile par différents formulaires (générique, microblogging, OPML, marque-pages).
- échange de références entre fermes avec XSAF (Cross-Site Autoblog Farming) - Échange de références entre fermes avec XSAF ([Cross-Site Autoblog Farming](https://github.com/mitsukarenai/Projet-Autoblog/wiki/XSAF---Cross-Site-Autoblog-Farming)).
- vérification du statut des sites distants, et flux de suivi des changements - Vérification du statut des sites distants, et flux de suivi des changements.
- export facile des références, articles et médias - Export des références, articles et médias.
- contrôle de version et alerte de mise à jour - Contrôle de version de la ferme et alerte de mise à jour.
- apparence de l'autoblog selon son type - Identification du type d'autoblog.
- CSS utilisateur personnalisable - CSS utilisateur personnalisable.
- hébergement de documents spécifiques - Hébergement de documents divers (PDF, images, réplique de site web, etc.).
Branches : Branches
=================== ===================
- [master](https://github.com/mitsukarenai/Projet-Autoblog/tree/master/) _(développement)_ : Autoblog Project serie 0.3 par Mitsu, Oros, Arthur Hoaro - [master](https://github.com/mitsukarenai/Projet-Autoblog/tree/master/) _(développement)_ : Autoblog Project serie 0.3 par Mitsu, Oros, Arthur Hoaro
@ -28,4 +47,36 @@ Branches :
Pré-requis techniques Pré-requis techniques
===================== =====================
- serveur web avec PHP 5.3 et son support SQLite - Serveur web (Apache, nginx, etc.)
- PHP 5.3 ou supérieur
- Support SQLite 3 pour PHP
Documentation
=====================
La documentation du projet est sur le [Wiki du repo](https://github.com/mitsukarenai/Projet-Autoblog/wiki).
Accès hors ligne : `git clone https://github.com/mitsukarenai/Projet-Autoblog.wiki.git`
Licence
=====================
Domaine public.
Changelog
=====================
- 2014-02-12 MILESTONE 0.3.2
- separate type icons
- cache added
- pagination fixes
- SVG fixes
- fix date() warnings
- bugfixes
- 2013-10-14 MILESTONE 0.3.1
- code semantics
- "docs" filesize
- robots.txt
- bugfixes
- 2013-07-30
- twitter2feed.php fixed (regex on class "avatar"; ```<fullname>```)
- 2013-07-22 MILESTONE 0.3

View file

@ -8,7 +8,7 @@
- Source feed MUST be valid UTF-8 - Source feed MUST be valid UTF-8
- Source feed MUST contain article body - Source feed MUST contain article body
This program is public domain. COPY COPY COPY ! This program is public domain. COPY COPY COPY!
*/ */
$vvbversion = '0.3.0'; $vvbversion = '0.3.0';
if (!version_compare(phpversion(), '5.3.0', '>=')) if (!version_compare(phpversion(), '5.3.0', '>='))
@ -41,7 +41,7 @@ if (!defined('MEDIA_DIR')) define('MEDIA_DIR', ROOT_DIR . '/media');
if (!defined('LOCAL_URL')) if (!defined('LOCAL_URL'))
{ {
// Automagic URL discover // Automagic URL discover
define('LOCAL_URL', 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '')."://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"); define('LOCAL_URL', 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '')."://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
} }
if (!defined('LOCAL_URI')) if (!defined('LOCAL_URI'))
@ -121,7 +121,7 @@ function exception_handler($e)
exit; exit;
} }
$error = "Error happened !\n\n". $error = "Error happened!\n\n".
$e->getCode()." - ".$e->getMessage()."\n\nIn: ". $e->getCode()." - ".$e->getMessage()."\n\nIn: ".
$e->getFile() . ":" . $e->getLine()."\n\n"; $e->getFile() . ":" . $e->getLine()."\n\n";
@ -328,6 +328,11 @@ class VroumVroum_Blog
return true; return true;
} }
public function mustUpdateXsaf()
{
return file_exists('import.json');
}
protected function _getStreamContext() protected function _getStreamContext()
{ {
@ -375,9 +380,12 @@ class VroumVroum_Blog
{ {
$date = isset($item->published) ? (string) $item->published : (string) $item->updated; $date = isset($item->published) ? (string) $item->published : (string) $item->updated;
$guid = !empty($item->id) ? (string)$item->id : (string)$item->link['href']; $guid = !empty($item->id) ? (string)$item->id : (string)$item->link['href'];
if( count($item->content->children()) > 0 ) $content = (string)$item->content->asXML();
else $content = (string)$item->content;
$id = $this->insertOrUpdateArticle($guid, (string)$item->title, $id = $this->insertOrUpdateArticle($guid, (string)$item->title,
(string)$item->link['href'], strtotime($date), (string)$item->content); (string)$item->link['href'], strtotime($date), $content );
if ($id !== false) if ($id !== false)
$updated++; $updated++;
@ -425,6 +433,34 @@ class VroumVroum_Blog
return $updated; return $updated;
} }
public function updateXsaf() {
if($this->mustUpdateXsaf()) {
$json = json_decode(file_get_contents('import.json'), true);
$count = count($json['files']);
file_put_contents('import.lock', $count); /* one-process locking */
$remoteurl = $json['url'];
if (!file_exists('media')) {
mkdir('media');
}
$time = time();
$maxtime = $time + 3; /* max exec time: 3 seconds */
while ($time <= $maxtime) {
$file = array_shift($json['files']); /* get first element while unstacking */
if(!empty($file)) {
$this->_copy($remoteurl.$file, "media/$file");
file_put_contents('import.json', json_encode($json));
}
else {
unlink('import.json');
break;
} /* first element empty: import finished */
$time = time();
}
unlink('import.lock');
}
}
public function listArticlesByPage($page = 1) public function listArticlesByPage($page = 1)
{ {
@ -467,6 +503,7 @@ class VroumVroum_Blog
$res = $this->articles->query('SELECT id, uri, title, content $res = $this->articles->query('SELECT id, uri, title, content
FROM articles FROM articles
WHERE content LIKE \'%'.$this->articles->escapeString($query).'%\' WHERE content LIKE \'%'.$this->articles->escapeString($query).'%\'
OR title LIKE \'%'.$this->articles->escapeString($query).'%\'
ORDER BY id DESC ORDER BY id DESC
LIMIT 0,100;'); LIMIT 0,100;');
@ -537,6 +574,13 @@ class VroumVroum_Blog
} }
return $content; return $content;
} }
public function getXsafCounter() {
if($this->mustUpdateXsaf()) {
$json = json_decode(file_get_contents('import.json'), true);
return count($json['files']);
}
}
/* copy() is buggy with http streams and safe_mode enabled (which is bad), so here's a workaround */ /* copy() is buggy with http streams and safe_mode enabled (which is bad), so here's a workaround */
protected function _copy($from, $to) protected function _copy($from, $to)
@ -583,7 +627,7 @@ if (isset($_GET['feed'])) // FEED
<updated>'.date(DATE_ATOM, $art['date']).'</updated> <updated>'.date(DATE_ATOM, $art['date']).'</updated>
<content type="html"> <content type="html">
<![CDATA[(<a href="'.escape($art['feed_id']).'">source</a>)<br />'.escape_content($art['content']).']]> <![CDATA[(<a href="'.escape($art['url']).'">source</a>)<br />'.escape_content($art['content']).']]>
</content> </content>
</entry>'; </entry>';
} }
@ -649,6 +693,7 @@ if (!$search && !empty($_SERVER['QUERY_STRING']) && !is_numeric($_SERVER['QUERY_
} }
// common CSS // common CSS
<<<<<<< HEAD
$css=' * { margin: 0; padding: 0; } $css=' * { margin: 0; padding: 0; }
body { font-family:sans-serif; background-color: #efefef; padding: 1%; color: #333; } body { font-family:sans-serif; background-color: #efefef; padding: 1%; color: #333; }
img { max-width: 100%; height: auto; } img { max-width: 100%; height: auto; }
@ -676,48 +721,108 @@ $css=' * { margin: 0; padding: 0; }
.content h2 { font-size: 1.4em;color:#000; } .content h2 { font-size: 1.4em;color:#000; }
.result h3 a { color: darkblue; text-decoration: none; text-shadow: 1px 1px 1px #fff; } .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; } #error { position: fixed; top: 0; left: 0; right: 0; padding: 1%; background: #fff; border-bottom: 2px solid red; color: darkred; }
||||||| merged common ancestors
$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; }
=======
$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; }
body > header a { text-decoration: none; color: #000;font-weight:bold; }
body > header { text-align:center; padding: 30px 3%; max-width:70em;margin:0 auto; }
body > article > header { margin-bottom: 1em; }
body > article > header h2 a:hover { color:#403976; }
body > article h4 { font-weight: normal; font-size: small; color: #666; }
body > article .source a { color: #666; }
body > header > form { float:right; }
body > header > form input { }
body > nav { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; }
body > nav strong { font-size: 1.2em; color: #333; }
body > nav a { color:#000; margin: 0 0.5em; }
body > nav a:hover { color:#333; }
body > footer a { color:#000; }
body > 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; }
>>>>>>> master
'; ';
if($site_type == 'generic') // custom CSS for generic switch($site_type) {
{ case 'microblog':
$css = $css.'.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px;text-transform:uppercase; } case 'twitter':
.article .title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } $css .= "\n".' /* twitter/microblog style */
.article .title h2 a { color:#000; text-decoration:none; } body > header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; }
.article .source { font-size: 0.8em; color: #666; } body > article > header 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 { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; } body > article > header h2 a { color:#333; text-decoration:none; }
.footer { text-align:center; font-size: small; color:#333; clear: both; }'; body > article { background-color:white;padding: 12px 10px 33px;border:1px solid #aaa;max-width:70em;margin:0 auto;box-shadow:0px 5px 7px #aaa; }
} body > article .source { font-size: 0.8em; color: #666; }
else if($site_type == 'microblog' || $site_type == 'twitter' || $site_type == 'identica') // custom CSS for microblog body > 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;}';
$css = $css.'.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; } break;
.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; } case 'shaarli':
.article .title h2 a { color:#333; text-decoration:none; } $css .= "\n".' /* shaarli style */
.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; } body > header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; }
.article .source { font-size: 0.8em; color: #666; } body > article > header title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; }
.footer { margin-top:1em;text-align:center; font-size: small; color:#333; clear: both; } body > article > header h2 a { color:#000; text-decoration:none; }
.content {font-size:0.9em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}'; body > article { background-color:white;padding: 12px 10px 33px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; }
} body > article footer.source { margin-top:1em;font-size: 0.8em; color: #666; }
else if($site_type == 'shaarli') // custom CSS for shaarli body > footer { text-align:center; font-size: small; color:#333; clear: both; }';
{ break;
$css = $css.'.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; } case 'generic':
.article .title h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; } case 'youtube':
.article .title h2 a { color:#000; text-decoration:none; } default:
.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; } $css .= "\n".' /* youtube style */
.article .source { margin-top:1em;font-size: 0.8em; color: #666; } body > header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px;text-transform:uppercase; }
.footer { text-align:center; font-size: small; color:#333; clear: both; }'; body > article > header h2 { margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; }
} body > article > header h2 a { color:#000; text-decoration:none; }
body > article footer.source { font-size: 0.8em; color: #666; }
body > article { background-color:white;padding: 12px 10px 33px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; }
body > footer { text-align:center; font-size: small; color:#333; clear: both; }';
}
// HTML HEADER // HTML HEADER
echo ' echo '<!DOCTYPE html>
<!DOCTYPE html> <html lang="fr" dir="ltr">
<html lang="en" dir="ltr"> <head>
<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>'.escape($config->site_title).'</title> <title>'.escape($config->site_title).'</title>
<link rel="canonical" href="'.escape($config->site_url).'"> <link rel="canonical" href="'.escape($config->site_url).'">
<link rel="alternate" type="application/atom+xml" title="'.__('ATOM Feed').'" href="?feed"> <link rel="alternate" type="application/atom+xml" title="'.__('ATOM Feed').'" href="?feed">
<style type="text/css" media="screen,projection"> <style type="text/css" media="screen,projection">
<<<<<<< HEAD
'.$css.' '.$css.'
</style> </style>
</head> </head>
@ -731,66 +836,111 @@ if (!empty($config->site_description)){
echo '<p>'.$config->site_description.'<br><a href="../../">&lArr; retour index</a></p>'; echo '<p>'.$config->site_description.'<br><a href="../../">&lArr; retour index</a></p>';
} }
echo '<p class="pagination">'.$config->site_meta_description.'<br></p>'; echo '<p class="pagination">'.$config->site_meta_description.'<br></p>';
||||||| merged common ancestors
'.$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>';
=======
'.$css.'
</style>';
if( $vvb->mustUpdateXsaf()) {
echo ' <meta http-equiv="Refresh" content="1">';
}
echo ' echo '
<form method="get" action="'.escape(LOCAL_URL).'" class="searchForm"> </head>
<div> <body>
<input type="text" name="q" value="'.escape($search).'"> <header>
<input type="submit" value="'.__('Search').'"> <h1><a href="../../" style="font-size:0.8em;">PROJET AUTOBLOG'. (strlen(HEAD_TITLE) > 0 ? ' ~ '. HEAD_TITLE : '') .'</a></h1>
</div> <hr />
</form> <h1><a href="./">'.escape($config->site_title).'</a></h1>';
</div>
if (!empty($config->site_description))
echo '
<p>'.$config->site_description.'</p>
<p><a href="../../">&lArr; retour index</a></p>';
>>>>>>> master
echo '
<form method="get" action="'.escape(LOCAL_URL).'">
<input type="search" name="q" value="'.escape($search).'" />
<input type="submit" value="'.__('Search').'" />
</form>
</header>
'; ';
if ($vvb->mustUpdate()) if( $vvb->mustUpdateXsaf()) {
echo '
<article>
<header>
<h2>'.__('Update').'</h2>
</header>
<div class="content" id="update">
'.__('Import running: '). $vvb->getXsafCounter() . __(' files remaining').'<br>
'.__('The page should refresh every second. If not, <a href="javascript:window.location.reload()">refresh manually</a>.').'
</div>
</article>';
}
elseif ($vvb->mustUpdate())
{ {
echo ' echo '
<div class="article"> <article>
<div class="title"> <header>
<h2>'.__('Update').'</h2> <h2>'.__('Update').'</h2>
</div> </header>
<div class="content" id="update"> <div class="content" id="update">
'.__('Updating database... Please wait.').' '.__('Updating database... Please wait.').'
</div> </div>
</div>'; </article>';
} }
if (!empty($search)) if (!empty($search))
{ {
$results = $vvb->searchArticles($search); $results = $vvb->searchArticles($search);
$text = sprintf(__('<b>%d</b> results for <i>%s</i>'), count($results), escape($search)); $text = sprintf(__('<strong>%d</strong> results for <em>%s</em>'), count($results), escape($search));
echo ' echo '
<div class="article"> <article id="results">
<div class="title"> <header>
<h2>'.__('Search').'</h2> <h2>'.__('Search').'</h2>
'.$text.' '.$text.'
</div> </header>
</div>'; <article>';
foreach ($results as $art) foreach ($results as $art)
{ {
echo ' echo '
<div class="article result"> <article class="result">
<h3><a href="./?'.escape($art['uri']).'">'.escape($art['title']).'</a></h3> <header>
<p>'.$art['content'].'</p> <h3><a href="./?'.escape($art['uri']).'">'.escape($art['title']).'</a></h3>
</div>'; </header>
<p>'.$art['content'].'</p>
</article>';
} }
} }
elseif (!is_null($article)) elseif (!is_null($article))
{ {
if (!$article) if (!$article)
{ {
echo ' echo '
<div class="article"> <article>
<div class="title"> <header>
<h2>'.__('Not Found').'</h2> <h2>'.__('Not Found').'</h2>
'.(!empty($uri) ? '<p><tt>'.escape($vvb->getLocalURL($uri)) . '</tt></p>' : '').' '.(!empty($uri) ? '<p><tt>'.escape($vvb->getLocalURL($uri)) . '</tt></p>' : '').'
'.__('Article not found.').' '.__('Article not found.').'
</div> </header>
</div>'; </article>';
} }
else else
{ {
display_article($article); display_article($article);
} }
} }
else else
@ -808,35 +958,54 @@ else
} }
$max = $vvb->countArticles(); $max = $vvb->countArticles();
if ($max > $config->articles_per_page) if ($max > $config->articles_per_page) {
{ echo "\n".' <nav>'."\n";
echo '<div class="pagination">'; if ($page > 1)
echo ' <a rel="prev" href="'.$vvb->getLocalURL($page - 1).'">&larr; '.__('Newer').'</a>'."\n";
if ($page > 1) $last = ceil($max / $config->articles_per_page);
echo '<a href="'.$vvb->getLocalURL($page - 1).'">&larr; '.__('Newer').'</a> '; for ($i = 1; $i <= $last; $i++) {
echo ' '.($i == $page ? '<strong>'.$i.'</strong>' : '<a href="'.$vvb->getLocalURL($i).'">'.$i.'</a>')."\n";
}
$last = ceil($max / $config->articles_per_page); if ($page < $last)
for ($i = 1; $i <= $last; $i++) echo ' <a rel="next" href="'.$vvb->getLocalURL($page + 1).'">'.__('Older').' &rarr;</a>'."\n";
{
echo '<a href="'.$vvb->getLocalURL($i).'">'.($i == $page ? '<b>'.$i.'</b>' : $i).'</a> ';
}
if ($page < $last) echo ' </nav>';
echo '<a href="'.$vvb->getLocalURL($page + 1).'">'.__('Older').' &rarr;</a> ';
echo '</div>';
} }
} }
echo ' echo '
<div class="footer"> <footer>
<p>Propulsé par <a href="https://github.com/mitsukarenai/Projet-Autoblog">Projet Autoblog '.$vvbversion.'</a> - <a href="?feed">'.__('ATOM Feed').'</a></p> <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>) <p>'.__('Download:').' <a href="./'.basename(CONFIG_FILE).'">'.__('configuration').'</a> (<a href="?opml">OPML</a>)
- <a href="./'.basename(ARTICLES_DB_FILE).'">'.__('articles').'</a><p/> <a href="./'.basename(ARTICLES_DB_FILE).'">'.__('articles').'</a></p>
<p><a href="./?media">'.__('Media export').' <sup> JSON</sup></a></p> <p><a href="./?media">'.__('Media export').' <sup> JSON</sup></a></p>
</div>'; </footer>';
if ($vvb->mustUpdate()) if( $vvb->mustUpdateXsaf() ) {
try {
ob_end_flush();
flush();
}
catch (Exception $e)
{
// Silent, not critical
}
try {
$updated = $vvb->updateXsaf();
}
catch (VroumVroum_Feed_Exception $e)
{
echo '
<div id="error">
'.escape($e->getMessage()).'
</div>';
$updated = 0;
}
}
elseif ($vvb->mustUpdate())
{ {
try { try {
ob_end_flush(); ob_end_flush();
@ -853,34 +1022,34 @@ if ($vvb->mustUpdate())
catch (VroumVroum_Feed_Exception $e) catch (VroumVroum_Feed_Exception $e)
{ {
echo ' echo '
<div id="error"> <div id="error">
'.escape($e->getMessage()).' '.escape($e->getMessage()).'
</div>'; </div>';
$updated = 0; $updated = 0;
} }
if ($updated > 0) if ($updated > 0)
{ {
echo ' echo '
<script type="text/javascript"> <script type="text/javascript">
window.onload = function () { window.onload = function () {
document.getElementById("update").innerHTML = "'.__('Update complete!').' <a href=\\"#reload\\" onclick=\\"window.location.reload();\\">'.__('Click here to reload this webpage.').'</a>"; document.getElementById("update").innerHTML = "'.__('Update complete!').' <a href=\\"#reload\\" onclick=\\"window.location.reload();\\">'.__('Click here to reload this webpage.').'</a>";
}; };
</script>'; </script>';
} }
else else
{ {
echo ' echo '
<script type="text/javascript"> <script type="text/javascript">
window.onload = function () { window.onload = function () {
document.body.removeChild(document.getElementById("update").parentNode); document.body.removeChild(document.getElementById("update").parentNode);
}; };
</script>'; </script>';
} }
} }
echo ' echo '
</body> </body>
</html>'; </html>';
@ -896,15 +1065,14 @@ function display_article($article)
{ {
global $vvb, $config; global $vvb, $config;
echo ' echo '
<div class="article"> <article>
<div class="title"> <header>
<h2><a href="'.$vvb->getLocalURL($article).'">'.escape($article['title']).'</a></h2> <h2><a href="'.$vvb->getLocalURL($article).'">'.escape($article['title']).'</a></h2>
'.strftime(__('_date_format'), $article['date']).' '.strftime(__('_date_format'), $article['date']).'
</div> </header>
<div class="content">'.escape_content($article['content']).'</div> <div class="content">'.escape_content($article['content']).'</div>
<p class="source">'.__('Source:').' <a href="'.escape($article['url']).'">'.escape($article['url']).'</a></p> <footer class="source"><p>'.__('Source:').' <a href="'.escape($article['url']).'">'.escape($article['url']).'</a></p></footer>
<br style="clear: both;" /> </article>';
</div>';
} }
?> ?>

View file

@ -1,46 +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', false );
// define( 'ALLOW_NEW_AUTOBLOGS_BY_LINKS', TRUE );
// define( 'ALLOW_NEW_AUTOBLOGS_BY_SOCIAL', TRUE );
// define( 'ALLOW_NEW_AUTOBLOGS_BY_BUTTON', TRUE );
// define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML_FILE', TRUE );
// define( 'ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK', TRUE );
// define( 'ALLOW_NEW_AUTOBLOGS_BY_XSAF', TRUE );
/**
* 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'
);
$myOptions['enableThumbShot'] = true;
$myOptions['externalThumbSdhot'] = 'http://soshot.knah-tsaeb.org/?key=3400affe9919&s=m&url=';
?>

57
config.php.example Normal file
View file

@ -0,0 +1,57 @@
<?php
/**
* config.php.example - User configuration file
* ---
* 1. Rename this file to config.php.
* 2. Uncomment settings 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( 'DOCS_CACHE_DURATION', 1800);
// define( 'AUTOBLOGS_CACHE_DURATION', 1800);
// 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 );
/**
* TwitterBridge: https://github.com/mitsukarenai/twitterbridge
* twitter2feed : https://github.com/mitsukarenai/twitter2feed
* rss-bridge : https://github.com/sebsauvage/rss-bridge
* replace LOCAL with:
- the twitterbridge request URL (example: 'http://www.some.website/twitterbridge/?u=' )
- or the rss-bridge request URL (example: 'http://www.some.website/rss-bridge/?action=display&bridge=TwitterBridge&format=AtomFormat&u=' )
- or leave LOCAL to use the included twitter2feed.php.
* set to FALSE if you want to fully disable Twitter support
**/
// define( 'API_TWITTER', 'LOCAL' );
/**
* 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',
// 'http://autoblog.suumitsu.eu/?export',
// 'http://streisand.hoa.ro/?export',
);
$myOptions['enableThumbShot'] = true;
$myOptions['externalThumbSdhot'] = 'http://soshot.knah-tsaeb.org/?key=apikey&s=m&url=';
?>

View file

@ -16,6 +16,9 @@ if (!defined('FOLDER_MAX_LENGTH')) define('FOLDER_MAX_LENGTH', 80);
date_default_timezone_set('Europe/Paris'); date_default_timezone_set('Europe/Paris');
setlocale(LC_TIME, 'fr_FR.UTF-8', 'fr_FR', 'fr'); setlocale(LC_TIME, 'fr_FR.UTF-8', 'fr_FR', 'fr');
if( !defined('DOCS_CACHE_DURATION')) define( 'DOCS_CACHE_DURATION', 1800 );
if( !defined('AUTOBLOGS_CACHE_DURATION')) define( 'AUTOBLOGS_CACHE_DURATION', 1800 );
if( !defined('ALLOW_FULL_UPDATE')) define( 'ALLOW_FULL_UPDATE', TRUE ); if( !defined('ALLOW_FULL_UPDATE')) define( 'ALLOW_FULL_UPDATE', TRUE );
if( !defined('ALLOW_CHECK_UPDATE')) define( 'ALLOW_CHECK_UPDATE', TRUE ); if( !defined('ALLOW_CHECK_UPDATE')) define( 'ALLOW_CHECK_UPDATE', TRUE );
@ -29,7 +32,7 @@ if( !defined('ALLOW_NEW_AUTOBLOGS_BY_OPML_LINK')) define( 'ALLOW_NEW_AUTOBLOGS_B
if( !defined('ALLOW_NEW_AUTOBLOGS_BY_XSAF')) define( 'ALLOW_NEW_AUTOBLOGS_BY_XSAF', TRUE ); if( !defined('ALLOW_NEW_AUTOBLOGS_BY_XSAF')) define( 'ALLOW_NEW_AUTOBLOGS_BY_XSAF', TRUE );
// More about TwitterBridge : https://github.com/mitsukarenai/twitterbridge // More about TwitterBridge : https://github.com/mitsukarenai/twitterbridge
if( !defined('API_TWITTER')) define( 'API_TWITTER', FALSE ); if( !defined('API_TWITTER')) define( 'API_TWITTER', 'LOCAL' );
if( !defined('LOGO')) define( 'LOGO', 'icon-logo.svg' ); if( !defined('LOGO')) define( 'LOGO', 'icon-logo.svg' );
if( !defined('HEAD_TITLE')) define( 'HEAD_TITLE', ''); if( !defined('HEAD_TITLE')) define( 'HEAD_TITLE', '');
@ -39,7 +42,7 @@ if( !defined('FOOTER')) define( 'FOOTER', 'D\'après les premières versions de
* Functions * Functions
**/ **/
function NoProtocolSiteURL($url) { function NoProtocolSiteURL($url) {
$protocols = array("http://", "https://"); $protocols = array("http://", "https://");
$siteurlnoproto = str_replace($protocols, "", $url); $siteurlnoproto = str_replace($protocols, "", $url);
// Remove the / at the end of string // Remove the / at the end of string
@ -158,8 +161,12 @@ function getArticlesPerPage( $type ) {
switch( $type ) { switch( $type ) {
case 'microblog': case 'microblog':
return 20; return 20;
case 'twitter':
return 20;
case 'shaarli': case 'shaarli':
return 20; return 20;
case 'youtube':
return 10;
default: default:
return 5; return 5;
} }
@ -169,6 +176,8 @@ function getInterval( $type ) {
switch( $type ) { switch( $type ) {
case 'microblog': case 'microblog':
return 300; return 300;
case 'twitter':
return 300;
case 'shaarli': case 'shaarli':
return 1800; return 1800;
default: default:
@ -178,10 +187,6 @@ function getInterval( $type ) {
function getTimeout( $type ) { function getTimeout( $type ) {
switch( $type ) { switch( $type ) {
case 'microblog':
return 30;
case 'shaarli':
return 30;
default: default:
return 30; return 30;
} }
@ -191,12 +196,12 @@ function updateType($siteurl) {
if( strpos($siteurl, 'twitter.com') !== FALSE ) { if( strpos($siteurl, 'twitter.com') !== FALSE ) {
return array('type' => 'twitter', 'name' => 'twitter'); return array('type' => 'twitter', 'name' => 'twitter');
} }
elseif ( strpos( $siteurl, 'identi.ca') !== FALSE ) {
return array('type' => 'identica', 'name' => 'identica');
}
elseif( strpos( $siteurl, 'shaarli' ) !== FALSE ) { elseif( strpos( $siteurl, 'shaarli' ) !== FALSE ) {
return array('type' => 'shaarli', 'name' => 'shaarli'); return array('type' => 'shaarli', 'name' => 'shaarli');
} }
elseif( strpos( $siteurl, 'youtube.com' ) !== FALSE ) {
return array('type' => 'youtube', 'name' => '');
}
else else
return array('type' => 'generic', 'name' => ''); return array('type' => 'generic', 'name' => '');
} }
@ -256,11 +261,14 @@ function __($str)
return 'Source :'; return 'Source :';
case '_date_format': case '_date_format':
return '%A %e %B %Y à %H:%M'; return '%A %e %B %Y à %H:%M';
case 'configuration':
case 'articles':
return $str;
case 'Media export': case 'Media export':
return 'Export fichiers media'; return 'Export fichiers media';
case 'Import running: ':
return 'Import en cours : ';
case ' files remaining':
return ' fichiers restants';
case 'The page should refresh every second. If not, <a href="javascript:window.location.reload()">refresh manually</a>.':
return 'La page devrait se rafraîchir toutes les secondes. Si non, <a href="javascript:window.location.reload()">rafraîchissez là manuellement.</a>.';
default: default:
return $str; return $str;
} }
@ -278,6 +286,7 @@ $json[] = array(
'status'=>$status, 'status'=>$status,
'response_code'=>$response_code 'response_code'=>$response_code
); );
$json = array_slice($json, -50, 50);
if(file_put_contents(RESOURCES_FOLDER.'rss.json', json_encode($json), LOCK_EX) === FALSE) if(file_put_contents(RESOURCES_FOLDER.'rss.json', json_encode($json), LOCK_EX) === FALSE)
{ return FALSE; } { return FALSE; }
else { return TRUE; } else { return TRUE; }
@ -287,47 +296,52 @@ function displayXMLstatus($status, $response_code, $autoblog_url, $autoblog_titl
switch ($status) switch ($status)
{ {
case 'unavailable': 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>'; return 'Autoblog "'.$autoblog_title.'" : site distant inaccessible (code '.$response_code.')<br>Autoblog : <a href="'. serverUrl(true).$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': 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>'; return 'Autoblog "'.$autoblog_title.'" : site distant redirigé (code '.$response_code.')<br>Autoblog : <a href="'. serverUrl(true).$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': 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>'; return 'Autoblog "'.$autoblog_title.'" : site distant introuvable (code '.$response_code.')<br>Autoblog : <a href="'. serverUrl(true).$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': 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>'; return 'Autoblog "'.$autoblog_title.'" : site distant a problème serveur (code '.$response_code.')<br>Autoblog : <a href="'. serverUrl(true).$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': 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>'; return 'Autoblog "'.$autoblog_title.'" : site distant à nouveau accessible (code '.$response_code.')<br>Autoblog : <a href="'. serverUrl(true).$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': 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>'; return 'Autoblog "'.$autoblog_title.'" ajouté.<br>Autoblog : <a href="'. serverUrl(true).$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() { function displayXML() {
header('Content-type: application/rss+xml; charset=utf-8'); header('Content-type: application/rss+xml; charset=utf-8');
echo '<?xml version="1.0" encoding="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>'; <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><link>'.serverUrl(true).'</link>';
echo '<atom:link href="'.serverUrl(false) . '/?rss" 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>'; echo '<atom:link href="'.serverUrl(true) . '/?rss" rel="self" type="application/rss+xml"/><title>Projet Autoblog'. ((strlen(HEAD_TITLE)>0) ? ' | '. HEAD_TITLE : '').'</title><description>Projet Autoblog - RSS : Ajouts et changements de disponibilité.</description>';
if(file_exists(RESOURCES_FOLDER.'rss.json')) if(file_exists(RESOURCES_FOLDER.'rss.json'))
{
$json = json_decode(file_get_contents(RESOURCES_FOLDER.'rss.json'), true);
rsort($json);
foreach ($json as $item)
{ {
$description = displayXMLstatus($item['status'],$item['response_code'],$item['autoblog_url'],$item['autoblog_title'],$item['autoblog_sourceurl'],$item['autoblog_sourcefeed']); $json = json_decode(file_get_contents(RESOURCES_FOLDER.'rss.json'), true);
$link = serverUrl(true).AUTOBLOGS_FOLDER.$item['autoblog_url']; rsort($json);
$date = date("r", $item['timestamp']); foreach ($json as $uitem)
print <<<EOT {
$item = array();
foreach($uitem AS $Key => $Value) {
$item[$Key] = escape($Value);
}
$description = displayXMLstatus($item['status'],$item['response_code'],$item['autoblog_url'],$item['autoblog_title'],$item['autoblog_sourceurl'],$item['autoblog_sourcefeed']);
$link = serverUrl(true).$item['autoblog_url'];
$date = date(DATE_RSS, $item['timestamp']);
print <<<EOT
<item> <item>
<title>{$item['autoblog_title']}</title> <title>{$item['autoblog_title']}</title>
<description><![CDATA[{$description}]]></description> <description><![CDATA[{$description}]]></description>
<link>{$link}</link> <link>{$link}</link>
<guid isPermaLink="false">{$item['timestamp']}</guid> <guid isPermaLink="false">{$item['timestamp']}</guid>
<author>admin@{$_SERVER['SERVER_NAME']}</author> <dc:creator>Autoblog</dc:creator>
<pubDate>{$date}</pubDate> <pubDate>{$date}</pubDate>
</item> </item>
EOT; EOT;
}
} }
} echo '</channel></rss>';
echo '</channel></rss>';
} }
?> ?>

801
index.php Executable file → Normal file

File diff suppressed because it is too large Load diff

View file

@ -9,40 +9,42 @@
body {background-color:#efefef;text-align:center;color:#333;font-family:sans-serif;} body {background-color:#efefef;text-align:center;color:#333;font-family:sans-serif;}
a {color:black;text-decoration:none;font-weight:bold;} a {color:black;text-decoration:none;font-weight:bold;}
a:hover {color:darkred;} a:hover {color:darkred;}
h1 {text-align:center;font-size:40pt;text-shadow: #ccc 0px 5px 5px;} h1 {text-transform:uppercase;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; } 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;} body > section {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;}
li {list-style-type:none;}
input[type="text"]{width:20em;} input[type="text"]{width:20em;}
input[type="radio"] {width:1em;} input[type="radio"] {width:1em;}
input[type="submit"] {width:8em;} input[type="submit"] {width:8em;}
div.form {padding:0.2em;border:1px solid #fff;} section.form {padding:0.2em;border:1px solid #fff;}
div.form:hover {background-color:#FAF4DA;border:1px dotted;} section.form:hover {background-color:#FAF4DA;border:1px dotted;}
#contentVignette {text-align: center;} section#autoblogs > ul {text-align: center;padding:0;}
.vignette {width:27%;height:2em;display: inline-block;text-align:justify;margin:0; padding:20px;background-color:#eee;border: 1px solid #888;} section#autoblogs > ul > li {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;} section#autoblogs > ul > li:hover {background-color:#fff;}
.vignette .title {font-size: 14pt;text-shadow: #ccc 0px 5px 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} section#autoblogs > ul > li header, section#autoblogs > ul > li h3 {font-size: large;text-shadow: #ccc 0px 5px 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.vignette .title a:hover {color:darkred; text-decoration:none;} section#autoblogs > ul > li h3 {display:inline;font-size:large;text-overflow:ellipsis;width:100%;}
.vignette .source {font-size:x-small;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} section#autoblogs > ul > li header a:hover {color:darkred; text-decoration:none;}
.vignette .source a:hover {color:darkred; text-decoration:none;} section#autoblogs > ul > li .source {font-size:x-small;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
section#autoblogs > ul > li .source a:hover {color:darkred; text-decoration:none;}
.clear {clear:both;text-align:right;font-size:small;} .clear {clear:both;text-align:right;font-size:small;}
#logo {float: right;} #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;} .bouton{border: 1px none;padding: 10px;border: 1px solid #777777;border-radius: 8px 8px 8px 8px;box-shadow: 0 1px 0 0 #FFFFFF inset;display: inline-block;}
.success {color: green;} .success {color: green;}
.error {color: red;} .error {color: red;}
.button_list{display:none;} .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{box-shadow:inset 0 1px 0 0 #d9fbbe;background:0;background-color:#b8e356;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:hover{background:0;background-color:#a5cc52;}
.button:active{position:relative;top:1px;} .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;} .buttonactive{background-color:#aaa;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) { @media screen and (max-width:1024px) {
.vignette { width: 40%; } section#autoblogs > ul > li { width: 40%; }
} }
@media screen and (max-width:640px) { @media screen and (max-width:640px) {
h1 { font-size:20pt; } h1 { font-size:20pt; }
.button, .button:hover, .button:active, .buttonactive { display: block; margin: auto; text-align:center; } .button, .button:hover, .button:active, .buttonactive { display: block; margin: auto; text-align:center; }
.vignette { width: 80%; } section#autoblogs > ul > li { width: 80%; }
} }
@media screen and (max-width:480px) { @media screen and (max-width:480px) {
#logo { max-width: 250px; } #logo { max-width: 250px; }
input[type="text"]{width:15em;} input[type="text"]{width:15em;}
} }

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15"><circle cx="7.5" cy="7.5" r="4" style="stroke:#000;fill:none;stroke-width:4" /></svg>

After

Width:  |  Height:  |  Size: 149 B

BIN
resources/icon-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -1,218 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) --> <svg xmlns="http://www.w3.org/2000/svg">
<path d="m 106.4,68.92 h -1.718 v -8.911 c 0,-0.7938 0.026,-1.968 0.0781,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103 l -1.435,1.181 -0.9467,-1.2 3.738,-2.918 h 1.464 v 14.27" />
<svg <g transform="matrix(0.91699047,-0.39890912,0.39890912,0.91699047,0,0)">
xmlns:dc="http://purl.org/dc/elements/1.1/" <path d="m 63.17,105.2 h -1.718 v -8.911 c -6e-6,-0.7938 0.02602,-1.968 0.07808,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103 l -1.435,1.181 -0.9467,-1.2 3.738,-2.918 h 1.464" />
xmlns:cc="http://creativecommons.org/ns#" </g>
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" <g transform="matrix(-0.59341889,-0.8048938,0.8048938,-0.59341889,0,0)">
xmlns:svg="http://www.w3.org/2000/svg" <path d="m -126.7,27.24 h -1.718 v -8.911 c 0,-0.7938 0.026,-1.968 0.0781,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103 l -1.435,1.181 -0.9467,-1.2 3.738,-2.918 h 1.464" />
xmlns="http://www.w3.org/2000/svg" </g>
version="1.1" <g transform="matrix(0.31316381,-0.94969913,0.94969913,0.31316381,0,0)">
width="300" <path d="m -41.44,113 h -1.718 v -8.911 c -5e-6,-0.7938 0.02602,-1.968 0.07808,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103 l -1.435,1.181 -0.9467,-1.2 3.738,-2.918" />
height="180" </g>
id="svg2"> <g transform="matrix(-0.26555612,-0.9640954,0.9640954,-0.26555612,0,0)">
<defs <path d="m -101.8,68.7 h -1.718 v -8.911 c -1e-5,-0.7938 0.026,-1.968 0.0781,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103 l -1.435,1.181 -0.9467,-1.2" />
id="defs4" /> </g>
<metadata <g transform="matrix(-0.66392621,0.74779809,-0.74779809,-0.66392621,0,0)">
id="metadata7"> <path d="m -10.77,-142.4 h -1.718 v -8.911 c -6e-6,-0.7938 0.02602,-1.968 0.07808,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103 l -1.435,1.181" />
<rdf:RDF> </g>
<cc:Work <g transform="matrix(0.61648634,0.7873656,-0.7873656,0.61648634,0,0)">
rdf:about=""> <path d="m 122.5,-67.26 h -1.718 v -8.911 c -1e-5,-0.7938 0.026,-1.968 0.0781,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103 l -1.435,1.181" />
<dc:format>image/svg+xml</dc:format> </g>
<dc:type <g transform="matrix(0.03315518,0.99945022,-0.99945022,0.03315518,0,0)">
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <path d="m 86.24,-144.5 h -1.718 v -8.911 c -5e-6,-0.7938 0.02602,-1.968 0.07808,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103" />
<dc:title></dc:title> </g>
</cc:Work> <g transform="matrix(0.56208338,0.82708057,-0.82708057,0.56208338,0,0)">
</rdf:RDF> <path d="m 141.5,-115.3 h -1.718 v -8.911 c -1e-5,-0.7938 0.026,-1.968 0.0781,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103" />
</metadata> </g>
<g <g transform="matrix(0.4102414,0.91197697,-0.91197697,0.4102414,0,0)">
id="layer5"> <path d="m 106.6,-165.8 h -1.718 v -8.911 c -1e-5,-0.7938 0.026,-1.968 0.0781,-3.523 -0.2538,0.2798 -0.6474,0.6474 -1.181,1.103" />
<g </g>
id="text2990-7" <g transform="matrix(-0.23683815,0.97154912,-0.97154912,-0.23683815,0,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 21.37,-224.2 h -1.718 v -8.911 c -6e-6,-0.7938 0.02602,-1.968 0.07808,-3.523" />
<path </g>
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" <g transform="matrix(0.260336,0.96551808,-0.96551808,0.260336,0,0)">
id="path3056" /> <path d="m 109.5,-224.8 h -1.718 v -8.911 c -1e-5,-0.7938 0.026,-1.968 0.0781,-3.523" />
</g> </g>
<g <g transform="matrix(-0.7254,-0.2967,-0.483,1.181,0,0)">
transform="matrix(-0.96800707,0.25092291,-0.25092291,-0.96800707,0,0)" <path d="m -165.4,43.09 c -0.9741,0 -1.712,-0.4105 -2.214,-1.231" />
id="text2990-7-4" </g>
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"> <g transform="matrix(-0.7582,-0.1986,-0.3232,1.234,0,0)">
<path <path d="M -151.5,77.36" />
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" </g>
id="path3059" /> <g transform="matrix(-0.7675,-0.1589,-0.2587,1.249,0,0)">
</g> <path d="m -143.4,102.9 c -0.9741,0 -1.712,-0.4105 -2.214,-1.231 -0.5019,-0.8252 -0.7529,-2.016 -0.7529,-3.573 0,-3.199 0.989,-4.798 2.967,-4.798 0.9868,1e-5 1.731,0.4126 2.233,1.238" />
<g </g>
transform="matrix(0.91697723,-0.39893955,0.39893955,0.91697723,0,0)" <g transform="matrix(-0.7776,-0.09801,-0.1596,1.266,0,0)">
id="text2990-7-9" <path d="m -128.4,130.7 c -0.9741,0 -1.712,-0.4105 -2.214,-1.231 -0.5019,-0.8252 -0.7529,-2.016 -0.7529,-3.573 0,-3.199 0.989,-4.798 2.967,-4.798" />
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"> </g>
<path <g transform="matrix(1.222,0.1981,-0.3157,0.7669,0,0)">
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" <path d="m 108.4,118.4 h -1.48 v -7.679 c 0,-0.6841 0.0224,-1.696 0.0673,-3.036 -0.2187,0.2411 -0.5579,0.5579 -1.018,0.9504" />
id="path3062" /> </g>
</g> <g transform="matrix(1.238,-0.0259,-0.1721,0.8113,0,0)">
<g <path d="m 95.07,172.2 h -1.48 v -7.679 c -5e-6,-0.6841 0.02242,-1.696 0.06729,-3.036" />
transform="matrix(-0.59314555,-0.80509524,0.80509524,-0.59314555,0,0)" </g>
id="text2990-7-5" <g transform="matrix(1.238,-0.001471,-0.188,0.8077,0,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 97.01,203.2 h -1.48 v -7.679" />
<path </g>
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" <g transform="matrix(-1.236,0.0417,-0.03046,0.8101,0,0)">
id="path3065" /> <path d="M -87.84,107.6" />
</g> </g>
<g <g transform="scale(1.355,0.7382)">
transform="matrix(0.31319215,-0.94968978,0.94968978,0.31319215,0,0)" <path d="m 77.81,118.1 c -2.224,0 -3.908,-0.937 -5.054,-2.811 -1.146,-1.884 -1.719,-4.602 -1.719,-8.156 -2e-6,-7.302 2.258,-10.95 6.772,-10.95 2.253,2.1e-5 3.952,0.9418 5.098,2.826" />
id="text2990-7-81" </g>
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> </svg>

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15"><circle cx="7.5" cy="7.5" r="4" style="stroke:#F60;fill:none;stroke-width:4" /></svg>

After

Width:  |  Height:  |  Size: 149 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15"><circle cx="7.5" cy="7.5" r="4" style="stroke:#080;fill:none;stroke-width:4" /></svg>

After

Width:  |  Height:  |  Size: 149 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15"><circle cx="7.5" cy="7.5" r="4" style="stroke:#3AE;fill:none;stroke-width:4" /></svg>

After

Width:  |  Height:  |  Size: 149 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15"><circle cx="7.5" cy="7.5" r="4" style="stroke:#A00;fill:none;stroke-width:4" /></svg>

After

Width:  |  Height:  |  Size: 149 B

125
twitter2feed.php Executable file
View file

@ -0,0 +1,125 @@
<?php
/*
* Récupération du flux RSS d'un compte Twitter
* Passez le nom du compte en Paramètre. Exemple: http://monsite.com/twit2rss.php?name=Craftbukkit
* 2013 - by Tronics
*/
// ----------------------------
// Autoblog Project inclusion
// ----------------------------
if(file_exists("config.php")) require_once "config.php";
if(file_exists("functions.php")) require_once "functions.php";
if( !defined('API_TWITTER')) {header("HTTP/1.1 404 Not Found"); die('API_TWITTER is undefined: make it LOCAL in "config.php" if you want me to work for you.');}
if ('API_TWITTER' === FALSE) {header("HTTP/1.1 404 Not Found"); die('Twitter support disabled in "config.php". Sorry.');}
$api = API_TWITTER;
if ($api === 'LOCAL') { } else {header("HTTP/1.1 404 Not Found"); die('Custom twitterbridge defined in "config.php": leave me alone.');}
if(!isset($_GET['u'])) {header("HTTP/1.1 404 Not Found"); die('no username provided');}
$exclude_reply = '@'; // if you want twitter2feed to return replies too: $exclude_reply = '';
// ----------------------------
// Let's rock !
$name = $_GET["u"];
$str = file_get_contents("https://twitter.com/$name");
$nb = preg_match_all('%<div class="tweet original-tweet(.*)'.
'data-tweet-id="(?P<id>\d+)"(.*)'.
'(data-retweet-id="(?P<retweetid>\d+)"(.*))?'.
'data-screen-name="(?P<name>[^"]+)"(.*)'.
'<img class="avatar js-action-profile-avatar" src="(?P<avatar>[^"]+)" alt="(?P<fullname>[^"]*)">(.*)'.
'data-time="(?P<created>\d+)"(.*)'.
'<p class="js-tweet-text tweet-text">(?P<message>.*)</p>'.
'%sU', $str, $arr);
function parsemessage($message)
{
$message = preg_replace('%<a href="/([^"]+)"([^>]+)>%', '<a href="https://twitter.com/$1" class="twitter_account">', $message);
$message = preg_replace('%<s>(@|#)</s><b>([^<]+)</b>%', '$1$2', $message);
$message = preg_replace('%<a href="http://t.co/[^"]+" rel="nofollow" dir="ltr" data-expanded-url="([^"]+)" class="twitter-timeline-link" target="_blank" title="[^"]+"%', '<a href="$1" class="twitter_link"', $message);
$message = preg_replace('%<span class="[^"]+">([^<]+)</span>%', '$1', $message);
$message = preg_replace('%<span class="tco-ellipsis">&nbsp;…</span>%', '', $message);
return $message;
}
function parsetitle($message)
{
$message = preg_replace('%<a ([^>]+)>https?://([^/]+)/[^<]*</a>%', '[$2]', $message);
$message = strip_tags($message);
return $message;
}
$fullname = "?";
$updated = "";
if ($nb !== false)
{
for ($i = 0; $i < $nb; $i++)
{
$mname = $arr["name"][$i];
$mfullname = $arr["fullname"][$i];
if ($updated == "")
$updated = date(DATE_ATOM, $arr["created"][$i]);
if ($mname == $name)
{
$fullname = $mfullname;
break;
}
}
}
header('Content-type: application/xml; charset=UTF-8', true);
echo '<?xml version="1.0" encoding="utf-8"?' . '>' . PHP_EOL;
?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
<title>Twitter / <?php echo $name ?></title>
<id>tag:twitter.com,2013:Status:<?php echo $name ?></id>
<link type="text/html" rel="alternate" href="http://twitter.com/<?php echo $name ?>"/>
<link type="application/atom+xml" rel="self" href="http://<?php echo $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] ?>"></link>
<updated><?php echo $updated ?></updated>
<subtitle>Twitter de <?php echo $fullname ?>.</subtitle>
<?php
if ($nb !== false)
{
for ($i = 0; $i < $nb; $i++)
{
$message = parsemessage($arr["message"][$i]);
$mname = $arr["name"][$i];
$mfullname = $arr["fullname"][$i];
$avatar = $arr["avatar"][$i];
$id = $arr["id"][$i];
$created = date(DATE_ATOM, $arr["created"][$i]);
$rt = "";
if ($arr["retweetid"][$i] != "")
$rt = "RT <a href=\"https://twitter.com/$mname\">@$mname</a> : ";
$title = htmlspecialchars(parsetitle($rt . $message));
$header = "<img src=\"$avatar\" alt=\"$mname\"/> $mfullname (<a href=\"https://twitter.com/$mname\">@$mname</a>)<br/>\r\n";
$footer = "<br/>\r\n<a href=\"https://twitter.com/$mname/status/$id\">Afficher la conversation</a>";
$message = "$header$rt$message$footer";
$message = htmlspecialchars($message);
if(substr($title, 0, 1) !== $exclude_reply) {
echo <<<HTML
<entry>
<title>$title</title>
<content type="html">$message</content>
<id>tag:twitter.com,2013:https://twitter.com/$name/status/$id</id>
<published>$created</published>
<updated>$created</updated>
<link type="text/html" rel="alternate" href="https://twitter.com/$name/status/$id"/>
<link type="image/png" rel="image" href="$avatar"/>
<author>
<name>$name</name>
<uri>https://twitter.com/$name</uri>
</author>
</entry>
HTML;
}
}
}
?>
</feed>

View file

@ -1 +1 @@
0.3.0-DEV Build 1 0.3.2

View file

@ -2,10 +2,12 @@
define('DEBUG', false); define('DEBUG', false);
define('XSAF_VERSION', 3); define('XSAF_VERSION', 3);
define('AUTOBLOG_FILE_NAME', 'autoblog.php'); define('AUTOBLOG_FILE_NAME', 'autoblog.php'); // useless ?
define('ALLOW_REMOTE_DB_DL', false); define('ALLOW_REMOTE_DB_DL', true);
define('ALLOW_REMOTE_MEDIA_DL', false); define('ALLOW_REMOTE_MEDIA_DL', true);
define('EXEC_TIME', 20); define('EXEC_TIME', 10);
date_default_timezone_set('UTC');
header("HTTP/1.0 403 Forbidden"); /* Uncivilized method to prevent bot indexing, huh :) */ 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('X-Robots-Tag: noindex'); /* more civilized method, but bots may not all take into account */
@ -75,17 +77,12 @@ function xsafimport($xsafremote, $max_exec_time) {
$get_remote_media = ($json_import['meta']['xsaf-media_transfer'] == "true") ? true : false; $get_remote_media = ($json_import['meta']['xsaf-media_transfer'] == "true") ? true : false;
if(!empty($json_import['autoblogs'])) { if(!empty($json_import['autoblogs'])) {
foreach ($json_import['autoblogs'] as $value) { foreach ($json_import['autoblogs'] as $remote_folder => $value) {
if(DEBUG) debug('remote = '. $remote_folder);
if(count($value)==4 && !empty($value['SITE_TYPE']) && !empty($value['SITE_TITLE']) && !empty($value['SITE_URL']) && !empty($value['FEED_URL'])) { 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']); $sitetype = escape($value['SITE_TYPE']);
$sitename = escape($value['SITE_TITLE']); $sitename = escape($value['SITE_TITLE']);
$siteurl = escape($value['SITE_URL']); $siteurl = escape($value['SITE_URL']);
if(empty($value['SITE_META_DESCRIPTION'])){
$siteDesc = getSiteDesc(escape($value['SITE_URL']));
} else {
$siteDesc = escape($value['SITE_META_DESCRIPTION']);
}
// Do not use DetectRedirect because it's slow and it has been used when the feed was added // 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 = DetectRedirect(escape($value['FEED_URL']));
$rssurl = escape($value['FEED_URL']); $rssurl = escape($value['FEED_URL']);
@ -100,10 +97,10 @@ function xsafimport($xsafremote, $max_exec_time) {
/* autoblog */ /* autoblog */
if( $result === true ) { if( $result === true ) {
$foldername = urlToFolder($sitename, $rssurl); $foldername = urlToFolder($siteurl, $rssurl);
try { try {
createAutoblog($sitetype, $sitename, $siteurl, $rssurl,$siteDesc); createAutoblog($sitetype, $sitename, $siteurl, $rssurl);
if( DEBUG ) { if( 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>'; 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>';
@ -114,23 +111,23 @@ function xsafimport($xsafremote, $max_exec_time) {
/* ============================================================================================================================================================================== */ /* ============================================================================================================================================================================== */
/* récupération de la DB distante */ /* récupération de la DB distante */
if($get_remote_db == true && ALLOW_REMOTE_DB_DL ) { if($get_remote_db == true && ALLOW_REMOTE_DB_DL ) {
$remote_db = str_replace("?export", $foldername."/articles.db", $xsafremote); $remote_db = str_replace("?export", $remote_folder."/articles.db", $xsafremote);
copy($remote_db, './'. $foldername .'/articles.db'); copy($remote_db, './'. $foldername .'/articles.db');
} }
/* préparation à la récupération des médias distants */
if($get_remote_media == true && ALLOW_REMOTE_MEDIA_DL ) { if($get_remote_media == true && ALLOW_REMOTE_MEDIA_DL ) {
$remote_media=str_replace("?export", $foldername."/?media", $xsafremote); $remote_media=str_replace("?export", $remote_folder."/?media", $xsafremote);
if(DEBUG)
debug("Récupération de la liste des médias à $remote_media <br>");
$json_media_import = file_get_contents($remote_media); $json_media_import = file_get_contents($remote_media);
if(!empty($json_media_import)) if(DEBUG)
{ debug($json_media_import);
mkdir('./'.$foldername.'/media/'); $media_data = json_decode($json_media_import, true);
$json_media_import = json_decode($json_media_import, true); if(DEBUG)
$media_path=$json_media_import['url']; debug($media_data);
if(!empty($json_media_import['files'])) { if(!empty($json_media_import) && $media_data !== null && !empty($media_data['files']))
foreach ($json_media_import['files'] as $value) { {
copy($media_path.$value, './'.$foldername.'/media/'.$value); file_put_contents('./'. $foldername .'/import.json', $json_media_import);
}
}
} }
} }