From 521ba07b08f178794a74720b884ab20c36cf9f7c Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Tue, 18 Jan 2022 13:22:38 +0100 Subject: [PATCH] Refactor --- includes/pages/update.php | 2 -- includes/pages/wishlist-product-add.php | 1 - includes/pages/wishlist-view.php | 1 - includes/pages/wishlist.php | 2 -- index.php | 6 +++++- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/includes/pages/update.php b/includes/pages/update.php index 4f63a532..6a9969d9 100644 --- a/includes/pages/update.php +++ b/includes/pages/update.php @@ -12,8 +12,6 @@ $page = new page(__FILE__, 'Update'); $page->header(); $page->navigation(); -$user = new User(); - /** * Update */ diff --git a/includes/pages/wishlist-product-add.php b/includes/pages/wishlist-product-add.php index 7274fee6..ffb626b4 100644 --- a/includes/pages/wishlist-product-add.php +++ b/includes/pages/wishlist-product-add.php @@ -18,7 +18,6 @@ if (isset($_POST['url'], $_POST['wishlist'])) { $page = new page(__FILE__, 'Add a product'); $page->header(); $page->navigation(); -$user = new User(); ?>
diff --git a/includes/pages/wishlist-view.php b/includes/pages/wishlist-view.php index f6b4a85c..e1f83269 100644 --- a/includes/pages/wishlist-view.php +++ b/includes/pages/wishlist-view.php @@ -19,7 +19,6 @@ $products = array(); * Get wishlist products */ if (isset($_GET['wishlist'])) { - $user = new User(); $wishlist = $database->query('SELECT * FROM `wishlists` WHERE `id` = "' . $_GET['wishlist'] . '"') ->fetch(); diff --git a/includes/pages/wishlist.php b/includes/pages/wishlist.php index 9c6703c1..7fe9f525 100644 --- a/includes/pages/wishlist.php +++ b/includes/pages/wishlist.php @@ -13,8 +13,6 @@ $page = new page(__FILE__, 'Wishlist'); $page->header(); $page->navigation(); -$user = new User(); - $wishlist = $database->query('SELECT * FROM `wishlists` WHERE `hash` = "' . $_GET['wishlist'] . '"') ->fetch(); diff --git a/index.php b/index.php index 90d412a5..5665d9dc 100644 --- a/index.php +++ b/index.php @@ -53,6 +53,11 @@ if ( */ session_start(); +/** + * User + */ +$user = new wishthis\User(); + /** * API */ @@ -75,7 +80,6 @@ define('VERSION', '0.2.0'); if ($options) { if (-1 === version_compare($options->version, VERSION)) { $options->updateAvailable = true; - $page = 'update'; } }