Nonactivate a post manually causes its status changed to 3 which cannot be edited and its status cannot be changed.
This commit is contained in:
parent
3de31142e0
commit
796148a532
@ -27,7 +27,8 @@ class Posts
|
|||||||
$table = 'pengumuman';
|
$table = 'pengumuman';
|
||||||
|
|
||||||
$valid = $this->post->showAll([
|
$valid = $this->post->showAll([
|
||||||
['valid_at', '<=', $now]
|
['valid_at', '<=', $now],
|
||||||
|
['status', '!=', 3]
|
||||||
]);
|
]);
|
||||||
if ($valid !== false) {
|
if ($valid !== false) {
|
||||||
foreach ($valid as $fields) {
|
foreach ($valid as $fields) {
|
||||||
@ -38,7 +39,8 @@ class Posts
|
|||||||
}
|
}
|
||||||
|
|
||||||
$not_valid = $this->post->showAll([
|
$not_valid = $this->post->showAll([
|
||||||
['valid_at', '>', $now]
|
['valid_at', '>', $now],
|
||||||
|
['status', '!=', 3]
|
||||||
]);
|
]);
|
||||||
if ($not_valid !== false) {
|
if ($not_valid !== false) {
|
||||||
foreach ($not_valid as $fields) {
|
foreach ($not_valid as $fields) {
|
||||||
@ -49,7 +51,8 @@ class Posts
|
|||||||
}
|
}
|
||||||
|
|
||||||
$expired = $this->post->showAll([
|
$expired = $this->post->showAll([
|
||||||
['expired_at', '<', $now]
|
['expired_at', '<', $now],
|
||||||
|
['status', '!=', 3]
|
||||||
]);
|
]);
|
||||||
if ($expired !== false) {
|
if ($expired !== false) {
|
||||||
foreach ($expired as $fields) {
|
foreach ($expired as $fields) {
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
{% if (post.status == 0 or editor_now != creator.id) %}
|
{% if (post.status == 0 or post.status == 3 or editor_now != creator.id) %}
|
||||||
disabled
|
disabled
|
||||||
{% endif %}
|
{% endif %}
|
||||||
>
|
>
|
||||||
|
@ -176,7 +176,7 @@ abstract class Model
|
|||||||
$sql = "UPDATE {$table} SET status = ? WHERE id = ?";
|
$sql = "UPDATE {$table} SET status = ? WHERE id = ?";
|
||||||
|
|
||||||
$query = $db->prepare($sql);
|
$query = $db->prepare($sql);
|
||||||
$query->bindValue(1, 0);
|
$query->bindValue(1, 3);
|
||||||
$query->bindValue(2, $id);
|
$query->bindValue(2, $id);
|
||||||
|
|
||||||
if ($query->execute()) {
|
if ($query->execute()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user