Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
m-scha1337 committed Dec 11, 2018
1 parent 18cf238 commit 4f45c0a
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 68 deletions.
5 changes: 0 additions & 5 deletions app/Controllers/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand All @@ -41,7 +40,6 @@ public function user(){
$markup.="</tr>";
}
$data['userList']=$markup;
// $data['css']=$this->insertCSS("admin.css");
$this->view->files_css=["admin.css"];
$this->view->render("admin/user", $data);
}
Expand Down Expand Up @@ -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);
Expand All @@ -110,7 +107,6 @@ public function product($id=null){
$markup.="</tr>";
}
$this->view->files_css=["admin.css"];
// $data['css']=$this->insertCSS("admin.css");
$data['prod']=$markup;
$this->view->render("admin/product", $data);
}
Expand All @@ -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(){
Expand Down
2 changes: 0 additions & 2 deletions app/Controllers/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 0 additions & 2 deletions app/Controllers/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
3 changes: 0 additions & 3 deletions app/Controllers/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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");
}
Expand Down
3 changes: 0 additions & 3 deletions app/Controllers/Shop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions app/Controllers/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down
2 changes: 0 additions & 2 deletions app/Core/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 :/"]);
}
}
}
26 changes: 0 additions & 26 deletions app/Core/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
}
10 changes: 0 additions & 10 deletions app/Core/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.="<link rel=\"stylesheet\" href=\"".APP_URL."$file\">\n\r";
}
return $markup;
}
return false;
}*/
private function loadJS(){
$markup = "";
if (count($this->files_js) > 0) {
Expand Down
1 change: 0 additions & 1 deletion app/Libs/Formbuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
class Formbuilder{
private $markup="";
public function __construct($name ,$method="POST", $action="", $enctype=false){
// $this->markup="<script src='assets/js/animationworkaround.js'></script>\n";
$this->markup="<form method='$method' ";
if(empty($action)) $this->markup.="id='f-$name'";
else $this->markup.="action='$action' id='f-$name'";
Expand Down
4 changes: 0 additions & 4 deletions app/Models/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']}");
}
Expand Down Expand Up @@ -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;
}
}
6 changes: 1 addition & 5 deletions app/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
//}
}

0 comments on commit 4f45c0a

Please sign in to comment.