$query=$db->exec("INSERT INTO pages (title) VALUES ('$title')");
//if something went wrong, show the failure template with the error message
if(!$query)
{
$smarty->assign("error",$db->lastErrorMsg());
$smarty->display('tpl/failure.tpl');
}
//else if everything went fine, show the success template
else
{
$smarty->assign("page_title",$title);
$smarty->assign("action","create");
$smarty->display('tpl/success.tpl');
}
}
}
//else if the user chose to create a new section
elseif($to_add=='section')
{
//if the user didn't choose a page to add the section to (can only happen if there's no page in the database), show the failure template with the error emssage
//if the user didn't choose a page to add the section to (can only happen if there's no page in the database), show the failure template with the error message
if(empty($_GET['page_to_add_section_to']))
{
$smarty->assign("error","There has to be a page in the wiki first!");
...
...
@@ -88,7 +99,7 @@ else
{
//get the value of this page to add the section to and perform a database query to find the id of this page, needed for the page_id field in the sections table