|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
$note = new Note("", "", $_SESSION['uid'], null);
|
|
|
|
|
|
|
|
if (!empty($VARS['note'])) {
|
|
|
|
try {
|
|
|
|
$note = Note::loadNote($VARS['note']);
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
// It's a new note I guess
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Check for note sharing
|
|
|
|
if ($note->getOwnerID() != $_SESSION['uid']) {
|
|
|
|
header("Location: app.php?msg=no_permission");
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
|
|
|
$note->saveNote();
|
|
|
|
?>
|
|
|
|
|
|
|
|
<style nonce="<?php echo $SECURE_NONCE; ?>">
|
|
|
|
.CodeMirror, #note_content, .cm-quote, .editor-preview-side {
|
|
|
|
background-color: #<?php echo $note->getColor(); ?>;
|
|
|
|
color: #<?php echo $note->getTextColor(); ?> !important;
|
|
|
|
caret-color: #<?php echo $note->getTextColor(); ?>;
|
|
|
|
}
|
|
|
|
|
|
|
|
.CodeMirror-cursor {
|
|
|
|
border-left: 1px solid #<?php echo $note->getTextColor(); ?>;
|
|
|
|
}
|
|
|
|
|
|
|
|
.editor-preview-side hr {
|
|
|
|
border-top: 1px solid #<?php echo $note->getTextColor(); ?>;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<form action="action.php" method="POST" id="noteform">
|
|
|
|
<textarea name="content" id="note_content" rows="10" class="form-control text-body"><?php echo $note->getText(); ?></textarea>
|
|
|
|
<input type="hidden" name="noteid" value="<?php echo $note->getID(); ?>" />
|
|
|
|
<input type="hidden" name="source" value="editnote" />
|
|
|
|
<input type="hidden" name="color" value="<?php echo $note->getColor(); ?>" />
|
|
|
|
<input type="hidden" name="action" value="savenote" />
|
|
|
|
<noscript>
|
|
|
|
<br />
|
|
|
|
<div class="input-group mb-3">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><?php $Strings->get("Note color"); ?></span>
|
|
|
|
</div>
|
|
|
|
<input class="form-control" type="color" name="color" value="#<?php echo $note->getColor(); ?>" />
|
|
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-success"><?php $Strings->get("Save"); ?></button>
|
|
|
|
<a href="./app.php?page=home" class="btn btn-default"><?php $Strings->get("Close"); ?></a>
|
|
|
|
<!-- Actually reload the page, otherwise Links gives an error -->
|
|
|
|
<input type="hidden" name="reload" value="1" />
|
|
|
|
</noscript>
|
|
|
|
</form>
|