\Mnemo_Driver_Sql

Mnemo storage implementation for Horde's Horde_Db database abstraction layer.

Copyright 2001-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (ASL). If you did not receive this file, see http://www.horde.org/licenses/apache.

Summary

Methods
Properties
Constants
retrieve()
listMemos()
getMemoDescription()
get()
getByUID()
add()
modify()
move()
delete()
deleteAll()
encryptionSupported()
toASNote()
toiCalendar()
fromiCalendar()
synchronize()
__construct()
No public properties found
No constants found
_add()
_modify()
_move()
_delete()
_deleteAll()
_loadPGP()
_encrypt()
_decrypt()
_decryptBody()
_generateId()
_buildNote()
$_memos
$_notepad
$_pgp
$_db
$_charset
$_column
N/A
No private methods found
No private properties found
N/A

Properties

$_memos

$_memos : array

Array holding the current memo list. Each array entry is a hash describing a memo. The array is indexed numerically by memo ID.

Type

array

$_notepad

$_notepad : string

String containing the current notepad name.

Type

string

$_pgp

$_pgp : \Horde_Crypt_pgp

Crypting processor.

Type

\Horde_Crypt_pgp

$_db

$_db : \Horde_Db_Adapter

The database connection object.

Type

\Horde_Db_Adapter

$_charset

$_charset : string

Charset

Type

string

$_column

$_column : \Horde_Db_Adapter_Base_Column

Column definition of body column.

Type

\Horde_Db_Adapter_Base_Column

Methods

retrieve()

retrieve(boolean  $raw = false) 

Retrieves all of the notes of the current notepad from the backend.

Parameters

boolean $raw

Return the raw bodies, don't try to decrypt.

Throws

\Mnemo_Exception

listMemos()

listMemos() : array

Lists memos based on the given criteria. All memos will be returned by default.

Returns

array —

Returns a list of the requested memos.

getMemoDescription()

getMemoDescription(  $body) 

Update the description (short summary) of a memo.

Parameters

$body

get()

get(string  $noteId, string  $passphrase = null) : array

Retrieves one note from the backend.

Parameters

string $noteId

The ID of the note to retrieve.

string $passphrase

A passphrase with which this note was supposed to be encrypted.

Throws

\Mnemo_Exception
\Horde_Exception_NotFound

Returns

array —

The array of note attributes.

getByUID()

getByUID(string  $uid, string  $passphrase = null) : array

Retrieves one note from the backend by UID.

Parameters

string $uid

The UID of the note to retrieve.

string $passphrase

A passphrase with which this note was supposed to be encrypted.

Throws

\Mnemo_Exception
\Horde_Exception_NotFound

Returns

array —

The array of note attributes.

add()

add(string  $desc, string  $body, array|string  $tags = '', string  $passphrase = null, string  $uid = null) : string

Adds a note to the backend storage.

Parameters

string $desc

The first line of the note.

string $body

The whole note body.

array|string $tags

The tags of the note.

string $passphrase

The passphrase to encrypt the note with.

string $uid

The note's UID.

Throws

\Mnemo_Exception

Returns

string —

The ID of the new note.

modify()

modify(string  $noteId, string  $desc, string  $body, string  $tags = '', string  $passphrase = null) 

Modifies an existing note.

Parameters

string $noteId

The note to modify.

string $desc

The first line of the note.

string $body

The whole note body.

string $tags

The tags of the note.

string $passphrase

The passphrase to encrypt the note with.

Throws

\Mnemo_Exception

move()

move(string  $noteId, string  $newNotepad) 

Moves a note to a new notepad.

Parameters

string $noteId

The note to move.

string $newNotepad

The new notepad.

Throws

\Mnemo_Exception

delete()

delete(string  $noteId) 

Deletes a note permanently.

Parameters

string $noteId

The note to delete.

Throws

\Mnemo_Exception

deleteAll()

deleteAll() 

Deletes all notes from the current notepad.

Throws

\Mnemo_Exception

encryptionSupported()

encryptionSupported() : boolean

Returns whether note encryption is supported.

