Пример #1
0
 function ondelete()
 {
     $id = $this->page;
     $success = static_delete($id);
     $this->smarty->assign('success', $success ? 2 : -2);
     return 1;
 }
Пример #2
0
function static_save($entry, $id, $oldid = null)
{
    if (!static_isvalid($id)) {
        return false;
    }
    $fname = STATIC_DIR . $id . EXT;
    $entry['content'] = apply_filters('content_save_pre', $entry['content']);
    $entry['subject'] = apply_filters('title_save_pre', $entry['subject']);
    $str = utils_kimplode($entry);
    if (io_write_file($fname, $str)) {
        if ($oldid && $id != $oldid && ($fname = static_exists($oldid))) {
            $succ = static_delete($oldid);
            return $succ !== false && $succ !== 2;
        }
        return true;
    }
    return false;
}