Exemplo n.º 1
0
 /**
  * Save a device to the backend.
  *
  * This method is intended to be overridden by a child class.  However it
  * also implements some basic checks, so a typical backend will still
  * call this method via parent::
  *
  * @param string $account Account to which the user should be added
  *
  * @param string $extension Extension to be saved
  *
  * @param array $details Phone numbers, PIN, options, etc to be saved
  *
  * @return TRUE on success, PEAR::Error object on error
  * @throws Shout_Exception
  */
 public function saveDevice($account, $devid, &$details)
 {
     if (empty($account)) {
         throw new Shout_Exception(_("Invalid device information."));
     }
     if (!Shout::checkRights("shout:accounts:{$account}:devices", PERMS_EDIT, 1)) {
         throw new Shout_Exception(_("Permission denied to save devices in this account."));
     }
     if (empty($devid) || !empty($details['genauthtok'])) {
         list($devid, $password) = Shout::genDeviceAuth($account);
         $details['devid'] = $devid;
         $details['password'] = $password;
     }
 }