Monday, 28 July 2014

Set Timezone

This will set the timezone for all the php functions in a page. Put this at the top of a page:


Solve 5 annoying moodle problems

XMPP chat

Prosody is a good XMPP chat server. It can be installed from the distro repository.

A guide:

There are many desktop clients for XMPP. There are a few web clients too: and

However, for these web clients to connect to the XMPP server, they need to use HTTP, so the XMPP server needs a plugin to communicate using xmpp over http, called BOSH:

The BOSH plugin for Prosody is:

Once the bosh-bind plugin is installed, a redirect should be setup in the web server (Apache or Nginx). This is because, converse.js must connect to the XMPP server (through bosh) at port 5280. However, browsers prevent authentication to this port because of same-origin policies (to prevent XSS). Therefore, the javascript can be made to authenticate to a particular directory which redirects the request to the correct url and port.

For integrating prosody with Wordpress, there is a plugin:

However, this plugin requires wordpress to store passwords as md5 hashes (using a plugin) instead of phpass. Md5 hashes are very insecure so wordpress-authenticator cannot be used.

There is another prosody plugin for wordpress authentication:
However, the code is alpha and development seems to have halted.

To integrate converse.js with a site that already uses authentication, one needs to use PHP prebinding:

Prosody: creating accounts:

Wednesday, 23 July 2014

Wednesday, 9 July 2014

Improving email delivery (preventing spam flagging)