Decode URL-safe base64 data, dealing with missing '='.
public static uriB64Decode ( string $string ) : string | ||
$string | string | Encoded data. |
return | string | Decoded data. |
/** * Deconstruct the ID elements from the ID string * * @param string $id The ID to be deconstructed. * * @return array A tuple of (owner, folder subpath). */ private function _idDeconstruct($id) { if (!($decoded_id = Horde_Url::uriB64Decode($id))) { $msg = sprintf('Share id %s is invalid.', $id); $this->_logger->err($msg); throw new Horde_Exception_NotFound($msg); } if (!($sid = @unserialize($decoded_id))) { $msg = sprintf('Share id %s is invalid.', $decoded_id); $this->_logger->err($msg); throw new Horde_Exception_NotFound($msg); } return $sid; }
/** * Deletes a task from the backend. * * @param string $taskId The task to delete. */ protected function _delete($taskId) { $this->_getData()->delete(Horde_Url::uriB64Decode($taskId)); }
/** * Decode a token into the prefixed nonce and the hash. * * @param string $token The token to be decomposed. * * @return array An array of two elements: The nonce and the hash. */ private function _decode($token) { $b = Horde_Url::uriB64Decode($token); return array(substr($b, 0, 6), substr($b, 6)); }
/** * TODO */ protected function _convertMembers(&$attributes) { if (isset($attributes['__members'])) { $member_ids = unserialize($attributes['__members']); $attributes['member'] = array(); foreach ($member_ids as $member_id) { $source_id = null; if (strpos($member_id, ':')) { list($source_id, $member_id) = explode(':', $member_id, 2); } $mail = array('uid' => Horde_Url::uriB64Decode($member_id)); $member = null; if ($source_id) { try { $driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($source_id); try { $member = $driver->getObject($member_id); $name = $member->getValue('name'); if (!empty($name)) { $mail['display-name'] = $name; } $emails = $member->getValue('emails'); if ($emails) { $emails = explode(',', $emails); $mail['smtp-address'] = trim($emails[0]); if (!isset($mail['display-name'])) { $mail['display-name'] = $mail['smtp-address']; } } } catch (Horde_Exception_NotFound $e) { } } catch (Turba_Exception $e) { } } elseif (isset($this->_contacts_cache[$member_id])) { $member = $this->_contacts_cache[$member_id]; if (!empty($member['full-name'])) { $mail['display-name'] = $member['full-name']; } if (!empty($member['emails'])) { $emails = explode(',', $member['emails']); $mail['smtp-address'] = trim($emails[0]); if (!isset($mail['display-name'])) { $mail['display-name'] = $mail['smtp-address']; } } } $attributes['member'][] = $mail; } unset($attributes['__members']); } }
/** * Deletes a note permanently. * * @param array $note The note to delete. * * @return string The note's UID. * @throws Mnemo_Exception */ protected function _delete($noteId) { $this->synchronize(); $uid = Horde_Url::uriB64Decode($noteId); try { $this->_getData()->delete($uid); } catch (Horde_Kolab_Storage_Exception $e) { throw new Mnemo_Exception($e); } return $uid; }