234 Commits

Author SHA1 Message Date
Marijn Jansen
04365c4f05 Fixed chat in safari 2017-02-01 12:24:59 +01:00
Lars van Hijfte
028c2373c1 Merge branch 'hendrik-testing' into 'master'
fixsquared

See merge request !163
2017-01-31 16:23:41 +01:00
Hendrik
fb9d070d6a fixsquared 2017-01-31 16:23:13 +01:00
Lars van Hijfte
e3ad9c4590 Merge branch 'hendrik-testing' into 'master'
Hendrik testing

See merge request !162
2017-01-31 16:20:36 +01:00
Marijn Jansen
3397253010 Merge branch 'marijn-settings' into 'master'
1337 bday

See merge request !161
2017-01-31 16:20:08 +01:00
Hendrik
52a4822477 post-merge fix 2017-01-31 16:20:02 +01:00
Marijn Jansen
c0a64e9ffd 1337 bday 2017-01-31 16:19:15 +01:00
Hendrik
64a3b13adf Merge branch 'master' into hendrik-testing 2017-01-31 16:17:42 +01:00
Hendrik
b16dc1d4b7 add bancomment change 2017-01-31 16:15:48 +01:00
Lars van Hijfte
83f75e0282 Merge branch 'lars' into 'master'
Age instead of birthday

See merge request !160
2017-01-31 16:11:47 +01:00
Lars van Hijfte
b41a365b60 Age instead of birthday 2017-01-31 16:11:20 +01:00
Lars van Hijfte
6a7bb4670b Merge branch 'lars' into 'master'
Lars

See merge request !159
2017-01-31 16:03:05 +01:00
Lars van Hijfte
7236a8ba35 Merge branch 'hendrik-search' into 'master'
Hendrik search

See merge request !158
2017-01-31 16:02:29 +01:00
Lars van Hijfte
4d40bb6042 checkbox width fix 2017-01-31 15:46:53 +01:00
Lars van Hijfte
d6c2fab617 Post is now mobile friendly 2017-01-31 15:32:19 +01:00
Hendrik
93200d27c2 Merge branch 'master' into hendrik-search 2017-01-31 15:32:09 +01:00
Hendrik
78e96d5a74 add pageselector on search 2017-01-31 15:30:48 +01:00
Lars van Hijfte
646e6dde48 Added max value in text area 2017-01-31 15:16:40 +01:00
Lars van Hijfte
44408ee429 Frozen user cant comment or niet slecht on postst 2017-01-31 14:34:51 +01:00
Lars van Hijfte
9ca212570d Merge branch 'master' into lars 2017-01-31 14:27:50 +01:00
Lars van Hijfte
164eb2dde6 Frozen users cant chat with other people 2017-01-31 14:26:34 +01:00
Lars van Hijfte
2dd7dd8140 Reload comments bug fix 2017-01-31 13:56:34 +01:00
Lars van Hijfte
794b5ab294 Added fancy text to posts and comments 2017-01-31 13:54:31 +01:00
Marijn Jansen
2a37b9c64d Merge branch 'kevin-prototype' into 'master'
Fixed posts on group pages.

See merge request !156
2017-01-31 13:54:30 +01:00
Marijn Jansen
dfdf72daf4 Merge branch 'marijn-postPicture' into 'master'
Fixed and spilt Avatar upload and Alerts

See merge request !157
2017-01-31 13:38:30 +01:00
Marijn Jansen
1c9c88e030 Fixed and spilt Avatar upload and Alerts 2017-01-31 13:36:32 +01:00
Hendrik
eb12b6ba7d fixed pageselector in admin 2017-01-31 13:11:23 +01:00
K. Nobel
6b13db9c4f Fixed posting on group pages. 2017-01-31 12:53:45 +01:00
K. Nobel
c14a2770bd Fixed posting functions for groups. 2017-01-31 12:52:50 +01:00
Lars van Hijfte
e85a685b0f Merge branch 'master' into lars 2017-01-31 12:47:51 +01:00
Lars van Hijfte
f67dd019c4 Inputs are now mobile friendly 2017-01-31 12:47:24 +01:00
Lars van Hijfte
f26097f55f Fixed online status 2017-01-31 12:25:28 +01:00
K. Nobel
2e71942fdf Merge branch 'master' into kevin-prototype 2017-01-31 12:06:58 +01:00
Hendrik
582d347bcb Merge branch 'master' into hendrik-testing 2017-01-31 12:05:05 +01:00
Lars van Hijfte
03481f5888 Merge branch 'lars' into 'master'
Rip website?

See merge request !155
2017-01-31 11:51:52 +01:00
Lars van Hijfte
d5d9d5857a Rip website? 2017-01-31 11:50:05 +01:00
K. Nobel
dee483e946 Masonry will now only refresh when the width of the screen changes. 2017-01-31 10:54:15 +01:00
Lars van Hijfte
c7d47cf446 Merge branch 'lars' into 'master'
Lars

See merge request !154
2017-01-31 10:33:20 +01:00
Lars van Hijfte
4dc3b4f651 Mobile friendly 2017-01-31 10:31:57 +01:00
Marijn Jansen
3579fe0cd5 Merge branch 'marijn-settings' into 'master'
Marijn settings

See merge request !153
2017-01-31 10:24:34 +01:00
Marijn Jansen
a6b6d6d747 Style changes 2017-01-31 10:23:47 +01:00
Marijn Jansen
6983aa06a2 Finishing touches 2017-01-30 23:03:50 +01:00
Marijn Jansen
8dfa31696c autocomplete suggestions at password 2017-01-30 22:49:43 +01:00
Marijn Jansen
ce53b6e9e4 Checkbox for showBday and showEmail 2017-01-30 22:42:47 +01:00
Marijn Jansen
bc7cbb0fb7 Merge branch 'marijn-settings' of ssh://gitlab-fnwi.uva.nl:1337/11166932/WebDB into marijn-settings 2017-01-30 21:49:17 +01:00
Marijn Jansen
422e2d1308 Date picker in bday 2017-01-30 21:48:18 +01:00
K. Nobel
6e6bbf8d92 Merge branch 'master' into kevin-prototype 2017-01-30 20:19:24 +01:00
Hendrik
a0e77491a2 Merge branch 'master' into hendrik-testing 2017-01-30 16:34:40 +01:00
Hendrik
e464f5bca2 cleaned admin.js, add admin/owner check (frontend), fix submit ajax 2017-01-30 16:32:57 +01:00
K. Nobel
3140242b4f Removed old query for posts. 2017-01-30 16:24:07 +01:00
Lars van Hijfte
0b6ca72dfc Fixed chat date not showing 2017-01-30 16:00:16 +01:00
Lars van Hijfte
6831994ede Merge branch 'lars' into 'master'
Lars

See merge request !152
2017-01-30 15:41:32 +01:00
Marijn Jansen
bb56679885 Merge branch 'kevin-prototype' into 'master'
POSTS ON GROUP PAGES

See merge request !151
2017-01-30 15:41:05 +01:00
Lars van Hijfte
b0a8ceafc3 Added youtube links 2017-01-30 15:40:31 +01:00
K. Nobel
54b56da445 Merge branch 'master' into kevin-prototype 2017-01-30 15:37:57 +01:00
K. Nobel
183a98a339 Fixed link to groups on profile page. 2017-01-30 15:34:32 +01:00
K. Nobel
941296802f Added posts to group page. 2017-01-30 15:30:08 +01:00
K. Nobel
aa12e29948 Fixed posts on profile page. 2017-01-30 15:29:42 +01:00
K. Nobel
1acad8e765 modified masonry and posts, masonry is now reusable on group pages. 2017-01-30 15:28:54 +01:00
Lars van Hijfte
44ff3a4cab added time to chat messages 2017-01-30 15:08:07 +01:00
Marijn Jansen
dd017d8885 Merge branch 'marijn-404' into 'master'
Redirect to index

See merge request !150
2017-01-30 14:35:51 +01:00
Marijn Jansen
282875c6a2 Redirect to index 2017-01-30 14:35:25 +01:00
Marijn Jansen
c840b28495 Merge branch 'marijn-404' into 'master'
Resize

See merge request !149
2017-01-30 14:34:08 +01:00
Marijn Jansen
f1b5a7fe95 Resize 2017-01-30 14:33:38 +01:00
Marijn Jansen
e8c76bef5b Merge branch 'marijn-nietslecht' into 'master'
Marijn nietslecht

See merge request !147
2017-01-30 14:31:17 +01:00
Marijn Jansen
25957c6c78 Merge branch 'marijn-404' into 'master'
404 page

See merge request !148
2017-01-30 14:31:03 +01:00
Marijn Jansen
20b951cad2 404 page 2017-01-30 14:30:36 +01:00
Lars van Hijfte
792f346b12 Added admin-panel button 2017-01-30 14:16:11 +01:00
Lars van Hijfte
54ddb78453 Chat receive messages is now better 2017-01-30 13:59:02 +01:00
Marijn Jansen
9a36dea592 Removed a comma 2017-01-30 13:22:44 +01:00
Marijn Jansen
578ad34020 Picture at nietslecht-button 2017-01-30 13:21:12 +01:00
K. Nobel
f3df682af5 Merge branch 'master' into kevin-prototype 2017-01-30 13:20:53 +01:00
Lars van Hijfte
c8450f3cb3 Changed profile buttons 2017-01-30 12:44:15 +01:00
Marijn Jansen
b30ef0d0cf Merge branch 'marijn-dbConnect' into 'master'
New database connect style

See merge request !146
2017-01-30 12:10:37 +01:00
Lars van Hijfte
877637fcc9 Added video and links in the chat 2017-01-29 18:29:27 +01:00
Lars van Hijfte
89c8c35b4a Changed profile look a bit more 2017-01-29 17:24:39 +01:00
Marijn Jansen
c1a7ccc076 Found some extra statemensts 2017-01-29 14:08:45 +01:00
Marijn Jansen
b24fed57d9 Changed db connect and database query structure so PhpStorm can detect it. 2017-01-29 14:01:25 +01:00
Marijn Jansen
da30b9101c Added age calculation 2017-01-29 13:09:22 +01:00
Lars van Hijfte
dd2113b234 Merge branch 'hendrik-testing' into 'master'
Hendrik testing

See merge request !145
2017-01-27 16:16:07 +01:00
Hendrik
3f960cc091 Merge branch 'master' into hendrik-testing 2017-01-27 16:15:42 +01:00
Hendrik
b12eaced4a improve adminpanel w/ ajax, enum fixes, misc fixes 2017-01-27 16:14:54 +01:00
Lars van Hijfte
16b1f93968 Merge branch 'kevin-prototype' into 'master'
Kevin prototype

See merge request !143
2017-01-27 16:13:32 +01:00
K. Nobel
753c596056 Merge branch 'master' into kevin-prototype 2017-01-27 16:09:11 +01:00
K. Nobel
8da1469ca9 Started with group page. 2017-01-27 16:05:45 +01:00
Lars van Hijfte
f7f442ce75 Merge branch 'lars' into 'master'
Lars

See merge request !142
2017-01-27 16:05:11 +01:00
Lars van Hijfte
c8c81ae730 Merge branch 'master' into lars 2017-01-27 16:03:54 +01:00
Lars van Hijfte
a57465189a Chat post images 2017-01-27 16:03:33 +01:00
Marijn Jansen
dc51ac5964 Even more sexy turnary statements! 2017-01-27 15:41:59 +01:00
Marijn Jansen
be9fa6d2c1 Merge branch 'marijn-settings' into 'master'
Added showEmail and showBday to the settings page

See merge request !141
2017-01-27 15:41:02 +01:00
Marijn Jansen
7e2c20e244 Added showEmail and showBday to the settings page 2017-01-27 15:40:07 +01:00
Marijn Jansen
dd6b41783a Merge branch 'joey-testing' into 'master'
fixed idk

See merge request !140
2017-01-27 14:18:27 +01:00
Joey Lai
e9eeeaf110 fixed idk 2017-01-27 14:17:56 +01:00
Marijn Jansen
2651e0fb2b Merge branch 'joey-testing' into 'master'
Made different files for login and register

See merge request !138
2017-01-27 14:04:39 +01:00
Joey Lai
5e9629eddd Fixed bugs 2017-01-27 14:03:11 +01:00
Marijn Jansen
d356468554 Merge branch 'marijn-nietslecht' into 'master'
Niet slecht inverted

See merge request !139
2017-01-27 12:30:56 +01:00
Marijn Jansen
ce6a751630 Niet slecht inverted 2017-01-27 12:30:28 +01:00
Joey Lai
609f350cd3 Made different files for login and register 2017-01-27 12:27:40 +01:00
Lars van Hijfte
07c3b07eb3 Merge branch 'lars' into 'master'
Lars

See merge request !137
2017-01-27 12:23:04 +01:00
Lars van Hijfte
f27b9ec6b4 Chat messages split per day 2017-01-27 12:22:26 +01:00
Marijn Jansen
bf1df4d2d4 Merge branch 'marijn-nietslecht' into 'master'
Marijn nietslecht

See merge request !136
2017-01-27 12:22:14 +01:00
Marijn Jansen
3b542e0878 "Niet slecht."-button! 2017-01-27 12:20:50 +01:00
Marijn Jansen
82c2eaccb3 Merge branch 'master' into marijn-nietslecht 2017-01-27 11:23:42 +01:00
Lars van Hijfte
cbff973b63 Save manu state with cookie 2017-01-27 11:15:33 +01:00
Hendrik
c2d8521cdd Merge branch 'master' into hendrik-testing 2017-01-27 10:48:18 +01:00
Lars van Hijfte
23904caf69 Merge branch 'lars' into 'master'
Lars

See merge request !135
2017-01-26 22:37:19 +01:00
Lars van Hijfte
f1bfc89e6a Custom scrollbar 2017-01-26 22:33:32 +01:00
Lars van Hijfte
f32e0ca382 Merge branch 'master' into lars 2017-01-26 21:57:13 +01:00
Lars van Hijfte
d89e672990 Also fixed unread chat 2017-01-26 21:54:47 +01:00
Lars van Hijfte
032e25b044 You can now only chat with friends 2017-01-26 21:50:47 +01:00
Marijn Jansen
7073995534 Stop before Genius Bar visit 2017-01-26 17:03:11 +01:00
Lars van Hijfte
637a26ba33 Merge branch 'joey-testing' into 'master'
Modal for register

See merge request !134
2017-01-26 16:18:35 +01:00
Joey Lai
dbdb12cca0 Modal for register 2017-01-26 16:17:58 +01:00
Lars van Hijfte
70b7734e8b Merge branch 'lars' into 'master'
Added direct button on the profile to chat with someone

See merge request !133
2017-01-26 16:14:09 +01:00
Lars van Hijfte
c1fc022658 Merge branch 'joey-testing' into 'master'
Fixed date and other extras

See merge request !132
2017-01-26 16:13:43 +01:00
Lars van Hijfte
5c1208460f Added direct button on the profile to chat with someone 2017-01-26 16:12:50 +01:00
K. Nobel
59fc65e27a Made small changes to posts, added amount of comments and niet slechts 2017-01-26 16:09:18 +01:00
Hendrik
0c324b9095 Merge branch 'master' into hendrik-testing 2017-01-26 15:33:08 +01:00
Marijn Jansen
cdfbcc0168 Merge branch 'master' into marijn-nietslecht 2017-01-26 15:24:55 +01:00
Marijn Jansen
bf87d20985 Queries for niet slecht 2017-01-26 15:14:51 +01:00
Joey Lai
96f70e1a11 Fixed date and other extras 2017-01-26 14:50:41 +01:00
K. Nobel
e75df42bd8 Merge branch 'master' into kevin-prototype 2017-01-26 14:32:00 +01:00
K. Nobel
b66c108f4e Fixed post titles for htmlchars. 2017-01-26 14:31:45 +01:00
Lars van Hijfte
f4b2fee290 Merge branch 'lars' into 'master'
Lars

See merge request !131
2017-01-26 14:14:40 +01:00
Lars van Hijfte
a60a9b6594 Merge branch 'master' into lars 2017-01-26 14:12:27 +01:00
Lars van Hijfte
feb64002f5 Live search 2017-01-26 14:12:04 +01:00
Lars van Hijfte
33a640329b Filter on search page
It also works with jquery now
2017-01-26 13:53:59 +01:00
Lars van Hijfte
59b0b00304 Merge branch 'hendrik-post' into 'master'
Hendrik post

See merge request !130
2017-01-26 13:47:40 +01:00
Hendrik
51cc736aca Merge branch 'master' into hendrik-post 2017-01-26 13:46:24 +01:00
Hendrik
1a53d01747 add authentication 2017-01-26 13:29:56 +01:00
Lars van Hijfte
e24960c319 Merge branch 'kevin-prototype' into 'master'
Kevin prototype

See merge request !129
2017-01-26 13:29:42 +01:00
K. Nobel
cf964ec8d6 Merge branch 'master' into kevin-prototype 2017-01-26 13:24:16 +01:00
Hendrik
b89a575039 Merge branch 'master' into hendrik-testing 2017-01-26 13:02:35 +01:00
Hendrik
91aca6baa7 change comments to use ajax 2017-01-26 12:21:01 +01:00
K. Nobel
3ebacd6251 Fixed masonry grid (posts). 2017-01-26 12:20:32 +01:00
Marijn Jansen
423c2fd771 Revert "Merge branch 'marijn-settings' into 'master'"
This reverts merge request !128
2017-01-26 12:16:28 +01:00
Marijn Jansen
58e5f200fa Merge branch 'marijn-settings' into 'master'
Removed .idea folder

See merge request !128
2017-01-26 12:14:52 +01:00
Marijn Jansen
47eed5514a Removed .idea folder 2017-01-26 12:14:07 +01:00
Marijn Jansen
78e85c2939 Merge branch 'marijn-messagePage' into 'master'
Email confirm and password change now use messagepage function.

See merge request !127
2017-01-26 12:06:38 +01:00
Marijn Jansen
44f86a4fbb Email confirm and password change now use messagepage function. 2017-01-26 12:05:28 +01:00
Lars van Hijfte
7b7f0b2c64 Added menu button 2017-01-26 11:48:06 +01:00
Hendrik
328f0665f3 add basic post functionality 2017-01-26 11:35:18 +01:00
Lars van Hijfte
8fb8df075f Added comments 2017-01-26 11:31:15 +01:00
Lars van Hijfte
6a882bf78d Merge branch 'lars' into 'master'
Chat messages and groups are now live.

See merge request !126
2017-01-26 10:27:45 +01:00
Lars van Hijfte
95ee91748f Chat messages and groups are now live. 2017-01-26 10:26:40 +01:00
Lars van Hijfte
30d403ae7b Merge branch 'lars' into 'master'
Lars

See merge request !125
2017-01-25 16:21:56 +01:00
Marijn Jansen
2242feda21 Merge branch 'marijn-settings' into 'master'
Password change

See merge request !124
2017-01-25 16:21:44 +01:00
Lars van Hijfte
2ece9e1c63 Merge branch 'master' into lars 2017-01-25 16:21:34 +01:00
Marijn Jansen
4ebdd378a6 Password change 2017-01-25 16:21:17 +01:00
Lars van Hijfte
09dac78eb4 Merge branch 'joey-testing' into 'master'
Joey testing

See merge request !123
2017-01-25 16:21:02 +01:00
Lars van Hijfte
e1ca3c52ed Merge branch 'hendrik-post' into 'master'
Hendrik post

See merge request !122
2017-01-25 16:20:48 +01:00
Lars van Hijfte
f7bf80d789 Merge branch 'kevin-prototype' into 'master'
Kevin prototype

See merge request !120
2017-01-25 16:20:30 +01:00
Joey Lai
4c5ea08614 Fixed reset password 2017-01-25 16:19:34 +01:00
Lars van Hijfte
9046b397a1 Merge branch 'master' into lars 2017-01-25 16:19:07 +01:00
Lars van Hijfte
91fae80326 Friends and friendrequest are fully ajax. Also added friend-item 2017-01-25 16:17:46 +01:00
Hendrik
f06de1e88d Merge branch 'master' into hendrik-post 2017-01-25 15:59:40 +01:00
Hendrik
b161596d67 polished post viewing 2017-01-25 15:59:03 +01:00
Joey Lai
ded314f4d6 Merged marijn 2017-01-25 15:53:44 +01:00
Joey Lai
0b035c0583 Merge branch 'marijn-settings' into joey-testing 2017-01-25 15:48:37 +01:00
Joey Lai
cc08ebec3c Modal added for resetting password 2017-01-25 15:47:31 +01:00
Marijn Jansen
1b2a1a5180 Almost request password 2017-01-25 15:46:20 +01:00
K. Nobel
977757b2d3 Made small improvements to friendship buttons and corresponding API files. 2017-01-25 15:42:28 +01:00
K. Nobel
6a43402c66 Added comment in getFriendshipStatus for Lars. 2017-01-25 15:14:00 +01:00
K. Nobel
95570c49d4 Merge branch 'master' into kevin-prototype 2017-01-25 15:08:34 +01:00
K. Nobel
9ff256429d Changed friendship buttons. We now use AJAX, changed button style and added FA icons. 2017-01-25 15:06:37 +01:00
Marijn Jansen
c23b8bd8e5 Merge branch 'joey-testing' into 'master'
Joey testing

See merge request !119
2017-01-25 13:44:11 +01:00
Joey Lai
e840def733 FIxed confirmation login 2017-01-25 13:43:08 +01:00
Hendrik
db333b6e98 add unpolished post viewing 2017-01-25 13:28:47 +01:00
Joey Lai
30d1ef40f4 fixed js for login 2017-01-25 12:55:29 +01:00
Marijn Jansen
13c575179d Merge branch 'joey-testing' into 'master'
Added confirmation login email

See merge request !118
2017-01-25 12:49:45 +01:00
Joey Lai
aa48092d27 Added confirmation login email 2017-01-25 12:48:30 +01:00
Marijn Jansen
7f755bfd2c Merge branch 'marijn-settings' into 'master'
Cleanup at logout.php

See merge request !117
2017-01-25 12:30:20 +01:00
Marijn Jansen
727d418c8d Merge branch 'marijn-settings' into 'master'
Email confirm on settings page and emailconfirm fix (:

See merge request !116
2017-01-25 12:06:50 +01:00
Marijn Jansen
185874d23f Cleanup at logout.php 2017-01-25 12:06:13 +01:00
Marijn Jansen
827be40646 Email confirm on settings page and emailconfirm fix (: 2017-01-25 12:02:31 +01:00
Marijn Jansen
93ddefa42f Merge branch 'joey-testing' into 'master'
redesigned code

See merge request !115
2017-01-25 11:20:15 +01:00
Marijn Jansen
d19639d1c3 Merge branch 'marijn-settings' into 'master'
Spelling mistake

See merge request !114
2017-01-25 11:20:01 +01:00
Marijn Jansen
d2c7f0787b Spelling mistake 2017-01-25 11:19:41 +01:00
K. Nobel
1402a3ea07 Fixed query for image tags 2017-01-25 11:19:24 +01:00
Joey Lai
981e34c950 redesigned code 2017-01-25 11:19:01 +01:00
Marijn Jansen
022620a375 Merge branch 'marijn-emailconfirm' into 'master'
Email confirm (:

See merge request !113
2017-01-25 11:17:31 +01:00
Marijn Jansen
28f31d749b Email confirm (: 2017-01-25 11:16:53 +01:00
Marijn Jansen
17600adbf1 Merge branch 'marijn-emailconfirm' into 'master'
Added emailconfirm.php

See merge request !112
2017-01-25 09:33:36 +01:00
Marijn Jansen
f7da87596a Added emailconfirm.php 2017-01-25 09:30:05 +01:00
Lars van Hijfte
7efd062f98 Merge branch 'lars' into 'master'
Lars

See merge request !111
2017-01-24 17:32:43 +01:00
Lars van Hijfte
fddbd0ca87 Merge branch 'master' into lars 2017-01-24 17:32:13 +01:00
Lars van Hijfte
37d83169c6 In notification bar accept or deny 2017-01-24 17:31:39 +01:00
Lars van Hijfte
d19038cb1c Merge branch 'lars' into 'master'
Lars

See merge request !110
2017-01-24 17:11:09 +01:00
Lars van Hijfte
12ed710369 Fixed API 2017-01-24 17:10:12 +01:00
Lars van Hijfte
3de4e1387f Merge branch 'master' into lars 2017-01-24 17:07:07 +01:00
Lars van Hijfte
7bf8a16cf0 Dingen door elkaar 2017-01-24 17:06:39 +01:00
Lars van Hijfte
cbfce6f698 Merge branch 'kevin-prototype' into 'master'
Kevin prototype

See merge request !109
2017-01-24 17:05:51 +01:00
K. Nobel
7144d700e4 Removed debug echo from profile page. 2017-01-24 17:02:49 +01:00
K. Nobel
ec56dbe578 Merge branch 'master' into kevin-prototype 2017-01-24 17:00:10 +01:00
K. Nobel
b8f662f825 Merge branch 'master' of ssh://gitlab-fnwi.uva.nl:1337/11166932/WebDB 2017-01-24 16:59:14 +01:00
K. Nobel
de03d8799a Fixed placeholder for new post. 2017-01-24 16:58:51 +01:00
Hendrik
b9fc016f7d add post viewing basis, add insert post and comment queries 2017-01-24 16:56:04 +01:00
K. Nobel
70957015ce Fixed links to friends on profile page. 2017-01-24 16:51:34 +01:00
K. Nobel
f9f1e2bf17 Changed select posts query. 2017-01-24 16:40:30 +01:00
Lars van Hijfte
4b6fe1d202 Merge branch 'lars' into 'master'
Fixed bugs

See merge request !108
2017-01-24 15:17:19 +01:00
Lars van Hijfte
fd055e8355 Fixed bugs 2017-01-24 15:16:15 +01:00
Lars van Hijfte
0b705df09a Merge branch 'joey-testing' into 'master'
Redesigned register functions

See merge request !107
2017-01-24 15:12:01 +01:00
Lars van Hijfte
c48227e258 Merge branch 'kevin-prototype' into 'master'
Kevin prototype

See merge request !106
2017-01-24 15:11:29 +01:00
Joey Lai
7a19fea5f9 Redesigned register functions 2017-01-24 15:08:24 +01:00
K. Nobel
887c773463 Merge branch 'master' into kevin-prototype 2017-01-24 15:03:24 +01:00
K. Nobel
4967ab6ea0 Made some small changes for Lars. 2017-01-24 15:01:55 +01:00
Marijn Jansen
6314494177 Merge branch 'marijn-settings' into 'master'
Max file size for gifs.

See merge request !105
2017-01-24 14:49:02 +01:00
Marijn Jansen
86b97cc186 Max file size for gifs. 2017-01-24 14:47:38 +01:00
K. Nobel
4b3d7967fb Merge branch 'master' into kevin-prototype 2017-01-24 14:47:05 +01:00
K. Nobel
d44ddf2793 Added functionality for add friend buttons. 2017-01-24 14:36:27 +01:00
Lars van Hijfte
9e89307bf9 Merge branch 'lars-chat' into 'master'
Fixed name length

See merge request !104
2017-01-24 14:33:11 +01:00
Lars van Hijfte
dc11830c80 Fixed name length 2017-01-24 14:32:43 +01:00
Lars van Hijfte
8403ff0a17 Merge branch 'lars-chat' into 'master'
Lars chat

See merge request !103
2017-01-24 14:30:09 +01:00
Lars van Hijfte
dbb23922d8 Merge branch 'master' into lars-chat 2017-01-24 14:26:48 +01:00
Lars van Hijfte
a88483ae47 FINALLY FIXED THE UNREAD CHAT MESSAGES! 2017-01-24 14:26:15 +01:00
Marijn Jansen
ee6b55bd91 Merge branch 'marijn-settings' into 'master'
Marijn settings

See merge request !102
2017-01-24 14:02:34 +01:00
Marijn Jansen
08c3d73377 Merge branch 'master' into 'marijn-settings'
# Conflicts:
#   website/views/menu.php
2017-01-24 14:02:19 +01:00
Marijn Jansen
c1359920e0 New Standard avatar 2017-01-24 14:00:55 +01:00
Marijn Jansen
4579b98eb8 Checks and resize on profile pictures :) 2017-01-24 13:54:08 +01:00
Marijn Jansen
62a2b32c95 Changed Alerts to Exceptions. 2017-01-24 12:12:48 +01:00
Hendrik
f6051ee14f Merge branch 'master' into hendrik-search 2017-01-24 11:05:58 +01:00
Lars van Hijfte
96003b1bdc Merge branch 'hendrik-search' into 'master'
Hendrik search

See merge request !100
2017-01-24 10:21:17 +01:00
Lars van Hijfte
c4a0367fef Merge branch 'lars-chat' into 'master'
Lars chat

See merge request !101
2017-01-24 10:19:52 +01:00
Lars van Hijfte
c4e4508b53 Changed admin layout and fixed for enums 2017-01-24 10:19:13 +01:00
Lars van Hijfte
d7e84ee138 Merge branch 'lars-algemeen' into lars-chat 2017-01-23 17:22:38 +01:00
Lars van Hijfte
7eec0cfa2a Begin chat change 2017-01-23 17:22:22 +01:00
Lars van Hijfte
348b66c08c Merge branch 'master' into lars-chat 2017-01-23 17:08:43 +01:00
Lars van Hijfte
37aa073fc1 End of day commit 2017-01-23 16:45:16 +01:00
Hendrik
119c82e110 minor color and text fixes 2017-01-23 16:27:54 +01:00
Lars van Hijfte
b6d166bdea Merge branch 'lars-algemeen' into 'master'
Lars algemeen

See merge request !98
2017-01-23 16:27:45 +01:00
Hendrik
648c2d26e4 Merge branch 'master' into hendrik-testing 2017-01-23 16:06:19 +01:00
Hendrik
2ff23ae668 Merge branch 'master' into hendrik-search 2017-01-23 16:06:03 +01:00
Hendrik
ac83bb750b fix status for enums, fix pages 2017-01-23 16:05:22 +01:00
Hendrik
e6f5044a9a add page functionality 2017-01-23 16:04:59 +01:00
105 changed files with 4923 additions and 1533 deletions

View File

@@ -1,7 +1,7 @@
Options +FollowSymLinks
RewriteEngine On
ErrorDocument 404 /error404.jpg
ErrorDocument 404 /error/404.php
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

View File

@@ -0,0 +1,25 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/user.php");
require_once ("../../queries/group_page.php");
$userinfo = getRoleByID($_SESSION['userID']);
if (isset($_POST["actions"]) && isset($_POST["userID"])) {
changeUserStatusByID($_POST["userID"], $_POST["actions"]);
} else if (isset($_POST["actions"]) && isset($_POST["groupID"])) {
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
} else if (isset($_POST["batchactions"]) && isset($_POST["checkbox-user"])) {
if ($userinfo == 'owner') {
changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
} else {
changeMultipleUserStatusByIDAdmin($_POST["checkbox-user"], $_POST["batchactions"]);
}
} else if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) {
changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]);
} else if (isset($_POST['bancommentuserID']) && isset($_POST['bancommenttext'])) {
editBanCommentByID($_POST['bancommentuserID'], $_POST['bancommenttext']);
}

View File

@@ -0,0 +1,38 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/user.php");
require_once ("../../queries/group_page.php");
$search = "";
if (isset($_POST["search"])) {
$search = test_input($_POST["search"]);
}
$pagetype = "user";
if (isset($_POST['pagetype'])) {
$pagetype = test_input($_POST['pagetype']);
}
$status = array();
if (isset($_POST['status'])) {
$status = $_POST["status"];
}
$groupstatus = array();
if (isset($_POST['groupstatus'])) {
$groupstatus = $_POST["groupstatus"];
}
$entries = 20;
$currentpage = 1;
if (isset($_POST['currentpage'])) {
$currentpage = (int) test_input($_POST["currentpage"]);
}
$offset = (int) $currentpage * $entries - $entries;
include ("../../views/adminpanel-page.php");

View File

@@ -0,0 +1,44 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/user.php");
require_once ("../../queries/group_page.php");
$offset = 0;
$entries = 20;
if (isset($_POST["currentpage"])) {
$offset = (int) test_input($_POST["currentpage"]) * $entries - $entries;
}
$search = "";
if (isset($_POST["search"])) {
$search = test_input($_POST["search"]);
}
$pagetype = "user";
if (isset($_POST['pagetype'])) {
$pagetype = test_input($_POST['pagetype']);
}
$status = array();
if (isset($_POST['status'])) {
$status = $_POST["status"];
}
$groupstatus = array();
if (isset($_POST['groupstatus'])) {
$groupstatus = $_POST["groupstatus"];
}
$userinfo = getRoleByID($_SESSION['userID']);
if ($pagetype == "user") {
include ("../../views/adminpanel-table.php");
} else if ($pagetype == "group") {
include ("../../views/adminpanel-grouptable.php");
} else {
echo "Search failed!";
}

View File

@@ -0,0 +1,27 @@
<?php
session_start();
require_once ("../../queries/friendship.php");
if(empty($_POST["usr"]) OR empty($_POST["action"]) OR !in_array($_POST["action"], array("request", "accept", "delete"))) {
header('HTTP/1.1 500 Non enough arguments');
}
$friendship_status = getFriendshipStatus($_POST["usr"]);
if($_POST["action"] == "request" AND $friendship_status == 0) {
if (!requestFriendship($_POST["usr"])) {
header('HTTP/1.1 500 Query (request) failed');
}
} else if($_POST["action"] == "delete" AND in_array($friendship_status, array(1, 2, 3))) {
if (!removeFriendship($_POST["usr"])) {
header('HTTP/1.1 500 Query (delete) failed');
}
} else if ($_POST["action"] == "accept" AND $friendship_status == 3) {
if (!acceptFriendship($_POST["usr"])) {
header('HTTP/1.1 500 Query (accept) failed');
}
} else {
header('HTTP/1.1 500 Not the right friendship status');
}

View File

@@ -0,0 +1,24 @@
<?php
# -2: Query failed.
# -1: user1 and 2 are the same user
# 0 : no record found
# 1 : confirmed
# 2 : user1 sent request (you)
# 3 : user2 sent request (other)
session_start();
require_once ("../../queries/friendship.php");
if(empty($_POST["usr"])) {
header('HTTP/1.1 500 Non enough arguments');
}
$friendship_status = getFriendshipStatus($_POST["usr"]);
if($friendship_status == -2) {
header('HTTP/1.1 500 Query failed');
}
echo $friendship_status;

View File

@@ -0,0 +1,26 @@
<?php
if(empty($_POST["usr"]) and empty($_POST["grp"])) {
header('HTTP/1.1 500 Non enough arguments');
}
require_once ("../../queries/post.php");
require_once ("../../queries/nicetime.php");
if(empty($_POST["usr"])) {
$posts = selectAllPosts(0, $_POST["grp"]);
} else {
$posts = selectAllPosts($_POST["usr"], 0);
}
if(!$posts) {
header('HTTP/1.1 500 Query failed');
}
$results = $posts->fetchAll(PDO::FETCH_ASSOC);
for($i = 0; $i < sizeof($results); $i++) {
$results[$i]["nicetime"] = nicetime($results[$i]["creationdate"]);
}
echo json_encode($results);

View File

@@ -3,6 +3,6 @@
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/friendship.php");
require_once ("../../queries/private_message.php");
echo selectAllUnreadChat();

View File

@@ -0,0 +1,15 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/friendship.php");
require_once ("../../queries/user.php");
if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
echo selectAllFriendRequests();
} else {
echo "[]";
}

View File

@@ -1,8 +0,0 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/friendship.php");
echo selectAllFriendRequests();

View File

@@ -0,0 +1,20 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/friendship.php");
if (isset($_SESSION["userID"])) {
if (isset($_POST["limit"])) {
echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_POST["limit"]));
} else if (isset($_GET["limit"])) {
echo selectLimitedFriends($_SESSION["userID"], (int)test_input($_GET["limit"]));
} else {
echo selectFriends($_SESSION["userID"]);
}
} else {
echo "[]";
}

View File

@@ -0,0 +1,14 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/group_member.php");
if (isset($_POST["limit"])) {
echo selectLimitedGroupsFromUser($_SESSION["userID"], (int) test_input($_POST["limit"]));
} else {
echo selectAllGroupsFromUser($_SESSION["userID"]);
}

View File

@@ -5,9 +5,12 @@ session_start();
require_once("../../queries/connect.php");
require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php");
require_once("../../queries/friendship.php");
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
setLastVisited(test_input($_POST["destination"]));
echo getNewChatMessages(test_input($_POST["lastID"]), test_input($_POST["destination"]));
} else {
setLastVisited(test_input($_POST["destination"]));
echo getOldChatMessages(test_input($_POST["destination"]));
}

View File

@@ -0,0 +1,12 @@
<?php
require_once("../../queries/connect.php");
require_once("../../queries/post.php");
require_once("../../queries/checkInput.php");
require_once("../../queries/nicetime.php");
if(isset($_GET['postID'])) {
include("../../views/post-view.php");
} else {
echo "Failed to load";
}

View File

