Dr Clèm's Blog

Tags: Captain's log MySQLiToRSS Mastodon PHP AWStats W3CSS JavaScript TootLine Translation

Captain's Log

Sunday Nov 19, 2017 01:30

Couple of news about my blog.

MySQLiToRSS

First, I fixed the error in the git repository for MySQLiToRSS. The git link actually linked to MySQLiToRSS repository and not to SHA1BruteForce anymore.

Comments

Second, I added a commentary section. I started my intellectual development by arguing with people on a forum, the Forum Analogue, so it is important for me to have people's reviews. I am planning on adding a RSS feed for each commentary section so it will be easy to follow. I will also add a cookie to auto fill the fields Name and Website. I will put a check box if you want to add the cookie when you comment.

Mastodon

In order to promote Mastodon, I added two buttons at the bottom of each article, one to follow me, the other one to share the article.


Mastodon Follow me Mastodon Share
<style>
.mastodon-intent-btn {
  display: inline-block;
  color: #fff; 
  text-decoration: none; 
  font-size: 14px; 
  line-height: 32px; 
  font-weight: 500; 
  background: #2b90d9; 
  border-radius: 4px; 
  padding: 0 18px; 
  padding-left: 16px; 
  font-family: Roboto, sans-serif; 
 box-sizing: content-box;
}
.mastodon-intent-btn img {
    width: 48px; 
    height: 48px; 
    vertical-align: middle; 
    padding-top: 10px; 
    padding-bottom: 10px; 
  }
</style>

<script>
[].forEach.call(document.querySelectorAll('.mastodon-intent-btn'), function (el) {
    el.addEventListener('click', function(e) {
    e.preventDefault();
    window.open(e.target.href, 'mastodon-intent', 'width=400,height=400,resizable=no,menubar=no,status=no,scrollbars=yes');
  });
});
</script>

<a href='web+mastodon://follow?uri=acct:me@myinstance.tld' class='mastodon-intent-btn' target="_blank">
  <img src='data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2MS4wNzY5NTRtbSIgaGVpZ2h0PSI2NS40NzgzMW1tIiB2aWV3Qm94PSIwIDAgMjE2LjQxNDQgMjMyLjAwOTc2Ij48cGF0aCBkPSJNMjExLjgwNzM0IDEzOS4wODc1Yy0zLjE4MTI1IDE2LjM2NjI1LTI4LjQ5MjU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MjVIOTYuMjA3MzRWODUuNDIzMjVjMC0xNC44NDUtNS44MTYyNS0yMi4zNTI1LTE3LjQxODc1LTIyLjM1MjUtMTAuNDkzNzUgMC0xNS43NCA2LjMyODc1LTE1Ljc0IDE4Ljc5NzV2NTkuMTVIMzguOTA0ODRWODAuMDc3YzAtMTIuNDU1IDMuMTcxMjUtMjIuMzUyNSA5LjU0MTI1LTI5LjY3NSA2LjU2ODc1LTcuMzIyNSAxNS4xNzEyNS0xMS4wNzYyNSAyNS44NS0xMS4wNzYyNSAxMi4zNTUgMCAyMS43MTEyNSA0Ljc0ODc1IDI3Ljg5NzUgMTQuMjQ3NWw2LjAxMzc1IDEwLjA4MTI1IDYuMDE1LTEwLjA4MTI1YzYuMTg1LTkuNDk4NzUgMTUuNTQxMjUtMTQuMjQ3NSAyNy44OTc1LTE0LjI0NzUgMTAuNjc3NSAwIDE5LjI4IDMuNzUzNzUgMjUuODUgMTEuMDc2MjUgNi4zNjg3NSA3LjMyMjUgOS41NCAxNy4yMiA5LjU0IDI5LjY3NSIgZmlsbD0iIzMwODhkNCIvPjwvc3ZnPg==' alt='Mastodon'>
  Follow me
</a>

<?php
$title 
"My title";
$url "https://mydomain.tld/myarticle.php";
$mastodon "<a href='web+mastodon://share?text=";
$mastodonText $title;
$mastodonText .= " " $url;

$url_reserved_char = array("!""#""$""&""'""("")""*""+"",""/"":"";""=""?""@""[""]");
$url_subtitute = array("%21""%23""%24""%26""%27""%28""%29""%2A""%2B""%2C""%2F""%3A""%3B""%3D""%3F""%40""%5B""%5D");
for (
$x 0$x <= 10$x++)
{
 
$mastodonText str_replace($url_reserved_char[$x], $url_subtitute[$x], $mastodonText);
}

$mastodonText str_replace(" ""+"$mastodonText);
$mastodon .= $mastodonText;
$mastodon .= "' class='mastodon-intent-btn' target=\"_blank\" >";
echo 
$mastodon
?>

