From df671802b884016de936830b7106a6aa0d5a7e34 Mon Sep 17 00:00:00 2001 From: Pepiuox Date: Sat, 11 Jan 2025 11:09:42 -0500 Subject: [PATCH] Updated --- config/Routers.php | 6 +- elements/menu.php | 3 + elements/menutopbar.php | 265 ++++++++++++++++++++++++++++++++++++++++ elements/top.php | 36 ++++++ elements/views.php | 45 ++----- public/.htaccess | 9 +- public/404.php | 38 ++++-- public/test.php | 6 + 8 files changed, 356 insertions(+), 52 deletions(-) create mode 100644 elements/menutopbar.php create mode 100644 elements/top.php create mode 100644 public/test.php diff --git a/config/Routers.php b/config/Routers.php index e32d0c6b..0f65e4d9 100644 --- a/config/Routers.php +++ b/config/Routers.php @@ -111,7 +111,7 @@ public function ExistsPage() { } public function GoPage() { - $page = $this->SplitUrl(); + $page = $this->basename; if ($page === "home" || $page === "inicio" || empty($page)) { return true; } else { @@ -131,7 +131,7 @@ public function GoPage() { public function routePages() { $nm = ""; - $page = $this->SplitUrl(); + $page = $this->basename; if ($page === "home" || $page === "inicio") { header("Location: $this->host"); die(); @@ -157,7 +157,7 @@ public function routePages() { } public function ContentPage() { - $page = $this->SplitUrl(); + $page = $this->basename; $nm = ""; if ($this->host === $this->url) { $spg = $this->conn->prepare("SELECT * FROM pages WHERE startpage = ? AND active = ? "); diff --git a/elements/menu.php b/elements/menu.php index 4e4fad59..d586b948 100644 --- a/elements/menu.php +++ b/elements/menu.php @@ -1,5 +1,8 @@ query("SELECT * FROM menu_options WHERE id='$menu'"); $rmopt = $rmenu->fetch_assoc(); $id_menu = $rmopt['id_menu']; diff --git a/elements/menutopbar.php b/elements/menutopbar.php new file mode 100644 index 00000000..82d4d9b5 --- /dev/null +++ b/elements/menutopbar.php @@ -0,0 +1,265 @@ +prepare("SELECT * FROM pages WHERE id=?"); + $stmt->bind_param("i", $mid); + $stmt->execute(); + $result = $stmt->get_result(); + $stmt->close(); + $row = $result->fetch_assoc(); + return "builder.php?id=" . $row["id"]; +} + +function dropdown() +{ + global $conn; + $active = 1; + $parent = 0; + $stmt = $conn->prepare("SELECT * FROM pages WHERE active=?"); + $stmt->bind_param("i", $active); + $stmt->execute(); + $result = $stmt->get_result(); + $stmt->close(); + while ($mrow = $result->fetch_array()) { + $parents[] = $mrow["parent"]; + } + $stmt1 = $conn->prepare( + "SELECT id, title, link, type, parent FROM pages WHERE parent=? AND active=?" + ); + $stmt1->bind_param("ii", $parent, $active); + $stmt1->execute(); + $result1 = $stmt1->get_result(); + $stmt1->close(); + while ($row = $result1->fetch_array()) { + + $mid = $row["id"]; + $plink = SITE_PATH . $row["link"]; + if($row["type"]==='File'){ + continue; + } + + if (in_array($row["id"], $parents)) { + echo '" . "\n"; + } else { + echo '" . + "\n"; + } + + } +} + +function second($mid, $plink) +{ + global $conn; + $active = 1; + + $stmt = $conn->prepare("SELECT * FROM pages WHERE active=?"); + $stmt->bind_param("i", $active); + $stmt->execute(); + $result = $stmt->get_result(); + $stmt->close(); + while ($mrow = $result->fetch_array()) { + $parents[] = $mrow["parent"]; + } + + $stmt1 = $conn->prepare( + "SELECT id, title, link, parent FROM pages WHERE parent=? AND active=?" + ); + $stmt1->bind_param("ii", $mid, $active); + $stmt1->execute(); + $result1 = $stmt1->get_result(); + $stmt1->close(); + echo '" . "\n"; +} + +function third($sid, $plink) +{ + global $conn; + $active = 1; + + $stmt = $conn->prepare("SELECT * FROM pages WHERE active=?"); + $stmt->bind_param("i", $active); + $stmt->execute(); + $result = $stmt->get_result(); + $stmt->close(); + while ($mrow = $result->fetch_array()) { + $parents[] = $mrow["parent"]; + } + $stmt1 = $conn->prepare( + "SELECT id, title, link, parent FROM pages WHERE parent=? AND active=?" + ); + $stmt1->bind_param("ii", $sid, $active); + $stmt1->execute(); + $result1 = $stmt1->get_result(); + $stmt1->close(); + echo '" . "\n"; +} + +if(empty($menu)){ + $menu = 1; +} + +$rmenu = $conn->prepare("SELECT * FROM menu_options WHERE id=?"); +$rmenu->bind_param("i", $menu); +$rmenu->execute(); +$rsmenu = $rmenu->get_result(); +$rmenu->close(); + +$rmopt = $rsmenu->fetch_assoc(); +$id_menu = $rmopt["id_menu"]; +$fluid = ""; +$placement = ""; +$aligment = ""; +$background = ""; +$color = ""; + +if ($rmopt["fluid"] === "yes") { + $fluid = "container-fluid"; +} else { + $fluid = "container"; +} + +if ($rmopt["placement"] === "top") { + $placement = "fixed-top"; +} elseif ($rmopt["placement"] === "bottom") { + $placement = "fixed-bottom"; +} else { + $placement = "sticky-top"; +} + +if ($rmopt["aligment"] === "start") { + $aligment = "justify-content-start"; +} elseif ($rmopt["aligment"] === "center") { + $aligment = "justify-content-center"; +} else { + $aligment = "justify-content-end"; +} + +if ($rmopt["background"] === "primary") { + $background = "bg-primary"; +} elseif ($rmopt["background"] === "secondary") { + $background = "bg-secondary"; +} elseif ($rmopt["background"] === "light") { + $background = "bg-light"; +} elseif ($rmopt["background"] === "dark") { + $background = "bg-dark"; +} elseif ($rmopt["background"] === "info") { + $background = "bg-info"; +} elseif ($rmopt["background"] === "success") { + $background = "bg-success"; +} elseif ($rmopt["background"] === "warning") { + $background = "bg-warning"; +} else { + $background = "bg-danger"; +} + +if ($rmopt["color"] === "light") { + $color = "light"; +} else { + $color = "dark"; +} +?> + + + diff --git a/elements/top.php b/elements/top.php new file mode 100644 index 00000000..d8a35fbd --- /dev/null +++ b/elements/top.php @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + +<?php echo $title; ?> + + + + + + diff --git a/elements/views.php b/elements/views.php index 04dfc069..ad3fdc46 100644 --- a/elements/views.php +++ b/elements/views.php @@ -32,43 +32,9 @@ $visitor->pageViews($title); $language = $_SESSION["language"] = $lng; + require_once 'top.php'; ?> - - - - - - - - - - - - - - - - - - - - <?php echo $title; ?> - - - - - - + + diff --git a/public/test.php b/public/test.php new file mode 100644 index 00000000..0a530fca --- /dev/null +++ b/public/test.php @@ -0,0 +1,6 @@ +