Skip to content

Commit

Permalink
Merge branch 'dev' for 3.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
timovn committed Jul 5, 2016
2 parents c89c587 + 06e9802 commit c174073
Show file tree
Hide file tree
Showing 51 changed files with 932 additions and 1,086 deletions.
33 changes: 3 additions & 30 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,25 @@
| Blogotext is a lightweight PHP-only Blog engine. |
| |
| (c) 2006 Frederic Nassar. |
| (c) 2010-2014 Timo van Neerden, AKA Le Hollandais Volant |
| (c) 2010-* Timo van Neerden, AKA Le Hollandais Volant |
| |
| Blogotext is redistributed under the terms of the X11 / MIT Licence |
| http://opensource.org/licenses/MIT |
| |
| Blogotext is based upon others ressources, that are listed below. |
| |
| Please, feel free to send bugs reports or questions to |
| http://lehollandaisvolant.net/contact |
| |
+-------------------------------------------------------------------------+
| LINX |
+-------------------------------------------------------------------------+
| http://lehollandaisvolant.net/tout/linx/ |
| |
| Linx is an ultra-lightweight SQLite-based "delicous-like" url-saver. |
| |
| (c) 2011 Timo van Neerden, AKA Le Hollandais Volant |
| (c) March 2011 Timo van Neerden, AKA Le Hollandais Volant |
| |
| Linx is redistributed under the terms of the WTFPL. |
| |
+-------------------------------------------------------------------------+
| FREECAP |
+-------------------------------------------------------------------------+
| http://www.puremango.co.uk |
| |
| Freecap is an independent Image Captcha generator. |
| |
| (c) 2006 Howard Yend |
| |
| Freecap is redistributed under the terms of the GNU GPL License. |
| Freecap is used in Blogotext with special grant of its author. |
| |
+-------------------------------------------------------------------------+
| GOOGLE MATERIAL DESIGN ICONS |
+-------------------------------------------------------------------------+
| https://github.com/google/material-design-icons |
Expand All @@ -47,7 +32,7 @@
| (c) 2014 Google Inc |
| |
| The ressource is included according to the CC-BY-4.0 license |
| script-tutorials.com. |
| |
+-------------------------------------------------------------------------+
|   GOOGLE ROBOTO FONTS |
+-------------------------------------------------------------------------+
Expand All @@ -74,18 +59,6 @@
| http://creativecommons.org/licenses/by/3.0/ |
| |
+-------------------------------------------------------------------------+
|   PARSEDOWN |
+-------------------------------------------------------------------------+
| http://parsedown.org/ |
| |
| ParseDown is a PHP markdown parser. |
| |
| (c) 2013 Emanuil Rusev |
| |
| ParseDown is distributed under the MIT License and included in |
| Blogotext accordingly. |
| |
+-------------------------------------------------------------------------+
| ~ |
+-------------------------------------------------------------------------+
| |
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

