Added push for IM applications integrated with nerdz and PMs. 

Please review code if possibile. Sorry for bad writing but it's time for me to sleep.

After having written pushed, a go daemon that asyncronously handles incoming push requests and forwards them to multiple services associated to a single user, I have now created a simple and short PHP socket library to connect with a local instance of pushed, and then I added config and push support into nerdz using these tools.

Nerdz Push architecture is made by several parts working together to keep track of ids of an user device and push any PM sent to him to all of his devices, even if they run on different platforms (only GCM is supported now, though).

Pushed is a daemon built with concurrency and not-blocking in mind (because otherwise a PHP script can take too long to run and decrease performances). It uses PostgreSQL for persistency.
Pushed implements a simple protocol, with few fast running boolean but blocking commands (EXISTS, SUBSCRIBED) and network bound and asyncronous commands (ADDUSER, DELUSER, SUBSCRIBE, UNSUBSCRIBE, PUSH). 
One peculiarity of pushed is that it implements a best effort protocol: pushed responds to an asyncronous command with ACCEPTED or REJECTED and a short message reply; there is no warranty that the user is valid, that the device id is good or anything; PHP shouldn't and doesn't care about this; these two replies only mean that the request itself is wrong even before its execution or that it makes sense.

JSON is involved in a large part of the infrastructure. It is used to represent a payload for the PUSH command, and push.php replies are mainly in this format.

push.php?action=[subscribe,unsubscribe] is a script that is remotely called via HTTP by a client. the client passes a service name and a device id via POST, and then the PHP script uses pushed-php-client to add an user (if needed) and a device id to pushed. if called with unsubscribe, the given id is deleted (actually unused, because gcm ids just expire after app removal from device and it's pushed GCM connector work to remove them from its own db).

PUSH commands are issued in pm.class.php, in function send(). No push operations happen for not registered users; a push field has been added to profiles table, and it is set to true the first time push.php?action=subscribe is used by the user. (ah, push.php has a built in flood limit regulation that uses a new field on profiles too).

Config has been edited (together with setup) to reflect the 3 new constants PUSHED_ENABLED (default:true), PUSHED_IP6 (default:true) and PUSHED_PORT (default: 5667).

Client is still not ready, though, and the stack needs still some bugfixing, but I opted for pushing this all to stress new code a bit and find any bug left in pushed.