Support iOS 5+ deprecated UDID. With CFUUIDCreate, each time you inst...

...all your app you'll get a new deviceuid, but the token may be the
same. You can end up with multiple entries for the same app, all with
the same valid token. Database changes:

CREATE UNIQUE INDEX `app_token` on apns_devices
(`appname`,`devicetoken`);
With this change, if a new UID is generated but the token is unchanged,
update the uid in the database:
  ON DUPLICATE KEY UPDATE `deviceuid`='{$deviceuid}',
Since it is now indexed, device token must be unique. This could be an
issue if you store devices in the table that did not successfully get
the token (or you reuse the table for non-iOS devices):
  ALTER TABLE apns_devices modify column devicetoken char(64) null;
Do not hardcode 'production' - added config variable.
Make _triggerError public so it can be used by apns.php etc.