Completed
Push — master ( 306300...8aacdd )
by mains
02:51
created

index.php (13 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php include 'php/jodel-web.php';?>
2
<!DOCTYPE html>
3
<html lang="en">
4
	<head>
5
		<title><?php echo $viewTest::getTitle($posts[0], $view, $isDetailedView);?></title>
6
		
7
		<meta charset="utf-8">
8
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
9
		<meta http-equiv="x-ua-compatible" content="ie=edge">
10
		
11
		<meta name="description" content="<?php echo $viewTest::getMetaDescription($posts[0], $view, $isDetailedView);?>">
12
		<meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client, web-app, browser, app">
13
		
14
		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 218 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
15
		<link rel="stylesheet" href="css/font-awesome.min.css">
16
		<link rel="stylesheet" href="style.css" type="text/css">
17
		
18
		<link rel="shortcut icon" type="image/x-icon" href="./img/favicon/favicon.ico">
19
		<link rel="icon" type="image/x-icon" href="./img/favicon/favicon.ico">
20
		<link rel="icon" type="image/gif" href="./img/favicon/favicon.gif">
21
		<link rel="icon" type="image/png" href="./img/favicon/favicon.png">
22
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon.png">
23
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-57x57.png" sizes="57x57">
24
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-60x60.png" sizes="60x60">
25
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-72x72.png" sizes="72x72">
26
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-76x76.png" sizes="76x76">
27
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-114x114.png" sizes="114x114">
28
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-120x120.png" sizes="120x120">
29
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-128x128.png" sizes="128x128">
30
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-144x144.png" sizes="144x144">
31
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-152x152.png" sizes="152x152">
32
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-180x180.png" sizes="180x180">
33
		<link rel="apple-touch-icon" href="./img/favicon/apple-touch-icon-precomposed.png">
34
		<link rel="icon" type="image/png" href="./img/favicon/favicon-16x16.png" sizes="16x16">
35
		<link rel="icon" type="image/png" href="./img/favicon/favicon-32x32.png" sizes="32x32">
36
		<link rel="icon" type="image/png" href="./img/favicon/favicon-96x96.png" sizes="96x96">
37
		<link rel="icon" type="image/png" href="./img/favicon/favicon-160x160.png" sizes="160x160">
38
		<link rel="icon" type="image/png" href="./img/favicon/favicon-192x192.png" sizes="192x192">
39
		<link rel="icon" type="image/png" href="./img/favicon/favicon-196x196.png" sizes="196x196">
40
		<meta name="msapplication-TileImage" content="./img/favicon/win8-tile-144x144.png"> 
41
		<meta name="msapplication-TileColor" content="#5682a3"> 
42
		<meta name="msapplication-navbutton-color" content="#5682a3"> 
43
		<meta name="application-name" content="JodelBlue"/> 
44
		<meta name="msapplication-tooltip" content="JodelBlue"/> 
45
		<meta name="apple-mobile-web-app-title" content="JodelBlue"/> 
46
		<meta name="msapplication-square70x70logo" content="./img/favicon/win8-tile-70x70.png"> 
47
		<meta name="msapplication-square144x144logo" content="./img/favicon/win8-tile-144x144.png"> 
48
		<meta name="msapplication-square150x150logo" content="./img/favicon/win8-tile-150x150.png"> 
49
		<meta name="msapplication-wide310x150logo" content="./img/favicon/win8-tile-310x150.png"> 
50
		<meta name="msapplication-square310x310logo" content="./img/favicon/win8-tile-310x310.png"> 
51
	</head>
52
	
53
	<body>
54
		<header>
55
			<nav class="navbar navbar-full navbar-dark navbar-fixed-top">
56
				<div class="container">					
57
						<?php
58
59
							if(isset($_GET['postId']) && isset($_GET['getPostDetails']))
60
							{
61
								echo '<a id="comment-back" href="index.php?view=' . $view . '#postId-' . htmlspecialchars($_GET['postId']) . '">';
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 122 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
62
								echo '<i class="fa fa-angle-left fa-3x"></i>';
63
								echo '</a>';
64
								echo '<h1>';
65
								echo '<a href="index.php?getPostDetails=' . htmlspecialchars($_GET['getPostDetails']) . '&postId=' . htmlspecialchars($_GET['postId']) . '" class="spinnable hidden-xs-down">';
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 183 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
66
							}
67
							else
68
							{
69
								echo '<h1>';	
70
								echo '<a href="./" class="spinnable">';
71
							}
72
						?>
73
						JodelBlue <i class="fa fa-refresh fa-1x"></i></a>
74
					</h1>
75
76
					<div id="location_mobile" class="hidden-sm-up">
77
						<form method="get">
78
							<input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 142 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
79
80
							<input type="submit" id="submit_mobile" class="fa" value="&#xf0ac;" />
81
						</form>
82
					</div>
83
				</div>
84
			</nav>
85
		</header>
86
		
87
		<div class="mainContent container">		
88
			<div class="content row">
89
				<article class="topContent col-sm-8">
90
91
					<content id="posts">
92
						<?php
93
							for($i = 0; $i<$loops; $i++)
94
							{
95
								if(array_key_exists($i, $posts) && array_key_exists('post_id', $posts[$i]) && isset($posts[$i]['post_id']))
96
								{
97
									$lastPostId = $posts[$i]['post_id'];
98
99
									$viewTest::jodelToHtml($posts[$i], $view, $isDetailedView);
100
								}
101
							} ?>
102
103
					</content>
104
					
105
					<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?>
106
						<p id="loading">
107
							Loading…
108
						</p>
109
					<?php } ?>
