mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 11:16:00 +05:30
Fix autosave bugs. See: #858
This commit is contained in:
parent
fdfb97ed48
commit
39a8c50cfd
1 changed files with 24 additions and 7 deletions
|
|
@ -998,6 +998,7 @@ post('/admin/autosave', function () {
|
|||
$media = null;
|
||||
}
|
||||
|
||||
if ($type == 'post') {
|
||||
if (!empty($title) && !empty($tag) && !empty($content)) {
|
||||
if ($addEdit == 'add') {
|
||||
$response = add_content($title, $tag, $url, $content, $user, $draft, $category, $type, $description, $media, $dateTime, $autoSave, $oldfile);
|
||||
|
|
@ -1007,6 +1008,22 @@ post('/admin/autosave', function () {
|
|||
$response = edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, $type, $destination, $description, $dateTime, $media, $autoSave);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$response = json_encode(array('message' => 'No content to save.', 'file' => ''));
|
||||
}
|
||||
} else {
|
||||
if (!empty($title) && !empty($tag) && !empty($content) && !empty($media)) {
|
||||
if ($addEdit == 'add') {
|
||||
$response = add_content($title, $tag, $url, $content, $user, $draft, $category, $type, $description, $media, $dateTime, $autoSave, $oldfile);
|
||||
} else {
|
||||
$arr = explode('/', $oldfile);
|
||||
if ($user === $arr[1] || $role === 'editor' || $role === 'admin') {
|
||||
$response = edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publishDraft, $category, $type, $destination, $description, $dateTime, $media, $autoSave);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$response = json_encode(array('message' => 'No content to save.', 'file' => ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue