mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 03:56:21 +05:30
Update admin.php
This commit is contained in:
parent
ee831b5cb1
commit
a3a6269647
1 changed files with 11 additions and 2 deletions
|
|
@ -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)
|
||||
{
|
||||
$dir = pathinfo($oldfile, PATHINFO_DIRNAME);
|
||||
$dirDraft = $dir . '/draft/';
|
||||
$views = array();
|
||||
$viewsFile = "content/data/views.json";
|
||||
$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;
|
||||
|
||||
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)) {
|
||||
$newfile = $dir . '/draft/' . $post_url . '.md';
|
||||
$newfile = $dirDraft . $post_url . '.md';
|
||||
file_put_contents($newfile, print_r($post_content, true));
|
||||
if (empty($static)) {
|
||||
$old = pathinfo($oldfile, PATHINFO_FILENAME);
|
||||
|
|
@ -1304,4 +1313,4 @@ function find_draft_subpages($static = null, $sub_static = null)
|
|||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue