getMemo() public static method

Retrieves a specific note from storage.
public static getMemo ( string $notepad, string $noteId, string $passphrase = null ) : array
$notepad string The notepad to retrieve the note from.
$noteId string The Id of the note to retrieve.
$passphrase string A passphrase with which this note was supposed to be encrypted.
return array The note.
Example #1
0
File: memo.php Project: horde/horde
         }
         /* Check our results. */
         if (!empty($haveError)) {
             $notification->push(sprintf(_("There was an error saving the note: %s"), $haveError), 'horde.warning');
         } else {
             $notification->push(sprintf(_("Successfully saved \"%s\"."), $memo_desc), 'horde.success');
         }
     }
     /* Return to the notepad view. */
     if (!Horde_Util::getFormData('save_only')) {
         Horde::url('list.php', true)->redirect();
     }
     break;
 case 'delete_memos':
     /* Delete the note if we're provided with a valid note ID. */
     if (!is_null($memo_id) && Mnemo::getMemo($memolist_id, $memo_id)) {
         if (getShare($memolist_id)->hasPermission($user, Horde_Perms::DELETE)) {
             $storage = $injector->getInstance('Mnemo_Factory_Driver')->create($memolist_id);
             try {
                 $storage->delete($memo_id);
                 $notification->push(_("The note was deleted."), 'horde.success');
             } catch (Mnemo_Exception $e) {
                 $notification->push(sprintf(_("There was an error removing the note: %s"), $e->getMessage()), 'horde.warning');
             }
         } else {
             $notification->push(_("Access denied deleting note."), 'horde.warning');
         }
     }
     /* Return to the notepad. */
     Horde::url('list.php', true)->redirect();
 default:
Example #2
0
File: pdf.php Project: horde/horde
        $note = $storage->getByUID($uid, $passphrase);
    } catch (Mnemo_Exception $e) {
        Horde::url('list.php', true)->redirect();
    }
    $note_id = $note['memo_id'];
    $notelist_id = $note['memolist_id'];
} else {
    /* If we aren't provided with a memo and memolist, redirect to
     * list.php. */
    $note_id = Horde_Util::getFormData('note');
    $notelist_id = Horde_Util::getFormData('notepad');
    if (!isset($note_id) || !$notelist_id) {
        Horde::url('list.php', true)->redirect();
    }
    /* Get the current memo. */
    $note = Mnemo::getMemo($notelist_id, $note_id, $passphrase);
}
try {
    $share = $GLOBALS['mnemo_shares']->getShare($notelist_id);
} catch (Horde_Share_Exception $e) {
    $notification->push(sprintf(_("There was an error viewing this notepad: %s"), $e->getMessage()), 'horde.error');
    Horde::url('list.php', true)->redirect();
}
if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
    $notification->push(_("You do not have permission to view this notepad."), 'horde.error');
    Horde::url('list.php', true)->redirect();
}
/* If the requested note doesn't exist, display an error message. */
if (!$note || !isset($note['memo_id'])) {
    $notification->push(_("Note not found."), 'horde.error');
    Horde::url('list.php', true)->redirect();
Example #3
0
        $memo = $storage->getByUID($uid, $passphrase);
    } catch (Mnemo_Exception $e) {
        Horde::url('list.php', true)->redirect();
    }
    $memo_id = $memo['memo_id'];
    $memolist_id = $memo['memolist_id'];
} else {
    /* If we aren't provided with a memo and memolist, redirect to
     * list.php. */
    $memo_id = Horde_Util::getFormData('memo');
    $memolist_id = Horde_Util::getFormData('memolist');
    if (!isset($memo_id) || !$memolist_id) {
        Horde::url('list.php', true)->redirect();
    }
    /* Get the current memo. */
    $memo = Mnemo::getMemo($memolist_id, $memo_id, $passphrase);
}
try {
    $share = $GLOBALS['mnemo_shares']->getShare($memolist_id);
} catch (Horde_Share_Exception $e) {
    $notification->push(sprintf(_("There was an error viewing this notepad: %s"), $e->getMessage()), 'horde.error');
    Horde::url('list.php', true)->redirect();
}
if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
    $notification->push(_("You do not have permission to view this notepad."), 'horde.error');
    Horde::url('list.php', true)->redirect();
}
/* If the requested note doesn't exist, display an error message. */
if (!$memo || !isset($memo['memo_id'])) {
    $notification->push(_("Note not found."), 'horde.error');
    Horde::url('list.php', true)->redirect();