Fix paste updated_at being updated when it should not be.

This commit is contained in:
Floorb 2022-07-30 17:13:21 -04:00
parent bc082581a9
commit 2aaa47ea25
4 changed files with 5 additions and 4 deletions

View file

@ -16,6 +16,7 @@ class Paste extends Model {
'visible' => 'integer',
'encrypt' => 'boolean'
];
public $timestamps = false;
public function user() {
return $this->belongsTo(User::class);

View file

@ -81,7 +81,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$error = validatePasteFields();
if ($error !== null) {
goto OutPut;
}
@ -93,7 +92,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
goto OutPut;
}
$tags = Tag::parseTagInput($tag_input);
$tags = Tag::parseTagInput($_POST['tag_input']);
if (count($tags) < 1) {
$error = 'You must specify at least 1 tag.';
@ -145,6 +144,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
'code' => $paste_code,
'expiry' => $expires,
'password' => $paste_password,
'updated_at' => date_create(),
'ip' => $ip
]);

View file

@ -67,7 +67,7 @@
</div>
</form>
<?php // Registration page
} elseif (isset($_GET['registeraccount'])) {
} elseif (isset($_GET['register'])) {
?>
<form action="/register" method="post">
<div class="columns">

View file

@ -127,7 +127,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
Created: <?= $paste['created_at'] ?>
<br/>
<?php if ($paste['updated_at'] != $paste['created_at']): ?>
<?= $paste['updated_at'] ?>
Updated: <?= $paste['updated_at'] ?>
<?php endif; ?>
</small>
</div>