| 12345678910111213141516171819202122232425262728293031323334353637383940 | /*    Hide a published post from the blog engine    Require paramter:    filepath    webroot*/requirelib("filelib");requirelib("appdata");includes("config.js");includes("helper.js");includes("indexManager.js");function hidePost(postObjectName, webroot){    //Check public post exists    var publishWebPosition = filepathClean(webroot) + "/blog/posts/" + postObjectName + ".html";    if (filelib.fileExists(publishWebPosition)){        filelib.deleteFile(publishWebPosition);    }    //Remove the file from the index list    removeTitleFromPostList(webroot, postObjectName);    sendResp("OK");}function getPostNameFromFilepath(path){    var tmp = path.split("/").pop();    if (tmp.indexOf(".html") >= 0){        tmp = tmp.replace(".html", "");    }else if (tmp.indexOf(".json") >= 0){        tmp = tmp.replace(".json", "");    }    return tmp;}var postName = getPostNameFromFilepath(filepath);hidePost(postName, webroot);
 |