@@ -0,0 +1,41 @@
<?php
session_start();
require_once ("../queries/connect.php");
require_once ("../queries/checkInput.php");
function getNietSlechtCountForPost(int $postID) : int {
$stmt = prepareQuery("
SELECT
`userID`
FROM
`niet_slecht`
WHERE
`postID` = :postID
");
$stmt->bindParam(":postID", $postID);
$stmt->execute();
return $stmt->rowCount();
}
function getNietSlechtUsersForPost(int $postID) {
$stmt = prepareQuery("
SELECT
`fname`,
`lname`,
CONCAT(`user`.`fname`, ' ', `user`.`lname`) as `fullname`
FROM
`user`
INNER JOIN
`niet_slecht`
WHERE
`user`.`userID` = `niet_slecht`.`userID` AND
`niet_slecht`.`postID` = :postID
");
$stmt->bindParam(":postID", $postID);
$stmt->execute();
$rows = $stmt->fetchAll();
foreach ($rows as $row) {
print($row["fullname"]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
session_start();
require_once("../../queries/post.php");
require_once("../../queries/connect.php");
require_once("../../queries/checkInput.php");
require_once("../../queries/user.php");
if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if ($_POST['button'] == 'reaction') {
if (empty($_POST['newcomment-content'])) {
echo 0;
} else {
if (makeComment($_POST['postID'],
$_SESSION['userID'],
test_input($_POST['newcomment-content']))) {
echo 1;
} else {
echo 0;
}
}
} else if ($_POST['button'] == 'nietslecht') {
if (makeNietSlecht($_POST["postID"], $_SESSION["userID"])) {
echo 1;
} else {
echo 0;
}
} else {
echo 0;
}
} else {
echo "frozen";
}

View File

@@ -0,0 +1,54 @@
<?php
session_start();
require_once("../../queries/post.php");
require_once("../../queries/group_page.php");
require_once("../../queries/connect.php");
require_once("../../queries/checkInput.php");
if (empty($_POST["title"]) or
empty($_POST["content"]) or
empty($_SESSION["userID"])) {
header('HTTP/1.1 500 Non enough arguments');
}
if (empty($_POST["group"])) {
// User Post
makePost(
$_SESSION["userID"],
null,
test_input($_POST["title"]),
test_input($_POST["content"])
);
} else {
// Group Post
// Check if the user is an admin or mod of the group.
if(!in_array(selectGroupRole($_POST["group"]), array('mod', 'admin'))) {
header('HTTP/1.1 500 Non enough rights');
return;
}
makePost(
$_SESSION["userID"],
$_POST["group"],
test_input($_POST["title"]),
test_input($_POST["content"])
);
}
//if (empty($_POST['newpost-title'])) {
//} else {
// makePost($_SESSION['userID'],
// null,
// test_input($_POST['newpost-title']),
// test_input($_POST['newpost-content']));
//}
//
//header("Location: ../profile.php");

View File

@@ -0,0 +1,28 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/group_member.php");
require_once ("../../queries/group_page.php");
$n = 0;
if (isset($_POST["n"])) {
$n = (int) test_input($_POST["n"]);
}
$m = 20;
if (isset($_POST["m"])) {
$m = (int) test_input($_POST["m"]);
}
$search = "";
if (isset($_POST["search"])) {
$search = test_input($_POST["search"]);
}
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
echo searchSomeOwnGroups($n, $m, $search);
} else {
echo searchSomeGroups($n, $m, $search);
}

View File

@@ -0,0 +1,41 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/user.php");
require_once ("../../queries/group_page.php");
$user_perpage = $group_perpage = 20;
$user_currentpage = $group_currentpage = 1;
if (isset($_POST['user-pageselect'])) {
$user_currentpage = test_input($_POST['user-pageselect']);
}
if (isset($_POST['group-pageselect'])) {
$group_currentpage = test_input($_POST['group-pageselect']);
}
$user_n = $user_currentpage * $user_perpage - $user_perpage;
$group_n = $group_currentpage * $group_perpage - $group_perpage;
$search = "";
if (isset($_POST['search'])) {
$search = test_input($_POST['search']);
}
$user_count = countSomeUsers($search)->fetchColumn();
$group_count = countSomeGroups($search)->fetchColumn();
$filter = "all";
if (isset($_POST['filter'])) {
$filter = test_input($_POST['filter']);
}
$option = "user";
if (isset($_POST['option'])) {
$option = test_input($_POST['option']);
}
include ("../../views/searchPageNumber.php");

View File

@@ -0,0 +1,29 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/checkInput.php");
require_once ("../../queries/friendship.php");
require_once ("../../queries/user.php");
$n = 0;
$m = 20;
$page = 1;
if (isset($_POST["user-pageselect"])) {
$page = (int) test_input($_POST['user-pageselect']);
}
$n = ($page - 1) * $m;
$search = "";
if (isset($_POST["search"])) {
$search = test_input($_POST["search"]);
}
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
echo searchSomeFriends($n, $m, $search);
} else {
echo searchSomeUsers($n, $m, $search);
}

View File

@@ -4,14 +4,22 @@ session_start();
require_once("../../queries/connect.php");
require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php");
require_once("../../queries/user.php");
if (!empty(test_input($_POST["destination"])) &&
!empty(test_input($_POST["content"]))) {
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
echo 1;
if (isset($_SESSION["userID"]) &&
getRoleByID($_SESSION["userID"]) != 'frozen' &&
getRoleByID($_SESSION["userID"]) != 'banned') {
if (!empty(test_input($_POST["destination"])) &&
!empty(test_input($_POST["content"]))
) {
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
echo 1;
} else {
echo 0;
}
} else {
echo 0;
}
} else {
echo 0;
echo "frozen";
}

View File

@@ -1,10 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<?php include("../views/head.php"); ?>
<?php
require_once ("../queries/user.php");
require_once ("../queries/group_page.php");
require_once ("../views/head.php"); ?>
<style>
@import url("styles/adminpanel.css");
</style>
<script src="js/admin.js" charset="utf-8"></script>
</head>
<body>
<?php
@@ -12,6 +16,15 @@
* This view adds the main layout over the screen.
* Header and menu.
*/
include_once ("../queries/user.php");
// auth
$role = getRoleByID($_SESSION['userID']);
if ($role != 'admin' AND $role != 'owner') {
header("location:profile.php");
}
include("../views/main.php");
/* Add your view files here. */

View File

@@ -0,0 +1,90 @@
<?php
session_start();
include_once ("../../queries/friendship.php");
if (isset($_POST["action"])) {
$action = $_POST["action"];
} else {
$action = "profile.php";
}
if (isset($_POST["actionType"])) {
$actionType = $_POST["actionType"];
} else {
$actionType = "GET";
}
$friends = json_decode($_POST["friends"]);
foreach($friends as $i => $friend) {
$friendshipStatus = getFriendshipStatus($friend->userID);
?>
<li class='friend-item'>
<form action='<?= $action ?>' method='<?= $actionType ?>'>
<button type='submit'
name='username'
value='<?php
if (isset($friend->username)) {
echo $friend->username;
} else if (isset($friend->content)) {
echo $friend->userID;
}
?>'>
<div class='friend'>
<img alt='PF' class='profile-picture <?= $friend->onlinestatus ?>' src='<?= $friend->profilepicture ?>'/>
<div class='friend-name'>
<?= $friend->fullname ?><br/>
<span style='color: #666'><?php
if (isset($friend->username)) {
echo $friend->username;
} else if (isset($friend->content)) {
echo $friend->content;
}
?></span>
</div>
</div>
</button>
</form>
<?php
if ($friendshipStatus > 1) {
if ($friendshipStatus == 2) {
$denyName = "Annuleer";
} else {
$denyName = "Weiger";
}
?>
<div class='notification-options'>
<?php
if ($friendshipStatus == 3) {
?>
<button name='accept'
onclick="editFriendship('<?= $friend->userID ?>', 'accept')"
class='accept-notification'
value='1'>
<i class='fa fa-check'></i>Accepteer
</button>
<?php
}
?>
<input type='hidden' name='userID' value='' />
<button name='delete'
onclick="editFriendship('<?= $friend->userID ?>', 'delete')"
class='deny-notification'
value='1'>
<i class='fa fa-times'></i> <?= $denyName ?>
</button>
</div>
<?php
}
?>
</li>
<?php
}
?>

View File

@@ -0,0 +1,24 @@
<?php
session_start();
include_once ("../../queries/group_member.php");
$groups = json_decode($_POST["groups"]);
foreach($groups as $i => $group) {
?>
<li class='group-item'>
<form action='group.php' method='get'>
<button type='submit'
name='groupname'
value='<?= $group->name ?>'>
<div class='group'>
<img alt='PF' class='group-picture' src='<?= $group->picture ?>'/>
<?= $group->name ?>
</div>
</button>
</form>
</li>
<?php
}

View File

@@ -0,0 +1,49 @@
<?php
include_once("../queries/connect.php");
include_once("../views/messagepage.php");
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
$checkHash = prepareQuery("
SELECT
`email`,
`role`
FROM
`user`
WHERE
`userID` = :userID
");
$checkHash->bindParam(":userID", $_GET["u"]);
$checkHash->execute();
$result = $checkHash->fetch();
$email = $result["email"];
$role = $result["role"];
if ($role == "unconfirmed") {
doActivate($email);
} else {
messagePage("Ongeldige link.");
}
} else {
messagePage("Ongeldige link.");
}
function doActivate(string $email) {
if (password_verify($email, $_GET["h"])) {
$confirmUser = prepareQuery("
UPDATE
`user`
SET
`role` = :role
WHERE
`userID` = :userID
");
$confirmUser->bindValue(":role", "user");
$confirmUser->bindParam(":userID", $_GET["u"]);
$confirmUser->execute();
if ($confirmUser->rowCount()) {
messagePage("Email bevestigd <br />
<a href='index.php'>Klik hier om terug te gaan naar de login pagina.</a>");
}
} else {
messagePage("Ongeldige link.");
}
}

View File

@@ -0,0 +1,9 @@
<?php
require_once "../../views/messagepage.php";
messagePage("
<div class='error-page'>
<h1>404</h1>
<h4>Verkeerde link...</h4><br />
<img height='25%' width='25%' src='../img/zelda.png'>
</div>");

View File

@@ -4,10 +4,23 @@
<?php include("../views/head.php"); ?>
<style>
@import url("styles/profile.css");
@import url("styles/post-popup.css");
@import url('https://fonts.googleapis.com/css?family=Anton');
</style>
</head>
<body>
<?php
include_once("../queries/group_page.php");
$group = selectGroupByName($_GET["groupname"]);
$members = selectGroupMembers(2);
?>
<script>alert("<?= $members[0] ?>");</script>
<script>alert("<?= $members[1] ?>");</script>
<?php
/*
* This view adds the main layout over the screen.
* Header, menu, footer.
@@ -19,6 +32,23 @@ include("../views/group.php");
/* This adds the footer. */
include("../views/footer.php");
$masonry_mode = 0;
if ($group["role"] == "mod" OR $group["role"] == "admin") {
$masonry_mode = 2;
}
?>
<script src="js/masonry.js"></script>
<script src="js/post.js"></script>
<script>
$(document).ready(function() {
userID = 0;
groupID = <?= $group["groupID"] ?>;
masonry(<?= $masonry_mode ?>);
});
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

View File

@@ -1,5 +1,9 @@
<html>
<head>
<meta http-equiv="refresh" content="0; url=login.php" />
</head>
</html>
<?php
session_start();
if (isset($_SESSION["userID"])) {
header("Location: profile.php");
} else {
header("Location: login.php");
}

View File

@@ -1,44 +1,110 @@
window.onload = function() {
$(window).on("load", function () {
changeFilter();
};
searchFromOne();
function checkAll(allbox) {
var checkboxes = document.getElementsByClassName('checkbox-list');
$(".admin-searchinput").keyup(function(){
searchFromOne();
});
// all inputs and labels directly under admin filter and groupfilter
$("#admin-filter, #admin-groupfilter > input, label").change(function(){
searchFromOne();
});
$("#pagetype").change(function(){
searchFromOne();
});
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox') {
checkboxes[i].checked = allbox.checked;
}
}
/* Update hidden input to be equal to submit pressed,
because serialize doesn't take submit values. */
$('#admin-batchform > button').click(function () {
$('#batchinput').prop('value', $(this).prop('value'));
console.log($('#batchinput').prop('value'));
});
$('#admin-groupbatchform > button').click(function () {
$('#groupbatchinput').prop('value', $(this).prop('value'));
console.log($('#batchinput').prop('value'));
});
});
function checkAll() {
$('.checkbox-list').each(function () {
$(this).prop('checked', $('#checkall').prop('checked'));
});
}
function checkCheckAll(allbox) {
var checkboxes = document.getElementsByClassName('checkbox-list');
function checkCheckAll() {
var checked = true;
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox') {
if (checkboxes[i].checked == false) {
checked = false;
break;
}
$('.checkbox-list').each(function () {
if ($(this).prop('checked') == false) {
checked = false;
return;
}
}
allbox.checked = checked;
});
$('#checkall').prop('checked', checked);
}
function changeFilter() {
if (document.getElementById('group').checked) {
if ($('#pagetype').find(":selected").val() == "group") {
document.getElementById('admin-filter').style.display = 'none';
document.getElementById('admin-groupfilter').style.display = 'inline-block';
document.getElementById('admin-batchactions').style.display = 'none';
document.getElementById('admin-groupbatchactions').style.display = 'inline-block';
document.getElementById('admin-batchform').style.display = 'none';
document.getElementById('admin-groupbatchform').style.display = 'inline-block';
} else {
document.getElementById('admin-filter').style.display = 'inline-block';
document.getElementById('admin-groupfilter').style.display = 'none';
document.getElementById('admin-batchactions').style.display = 'inline-block';
document.getElementById('admin-groupbatchactions').style.display = 'none';
document.getElementById('admin-batchform').style.display = 'inline-block';
document.getElementById('admin-groupbatchform').style.display = 'none';
}
}
function searchFromOne() {
$('#currentpage').prop('value', 1);
adminSearch();
}
function adminSearch() {
console.log($("#admin-searchform").serialize());
$.post(
"API/adminSearchUsers.php",
$("#admin-searchform").serialize()
).done(function (data) {
$("#usertable").html(data);
updatePageN();
})
}
function adminUpdate(form) {
$.post(
"API/adminChangeUser.php",
$(form).serialize()
).done(function () {
adminSearch();
})
}
function updatePageN() {
$.post(
"API/adminPageNumber.php",
$("#admin-searchform").serialize()
).done(function (data) {
$("#admin-pageinfo").html(data);
})
}
function toggleBancomment(button) {
$(button).siblings("div").toggle();
$(button).toggle();
}
function editComment(form) {
$.post(
"API/adminChangeUser.php",
$(form).serialize()
).done(function (data) {
adminSearch();
});
}

View File

@@ -1,23 +1,31 @@
var previousDate = new Date("1970-01-01 00:00:00");
var previousTime = "00:00";
var gettingMessages = false;
var previousType = "robot";
$(document).ready(function() {
loadMessages();
setInterval(loadMessages, 1000);
sayEmpty();
$(".chat-field").hide();
});
function loadMessages() {
$.post(
"API/loadMessages.php",
$("#lastIDForm").serialize()
).done(function(data) {
if (data && data != "[]") {
messages = JSON.parse(data);
addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID);
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight);
}
});
setTimeout(loadMessages, 1000);
if (!gettingMessages) {
gettingMessages = true;
$.post(
"API/loadMessages.php",
$("#lastIDForm").serialize()
).done(function (data) {
if (data && data != "[]") {
messages = JSON.parse(data);
addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID);
}
gettingMessages = false;
});
} else {
setTimeout(loadMessages, 500);
}
}
@@ -25,38 +33,82 @@ function sendMessage() {
$.post(
"API/sendMessage.php",
$("#sendMessageForm").serialize()
);
).done(function(response) {
if (response == "frozen") {
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
}
});
$("#newContent").val("");
loadMessages();
}
function addMessages(messages) {
for(i in messages) {
var messagesText = "";
for(var i in messages) {
// Initialize message variables
var thisDate = new Date(messages[i].creationdate.replace(/ /,"T"));
var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
console.log(thisDate);
var type;
thisDate.setHours(0,0,0,0);
if (messages[i].destination == $(".destinationID").val()) {
type = "chat-message-self";
} else {
type = "chat-message-other";
}
if (i == 0) {
previousDate = thisDate;
messagesText += '\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>';
messagesText += '<div class="chat-message"><div class="' + type + '">';
} else if (type != previousType || thisTime != previousTime || thisDate.getTime() > previousDate.getTime()) {
messagesText += '<div class="chat-time">\
' + thisTime + '\
</div></div></div>';
$("#chat-history").append('\
<div class="chat-message"> \
<div class="' + type + '">\
' + messages[i].content + '\
</div> \
</div>\
');
previousTime = thisTime;
previousType = type;
if (thisDate > previousDate) {
previousDate = thisDate;
messagesText += '\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>';
}
messagesText += '<div class="chat-message"><div class="' + type + '">';
}
messagesText += fancyText(messages[i].content) + "<br />";
}
// Close the last message
messagesText += '<div class="chat-time">\
' + thisTime + '\
</div></div></div>';
$("#chat-history").append(messagesText);
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight - $('#chat-history')[0].clientHeight);
}
function switchUser(userID) {
previousDate = new Date("1970-01-01 00:00:00");
$(".chat-field").show();
$(".destinationID").val(userID);
$("#chat-history").html("");
$("#lastID").val("");
$(".chat-left .friend-item").removeClass("active-friend-chat");
$(".chat-left #friend-item-" + userID).addClass("active-friend-chat");
$("#chat-recent-panel .friend-item").removeClass("active-friend-chat");
$("#friend-item-" + userID).addClass("active-friend-chat");
}
function sayEmpty() {
$("#chat-history").html("Begin nu met chatten!");
$("#chat-history").html("Probeer ook eens foto's en video's te sturen");
}

View File

@@ -0,0 +1,70 @@
function placeFriendButtons() {
$.post("API/getFriendshipStatus.php", { usr: userID })
.done(function(data) {
var friendshipStatus = data;
var $buttonContainer = $("div.friend-button-container");
$("#start-profile-chat").hide();
$buttonContainer.html("");
var value1 = "";
var class1 = "empty-button";
var icon1 = "";
var text1 = "";
var value2 = "";
var class2 = "empty-button";
var icon2 = "";
var text2 = "";
switch (friendshipStatus) {
case "0":
value1 = "request";
class1 = "green";
text1 = "Bevriend";
icon1 = "fa-handshake-o";
break;
case "1":
value1 = userID;
class1 = "green";
text1 = "Chat";
icon1 = "fa-comment-o";
value2 = "delete";
class2 = "red";
text2 = "Verwijder";
icon2 = "fa-times";
break;
case "2":
value1 = "delete";
class1 = "red";
text1 = "Trek verzoek in";
icon1 = "fa-cross";
break;
case "3":
value1 = "accept";
class1 = "green";
text1 = "Accepteer";
icon1 = "fa-check";
value2 = "delete";
class2 = "red";
text2 = "Weiger";
icon2 = "fa-times";
break;
}
$buttonContainer.append(
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
"<i class='fa "+ icon1 +"'></i> " + text1 +
"</button>");
$buttonContainer.append(
"<button class='"+ class2 +" friend-button' value='"+ value2 +"'>" +
"<i class='fa "+ icon2 +"'></i> " + text2 +
"</button>");
$buttonContainer.children().click(function() {
if (isNaN(this.value))
editFriendship(userID, this.value);
else if (this.value != "")
window.location.href = "chat.php?username=" + this.value;
});
});
}

View File

@@ -1,35 +1,40 @@
$(document).ready(function() {
// Hide notification center.
$("#profile-menu-popup").hide();
// Toggle menu
$("#own-profile-picture, #open-notifications").click(function() {
if ($("#notification-center").css('display') == "none") {
// Make the menu visible and move the content to the left.
$(".modal").width("calc(100% - 512px)");
$(".content").css("margin-right", "256px");
$("#notification-center").css("right", "0px");
$("#notification-center").css("display", "block");
$("#contact-menu").css("display", "block");
// $("#own-profile-picture").click(function() {
// $("#profile-menu-popup").toggle();
// $("#profile-hello-popup").toggle();
// });
// Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 587px)");
document.cookie = "menu=open; path=/";
} else {
document.cookie = "menu=closed; path=/";
}
} else {
$(".modal").width("calc(100% - 256px)");
$(".content").css("margin-right", "0px");
$("#notification-center").css("display", "none");
$("#own-profile-picture").click(function() {
if($("#notification-center").css('right') == "-256px") {
$(".content").animate({
marginRight: "256px"
}, 500);
$(".chat-right").animate({
width: "calc(100% - 512px - 40px)"
}, 500);
$("#notification-center").animate({
right: "0px"
}, 500);
} else {
$(".chat-right").animate({
width: "calc(100% - 256px - 40px)"
}, 500);
$(".content").animate({
marginRight: "0px"
}, 500);
$("#notification-center").animate({
right: "-256px"
}, 500);
}
if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 331px)");
} else {
// Make the menu invisible and move the content to the right.
$("#contact-menu").css("display", "none");
}
// Change menu cookie to close
document.cookie = "menu=closed; path=/";
}
});
$("#own-profile-picture").click();
if (getCookie("menu") == "open") {
$("#own-profile-picture").click();
}
});

106
website/public/js/main.js Normal file
View File

@@ -0,0 +1,106 @@
var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]
function fancyText(text) {
// Add links, images, gifs and (youtube) video's.
var regex = /(https?:\/\/.[^ <>"]*)/ig;
text = text.replace(regex, function(link) {
// Add images
if (link.match(/(https?:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig)) {
return "<img alt='" + link + "' src='" + link + "' />";
}
// Add mp4 video's
else if (link.match(/(https?:\/\/.[^ ]*\.(?:mp4))/ig)) {
return "<video width='100%'>" +
"<source src='"+ link +"' type='video/mp4'>" +
"<b>Je browser ondersteund geen video</b>" +
"</video><button class='gray' onclick='$(this).prev().get(0).play();'>Speel af</button>";
}
// Add ogg video's
else if (link.match(/(https?:\/\/.[^ ]*\.(?:ogg))/ig)) {
return "<video width='100%'>" +
"<source src='"+ link +"' type='video/ogg'>" +
"<b>Je browser ondersteund geen video</b>" +
"</video><button onclick='$(this).prev().get(0).play();'>Speel af</button>";
}
// Add youtube video's
else if (link.match(/(https?:\/\/.(www.)?youtube|youtu.be)*watch/ig)) {
return '<iframe width="100%"' +
' src="https://www.youtube.com/embed/' + link.substr(link.length - 11) +
'" frameborder="0" allowfullscreen></iframe>';
}
// Add links
else {
return "<a href='" + link + "'>" + link + "</a>";
}
});
return text;
}
function getCookie(key) {
cookies = document.cookie.split("; ");
for (var i in cookies) {
cookie = cookies[i].split("=");
if (cookie[0] == key) {
return cookie[1];
}
}
return false;
}
function editFriendship(userID, value) {
$.post("API/editFriendship.php", { usr: userID, action: value })
.done(function() {
placeFriendButtons();
});
}
function showFriends(friends, list) {
if(friends && friends != "[]") {
$(list).load("bits/friend-item.php", {
"friends": friends
});
return true;
} else {
return false;
}
}
function showFriendsPlus(friends, list, limit, action, actionType) {
if(friends && friends != "[]") {
$(list).load("bits/friend-item.php", {
"friends": friends,
"limit": limit,
"action": action,
"actionType": actionType
});
return true;
} else {
return false;
}
}
function showGroups(groups, list) {
if(groups && groups != "[]") {
$(list).load("bits/group-item.php", {
"groups": groups
});
return true;
} else {
return false;
}
}
$(document).ready(function() {
$("body").delegate("textarea[maxlength]", "keydown", function() {
if ($(this).val().length / .9 >= $(this).attr("maxlength")) {
$(this).next().text($(this).val().length + "/" + $(this).attr("maxlength"));
} else {
$(this).next().text("");
}
});
});

View File

@@ -1,37 +1,106 @@
margin = 20;
// scrolling modal taken from http://stackoverflow.com/questions/10476632/how-to-scroll-the-page-when-a-modal-dialog-is-longer-than-the-screen
function scrollbarMargin(width, overflow) {
$('body').css({
marginRight: width,
overflow: overflow
});
$('.profile-menu').css({
marginRight: width
});
}
function requestPost(postID) {
$(".modal").show();
$.get("API/loadPost.php", { postID : postID }).done(function(data) {
$('.modal-default').hide();
var scrollBarWidth = window.innerWidth - document.body.offsetWidth;
scrollbarMargin(scrollBarWidth, 'hidden');
$('#modal-response').show();
$('#modal-response').html(fancyText(data));
});
}
function postPost() {
title = $("input.newpost[name='title']").val();
content = $("textarea.newpost[name='content']").val();
if (masonryMode == 2) {
$.post("API/postPost.php", { title: title,
content : content,
group : groupID })
.done(function() {
masonry(masonryMode);
});
} else {
$.post("API/postPost.php", { title: title,
content : content })
.done(function() {
masonry(masonryMode);
});
}
}
$(window).on("load", function() {
console.log("LOADED");
container = $("div.posts");
posts = container.children();
posts.remove();
column = $('<div class="column"></div>').append(posts);
container.append(column);
mansonry();
mansonry();
$(".modal-close").click(function () {
$(".modal").hide();
scrollbarMargin(0, 'auto');
$('#modal-response').hide();
$('.modal-default').show();
});
});
var masonryMode = 0;
var windowWidth = $(window).width();
$(window).resize(function() {
clearTimeout(window.resizedFinished);
window.resizeFinished = setTimeout(function() {
mansonry();
if ($(window).width() != windowWidth) {
windowWidth = $(window).width();
masonry(masonryMode);
}
}, 250);
});
function mansonry() {
var $container = $(".posts");
function masonry(mode) {
masonryMode = mode;
$container.children().remove();
columnCount = Math.floor($(".posts").width() / 250);
console.log("columns: " + columnCount);
/*
* Initialise columns.
*/
var columns = new Array(columnCount);
for (i = 0; i < columnCount; i++) {
columns[i] = [0, []];
console.log(columns[i]);
$column = $("<div class=\"column\">");
$column.width(100/columnCount + "%");
$container.append($column);
columns[i] = [0, $column];
}
if(mode > 0) {
$postInput = $("<div class=\"post platform\">");
$form = $("<form class=\"newpost\" action=\"API/postPost.php\" method=\"post\" onsubmit=\"postPost(); return false;\">");
$postInput.append($form);
if(mode == 2) {
$form.append($("<input class=\"newpost\" type=\"hidden\" name=\"group\" value=\"" + groupID + "\">"));
}
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>"));
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
columns[0][1].append($postInput);
columns[0][0] = $postInput.height() + margin;
}
/*
@@ -45,32 +114,30 @@ function mansonry() {
column = columns[i];
}
}
return column;
}
/*
* Rearange the objects.
* Get the posts from the server.
*/
j = 0;
posts.each(function(i) {
post = posts[i];
shortestColumn = getShortestColumn(columns);
shortestColumn[0] = shortestColumn[0] + $(post).height() + margin;
shortestColumn[1].push(post);
$.post("API/getPosts.php", { usr : userID, grp : groupID })
.done(function(data) {
posts = JSON.parse(data);
});
/*
* Rearange the objects.
*/
$.each(posts, function() {
$post = $("<div class=\"post platform\" onclick=\"requestPost(\'"+this['postID']+"\')\">");
$post.append($("<h2>").html(this["title"]));
$post.append($("<p>").html(fancyText(this["content"])));
$post.append($("<p class=\"subscript\">").text(this["nicetime"]));
$post.append($("<p class=\"subscript\">").text("comments: " + this["comments"] + ", niet slechts: " + this["niet_slechts"]));
container.children().remove();
/*
* Display the objects again in the correct order.
*/
for (i = 0; i < columnCount; i++) {
column = $('<div class="column"></div>').append(columns[i][1]);
console.log(column);
container.append(column);
}
$("div.posts div.column").width(100/columnCount + "%");
shortestColumn = getShortestColumn(columns);
shortestColumn[1].append($post);
shortestColumn[0] = shortestColumn[0] + $post.height() + margin;
});
});
}

View File

@@ -1,39 +1,93 @@
var menuFriendsData;
var menuGroupsData;
var notificationMessagesData;
var notificationRequestsData;
$(document).ready(function() {
$(".extra-menu-items").hide();
$("#menu-back").hide();
// Show more friends
$("#more-friends-click").click(function() {
// Show only friends
$("#groups-menu-section").slideUp();
$("#friends-menu-section li").show();
// Change buttons
$("#more-friends-click").hide();
$("#menu-back").show();
});
// Show more groups
$("#more-groups-click").click(function() {
// Show only groups
$("#friends-menu-section").slideUp();
$("#groups-menu-section li").show();
// Change buttons
$("#more-groups-click").hide();
$("#menu-back").show();
});
// Go back
$("#menu-back").click(function() {
// Show overview of friends and groups
$("#friends-menu-section").slideDown();
$("#groups-menu-section").slideDown();
$(".extra-menu-items").hide();
// Change buttons
$("#menu-back").hide();
$("#more-groups-click").show();
$("#more-friends-click").show();
});
loadMenuFriends(5);
loadNotificationFriends();
loadUnreadMessages();
loadMenuGroups();
setInterval(updateMenus, 3000);
});
// Update the menu and notification items.
function updateMenus() {
loadMenuFriends(5);
loadNotificationFriends();
loadUnreadMessages();
loadMenuGroups();
}
// Get, every 3 seconds, the friends and insert them in the menu.
function loadMenuFriends(limit) {
$.post(
"API/loadFriends.php",
{
limit: 5
}
).done(function(data) {
if (menuFriendsData != data) {
menuFriendsData = data;
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
$("#friends-menu-section").show();
} else {
$("#friends-menu-section").hide();
}
}
});
}
// Get, every 3 seconds, the groups and insert them in the menu.
function loadMenuGroups() {
$.post(
"API/loadGroups.php",
{
limit: 5
}
).done(function(data) {
if (menuGroupsData != data) {
menuGroupsData = data;
if (showGroups(data, "#menu-groups-list")) {
$("#groups-menu-section").show();
} else {
$("#groups-menu-section").hide();
}
}
});
}
// Get, every 3 seconds, the friends requests and insert them in the notification center.
function loadNotificationFriends() {
$.post(
"API/loadFriendRequest.php"
).done(function(data) {
if (notificationRequestsData != data) {
notificationRequestsData = data;
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
$("#friend-request-section").show();
} else {
$("#friend-request-section").hide();
}
}
});
}
// Get, every 3 seconds, the unread messages and insert them in the notification center.
function loadUnreadMessages() {
$.post(
"API/loadChatNotifications.php"
).done(function(data) {
if (notificationMessagesData != data) {
notificationMessagesData = data;
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
$("#unread-messages-section").show();
} else {
$("#unread-messages-section").hide();
}
}
});
}

View File

@@ -1,44 +0,0 @@
function showNotifications(notifications, id) {
$("#" + id).html("");
for (i in notifications) {
$("#" + id).append(" \
<li class='friend-item $extraItem'> \
<form action='profile.php' method='get'> \
<button type='submit' \
name='username' \
value='"+ notifications[i].username +"'> \
<div class='friend'> \
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
"+ notifications[i].username +" \
</div> \
</button> \
</form> \
</li> \
");
}
}
function loadNotifications() {
$.post(
"API/loadFriendRequestNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "friendrequestslist");
}
});
$.post(
"API/loadChatNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "unreadChatlist");
}
});
setTimeout(loadNotifications, 10000);
}
$(document).ready(function() {
loadNotifications();
});

22
website/public/js/post.js Normal file
View File

@@ -0,0 +1,22 @@
function postComment(buttonValue) {
formData = $("#newcommentform").serializeArray();
formData.push({name: "button", value: buttonValue});
$.post(
"API/postComment.php",
formData
).done(function (response) {
if (response == "frozen") {
alert("Je account is bevroren, dus je kan geen comments plaatsen of \"niet slechten\". Contacteer een admin als je denkt dat dit onjuist is.");
}
});
$("#newcomment").val("");
//reload post
$.get(
"API/loadPost.php",
$("#newcommentform").serialize()
).done(function (data) {
$('#modal-response').html(fancyText(data));
});
}

View File

View File

@@ -1,8 +1,15 @@
function checkLoggedIn() {
if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) {
if (confirm("U bent al ingelogd!!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
window.location.href = "logout.php";
} else {
window.location.href = "profile.php";
}
document.getElementById("demo").innerHTML = x;
}
function bannedAlert(){
alert("Uw account is geband!");
}
function emailNotConfirmed(){
alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
}

View File

@@ -0,0 +1,41 @@
$(window).on('load', function () {
pageNumber();
});
function searchUsers() {
$.post(
"API/searchUsers.php",
$('#search-form').serialize()
).done(function(data) {
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
$("#search-users-list").text("Niemand gevonden");
}
});
}
function searchGroups() {
$.post(
"API/searchGroups.php",
$('#search-form').serialize()
).done(function(data) {
if (!showGroups(data, "#search-groups-list")) {
$("#search-groups-list").text("Geen groepen gevonden");
}
});
}
function pageNumber() {
var input = input2 = $('#search-form').serialize();
$.post(
"API/searchPageNumber.php",
input + "&option=user"
).done(function (data) {
$('#user-pageselect').html(data);
});
$.post(
"API/searchPageNumber.php",
input2 + "&option=group"
).done(function (data) {
$('#group-pageselect').html(data);
});
}

View File