110
				</article>
111
			
112
				<aside class="topSidebar col-sm-4 sidebar-outer">
113
					<div class="fixed">
114
						<article>
115
							<div>
116
								<h2>Position / Hashtag</h2>
117
								<form method="get">
118
									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 137 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
119
									<label>try: #jhj</label><br>
120
									<input type="submit" value="Set Location" /> 
121
								</form>
122
							</div>
123
						</article>
124
125
						<article>
126
							<div>
127
								<h2>Karma</h2>
128
								<?php echo $jodelAccountForKarma->getKarma(); ?>
129
							</div>
130
						</article>
131
132
						<article>
133
							<div>
134
								<?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?>
135
								<h2>Comment on Jodel</h2>
136
								<form method="POST">				
137
										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" />
138
										<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 137 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
139
									<br />
140
									<input type="submit" value="SEND" /> 
141
								</form>
142
									<?php } else { ?>
143
								<h2>New Jodel</h2>
144
								<form method="POST">
145
									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 123 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
146
									<br />
147
									<select id="postColorPicker" name="color">
148
										<option value="06A3CB">Blue</option>
149
										<option value="8ABDB0">Teal</option>
150
										<option value="9EC41C">Green</option>
151
										<option value="FFBA00">Yellow</option>
152
										<option value="DD5F5F">Red</option>
153
										<option value="FF9908">Orange</option>
154
									</select> 
155
									<br />
156
									<input type="submit" value="SEND" /> 
157
								</form>
158
								<?php } ?>
159
							</div>
160
						</article>
161
							
162
						<article>
163
							<div>
164
								<h2>Login</h2>
165
							</div>
166
						</article>
167
					</div>
168
				</aside>
169
			</div>
170
			<div id="sortJodelBy" class="row">
171
				<div class="col-xs-12">
172
					<div class="row">
173
						<div class="col-xs-3">
174
							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
175
						</div>
176
						<div class="col-xs-3">
177
							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 136 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
178
						</div>
179
						<div class="col-xs-3">
180
							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 130 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
181
						</div>
182
						<div class="col-xs-3">
183
							<nav>
184
								<a href="./about-us.html">about us</a>
185
							</nav>
186
						</div>
187
					</div>
188
				</div>	
189
			</div>
190
		</div>
191
		
192
		
193
		<!-- jQuery, Tether, Bootstrap JS and own-->
194
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 198 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
195
    	<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.7/js/tether.min.js" integrity="sha384-XTs3FgkjiBgo8qjEjBk0tGmf3wPrWtA6coPfQDfFEY8AnYJwjalXCiosYRBIBZX8" crossorigin="anonymous"></script>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 205 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
196
    	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js" integrity="sha384-BLiI7JTZm+JWlgKa0M0kGRpJbF2J8q+qreVrKBC47e3K6BW78kGLrCkeRX6I9RoK" crossorigin="anonymous"></script>
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 212 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
197
    	<script src="js/jQueryEmoji.js"></script>
198
199
		<script>
200
			//BackButton
201
			function goBack()
202
			{
203
				window.history.back();
204
			}
205
206
			$(document).ready(function()
207
			{
208
				//Transform UTF-8 Emoji to img
209
				$('.jodel > content').Emoji();
210
211
				$('a').on('click', function(){
212
				    $('a').removeClass('selected');
213
				    $(this).addClass('selected');
214
				});
215
216
				function scrollToAnchor(aid){
217
				    var aTag = $("article[id='"+ aid +"']");
218
				    $('html,body').animate({scrollTop: aTag.offset().top-90},'slow');
219
				}
220
221
				<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?>
222
223
				
224
225
226
227
				var win = $(window);
228
				var lastPostId = "<?php echo $lastPostId; ?>";
229
				var view = "<?php echo $view; ?>"
230
				var old_lastPostId = "";
231
				var morePostsAvailable = true;
232
233
				if(window.location.hash)
234
				{
235
					var hash = window.location.hash.slice(1);
236
237
					if(!$("article[id='"+ hash +"']").length)
238
					{
239
						for (var i = 5; i >= 0; i--)
240
						{
241
							if(!$("article[id='"+ hash +"']").length)
242
							{
243
								$.ajax({
244
									url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
245
									dataType: 'html',
246
									async: false,
247
									success: function(html) {
248
										var div = document.createElement('div');
249
										div.innerHTML = html;
250
										var elements = div.childNodes;
251
										old_lastPostId = lastPostId;
252
										lastPostId = elements[3].textContent;
253
										lastPostId = lastPostId.replace(/\s+/g, '');
254
										//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
255
										if(lastPostId == old_lastPostId) {
256
											
257
											//morePostsAvailable = false;
258
										}
259
										else {
260
											//alert(elements[3].textContent);
261
											$('#posts').append(elements[1].innerHTML);
262
											$('#posts').hide().show(0);
263
										}
264
										$('#loading').hide();
265
									}
266
								});
267
268
								$('.jodel > content').Emoji();
269
							}
270
							
271
						}
272
						scrollToAnchor(hash);
273
274
					}						
275
				}
276
277
				// Each time the user scrolls
278
				win.scroll(function() {
279
280
281
					// End of the document reached?
282
					if ($(window).scrollTop() + $(window).height() > $(document).height() - 100 && morePostsAvailable)
283
					{
284
						$('#loading').show();
285
286
						$.ajax({
287
							url: 'get-posts-ajax.php?lastPostId=' + lastPostId + '&view=' + view,
288
							dataType: 'html',
289
							async: false,
290
							success: function(html) {
291
								var div = document.createElement('div');
292
								div.innerHTML = html;
293
								var elements = div.childNodes;
294
								old_lastPostId = lastPostId;
295
								lastPostId = elements[3].textContent;
296
								lastPostId = lastPostId.replace(/\s+/g, '');
297
								//alert('Neu: ' + lastPostId + " Alt: " + old_lastPostId);
298
								if(lastPostId == old_lastPostId)
299
								{
300
									
301
									//morePostsAvailable = false;
302
								}
303
								else
304
								{
305
									//alert(elements[3].textContent);
306
									$('#posts').append(elements[1].innerHTML);
307
								}
308
								$('#loading').hide();
309
							}
310
						});
311
312
						$('.jodel > content').Emoji();
313
					}
314
				});
315
			<?php } ?>
316
			});	
317
318
		</script>
319
320
		<?php  
321
			if(is_file('./piwik-script.html'))
322
			{
323
			    require_once('./piwik-script.html');
324
			}
325
		?>
326
327
	</body>
328
</html>
329
0 ignored issues
show
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
330