Test Failed
Push — main ( a87dfd...e3d6db )
by chief
02:55
created
web/public/get/like_video.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 $stmt->bindParam(":username", $_SESSION['siteusername']);
18 18
 $stmt->bindParam(":reciever", $name);
19 19
 $stmt->execute();
20
-while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
20
+while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
21 21
     $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever");
22 22
     $stmt->execute(array(
23 23
       ':username' => $_SESSION['siteusername'],
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 $stmt->bindParam(":username", $_SESSION['siteusername']);
31 31
 $stmt->bindParam(":reciever", $name);
32 32
 $stmt->execute();
33
-while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
33
+while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
34 34
     $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever");
35 35
     $stmt->execute(array(
36 36
       ':username' => $_SESSION['siteusername'],
Please login to merge, or discard this patch.
web/public/get/dislike_video.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 <?php
14 14
 $name = $_GET['v'];
15 15
 
16
-if(!isset($_SESSION['siteusername']) || !isset($_GET['v'])) {
16
+if (!isset($_SESSION['siteusername']) || !isset($_GET['v'])) {
17 17
     header('Location: ' . $_SERVER['HTTP_REFERER']);
18 18
 }
19 19
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $stmt->bindParam(":username", $_SESSION['siteusername']);
22 22
 $stmt->bindParam(":reciever", $name);
23 23
 $stmt->execute();
24
-while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
24
+while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
25 25
     $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever");
26 26
     $stmt->execute(array(
27 27
       ':username' => $_SESSION['siteusername'],
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 $stmt->bindParam(":username", $_SESSION['siteusername']);
35 35
 $stmt->bindParam(":reciever", $name);
36 36
 $stmt->execute();
37
-while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
37
+while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
38 38
     $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever");
39 39
     $stmt->execute(array(
40 40
       ':username' => $_SESSION['siteusername'],
Please login to merge, or discard this patch.
web/public/get/delete_video.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 <?php $video = $__video_h->fetch_video_rid($_GET['v']); ?>
14 14
 <?php
15 15
 
16
-if($video['author'] == $_SESSION['siteusername']) {
16
+if ($video['author'] == $_SESSION['siteusername']) {
17 17
   $stmt = $__db->prepare("DELETE FROM videos WHERE rid=:rid AND author=:author");
18 18
   $stmt->execute(array(
19 19
     ':author' => $video['author'],
Please login to merge, or discard this patch.
web/public/get/delete_playlist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 <?php $__time_h = new time_helper(); ?>
13 13
 <?php $playlist = $__video_h->fetch_playlist_rid($_GET['id']); ?>
14 14
 <?php
15
-if($playlist['author'] == $_SESSION['siteusername']) {
15
+if ($playlist['author'] == $_SESSION['siteusername']) {
16 16
     $stmt = $__db->prepare("DELETE FROM playlists WHERE rid=:rid AND author=:author");
17 17
     $stmt->execute(array(
18 18
         ':author' => $_SESSION['siteusername'],
Please login to merge, or discard this patch.
web/public/watch_ajax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
                     $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC LIMIT 20");
40 40
                     $stmt->bindParam(":username", $_video['author']);
41 41
                     $stmt->execute();
42
-                    while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
42
+                    while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
43 43
                         $video['age'] = $__time_h->time_elapsed_string($video['publish']);		
44 44
                         $video['duration'] = $__time_h->timestamp($video['duration']);
45 45
                         $video['views'] = $__video_h->fetch_video_views($video['rid']);
Please login to merge, or discard this patch.
web/public/comment_ajax.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
10 10
 <?php $__user_u = new user_update($__db); ?>
11 11
 <?php $__db_h = new db_helper(); ?>
12 12
 <?php $__time_h = new time_helper(); ?>
13
-<?php if(!$__video_h->video_exists($_GET['v'])) { header("Location: /?error=This video doesn't exist!"); } ?>
13
+<?php if (!$__video_h->video_exists($_GET['v'])) { header("Location: /?error=This video doesn't exist!"); } ?>
14 14
 <?php $_video = $__video_h->fetch_video_rid($_GET['v']); ?>
15 15
 <?php $_video['comments'] = $__video_h->get_comments_from_video($_video['rid']); ?>
16 16
 <?php
17
-    if($_SERVER['REQUEST_METHOD'] == 'POST') {
17
+    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
18 18
         $error = array();
19 19
         $request = (object) [
20 20
             "status" => "success"
21 21
         ];
22 22
 
23
-        if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; }
24
-        if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
25
-        if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
26
-        if($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before posting another comment."; $error['status'] = true; }
23
+        if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; }
24
+        if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
25
+        if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
26
+        if ($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before posting another comment."; $error['status'] = true; }
27 27
 
28
-        if(!isset($error['message'])) {
28
+        if (!isset($error['message'])) {
29 29
 			$text = $_POST['comment'];
30 30
             $stmt = $__db->prepare("INSERT INTO comments (toid, author, comment) VALUES (:v, :username, :comment)");
31 31
             $stmt->bindParam(":v", $_GET['v']);
Please login to merge, or discard this patch.
web/public/playlists.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@  discard block
 block discarded – undo
12 12
 <?php $__user_u = new user_update($__db); ?>
13 13
 <?php $__db_h = new db_helper(); ?>
14 14
 <?php $__time_h = new time_helper(); ?>
15
-<?php if(!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?>
15
+<?php if (!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?>
16 16
 <?php
17
-    if($_SERVER['REQUEST_METHOD'] == 'POST') {
17
+    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
18 18
         $error = array();
19 19
 
20
-        if(!isset($_SESSION['siteusername'])){ $error['message'] = "You are not logged in"; $error['status'] = true; }
21
-        if(!$_POST['comment']){ $error['message'] = "Your description cannot be blank"; $error['status'] = true; }
22
-        if(empty(trim($_POST['title']))){ $error['message'] = "Your title cannot be blank"; $error['status'] = true; }
23
-        if(strlen($_POST['comment']) > 1000){ $error['message'] = "Your description must be shorter than 1000 characters"; $error['status'] = true; }
24
-        if($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before making a playlist."; $error['status'] = true; }
20
+        if (!isset($_SESSION['siteusername'])) { $error['message'] = "You are not logged in"; $error['status'] = true; }
21
+        if (!$_POST['comment']) { $error['message'] = "Your description cannot be blank"; $error['status'] = true; }
22
+        if (empty(trim($_POST['title']))) { $error['message'] = "Your title cannot be blank"; $error['status'] = true; }
23
+        if (strlen($_POST['comment']) > 1000) { $error['message'] = "Your description must be shorter than 1000 characters"; $error['status'] = true; }
24
+        if ($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before making a playlist."; $error['status'] = true; }
25 25
 
26
-        if(!isset($error['message'])) {
26
+        if (!isset($error['message'])) {
27 27
             $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
28 28
             $result = '';
29 29
             for ($i = 0; $i < 11; $i++)
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
                                     $stmt->execute();
193 193
 
194 194
                                     $number_of_result = $stmt->rowCount();
195
-                                    $number_of_page = ceil ($number_of_result / $results_per_page);  
195
+                                    $number_of_page = ceil($number_of_result/$results_per_page);  
196 196
 
197
-                                    if (!isset ($_GET['page']) ) {  
197
+                                    if (!isset ($_GET['page'])) {  
198 198
                                         $page = 1;  
199 199
                                     } else {  
200
-                                        $page = (int)$_GET['page'];  
200
+                                        $page = (int) $_GET['page'];  
201 201
                                     }  
202 202
 
203
-                                    $page_first_result = ($page - 1) * $results_per_page;  
203
+                                    $page_first_result = ($page - 1)*$results_per_page;  
204 204
                                 ?>
205 205
                                 <?php 
206 206
                                     $stmt6 = $__db->prepare("SELECT * FROM playlists WHERE author = :search ORDER BY id DESC LIMIT :pfirst, :pper");
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
                                     </tr>
246 246
                                     
247 247
                                     <?php
248
-                                        while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
248
+                                        while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
249 249
                                             $playlist['videos'] = json_decode($playlist['videos']);
250
-                                            if($__video_h->video_exists(@$playlist['videos'][0])) {
251
-                                                if(count($playlist['videos']) != 0) {
250
+                                            if ($__video_h->video_exists(@$playlist['videos'][0])) {
251
+                                                if (count($playlist['videos']) != 0) {
252 252
                                                     $video = $__video_h->fetch_video_rid($playlist['videos'][0]);
253 253
                                                     $video['video_responses'] = $__video_h->get_video_responses($video['rid']);
254 254
                                                     $video['age'] = $__time_h->time_elapsed_string($video['publish']);		
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                                     </div>
331 331
                                 </center>
332 332
 
333
-                                <?php for($page = 1; $page<= $number_of_page; $page++) { ?>
333
+                                <?php for ($page = 1; $page <= $number_of_page; $page++) { ?>
334 334
                                     <button class="yt-uix-button yt-uix-button-default" onclick="ajax_fetch_videomanager(<?php echo $page; ?>)"><?php echo $page; ?></button>
335 335
                                 <?php } ?>   
336 336
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                                 </script>
377 377
 
378 378
                                 <?php 
379
-                                    if($stmt6->rowCount() == 0) { echo "
379
+                                    if ($stmt6->rowCount() == 0) { echo "
380 380
                                         <br>Welcome to your playlists! You can make collections of videos for you to share with others.<br>
381 381
                                     "; 
382 382
                                 } ?>
Please login to merge, or discard this patch.
web/public/favorite_videos.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 <?php $__user_h = new user_helper($__db); ?>
11 11
 <?php $__db_h = new db_helper(); ?>
12 12
 <?php $__time_h = new time_helper(); error_reporting(E_ERROR | E_PARSE); ?>
13
-<?php if(!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?>
13
+<?php if (!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?>
14 14
 <!DOCTYPE html>
15 15
 <html dir="ltr">
16 16
 	<head>
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
                                     $stmt->execute();
164 164
 
165 165
                                     $number_of_result = $stmt->rowCount();
166
-                                    $number_of_page = ceil ($number_of_result / $results_per_page);  
166
+                                    $number_of_page = ceil($number_of_result/$results_per_page);  
167 167
 
168
-                                    if (!isset ($_GET['page']) ) {  
168
+                                    if (!isset ($_GET['page'])) {  
169 169
                                         $page = 1;  
170 170
                                     } else {  
171
-                                        $page = (int)$_GET['page'];  
171
+                                        $page = (int) $_GET['page'];  
172 172
                                     }  
173 173
 
174
-                                    $page_first_result = ($page - 1) * $results_per_page;  
174
+                                    $page_first_result = ($page - 1)*$results_per_page;  
175 175
                                 ?>
176 176
                                 <?php 
177 177
                                     $stmt6 = $__db->prepare("SELECT * FROM favorite_video WHERE sender = :search ORDER BY id DESC LIMIT :pfirst, :pper");
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
                                     </tr>
192 192
                                     
193 193
                                     <?php
194
-                                        while($video = $stmt6->fetch(PDO::FETCH_ASSOC)) { 
195
-											if($__video_h->video_exists($video['reciever'])) {
194
+                                        while ($video = $stmt6->fetch(PDO::FETCH_ASSOC)) { 
195
+											if ($__video_h->video_exists($video['reciever'])) {
196 196
 												$_video = $__video_h->fetch_video_rid($video['reciever']);
197 197
 												$_video['video_responses'] = $__video_h->get_video_responses($_video['rid']);
198 198
 												$_video['age'] = $__time_h->time_elapsed_string($_video['publish']);		
@@ -202,19 +202,19 @@  discard block
 block discarded – undo
202 202
 												$_video['title'] = htmlspecialchars($_video['title']);
203 203
 												$_video['description'] = $__video_h->shorten_description($_video['description'], 50);
204 204
 
205
-												if($_video['thumbnail'] == ".png" && $_video['filename'] == ".mp4") {
205
+												if ($_video['thumbnail'] == ".png" && $_video['filename'] == ".mp4") {
206 206
 													$status = "Corrupted";
207
-												} else if($_video['visibility'] == "v") {
207
+												} else if ($_video['visibility'] == "v") {
208 208
 													$status = "Approved";
209
-												} else if($_video['visibility'] == "n") {
209
+												} else if ($_video['visibility'] == "n") {
210 210
 													$status = "Approved";
211
-												} else if($_video['visibility'] == "o") {
211
+												} else if ($_video['visibility'] == "o") {
212 212
 													$status = "Disapproved";
213 213
 												} else {
214 214
 													$status = "Unknown";
215 215
 												}                      
216 216
 												
217
-												if($_video['commenting'] == "a") 
217
+												if ($_video['commenting'] == "a") 
218 218
 													$_video['commentstatus'] = "Commenting allowed";
219 219
 												else 
220 220
 													$_video['commentstatus'] = "Commenting disallowed";
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
                                     </div>
261 261
                                 </center>
262 262
 
263
-                                <?php for($page = 1; $page<= $number_of_page; $page++) { ?>
263
+                                <?php for ($page = 1; $page <= $number_of_page; $page++) { ?>
264 264
                                     <button class="yt-uix-button yt-uix-button-default" onclick="ajax_fetch_videomanager(<?php echo $page; ?>)"><?php echo $page; ?></button>
265 265
                                 <?php } ?>   
266 266
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                                 </script>
307 307
 
308 308
                                 <?php 
309
-                                    if($stmt6->rowCount() == 0) { echo "
309
+                                    if ($stmt6->rowCount() == 0) { echo "
310 310
                                         <br>Welcome to your favorite vidoes page.<br>
311 311
 										You can add videos that you like and the video will be added here!
312 312
                                     "; 
Please login to merge, or discard this patch.
web/public/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 
4 4
 switch ($requestedPage[1]) {
5 5
     case 'player':
6
-        if($requestedPage[1] == "2009player" && $requestedPage[2] == "assets") {
6
+        if ($requestedPage[1] == "2009player" && $requestedPage[2] == "assets") {
7 7
             $a = implode("/", $requestedPage);
8 8
             $i = implode(".", $requestedPage);
9 9
             $file = file_get_contents($_SERVER['DOCUMENT_ROOT'] . $a);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         $file_info = new finfo(FILEINFO_MIME_TYPE);
43 43
         $mime_type = $file_info->buffer($file);
44
-        if($mime_type == "text/plain")
44
+        if ($mime_type == "text/plain")
45 45
             header('Content-Type: text/css');
46 46
         else
47 47
             header('Content-Type: ' . $mime_type);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		$__db_h = new db_helper(); 
83 83
 		$__time_h = new time_helper(); 
84 84
         
85
-        if(empty($requestedPage[1]))
85
+        if (empty($requestedPage[1]))
86 86
             require_once($_SERVER['DOCUMENT_ROOT'] . "/homepage.php");
87 87
         else
88 88
             require_once($_SERVER['DOCUMENT_ROOT'] . "/" . $requestedPage[1] . ".php");
Please login to merge, or discard this patch.