@@ -5,6 +5,9 @@
require_once("../queries/connect.php");
include_once("../queries/login.php");
include_once("../queries/checkInput.php");
include_once("../queries/emailconfirm.php");
include_once("../queries/requestpassword.php");
include_once("../queries/register.php");
?>
<body>
<?php
@@ -16,35 +19,45 @@
</script>";
}
// define variables and set to empty values
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
$correct = true;
$day_date = "dag";
$month_date = "maand";
$year_date = "jaar";
// Define variables and set to empty values
$uname = $psw ="";
$loginErr ="";
$user = $psw = $remember ="";
$loginErr = $resetErr ="";
// Trying to login
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Empty username or password field
if (empty($_POST["uname"]) || empty($_POST["psw"])) {
$loginErr = "Gebruikersnaam of wachtwoord is niet ingevuld";
}
else {
$uname = strtolower(test_input($_POST["uname"]));
$psw = test_input($_POST["psw"]);
$hash = getUser()["password"];
$userid = getUser()["userID"];
// If there's an account, go to the profile page
if(password_verify($psw, $hash)) {
$_SESSION["userID"] = $userid;
header("location: profile.php");
} else {
$loginErr = "Inloggegevens zijn niet correct";
}
switch ($_POST["submit"]) {
case "login":
try {
$user = ($_POST["user"]);
validateLogin($_POST["user"], $_POST["psw"]);
} catch(loginException $e) {
$loginErr = $e->getMessage();
}
break;
case "reset":
try {
resetEmail($_POST["forgotEmail"]);
sendPasswordRecovery($_POST["forgotEmail"]);
} catch (emailException $e){
$resetErr = $e->getMessage();
echo "<script>
window.onload = function() {
$('#myModal').show();
}
</script>";
}
break;
case "register":
include("register.php");
}
}
/* This view adds login view */
include("../views/login-view.php");
?>

View File

@@ -1,15 +1,4 @@
<!DOCTYPE html>
<html>
<?php
include("../views/login_head.php");
require_once("../queries/connect.php");
include_once("../queries/login.php");
?>
<body>
<?php
session_start();
unset($_SESSION["userID"]);
header("Location: login.php");
?>
</body>
</html>
session_start();
session_destroy();
header("Location: login.php");

View File

@@ -2,16 +2,22 @@
<html>
<head>
<?php include("../views/head.php"); ?>
<script src="/js/masonry.js"></script>
<script src="js/masonry.js"></script>
<script src="js/post.js"></script>
<style>
@import url("styles/profile.css");
@import url("styles/post-popup.css");
@import url('https://fonts.googleapis.com/css?family=Anton');
</style>
</head>
<body>
<?php
include("../queries/user.php");
include("../queries/friendship.php");
include("../queries/nicetime.php");
include_once("../queries/user.php");
include_once("../queries/friendship.php");
include_once("../queries/nicetime.php");
include_once("../queries/post.php");
include_once("../queries/calcAge.php");
if(empty($_GET["username"])) {
$userID = $_SESSION["userID"];
@@ -19,10 +25,18 @@ if(empty($_GET["username"])) {
$userID = getUserID($_GET["username"]);
}
$user = selectUser($userID);
$user = selectUser($_SESSION["userID"], $userID);
$profile_friends = selectAllFriends($userID);
$profile_groups = selectAllUserGroups($userID);
$posts = selectAllUserPosts($userID);
if ($userID == $_SESSION["userID"]) {
$friendship_status = -1;
$masonry_mode = 1;
} else {
$friendship_status = $user["friend_status"];
$masonry_mode = 0;
}
/*
* This view adds the main layout over the screen.
@@ -36,5 +50,17 @@ include("../views/profile.php");
/* This adds the footer. */
include("../views/footer.php");
?>
<script src="js/friendButtons.js"></script>
<script src="js/masonry.js"></script>
<script>
$(document).ready(function() {
userID = <?= $userID ?>;
groupID = 0;
placeFriendButtons();
masonry(<?= $masonry_mode ?>);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html>
<?php
include("../views/login_head.php");
require_once("../queries/connect.php");
include_once("../queries/register.php");
include_once("../queries/checkInput.php");
include_once("../queries/emailconfirm.php");
?>
<body>
<?php
session_start();
if(isset($_SESSION["userID"])){
header("location: login.php");
}
// define variables and set to empty values
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
$correct = true;
$day_date = "dag";
$month_date = "maand";
$year_date = "jaar";
// Trying to register an account
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
$name = test_input(($_POST["name"]));
checkInputChoice($name, "lettersAndSpaces");
} catch(lettersAndSpacesException $e){
$correct = false;
$nameErr = $e->getMessage();
}
try {
$surname = test_input(($_POST["surname"]));
checkInputChoice($surname, "lettersAndSpaces");
}
catch(lettersAndSpacesException $e){
$correct = false;
$surnameErr = $e->getMessage();
}
try{
$day_date = test_input(($_POST["day_date"]));
$month_date = test_input(($_POST["month_date"]));
$year_date = test_input(($_POST["year_date"]));
$bday = $year_date . "-" . $month_date . "-" . $day_date;
checkInputChoice($bday, "bday");
} catch(bdayException $e){
$correct = false;
$bdayErr = $e->getMessage();
}
try{
$username = str_replace(' ', '', test_input(($_POST["username"])));
checkInputChoice($username, "username");
} catch(usernameException $e){
$correct = false;
$usernameErr = $e->getMessage();
}
try{
$password = str_replace(' ', '', test_input(($_POST["password"])));
checkInputChoice($password, "longerEight");
matchPassword();
} catch(passwordException $e){
$correct = false;
$passwordErr = $e->getMessage();
} catch(confirmPasswordException $e){
$correct = false;
$confirmPasswordErr = $e->getMessage();
}
try{
$location = test_input(($_POST["location"]));
checkInputChoice($location, "lettersAndSpaces");
} catch(lettersAndSpacesException $e){
$correct = false;
$locationErr = $e->getMessage();
}
try{
$email = test_input(($_POST["email"]));
checkInputChoice($email, "email");
$confirmEmail = test_input(($_POST["confirmEmail"]));
matchEmail();
} catch(emailException $e){
$correct = false;
$emailErr = $e->getMessage();
} catch(confirmEmailException $e){
$correct = false;
$confirmEmailErr = $e->getMessage();
}
try{
$captcha = $_POST['g-recaptcha-response'];
checkCaptcha($captcha);
} catch(captchaException $e){
$correct = false;
$captchaErr = $e->getMessage();
}
try {
getIp();
registerCheck($correct);
sendConfirmEmailUsername($username);
} catch(registerException $e){
$genericErr = $e->getMessage();
}
}
/* This view adds register view */
include("../views/register-view.php");
?>
</body>
</html>

View File

@@ -1,45 +1,91 @@
<!DOCTYPE html>
<html>
<?php
include("../views/login_head.php");
require_once("../queries/connect.php");
include_once("../queries/register.php");
include_once("../queries/checkInput.php");
?>
<body>
<?php
session_start();
if(isset($_SESSION["userID"])){
header("location: profile.php");
try {
$name = test_input(($_POST["name"]));
checkInputChoice($name, "lettersAndSpaces");
} catch(lettersAndSpacesException $e){
$correct = false;
$nameErr = $e->getMessage();
}
// define variables and set to empty values
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = "";
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = "";
$correct = true;
// Trying to register an account
if ($_SERVER["REQUEST_METHOD"] == "POST") {
checkInputChoice("name", "lettersAndSpace");
checkInputChoice("surname", "lettersAndSpace");
try {
$surname = test_input(($_POST["surname"]));
checkInputChoice($surname, "lettersAndSpaces");
}
catch(lettersAndSpacesException $e){
$correct = false;
$surnameErr = $e->getMessage();
}
if (empty($_POST["bday"])) {
$bdayErr = "Geboortedatum is verplicht!";
$correct = false;
try{
$day_date = test_input(($_POST["day_date"]));
$month_date = test_input(($_POST["month_date"]));
$year_date = test_input(($_POST["year_date"]));
$bday = $year_date . "-" . $month_date . "-" . $day_date;
checkInputChoice($bday, "bday");
} catch(bdayException $e){
$correct = false;
$bdayErr = $e->getMessage();
}
} else {
$bday = test_input($_POST["bday"]);
}
try{
$username = str_replace(' ', '', test_input(($_POST["username"])));
checkInputChoice($username, "username");
} catch(usernameException $e){
$correct = false;
$usernameErr = $e->getMessage();
}
checkInputChoice("username", "username");
checkInputChoice("password", "longerEight");
checkInputChoice("confirmpassword", "");
try{
$password = str_replace(' ', '', test_input(($_POST["password"])));
checkInputChoice($password, "longerEight");
matchPassword();
checkInputChoice("location", "lettersAndSpace");
checkInputChoice("email", "email");
registerCheck();
} catch(passwordException $e){
$correct = false;
$passwordErr = $e->getMessage();
} catch(confirmPasswordException $e){
$correct = false;
$confirmPasswordErr = $e->getMessage();
}
try{
$location = test_input(($_POST["location"]));
checkInputChoice($location, "lettersAndSpaces");
} catch(lettersAndSpacesException $e){
$correct = false;
$locationErr = $e->getMessage();
}
try{
$email = test_input(($_POST["email"]));
checkInputChoice($email, "email");
$confirmEmail = test_input(($_POST["confirmEmail"]));
matchEmail();
} catch(emailException $e){
$correct = false;
$emailErr = $e->getMessage();
} catch(confirmEmailException $e){
$correct = false;
$confirmEmailErr = $e->getMessage();
}
try{
$captcha = $_POST['g-recaptcha-response'];
checkCaptcha($captcha);
} catch(captchaException $e){
$correct = false;
$captchaErr = $e->getMessage();
}
try {
getIp();
registerCheck($correct);
sendConfirmEmailUsername($username);
} catch(registerException $e){
echo "<script>
window.onload = function() {
$('#registerModal').show();
}
</script>";
$genericErr = $e->getMessage();
}
/* This view adds register view */
include("../views/register-view.php");
?>
</body>
</html>

View File

@@ -0,0 +1,57 @@
<?php
include_once("../queries/connect.php");
include_once("../views/messagepage.php");
include_once("../views/resetpassword.php");
if ($_SERVER["REQUEST_METHOD"] == "GET") {
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
if (verifyLink($_GET["u"], $_GET["h"])) {
messagePage(passwordResetFields());
} else {
messagePage("Wachtwoorden komen niet overeen.");
}
} else {
messagePage("Ongeldige links");
}
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
if (verifyLink($_POST["u"], $_POST["h"])) {
if ($_POST["password"] == $_POST["password-confirm"]) {
changePassword();
messagePage("Wachtwoord gewijzigd");
} else {
messagePage("Ongeldige link");
}
}
} else {
messagePage("Ongeldige link");
}
function changePassword() {
$stmt = prepareQuery("
UPDATE
`user`
SET
`password` = :password
WHERE
`userID` = :userID
");
$stmt->bindValue(":password", password_hash($_POST["password"], PASSWORD_DEFAULT));
$stmt->bindParam(":userID", $_POST["u"]);
$stmt->execute();
}
function verifyLink(int $userID, string $hash) {
$stmt = prepareQuery("
SELECT
`password`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $userID);
$stmt->execute();
$password = $stmt->fetch()["password"];
return password_verify($password, $hash);
}

View File

@@ -9,6 +9,8 @@
<style>
@import url("styles/search.css");
</style>
<script src="js/search.js"></script>
</head>
<body>
<?php

View File

@@ -12,23 +12,28 @@
</head>
<body>
<?php
$notImplemented = new settingsMessage("angry", "Deze functie werkt nog niet :(");
$alertClass;
$alertMessage;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
switch ($_POST["form"]) {
case "profile":
$result = updateSettings();
break;
case "password":
$result = changePassword();
break;
case "email":
$result = changeEmail();
break;
case "picture":
updateProfilePicture();
$result = new settingsMessage("happy", "Deze melding doet nog niks nuttigs.");
break;
try {
switch ($_POST["form"]) {
case "profile":
updateSettings();
break;
case "password":
changePassword();
break;
case "email":
changeEmail();
break;
case "picture":
updateAvatar();
break;
}
} catch (AlertMessage $w) {
$alertClass = $w->getClass();
$alertMessage = $w->getMessage();
}
}
include("../views/main.php");

View File

@@ -0,0 +1,3 @@
#quick-links i {
font-size: 32px;
}

View File

@@ -1,78 +1,39 @@
.admin-panel {
margin: auto;
min-width: 800px;
}
.admin-title {
margin: 10px;
padding-bottom: 5px;
border-bottom: 4px solid #FBC02D;
}
.admin-panel input[type="radio"], input[type="checkbox"] {
height: auto;
}
.admin-batchactions, .admin-groupbatchactions {
display: inline-block;
padding: 8px;
vertical-align: top;
border-radius: 10px;
border: 4px solid #FBC02D;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
vertical-align: middle;
height: 28px;
margin: 2px;
}
.admin-searchform {
display: inline-block;
width: 100%;
}
.admin-searchbar {
display: inline-block;
margin: 10px;
vertical-align: top;
}
.admin-searchinput {
margin-bottom: 10px;
}
.admin-filter, .admin-filtertype, .admin-groupfilter {
display: inline-block;
margin: 10px;
vertical-align: top;
margin-right: 50px;
margin-left: 50px;
}
.admin-filter, .admin-groupfilter {
width: 120px;
}
.admin-users {
margin: 10px;
}
.admin-userheading {
width: auto;
float: left;
}
.admin-pageui {
text-align: right;
float: right;
width: auto;
margin-bottom: 20px;
}
.usertitle {
width: 150px;
.admin-pageui {
display: inline-block;
width: 100%;
}
.admin-pageselector {
display: inline-block;
}
.admin-users {
margin-top: 50px;
}
.usertable {
width: 100%;
}
.usertable .table-checkbox {width: 20px}
.usertable .table-username {width: 150px}
.usertable .table-status {width: 100px}
.usertable .table-action {width: 200px}
@@ -82,10 +43,18 @@
padding: 3px;
}
.usertable tr {
.usertable th, tr {
text-align: left;
}
.usertable tr:hover {
background-color: #f5f5f5;
}
.bancommentedit {
display: none;
}
.bancommentform input[type="text"] {
width: 100%;
}

View File

@@ -1,39 +1,76 @@
body {
overflow: hidden;
}
/* Overall chat-screen */
.chat {
position: fixed;
top: 80px;
left: 256px;
padding: 15px 0;
width: calc(100% - 256px);
height: calc(100% - 120px);
display: inline-flex;
padding: 20px 0;
display: inline-block;
}
.chat-left {
#chat-recent-panel {
width: 256px;
height: calc(100% - 100px);
margin: 0 10px;
overflow-y: auto;
}
.chat-right {
width: calc(100% - 256px - 40px);
height: calc(100% - 80px);
margin-right: 10px;
display: inline-block;
float: left;
overflow-y: auto;
}
/* Chat history. */
.chat-history {
#chat-history {
overflow-y: auto;
height: 100%;
overflow-x: hidden;
width: calc(100% - 256px - 85px);
height: calc(100% - 80px);
margin-right: 10px;
padding: 10px;
display: inline-block;
float: right;
word-wrap: break-word;
}
/* Chat-message takes the whole width of the chat area */
.day-message {
width: 100%;
min-height: 40px;
padding: 10px 0;
clear: both;
text-align: center;
}
.day-message-content {
width: auto;
padding: 10px;
background-color: #F8F8F8;
color: #666;
}
.chat-message {
width: 100%;
min-height: 40px;
padding-top: 10px;
padding: 10px 0;
clear: both;
}
.chat-message::after {
content: '';
display: table;
clear: both;
}
@@ -46,20 +83,21 @@
.chat-message-self {
float: right;
margin-right: 10px;
background-color: darkgreen;
color: white;
background-color: #FBC02D;
color: #333;
}
.chat-message-other {
float: left;
margin-left: 10px;
background-color: aquamarine;
background-color: #4CAF50;
color: white;
}
/* Chat reply field */
.chat-field {
width: 100%;
width: calc(100% - 10px);
display: table;
}
@@ -77,7 +115,6 @@
width: 100%;
border: none;
border-radius: 10px 0 0 10px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.chat-field input[type="submit"] {
@@ -87,10 +124,45 @@
color: white;
padding: 5px 10px;
border-radius: 0 10px 10px 0;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.active-friend-chat {
background: aquamarine;
color: #333;
background: #4CAF50;
color: white;
}
.chat-message img {
max-width: 100%;
}
.chat-message a {
text-decoration: underline;
}
.chat-time {
color: #666666;
font-size: 12px;
margin-bottom: -3px;
}
.chat-message-other .chat-time {
text-align: right;
}
@media only screen and (max-width: 1080px) {
.chat-message-self, .chat-message-other {
max-width: 75%;
}
.chat {
left: 0;
width: 100%;
}
#chat-recent-panel {
left: 0;
width: 320px;
}
#chat-history {
left: 50%;
width: calc(100% - 390px);
}
}

View File

@@ -7,7 +7,9 @@ header {
height: 80px;
width: 100%;
color: white;
color: #FFF;
font-weight: bold;
letter-spacing: 1px;
background-color: #FBC02D;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
@@ -24,7 +26,8 @@ header {
}
#header-search {
padding-left: 42px;
margin: 24px 0 24px 32px;
vertical-align: middle;
}
@@ -41,6 +44,16 @@ header div {
width: 64px;
}
#own-profile-picture {
#own-profile-picture, #open-notifications {
cursor: pointer;
}
#open-notifications {
padding: 20px 20px 20px 0px;
}
@media only screen and (max-width: 1080px) {
#header-logo {
display: none;
}
}

View File

