mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00

* phpstan v1 + workflow * Fix intend * More fixes * Update phpstan.neon * phpstan level 2 * Move errors ignoring into phpstan.neon * phpstan level 3 * Don't ignore templates folder * Something from level 4 * Update phpstan.neon
42 lines
927 B
PHP
42 lines
927 B
PHP
<?php
|
|
/**
|
|
* Notepad
|
|
*
|
|
* @package MyAAC
|
|
* @author Slawkens <slawkens@gmail.com>
|
|
* @copyright 2019 MyAAC
|
|
* @link https://my-aac.org
|
|
*/
|
|
|
|
use MyAAC\Models\Notepad as ModelsNotepad;
|
|
|
|
defined('MYAAC') or die('Direct access not allowed!');
|
|
$title = 'Notepad';
|
|
|
|
csrfProtect();
|
|
|
|
/**
|
|
* @var OTS_Account $account_logged
|
|
*/
|
|
$_content = '';
|
|
$notepad = ModelsNotepad::where('account_id', $account_logged->getId())->first();
|
|
if (isset($_POST['content'])) {
|
|
$_content = html_entity_decode(stripslashes($_POST['content']));
|
|
if (!$notepad) {
|
|
ModelsNotepad::create([
|
|
'account_id' => $account_logged->getId(),
|
|
'content' => $_content
|
|
]);
|
|
}
|
|
else {
|
|
ModelsNotepad::where('account_id', $account_logged->getId())->update(['content' => $_content]);
|
|
}
|
|
|
|
success('Saved at ' . date('H:i'));
|
|
} else {
|
|
if ($notepad)
|
|
$_content = $notepad->content;
|
|
}
|
|
|
|
$twig->display('admin.notepad.html.twig', ['content' => $_content]);
|