From 9861dd3159c3d54e34f3dc71c8d2317a683ac02a Mon Sep 17 00:00:00 2001 From: DewanaGustavus <76590469+DewanaGustavus@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:15:22 +0700 Subject: [PATCH] fix: navbar lowercase title --- src/App/components/template/Navbar.php | 8 ++++---- src/App/models/CategoryModel.php | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/App/components/template/Navbar.php b/src/App/components/template/Navbar.php index 7c4d21d..100ecfc 100644 --- a/src/App/components/template/Navbar.php +++ b/src/App/components/template/Navbar.php @@ -15,13 +15,13 @@ $title = str_replace('.php', '', $title); <li><a href="/register">Register</a></li> <?php elseif ($this->userRole === 1) : ?> <!-- Display "Cart", "Profile", and "Log out" when logged in as a user --> - <li <?php if ($title == "Cart") echo 'aria-current="page"'; ?>><a href="/cart">Cart</a></li> - <li <?php if ($title == "Profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> + <li <?php if ($title == "cart") echo 'aria-current="page"'; ?>><a href="/cart">Cart</a></li> + <li <?php if ($title == "profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> <li><a href="/logout">Log out</a></li> <?php elseif ($this->userRole === 2) : ?> <!-- Display "Category", "Profile", and "Log out" when logged in as admin --> - <li <?php if ($title == "Category") echo 'aria-current="page"'; ?>><a href="/category">Category</a></li> - <li <?php if ($title == "Profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> + <li <?php if ($title == "category") echo 'aria-current="page"'; ?>><a href="/category">Category</a></li> + <li <?php if ($title == "profile") echo 'aria-current="page"'; ?>><a href="/profile">Profile</a></li> <li><a href="/logout">Log out</a></li> <?php endif; ?> </ul> diff --git a/src/App/models/CategoryModel.php b/src/App/models/CategoryModel.php index f670ae2..badf29f 100644 --- a/src/App/models/CategoryModel.php +++ b/src/App/models/CategoryModel.php @@ -28,6 +28,7 @@ class CategoryModel extends Model{ } public function updateCategory($id, $name){ + if(strlen($name) > 25)throw new Exception('Category name is too long', 400); $stmt = $this->database->getConn()->prepare("UPDATE categories SET name = ? WHERE id = ?"); $stmt->bind_param("si", $name, $id); -- GitLab