public static function listNotepads($owneronly = false, $permission = Horde_Perms::SHOW)
{
if ($owneronly && !$GLOBALS['registry']->getAuth()) {
return array();
}
if ($owneronly || empty($GLOBALS['conf']['share']['hidden'])) {
try {
$notepads = $GLOBALS['mnemo_shares']->listShares($GLOBALS['registry']->getAuth(), array('perm' => $permission, 'attributes' => $owneronly ? $GLOBALS['registry']->getAuth() : null, 'sort_by' => 'name'));
} catch (Horde_Share_Exception $e) {
Horde::log($e->getMessage(), 'ERR');
return array();
}
} else {
try {
$notepads = $GLOBALS['mnemo_shares']->listShares($GLOBALS['registry']->getAuth(), array('perm' => $permission, 'attributes' => $GLOBALS['registry']->getAuth(), 'sort_by' => 'name'));
} catch (Horde_Share_Exception $e) {
Horde::log($e);
return array();
}
$display_notepads = @unserialize($GLOBALS['prefs']->getValue('display_notepads'));
if (is_array($display_notepads)) {
foreach ($display_notepads as $id) {
try {
$notepad = $GLOBALS['mnemo_shares']->getShare($id);
if ($notepad->hasPermission($GLOBALS['registry']->getAuth(), $permission)) {
$notepads[$id] = $notepad;
}
} catch (Horde_Exception_NotFound $e) {
} catch (Horde_Share_Exception $e) {
Horde::log($e);
return array();
}
}
}
}
return $notepads;
}