From dff3fc7372e40dce39ab010bb16f6287556c467c Mon Sep 17 00:00:00 2001 From: OliverParoczai Date: Thu, 1 Apr 2021 11:58:21 +0200 Subject: [PATCH] Finish event uploading, minor fixes --- API/request.php | 7 ++++++- admin/eventupload.php | 46 +++++++++++++++++++++++++++---------------- css/style.css | 8 +++++++- events.php | 9 +++++++-- footer.php | 4 +++- header.php | 37 ++++++++++++++++++++++++++++++++-- school.php | 10 ++++++++-- setup.php | 6 +++--- 8 files changed, 98 insertions(+), 29 deletions(-) diff --git a/API/request.php b/API/request.php index 0c2c381..30d0681 100644 --- a/API/request.php +++ b/API/request.php @@ -53,7 +53,12 @@ if($type == null){ } if (!empty($result) && $result->num_rows > 0) { while($row = $result->fetch_assoc()) { - $list["name"] += $row["name"]; + if($row["fullname"] != ""){ + $list["name"] = $row["fullname"]; + }else{ + $list["name"] = $row["username"]; + } + } echo json_encode($list); }else{ diff --git a/admin/eventupload.php b/admin/eventupload.php index 22028f6..760ec7d 100644 --- a/admin/eventupload.php +++ b/admin/eventupload.php @@ -1,4 +1,4 @@ - +
@@ -8,16 +8,23 @@
- +
"; - for($i = 0; $i=0; $i--) { if($json[$i]["title"] != ""){ #echo ''.$json[$i]["title"].'
'.$json[$i]["description"].'
'; //echo '
'.$json[$i]["title"].'
'.$selschvals["name"].'
'.$json[$i]["description"].'
'; @@ -27,14 +34,14 @@ diff --git a/css/style.css b/css/style.css index f9e3a35..1645be1 100644 --- a/css/style.css +++ b/css/style.css @@ -42,7 +42,13 @@ section.fullscreencontent { } .ls-closed section.fullscreencontent { - margin-left: 15px; } + margin-left: 15px; +} + +.fixsizeimg42 { + height: 42px; + width: 42px; +} /* Navbar ====================================== */ @import url(materialize.css); diff --git a/events.php b/events.php index 84d2e49..7a9d0e1 100644 --- a/events.php +++ b/events.php @@ -10,7 +10,7 @@ =0; $i--) { if($json[$i]["title"] != ""){ if($json[$i]["ownertype"] == 2){ $viewsql = "SELECT * FROM `companies` WHERE `id` = ".$json[$i]["ownerid"]; @@ -21,7 +21,12 @@ if ($result == TRUE) { if (!empty($result) && $result->num_rows > 0) { $vals = $result->fetch_assoc(); - $ownername = $vals["name"]; + if($json[$i]["uploadedas_userid"] != ""){ + $userjson = json_decode(file_get_contents($url."/API/request.php?type=user&id=".$json[$i]["ownerid"]), true); + $ownername = $userjson["name"]; + }else{ + $ownername = $vals["name"]; + } }else{ $ownername = "Ismeretlen"; } diff --git a/footer.php b/footer.php index 253c2f6..8252ab5 100644 --- a/footer.php +++ b/footer.php @@ -45,8 +45,10 @@ - + + + diff --git a/header.php b/header.php index 20fb22b..0ca12f0 100644 --- a/header.php +++ b/header.php @@ -120,6 +120,7 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type ! copy($_FILES["formfile"]["tmp_name"], $filepath); } } + $conn->query($modsql); if(isset($uploadProblem)){ header("Location: dataupload.php?imageuploaded=".$uploadProblem); die(); @@ -150,6 +151,29 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type ! } die(); } + }elseif(isset($eventupload)){ + if(isset($_POST["submit"]) || isset($_POST["submituser"])){ + if($type == 2){ + $ownertype = 2; + $ownerid = substr($_SESSION["selectedcompany"], 1); + + }else{ + $ownertype = 1; + $ownerid = substr($_SESSION["selectedschool"], 1); + } + if(isset($_POST["submituser"])){ + $submituser = $userid; + }else{ + $submituser = ""; + } + $modsql = "INSERT INTO `events` (`title`, `description`, `datetime`, `ownertype`, `ownerid`, `category`, `uploadedas_userid`) VALUES ('".$conn->real_escape_string($_POST['title'])."', '".$conn->real_escape_string($_POST['description'])."', '".date('Y-m-d H:i:s')."', '".$ownertype."', '".$ownerid."', 'none', '".$submituser."');"; + if ($conn->query($modsql) === TRUE) { + header("Location: eventupload.php?eventadded=1"); + } else { + header("Location: eventupload.php?eventadded=0"); + } + die(); + } } if($type == 2){ @@ -276,6 +300,15 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type ! + + + + + - + "> @@ -483,7 +516,7 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type ! User
- +
".$ssname; ?>
diff --git a/school.php b/school.php index c1c351d..5b40818 100644 --- a/school.php +++ b/school.php @@ -1,7 +1,7 @@
') center center; width: 100%; height: ; background-repeat: no-repeat; background-size: cover;">
-
+
".$mjson[$mid]["name"].""; }else{ echo "

".$mjson[$mid]["name"]."

"; }?>

".$mjson[$mid]["emailaddress"]." "; }else{ echo "Nincs megadva"; }?>
+ + bookOktatott szakok +

+ " readOnly disabled> +
+
diff --git a/setup.php b/setup.php index 7b449a3..d2f9fc6 100755 --- a/setup.php +++ b/setup.php @@ -9,15 +9,15 @@ if(!file_exists("images/company")){ $error = 1; } } -if(!file_exists("images/school")){ - if(mkdir("images/school", 0777) && $error != 1){ +if(!file_exists("images/user")){ + if(mkdir("images/user", 0777) && $error != 1){ echo "Felhasználói fotó könyvtár létrehozva
"; }else{ $error = 1; } } if(!file_exists("images/school")){ - if(mkdir("images/user", 0777) && $error != 1){ + if(mkdir("images/school", 0777) && $error != 1){ echo "Intézményi fotó könyvtár létrehozva
"; }else{ $error = 1;