'publish', 'page' => $argv[1] ); } else { // In web mode, take from args from GET request $params=&$_GET; } // params clean-up $action=sanitize($params, 'action', '/[^a-z_]+/', 'preview'); /* Could be : preview, edit, publish */ $page=sanitize($params, 'page', '/[^a-z0-9\/]+/', $site_conf['site_default_page']); // Never put \. in this regex // Template vars init ($page, $page_path, $page_props, $page_tpl_url) $page_path = "content/$page"; if ( ! is_dir($page_path) ) trigger_error("Error : page does not exists ($page)", E_USER_ERROR); $page_props = load_ini_page_props($page); if ( ! is_array($page_props) ) trigger_error("Error parsing page properties ($page/props.ini)", E_USER_ERROR); $page_tpl_url = str_repeat('../', substr_count($page, '/')) . "admin/templates/" . $page_props['page_template'] . '/'; if ($action === 'publish') ob_start(); /* Buffering for redirecting to file instead of browser */ // Basic HTML5 skeleton + page props insertion + template call ?>