示例#1
0
            } else {
                header('Location: ?page=create_topic&id=1');
                exit;
            }
        }
    } else {
        header('Location : ?page=error_404');
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
    $manager = new TopicManager($db);
    $topic = $manager->findById($_GET['id']);
    if ($topic->getId() == $currentUser->getId()) {
        if (isset($_POST['title'])) {
            $id = intval($_GET['id']);
            $title = $_POST['title'];
            $topic = $manager->editTitle($title, $id);
            if (is_string($topic)) {
                $errors[] = $topic;
            } else {
                header('Location: index.php?page=topic&id=' . $_GET['id'] . '');
            }
        }
    }
}
?>