Browse Source

Update admin.php

pull/674/head
danpros 1 year ago
parent
commit
a3a6269647
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      system/admin/admin.php

+ 11
- 2
system/admin/admin.php View File

@ -599,6 +599,7 @@ function add_sub_page($title, $url, $content, $static, $draft, $description = nu
function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft, $destination = null, $description = null, $static = null) function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft, $destination = null, $description = null, $static = null)
{ {
$dir = pathinfo($oldfile, PATHINFO_DIRNAME); $dir = pathinfo($oldfile, PATHINFO_DIRNAME);
$dirDraft = $dir . '/draft/';
$views = array(); $views = array();
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
$post_title = safe_html($title); $post_title = safe_html($title);
@ -617,9 +618,17 @@ function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft,
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content; $post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content;
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) { if (!empty($post_title) && !empty($post_url) && !empty($post_content)) {
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
}
if (!is_dir($dirDraft)) {
mkdir($dirDraft, 0775, true);
}
if(!empty($revertPage)) { if(!empty($revertPage)) {
$newfile = $dir . '/draft/' . $post_url . '.md';
$newfile = $dirDraft . $post_url . '.md';
file_put_contents($newfile, print_r($post_content, true)); file_put_contents($newfile, print_r($post_content, true));
if (empty($static)) { if (empty($static)) {
$old = pathinfo($oldfile, PATHINFO_FILENAME); $old = pathinfo($oldfile, PATHINFO_FILENAME);
@ -1304,4 +1313,4 @@ function find_draft_subpages($static = null, $sub_static = null)
} }
return $tmp; return $tmp;
}
}

Loading…
Cancel
Save