@@ -1,20 +1,19 @@
a.button {
background-color: #C8CABD;
border-radius: 10px;
border-radius: 5px;
color: black;
cursor: pointer;
height: 50%;
margin: 8px 0;
padding: 14px 20px;
width: 25%;
padding: 8px 20px;
font-family: Arial;
font-size: 16px;
font-size: 22px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
/* Body */
body {
height: 100%;
background-color: #C8CABD;
background-color: #FBC02D;
/*background-image: url(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg);
background-size: cover;
background-attachment: fixed;*/
@@ -24,34 +23,20 @@ body {
font-family: Arial, sans-serif;
}
/* The Close Button */
.close {
/* Position it in the top right corner outside of the modal */
color: white;
font-size: 100px;
font-weight: bold;
position: absolute;
right: 25px;
top: 0;
}
/* Close button on hover */
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}
/* inlogform */
form {
/*background-color: #a87a87;*/
border-radius: 12px;
height: 70%;
height: 85%;
margin: auto;
width: 70%;
overflow-y:auto;
width: 600px;
overflow-y: auto;
overflow-x: hidden;
}
/* inlog titel */
h1 {
padding: 8px;
@@ -61,87 +46,76 @@ h1 {
/* registreer titel*/
h2 {
padding: 16px;
padding: 8px;
text-align: left;
font-size: 2.0em;
}
h3 {
padding: 8px;
text-align: center;
font-size: 1.5em;
}
input[type=text], input[type=password], input[type=email], input[type="date"] {
box-sizing: border-box;
border-color: #C8CABD;
display: inline-block;
height: 60%;
padding: 8px 20px;
margin: 4px 0;
width: 70%;
}
/*
input[type=text], input[type=password], input[type=email], input[type="date"] {
border: 0px;
border-bottom: 4px solid lightgray;
border-radius: 0px;
}*/
button[type=submit] {
background-color: #C8CABD;
color: black ;
cursor: pointer;
font-family: Arial;
font-size: 16px;
width: 50%;
padding: 8px 10px;
margin: 4px 0;
width: 55%;
}
.middle{
text-align: center;
}
.center{
text-align: center;
}
button {
background-color: #C8CABD;
border-radius: 5px;
color: black;
cursor: pointer;
height: 50%;
padding: 8px 20px;
margin: 5px;
font-family: Arial;
font-size: 22px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.error {
font-family: Arial;
font-size: 15px;
color: red;
text-align: left;
}
label {
display: block;
}
.left-arrow {
display: inline-block;
position: relative;
background-color: #C8CABD;
height: 30px;
width: 90px;
padding: 3px 3px 3px 0px;
text-align: center;
border-radius: 0px 10px 10px 0px;
font-size: 24px;
}
.left-arrow:after {
content: '';
display: block;
position: absolute;
right: 100%;
top: 0;
bottom: 0;
border-top: 15px solid transparent;
border-right: 20px solid #C8CABD;
border-bottom: 15px solid transparent;
border-left: 0px solid transparent;
}
/* padding voor registreer container */
.login_containerregister {
padding: 16px;
padding: 8px;
text-align: left;
}
/* padding voor login_containers */
.login_containerlogin {
padding:25px;
padding:8px;
text-align: center;
}
/* padding voor foutmelding login */
.login_containerfault {
padding: 16px;
padding: 4px;
text-align: center;
color: red;
}
@@ -159,24 +133,89 @@ label {
background-repeat: repeat-x;
background-attachment: fixed;*/
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
height: 500px;
margin: 34px auto;
height: 400px;
margin: 16px auto;
overflow-y: auto;
padding: 20px;
width: 50%;
width: 600px;
}
/*.platform {
width: 40%;
margin: 34px auto;
}*/
@-webkit-keyframes animatezoom {
from {-webkit-transform: scale(0)}
to {-webkit-transform: scale(1)}
select{
width: 18%;
}
ul {
font-family: Arial;
font-size: 16px;
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 30px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: hidden; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #FFFFFF;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 600px;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop;
-webkit-animation-duration: 0.4s;
animation-name: animatetop;
animation-duration: 0.4s
}
/* Add Animation */
@-webkit-keyframes animatetop {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
@keyframes animatetop {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
/* The Close Button */
.close {
color: white;
float: right;
font-size: 36px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.modal-header {
padding: 4px 16px;
background-color: #FBC02D;
color: black;
}
.modal-body {
padding: 2px 16px;
}
.modal-footer {
background-color: #FBC02D;
color: black;
}

View File

@@ -92,21 +92,29 @@ p {
border-radius: 50%;
}
.online {
border: #4CAF50 solid 3px;
}
.offline {
border: #666666 solid 3px;
}
.group-picture {
border-radius: 5px;
}
.item-box, .item-box-full-width {
margin: 20px 0 0 0;
padding: 25px;
background-color: #FFFFFF;
}
.item-box {
width: calc(50% - 60px);
width: calc(33% - 50px);
display: inline-table;
}
@media only screen and (max-width: 900px) {
@media only screen and (max-width: 1400px) {
.item-box {
width: calc(100% - 50px);
}
@@ -175,6 +183,19 @@ textarea:focus, input:focus, select:focus {
}
/* All buttons */
button.red {
background-color: firebrick;
}
button.green {
background-color: forestgreen;
}
button.gray{
background-color: #FFF;
color: #333;
}
button,
input[type="submit"],
input[type="reset"] {
@@ -215,6 +236,7 @@ td {
/* Custom title box, appears instantaneously */
a[data-title]:hover,
i[data-title]:hover,
img[data-title]:hover,
span[data-title]:hover,
div[data-title]:hover {
@@ -222,6 +244,7 @@ div[data-title]:hover {
}
a[data-title]:hover:after,
i[data-title]:hover:after,
img[data-title]:hover:after,
span[data-title]:hover:after,
div[data-title]:hover:after {
@@ -242,3 +265,58 @@ div[data-title]:hover:after {
line-height: normal;
font-family: Arial, sans-serif;
}
.friend-item, .group-item {
cursor: pointer;
transition-duration: 250ms;
}
.friend-item button, .group-item button {
background: none;
color: inherit;
width: 100%;
height: 100%;
padding: 0;
text-align: left;
}
.friend-item:hover, .group-item:hover {
background: #FBC02D;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.friend-name {
display: inline-block;
vertical-align: middle;
}
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-track {
background: none;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 20px;
border-radius: 20px;
background: #4CAF50;
}
@media only screen and (max-width: 1080px) {
body {
font-size: 28px!important;
}
button, input, select {
font-size: 28px;
height: 42px;
}
textarea {
font-size: 28px;
}
input[type="checkbox"], input[type="radio"] {
width: 28px;
height: 28px;
}
}

View File

@@ -5,7 +5,7 @@
left: 0;
top: 80px;
height: calc(100% - 80px);
height: calc(100% - 120px);
width: 236px;
padding: 20px 10px;
@@ -34,25 +34,6 @@
cursor: pointer;
}
.friend-item, .group-item {
cursor: pointer;
transition-duration: 250ms;
}
.friend-item:hover, .group-item:hover {
background: #FBC02D;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.menu button {
background: none;
color: inherit;
width: 100%;
height: 100%;
padding: 0;
text-align: left;
}
#notification-center {
left: auto;
width: 236px;
@@ -74,3 +55,49 @@
#quick-links i:hover {
color: #FBC02D;
}
.notification-options {
width: 100%;
display: none;
}
.notification-options button {
display: inline-block;
padding: 5px 20px;
width: auto;
}
.accept-notification:hover {
color: #4CAF50;
}
.deny-notification:hover {
color: firebrick;
}
.friend-item:hover .notification-options {
display: inline-block;
}
.menu button {
background: none;
color: inherit;
width: 100%;
height: 100%;
padding: 0;
text-align: left;
}
@media only screen and (max-width: 1080px) {
#contact-menu, #notification-center {
display: none;
background: rgba(0, 0, 0, 0.4);
width: calc(50% - 20px);
}
.content {
margin-left: 0;
}
#quick-links i {
font-size: 48px!important;
}
}

View File

@@ -0,0 +1,28 @@
body {
background-color: #FBC02D;
}
.password-change {
height: 100%;
margin: auto;
}
.top-logo {
text-align: center;
}
.item-box {
margin: 30px auto auto;
display: block;
}
.top-logo img {
width: 50%;
}
.error-page {
text-align: center;
}
.error-page img {
vertical-align: middle;
}

View File

@@ -0,0 +1,47 @@
/* MAIN */
body {
font-size: 28px!important;
}
button {
font-size: 28px;
}
/* HEADER */
#header-logo {
display: none;
}
/* PROFILE */
.post-box {
width: calc(100% - 65px);
}
/* MENU */
#contact-menu, #notification-center {
display: none;
background: rgba(0, 0, 0, 0.4);
width: calc(50% - 20px);
}
.content {
margin-left: 0;
}
#quick-links i {
font-size: 48px!important;
}
/* CHAT */
.chat-message-self, .chat-message-other {
max-width: 75%;
}
.chat {
left: 0;
width: 100%;
}
#chat-recent-panel {
left: 0;
width: 320px;
}
#chat-history {
left: 50%;
width: calc(100% - 390px);
}

View File

@@ -0,0 +1,86 @@
/* modal based on: http://www.w3schools.com/howto/howto_css_modals.asp */
.modal {
display: none;
position: fixed;
top: 80px;
left: 256px;
width: calc(100% - 256px); /* Full width */
height: calc(100% - 80px); /* Full height */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
overflow-y: auto;
}
/* Modal Content/Box */
.modal-content {
margin: 5% auto;
width: 70%; /* Could be more or less, depending on screen size */
overflow-y: auto;
}
.modal-close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
margin: auto;
}
.modal-close:hover,
.modal-close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
.modal-content img {
max-height: 100%;
max-width: 100%;
}
.post-header h4 {
font-size: 20pt;
}
.post-content {
margin: 30px auto;
width: 90%;
}
.commentfield {
margin-bottom: 20px;
}
.commentfield textarea {
width: 100%;
}
.comment {
padding-top: 10px;
padding-bottom: 10px;
border-top: 1px solid #4CAF50;
}
.commentinfo {
font-size: 10pt;
}
.commentcontent {
margin: 5px auto;
width: 95%;
}
.nietslecht-text {
font-family: Impact, Anton, sans-serif;
text-shadow: -1px 0 1px black, 0 1px 1px black, 1px 0 1px black, 0 -1px 1px black;
}
.nietslecht {
}
.nietslecht img {
vertical-align: middle;
height: 24px;
width: 24px;
}

View File

@@ -1,15 +1,60 @@
.profile-box {
min-height: 150px;
padding: 25px;
background-color: #FFFFFF;
/* New */
.user-box {
text-align: center;
}
.profile-box .profile-picture, .profile-box .group-picture {
.status-buttons-container {
position: relative;
float: left;
width: 200px;
display: inline-block;
}
.friend-button-container {
position: relative;
float: right;
width: 200px;
display: inline-block;
}
.friend-button-container button, .status-buttons-container button {
display: block;
margin: 7px 0;
width: 200px;
font-size: 18px;
}
.empty-button {
background: none;
cursor: auto;
}
.empty-button:active {
box-shadow: none;
}
.profile-info {
display: inline-block;
min-width: 250px;
width: auto;
padding-top: 30px;
}
.main-picture {
position: relative;
border-width: 5px;
display: inline-block;
width: 150px;
height: 150px;
margin: 0 20px 20px 0;
margin-bottom: -45px;
}
/* Old */
.profile-box h1.profile-username {
padding-top: 50px;
}
@@ -18,18 +63,17 @@
}
div.posts {
padding-top: 20px;
width: calc(100% + 20px);
display: inline-flex;
}
div.posts div.post {
display: block;
margin: 20px 0 0 0;
padding: 10px;
width: calc(100% - 40px);
cursor: pointer;
transition-duration: 250ms;
word-wrap: break-word;
}
div.posts div.post:hover {
@@ -59,6 +103,12 @@ div.posts .post form textarea.newpost {
height: 100px;
}
.post .post-date {
float: right;
color: #aaaaaa;
font-size: 0.8em;
}
@media only screen and (max-width: 1500px) {
.post-box {
width: calc(50% - 68px);
@@ -66,28 +116,12 @@ div.posts .post form textarea.newpost {
}
/* mobile */
@media only screen and (max-width: 1000px) {
@media only screen and (max-width: 1080px) {
.post-box {
width: calc(100% - 65px);
}
}
.post .post-date {
float: right;
color: #aaaaaa;
font-size: 0.8em;
}
.profile-button {
float: right;
padding: 10px;
border-radius: 5px;
background-color: #4CAF50;
color: #FFFFFF;
transition-duration: 250ms;
cursor: pointer;
}
.profile-button:hover {
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
.modal {
left: 0!important;
width: 100%!important;
}
}

View File

@@ -15,3 +15,15 @@
display: inline-block;
vertical-align: top;
}
.user-pageselect, .searchleft h4, .group-pageselect, .searchright h4 {
display: inline-block;
}
.user-pageselect, .group-pageselect {
float: right;
}
li.search-item:hover{
background-color: #FBC02D;
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Class AlertMessage
* abstract class for alertMessages used in
*/
abstract class AlertMessage extends Exception {
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
abstract public function getClass();
}
/**
* Class HappyAlert
* class for a happy alert as an exception.
*/
class HappyAlert extends AlertMessage {
public function __construct($message = "Gelukt!", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
public function getClass() {
return "settings-message-happy";
}
}
/**
* Class AngryAlert
* class for an angry alert as as exception.
*/
class AngryAlert extends AlertMessage {
public function __construct($message = "Er is iets fout gegaan.", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
public function getClass() {
return "settings-message-angry";
}
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* calculates the age of a user
* @param string $bdayAsString
* @return int age
*/
function getAge(string $bdayAsString) : int {
$bday = new DateTime($bdayAsString);
$today = new DateTime("now");
$interval = $bday->diff($today);
return $interval->y;
}

View File

@@ -1,97 +1,156 @@
<?php
/**
* Function for checking inputfields
* @param variable $variable Give name of the inputfield.
* @param string $option Give the name of the option.
* @param String $variable Give name of the inputfield.
* @param String $option Give the name of the option.
* @return sets correct to false and gives value to error message if it doesn't pass the checks.
*/
function checkInputChoice($variable, $option){
if (empty($_POST[$variable])) {
$GLOBALS[$variable . "Err"] = "Verplicht!";
$GLOBALS["correct"] = false;
switch ($option) {
case "lettersAndSpaces";
checkName($variable);
break;
} else {
$GLOBALS[$variable] = test_input($_POST[$variable]);
switch ($option) {
case "lettersAndSpace":
checkonly($variable);
break;
case "bday";
validateBday($variable);
break;
case "username";
username($variable);
break;
case "username";
username($variable);
break;
case "longerEight";
longerEight($variable);
break;
case "longerEight";
longerEight($variable);
break;
case "email";
validateEmail($variable);
break;
case "email";
validateEmail($variable);
break;
default:
break;
default:
break;
}
}
}
/* Checks for only letters and spaces. */
function checkOnly($variable){
if (!preg_match("/^[a-zA-Z ]*$/",$GLOBALS[$variable])) {
$GLOBALS[$variable . "Err"] = "Alleen letters en spaties zijn toegestaan!";
$correct = false;
function checkName($variable){
if (empty($variable)) {
throw new lettersAndSpacesException("Verplicht!");
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
}
}
/* Checks for bday */
function validateBday($variable){
if (empty($variable)) {
throw new bdayException("Verplicht!");
} else {
if (!(validateDate($variable, "Y-m-d"))) {
throw new bdayException("Geen geldige datum");
} else {
$dateNow = date("Y-m-d");
if ($dateNow < $variable) {
throw new bdayException("Geen geldige datum!");
}
}
}
}
// Checks for date
function validateDate($date, $format)
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
/* checks if username exist and if its longer than 6 characters. */
function username($variable){
if (strlen($GLOBALS[$variable]) < 6) {
$GLOBALS[$variable . "Err"] = "Gebruikersnaam moet minstens 6 karakters bevatten";
$correct = false;
if (empty($variable)) {
throw new usernameException("Verplicht!");
} else if (strlen($variable) < 6) {
throw new usernameException("Moet minstens 6 karakters bevatten");
} else if (getExistingUsername() == 1) {
$GLOBALS[$variable . "Err"] = "Gebruikersnaam bestaat al";
$correct = false;
throw new usernameException("Gebruikersnaam bestaal al");
}
}
/* checks if an input is longer that 8 characters. */
function longerEight($variable){
if (strlen($GLOBALS[$variable]) < 8) {
$GLOBALS[$variable . "Err"] = "Moet minstens 8 karakters bevatten";
$correct = false;
if (empty($variable)) {
throw new passwordException("Verplicht!");
} else if (strlen($variable) < 8) {
throw new passwordException("Moet minstens 8 karakters bevatten");
}
}
/* checks if an input is a valid email. */
function validateEmail($variable){
if (!filter_var($GLOBALS[$variable], FILTER_VALIDATE_EMAIL)) {
$GLOBALS[$variable . "Err"] = "Geldige email invullen!";
$correct = false;
if (empty($variable)) {
throw new emailException("Verplicht!");
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
throw new emailException("Geldige email invullen");
} else if (getExistingEmail() == 1){
$GLOBALS[$variable . "Err"] = "Email bestaat al";
$correct = false;
throw new emailException("Email bestaal al!");
}
}
function matchEmail(){
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
throw new confirmEmailException("Emails matchen niet!");
}
}
/* checks if an input is a valid email. */
function resetEmail($variable){
if (empty($variable)) {
throw new emailException("Verplicht!");
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
throw new emailException("Geldige email invullen");
} else if (getResetEmail() == 0){
throw new emailException("Email bestaat niet!");
}
}
/* checks if two passwords matches. */
function matchPassword(){
if ($_POST["password"] != $_POST["confirmpassword"]) {
$GLOBALS["confirmpasswordErr"] = "Wachtwoorden matchen niet";
$GLOBALS["correct"] = false;
throw new confirmPasswordException("Wachtwoorden matchen niet!");
}
}
// Checks if everything is filled in correctly
function registerCheck(){
if ($GLOBALS["correct"] == false){
$GLOBALS["genericErr"] = "Bepaalde velden zijn verkeerd of niet ingevuld!";
/* Checks if captcha is correctly filled in */
function checkCaptcha($captcha){
if(!$captcha){
throw new captchaException("Captcha moet ingevuld worde!");
} else {
$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Lc72xIUAAAAAPizuF3nUbklCPljVCVzgYespz8o&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']));
if($response->success==false) {
throw new captchaException("Je bent een spammer!");
}
}
}
/* Get ip adres */
function getIp(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$GLOBALS["ip"] = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$GLOBALS["ip"] = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$GLOBALS["ip"] = $_SERVER['REMOTE_ADDR'];
}
}
/* Checks if everything is filled in correctly */
function registerCheck($status){
if ($status == false){
throw new registerException("Bepaalde velden zijn verkeerd of niet ingevuld");
} else {
registerAccount();
header("location: login.php");
}
}
@@ -102,4 +161,77 @@ function test_input($data) {
$data = htmlspecialchars($data);
return $data;
}
class lettersAndSpacesException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class bdayException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class usernameException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class passwordException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class confirmPasswordException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class emailException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class confirmEmailException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class captchaException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class registerException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
?>

View File

@@ -9,3 +9,7 @@ else {
"$dbconf->mysql_username", "$dbconf->mysql_password")
or die('Error connecting to mysql server');
}
function prepareQuery(string $query) : PDOStatement {
return $GLOBALS["db"]->prepare($query);
}

View File

@@ -0,0 +1,42 @@
<?php
function sendConfirmEmailUsername(string $username) {
$stmt = prepareQuery("
SELECT
`userID`
FROM
`user`
WHERE
`username` = :username
");
$stmt->bindParam(":username", $username);
$stmt->execute();
$userID = $stmt->fetch()["username"];
sendConfirmEmail($userID);
}
function sendConfirmEmail(int $userID) {
$stmt = prepareQuery("
SELECT
`email`,
`fname`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $userID);
$stmt->execute();
$user = $stmt->fetch();
$email = $user["email"];
$fname = $user["fname"];
$hash = password_hash($email, PASSWORD_DEFAULT);
$confirmLink = "https://myhyvesbookplus.nl/emailconfirm.php?u=$userID&h=$hash";
$subject = "Bevestig uw emailadres";
$body = "Hallo $fname,\r\n\r\nKlik op de onderstaande link om uw emailadres te bevestigen.\r\n\r\n$confirmLink\r\n\r\nGroeten MyHyvesbook+";
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
mail($email, $subject, $body, $header);
}

View File

@@ -1,15 +1,65 @@
<?php
function selectAllFriends($userID) {
$stmt = $GLOBALS["db"]->prepare("
require_once ("connect.php");
function selectFriends($userID) {
return selectLimitedFriends($userID, 9999);
}
function selectLimitedFriends($userID, $limit) {
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
'../img/avatar-standard.png'
) AS profilepicture,
`onlinestatus`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `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
`user`.`role` != 'banned' AND
`friendship`.`status` = 'confirmed'
ORDER BY
`user`.`lastactivity`
DESC
LIMIT :limitCount
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->bindParam(':limitCount', $limit, PDO::PARAM_INT);
$stmt->execute();
return json_encode($stmt->fetchAll());
}
function selectAllFriends($userID) {
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
IFNULL(
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
`role`
FROM
`user`
@@ -32,15 +82,19 @@ function selectAllFriends($userID) {
}
function selectAllFriendRequests() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
'../img/avatar-standard.png'
) AS profilepicture,
`onlinestatus`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
`role`
FROM
`user`
@@ -52,7 +106,7 @@ function selectAllFriendRequests() {
`friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`user`.`role` != 5 AND
`user`.`role` != 'banned' AND
`friendship`.`status` = 'requested'
");
@@ -61,3 +115,164 @@ function selectAllFriendRequests() {
return json_encode($stmt->fetchAll());
}
function getFriendshipStatus($userID) {
# -2: Query failed.
# -1: user1 and 2 are the same user
# 0 : no record found
# 1 : confirmed
# 2 : user1 sent request (you)
# 3 : user2 sent request (other)
if($_SESSION["userID"] == $userID) {
return -1;
}
$stmt = prepareQuery("
SELECT
CASE `status` IS NULL
WHEN TRUE THEN 0
WHEN FALSE THEN
CASE `status` = 'confirmed'
WHEN TRUE THEN
1
WHEN FALSE THEN
CASE `user1ID` = :me AND `user2ID` = :other
WHEN TRUE THEN
2
WHEN FALSE THEN
3
END
END
END AS `friend_state`
FROM
`friendship`
WHERE
`user1ID` = :other AND `user2ID` = :me OR
`user1ID` = :me AND `user2ID` = :other
");
$stmt->bindParam(':me', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->bindParam(':other', $userID, PDO::PARAM_INT);
if(!$stmt->execute()) {
return -2;
}
return intval($stmt->fetch()["friend_state"]);
}
function requestFriendship($userID) {
$stmt = prepareQuery("
INSERT INTO `friendship` (user1ID, user2ID)
VALUES (:user1, :user2)
");
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
return $stmt->execute();
}
function removeFriendship($userID) {
$stmt = prepareQuery("
DELETE FROM `friendship`
WHERE
`user1ID` = :user1 AND
`user2ID` = :user2 OR
`user1ID` = :user2 AND
`user2ID` = :user1
LIMIT 1
");
$stmt->bindParam(':user1', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->bindParam(':user2', $userID, PDO::PARAM_INT);
return $stmt->execute();
}
function acceptFriendship($userID) {
$stmt = prepareQuery("
UPDATE `friendship`
SET `status`='confirmed'
WHERE
`user1ID` = :user1 AND
`user2ID` = :user2
LIMIT 1
");
$stmt->bindParam(':user1', $userID, PDO::PARAM_INT);
$stmt->bindParam(':user2', $_SESSION["userID"], PDO::PARAM_INT);
return $stmt->execute();
}
function setLastVisited($friend) {
$stmt = prepareQuery("
UPDATE
`friendship`
SET `friendship`.chatLastVisted1=(
CASE `user1ID` = :sessionUser
WHEN TRUE THEN NOW()
WHEN FALSE THEN `chatLastVisted1`
END
),
`friendship`.`chatLastVisted2`=(
CASE `user2ID` = :sessionUser
WHEN TRUE THEN NOW()
WHEN FALSE THEN `chatLastVisted2`
END
)
WHERE
`user1ID` = :sessionUser AND
`user2ID` = :friend OR
`user2ID` = :sessionUser AND
`user1ID` = :friend;
");
$stmt->bindParam(':sessionUser', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->bindParam(':friend', $friend, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
function searchSomeFriends($n, $m, $search) {
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
IFNULL(
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `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
`user`.`role` != 'banned' AND
`friendship`.`status` = 'confirmed') AND
(`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(':userID', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return json_encode($stmt->fetchAll());
}

View File

@@ -1,7 +1,11 @@
<?php
function selectAllGroupsFromUser($userID) {
$stmt = $GLOBALS["db"]->prepare("
selectLimitedGroupsFromUser($userID, 9999);
}
function selectLimitedGroupsFromUser($userID, $limit) {
$stmt = prepareQuery("
SELECT
`group_page`.`name`,
`group_page`.`picture`
@@ -13,10 +17,40 @@ function selectAllGroupsFromUser($userID) {
`group_member`.`userID` = :userID AND
`group_member`.`groupID` = `group_page`.`groupID` AND
`group_page`.`status` != 'hidden'
LIMIT :limitCount
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->bindParam(':limitCount', $limit, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
return json_encode($stmt->fetchAll());
}
function searchSomeOwnGroups($n, $m, $search) {
$stmt = prepareQuery("
SELECT
`group_page`.`name`,
`group_page`.`picture`
FROM
`group_page`
INNER JOIN
`group_member`
WHERE
`group_member`.`userID` = :userID AND
`group_member`.`groupID` = `group_page`.`groupID` AND
`group_page`.`status` != 'hidden' AND
`name` LIKE :keyword
LIMIT
:n, :m
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return json_encode($stmt->fetchAll());
}

View File

@@ -1,7 +1,90 @@
<?php
require_once("connect.php");
function selectGroupByName($name) {
$stmt = prepareQuery("
SELECT
`group_page`.`groupID`,
`group_page`.`groupID`,
`name`,
`description`,
`picture`,
`status`,
(
SELECT `role`
FROM `group_member`
WHERE `group_member`.`groupID` = `group_page`.`groupID` AND
`userID` = :userID
) AS `role`,
COUNT(`group_member`.`groupID`) as `members`
FROM
`group_page`
LEFT JOIN
`group_member`
ON
`group_page`.`groupID` = `group_member`.`groupID`
WHERE
name LIKE :name
");
$stmt->bindParam(':name', $name, PDO::PARAM_STR);
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
if (!$stmt->execute()) {
return False;
}
return $stmt->fetch();
}
function selectGroupRole(int $groupID) {
$stmt = prepareQuery("
SELECT
`role`
FROM
`group_member`
WHERE
`groupID` = :groupID AND
`userID` = :userID
");
$stmt->bindParam(':groupID', $groupID, PDO::PARAM_INT);
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
if(!$stmt->execute()) {
return False;
}
if($stmt->rowCount() == 0) {
return "none";
}
return $stmt->fetch()["role"];
}
function selectGroupMembers(int $groupID) {
$stmt = prepareQuery("
SELECT
`username`,
`fname`,
`lname`,
`profilepicture`
FROM
`group_member`
LEFT JOIN
`user`
ON
`group_member`.`userID` = `user`.`userID`
WHERE
`groupID` = :groupID
LIMIT 20
");
$stmt->bindParam(':groupID', $groupID);
if (!$stmt->execute()) {
return False;
}
return $stmt->fetchAll();
}
function selectGroupById($groupID) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`group_page`.`name`,
`group_page`.`picture`,
@@ -20,7 +103,7 @@ function selectGroupById($groupID) {
}
function select20GroupsFromN($n) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`group_page`.`groupID`,
`group_page`.`name`,
@@ -42,7 +125,7 @@ function select20GroupsFromN($n) {
}
function select20GroupsByStatusFromN($n, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`group_page`.`groupID`,
`group_page`.`name`,
@@ -67,7 +150,7 @@ function select20GroupsByStatusFromN($n, $status) {
}
function search20GroupsFromNByStatus($n, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`groupID`,
`name`,
@@ -94,7 +177,7 @@ function search20GroupsFromNByStatus($n, $keyword, $status) {
}
function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
$q = $GLOBALS['db']->prepare("
$q = prepareQuery("
SELECT
`groupID`,
`name`,
@@ -122,7 +205,7 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
}
function countSomeGroupsByStatus($keyword, $status) {
$q = $GLOBALS['db']->prepare("
$q = prepareQuery("
SELECT
COUNT(*)
FROM
@@ -143,20 +226,23 @@ function countSomeGroupsByStatus($keyword, $status) {
}
function changeGroupStatusByID($id, $status) {
$q = $GLOBALS["db"]->query("
$q = prepareQuery("
UPDATE
`group_page`
SET
`status` = $status
`status` = :status
WHERE
`groupID` = $id
`groupID` = :id
");
$q->bindParam(':status', $status);
$q->bindParam(':id', $id);
$q->execute();
return $q;
}
function changeMultipleGroupStatusByID($ids, $status) {
$q = $GLOBALS['db']->prepare("
$q = prepareQuery("
UPDATE
`group_page`
SET
@@ -173,7 +259,7 @@ function changeMultipleGroupStatusByID($ids, $status) {
}
function searchSomeGroups($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`name`,
`picture`
@@ -192,6 +278,23 @@ function searchSomeGroups($n, $m, $search) {
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return json_encode($stmt->fetchAll());
}
function countSomeGroups($search) {
$stmt = prepareQuery("
SELECT
COUNT(*)
FROM
`group_page`
WHERE
`name` LIKE :keyword
ORDER BY
`name`
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->execute();
return $stmt;
}
?>

View File

@@ -1,12 +1,12 @@
<?php
function getHeaderInfo() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`fname`,
`lname`,
IFNULL(
`profilepicture`,
'img/notbad.jpg'
'img/avatar-standard.png'
) AS profilepicture
FROM
`user`

View File

@@ -1,17 +1,64 @@
<?php
function getUser() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`password`,
`userID`
`userID`,
`role`
FROM
`user`
WHERE
`username` LIKE :username
`username` LIKE :username OR
`email` LIKE :username
");
$stmt->bindParam(":username", $_POST["uname"]);
$stmt->bindValue(":username", test_input($_POST["user"]));
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
}
function validateLogin($username, $password){
// Empty username or password field
if (empty($username) || empty($password)) {
throw new loginException("Inloggegevens zijn niet ingevuld");
}
else {
$psw = test_input($password);
$hash = getUser()["password"];
$userID = getUser()["userID"];
$role = getUser()["role"];
// If there's an account, go to the profile page
if(password_verify($psw, $hash)) {
if ($role == "banned"){
echo "<script>
window.onload=bannedAlert();
</script>";
} else if ($role == "unconfirmed"){
sendConfirmEmail(getUser()["userID"]);
echo "<script>
window.onload=emailNotConfirmed();
</script>";
} else {
$_SESSION["userID"] = $userID;
// if($_POST[rememberMe] == 1){
// ini_set("session.gc_maxlifetime", "10");
// }
header("location: profile.php");
}
} else {
throw new loginException("Inloggevens zijn niet correct");
}
}
}
class loginException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

View File

@@ -1,39 +1,39 @@
<?php
function nicetime($date) {
if(empty($date)) {
return "No date provided";
}
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
$now = time();
$unix_date = strtotime($date);
if(empty($unix_date)) {
return "Bad date";
}
if($now > $unix_date) {
$difference = $now - $unix_date;
$tense = "geleden";
} else {
$difference = $unix_date - $now;
$tense = "vanaf nu";
}
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
$difference /= $lengths[$i];
}
$difference = round($difference);
if($difference != 1) {
$period = $multiple_periods[$i];
} else {
$period = $single_periods[$i];
}
return "$difference $period $tense";
if(empty($date)) {
return "No date provided";
}
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
$now = time();
$unix_date = strtotime($date);
if(empty($unix_date)) {
return "Bad date";
}
if($now > $unix_date) {
$difference = $now - $unix_date;
$tense = "geleden";
} else {
$difference = $unix_date - $now;
$tense = "vanaf nu";
}
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
$difference /= $lengths[$i];
}
$difference = round($difference);
if($difference != 1) {
$period = $multiple_periods[$i];
} else {
$period = $single_periods[$i];
}
return "$difference $period $tense";
}

138
website/queries/picture.php Normal file
View File

@@ -0,0 +1,138 @@
<?php
/**
* Uploads Avatar, checks it, and removes the old one.
* @param bool $group
* @throws AngryAlert
* @throws HappyAlert
*/
function updateAvatar(bool $group = false) {
$publicDir = "/var/www/html/public/";
$tmpImg = $_FILES["pp"]["tmp_name"];
$avatarDir = $group ? "uploads/groupavatar/" : "uploads/profilepictures/";
checkAvatarSize($tmpImg);
if (getimagesize($tmpImg)["mime"] == "image/gif") {
if ($_FILES["pp"]["size"] > 4000000) {
throw new AngryAlert("Bestand is te groot, maximaal 4MB toegestaan.");
}
$relativePath = $avatarDir . $_SESSION["userID"] . "_avatar.gif";
$group ? removeOldGroupAvatar($_POST["groupID"]) : removeOldUserAvatar();
move_uploaded_file($tmpImg, $publicDir . $relativePath);
} else {
$relativePath = $avatarDir . $_SESSION["userID"] . "_avatar.png";
$scaledImg = scaleAvatar($tmpImg);
$group ? removeOldGroupAvatar($_POST["groupID"]) : removeOldUserAvatar();
imagepng($scaledImg, $publicDir . $relativePath);
}
$group ? setGroupAvatarToDatabase("../" . $relativePath, $_POST["groupID"]) : setUserAvatarToDatabase("../" . $relativePath);
throw new HappyAlert("Profielfoto veranderd.");
}
/**
* Removes the old avatar from the uploads folder, for a user.
*/
function removeOldUserAvatar() {
$stmt = prepareQuery("
SELECT
`profilepicture`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
$old_avatar = $stmt->fetch()["profilepicture"];
if ($old_avatar != NULL) {
unlink("/var/www/html/public/uploads/" . $old_avatar);
}
}
/**
* Removes the old avatar from the uploads folder, for a group.
* @param int $groupID
*/
function removeOldGroupAvatar(int $groupID) {
$stmt = prepareQuery("
SELECT
`picture`
FROM
`group_page`
WHERE
groupID = :groupID
");
$stmt->bindParam(":groupID", $groupID);
$stmt->execute();
$old_avatar = $stmt->fetch()["picture"];
if ($old_avatar != NULL) {
unlink("/var/www/html/public/uploads/" . $old_avatar);
}
}
/**
* Inserts the the path to the avatar into the database, for Users.
* @param string $url path to the avatar
*/
function setUserAvatarToDatabase(string $url) {
$stmt = prepareQuery("
UPDATE
`user`
SET
`profilepicture` = :avatar
WHERE
`userID` = :userID
");
$stmt->bindParam(":avatar", $url);
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
}
/**
* Inserts the the path to the avatar into the database, for Groups.
* @param string $url path to the avatar
* @param int $groupID
*/
function setGroupAvatarToDatabase(string $url, int $groupID) {
$stmt = prepareQuery("
UPDATE
`group_page`
SET
`picture` = :avatar
WHERE
`groupID` = :groupID
");
$stmt->bindParam(":avatar", $url);
$stmt->bindParam(":groupID", $groupID);
$stmt->execute();
}
/**
* Checks the resoluton of a picture.
* @param string $img
* @throws AngryAlert
*/
function checkAvatarSize(string $img) {
$minResolution = 200;
$imgSize = getimagesize($img);
if ($imgSize[0] < $minResolution or $imgSize[1] < $minResolution) {
throw new AngryAlert("Afbeelding te klein, minimaal 200x200 pixels.");
}
}
/**
* Scales a picture, standard width is 600px.
* @param string $imgLink Path to a image file
* @param int $newWidth Custom image width.
* @return bool|resource Returns the image as an Resource.
* @throws AngryAlert
*/
function scaleAvatar(string $imgLink, int $newWidth = 600) {
$img = imagecreatefromstring(file_get_contents($imgLink));
if ($img) {
return imagescale($img, $newWidth);
} else {
throw new AngryAlert("Afbeelding wordt niet ondersteund.");
}
}

194
website/queries/post.php Normal file
View File

@@ -0,0 +1,194 @@
<?php
require_once("connect.php");
function selectAllPosts($userID, $groupID) {
$stmt = prepareQuery("
SELECT
`post`.`postID`,
`post`.`author`,
`title`,
CASE LENGTH(`post`.`content`) >= 150 AND `post`.`content` NOT LIKE '<img%'
WHEN TRUE THEN
CONCAT(LEFT(`post`.`content`, 150), '...')
WHEN FALSE THEN
`post`.`content`
END
AS `content`,
`post`.`creationdate`,
COUNT(DISTINCT `commentID`) AS `comments`,
COUNT(DISTINCT `niet_slecht`.`postID`) AS `niet_slechts`
FROM
`post`
LEFT JOIN
`niet_slecht`
ON
`post`.`postID` = `niet_slecht`.`postID`
LEFT JOIN
`comment`
ON
`post`.`postID` = `comment`.`postID`
WHERE
`post`.`author` = :userID AND
`groupID` IS NULL OR
`groupID` = :groupID
GROUP BY
`post`.`postID`
ORDER BY
`post`.`creationdate` DESC
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->bindParam(':groupID', $groupID , PDO::PARAM_INT);
if(!$stmt->execute()) {
return False;
}
return $stmt;
}
function selectPostById($postID) {
$stmt = prepareQuery("
SELECT
`user`.`fname`,
`user`.`lname`,
`user`.`username`,
`post`.`groupID`,
`post`.`title`,
`post`.`content`,
`post`.`creationdate`
FROM
`post`
INNER JOIN
`user`
ON
`post`.`author` = `user`. `userID`
WHERE
`post`.`postID` = :postID
");
$stmt->bindParam(':postID', $postID);
$stmt->execute();
return $stmt;
}
function selectCommentsByPostId($postID) {
$stmt = prepareQuery("
SELECT
`comment`.`commentID`,
`comment`.`postID`,
`comment`.`author`,
`comment`.`content`,
`comment`.`creationdate`,
`user`.`fname`,
`user`.`lname`,
`user`.`username`
FROM
`comment`
INNER JOIN
`user`
ON
`comment`.`author` = `user`.`userID`
WHERE
`comment`.`postID` = :postID
");
$stmt->bindParam(':postID', $postID);
$stmt->execute();
return $stmt;
}
function makePost($userID, $groupID, $title, $content) {
$stmt = prepareQuery("
INSERT INTO
`post` (
`author`,
`groupID`,
`title`,
`content`
)
VALUES (
:userID,
:groupID,
:title,
:content
)
");
$stmt->bindParam(':userID', $userID);
$stmt->bindParam(':groupID', $groupID);
$stmt->bindParam(':title', $title);
$stmt->bindParam(':content', $content);
$stmt->execute();
}
function makeComment($postID, $userID, $content) : int {
$stmt = prepareQuery("
INSERT INTO
`comment` (
`postID`,
`author`,
`content`
)
VALUES (
:postID,
:userID,
:content
)
");
$stmt->bindParam(':postID', $postID);
$stmt->bindParam(':userID', $userID);
$stmt->bindParam(':content', $content);
$stmt->execute();
return $stmt->rowCount();
}
function makeNietSlecht(int $postID, int $userID) : int {
if (checkNietSlecht($postID, $userID)) {
return deleteNietSlecht($postID, $userID);
} else {
return addNietSlecht($postID, $userID);
}
}
function checkNietSlecht(int $postID, int $userID) {
$stmt = prepareQuery("
SELECT
*
FROM
`niet_slecht`
WHERE
`userID` = :userID AND
`postID` = :postID
");
$stmt->bindParam(":userID", $userID);
$stmt->bindParam(":postID", $postID);
$stmt->execute();
return $stmt->rowCount();
}
function addNietSlecht(int $postID, int $userID) {
$stmt = prepareQuery("
INSERT INTO
`niet_slecht` (`userID`, `postID`)
VALUES (:userID, :postID)
");
$stmt->bindParam(":userID", $userID);
$stmt->bindParam(":postID", $postID);
$stmt->execute();
return $stmt->rowCount();
}
function deleteNietSlecht(int $postID, int $userID) {
$stmt = prepareQuery("
DELETE FROM
`niet_slecht`
WHERE
`userID` = :userID AND
`postID` = :postID
");
$stmt->bindParam(":userID", $userID);
$stmt->bindParam(":postID", $postID);
$stmt->execute();
return $stmt->rowCount();
}

View File

@@ -1,74 +1,130 @@
<?php
function getOldChatMessages($user2ID) {
require_once ("friendship.php");
$user1ID = $_SESSION["userID"];
if (getFriendshipStatus($user2ID) == 1) {
$stmt = prepareQuery("
SELECT
*
FROM
`private_message`
WHERE
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1
ORDER BY
`creationdate` ASC
LIMIT
100
");
$stmt = $GLOBALS["db"]->prepare("
SELECT
*
FROM
`private_message`
WHERE
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1
ORDER BY
`messageID` ASC
");
$stmt->bindParam(":user1", $user1ID);
$stmt->bindParam(":user2", $user2ID);
$stmt->bindParam(":user1", $user1ID);
$stmt->bindParam(":user2", $user2ID);
$stmt->execute();
$stmt->execute();
return json_encode($stmt->fetchAll());
return json_encode($stmt->fetchAll());
} else {
return "[]";
}
}
function sendMessage($destination, $content) {
$stmt = $GLOBALS["db"]->prepare("
INSERT INTO
`private_message`
(
`origin`,
`destination`,
`content`
)
VALUES
(
:origin,
:destination,
:content
)
");
require_once("friendship.php");
if (getFriendshipStatus($destination) == 1) {
$stmt = prepareQuery("
INSERT INTO
`private_message`
(
`origin`,
`destination`,
`content`
)
VALUES
(
:origin,
:destination,
:content
)
");
return $stmt->execute(array(
"origin" => $_SESSION["userID"],
"destination" => $destination,
"content" => $content
));
return $stmt->execute(array(
"origin" => $_SESSION["userID"],
"destination" => $destination,
"content" => $content
));
} else {
return false;
}
}
function getNewChatMessages($lastID, $destination) {
$stmt = $GLOBALS["db"]->prepare("
require_once("friendship.php");
if (getFriendshipStatus($destination) == 1) {
$stmt = prepareQuery("
SELECT
*
FROM
`private_message`
WHERE
(
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1) AND
`messageID` > :lastID
ORDER BY
`creationdate` ASC
");
$stmt->bindParam(':user1', $_SESSION["userID"]);
$stmt->bindParam(':user2', $destination);
$stmt->bindParam(':lastID', $lastID);
$stmt->execute();
return json_encode($stmt->fetchAll());
} else {
return "[]";
}
}
function selectAllUnreadChat() {
$stmt = prepareQuery("
SELECT
*
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
`user`.`userID`,
IFNULL(
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
LEFT(`private_message`.`content`, 15) AS `content`
FROM
`private_message`
`private_message`,
`friendship`,
`user`
WHERE
(
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1) AND
`messageID` > :lastID
ORDER BY
`messageID` ASC
(`friendship`.user2ID = `private_message`.`origin` AND
`friendship`.user1ID = `private_message`.`destination` AND
(`friendship`.chatLastVisted1 < `private_message`.`creationdate` OR
`friendship`.chatLastVisted1 IS NULL) OR
`friendship`.user1ID = `private_message`.`origin` AND
`friendship`.user2ID = `private_message`.`destination` AND
(`friendship`.chatLastVisted2 < `private_message`.`creationdate` OR
`friendship`.chatLastVisted2 IS NULL)) AND
`private_message`.`origin` = `user`.`userID` AND
`private_message`.`destination` = :userID AND
`user`.`role` != 'banned' AND
`friendship`.`status` = 'confirmed'
GROUP BY `user`.`userID`
");
$stmt->bindParam(':user1', $_SESSION["userID"]);
$stmt->bindParam(':user2', $destination);
$stmt->bindParam(':lastID', $lastID);
$stmt->bindParam(':userID', $_SESSION["userID"]);
$stmt->execute();

View File

@@ -1,7 +1,7 @@
<?php
function getExistingUsername() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`username`
FROM
@@ -10,14 +10,14 @@ function getExistingUsername() {
`username` LIKE :username
");
$stmt->bindParam(":username", $_POST["username"]);
$stmt->bindValue(":username", test_input($_POST["username"]));
$stmt->execute();
return $stmt->rowCount();
}
function getExistingEmail() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`email`
FROM
@@ -26,14 +26,30 @@ function getExistingEmail() {
`email` LIKE :email
");
$stmt->bindParam(":email", $_POST["email"]);
$stmt->bindValue(":email", test_input($_POST["email"]));
$stmt->execute();
return $stmt->rowCount();
}
function getResetEmail() {
$stmt = prepareQuery("
SELECT
`email`
FROM
`user`
WHERE
`email` LIKE :email
");
$stmt->bindValue(":email", test_input($_POST["forgotEmail"]));
$stmt->execute();
return $stmt->rowCount();
}
function registerAccount() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
INSERT INTO
`user`(fname,
lname,
@@ -54,15 +70,21 @@ function registerAccount() {
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
$stmt->bindParam(":fname", $_POST["name"]);
$stmt->bindParam(":lname", $_POST["surname"]);
$stmt->bindParam(":bday", $_POST["bday"]);
$stmt->bindParam(":username", $_POST["username"]);
$stmt->bindParam(":password", $hash);
$stmt->bindParam(":location", $_POST["location"]);
$stmt->bindParam(":email", (strtolower($_POST["email"])));
$stmt->bindValue(":fname", test_input($_POST["name"]));
$stmt->bindValue(":lname", test_input($_POST["surname"]));
$stmt->bindValue(":bday", test_input($_POST["bday"]));
$stmt->bindValue(":username", test_input($_POST["username"]));
$stmt->bindValue(":password", test_input($hash));
$stmt->bindValue(":location", test_input($_POST["location"]));
$stmt->bindValue(":email", test_input(strtolower($_POST["email"])));
$stmt->execute();
$stmt->rowCount();
}
function submitselect($date, $value){
if ($date == $value){
echo "selected";
}
}
?>

View File

@@ -0,0 +1,54 @@
<?php
include_once "../queries/connect.php";
function sendPasswordRecovery(string $email) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$stmt = prepareQuery("
SELECT
`userID`,
`username`
FROM
`user`
WHERE
`email` = :email
");
$stmt->bindParam(":email", $email);
$stmt->execute();
if (!$stmt->rowCount()) {
return;
}
$result = $stmt->fetch();
$userID = $result["userID"];
$username = $result["username"];
$hash = md5(random_int(0, 1000000));
$hashedHash = password_hash($hash, PASSWORD_DEFAULT);
setHashToDatabase($userID, $hash);
doSendPasswordRecovery($userID, $email, $username, $hashedHash);
} else {
// TODO: Be angry!
}
}
function doSendPasswordRecovery(int $userID, string $email, string $username, string $hash) {
$resetLink = "https://myhyvesbookplus.nl/resetpassword.php?u=$userID&h=$hash";
$subject = "Reset uw wachtwoord";
$body = "Hallo $username,\r\n\r\nKlik op de onderstaande link om uw wachtwoord te resetten.\r\n\r\n$resetLink\r\n\r\nGroeten MyHyvesbook+";
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
mail($email, $subject, $body, $header);
}
function setHashToDatabase(int $userID, string $hash) {
$stmt = prepareQuery("
UPDATE
`user`
SET
`password` = :hash
WHERE
`userID` = :userID
");
$stmt->bindParam(":hash", $hash);
$stmt->bindParam(":userID", $userID);
$stmt->execute();
$stmt->rowCount();
}

View File

@@ -1,44 +1,14 @@
<?php
class settingsMessage {
private $class;
private $message;
/**
* settingsMessage constructor.
* @param string $type Happy or angry
* @param string $message The message to display
*/
public function __construct($type, $message) {
$this->message = $message;
switch ($type) {
case "happy":
$this->class = "settings-message-happy";
break;
case "angry":
$this->class = "settings-message-angry";
break;
default:
$this->class = "settings-message";
break;
}
}
public function getClass() {
return $this->class;
}
public function getMessage() {
return $this->message;
}
}
include_once "../queries/emailconfirm.php";
include_once "../queries/picture.php";
include_once "../queries/alerts.php";
/**
* Gets the settings form the database.
* @return mixed Setting as an array.
*/
function getSettings() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`fname`,
`lname`,
@@ -46,7 +16,9 @@ function getSettings() {
`location`,
`birthdate`,
`bio`,
`profilepicture`
`profilepicture`,
`showBday`,
`showEmail`
FROM
`user`
WHERE
@@ -58,8 +30,12 @@ function getSettings() {
return $stmt->fetch();
}
/**
* Gets the passwordHas form the database
* @return mixed passwordhash
*/
function getPasswordHash() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`password`,
`username`
@@ -73,8 +49,12 @@ function getPasswordHash() {
return $stmt->fetch();
}
/**
* Changes the setting from post.
* @throws HappyAlert
*/
function updateSettings() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET
@@ -82,41 +62,60 @@ function updateSettings() {
`lname` = :lname,
`location` = :location,
`birthdate` = :bday,
`bio` = :bio
`bio` = :bio,
`showEmail` = :showEmail,
`showBday` = :showBday
WHERE
`userID` = :userID
");
$bday = new DateTime();
$bday->setDate(test_input($_POST["year"]), test_input($_POST["month"]), test_input($_POST["day"]));
checkBday($bday);
$stmt->bindValue(":fname", test_input($_POST["fname"]));
$stmt->bindValue(":lname", test_input($_POST["lname"]));
$stmt->bindValue(":location", test_input($_POST["location"]));
$stmt->bindValue(":bday", test_input($_POST["bday"]));
$stmt->bindValue(":bday", $bday->format("Ymd"));
$stmt->bindValue(":bio", test_input($_POST["bio"]));
$stmt->bindValue(":showEmail", (array_key_exists("showEmail", $_POST) ? "1" : "0"));
$stmt->bindValue(":showBday", (array_key_exists("showBday", $_POST) ? "1" : "0"));
$stmt->bindValue(":userID", $_SESSION["userID"]);
$stmt->execute();
return new settingsMessage("happy", "Instellingen zijn opgeslagen.");
throw new HappyAlert("Instellingen zijn opgeslagen.");
}
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 (doChangePassword()) {
return new settingsMessage("happy", "Wachtwoord gewijzigd.");
} else {
return new settingsMessage("angry", "Er is iets mis gegaan.");
}
} else {
return new settingsMessage("angry", "Wachtwoorden komen niet oveen.");
}
} else {
return new settingsMessage("angry", "Oud wachtwoord niet correct.");
function checkBday(DateTime $bday) {
$today = new DateTime();
if ($bday >= $today) {
throw new AngryAlert("Jij bent vast niet in de toekomst geboren toch? ;)");
}
}
/**
* Change
* @throws AngryAlert
*/
function changePassword() {
$user = getPasswordHash();
if (password_verify($_POST["password-old"], test_input($user["password"]))) {
if (test_input($_POST["password-new"]) == test_input($_POST["password-confirm"]) && (strlen(test_input($_POST["password-new"])) >= 8)) {
doChangePassword();
} else {
throw new AngryAlert("Wachtwoorden komen niet overeen.");
}
} else {
throw new AngryAlert("Oud wachtwoord niet correct.");
}
}
/**
* @throws AngryAlert
* @throws HappyAlert
*/
function doChangePassword() {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET
@@ -129,34 +128,32 @@ function doChangePassword() {
$stmt->bindParam(":new_password", $hashed_password);
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
return $stmt->rowCount();
if ($stmt->rowCount()) {
throw new HappyAlert("Wachtwoord gewijzigd.");
} else {
throw new AngryAlert();
}
}
function changeEmail() {
if ($_POST["email"] == $_POST["email-confirm"]) {
$email = strtolower($_POST["email"]);
if (test_input($_POST["email"]) == test_input($_POST["email-confirm"])) {
$email = strtolower(test_input($_POST["email"]));
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
//check if email exists
if (emailIsAvailableInDatabase($email)) {
if (doChangeEmail($email)) {
return new settingsMessage("happy", "Emailadres is veranderd.");
} else {
return new settingsMessage("angry", "Er is iets mis gegaan.");
}
} else {
return new settingsMessage("angry", "Emailadres bestaat al.");
}
emailIsAvailableInDatabase($email);
doChangeEmail($email);
} else {
return new settingsMessage("angry", "Geef een geldig emailadres.");
throw new AngryAlert("Geef een geldig emailadres");
}
} else {
return new settingsMessage("angry", "Emailadressen komen niet overeen.");
throw new AngryAlert("Emailadressen komen niet overeen.");
}
}
function emailIsAvailableInDatabase($email) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`email`
FROM
@@ -167,58 +164,30 @@ function emailIsAvailableInDatabase($email) {
$stmt->bindParam(":email", $email);
$stmt->execute();
return !$stmt->rowCount();
if ($stmt->rowCount()) {
throw new AngryAlert("Emailadres wordt al gebruikt.");
}
}
function doChangeEmail($email) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
UPDATE
`user`
SET
`email` = :email
`email` = :email,
`role` = 'unconfirmed'
WHERE
`userID` = :userID
");
$stmt->bindParam(":email", $email);
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
return $stmt->rowCount();
}
function updateProfilePicture() {
$profilePictureDir = "/var/www/html/public/";
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
removeOldProfilePicture();
move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath);
setProfilePictureToDatabase("../" . $relativePath);
}
function removeOldProfilePicture() {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`profilepicture`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
$old_avatar = $stmt->fetch()["profilepicture"];
unlink("/var/www/html/public/uploads/" . $old_avatar);
}
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();
if ($stmt->rowCount()) {
sendConfirmEmail($_SESSION["userID"]);
session_destroy();
throw new HappyAlert("Emailadres is veranderd.");
} else {
throw new AngryAlert();
}
}

View File

@@ -1,9 +1,22 @@
<?php
require("connect.php");
require_once ("connect.php");
function updateLastActivity() {
$stmt = prepareQuery("
UPDATE
`user`
SET
`lastactivity` = NOW()
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $_SESSION["userID"]);
return $stmt->execute();
}
function getUserID($username) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`
FROM
@@ -17,33 +30,75 @@ function getUserID($username) {
return $stmt->fetch()["userID"];
}
function selectUser($userID) {
$stmt = $GLOBALS["db"]->prepare("
function getUsername($userID) {
$stmt = prepareQuery("
SELECT
`username`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
) AS profilepicture,
`bio`,
`role`,
`onlinestatus`,
`loggedin`,
`fname`,
`lname`
`username`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->bindParam(':userID', $userID, PDO::PARAM_STR);
$stmt->execute();
return $stmt->fetch()["username"];
}
function selectUser($me, $other) {
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
`birthdate`,
`location`,
IFNULL(
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
`bio`,
`user`.`creationdate`,
CASE `lastactivity` >= DATE_SUB(NOW(),INTERVAL 15 MINUTE)
WHEN TRUE THEN 'online'
WHEN FALSE THEN 'offline'
END AS `onlinestatus`,
`role`,
`fname`,
`lname`,
CASE `status` IS NULL
WHEN TRUE THEN 0
WHEN FALSE THEN
CASE `status` = 'confirmed'
WHEN TRUE THEN
1
WHEN FALSE THEN
CASE `user1ID` = `userID` AND `user2ID` = :me
WHEN TRUE THEN
2
WHEN FALSE THEN
3
END
END
END AS `friend_status`
FROM
`user`
LEFT JOIN
`friendship`
ON
`user1ID` = `userID` AND `user2ID` = :me OR
`user1ID` = :me AND `user2ID` = `userID`
WHERE
`user`.`userID` = :other
");
$stmt->bindParam(':me', $me, PDO::PARAM_INT);
$stmt->bindParam(':other', $other, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetch();
}
function selectAllUserGroups($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`group_page`.`groupID`,
`name`,
@@ -57,29 +112,7 @@ function selectAllUserGroups($userID) {
`group_page`.`groupID` = `group_member`.`groupID`
WHERE
`userID` = :userID AND
`role` = 1
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
function selectAllUserPosts($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`postID`,
`author`,
`title`,
`content`,
`creationdate`
FROM
`post`
WHERE
`author` = :userID AND
`groupID` IS NULL
ORDER BY
`creationdate` DESC
`role` = 'member'
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
@@ -88,7 +121,7 @@ function selectAllUserPosts($userID) {
}
function select20UsersFromN($n) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -109,7 +142,7 @@ function select20UsersFromN($n) {
}
function search20UsersFromN($n, $keyword) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -133,7 +166,7 @@ function search20UsersFromN($n, $keyword) {
}
function search20UsersFromNByStatus($n, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -161,7 +194,7 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
}
function searchSomeUsersByStatus($n, $m, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
`userID`,
`username`,
@@ -190,7 +223,7 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
}
function countSomeUsersByStatus($keyword, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
SELECT
COUNT(*)
FROM
@@ -213,7 +246,7 @@ function countSomeUsersByStatus($keyword, $status) {
function changeUserStatusByID($id, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
UPDATE
`user`
SET
@@ -229,7 +262,7 @@ function changeUserStatusByID($id, $status) {
}
function changeMultipleUserStatusByID($ids, $status) {
$q = $GLOBALS["db"]->prepare("
$q = prepareQuery("
UPDATE
`user`
SET
@@ -245,8 +278,27 @@ function changeMultipleUserStatusByID($ids, $status) {
return $q;
}
function changeMultipleUserStatusByIDAdmin($ids, $status) {
$q = prepareQuery("
UPDATE
`user`
SET
`role` = :status
WHERE
FIND_IN_SET (`userID`, :ids)
AND NOT `role` = 'admin'
AND NOT `role` = 'owner'
");
$ids = implode(',', $ids);
$q->bindParam(':ids', $ids);
$q->bindParam(':status', $status);
$q->execute();
return $q;
}
function selectRandomNotFriendUser($userID) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`user`.`username`
FROM
@@ -274,18 +326,22 @@ function selectRandomNotFriendUser($userID) {
}
function searchSomeUsers($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
$stmt = prepareQuery("
SELECT
`userID`,
`username`,
`profilepicture`,
`fname`,
`lname`
IFNULL(
`profilepicture`,
'../img/avatar-standard.png'
) AS profilepicture,
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`
FROM
`user`
WHERE
`username` LIKE :keyword OR
(`username` LIKE :keyword OR
`fname` LIKE :keyword OR
`lname` LIKE :keyword
`lname` LIKE :keyword) AND
`role` != 'banned'
ORDER BY
`fname`,
`lname`,
@@ -298,6 +354,61 @@ function searchSomeUsers($n, $m, $search) {
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return json_encode($stmt->fetchAll());
}
function countSomeUsers($search) {
$q = prepareQuery("
SELECT
COUNT(*)
FROM
`user`
WHERE
(`username` LIKE :keyword OR
`fname` LIKE :keyword OR
`lname` LIKE :keyword) AND
`role` != 'banned'
ORDER BY
`fname`,
`lname`,
`username`
");
$search = "%$search%";
$q->bindParam(':keyword', $search);
$q->execute();
return $q;
}
function getRoleByID($userID) {
$stmt = prepareQuery("
SELECT
`role`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(':userID', $userID);
$stmt->execute();
return $stmt->fetch()["role"];
}
function editBanCommentByID($userID, $comment) {
$stmt = prepareQuery("
UPDATE
`user`
SET
`bancomment` = :comment
WHERE
`userID` = :userID
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->bindParam(':comment', $comment);
$stmt->execute();
return $stmt;
}

View File

@@ -0,0 +1,46 @@
<tr>
<th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll(this)"></th>
<th class="table-username">Gebruikersnaam</th>
<th class="table-status">Status</th>
<th class="table-comment">Aantekening</th>
<th class="table-action">Actie</th>
</tr>
<?php
print_r($_POST);
$q = searchSomeGroupsByStatus($offset, $entries, $search, $groupstatus);
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
$groupID = $group['groupID'];
$name = $group['name'];
$role = $group['status'];
$description = $group['description'];
echo("
<tr>
<td><input type='checkbox'
name='checkbox-group[]'
class='checkbox-list'
value='$groupID'
form='admin-groupbatchform'
onchange='checkCheckAll();'>
</td>
<td>$name</td>
<td>$role</td>
<td>$description</td>
<td>
<form class='admin-groupaction'
onsubmit=\"adminUpdate(this); return false;\">
<select class='action' name='actions'>
<option value='hidden'>Hidden</option>
<option value='public'>Public</option>
<option value='membersonly'>Members</option>
</select>
<input type='hidden' name='groupID' value='$groupID'>
<input type='submit' value='Confirm'>
</form>
</td>
</tr>
");
}

View File

@@ -0,0 +1,30 @@
<?php
if ($pagetype == "user") {
$pages = countSomeUsersByStatus($search, $status);
} else {
$pages = countSomeGroupsByStatus($search, $groupstatus);
}
$countresults = $pages->fetchColumn();
?>
Pagina:
<select class="admin-pageselect"
name="currentpage"
id="currentpage"
form="admin-searchform"
onchange="adminSearch();">
<?php
for ($i=1; $i <= ceil($countresults / $entries); $i++) {
if ($currentpage == $i) {
echo "<option value='$i' selected>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
?>
</select>
<?php
$n = min($offset + 1, $countresults);
$m = min($offset + $entries, $countresults);
echo " $n tot $m ($countresults totaal)";
?>

View File

@@ -0,0 +1,73 @@
<tr>
<th><input class="table-checkbox" type="checkbox" id="checkall" name="checkall" onchange="checkAll()"></th>
<th class="table-username">Gebruikersnaam</th>
<th class="table-status">Status</th>
<th class="table-comment">Aantekening</th>
<th class="table-action">Actie</th>
</tr>
<!-- Table construction via php PDO. -->
<?php
$q = searchSomeUsersByStatus($offset, $entries, $search, $status);
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
$userID = $user['userID'];
$username = $user['username'];
$role = $user['role'];
$bancomment = $user['bancomment'];
echo("
<tr>
<td>
<input type='checkbox'
name='checkbox-user[]'
class='checkbox-list'
value='$userID'
form='admin-batchform'
onchange='checkCheckAll();'>
</td>
<td>$username</td>
<td>$role</td>
<td>
<div class='bancomment'>$bancomment</div>
<div class='bancommentedit'>
<form class='bancommentform'
id='bancommentform'
onsubmit='editComment(this);
return false;'>
<input type='text'
name='bancommenttext'
placeholder='Schrijf een aantekening'
value='$bancomment'>
<input type='hidden'
name='bancommentuserID'
value='$userID'>
<button type='submit'>Update</button>
</form>
</div>
<button type='button' onclick='toggleBancomment(this)'>Verander</button>
</td>
<td>
<form class='admin-useraction'
onsubmit=\"adminUpdate(this); return false;\">
<select class='action' name='actions'>");
if (!($userinfo == 'admin'
AND ($user['role'] == 'admin'
OR $user['role'] == 'owner'))) {
echo "<option value='frozen'>Bevries</option>
<option value='banned'>Ban</option>
<option value='user'>Activeer</option>";
if ($userinfo == 'owner') {
echo "<option value='admin'>Admin</option>
<option value='owner'>Owner</option>";
}
}
echo ("</select>
<input type='hidden' name='userID' value='$userID'>
<input type='submit' value='Confirm'>
</form>
</td>
</tr>
");
}

View File

@@ -1,23 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Admin Panel</title>
<script src="/js/admin.js" charset="utf-8"></script>
<?php
include_once("../queries/user.php");
include_once("../queries/group_page.php");
?>
</head>
<body>
<!-- function test_input taken from http://www.w3schools.com/php/php_form_validation.asp -->
<?php
$search = "";
$currentpage = 1;
$perpage = 20;
$status = $groupstatus = array();
$status = array("user", "frozen", "banned", "unconfirmed", "admin", "owner");
$groupstatus = array("hidden", "public", "membersonly");
$pagetype = "user";
$userinfo = getRoleByID($_SESSION['userID']);
if (isset($_GET["search"])) {
$search = test_input($_GET["search"]);
@@ -35,277 +23,132 @@ if (isset($_GET["groupstatus"])) {
$groupstatus = $_GET["groupstatus"];
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST["actions"]) && isset($_POST["userID"])) {
changeUserStatusByID($_POST["userID"], $_POST["actions"]);
}
if (isset($_POST["actions"]) && isset($_POST["groupID"])) {
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
}
if (isset($_POST["batchactions"]) && isset($_POST["checkbox-user"])) {
changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
}
if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) {
changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]);
}
if (isset($_POST["pageselect"])) {
$currentpage = $_POST["pageselect"];
}
}
$listn = ($currentpage-1) * $perpage;
$listm = $currentpage * $perpage;
?>
<div class="content">
<div class="platform admin-panel">
<div class="admin-title">
<h1>User Management Panel</h1>
</div> <br>
<h5>Zoek naar gebruikers of groepen:</h5>
<div class="admin-options">
<form class="admin-searchform"
action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
id="admin-searchform"
action="javascript:searchFromOne();"
method="get">
<div class="admin-searchbar">
<h2>Search</h2>
<input type="text"
name="search"
class="admin-searchinput"
value="<?php echo $search;?>"> <br>
<input type="submit" value="Search">
Zoek: <input type="text"
name="search"
class="admin-searchinput"
placeholder="Naam"
value="<?php echo $search;?>">
Op: <select name="pagetype" id="pagetype" onchange="changeFilter()">
<option value="user"
<?php if (isset($pagetype) && $pagetype=="user") echo "selected";?>>
Gebruiker
</option>
<option value="group"
<?php if (isset($pagetype) && $pagetype=="group") echo "selected";?>>
Groep
</option>
</select>
<button type="submit"><i class="fa fa-search"></i></button>
</div>
<div class="admin-filter" id="admin-filter">
<h2>Show:</h2>
<input type="checkbox" name="status[]" id="normal" value="1"
<?php if (in_array("1", $status)) echo "checked";?>>
<label for="normal">Normal</label><br>
<input type="checkbox" name="status[]" id="frozen" value="2"
<?php if (in_array("2", $status)) echo "checked";?>>
<label for="frozen">Frozen</label><br>
<input type="checkbox" name="status[]" id="banned" value="3"
<?php if (in_array("3", $status)) echo "checked";?>>
<label for="banned">Banned</label><br>
<input type="checkbox" name="status[]" id="admin" value="5"
<?php if (in_array("5", $status)) echo "checked";?>>
<div id="admin-filter">
<h5>Type gebruiker:</h5>
<input type="checkbox"
name="status[]"
id="normal"
value="user"
<?php if (in_array("user", $status)) echo "checked";?>>
<label for="normal">Normaal</label><br>
<input type="checkbox"
name="status[]"
id="frozen"
value="frozen"
<?php if (in_array("frozen", $status)) echo "checked";?>>
<label for="frozen">Gefrozen</label><br>
<input type="checkbox"
name="status[]"
id="banned"
value="banned"
<?php if (in_array("banned", $status)) echo "checked";?>>
<label for="banned">Gebant</label><br>
<input type="checkbox"
name="status[]"
id="admin"
value="admin"
<?php if (in_array("admin", $status)) echo "checked";?>>
<label for="admin">Admin</label><br>
<input type="checkbox" name="status[]" id="unvalidated" value="0"
<?php if (in_array("0", $status)) echo "checked";?>>
<label for="unvalidated">Unvalidated</label><br>
<input type="checkbox" name="status[]" id="owner" value="42"
<?php if (in_array("42", $status)) echo "checked";?>>
<input type="checkbox"
name="status[]"
id="unvalidated"
value="unconfirmed"
<?php if (in_array("unconfirmed", $status)) echo "checked";?>>
<label for="unvalidated">Ongevalideerd</label><br>
<input type="checkbox"
name="status[]"
id="owner"
value="owner"
<?php if (in_array("owner", $status)) echo "checked";?>>
<label for="owner">Owner</label>
</div>
<div class="admin-groupfilter" id="admin-groupfilter">
<h2>Show:</h2>
<input type="checkbox" name="groupstatus[]" id="hidden" value="0"
<?php if (in_array("0", $groupstatus)) echo "checked";?>>
<label for="hidden">Hidden</label><br>
<input type="checkbox" name="groupstatus[]" id="public" value="1"
<?php if (in_array("1", $groupstatus)) echo "checked";?>>
<label for="public">Public</label><br>
<input type="checkbox" name="groupstatus[]" id="membersonly" value="2"
<?php if (in_array("2", $groupstatus)) echo "checked";?>>
<label for="membersonly">Members-only</label><br>
</div>
<div class="admin-filtertype">
<h2>Page Type:</h2>
<input type="radio" name="pagetype" id="user" value="user"
<?php if (isset($pagetype) && $pagetype=="user") echo "checked";?>
onchange="changeFilter()">
<label for="user">Users</label><br>
<input type="radio" name="pagetype" id="group" value="group"
<?php if (isset($pagetype) && $pagetype=="group") echo "checked";?>
onchange="changeFilter()">
<label for="group">Groups</label>
<div id="admin-groupfilter">
<h5>Type groep:</h5>
<input type="checkbox" name="groupstatus[]" id="hidden" value="hidden"
<?php if (in_array("hidden", $groupstatus)) echo "checked";?>>
<label for="hidden">Verborgen</label><br>
<input type="checkbox" name="groupstatus[]" id="public" value="public"
<?php if (in_array("public", $groupstatus)) echo "checked";?>>
<label for="public">Publiek</label><br>
<input type="checkbox" name="groupstatus[]" id="membersonly" value="membersonly"
<?php if (in_array("membersonly", $groupstatus)) echo "checked";?>>
<label for="membersonly">Alleen Leden</label><br>
</div>
</form>
</div>
<div class="admin-users">
<div class="admin-usertitle">
<h4>Resultaat:</h4>
<div style="float: right" id="admin-pageinfo">
<div class="admin-batchactions" id="admin-batchactions">
<h2>Batch Actions: </h2>
<form class="admin-batchform"
id="admin-batchform"
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
method="post">
<input type="radio" name="batchactions" id="freeze" value="2">
<label for="freeze">Freeze</label><br>
<input type="radio" name="batchactions" id="ban" value="3">
<label for="ban">Ban</label><br>
<input type="radio" name="batchactions" id="restore" value="1">
<label for="restore">Restore</label><br><br>
<input type="submit" value="Confirm">
</form>
</div>
<form id="admin-batchform"
onsubmit="adminUpdate(this); return false;">
<div class="admin-groupbatchactions" id="admin-groupbatchactions">
<h2>Batch Actions: </h2>
<form class="admin-groupbatchform"
id="admin-groupbatchform"
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
method="post">
<input type="radio" name="groupbatchactions" id="hide" value="0">
<label for="hide">Hide</label><br>
<input type="radio" name="groupbatchactions" id="public" value="1">
<label for="public">Public</label><br>
<input type="radio" name="groupbatchactions" id="membersonly" value="2">
<label for="membersonly">Member</label><br><br>
<input type="submit" value="Confirm">
</form>
</div>
</div>
<br>
<div class="admin-users">
<div class="admin-usertitle">
<div class="admin-userheading">
<h2>Users:</h2>
</div>
<div class="admin-pageui">
<?php
if ($pagetype == "user") {
$pages = countSomeUsersByStatus($search, $status);
} else {
$pages = countSomeGroupsByStatus($search, $groupstatus);
}
$countresults = $pages->fetchColumn();
$mincount = min($listm, $countresults);
$minlist = min($listn + 1, $countresults);
?>
<p class="pagenumber">Current page:</p>
<form class="admin-pageselector"
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
method="post">
<select class="admin-pageselect"
name="pageselect"
onchange="this.form.submit()"
value="">
<?php
for ($i=1; $i <= ceil($countresults / $perpage); $i++) {
if ($currentpage == $i) {
echo "<option value='$i' selected>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
?>
</select>
</form>
<p class="entriesshown">
<?php
echo "Showing results $minlist to $mincount out of $countresults";
?>
</div>
</div> <br>
<table class="usertable">
<tr>
<th class="table-checkbox">
<input type="checkbox" id="checkall" name="checkall" onchange="checkAll(this)">
</th>
<th class="table-username">User</th>
<th class="table-status">Status</th>
<th class="table-comment">Comment</th>
<th class="table-action">Action</th>
</tr>
<!-- Table construction via php PDO. -->
<input type="hidden" name="batchactions" id="batchinput">
<button type="submit" name="batchactions" id="freeze" value="frozen">Bevries</button>
<button type="submit" name="batchactions" id="ban" value="banned">Ban</button>
<button type="submit" name="batchactions" id="restore" value="user">Activeer</button>
<?php
$listn = ($currentpage-1) * $perpage;
$listm = $currentpage * $perpage;
if ($pagetype == 'user') {
$q = searchSomeUsersByStatus($listn, $listm, $search, $status);
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
$userID = $user['userID'];
$username = $user['username'];
$role = $user['role'];
$bancomment = $user['bancomment'];
$thispage = htmlspecialchars(basename($_SERVER['REQUEST_URI']));
$function = "checkCheckAll(document.getElementById('checkall'))";
echo("
<tr>
<td><input type='checkbox'
name='checkbox-user[]'
class='checkbox-list'
value='$userID'
form='admin-batchform'
onchange=" . "$function" . ">
</td>
<td>$username</td>
<td>$role</td>
<td>$bancomment</td>
<td>
<form class='admin-useraction'
action='$thispage'
method='post'>
<select class='action' name='actions'>
<option value='2'>Freeze</option>
<option value='3'>Ban</option>
<option value='1'>Restore</option>
</select>
<input type='hidden' name='userID' value='$userID'>
<input type='submit' value='Confirm'>
</form>
</td>
</tr>
");
}
} else {
$q = searchSomeGroupsByStatus($listn, $listm, $search, $groupstatus);
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
$groupID = $group['groupID'];
$name = $group['name'];
$role = $group['status'];
$description = $group['description'];
$thispage = htmlspecialchars(basename($_SERVER['REQUEST_URI']));
$function = "checkCheckAll(document.getElementById('checkall'))";
echo("
<tr>
<td><input type='checkbox'
name='checkbox-group[]'
class='checkbox-list'
value='$groupID'
form='admin-groupbatchform'
onchange=" . "$function" . ">
</td>
<td>$name</td>
<td>$role</td>
<td>$description</td>
<td>
<form class='admin-groupaction'
action='$thispage'
method='post'>
<select class='action' name='actions'>
<option value='0'>Hide</option>
<option value='1'>Public</option>
<option value='2'>Members</option>
</select>
<input type='hidden' name='groupID' value='$groupID'>
<input type='submit' value='Confirm'>
</form>
</td>
</tr>
");
}
if ($userinfo == 'owner') {
echo "<button type=\"submit\"
name=\"batchactions\"
id=\"admin\"
value=\"admin\">Maak Admin</button>
<button type=\"submit\"
name=\"batchactions\"
id=\"owner\"
value=\"owner\">Maak Owner</button>";
}
?>
</table>
</form>
<form id="admin-groupbatchform"
onsubmit="adminUpdate(this); return false;">
<input type="hidden" name="groupbatchactions" id="groupbatchinput">
<button type="submit" name="batchactions" id="hide" value="hidden">Hide</button>
<button type="submit" name="batchactions" id="ban" value="public">Public</button>
<button type="submit" name="batchactions" id="members" value="membersonly">Members</button>
</form>
</div>
<table class="usertable" id="usertable">
</table>
</div>
</div>
</div>
</body>

View File

@@ -0,0 +1,37 @@
<select name="day_date" >
<option>dag</option>
<?php
for($i=1; $i<32; $i++) {
$i = sprintf("%02d", $i);
?>
<option value="<?= $i ?>" <?php submitselect($day_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>
<select name="month_date">
<option>Maand</option>
<option value="01" <?php submitselect($month_date, "01")?>>januari</option>
<option value="02" <?php submitselect($month_date, "02")?>>februari</option>
<option value="03" <?php submitselect($month_date, "03")?>>maart</option>
<option value="04" <?php submitselect($month_date, "04")?>>april</option>
<option value="05" <?php submitselect($month_date, "05")?>>mei</option>
<option value="06" <?php submitselect($month_date, "06")?>>juni</option>
<option value="07" <?php submitselect($month_date, "07")?>>juli</option>
<option value="08" <?php submitselect($month_date, "08")?>>augustus</option>
<option value="09" <?php submitselect($month_date, "09")?>>september</option>
<option value="10" <?php submitselect($month_date, "10")?>>oktober</option>
<option value="11" <?php submitselect($month_date, "11")?>>november</option>
<option value="12" <?php submitselect($month_date, "12")?>>december</option>
</select>
<select name="year_date">
<option>Jaar</option>
<?php
$year = (new DateTime)->format("Y");
for($i=$year; $i > $year - 100; $i--) {
?>
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>

View File

@@ -1,6 +1,6 @@
<div class="content">
<div class="chat">
<nav class="nav-list chat-left left platform chat-recent">
<nav class="nav-list platform" id="chat-recent-panel">
<h5>Chats</h5>
<ul>
<?php
@@ -16,8 +16,9 @@
// Set default values of a friend.
$username = $friend["username"];
$name = $friend["fullname"];
$userID = $friend["userID"];
$pf = "img/notbad.jpg";
$pf = "img/avatar-standard.png";
// Change values if needed.
if (!empty($friend["profilepicture"]))
@@ -28,17 +29,24 @@
<li class='friend-item' id='friend-item-$userID' onclick='switchUser(\"$userID\")'>
<div class='friend'>
<img alt='PF' class='profile-picture' src='$pf'/>
$username
<div class='friend-name'>
$name<br/>
<span style='color: #666'>$username</span>
</div>
</div>
</li>
";
";
}
if (isset($_GET["username"]) && $_GET["username"] != "") {
$chatID = $_GET["username"];
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
}
?>
</ul>
</nav>
<div class="chat-right">
<div id="chat-history" class="chat-history platform">
</div>
<div id="chat-history" class="chat-history platform">
</div>
<div>
<form id="lastIDForm">
<input type="hidden"
id="lastID"
@@ -66,6 +74,7 @@
name="content"
id="newContent"
placeholder="Schrijf een bericht..."
autocomplete="off"
autofocus
required
/>

View File

@@ -0,0 +1,36 @@
<!-- Trigger/Open The Modal -->
<button id="myBtn" class="button">Wachtwoord vergeten</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post"
name="forgotPassword">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">&times;</span>
<h3>Voer uw emailadres in</h3>
</div>
<div class="modal-body">
<input type="text"
class="middle"
placeholder="Voer uw email in"
name="forgotEmail"
title="Voer een email in">
</div>
<div class="modal-footer">
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
<button type="submit"
value="reset"
name="submit"
id="frm1_submit">
Reset password
</button>
</div>
</div>
</form>
</div>

View File

@@ -1,122 +1,36 @@
<div class="content">
<div class="profile-box platform">
<img class="left group-picture" src="http://i.imgur.com/afjEUx2.jpg">
<img class="left main-picture" src="<?= $group['picture'] ?>">
<div class="profile-button">
<p><img src="img/leave-group.png"> Groep verlaten</p>
</div>
<h1 class="profile-username">[groepnaam]</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dictum turpis quam, eu ultrices sapien hendrerit tincidunt. Nunc aliquam neque turpis, id porta quam iaculis id. Sed suscipit, nisl a fermentum congue, nunc augue finibus lectus, id varius nunc purus nec dolor. Integer laoreet tellus sit amet sapien auctor congue. Mauris laoreet eu elit vel rhoncus. Nam et tortor arcu. Maecenas sit amet leo quis tellus varius gravida. Sed quis fermentum odio, sed dictum nulla. Donec aliquam rutrum orci cursus tempus. Quisque sit amet ipsum eget velit aliquam facilisis ultricies quis ligula. Nunc nisi lacus, luctus non bibendum quis, sagittis sit amet odio.</p>
<h1 class="profile-username"><?= $group['name'] ?></h1>
<p><?= $group['description'] ?></p>
</div>
<div class="item-box-full-width platform">
<h2>Leden</h2>
<h2>Leden (<?= $group['members'] ?>)</h2>
<p>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#vrienden">...en nog 25 anderen!</a>
<?php
foreach($members as $member) {
echo "<a href=\"profile.php?username=" . $member["username"] . "\" data-title=\"" . $member["username"] . "\"><img class=\"profile-picture\" src=\"" . $member["profilepicture"] . "\" alt=\"" . $member["username"] . "'s profielfoto\"></a>";
}
?>
</p>
</div>
<div class="posts">
<div class="post platform">
<h2>Lorem</h2>
<p>Lorem ipsum dolor sit amet, consectetur.</p>
<p class="subscript">Enkele minuten geleden geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="http://i.imgur.com/ypIQKjE.jpg" alt="Olympic Mountains, Washington">
<p class="subscript">Gisteren geplaatst</p>
</div>
<div class="post platform">
<h2>Ipsum</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem nihil alias amet dolores fuga totam sequi a cupiditate ipsa voluptas id facilis nobis.</p>
<p class="subscript">Maandag geplaatst</p>
</div>
<div class="post platform">
<h2>Dolor</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Sit</h2>
<p>Lorem ipsum dolor sit.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="https://i.redditmedia.com/EBWWiEojgkRrdn89R7qF7tBZjJszJaIqgkWUH23s11A.jpg?w=576&s=ba4fe1f02485cb2327305924ef869a66" alt="Nunobiki Falls, Kobe Japan">
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Amet</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima asperiores eveniet vero velit eligendi aliquid in.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Consectetur</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error aliquid reprehenderit expedita odio beatae est.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Adipisicing</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat architecto quis tenetur fugiat veniam iste molestiae fuga labore!</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Elit</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem ut debitis dolorum earum expedita eveniet voluptatem quibusdam facere eos numquam commodi ad iusto laboriosam rerum aliquam.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Geen error</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus dolorem maxime minima animi cum.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="https://i.reddituploads.com/82c1c4dd0cfb4a4aa1cfa16f93f5dbfa?fit=max&h=1536&w=1536&s=dd629d407f3646ee6e3adb4da78c93f2" alt="Oregon cliffs are no joke.">
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Aliquid</h2>
<p>Lorem ipsum dolor sit amet, consectetur.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Odit</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit accusamus tempore at porro officia rerum est impedit ea ipsa tenetur. Labore libero hic error sunt laborum expedita.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Accusamus</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nobis quaerat suscipit ad.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
</div>
<div class="modal">
<div class="modal-content platform">
<div class="modal-close">
&times;
</div>
<div class="modal-response" id="modal-response">
<span class="modal-default">Aan het laden...</span>
</div>
</div>
</div>
</div>

View File

@@ -2,9 +2,9 @@
<title>MyHyvesbook+</title>
<!-- Add your javascript files here. -->
<script src="js/jquery.js"></script>
<script src="js/main.js"></script>
<script src="js/header.js"></script>
<script src="js/menu.js"></script>
<script src="js/notifications.js"></script>
<style>
/* Add your css files here. */
@import url("styles/main.css");
@@ -12,14 +12,19 @@
@import url("styles/header.css");
@import url("styles/menu.css");
@import url("styles/footer.css");
@import url("styles/mobilefriendly.css") screen and (orientation: portrait);
</style>
<?php
require_once ("../queries/checkInput.php");
require_once ("../queries/connect.php");
require_once ("../queries/user.php");
session_start();
if(!isset($_SESSION["userID"])){
header("location:login.php");
} else {
updateLastActivity();
}

View File

@@ -12,10 +12,10 @@ $userinfo = getHeaderInfo();
<input name="search"
type="text"
placeholder="Zoek naar wat je wil"
required
/>
<input type="submit"
value="Zoek"/>
<button type="submit">
<i class="fa fa-search"></i>
</button>
</form>
</div>
<div class="right profile-menu">
@@ -25,7 +25,7 @@ $userinfo = getHeaderInfo();
</div>
<?=$userinfo["fname"]?>
</div>
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/><i id="open-notifications" class="fa fa-bars"></i>
</div>
</header>
<?php include("notification-center.php"); ?>

View File

@@ -0,0 +1,3 @@
<?php
echo json_encode(selectAllFriends($_SESSION["userID"])->fetchAll());

View File

@@ -7,17 +7,19 @@
<h1>Welkom bij MyHyvesbook+</h1>
<!-- Login content -->
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post">
return=$correct
method="post"
name="login">
<!-- Login name -->
<div class="login_containerlogin">
<label><b>Gebruikersnaam</b></label>
<label><b>Gebruikersnaam/Email</b></label>
<input type="text"
placeholder="Voer uw gebruikersnaam in"
name="uname"
value="<?php echo $uname ?>"
title="Moet 6 of meer karakters bevatten"
class="middle"
placeholder="Voer uw gebruikersnaam/email in"
name="user"
value="<?php echo $user ?>"
title="Moet een geldige gebruiker zijn"
>
</div>
@@ -25,6 +27,7 @@
<div class="login_containerlogin">
<label><b>Wachtwoord</b></label>
<input type="password"
class="middle"
placeholder="Voer uw wachtwoord in"
name="psw"
title="Moet minstens 8 karakters lang zijn"
@@ -37,15 +40,71 @@
<!-- Button for logging in -->
<div class="login_containerlogin">
<button type="submit"
value="Login"
name="submit"
id="frm1_submit">
Login
value="login"
name="submit"
id="frm1_submit">
Inloggen
</button>
</div>
<div class="login_containerlogin">
<label><b>Onthoud mij</b></label>
<input type="checkbox" name="rememberMe" value=1><br>
</div>
</form>
<!-- Button for going to the register screen -->
<div class="login_containerlogin">
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
</div>
</div>
<!-- Button for going to the register screen -->
<div class="login_containerlogin">
<!-- <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>-->
<?php
include("../views/forgotPasswordModal.php");
include("../views/registerModal.php");
?>
</div>
<script>
// Get the button that opens the modal
var modal = document.getElementById('myModal');
var btn = document.getElementById("myBtn");
// Get the modal
var registerModal = document.getElementById('registerModal');
var registerBtn = document.getElementById("registerBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
var registerSpan = document.getElementsByClassName("close")[1];
// When the user clicks the button, open the modal
btn.onclick = function () {
// modal.style.display = "block";
modal.style.display = "block";
window.onload=emailSent();
}
registerBtn.onclick = function () {
registerModal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function () {
modal.style.display = "none";
}
registerSpan.onclick = function () {
registerModal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
if (event.target == registerModal) {
registerModal.style.display = "none";
}
}
</script>

View File

@@ -7,6 +7,7 @@
<link rel="stylesheet"
type="text/css"
href="styles/index.css">
<script src="/js/jqeury.js"></script>
<script src="/js/registerAndLogin.js"></script>
<script src="js/jquery.js"></script>
<script src="js/registerAndLogin.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>

View File

@@ -1,129 +1,39 @@
<nav class="menu">
<nav class="menu" id="contact-menu">
<section id="friends-menu-section">
<?php
// Load file.
require_once("../queries/friendship.php");
require_once("../queries/user.php");
// Get confirmed friends of the user and a random non-friend.
$friends = selectAllFriends($_SESSION["userID"])->fetchAll();
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
$i = 0;
if (sizeof($friends) == 0) {
echo "
<ul class=\"nav-list\"><li class='friend-item'>
<form action='profile.php' method='get'>
<button type='submit'
name='username'
value='$randomUser'>
<div class='friend'>
Maak nieuwe vrienden :)
</div>
</button>
</form>
</li><ul class=\"nav-list\">
";
} else {
echo "
<h4>
Vrienden
</h4>
<ul class=\"nav-list\">
";
foreach ($friends as $i => $friend) {
$username = $friend["username"];
$extraItem = "";
$pf = $friend["profilepicture"];
if ($i >= 5)
$extraItem = "extra-menu-items";
echo "
<li class='friend-item $extraItem'>
<form action='profile.php' method='get'>
<button type='submit'
name='username'
value='$username'>
<div class='friend'>
<img alt='PF' class='profile-picture' src='$pf'/>
$username
</div>
</button>
</form>
</li>
";
}
if (sizeof($friends) > 5) {
echo "
<li class='more-item' id='more-friends-click'>
Meer vrienden..
</li>
";
}
}
?>
<h4>
Recente vrienden
</h4>
<ul id="menu-friends-list" class="nav-list">
</ul>
</section>
<section id="groups-menu-section">
<?php
// Load file.
require_once("../queries/group_member.php");
// Get all the friends of a user.
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
if (sizeof($groups) > 0) {
echo "
<h4>
Groepen
</h4>
<ul class=\"nav-list\">
";
foreach ($groups as $i => $group) {
// Set default values of a friend.
$name = $group["name"];
$extraItem = "";
$picture = $group["picture"];
// Change values if needed.
if ($i > 3)
$extraItem = "extra-menu-items";
echo "
<li class='group-item $extraItem'>
<form action='group.php' method='get'>
<button type='submit'
name='groupname'
value='$name'>
<div class='group'>
<img alt='PF' class='group-picture' src='$picture'/>
$name
</div>
</button>
</form>
</li>
";
}
if (sizeof($groups) > 3) {
echo "
<li class='more-item' id='more-groups-click'>
Meer groepen..
</li>
";
}
}
?>
<h4>
Top groepen
</h4>
<ul id="menu-groups-list" class="nav-list">
</ul>
<ul class="nav-list">
<li>
<a href="#">
Maak een groep aan
</a>
</li>
</ul>
</section>
<section>
<ul>
<li class="more-item" id="menu-back">
Terug naar het overzicht
<ul class="nav-list">
<li>
<form action="search.php" method="get">
<input type="hidden"
name="search"
value="" />
<input type="hidden"
name="filter"
value="personal" />
<button type="submit">
Klik voor al je groepen en vrienden...
</button>
</form>
</li>
</ul>
</section>

View File

@@ -0,0 +1,23 @@
<?php
function messagePage(string $content) {
$webpage = ("
<!DOCTYPE html>
<html>
<head>
<style>
@import url(../styles/main.css);
@import url(../styles/settings.css);
@import url(../styles/message-page.css);
</style>
</head>
<body>
<div class='password-change'>
<div class='top-logo'><a href='../index.php'><img src='../img/top-logo.png' alt='MyHyvesbook+'/></a></div>
<div class='item-box platform'>$content</div>
</div>
</body>
</html>
");
echo $webpage;
}

View File

@@ -1,15 +1,34 @@
<nav class="menu" id="notification-center">
<section id="quick-links">
<a href="chat.php"><i class="fa fa-comments-o" data-title="Prive chats"></i></a>
<a href="settings.php"><i class="fa fa-cog" data-title="Instellingen"></i></a>
<a href="profile.php"><i class="fa fa-user" data-title="Profiel"></i></a>
<a href="logout.php"><i class="fa fa-sign-out" data-title="Uitloggen"></i></a>
<a href="chat.php" data-title="Prive chats"><i class="fa fa-comments-o"></i></a>
<a href="settings.php" data-title="Instellingen"><i class="fa fa-cog"></i></a>
<a href="profile.php" data-title="Profiel"><i class="fa fa-user"></i></a>
<?php
include_once ("../queries/user.php");
// auth
$role = getRoleByID($_SESSION['userID']);
if ($role == 'admin' OR $role == 'owner') {
echo "<a href=\"admin.php\" data-title=\"Admin\"><i class=\"fa fa-lock\"></i></a>";
echo "<style>@import url('styles/adminbutton.css'); </style>";
}
?>
<a href="logout.php" data-title="Admin"><i class="fa fa-sign-out"></i></a>
</section>
<section id="notifocationCenter">
<section id="friend-request-section">
<h4>
Vriendchapsverzoeken
Verzoeken
</h4>
<ul class="nav-list" id="friendrequestslist">
<ul class="nav-list" id="friend-requests-list">
</ul>
</section>
<section id="unread-messages-section">
<h4>
Nieuwe berichten
</h4>
<ul class="nav-list" id="unread-chat-list">
</ul>
</section>

View File

@@ -0,0 +1,63 @@
<?php
$postID = $_GET['postID'];
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
session_start();
echo("
<div class='post-header header'>
<h4>" . $post['title'] . "</h4>
<span class='postinfo'>
gepost door $fullname,
<span class='posttime' title='" . $post['creationdate'] . "'>
" . nicetime($post['creationdate']) . "
</span>
</span>
</div>
<div class='post-content'>
<p>" . $post['content'] . "</p>
</div>
"); ?>
<div class='post-comments'>
<div class="commentfield">
<form id="newcommentform" onsubmit="return false;">
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..." maxlength="1000"></textarea><span></span> <br>
<button onclick="postComment('reaction')" name="button" value="reaction">Reageer!</button>
<button onclick="postComment('nietslecht')" name="button" value="nietslecht" class="nietslecht">
<?php
if (checkNietSlecht($postID, $_SESSION["userID"])) {
echo 'Trek <span class="nietslecht-text">"Niet slecht."</span> terug';
} else {
echo '<img src="img/nietslecht_small.png" /> <span class="nietslecht-text">"Niet slecht."</span>';
}
?>
</button>
</form>
</div>
<?php
$q = selectCommentsByPostId($postID);
while($comment = $q->fetch(PDO::FETCH_ASSOC)) {
$commentauthor = $comment['fname'] . " " . $comment['lname'] . " (" . $comment['username'] . ")";
$commentdate = $comment['creationdate'];
$commentnicetime = nicetime($commentdate);
$commentcontent = $comment['content'];
echo("
<div class='comment'>
<div class='commentinfo'>
$commentauthor
<span class='commentdate' title='$commentdate'>
$commentnicetime
</span>
</div>
<div class='commentcontent'>
$commentcontent
</div>
</div>
");
} ?>
</div>

View File

@@ -1,20 +1,47 @@
<div class="content">
<div class="profile-box platform">
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
<div class="profile-button">
<p><img src="/img/add-friend.png"> Als vriend toevoegen</p>
<div class="user-box">
<img class="profile-picture main-picture <?= $user["onlinestatus"] ?>" src="<?= $user["profilepicture"] ?>"><br />
<div class="platform">
<div class="status-buttons-container">
<button disabled class="gray">
<?= $user["onlinestatus"] ?>
</button>
<button disabled class="gray"><?= $user["role"] ?></button>
</div>
<div class="friend-button-container">
<p>:)</p>
<p>Je ziet er goed uit vandaag</p>
</div>
<div class="profile-info">
<h2><?= $user["fname"]?> <?=$user["lname"]?></h2>
<h5><?=$user["username"]?></h5>
<?php if (strlen($user["bio"]) <= 50) {
echo "<p>" . $user["bio"] . "</p>";
} ?>
</div>
</div>
<h1 class="profile-username"><?=$user["username"]?></h1>
<h5 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h5>
<p><?=$user["bio"]?></p>
</div>
<?php if (strlen($user["bio"]) > 50) {
echo "<div class='platform'><h3>Bio:</h3><p>" . $user["bio"] . "</p></div>";
} ?>
<div class="item-box platform">
<h3>Informatie</h3>
<p>
<ul>
<li>Leeftijd: <?= getAge($user["birthdate"]) ?> jaar</li>
<li>Locatie: <?= $user["location"] ?></li>
<li>Lid sinds: <?= nicetime($user["creationdate"]) ?></li>
</ul>
</p>
</div>
<div class="item-box left platform">
<h2>Vrienden</h2>
<div class="item-box platform">
<h3>Vrienden</h3>
<p>
<?php
while($friend = $profile_friends->fetch()) {
echo "<a href='/profile/${friend["username"]}/' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
echo "<a href='profile.php?username=${friend["username"]}' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
}
@@ -25,12 +52,12 @@
</p>
</div>
<div class="item-box right platform">
<h2>Groepen</h2>
<div class="item-box platform">
<h3>Groepen</h3>
<p>
<?php
while($group = $profile_groups->fetch()) {
echo "<a href='/group/${group["name"]}/' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
echo "<a href='group.php?groupname=${group['name']}' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
}
if($profile_groups->rowCount() === 0) {
@@ -41,29 +68,17 @@
</div>
<div class="posts">
<?php
if ($_SESSION["userID"] === $userID) {
?>
<div class="post platform">
<form>
<input type="text" class="newpost" placeholder="Titel">
<textarea class="newpost">Schrijf een berichtje...</textarea>
<input type="submit" value="Plaats!">
</form>
</div>
<?php
}
while($post = $posts->fetch()) {
$nicetime = nicetime($post["creationdate"]);
echo "
<div class='post platform'>
<h2>${post["title"]}</h2>
<p>${post["content"]}</p>
<p class=\"subscript\">${nicetime} geplaatst.</p>
</div>
";
}
?>
</div>
<div class="modal">
<div class="modal-content platform">
<div class="modal-close">
&times;
</div>
<div class="modal-response" id="modal-response">
<span class="modal-default">Aan het laden...</span>
</div>
</div>
</div>
</div>

View File

@@ -40,13 +40,44 @@
<!-- Register birthday -->
<div class="login_containerregister">
<label><b>Geboortedatum</b></label>
<input type="date"
name="bday"
value="<?php echo $bday ?>"
id="bday"
placeholder="01/01/1900"
>
<label><b>Geboortedatum(Dag/Maand/Jaar)</b></label>
<select name="day_date" >
<option>dag</option>
<?php
for($i=1; $i<32; $i++) {
$i = sprintf("%02d", $i);
?>
<option value="<?= $i ?>" <?php submitselect($day_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>
<select name="month_date">
<option>Maand</option>
<option value="01" <?php submitselect($month_date, "01")?>>Januari</option>
<option value="02" <?php submitselect($month_date, "02")?>>Februari</option>
<option value="03" <?php submitselect($month_date, "03")?>>Maart</option>
<option value="04" <?php submitselect($month_date, "04")?>>April</option>
<option value="05" <?php submitselect($month_date, "05")?>>Mei</option>
<option value="06" <?php submitselect($month_date, "06")?>>Juni</option>
<option value="07" <?php submitselect($month_date, "07")?>>Juli</option>
<option value="08" <?php submitselect($month_date, "08")?>>Augustus</option>
<option value="09" <?php submitselect($month_date, "09")?>>September</option>
<option value="10" <?php submitselect($month_date, "10")?>>Oktober</option>
<option value="11" <?php submitselect($month_date, "11")?>>November</option>
<option value="12" <?php submitselect($month_date, "12")?>>December</option>
</select>
<select name="year_date">
<option>Jaar</option>
<?php
$year = (new DateTime)->format("Y");
for($i=$year; $i > $year - 100; $i--) {
?>
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
<?php
}
?>
</select>
*<span class="error"> <?php echo $bdayErr;?></span>
</div>
@@ -95,7 +126,7 @@
<!-- Register location -->
<div class="login_containerregister">
<label><b>Woonplaats</b></label>
<label><b>Locatie</b></label>
<input type="text"
placeholder="Voer uw woonplaats in"
name="location"
@@ -117,18 +148,35 @@
*<span class="error"> <?php echo $emailErr;?></span>
</div>
<!-- Button for registering -->
<!-- Register email -->
<div class="login_containerregister">
<label><b>Herhaal email</b></label>
<input type="text"
placeholder="Herhaal uw email"
name="confirmEmail"
value="<?php echo $confirmEmail ?>"
id="email"
title="Herhaal uw email">
*<span class="error"> <?php echo $confirmEmailErr;?></span>
</div>
<div class="login_containerregister">
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ"></div>
<span class="error"> <?php echo $captchaErr;?></span>
</div>
<!-- Button for registering -->
<div class="login_containerlogin">
<!-- Button for going back to login screen -->
<a href="https://myhyvesbookplus.nl/login.php" class="button">Annuleren</a>
<button type="submit"
value="Registreer uw account"
name="Submit"
id="frm1_submit">
Registreer
</button>
</div>
</div>
</form>
<div class="login_containerlogin">
<!-- Button for going back to login screen -->
<a href="https://myhyvesbookplus.nl/login.php" class="left-arrow">Login</a>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More