diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-24 19:40:50 -0600 |
---|---|---|
committer | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-24 19:40:50 -0600 |
commit | 2098bf444afadcf0363d89b4cc1dca5d2213d754 (patch) | |
tree | da93b29e22170d7be7c9ed215fde5238e9d76178 /manage_post.php | |
parent | aae25cd709d486f7ee9513753d40eb5cc239c42d (diff) |
Remove all uses of db_inc.php
This method of importing the database login every time wasn't very good.
Now everything uses the new Database singleton class.
Diffstat (limited to 'manage_post.php')
-rw-r--r-- | manage_post.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/manage_post.php b/manage_post.php index 9e04dd4..99f0ad4 100644 --- a/manage_post.php +++ b/manage_post.php @@ -1,7 +1,6 @@ <?php -include('includes/db_inc.php'); -include('includes/functions_post.php'); -include('includes/model/Post.php'); +include_once './includes/functions_post.php'; +include_once './includes/model/Post.php'; session_start(); @@ -13,7 +12,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'GET') { include_once './includes/templates/404.php'; die(); } else { - $result = $current->get_from_database($_GET['id'], $dbc); + $result = $current->get_from_database($_GET['id']); if ($result == 0) { http_response_code(404); include_once './includes/templates/404.php'; @@ -26,7 +25,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'GET') { $post_content = filter_input(INPUT_POST, 'post_content', FILTER_SANITIZE_STRING); $post = new Post(); - $post->get_from_database($id, $dbc); + $post->get_from_database($id); if (strcasecmp($delete, "on") == 0) { delete_post($post); @@ -47,7 +46,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'GET') { <?php include('includes/templates/header.php'); ?> <h1>Manage a post</h1> <?php -$current->display_content($dbc); +echo get_post_content($current); echo '<hr>'; $id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |