mirror of
https://github.com/danpros/htmly.git
synced 2026-04-23 14:06:23 +05:30
Update admin.php
This commit is contained in:
parent
450fdd1e32
commit
a6792d4ba1
1 changed files with 11 additions and 1 deletions
|
|
@ -559,7 +559,8 @@ function add_sub_page($title, $url, $content, $static, $description = null)
|
|||
function edit_page($title, $url, $content, $oldfile, $destination = null, $description = null, $static = null)
|
||||
{
|
||||
$dir = substr($oldfile, 0, strrpos($oldfile, '/'));
|
||||
|
||||
$views = array();
|
||||
$viewsFile = "content/data/views.json";
|
||||
$post_title = safe_html($title);
|
||||
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
|
||||
$description = safe_html($description);
|
||||
|
|
@ -602,6 +603,15 @@ function edit_page($title, $url, $content, $oldfile, $destination = null, $descr
|
|||
|
||||
rebuilt_cache('all');
|
||||
clear_page_cache($post_url);
|
||||
|
||||
if ($oldfile != $newfile) {
|
||||
if (file_exists($viewsFile)) {
|
||||
$views = json_decode(file_get_contents($viewsFile), true);
|
||||
$arr = replace_key($views, $oldfile, $newfile);
|
||||
file_put_contents($viewsFile, json_encode($arr, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
if ($destination == 'post') {
|
||||
header("Location: $posturl");
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue