function check_step() { global $lang; $validate = validate(); if ($validate) { $vl =& $lang['samplecontent']; entry_save(array('subject' => $vl['entry']['subject'], 'content' => $vl['entry']['content'])); if (!static_exists('menu')) { static_save(array('subject' => $vl['menu']['subject'], 'content' => $vl['menu']['content']), 'menu'); } if (!static_exists('about')) { static_save(array('subject' => $vl['about']['subject'], 'content' => $vl['about']['content']), 'about'); } } return $validate; }
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; }
function doenable($id) { $success = -1; $enabled =& $this->bp_enabled; if (static_exists($id)) { if (!$enabled) { $enabled = array(); } if (!in_array($id, $enabled)) { $enabled[] = $id; sort($enabled); plugin_addoption('blockparser', 'pages', $enabled); plugin_saveoptions(); $success = 1; } } $this->smarty->assign('success', $success); return PANEL_REDIRECT_CURRENT; }
function index_staticpage($page, $explicit_req, &$params, &$module) { global $smarty, $title; if (static_exists($page)) { $arr = static_parse($page); $title = $arr['subject']; if ($explicit_req) { add_filter('wp_title', 'index_gentitle', 1, 2); } $smarty->assign('static_id', $page); $smarty->assign('static_page', $arr); return $module = 'static.tpl'; } if (user_loggedin()) { utils_redirect('admin.php?p=static&action=write&page=' . $page); } else { $module = index_404error(); } return $module; }