Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions lib/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -721,23 +721,31 @@ public function export($uid, $contentType, array $options = [])
/**
* Delete a memo identified by UID.
*
* @param string | array $uid Identify the note to delete, either a
* single UID or an array.
* @param string|array $uid Identify the note to delete, either a
* single UID or an array.
* @param string $notepad The notepad id, if not using multiplexed
* ActiveSync collections.
*
* @throws Horde_Exception_PermissionDenied
*/
public function delete($uid)
public function delete($uid, $notepad = null)
{
// Handle an arrray of UIDs for convenience of deleting multiple
// notes at once.
if (is_array($uid)) {
foreach ($uid as $u) {
$result = $this->delete($u);
$this->delete($u, $notepad);
}
return;
}

$storage = $GLOBALS['injector']->getInstance('Mnemo_Factory_Driver')->create();
$storage = $GLOBALS['injector']->getInstance('Mnemo_Factory_Driver')->create(
$notepad ?: ''
);
$memo = $storage->getByUID($uid);
if ($notepad !== null && $memo['memolist_id'] != $notepad) {
throw new Horde_Exception_NotFound('Not found');
}
if (!$GLOBALS['registry']->isAdmin()
&& !array_key_exists($memo['memolist_id'], Mnemo::listNotepads(false, Horde_Perms::DELETE))) {

Expand Down
Loading