From 4f45c0a172ff65c4abbf55ed2b26305707216100 Mon Sep 17 00:00:00 2001 From: Maximilian Michael Schaumann Date: Tue, 11 Dec 2018 19:57:33 +0100 Subject: [PATCH] Cleanup --- app/Controllers/Admin.php | 5 ----- app/Controllers/Home.php | 2 -- app/Controllers/Login.php | 2 -- app/Controllers/Register.php | 3 --- app/Controllers/Shop.php | 3 --- app/Controllers/User.php | 5 ----- app/Core/AdminController.php | 2 -- app/Core/Model.php | 26 -------------------------- app/Core/View.php | 10 ---------- app/Libs/Formbuilder.php | 1 - app/Models/Cart.php | 4 ---- app/helper.php | 6 +----- 12 files changed, 1 insertion(+), 68 deletions(-) diff --git a/app/Controllers/Admin.php b/app/Controllers/Admin.php index e16812d..697481f 100644 --- a/app/Controllers/Admin.php +++ b/app/Controllers/Admin.php @@ -18,7 +18,6 @@ class Admin extends AdminController { public function index(){ $this->view->files_css=["admin.css"]; -// $data['css']=$this->insertCSS("admin.css"); $this->view->render("admin/index"); } public function user(){ @@ -41,7 +40,6 @@ public function user(){ $markup.=""; } $data['userList']=$markup; -// $data['css']=$this->insertCSS("admin.css"); $this->view->files_css=["admin.css"]; $this->view->render("admin/user", $data); } @@ -83,7 +81,6 @@ public function useredit($id=null){ } } $this->view->files_css=['admin.css']; -// $data['css']=$this->insertCSS("admin.css"); $data['form']=$edit->output(); $data['user']=$user; $this->view->render("admin/useredit", $data); @@ -110,7 +107,6 @@ public function product($id=null){ $markup.=""; } $this->view->files_css=["admin.css"]; -// $data['css']=$this->insertCSS("admin.css"); $data['prod']=$markup; $this->view->render("admin/product", $data); } @@ -133,7 +129,6 @@ public function prodedit($id){ $data['prod']=$selected; $data['form']=$form->output(); $this->view->files_css=['admin.css']; -// $data['css']=$this->insertCSS("admin.css"); $this->view->render("admin/prodedit", $data); } public function productAdd(){ diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 99f90da..129df40 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -12,9 +12,7 @@ class Home extends Controller { public function index(){ -// $data['css']=$this->insertCSS("home.css"); $this->view->files_css=['home.css']; -// $data['js']=$this->insertJS("slider.js"); $this->view->files_js=['slider.js']; $this->view->render("home/index"); } diff --git a/app/Controllers/Login.php b/app/Controllers/Login.php index cee27d4..e9d618a 100644 --- a/app/Controllers/Login.php +++ b/app/Controllers/Login.php @@ -19,8 +19,6 @@ class Login extends GuestController { public function index(){ $this->view->files_css=["login.css"]; $this->view->files_js=["animationworkaround.js"]; -// $data['css']=$this->insertCSS("login.css"); -// $data['js']=$this->insertJS("animationworkaround.js"); if (!empty($_POST) && $_SERVER['REQUEST_METHOD'] == "POST") { $data['errors'] = $this->login(); } diff --git a/app/Controllers/Register.php b/app/Controllers/Register.php index 1a8b48a..529a991 100644 --- a/app/Controllers/Register.php +++ b/app/Controllers/Register.php @@ -17,9 +17,7 @@ class Register extends GuestController { public function index(){ -// $data['css']=$this->insertCSS("register.css"); $this->view->files_css=['register.css']; -// $data['js']=$this->insertJS("animationworkaround.js"); $this->view->files_js=['animationworkaround.js']; if (!empty($_POST) && $_SERVER['REQUEST_METHOD'] == "POST") { $data['errors'] = $this->register(); @@ -76,7 +74,6 @@ public function register(){ return true; } public function success(){ -// $data['css']=$this->insertCSS("login.css"); $this->view->files_css=['login.css']; $this->view->render("register/success"); } diff --git a/app/Controllers/Shop.php b/app/Controllers/Shop.php index b171cf9..24bfa3d 100644 --- a/app/Controllers/Shop.php +++ b/app/Controllers/Shop.php @@ -18,14 +18,12 @@ public function index(){ if(isset($_POST['search'])){ $product=new Product(); $data['prod']=$product->buildShop($_POST['search']); -// $data['css']=$this->insertCSS("shop.css"); $this->view->files_css=['shop.css']; $this->view->render("shop/index", $data); } else{ $product=new Product(); $data['prod']=$product->getAll(); -// $data['css']=$this->insertCSS("shop.css"); $this->view->files_css=['shop.css']; $this->view->render("shop/index", $data); } @@ -48,7 +46,6 @@ public function prod($parm){ header("Location:".APP_URL."shop"); } $data['prod']=$product->getProduct($parm); -// $data['css']=$this->insertCSS("product.css"); $this->view->files_css=['product.css']; $this->view->render("shop/prod", $data); } diff --git a/app/Controllers/User.php b/app/Controllers/User.php index 81a6abf..3687e35 100644 --- a/app/Controllers/User.php +++ b/app/Controllers/User.php @@ -17,8 +17,6 @@ class User extends UserController { public function index(){ -// $data['css']=$this->insertCSS("login.css"); -// $data['css2']=$this->insertCSS("user.css"); $this->view->files_css=['login.css', 'user.css']; $user=new \App\Models\User(); $data['user']=$user->getUserByUname(Sessions::get("uname")); @@ -36,10 +34,7 @@ public function edit(){ ->addButton("submit", "Update") ->addButton("remove", "Remove Account", ["class"=>"remove", "onclick"=>"var x=confirm('Are you sure you want to delete your Account?'); if(x==false){return false}"]); $data['form']=$form->output(); -// $data['css']=$this->insertCSS("login.css"); -// $data['css2']=$this->insertCSS("user.css"); $this->view->files_css=['login.css', 'user.css']; -// $data['js']=$this->insertJS("animationworkaround.js"); $this->view->files_js=['animationworkaround.js']; $user=new \App\Models\User(); $userid=$user->getUserByUname(Sessions::get("uname")); diff --git a/app/Core/AdminController.php b/app/Core/AdminController.php index bb50bd1..fb4b4a9 100644 --- a/app/Core/AdminController.php +++ b/app/Core/AdminController.php @@ -18,11 +18,9 @@ public function __construct() private function checkGroup(){ if (Sessions::get('login')!=1){ header("Location:".APP_URL."error/login"); -// error(["You don't seem to be logged in. Please log in to do that"]); } if(Sessions::get('user_group')<2){ header("Location:".APP_URL."error/perm"); -// error(["You seem to have insufficient permissions. Sorry about that :/"]); } } } \ No newline at end of file diff --git a/app/Core/Model.php b/app/Core/Model.php index d44cd38..5fd130c 100644 --- a/app/Core/Model.php +++ b/app/Core/Model.php @@ -10,30 +10,4 @@ public function __construct(){ $this->db = new Database(); $this->db->query("SET names UTF8"); } -// public function insert($data=array()){ -// if(count($data)>0){ -// $sql="INSERT INTO ".$this->tablename." SET "; -// $end=array_keys($data); -// $end=end($end); -// foreach ($data as $key=>$item){ -// if($end==$key){ -// $sql.="$key='$item'"; -// } -// else{ -// $sql.="$key='$item',"; -// } -// } -// $this->db->query($sql); -// } -// } -// public function get($id=null){ -// if(id!==null){ -// $sql="SELECT * FROM ".$this->tablename." WHERE id=$id"; -// } -// else{ -// $sql="SELECT * FROM ".$this->tablename; -// } -// $res=$this->db->query($sql); -// return $res->fetch_all(MYSQLI_ASSOC); -// } } \ No newline at end of file diff --git a/app/Core/View.php b/app/Core/View.php index c57e50c..78db836 100644 --- a/app/Core/View.php +++ b/app/Core/View.php @@ -31,16 +31,6 @@ private function loadCSS(){ return false; } } -/* private function loadCSS(){ - $markup=; - if (count($this->files_css)>0){ - foreach ($this->files_css as $file){ - $markup.="\n\r"; - } - return $markup; - } - return false; - }*/ private function loadJS(){ $markup = ""; if (count($this->files_js) > 0) { diff --git a/app/Libs/Formbuilder.php b/app/Libs/Formbuilder.php index 6d046e5..65812b2 100644 --- a/app/Libs/Formbuilder.php +++ b/app/Libs/Formbuilder.php @@ -3,7 +3,6 @@ class Formbuilder{ private $markup=""; public function __construct($name ,$method="POST", $action="", $enctype=false){ -// $this->markup="\n"; $this->markup="
markup.="id='f-$name'"; else $this->markup.="action='$action' id='f-$name'"; diff --git a/app/Models/Cart.php b/app/Models/Cart.php index 76cd23a..08a5646 100644 --- a/app/Models/Cart.php +++ b/app/Models/Cart.php @@ -24,9 +24,6 @@ public function createCart($id=null){ } public function sessionToCart($session=array()){ $data=implode("::", $session['cart']); -// if ($id!=null){ -// $this->db->query("UPDATE {$this->table_name} SET data='$data' WHERE user_fs=$id"); -// } if($_SESSION['cart_count']>0){ $this->db->query("UPDATE {$this->table_name} SET data=CONCAT(data,'::$data') WHERE user_fs={$_SESSION['id']}"); } @@ -55,6 +52,5 @@ public function resolveCart(){ public function clearCart(){ $this->db->query("UPDATE {$this->table_name} SET data='' WHERE user_fs={$_SESSION['id']}"); unset($_SESSION['cart_count']); -// $_SESSION['cart_count']=0; } } \ No newline at end of file diff --git a/app/helper.php b/app/helper.php index 1f47206..8af6170 100644 --- a/app/helper.php +++ b/app/helper.php @@ -21,8 +21,4 @@ function previous($x){ //Funktion zum wiedergeben alter formular elemente (falls } function countCart(){ print_r(json_decode(\App\Libs\Sessions::get('cart'), true)); -} -//function error($code=array()){ -// if (count($code)>0)extract($code); -// require "views/sites/error/error.php"; -//} \ No newline at end of file +} \ No newline at end of file