diff -r 0b53c89a7d11 -r 293148ad7a70 index.php --- a/index.php Sun Aug 19 15:53:56 2007 -0400 +++ b/index.php Sun Aug 19 16:22:04 2007 -0400 @@ -345,9 +345,45 @@ break; case 'setwikimode': if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '
Changing the wiki mode setting requires admin rights.
'); - if(!isset($_GET['level']) || ( isset($_GET['level']) && !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', 'Level not specified
'); - $template->header(); - $template->footer(); + if ( isset($_POST['finish']) ) + { + $level = intval($_POST['level']); + if ( !in_array($level, array(0, 1, 2) ) ) + { + die_friendly('Invalid request', 'Level not specified
'); + } + $q = $db->sql_query('UPDATE '.table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';'); + if ( !$q ) + $db->_die(); + redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), 'Wiki mode for this page has been set. Redirecting you to the page...', 2); + } + else + { + $template->header(); + if(!isset($_GET['level']) || ( isset($_GET['level']) && !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', 'Level not specified
'); + $level = intval($_GET['level']); + if ( !in_array($level, array(0, 1, 2) ) ) + { + die_friendly('Invalid request', 'Level not specified
'); + } + echo '