Add download button to notes
This commit is contained in:
parent
bc86fd0aa6
commit
91636b15d2
11
action.php
11
action.php
@ -57,4 +57,15 @@ switch ($VARS['action']) {
|
||||
}
|
||||
$note->deleteNote();
|
||||
returnToSender("note_deleted");
|
||||
case "downloadnote":
|
||||
if (empty($VARS['noteid'])) {
|
||||
die($Strings->get("invalid parameters", false));
|
||||
}
|
||||
$note = Note::loadNote($VARS['noteid']);
|
||||
if (!$note->hasReadAccess(new User($_SESSION['uid']))) {
|
||||
die($Strings->get("invalid parameters", false));
|
||||
}
|
||||
header("Content-Type: text/markdown; charset=UTF-8");
|
||||
header("Content-disposition: attachment; filename=\"" . $note->getCleanTitle() . "_" . $note->getModified() . ".md\"");
|
||||
echo $note->getText();
|
||||
}
|
@ -4,5 +4,6 @@
|
||||
"Note": "Note",
|
||||
"Edit": "Edit",
|
||||
"Delete": "Delete",
|
||||
"Download": "Download",
|
||||
"Note deleted": "Note deleted"
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ foreach ($notes as $note) {
|
||||
<a href="./app.php?page=editnote¬e=<?php echo $note->getID(); ?>" class="text-body mr-2">
|
||||
<i class="fas fa-edit"></i> <?php $Strings->get('Edit'); ?>
|
||||
</a>
|
||||
<a href="./action.php?action=downloadnote¬eid=<?php echo $note->getID(); ?>" class="text-body mr-2">
|
||||
<i class="fas fa-download"></i> <?php $Strings->get('Download'); ?>
|
||||
</a>
|
||||
<a href="./action.php?action=deletenote¬eid=<?php echo $note->getID(); ?>" class="text-body text-danger">
|
||||
<i class="fas fa-trash"></i> <?php $Strings->get('Delete'); ?>
|
||||
</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user