From eb1fc154015d8477041aee70a05c2561f8983196 Mon Sep 17 00:00:00 2001 From: Joey Lai Date: Fri, 20 Jan 2017 12:32:39 +0100 Subject: [PATCH 001/233] script on right lines --- website/public/login.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/website/public/login.php b/website/public/login.php index 65babdf..3d37da7 100644 --- a/website/public/login.php +++ b/website/public/login.php @@ -7,6 +7,18 @@ include_once("../queries/checkInput.php") ?> + + - - - -- 2.49.1 From 42188609363a214a33a7df8a5bbd8c91a3e6334a Mon Sep 17 00:00:00 2001 From: Hendrik Date: Fri, 20 Jan 2017 14:43:04 +0100 Subject: [PATCH 002/233] remove testinput --- website/views/adminpanel.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/website/views/adminpanel.php b/website/views/adminpanel.php index fde8237..116512c 100644 --- a/website/views/adminpanel.php +++ b/website/views/adminpanel.php @@ -62,12 +62,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $listn = ($currentpage-1) * $perpage; $listm = $currentpage * $perpage; -function test_input($data) { - $data = trim($data); - $data = stripslashes($data); - $data = htmlspecialchars($data); - return $data; -} ?>
-- 2.49.1 From 59d4740ad5843650f5b5fa7a5eb316e36d309f61 Mon Sep 17 00:00:00 2001 From: Marijn Jansen Date: Fri, 20 Jan 2017 14:55:47 +0100 Subject: [PATCH 003/233] Alpha 0.0.1 profile picture upload shizzle! --- website/public/settings.php | 3 ++- website/queries/settings.php | 28 +++++++++++++++++++++++++--- website/views/settings-view.php | 3 ++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/website/public/settings.php b/website/public/settings.php index 45e50d8..d52608b 100644 --- a/website/public/settings.php +++ b/website/public/settings.php @@ -22,12 +22,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $result = updateSettings(); break; case "password": - $result = updatePassword(); + $result = changePassword(); break; case "email": $result = changeEmail(); break; case "picture": + updateProfilePicture(); $result = $notImplemented; break; } diff --git a/website/queries/settings.php b/website/queries/settings.php index 7c92583..b85cae8 100644 --- a/website/queries/settings.php +++ b/website/queries/settings.php @@ -99,11 +99,11 @@ function updateSettings() { return new settingsMessage("happy", "Instellingen zijn opgeslagen."); } -function updatePassword() { +function changePassword() { $user = getPasswordHash(); if (password_verify($_POST["password-old"], $user["password"])) { if ($_POST["password-new"] == $_POST["password-confirm"] && (strlen($_POST["password-new"]) >= 8)) { - if (changePassword()) { + if (doChangePassword()) { return new settingsMessage("happy", "Wachtwoord gewijzigd."); } else { return new settingsMessage("angry", "Er is iets mis gegaan."); @@ -116,7 +116,7 @@ function updatePassword() { } } -function changePassword() { +function doChangePassword() { $stmt = $GLOBALS["db"]->prepare(" UPDATE `user` @@ -184,4 +184,26 @@ function doChangeEmail($email) { $stmt->bindParam(":userID", $_SESSION["userID"]); $stmt->execute(); return $stmt->rowCount(); +} + +function updateProfilePicture() { + $profilePictureDir = "/var/www/html/public/"; + $relativePath = "uploads/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]); + move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath); + setProfilePictureToDatabase("../" . $relativePath); +} + +function setProfilePictureToDatabase($url) { + $stmt = $GLOBALS["db"]->prepare(" + UPDATE + `user` + SET + `profilepicture` = :profilepicture + WHERE + `userID` = :userID + "); + + $stmt->bindParam(":profilepicture", $url); + $stmt->bindParam(":userID", $_SESSION["userID"]); + $stmt->execute(); } \ No newline at end of file diff --git a/website/views/settings-view.php b/website/views/settings-view.php index 6d9d660..f6c4e07 100644 --- a/website/views/settings-view.php +++ b/website/views/settings-view.php @@ -1,5 +1,6 @@
@@ -68,7 +69,7 @@ $settings = getSettings(); -
+
Verander profielfoto
  • -- 2.49.1 From e547712b2a6020aaee8cb59ee4795287f82dfa74 Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Fri, 20 Jan 2017 15:02:05 +0100 Subject: [PATCH 004/233] Changed links to absolute path. --- website/views/adminpanel.php | 2 +- website/views/header.php | 12 ++++++------ website/views/login-view.php | 4 ++-- website/views/login_head.php | 6 +++--- website/views/menu.php | 2 +- website/views/profile.php | 2 +- website/views/register-view.php | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/website/views/adminpanel.php b/website/views/adminpanel.php index fde8237..e8efe6f 100644 --- a/website/views/adminpanel.php +++ b/website/views/adminpanel.php @@ -3,7 +3,7 @@ Admin Panel - +
    diff --git a/website/views/login-view.php b/website/views/login-view.php index 33fa7e9..7a023f0 100644 --- a/website/views/login-view.php +++ b/website/views/login-view.php @@ -1,6 +1,6 @@
    MyHyvesbook+
    diff --git a/website/views/login_head.php b/website/views/login_head.php index a41e87e..645f919 100644 --- a/website/views/login_head.php +++ b/website/views/login_head.php @@ -3,9 +3,9 @@ MyHyvesbook+ + href="/styles/main.css"> - + href="/styles/index.css"> + diff --git a/website/views/menu.php b/website/views/menu.php index 88ae076..c6b030a 100644 --- a/website/views/menu.php +++ b/website/views/menu.php @@ -51,7 +51,7 @@ echo "
  • -
    +
- -
-- 2.49.1 From e7d63c2f572a79d6a2250e2f3ae23a57f6e370fc Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Fri, 20 Jan 2017 15:34:01 +0100 Subject: [PATCH 006/233] Changed how name is displayed on profile page. --- website/public/styles/profile.css | 23 ++++------------------- website/views/profile.php | 7 ++++--- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/website/public/styles/profile.css b/website/public/styles/profile.css index af1ed58..7437e4c 100644 --- a/website/public/styles/profile.css +++ b/website/public/styles/profile.css @@ -10,9 +10,12 @@ margin: 0 20px 20px 0; } -.profile-box .profile-username { +.profile-box h1.profile-username { padding-top: 50px; } +.profile-box h5.profile-username { + padding-top: 0; +} div.posts { padding-top: 20px; @@ -37,24 +40,6 @@ div.posts .post p.subscript { font-size: 8pt; } -/*.posts {*/ - /*z-index: -1;*/ - /*margin-right: 0;*/ - /*width: calc(100% + 15px);*/ -/*}*/ - -/*.post-box {*/ - /*display: inline-flex;*/ - /*margin: 20px 15px 0 0;*/ - /*padding: 25px;*/ - /*background-color: #FFFFFF;*/ -/*}*/ - -/*!* fullscreen *!*/ -/*.post-box {*/ - /*width: calc(25% - 69px);*/ -/*}*/ - @media only screen and (max-width: 1500px) { .post-box { width: calc(50% - 68px); diff --git a/website/views/profile.php b/website/views/profile.php index f8cdadd..1457dee 100644 --- a/website/views/profile.php +++ b/website/views/profile.php @@ -4,7 +4,8 @@

Als vriend toevoegen

-

()

+

+

@@ -13,7 +14,7 @@

fetch()) { - echo "${friend["username"]}"; + echo "${friend["username"]}"; } @@ -29,7 +30,7 @@

fetch()) { - echo "${group["name"]}s logo"; + echo "${group["name"]}s logo"; } if($profile_groups->rowCount() === 0) { -- 2.49.1 From 587d0e6ac351787fe1d944b06c6a05b42e1952f1 Mon Sep 17 00:00:00 2001 From: Marijn Jansen Date: Fri, 20 Jan 2017 15:41:13 +0100 Subject: [PATCH 007/233] fixed crosssitescripting on settings pagw --- website/queries/settings.php | 8 ++++---- website/views/settings-view.php | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/website/queries/settings.php b/website/queries/settings.php index b85cae8..7d3bf9c 100644 --- a/website/queries/settings.php +++ b/website/queries/settings.php @@ -87,11 +87,11 @@ function updateSettings() { `userID` = :userID "); - $stmt->bindParam(":fname", $_POST["fname"]); - $stmt->bindParam(":lname", $_POST["lname"]); - $stmt->bindParam(":location", $_POST["location"]); + $stmt->bindParam(":fname", test_input($_POST["fname"])); + $stmt->bindParam(":lname", test_input($_POST["lname"])); + $stmt->bindParam(":location", test_input($_POST["location"])); $stmt->bindParam(":bday", $_POST["bday"]); - $stmt->bindParam(":bio", $_POST["bio"]); + $stmt->bindParam(":bio", test_input($_POST["bio"])); $stmt->bindParam(":userID", $_SESSION["userID"]); $stmt->execute(); diff --git a/website/views/settings-view.php b/website/views/settings-view.php index f6c4e07..1fa5278 100644 --- a/website/views/settings-view.php +++ b/website/views/settings-view.php @@ -1,6 +1,5 @@

-- 2.49.1 From e17a55e82dff94723917a2393698892134aab18e Mon Sep 17 00:00:00 2001 From: Joey Lai Date: Fri, 20 Jan 2017 16:01:08 +0100 Subject: [PATCH 008/233] Fixed redirect to profile page after going back 1 page --- website/public/js/registerAndLogin.js | 8 ++++++++ website/public/login.php | 13 +------------ website/public/register.php | 6 ++++-- website/views/login_head.php | 1 + 4 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 website/public/js/registerAndLogin.js diff --git a/website/public/js/registerAndLogin.js b/website/public/js/registerAndLogin.js new file mode 100644 index 0000000..8428440 --- /dev/null +++ b/website/public/js/registerAndLogin.js @@ -0,0 +1,8 @@ +function checkLoggedIn() { + if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) { + window.location.href = "logout.php"; + } else { + window.history.back(); + } + document.getElementById("demo").innerHTML = x; +} diff --git a/website/public/login.php b/website/public/login.php index b3da203..0d07413 100644 --- a/website/public/login.php +++ b/website/public/login.php @@ -4,20 +4,9 @@ include("../views/login_head.php"); require_once("../queries/connect.php"); include_once("../queries/login.php"); - include_once("../queries/checkInput.php") + include_once("../queries/checkInput.php"); ?> - - + -- 2.49.1 From 6ff70440e67ad96ef71867ef26ca1a1f3f90135c Mon Sep 17 00:00:00 2001 From: Joey Lai Date: Fri, 20 Jan 2017 16:14:32 +0100 Subject: [PATCH 009/233] history back -> profile.php --- website/public/js/registerAndLogin.js | 2 +- website/public/register.php | 2 +- website/views/login_head.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/public/js/registerAndLogin.js b/website/public/js/registerAndLogin.js index 8428440..0452d15 100644 --- a/website/public/js/registerAndLogin.js +++ b/website/public/js/registerAndLogin.js @@ -2,7 +2,7 @@ function checkLoggedIn() { if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) { window.location.href = "logout.php"; } else { - window.history.back(); + window.location.href = "profile.php"; } document.getElementById("demo").innerHTML = x; } diff --git a/website/public/register.php b/website/public/register.php index ec1f879..8c0f8e4 100644 --- a/website/public/register.php +++ b/website/public/register.php @@ -29,7 +29,7 @@ } else { $bday = test_input($_POST["bday"]); } -g + checkInputChoice("username", "username"); checkInputChoice("password", "longerEight"); checkInputChoice("confirmpassword", ""); diff --git a/website/views/login_head.php b/website/views/login_head.php index 7f1771a..05c9e38 100644 --- a/website/views/login_head.php +++ b/website/views/login_head.php @@ -7,6 +7,6 @@ - + -- 2.49.1 From 173ef3e50c2feceb27e715fddbfc33aac08ff5db Mon Sep 17 00:00:00 2001 From: Lars van Hijfte Date: Fri, 20 Jan 2017 16:17:56 +0100 Subject: [PATCH 010/233] Added a notification bar --- website/public/js/header.js | 24 ++++++++++++++++++++++-- website/public/styles/header.css | 22 +--------------------- website/public/styles/menu.css | 17 +++++++++++++++++ website/queries/friendship.php | 3 ++- website/views/header.php | 9 +++------ website/views/notification-center.php | 11 +++++++++++ 6 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 website/views/notification-center.php diff --git a/website/public/js/header.js b/website/public/js/header.js index 797c56c..ceb6086 100644 --- a/website/public/js/header.js +++ b/website/public/js/header.js @@ -1,7 +1,27 @@ $(document).ready(function() { + // Hide notification center. $("#profile-menu-popup").hide(); + + // $("#own-profile-picture").click(function() { + // $("#profile-menu-popup").toggle(); + // $("#profile-hello-popup").toggle(); + // }); + $("#own-profile-picture").click(function() { - $("#profile-menu-popup").toggle(); - $("#profile-hello-popup").toggle(); + if($("#notification-center").css('right') == "-256px") { + // $(".content").animate({ + // marginRight: "256px" + // }, 500); + $("#notification-center").animate({ + right: "0px" + }, 500); + } else { + // $(".content").animate({ + // marginRight: "0px" + // }, 500); + $("#notification-center").animate({ + right: "-256px" + }, 500); + } }); }); diff --git a/website/public/styles/header.css b/website/public/styles/header.css index 84f308c..ddefdec 100644 --- a/website/public/styles/header.css +++ b/website/public/styles/header.css @@ -33,32 +33,12 @@ header { header div { display: inline-block; } - -#open-chat { - font-size: 32px; - line-height: 80px; - margin-right: 50px; -} - -.profile-menu { - font-size: 21px; -} - .profile-menu img { padding: 8px; height: 64px; width: 64px; } -#own-profile-picture, #profile-menu-popup span { +#own-profile-picture { cursor: pointer; } - -#profile-menu-popup { - padding: 5px; - - background: white; - color: #666; - - border-radius: 3px; -} diff --git a/website/public/styles/menu.css b/website/public/styles/menu.css index 4d4b8bb..b9e3904 100644 --- a/website/public/styles/menu.css +++ b/website/public/styles/menu.css @@ -42,4 +42,21 @@ height: 100%; padding: 0; text-align: left; +} + +#notification-center { + left: auto; + width: 256px; + right: -256px; +} + +#quick-links { + text-align: center; + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); +} + +#quick-links i { + color: #845663; + font-size: 42px; + padding: 7px; } \ No newline at end of file diff --git a/website/queries/friendship.php b/website/queries/friendship.php index 258699f..df6a917 100644 --- a/website/queries/friendship.php +++ b/website/queries/friendship.php @@ -15,13 +15,14 @@ function selectAllFriends($userID) { `user` INNER JOIN `friendship` + WHERE (`friendship`.`user1ID` = :userID AND `friendship`.`user2ID` = `user`.`userID` OR `friendship`.`user2ID` = :userID AND `friendship`.`user1ID` = `user`.`userID`) AND `role` != 5 AND - `status` = 1 + `status` = 1 "); $stmt->bindParam(':userID', $userID, PDO::PARAM_INT); diff --git a/website/views/header.php b/website/views/header.php index a58e5f0..2d65291 100644 --- a/website/views/header.php +++ b/website/views/header.php @@ -19,11 +19,6 @@ $userinfo = getHeaderInfo();
-
- | - | - -
Hallo @@ -32,5 +27,7 @@ $userinfo = getHeaderInfo();
"/>
-
+ + + diff --git a/website/views/notification-center.php b/website/views/notification-center.php new file mode 100644 index 0000000..f4b4b5d --- /dev/null +++ b/website/views/notification-center.php @@ -0,0 +1,11 @@ + \ No newline at end of file -- 2.49.1 From 9152ae4f75b17fd7903ba10624f54560f337a637 Mon Sep 17 00:00:00 2001 From: Hendrik Date: Fri, 20 Jan 2017 16:18:09 +0100 Subject: [PATCH 011/233] add searching users, searching groups, remembering search options --- website/public/search.php | 6 +- website/public/styles/search.css | 5 ++ website/queries/group_page.php | 23 +++++- website/queries/user.php | 35 ++++++++- website/views/search-view.php | 120 +++++++++++++++++++------------ 5 files changed, 137 insertions(+), 52 deletions(-) diff --git a/website/public/search.php b/website/public/search.php index c314791..6cfadd8 100644 --- a/website/public/search.php +++ b/website/public/search.php @@ -1,7 +1,11 @@ - + diff --git a/website/public/styles/search.css b/website/public/styles/search.css index 4b2281c..b54723d 100644 --- a/website/public/styles/search.css +++ b/website/public/styles/search.css @@ -9,4 +9,9 @@ #search-friends-output { margin-right: 10px; +} + +.searchleft, .searchright { + display: inline-block; + vertical-align: top; } \ No newline at end of file diff --git a/website/queries/group_page.php b/website/queries/group_page.php index ef7af07..d704e8c 100644 --- a/website/queries/group_page.php +++ b/website/queries/group_page.php @@ -172,5 +172,26 @@ function changeMultipleGroupStatusByID($ids, $status) { return $q; } +function searchSomeGroups($n, $m, $search) { + $stmt = $GLOBALS["db"]->prepare(" + SELECT + `name`, + `picture` + FROM + `group_page` + WHERE + `name` LIKE :keyword + ORDER BY + `name` + LIMIT + :n, :m + "); -?> + $search = "%$search%"; + $stmt->bindParam(':keyword', $search); + $stmt->bindParam(':n', $n, PDO::PARAM_INT); + $stmt->bindParam(':m', $m, PDO::PARAM_INT); + $stmt->execute(); + return $stmt; +} +?> \ No newline at end of file diff --git a/website/queries/user.php b/website/queries/user.php index 398e2e4..114d673 100644 --- a/website/queries/user.php +++ b/website/queries/user.php @@ -252,12 +252,12 @@ function selectRandomNotFriendUser($userID) { FROM `user` WHERE - `userID` NOT IN (SELECT + `userID` NOT IN (SELECT `user1ID` FROM `friendship` WHERE `user1ID` = :userID) OR - `userID` NOT IN (SELECT + `userID` NOT IN (SELECT `user2ID` FROM `friendship` @@ -271,4 +271,33 @@ function selectRandomNotFriendUser($userID) { $stmt->bindParam(':userID', $userID, PDO::PARAM_INT); $stmt->execute(); return $stmt->fetch(); -} \ No newline at end of file +} + +function searchSomeUsers($n, $m, $search) { + $stmt = $GLOBALS["db"]->prepare(" + SELECT + `username`, + `profilepicture`, + `fname`, + `lname` + FROM + `user` + WHERE + `username` LIKE :keyword OR + `fname` LIKE :keyword OR + `lname` LIKE :keyword + ORDER BY + `fname`, + `lname`, + `username` + LIMIT + :n, :m + "); + + $search = "%$search%"; + $stmt->bindParam(':keyword', $search); + $stmt->bindParam(':n', $n, PDO::PARAM_INT); + $stmt->bindParam(':m', $m, PDO::PARAM_INT); + $stmt->execute(); + return $stmt; +} diff --git a/website/views/search-view.php b/website/views/search-view.php index b1418d1..0d650d4 100644 --- a/website/views/search-view.php +++ b/website/views/search-view.php @@ -1,3 +1,16 @@ + +
@@ -7,72 +20,85 @@ + value= + >
-
+

Gebruikers

-
- \ No newline at end of file +
-- 2.49.1 From 18185020c3b4a389d623042050a8edafe622dc6a Mon Sep 17 00:00:00 2001 From: "K. Nobel" Date: Fri, 20 Jan 2017 16:18:12 +0100 Subject: [PATCH 012/233] Added improvements to profile page. --- website/public/styles/profile.css | 21 +++++++++++++-------- website/views/profile.php | 12 ++++++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/website/public/styles/profile.css b/website/public/styles/profile.css index 7437e4c..9c07242 100644 --- a/website/public/styles/profile.css +++ b/website/public/styles/profile.css @@ -40,6 +40,19 @@ div.posts .post p.subscript { font-size: 8pt; } +div.posts .post form input, div.posts .post form textarea { + width: calc(100% - 15px); +} + +div.posts .post form input[type="submit"] { + width: 100%; +} + +div.posts .post form textarea.newpost { + margin: 15px 0 15px 0; + height: 100px; +} + @media only screen and (max-width: 1500px) { .post-box { width: calc(50% - 68px); @@ -53,14 +66,6 @@ div.posts .post p.subscript { } } -.post { - width: 100%; -} - -.post img { - width: 100%; -} - .post .post-date { float: right; color: #aaaaaa; diff --git a/website/views/profile.php b/website/views/profile.php index 1457dee..19bd908 100644 --- a/website/views/profile.php +++ b/website/views/profile.php @@ -42,6 +42,18 @@
+
+
+ + + +
+
+ fetch()) { $nicetime = nicetime($post["creationdate"]); echo " -- 2.49.1 From ac96200d1642a663c61545de841af182285d9981 Mon Sep 17 00:00:00 2001 From: Marijn Jansen Date: Fri, 20 Jan 2017 16:20:34 +0100 Subject: [PATCH 013/233] Kind of works now: Profile update --- website/public/settings.php | 2 +- website/queries/settings.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/website/public/settings.php b/website/public/settings.php index d52608b..06d17c0 100644 --- a/website/public/settings.php +++ b/website/public/settings.php @@ -29,7 +29,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { break; case "picture": updateProfilePicture(); - $result = $notImplemented; + $result = new settingsMessage("happy", "Deze melding doet nog niks nuttigs."); break; } } diff --git a/website/queries/settings.php b/website/queries/settings.php index 7d3bf9c..0e6dff2 100644 --- a/website/queries/settings.php +++ b/website/queries/settings.php @@ -188,22 +188,28 @@ function doChangeEmail($email) { function updateProfilePicture() { $profilePictureDir = "/var/www/html/public/"; - $relativePath = "uploads/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]); + $relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]); +// removeOldProfilePicture(); move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath); setProfilePictureToDatabase("../" . $relativePath); } +//function removeOldProfilePicture() { +// +// unlink("/var/www/html/public/uploads/profilepictures/" . $_SESSION["userID"] . "_*"); +//} + function setProfilePictureToDatabase($url) { $stmt = $GLOBALS["db"]->prepare(" UPDATE `user` SET - `profilepicture` = :profilepicture + `profilepicture` = :profilePicture WHERE `userID` = :userID "); - $stmt->bindParam(":profilepicture", $url); + $stmt->bindParam(":profilePicture", $url); $stmt->bindParam(":userID", $_SESSION["userID"]); $stmt->execute(); } \ No newline at end of file -- 2.49.1 From 2a44057233f4abb86eec42c419e566adcb5e7d2d Mon Sep 17 00:00:00 2001 From: Marijn Jansen Date: Sun, 22 Jan 2017 11:23:13 +0100 Subject: [PATCH 014/233] Changed binParam for bindValue --- website/queries/settings.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/website/queries/settings.php b/website/queries/settings.php index 0e6dff2..f4c7011 100644 --- a/website/queries/settings.php +++ b/website/queries/settings.php @@ -87,12 +87,12 @@ function updateSettings() { `userID` = :userID "); - $stmt->bindParam(":fname", test_input($_POST["fname"])); - $stmt->bindParam(":lname", test_input($_POST["lname"])); - $stmt->bindParam(":location", test_input($_POST["location"])); - $stmt->bindParam(":bday", $_POST["bday"]); - $stmt->bindParam(":bio", test_input($_POST["bio"])); - $stmt->bindParam(":userID", $_SESSION["userID"]); + $stmt->bindValue(":fname", test_input($_POST["fname"])); + $stmt->bindValue(":lname", test_input($_POST["lname"])); + $stmt->bindValue(":location", test_input($_POST["location"])); + $stmt->bindValue(":bday", $_POST["bday"]); + $stmt->bindValue(":bio", test_input($_POST["bio"])); + $stmt->bindValue(":userID", $_SESSION["userID"]); $stmt->execute(); -- 2.49.1 From 93b6835ea4400193d9a8fe98ecbafb7018ab4697 Mon Sep 17 00:00:00 2001 From: Lars van Hijfte Date: Mon, 23 Jan 2017 11:33:27 +0100 Subject: [PATCH 015/233] Changed style and added friendrequests --- website/public/API/loadMessages.php | 1 + website/public/API/loadNotifications.php | 8 +++ website/public/js/notifications.js | 34 ++++++++++++ website/public/profile.php | 2 +- website/public/styles/adminpanel.css | 4 +- website/public/styles/chat.css | 2 +- website/public/styles/header.css | 8 ++- website/public/styles/index.css | 2 +- website/public/styles/main.css | 71 +++++++++++++++++------- website/public/styles/menu.css | 12 +++- website/public/styles/profile.css | 16 +++++- website/queries/friendship.php | 33 ++++++++++- website/views/head.php | 17 +++--- website/views/header.php | 2 +- website/views/menu.php | 6 +- website/views/notification-center.php | 7 ++- 16 files changed, 178 insertions(+), 47 deletions(-) create mode 100644 website/public/API/loadNotifications.php create mode 100644 website/public/js/notifications.js diff --git a/website/public/API/loadMessages.php b/website/public/API/loadMessages.php index 1c6b942..e30acc8 100644 --- a/website/public/API/loadMessages.php +++ b/website/public/API/loadMessages.php @@ -1,6 +1,7 @@ \ +
\ + \ +
\ + \ + "); + } +} + +function loadNotifications() { + $.post( + "API/loadNotifications.php" + ).done(function(data) { + if (data && data != "[]") { + showNotifications(JSON.parse(data), "friendrequestslist"); + } + }); + + setTimeout(loadNotifications, 10000); +} + +loadNotifications(); + diff --git a/website/public/profile.php b/website/public/profile.php index 6ede201..e4f1452 100644 --- a/website/public/profile.php +++ b/website/public/profile.php @@ -4,7 +4,7 @@ diff --git a/website/public/styles/adminpanel.css b/website/public/styles/adminpanel.css index b226cd3..4c5356f 100644 --- a/website/public/styles/adminpanel.css +++ b/website/public/styles/adminpanel.css @@ -6,7 +6,7 @@ .admin-title { margin: 10px; padding-bottom: 5px; - border-bottom: 4px solid #845663; + border-bottom: 4px solid #FBC02D; } .admin-panel input[type="radio"], input[type="checkbox"] { @@ -18,7 +18,7 @@ padding: 8px; vertical-align: top; border-radius: 10px; - border: 4px solid #845663; + border: 4px solid #FBC02D; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } diff --git a/website/public/styles/chat.css b/website/public/styles/chat.css index e2fa7c9..f6060dd 100644 --- a/website/public/styles/chat.css +++ b/website/public/styles/chat.css @@ -83,7 +83,7 @@ .chat-field input[type="submit"] { width: auto; float: right; - background-color: #845663; + background-color: #FBC02D; color: white; padding: 5px 10px; border-radius: 0 10px 10px 0; diff --git a/website/public/styles/header.css b/website/public/styles/header.css index ddefdec..e39f204 100644 --- a/website/public/styles/header.css +++ b/website/public/styles/header.css @@ -8,21 +8,23 @@ header { width: 100%; color: white; - background-color: rgba(132,86,99, 0.98); + background-color: #FBC02D; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } +#header-logo { + padding-left: 42px; +} #header-logo, #header-logo img { height: 80px; vertical-align: middle; line-height: 80px; - padding-left: 5px; } #header-search { - padding-left: 48px; + padding-left: 42px; } diff --git a/website/public/styles/index.css b/website/public/styles/index.css index 4b55904..6c12823 100644 --- a/website/public/styles/index.css +++ b/website/public/styles/index.css @@ -19,7 +19,7 @@ body { background-size: cover; background-attachment: fixed;*/ - /*background-color: #B78996;*/ + /*background-color: #EEE;*/ color: #333; font-family: Arial, sans-serif; } diff --git a/website/public/styles/main.css b/website/public/styles/main.css index 014d05b..062d5d9 100644 --- a/website/public/styles/main.css +++ b/website/public/styles/main.css @@ -18,7 +18,7 @@ html { body { height: 100%; - background-color: #B78996; + background-color: #EEE; color: #333; font-family: Arial, sans-serif; } @@ -37,11 +37,12 @@ h3 { } h4 { - font-size: 1.6em; + font-size: 1.2em; } h5 { - font-size: 1.4em; + font-size: 1.0em; + color: #666; } ul { @@ -54,12 +55,12 @@ p { /* Selection colors */ ::selection { - background: #845663; + background: #FBC02D; color: white; } ::-moz-selection { - background: #845663; + background: #FBC02D; color: white; } @@ -75,7 +76,7 @@ p { .platform { padding: 20px; margin-bottom: 10px; - border-radius: 10px; + border-radius: 5px; background-color: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } @@ -143,7 +144,7 @@ button, input, select { cursor: pointer; border: none; font-size: 16px; - border-radius: 7px; + transition-duration: 250ms; } /* All textinput and sections */ @@ -151,19 +152,53 @@ textarea, input, select { padding: 0 5px; background: white; color: #333333; - border: 1px solid #845663; - border-radius: 7px; + border-radius: 5px; + border-bottom: 1px solid #4CAF50; font-size: 16px; + outline: none; + transition-duration: 250ms; +} + +textarea { + padding: 5px; + resize: none; +} + +textarea:hover, input:hover, select:hover { + border-radius: 10px; +} + +textarea:focus, input:focus, select:focus { + border-radius: 10px; + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } /* All buttons */ button, input[type="submit"], input[type="reset"] { - background-color: #845663; + background-color: #FBC02D; color: white; padding: 0 10px; border: none; + border-radius: 5px; +} + +button:focus, +input[type="submit"]:focus, +input[type="reset"]:focus { + outline: none; +} + +button:active, +input[type="submit"]:active, +input[type="reset"]:active { + outline: none; + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24) +} + +input[type="radio"] { + border-radius: 100%; } /* Tables */ @@ -190,19 +225,17 @@ img[data-title]:hover:after, span[data-title]:hover:after, div[data-title]:hover:after { content: attr(data-title); - padding: 4px 4px; + padding: 7px 7px; color: #FFFFFF; position: absolute; left: 0; - top: 100%; - z-index: 20; + top: 150%; + z-index: 200; white-space: nowrap; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - border-radius: 5px; - -moz-box-shadow: 0 0 4px #222; - -webkit-box-shadow: 0 0 4px #222; - box-shadow: 0 0 4px #222; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22); background-color: #333; font-size: 15px; line-height: normal; diff --git a/website/public/styles/menu.css b/website/public/styles/menu.css index b9e3904..69aa8a9 100644 --- a/website/public/styles/menu.css +++ b/website/public/styles/menu.css @@ -1,6 +1,7 @@ .menu { position: fixed; z-index: 50; + overflow-y: auto; left: 0; top: 80px; @@ -11,6 +12,10 @@ box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } +.menu section { + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); +} + .menu h4 { padding: 10px; } @@ -26,12 +31,13 @@ cursor: pointer; } -.friend-item { +.friend-item, .group-item { cursor: pointer; + transition-duration: 250ms; } .friend-item:hover, .group-item:hover { - background: #845663; + background: #FBC02D; color: white; } @@ -56,7 +62,7 @@ } #quick-links i { - color: #845663; + color: #4CAF50; font-size: 42px; padding: 7px; } \ No newline at end of file diff --git a/website/public/styles/profile.css b/website/public/styles/profile.css index 9c07242..f5dd6b1 100644 --- a/website/public/styles/profile.css +++ b/website/public/styles/profile.css @@ -14,7 +14,7 @@ padding-top: 50px; } .profile-box h5.profile-username { - padding-top: 0; + padding: 0 0 10px 0; } div.posts { @@ -28,6 +28,15 @@ div.posts div.post { margin: 20px 0 0 0; padding: 10px; width: calc(100% - 40px); + cursor: pointer; + transition-duration: 250ms; +} + +div.posts div.post:hover { + /*margin: 15px 0 0 -5px;*/ + /*padding: 15px;*/ + /*z-index: 20;*/ + box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); } div.posts div.post img { @@ -76,11 +85,12 @@ div.posts .post form textarea.newpost { float: right; padding: 10px; border-radius: 5px; - background-color: #845663; + background-color: #4CAF50; color: #FFFFFF; transition-duration: 250ms; + cursor: pointer; } .profile-button:hover { - background-color: #B78996; + box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); } \ No newline at end of file diff --git a/website/queries/friendship.php b/website/queries/friendship.php index df6a917..0deba63 100644 --- a/website/queries/friendship.php +++ b/website/queries/friendship.php @@ -22,11 +22,42 @@ function selectAllFriends($userID) { `friendship`.`user2ID` = :userID AND `friendship`.`user1ID` = `user`.`userID`) AND `role` != 5 AND - `status` = 1 + `status` = 1 "); $stmt->bindParam(':userID', $userID, PDO::PARAM_INT); $stmt->execute(); return $stmt; +} + +function selectAllFriendRequests() { + $stmt = $GLOBALS["db"]->prepare(" + SELECT + `userID`, + `username`, + IFNULL( + `profilepicture`, + '../img/notbad.jpg' + ) AS profilepicture, + `onlinestatus`, + `role` + FROM + `user` + INNER JOIN + `friendship` + + WHERE + (`friendship`.`user1ID` = :userID AND + `friendship`.`user2ID` = `user`.`userID` OR + `friendship`.`user2ID` = :userID AND + `friendship`.`user1ID` = `user`.`userID`) AND + `role` != 5 AND + `status` = 0 + "); + + $stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT); + $stmt->execute(); + + return json_encode($stmt->fetchAll()); } \ No newline at end of file diff --git a/website/views/head.php b/website/views/head.php index 4347650..044ac83 100644 --- a/website/views/head.php +++ b/website/views/head.php @@ -1,16 +1,17 @@ MyHyvesbook+ - - - + + + + MyHyvesbook+