/usr/share/horde/nag/lib/CompleteTask.php is in php-horde-nag 4.2.7-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | <?php
/**
*/
class Nag_CompleteTask {
/**
*/
public function result($task, $tasklist)
{
global $nag_shares, $notification, $registry;
try {
$share = $nag_shares->getShare($tasklist);
$task = Nag::getTask($tasklist, $task);
if (!$share->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$result = array('error' => 'permission denied');
$notification->push(_("Access denied completing this task."), 'horde.error');
} else {
$wasCompleted = $task->completed;
$task->loadChildren();
if ($wasCompleted &&
$task->parent &&
$task->parent->completed) {
$result = array('data' => 'complete');
$notification->push(_("Completed parent task, mark it as incomplete first"), 'horde.error');
} elseif (!$wasCompleted && !$task->childrenCompleted()) {
$result = array('data' => 'incomplete');
$notification->push(_("Incomplete sub tasks, complete them first"), 'horde.error');
} else {
$task->toggleComplete();
$task->save();
if ($task->completed) {
$result = array('data' => 'complete');
$notification->push(sprintf(_("Completed %s."), $task->name), 'horde.success');
} elseif (!$wasCompleted) {
$result = array('data' => 'incomplete');
$notification->push(sprintf(_("%s is still incomplete."), $task->name), 'horde.success');
} else {
$result = array('data' => 'incomplete');
$notification->push(sprintf(_("%s is now incomplete."), $task->name), 'horde.success');
}
}
}
} catch (Exception $e) {
$result = array('error' => $e->getMessage());
$notification->push(sprintf(_("There was a problem completing %s: %s"), $task->name, $e->getMessage()), 'horde.error');
}
return $result;
}
}
|