Skip to content

Commit

Permalink
Fix indention, wrapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Aug 29, 2014
1 parent dedf049 commit 39fc848
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions nag/lib/Api.php
Expand Up @@ -464,29 +464,27 @@ public function put($path, $content, $content_type)

if (count($parts) == 2 &&
substr($parts[1], -4) == '.ics') {

// Workaround for WebDAV clients that are not smart enough to send
// the right content type. Assume text/calendar.
if ($content_type == 'application/octet-stream') {
$content_type = 'text/calendar';
}
$tasklist = substr($parts[1], 0, -4);
} elseif (count($parts) == 3) {
$tasklist = $parts[1];

// Workaround for WebDAV clients that are not smart enough to send
// the right content type. Assume the same format we send individual
// tasklist items: text/calendar
if ($content_type == 'application/octet-stream') {
$content_type = 'text/calendar';
}
} else {
throw new Nag_Exception(_("Invalid task list name supplied."), 403);
// Workaround for WebDAV clients that are not smart enough to send
// the right content type. Assume text/calendar.
if ($content_type == 'application/octet-stream') {
$content_type = 'text/calendar';
}
$tasklist = substr($parts[1], 0, -4);
} elseif (count($parts) == 3) {
$tasklist = $parts[1];
// Workaround for WebDAV clients that are not smart enough to send
// the right content type. Assume the same format we send
// individual tasklist items: text/calendar
if ($content_type == 'application/octet-stream') {
$content_type = 'text/calendar';
}
} else {
throw new Nag_Exception(_("Invalid task list name supplied."), 403);
}

if (!Nag::hasPermission($tasklist, Horde_Perms::EDIT)) {
// FIXME: Should we attempt to create a tasklist based on the filename
// in the case that the requested tasklist does not exist?
// FIXME: Should we attempt to create a tasklist based on the
// filename in the case that the requested tasklist does not exist?
throw new Nag_Exception(_("Task list does not exist or no permission to edit"), 403);
}

Expand Down Expand Up @@ -613,9 +611,9 @@ public function path_delete($path)

if (count($parts) == 2) {
// @TODO Deny deleting of the entire tasklist for now.
// Allow users to delete tasklists but not create them via WebDAV will
// be more confusing than helpful. They are, however, still able to
// delete individual task items within the tasklist folder.
// Allow users to delete tasklists but not create them via WebDAV
// will be more confusing than helpful. They are, however, still
// able to delete individual task items within the tasklist folder.
throw Nag_Exception(_("Deleting entire task lists is not supported."), 403);
// To re-enable the functionality just remove this if {} block.
}
Expand Down

0 comments on commit 39fc848

Please sign in to comment.