function act($section) { $data = array(); $data['parent_id'] = $_POST['parent_id']; $data['name'] = $_POST['name']; $data['text'] = $_POST['text']; if (isset($_POST['edit'])) { $data['id'] = $section; if (!Sections::isSection($data['parent_id'])) { $data['parent_id'] = 0; } Sections::updateSection($data); header("Location: " . PATH . "/admin.php?section=" . $section); } else { if (isset($_POST['delete'])) { Sections::deleteSection($section); header("Location: " . PATH . "/admin.php"); } else { if (isset($_POST['add'])) { if (!Sections::isSection($data['parent_id'])) { $data['parent_id'] = 0; } Sections::insertSection($data); header("Location: " . PATH . "/admin.php?section=" . $data['parent_id']); } else { header("Location: " . PATH . "/admin.php?section=" . $section); } } } }