if (!$user->isAdmin()) { $errors[] = "Je hebt geen admin rechten."; } $section->setBaseURI($_POST['baseURI']); $section->setTitle($_POST['title']); $section->setType($_POST['type']); if (!$section->baseURI()) { $errors[] = "Je kunt de URL naam niet leeg laten."; } // if ( strstr( $section->baseURI(), "/" ) ) // $errors[] = "Een URL naam mag geen <q>/</q> bevatten."; if (!sizeof($errors)) { $section->save(); } if (isset($_POST['json'])) { $response = array(); $response['sectionId'] = $section->id(); $response['errors'] = $errors; header('Content-type: application/json'); echo json_encode($response); exit; } if (!count($errors)) { Router::redirect($_SERVER['HTTP_REFERER'], 303); exit; } $template = Template::getInstance(); $template->load('pages/admin'); $template->assign('content', "fouten bij opslaan:<pre>" . print_r($errors, true) . "</pre>"); echo $template->content(); }