This is [Blogotext](http://lehollandaisvolant.net/blogotext/), the lightweight SQLite Blog-Engine.

2011 - 2016 Timo van Neerden
(by Timo van Neerden, since 2010)

---

## Features

* Blog with comments and RSS feeds
* Links sharing (Shaarli-like)
* Links sharing
* RSS Reader
* Images/Files uploading and sharing
* JSON/ZIP/HTML import-export; Wordpress import

![alt tag](http://lehollandaisvolant.net/blogotext/blogotext-screen.png?3)

Expand All @@ -26,15 +27,13 @@ This is [Blogotext](http://lehollandaisvolant.net/blogotext/), the lightweight S
* min 1 Mo disk space (more data = more space needed)

## Recommended PHP-libraries
* GD (for captcha);
* cURL, LibXML (for RSS reader and links sharing)
* GD (for comments icons / favicons);
* cURL (for RSS reader, links sharing, comments icons)
* LibXML (for RSS reader)
* GZip (for zip exporting function)

## Installation
* Unzip the downloaded archive file
* Upload folder to your site (eg: to http://example.com/blog)
* Upload folder to your site (eg: to `http://example.com/blog`)
* Use your browser to go to your site
* Follow the few steps

## Bugs
* Please, report any bugs to me using [my email](http://lehollandaisvolant.net/contact) or the Github bugtracking system.
4 changes: 2 additions & 2 deletions admin/articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@

function afficher_liste_articles($tableau) {
if (!empty($tableau)) {
mb_internal_encoding('UTF-8');
$i = 0;
$out = '<ul id="billets">'."\n";
foreach ($tableau as $article) {
// COULEUR DE FOND SELON DATE
$out .= "\t".'<li'.( ($article['bt_date'] > date('YmdHis')) ? ' class="planned"' : '').'>'."\n";
// TITRE + ICONE SELON STATUT
$out .= "\t\t".'<span class="'.( ($article['bt_statut'] == '1') ? 'on' : 'off').'">'.'<a href="ecrire.php?post_id='.$article['bt_id'].'" title="'.htmlspecialchars(trim(mb_substr(strip_tags($article['bt_abstract']), 0, 249)), ENT_QUOTES).'">'.$article['bt_title'].'</a>'.'</span>'."\n";
$title = trim(htmlspecialchars(mb_substr(strip_tags( (empty($article['bt_abstract']) ? $article['bt_content'] : $article['bt_abstract']) ), 0, 249), ENT_QUOTES)) . '';
$out .= "\t\t".'<span class="'.( ($article['bt_statut'] == '1') ? 'on' : 'off').'">'.'<a href="ecrire.php?post_id='.$article['bt_id'].'" title="'.$title.'">'.$article['bt_title'].'</a>'.'</span>'."\n";
// DATE
$out .= "\t\t".'<span><a href="'.basename($_SERVER['SCRIPT_NAME']).'?filtre='.substr($article['bt_date'],0,8).'">'.date_formate($article['bt_date']).'</a><span>, '.heure_formate($article['bt_date']).'</span></span>'."\n";
// NOMBRE COMMENTS
Expand Down
14 changes: 1 addition & 13 deletions admin/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,17 @@
echo '<div id="auth">'."\n";
echo '<p><label for="user">'.ucfirst($GLOBALS['lang']['label_dp_identifiant']).'</label><input class="text" type="text" autocomplete="off" id="user" name="nom_utilisateur" placeholder="John Doe" value="" /></p>'."\n";
echo '<p><label for="password">'.ucfirst($GLOBALS['lang']['label_dp_motdepasse']).'</label><input class="text" id="password" type="password" placeholder="••••••••••••" name="mot_de_passe" value="" /></p>'."\n";
if (isset($GLOBALS['connexion_captcha']) and ($GLOBALS['connexion_captcha'] == "1")) {
echo '<p><label for="word">'.ucfirst($GLOBALS['lang']['label_dp_word_captcha']).'</label><input class="text" type="text" id="word" name="word" value="" /></p>'."\n";
echo '<p><a href="#" onclick="new_freecap();return false;" title="'.$GLOBALS['lang']['label_dp_changer_captcha'].'"><img src="../inc/freecap/freecap.php" id="freecap" alt="captcha"></a></p>'."\n";
}
echo '<p><label for="stay_logged">'.$GLOBALS['lang']['label_stay_logged'].'</label><input type="checkbox" id="stay_logged" name="stay_logged" checked /></p>'."\n";
echo '<p><input type="checkbox" id="stay_logged" name="stay_logged" checked class="checkbox" /><label for="stay_logged">'.$GLOBALS['lang']['label_stay_logged'].'</label></p>'."\n";
echo '<button class="submit button-submit" type="submit" name="submit">'.$GLOBALS['lang']['connexion'].'</button>'."\n";
echo '<input type="hidden" name="_verif_envoi" value="1" />'."\n";
echo '</div>'."\n";
echo '</form>'."\n";
}

function valider_form() {
// first test password
if (!password_verify($_POST['mot_de_passe'], USER_PWHASH)) {
return FALSE;
}
// then test captcha
if (isset($GLOBALS['connexion_captcha']) and ($GLOBALS['connexion_captcha'] == "1")) { // si captcha activé
if ( empty($_SESSION['freecap_word_hash']) or empty($_POST['word']) or (sha1(strtolower($_POST['word'])) != $_SESSION['freecap_word_hash']) ) {
return FALSE;
}
$_SESSION['freecap_word_hash'] = FALSE; // reset captcha word
}
return TRUE;
}

Expand Down
61 changes: 0 additions & 61 deletions admin/cache/favicons/get.php

This file was deleted.

101 changes: 101 additions & 0 deletions admin/cache/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php
# *** LICENSE ***
# This file is part of BlogoText.
# http://lehollandaisvolant.net/blogotext/
#
# 2006 Frederic Nassar.
# 2010-2015 Timo Van Neerden <[email protected]>
#
# BlogoText is free software.
# You can redistribute it under the terms of the MIT / X11 Licence.
#
# *** LICENSE ***

if (!isset($_GET['w'], $_GET['q'])) {
header("HTTP/1.0 400 Bad Request"); exit;
}

$expire = time() -60*60*24*7*365 ; // default: 1 year

if ($_GET['w'] == 'favicon') {
// target dir
$target_dir = 'favicons';
// source file
$domain = parse_url($_GET['q'], PHP_URL_HOST); // full URL given?
if ($domain === NULL) { $domain = parse_url($_GET['q'], PHP_URL_PATH); } // or only domain name?
if ($domain === NULL) { header("HTTP/1.0 400 Bad Request"); exit; } // or some unusable crap?
$source_file = 'http://www.google.com/s2/favicons?domain='.$domain;
// dest file
$target_file = $target_dir.'/'.md5($domain).'.png';
// expiration delay
$expire = time() -60*60*24*7*365 ; // default: 1 year
}

elseif ($_GET['w'] == 'gravatar') {
// target dir
$target_dir = 'gravatar';
// source file
if (strlen($_GET['q']) !== 32) { header("HTTP/1.0 400 Bad Request"); exit; } // g is 32 character long ? if no, die.
$hash = preg_replace("[^a-f0-9]", "", $_GET['q'] ); // strip out anything that doesn't belong in a md5 hash
if (strlen($hash) != 32) { header("HTTP/1.0 400 Bad Request"); exit; } // still 32 characters ? if no, given hash wasn't genuine. die.
$target_file = $hash.'.png';
$s = (isset($_GET['s']) and is_numeric($_GET['s'])) ? htmlspecialchars($_GET['s']) : 48; // try to get size
$d = (isset($_GET['d'])) ? htmlspecialchars($_GET['d']) : 'monsterid'; // try to get substitute image
$source_file = 'http://www.gravatar.com/avatar/'.$hash.'?s='.$s.'&d='.$d;
// dest file
$target_file = $target_dir.'/'.md5($hash).'.png';
// expiration delay
$expire = time() -60*60*24*30 ; // default: 30 days
}

else {
// wrong request: returning error 400.
header("HTTP/1.0 400 Bad Request"); exit;
}

/* processing :
- testing cache file
- gathering source file
- converting to PNG and saving
- sending image to browser
*/

// cached file existing & expired : mark to remove it
$force_new = FALSE;
if (file_exists($target_file) and filemtime($target_file) < $expire) {
$force_new = TRUE;
}

// no cached file or expired
if (!file_exists($target_file) or $force_new === TRUE) {
// request
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $source_file);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$file_content = curl_exec($curl_handle);
curl_close($curl_handle);
if ($file_content == NULL) { // impossible request
header("HTTP/1.0 404 Not Found"); exit;
}
// new request is a succes, delete old and save new file
if ($force_new === TRUE) {
unlink($target_file);
}
if (!is_dir($target_dir)) { mkdir($target_dir); }
file_put_contents($target_file, $file_content);

// testing format
$imagecheck = getimagesize($target_file);
if ($imagecheck['mime'] !== 'image/png') {
imagepng(imagecreatefromjpeg($target_file), $target_file.'2'); // if not, creating PNG and replacing
rename($target_file.'2', $target_file);
}
}

// send file to browser
header('Content-Type: image/png');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($target_file)).' GMT');
header('Content-Length: ' . filesize($target_file));
header('Cache-Control: public, max-age=2628000');
readfile($target_file);
exit;
57 changes: 0 additions & 57 deletions admin/cache/gravatar/get.php

This file was deleted.

Loading

0 comments on commit c174073

Please sign in to comment.