Merge branch 'master' of github.com:evacchi/flatpress

This commit is contained in:
Edoardo Vacchi 2013-11-27 18:13:04 +01:00
commit a3b54b0d3d
2 changed files with 13 additions and 1 deletions

View File

@ -24,15 +24,23 @@
} }
function static_parse($id) { function static_parse($id) {
if (!static_isvalid($id)) return false;
if ($fname=static_exists($id)) { if ($fname=static_exists($id)) {
$entry = io_load_file($fname); $entry = io_load_file($fname);
return (utils_kexplode($entry)); return (utils_kexplode($entry));
} }
return array(); return array();
} }
function static_isvalid($id) {
return !preg_match('/[^./\\\\]+/', $id);
}
function static_save($entry, $id, $oldid=null) { function static_save($entry, $id, $oldid=null) {
if (!static_isvalid($id)) return false;
$fname = STATIC_DIR . $id . EXT; $fname = STATIC_DIR . $id . EXT;
$entry['content'] = apply_filters('content_save_pre', $entry['content']); $entry['content'] = apply_filters('content_save_pre', $entry['content']);
@ -51,6 +59,8 @@
} }
function static_exists($id) { function static_exists($id) {
if (!static_isvalid($id)) return false;
$fname = STATIC_DIR . $id . EXT; $fname = STATIC_DIR . $id . EXT;
if (file_exists($fname)) if (file_exists($fname))
@ -60,6 +70,8 @@
} }
function static_delete($id) { function static_delete($id) {
if (!static_isvalid($id)) return false;
return fs_delete(STATIC_DIR . $id . EXT); return fs_delete(STATIC_DIR . $id . EXT);
} }

View File

@ -73,7 +73,7 @@
define('SYSTEM_VER', '1.0'); define('SYSTEM_VER', '1.0.1');
function system_ver() { function system_ver() {
return 'fp-' . SYSTEM_VER; return 'fp-' . SYSTEM_VER;
} }