Checks if PGP support could be loaded, if it supports symmetric encryption, and if we have a secure connection.

Returns

boolean —

Whether encryption is suppoted.

toASNote()

toASNote(array  $memo, array  $options = array()) : \Horde_ActiveSync_Message_Note

Create an AS memo from this task

Parameters

array $memo

A memo array.

array $options

Returns

\Horde_ActiveSync_Message_Note

toiCalendar()

toiCalendar(  $memo,   $calendar) : \Horde_Icalendar_Vnote

Export this memo in iCalendar format.

Parameters

$memo
$calendar

Returns

\Horde_Icalendar_Vnote —

object for this event.

fromiCalendar()

fromiCalendar(\Horde_Icalendar_Vnote  $vNote) : array

Create a memo (hash array) from a Horde_Icalendar_Vnote object.

Parameters

\Horde_Icalendar_Vnote $vNote

Returns

array —

Memo (hash array) created from the vNote.

synchronize()

synchronize(mixed  $token = false) 

Perform any synchronization with backend data handlers that may be necessary for the driver.

Parameters

mixed $token

A value indicating the last synchronization point, if available.

__construct()

__construct(string  $notepad, array  $params = array()) 

Construct a new SQL storage object.

Parameters

string $notepad

The name of the notepad to load/save notes from.

array $params

The connection parameters

Throws

\InvalidArguementException

_add()

_add(string  $noteId, string  $desc, string  $body, array|string  $tags, string  $uid) : string

Adds a note to the backend storage.

Parameters

string $noteId

The ID of the new note.

string $desc

The first line of the note.

string $body

The whole note body.

array|string $tags

The tags of the note.

string $uid

The note's UID.

Throws

\Mnemo_Exception

Returns

string —

The unique ID of the new note.

_modify()

_modify(string  $noteId, string  $desc, string  $body, string  $tags) : string

Modifies an existing note.

Parameters

string $noteId

The note to modify.

string $desc

The first line of the note.

string $body

The whole note body.

string $tags

The tags of the note.

Throws

\Mnemo_Exception

Returns

string —

The note's UID.

_move()

_move(string  $noteId, string  $newNotepad) : string

Moves a note to a new notepad.

Parameters

string $noteId

The note to move.

string $newNotepad

The new notepad.

Throws

\Mnemo_Exception

Returns

string —

The note's UID.

_delete()

_delete(  $noteId) : string

Deletes a note permanently.

Parameters

$noteId

Throws

\Mnemo_Exception

Returns

string —

The note's UID.

_deleteAll()

_deleteAll() : array

Deletes all notes from the current notepad.

Throws

\Mnemo_Exception

Returns

array —

An array of uids that have been removed.

_loadPGP()

_loadPGP() 

Loads the PGP encryption driver.

_encrypt()

_encrypt(string  $note, string  $passphrase) : string

Encrypts a note.

Parameters

string $note

The note text.

string $passphrase

The passphrase to encrypt the note with.

Returns

string —

The encrypted text.

_decrypt()

_decrypt(string  $note, string  $passphrase) : string

Decrypts a note.

Parameters

string $note

The encrypted note text.

string $passphrase

The passphrase to decrypt the note with.

Throws

\Mnemo_Exception

Returns

string —

The decrypted text.

_decryptBody()

_decryptBody(string  $body, string  $id, string  $passphrase) : boolean

Tries to decrypt the note body.

Parameters

string $body

The note body. Will be decrypted if possible, or set to an exception if decryption failed.

string $id

The note ID.

string $passphrase

An optional encryption password.

Returns

boolean —

Whether this was an encrypted note.

_generateId()

_generateId() : string

Generates a local note ID.

Returns

string —

A new note ID.

_buildNote()

_buildNote(array  $row, string  $passphrase = null, boolean  $raw = false) : array

Parameters

array $row

Hash of the note data, db keys.

string $passphrase

The encryption passphrase.

boolean $raw

Return the raw body, don't try to decrypt.

Throws

\Mnemo_Exception

Returns

array —

a Note hash.