<?php

// Get task ID to add this step to
$task_id = TaskerMAN\Core\IO::GET('task_id');
try {
    // Creates a new step, loads information, and then saves
    $step = new TaskerMAN\Application\TaskStep();
    $step->setTaskID(TaskerMAN\Core\IO::GET('task_id'));
    $step->setComment(TaskerMAN\Core\IO::POST('comment'));
    $step->setTitle(TaskerMAN\Core\IO::POST('title'));
    $step->save();
} catch (TaskerMAN\Application\TaskException $e) {
}
// Redirect back to the task page
header('Location: index.php?p=task&id=' . $task_id);
<?php

$id = (int) TaskerMAN\Core\IO::GET('id');
$comment = TaskerMAN\Core\IO::POST('comment', false);
$step = new TaskerMAN\Application\TaskStep($id);
if ($step->task_id === NULL) {
    // Unable to load step, does not exist
    throw new TaskerMAN\Application\APIErrorException('Unknown step ID');
}
// Check that user is permitted to modify this task
if ((int) $step->assignee_uid != TaskerMAN\Application\API::$uid) {
    throw new TaskerMAN\Application\APIErrorException('User does not have access to modify this step');
}
// Set comment and commit changes
try {
    $step->setComment($comment);
    $step->save();
} catch (TaskerMAN\Application\TaskException $e) {
    throw new TaskerMAN\Application\APIErrorException($e->getMessage());
}
echo TaskerMAN\Application\API::response('Step comment updated successfully');