<img src='data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHd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3Ny41MDk4NCA4MC4wNzd2NjAuOTQxMjVoLTI0LjE0Mzc1di01OS4xNWMwLTEyLjQ2ODc1LTUuMjQ2MjUtMTguNzk3NS0xNS43NC0xOC43OTc1LTExLjYwMjUgMC0xNy40MTc1IDcuNTA3NS0xNy40MTc1IDIyLjM1MjV2MzIuMzc2MjVIOTYuMjA3MzRWODUuNDIzMjVjMC0xNC44NDUtNS44MTYyNS0yMi4zNTI1LTE3LjQxODc1LTIyLjM1MjUtMTAuNDkzNzUgMC0xNS43NCA2LjMyODc1LTE1Ljc0IDE4Ljc5NzV2NTkuMTVIMzguOTA0ODRWODAuMDc3YzAtMTIuNDU1IDMuMTcxMjUtMjIuMzUyNSA5LjU0MTI1LTI5LjY3NSA2LjU2ODc1LTcuMzIyNSAxNS4xNzEyNS0xMS4wNzYyNSAyNS44NS0xMS4wNzYyNSAxMi4zNTUgMCAyMS43MTEyNSA0Ljc0ODc1IDI3Ljg5NzUgMTQuMjQ3NWw2LjAxMzc1IDEwLjA4MTI1IDYuMDE1LTEwLjA4MTI1YzYuMTg1LTkuNDk4NzUgMTUuNTQxMjUtMTQuMjQ3NSAyNy44OTc1LTE0LjI0NzUgMTAuNjc3NSAwIDE5LjI4IDMuNzUzNzUgMjUuODUgMTEuMDc2MjUgNi4zNjg3NSA3LjMyMjUgOS41NCAxNy4yMiA5LjU0IDI5LjY3NSIgZmlsbD0iIzMwODhkNCIvPjwvc3ZnPg==' alt='Mastodon'>
  Share
</a>
Favicon

I added a favicon to the blog.

Tags

I added tags for each articles, currently at the top of the article.

PhD thesis

I manage to get rid of the iframe to display my PhD thesis. I generate the html base using pdf2htmlEX, which needs new maintainers. After a bit of rewriting, I think that I achieved something better integrated to this blog.

If anyone is interested, I can publish the code, but because it is based on an unmaintained software, I do not know if it is worth the trouble.

Statistics

Last, but not least, I spend two days to rewrite AWStats from Perl to PHP and adding W3CSS. I manage to get rid of the iframe to integrate the statistics to the blog. Overall, I made it a lot more modular than the original script, or maybe I have this feeling because I know my own code better or because I am more comfortable in PHP.



I think one of the nicest improvements are the filters. They are using GET, which I kept but I do not display by default. In my version, I use JavaScript to make an on-the-fly filter.



Fonts

I fix few serious font issues. For now on, they should be displayed problem.

Future
TootLine

I am working on TootLine, the PHP code that allows you to share your TootLine on your blog, like the one there is on the right or bottom, depending on the size of your screen. I have couple of issues to address before publishing it, which are proper word wrapping, create a cache for the media in order to solve CSP issue, handle the NSFW content that is displayed so far.

Tags' categories

I am planning on adding clickable tags to fetch all articles with matching tags.

Translation

I already published a note in French and I began to write couple of drafts in French, so I would like to make a French version of this blog, with most of the articles translated.

Mastodon Follow me Mastodon Share
Comments

Perfect
Posted by f4b1 on Monday Nov 20, 2017 11:35.
Very nice tips, thank's !
Dr Clément Février

I am Dr Clément Février, French, living in Grenoble. I defended my PhD on July 4th, 2016. After my defense I run as deputy deputy (not a typo) for the national parliamentary elections in the 1st circonscription of Isère for the political movement La France Insoumise.


Ça se passe dans l'Ain (entre autre). La France n'a pas les moyens de mettre 10000€ pour faire une enquête sur des malformations de bébés, on doit vraiment être un des pays les plus pauvre de la planète. L'État abandonnait déjà les vieux avec les retraites (ça coûte trop cher), la santé (ça coûte trop cher), la sécurité (ça coûte trop cher), la recherche (ça coûte trop cher), les pauvres (ça coûte trop cher), l'environnement (ça coûte trop cher),

mamot.fr/@LeMediaTV/1032052807

"Les états-unis [gentil] aurait espionner Assange [méchant]" (sauf dans Médiapart)
"Durant la manifestation, 15 policiers ont été gravement blessés par des projectiles a base d’œufs et de farines lancés par les manifestants, désigné de "ultra" par le gouvernement, et 12 manifestants auraient été légèrement blessés par des projectiles de provenances inconnus"

Si le gentil est accusé d'une exaction, alors non seulement le conditionnel est utilisé, mais en plus, les propos sont rapportés par le méchant. Exemple : "Selon [gilet jaune/Erdogan/Putin/Trump], le [gouvernement/kurdes/USA/UnPeuToutLeMonde] aurait fait un truc mal."
"Selon Erdogan [méchant], le PKK [gentil] est a l'origine de l'attaque suicide qui a tué des dizaines de civiles sur la place public."
"Erdogan [méchant] a lancé l'offensive contre les kurdes [gentils]"

"Gilet jaune blessé : les "selon" du 20 Heures" par Arrêt sur Images.

Maintenant, regardez n'importe quel article, si le conditionnel est utilisé sauf pour les exactions, où le présent de vérité général est utilisé, alors c'est un méchant/ennemis/terroriste/"ultra"/dictateur/..., si au contraire, le présent de vérité général est utilisé par défaut, alors c'est un gentil.

arretsurimages.net/emissions/c