Boys with toys...

I'm always surprised at what horrible things web developers can actually do in their work just to use AJAX stuff. I won't hurt anyone because there would be many useless deaths, but guys... use your head! A user wants interfaces to look nice, but not to hide the whole screen while reloading a single block (where's the point of using AJAX?), and they don't want to have to click on every single element to extend it just to be able to see data, either.

Don't use true filenames on your server

In a recent meeting with the Dokeos 2.0 team, I realized that sometimes things are not quite evident. One of these cases that can only be understood with experience is that there's no use in allowing a user to upload files and keep the true filenames on the server's disk. In fact, it is quite a bigger problem to do that instead of changing the filenames and storing files as hashes.

Reason 1: Avoid security issues

When uploading a file to the server, you will have filters in place (won't you?).

Loginshare for Dokeos

A long time ago, I developed a loginshare script for a customer, that I think can now be shared with the community. I don't know much about LoginShare, and the truth is that their forum doesn't tell me much either, but based on a similar script, I developed the following script to use Dokeos 1.8.5 with it. Just in case it would be useful to anyone... (it certainly will be more useful this way than abandoned in one of my directories).

PHP 5.3 and the Internationalization extension

In this article, Stas Malyshev describes the internationalization extension and mentions it's been included in the PHP 5.3 core. It is an extensive article with plenty of examples to explain every component of Internationalization: Locale, Collator, Number formatter, Date formatter, Message formatter, Normalizer, Grapheme and Internation Domain Names. Pretty useful. Storing it for later (when Dokeos will require 5.3 by default, or the installation of the extension in 5.2)

Get current PHP API

One method to know if the script being executed has been started through cli, apache or any other API is to use PHP_SAPI:
if (PHP_SAPI != 'cli') { ... }
will ensure that the script is executed in a command-line context before doing what's inside the brackets.

Building a cache cleaner from devel for Drupal 5

In a particular context, it happened to me to have to reproduce a cache cleaner feature for Drupal 5 without installing the Devel module. Although this article doesn't create anything new, I thought it might be worth explaining in case this would help someone someday. The idea is to re-use the code from the devel module and put it into another module for re-use without having the weight corresponding to a new module installation. The code from the devel module (devel.module) looks like this:
/** * Implementation of hook_menu(). */ function devel_menu($may_cache) { $items = array