-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
147 lines (123 loc) · 6.09 KB
/
main.php
File metadata and controls
147 lines (123 loc) · 6.09 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
require("php/common.php");
require("php/checkLogin.php");
$postsPerPage = 10;
$query = 'SELECT COUNT(*) FROM posts';
$stmt = $db->prepare($query);
$result = $stmt->execute();
$numPosts = $stmt->fetchColumn();
$numPages = ceil($numPosts / $postsPerPage);
?>
<!DOCTYPE html>
<html>
<head>
<title>Breadbin</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="css/common.css" rel="stylesheet" type="text/css">
<link href="css/navbar.css" rel="stylesheet" type="text/css">
<link href="css/main.css" rel="stylesheet" type="text/css">
<link href="css/vendor/lazyYT.css" rel="stylesheet" type="text/css">
<link href="css/vendor/normalize.css" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="icon" type="image/png" href="img/favicon.png" />
<script src="js/vendor/jquery-1.11.2.min.js"></script>
<script src="js/vendor/jquery.cookie.js"></script>
<script src="js/vendor/jquery.hoverIntent.js"></script>
<script src="js/pages/main.js"></script>
<script src="js/postFunctions.js"></script>
<script src="js/errorHandler.js"></script>
<script src="js/vendor/progressbar.min.js"></script>
<script type="text/javascript" src="js/vendor/lazyYT.js"></script>
<script>
$( document ).ready(function() {
$('.js-lazyYT').lazyYT();
});
</script>
</head>
<body>
<noscript>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=error.php">
</noscript>
<?php require('php/template/navbar.php');?>
<?php require('php/template/popup.php');?>
<script>
var instruction = 1;
function add_fieldsInstruc() {
instruction++;
var container = document.createElement("div");
container.style.width = "100%";
container.style.height = "100px";
container.innerHTML = '<div class="leftInstruc"><p class="number">' + instruction + '</p></div><div class="rightInstruc"><textarea name="recipeInstructions" class="recipeInstructions" id="recipeInstructions" maxlength="260" placeholder="Recipe Instructions..." autocomplete="off"></textarea></div>';
document.getElementById("instructionBody").appendChild(container);
/*document.getElementById('instructionBody').innerHTML += '<div id="eachInstruc"><div class="leftInstruc"><p class="number">' + instruction + '</p></div><div class="rightInstruc"><textarea name="recipeInstructions" class="recipeInstructions" id="recipeInstructions" maxlength="220" placeholder="Recipe Instructions..."></textarea></div></div>';*/
}
function add_fields() {
var container = document.createElement("div");
container.style.width = "210px";
container.style.display = "inline";
container.innerHTML = '<input type="text" name="recipeIngredients" id="recipeIngredients" placeholder="Recipe Ingredient" class="recipeIngredients" autocomplete="off" />';
document.getElementById("ingredientBody").appendChild(container);
/*document.getElementById('ingredientBody').innerHTML += '<input type="text" name="recipeIngredients" id="recipeIngredients" placeholder="Recipe Ingredient" class="recipeIngredients" style="margin " />';*/
}
</script>
<?php require('php/template/gridPopUp.php');?>
<div id="blackOverlay"></div>
<div id="center">
<div id="content">
<?php require('php/fetchPosts.php'); ?>
</div>
<div id="sidebar">
<div id="uploadBox" class="sideBox">
<form action="php/post.php" method="POST" id="postForm" enctype="multipart/form-data">
<div class="textarea">
<textarea name="TextUpload" class="postText" id="uploadText" maxlength="150" placeholder="Make a slice..." rows="1"></textarea>
</div>
<div class="uploadRest">
<input type="submit" value="Submit" id="submitPost" class="buttonstyle">
<div id="imageIcon"><a href="#" onclick="getFile();"><i class="fa fa-camera"></i></a></div>
<div style='height: 0px;width:0px; overflow:hidden;'><input id="upfile" type="file" value="upfile" accept="image/*"/></div>
<div id="uploadname"></div>
</div>
</form>
<div id="gridClick">
<div class="gridBoxes 2">
<i class="fa fa-video-camera" style="font-size: 2.3em;"></i>
</div>
<div class="gridBoxes 1">
<i class="fa fa-cutlery" style="font-size: 2.3em;"></i>
</div>
</div>
<div class="clearFix"></div>
</div>
<?php require('php/recommendToaster.php'); ?>
<div id="supportBox" class="sideBox">
<ul id="credits">
<li>© 2015 Breadbin</li>
<li><a href="http://google.co.uk" target="_blank">About</a></li>
<li><a href="http://google.co.uk" target="_blank">Help</a></li>
<li><a href="http://google.co.uk" target="_blank">Privacy</a></li>
<li><a href="http://google.co.uk" target="_blank">Terms</a></li>
</ul>
</div>
</div>
</div>
<script>
var loading = false;
var groupNumber = 1;
$(window).scroll(function() {
if ($(window).scrollTop() + $(window).height() == $(document).height()) {
if (loading == false && groupNumber <= <?php echo $numPages ?>) {
loading = true;
$.post('php/fetchPosts.php', {'groupNumber' : groupNumber}, function(data) {
$("#content").append(data);
loading = false;
groupNumber++;
$('.js-lazyYT').lazyYT();
});
}
}
});
</script>
</body>
</html>