getValidPageName($page); if (!$page) { header('HTTP/1.1 404 Not Found'); exit; } $fp = @fopen('php://input', 'r'); if (!$fp) { header('HTTP/1.1 400 Bad Request'); exit; } $content = ''; while($line = fread($fp, 1024)) { $content .= $line; } fclose($fp); if (empty($content)) { header('HTTP/1.1 400 Bad Request'); exit; } if (!preg_match('/(.*)/is', $content, $match)) { header('HTTP/1.1 500 Internal Server Error'); exit; } $content = trim($match[1]); if (empty($content)) { header('HTTP/1.1 400 Bad Request'); exit; } $metas = $nk->getPageMetas($page); $nk->savePage($page, $content, $metas); $tpl->clear_cache('page.tpl', md5($page)); header('HTTP/1.1 201 Created'); exit; } ?>