mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00

* Fix alert class name * feature: csrf protection * Cosmetics * Fix token generate * Admin Panel: changelogs csrf protection * news/id route * Refactor admin newses + add csrf * Use admin.links instead * Admin panel: Pages csrf * Menus: better csrf + add success message on reset colors * Plugins csrf * Move definitions * add info function, same as note($message) * Update mailer.php * Fix new page/news links * clear_cache & maintenance csrf * Formatting * Fix news type * Fix changelog link * Add new changelog link * More info to confirm dialog * This is always true
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 $account_logged OTS_Account
|
|
*/
|
|
$_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]);
|