/
viewlist.php
72 lines (71 loc) · 2.4 KB
/
viewlist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
require 'lfl.php';
if(lfl_user_is_of_type()){
$listId = filter_input(INPUT_GET, 'listId');
$listData = null;
$userOwnsList = false;
if($listId){
$listData = lfl_get_list($listId);
$userOwnsList = lfl_user_owns_list($_SESSION['user']['userId'], $listId);
}
}
?>
<!DOCTYPE html>
<!--
TODO:
- Pagina's toevoegen
- Content home toevoegen
- DB spul?
-->
<html>
<head>
<title><?php echo '' ?> - POST it</title>
<meta charset="UTF-8">
<!-- Mobile phone 'support' -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="jquery-1.11.3.min.js"></script>
<script src="menu.js"></script>
<script src="header.js"></script>
</head>
<body>
<?php
include 'inc/header.php';
include 'inc/menu.php';
?>
<div id="pageContent">
<div id="content">
<?php
if(lfl_user_is_of_type()){
if($userOwnsList || lfl_user_is_of_type(array('admin'))){
if($listData){
//Dump dat shit jo
echo '<h2>Viewing: ' . $listData['listname'] . '</h2>' . "\n";
$items = lfl_get_list_items($listId);
foreach($items as $item){
echo '<div class="listItemBox">';
echo '<div class="listItemBoxHeader">';
echo '<h3>' . $item['itemname'] . '</h3>';
echo '</div>';
echo '<div class="listItemBoxContent">';
echo '<p>' . $item['itemtext'] . '</p>';
echo '</div>';
echo '</div>' . "\n";
}
}else{
echo '<p>List not found</p>';
}
}else{
echo '<p>You are not allowed to see this list</p>';
}
}else{
echo '<p>This page is only available to logged in users</p>';
}
?>
</div>
</div>
<?php
include 'inc/footer.php';
?>
</body>
</html>