Test Failed
Push — main ( 594560...d41f84 )
by chief
05:05 queued 02:09
created
web/public/watch.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 <?php $__user_u = new user_update($__db); ?>
12 12
 <?php $__db_h = new db_helper(); ?>
13 13
 <?php $__time_h = new time_helper(); ?>
14
-<?php if(!$__video_h->video_exists($_GET['v'])) { header("Location: /?error=This video doesn't exist!"); } ?>
14
+<?php if (!$__video_h->video_exists($_GET['v'])) { header("Location: /?error=This video doesn't exist!"); } ?>
15 15
 <?php $_video = $__video_h->fetch_video_rid($_GET['v']); ?>
16 16
 <?php $_video['comments'] = $__video_h->get_comments_from_video($_video['rid']); ?>
17 17
 <?php
18
-	if($_video['visibility'] == "v" && @$_SESSION['siteusername'] != $_video['author'])
18
+	if ($_video['visibility'] == "v" && @$_SESSION['siteusername'] != $_video['author'])
19 19
 		header("Location: /");
20 20
 
21 21
 	$__video_h->check_view($_GET['v'], @$_SERVER["HTTP_CF_CONNECTING_IP"]);
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
          if (window.yt.timing) {yt.timing.tick("ct");}    
67 67
       </script>
68 68
 		<?php
69
-			$_video['dislikes'] =  $__video_h->get_video_stars_level($_video['rid'], 1);
69
+			$_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1);
70 70
 			$_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2);
71 71
 
72
-			$_video['likes'] =     $__video_h->get_video_stars_level($_video['rid'], 4);
73
-			$_video['likes'] +=    $__video_h->get_video_stars_level($_video['rid'], 5);
72
+			$_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4);
73
+			$_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5);
74 74
 
75 75
 			$_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false);
76 76
 			$_video['likes'] += $__video_h->get_video_likes($_video['rid'], true);
77 77
 
78
-			if($_video['likes'] == 0 && $_video['dislikes'] == 0) {
78
+			if ($_video['likes'] == 0 && $_video['dislikes'] == 0) {
79 79
 				$_video['likeswidth'] = 0;
80 80
 				$_video['dislikeswidth'] = 0;
81 81
 			} else {
82
-				$_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100;
82
+				$_video['likeswidth'] = $_video['likes']/($_video['likes'] + $_video['dislikes'])*100;
83 83
 				$_video['dislikeswidth'] = 100 - $_video['likeswidth'];
84 84
 			}
85 85
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 									</div>
114 114
 									<div id="instream_google_companion_ad_div"></div>
115 115
 								</div>
116
-								<?php if(@$_SESSION['siteusername'] == $_video['author']) { ?>
116
+								<?php if (@$_SESSION['siteusername'] == $_video['author']) { ?>
117 117
 									<div id="watch-owner-container">
118 118
 										<div id="masthead-subnav" class="yt-nav yt-nav-dark ">
119 119
 											<ul class="yt-nav-aside">
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 										</div>
133 133
 									</div><br>
134 134
 								<?php } ?>
135
-								<?php if($__user_h->if_admin(@$_SESSION['siteusername']) && @$_SESSION['siteusername'] != $_video['author']) { ?>
135
+								<?php if ($__user_h->if_admin(@$_SESSION['siteusername']) && @$_SESSION['siteusername'] != $_video['author']) { ?>
136 136
 									<div id="watch-owner-container">
137 137
 										<div id="masthead-subnav" class="yt-nav yt-nav-dark ">
138 138
 											<ul class="yt-nav-aside">
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 										$stmt->execute();
162 162
 										$alts = $stmt->rowCount();
163 163
 
164
-										if($alts != 0) { echo "<span style='font-size:11px;color:grey;'>Alts will pop up below here...</span><br>"; }
164
+										if ($alts != 0) { echo "<span style='font-size:11px;color:grey;'>Alts will pop up below here...</span><br>"; }
165 165
 
166
-										while($username = $stmt->fetch(PDO::FETCH_ASSOC)) { 
167
-											if($username['username'] != $_video['author'] && $username['ip'] != "0.0.0.0")
166
+										while ($username = $stmt->fetch(PDO::FETCH_ASSOC)) { 
167
+											if ($username['username'] != $_video['author'] && $username['ip'] != "0.0.0.0")
168 168
 												echo "
169 169
 												  <a style='font-size:10px;' href='/user/" .  htmlspecialchars($username['username']) . "'>" . 
170 170
 													htmlspecialchars($username['username']) 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 											title="" 
190 190
 											id="subscribe-button"
191 191
 											type="button" 
192
-											class="<?php if($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
192
+											class="<?php if ($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
193 193
 											role="button">
194 194
 											<span class="yt-uix-button-icon-wrapper">
195 195
 												<img class="yt-uix-button-icon yt-uix-button-icon-subscribe" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="">
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 						<div id="watch-main-container">
248 248
 							<div id="watch-main">
249 249
 								<div id="watch-panel">
250
-									<?php if($_video['featured'] == "v") { ?>
250
+									<?php if ($_video['featured'] == "v") { ?>
251 251
 										<div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-warn">  <div class="yt-alert-icon">
252 252
 											<img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon">
253 253
 										</div>
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 										</div></div></div>
259 259
 									<?php }  ?>
260 260
 
261
-	  								<?php if($_video['visibility'] == "u") { ?>
261
+	  								<?php if ($_video['visibility'] == "u") { ?>
262 262
 										<div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-warn">  <div class="yt-alert-icon">
263 263
 											<img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon">
264 264
 										</div>
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 												This video is unlisted. Only people who have the link can view this video.
268 268
 											</div>
269 269
 										</div></div></div>
270
-									<?php } else if($_video['visibility'] == "v") { ?>
270
+									<?php } else if ($_video['visibility'] == "v") { ?>
271 271
 										<div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error">  <div class="yt-alert-icon">
272 272
 											<img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon">
273 273
 										</div>
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 											<button onclick=";window.location.href=this.getAttribute('href');return false;" href="/get/like_video?v=<?php echo $_video['rid']; ?>"
302 302
 											title="I like this" 
303 303
 											type="button" 
304
-											class="start <?php if($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse  yt-uix-button yt-uix-button-default yt-uix-tooltip" 
304
+											class="start <?php if ($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse  yt-uix-button yt-uix-button-default yt-uix-tooltip" 
305 305
 											id="watch-like"  
306 306
 											href="/get/like_video?v=<?php echo $_video['rid']; ?>"
307 307
 											role="button"><span class="yt-uix-button-icon-wrapper">
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 											type="button" 
316 316
 											style="margin-left: -2px;"
317 317
 											href="/get/dislike_video?v=<?php echo $_video['rid']; ?>"
318
-											class="end yt-uix-tooltip-reverse <?php if($_video['disliked']) { echo "unliked "; } ?>  yt-uix-button yt-uix-button-default yt-uix-tooltip yt-uix-button-empty" 
318
+											class="end yt-uix-tooltip-reverse <?php if ($_video['disliked']) { echo "unliked "; } ?>  yt-uix-button yt-uix-button-default yt-uix-tooltip yt-uix-button-empty" 
319 319
 											id="watch-unlike" 
320 320
 											role="button">
321 321
 												<span class="yt-uix-button-icon-wrapper">
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 												</div>
336 336
 											</div>
337 337
 											<div id="watch-actions-logged-out" class="watch-actions-panel hid">
338
-												<?php if(!isset($_SESSION['siteusername'])) { ?>
338
+												<?php if (!isset($_SESSION['siteusername'])) { ?>
339 339
 												<div class="yt-alert yt-alert-naked yt-alert-warn  ">
340 340
 													<div class="yt-alert-icon">
341 341
 														<img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon">
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 												<?php } else { ?>
352 352
 													<h3>Be friends with the creator</h3>
353 353
 
354
-													<?php if($_SESSION['siteusername'] != $_video['author']) { ?>
354
+													<?php if ($_SESSION['siteusername'] != $_video['author']) { ?>
355 355
 														<img style="width: 50px;height:50px;" src="/dynamic/pfp/<?php echo $__user_h->fetch_pfp($_video['author']); ?>">
356 356
 														<span style="display: inline-block; vertical-align:top;width: 100px;font-size:11px;">
357 357
 															<b><a href="/user/<?php echo htmlspecialchars($_video['author']); ?>"><?php echo htmlspecialchars($_video['author']); ?></a></b><br>
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 														</span><br><br>
366 366
 													<?php } ?>
367 367
 
368
-													<?php if($_SESSION['siteusername'] != $_video['author']) { ?>
369
-														<?php if($_video['friended'] == false) { ?>
368
+													<?php if ($_SESSION['siteusername'] != $_video['author']) { ?>
369
+														<?php if ($_video['friended'] == false) { ?>
370 370
 															<a href="/friends">Send a friend request</a>
371 371
 														<?php } else { ?>
372 372
 															Your friend request is pending.
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 													<?php } ?>
377 377
 													<hr><br>
378 378
 													<h3>Add to Favorites</h3>
379
-													<?php if($_video['favorited'] == false) { ?>
379
+													<?php if ($_video['favorited'] == false) { ?>
380 380
 														<a href="/get/favorite?v=<?php echo $_video['rid']; ?>">Favorite Video</a>
381 381
 													<?php } else { ?>
382 382
 														<a href="/get/unfavorite?v=<?php echo $_video['rid']; ?>">Unfavorite Video</a>
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 														$stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20");
388 388
 														$stmt->bindParam(":username", $_SESSION['siteusername']);
389 389
 														$stmt->execute();
390
-														while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
390
+														while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
391 391
 															$buffer = json_decode($playlist['videos']);
392 392
 															@$rid = $buffer[0];
393
-															if(!empty($rid)) {
393
+															if (!empty($rid)) {
394 394
 																@$video = $__video_h->fetch_video_rid($rid);
395 395
 															} else {
396 396
 																$video['thumbnail'] = "";
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 												$stmt->execute();
669 669
 											?>
670 670
 
671
-											<?php if($stmt->rowCount() != 0) { ?>
671
+											<?php if ($stmt->rowCount() != 0) { ?>
672 672
 												<div class="comments-section">
673 673
 													<a class="comments-section-see-all" href="/video_response_view_all?v=<?php echo htmlspecialchars($_video['rid']); ?>">
674 674
 													see all
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 													<h4>Video Responses</h4>
677 677
 													<ul class="video-list">
678 678
 													<?php 
679
-														while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
680
-															if($__video_h->video_exists($video['video'])) { 
679
+														while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
680
+															if ($__video_h->video_exists($video['video'])) { 
681 681
 																$video = $__video_h->fetch_video_rid($video['video']);
682 682
 																$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
683 683
 																$video['duration'] = $__time_h->timestamp($video['duration']);
@@ -708,18 +708,18 @@  discard block
 block discarded – undo
708 708
 														</h4>
709 709
 													</div>
710 710
 												</div>
711
-												<?php if(!isset($_SESSION['siteusername'])) { ?>
711
+												<?php if (!isset($_SESSION['siteusername'])) { ?>
712 712
 													<div class="comments-post-container clearfix">
713 713
 														<div class="comments-post-alert">
714 714
 															<a href="/sign_in">Sign In</a> or <a href="/sign_up">Sign Up</a><span class="comments-post-form-rollover-text"> now to post a comment!</span>
715 715
 														</div>
716 716
 													</div>
717
-												<?php } else if($_video['commenting'] == "d") { ?>
717
+												<?php } else if ($_video['commenting'] == "d") { ?>
718 718
 													<div class="comments-disabled-message">
719 719
 														<img src="http://s.ytimg.com/yt/img/icon_comments_disabled-vflxokpZC.png">
720 720
 														<span>Adding comments has been disabled for this video.</span>
721 721
 													</div>
722
-												<?php } else if($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?>
722
+												<?php } else if ($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?>
723 723
 													<div class="comments-post-container clearfix">
724 724
 														<div class="comments-post-alert">
725 725
 															This user has blocked you!
@@ -773,15 +773,15 @@  discard block
 block discarded – undo
773 773
 														$stmt->execute();
774 774
 
775 775
 														$number_of_result = $stmt->rowCount();
776
-														$number_of_page = ceil ($number_of_result / $results_per_page);  
776
+														$number_of_page = ceil($number_of_result/$results_per_page);  
777 777
 
778
-														if (!isset ($_GET['page']) ) {  
778
+														if (!isset ($_GET['page'])) {  
779 779
 															$page = 1;  
780 780
 														} else {  
781
-															$page = (int)$_GET['page'];  
781
+															$page = (int) $_GET['page'];  
782 782
 														}  
783 783
 
784
-														$page_first_result = ($page - 1) * $results_per_page;  
784
+														$page_first_result = ($page - 1)*$results_per_page;  
785 785
 
786 786
 														$stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper");
787 787
 														$stmt->bindParam(":rid", $_video['rid']);
@@ -789,10 +789,10 @@  discard block
 block discarded – undo
789 789
 														$stmt->bindParam(":pper", $results_per_page);
790 790
 														$stmt->execute();
791 791
 
792
-														while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
793
-															if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true))
792
+														while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
793
+															if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true))
794 794
 																$comment['liked'] = true;
795
-															else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false))
795
+															else if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false))
796 796
 																$comment['disliked'] = true;
797 797
 																
798 798
 															$comment['likes']  = $__video_h->get_comment_likes($comment['id'], true);
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 																			<span dir="ltr"><?php echo $__time_h->time_elapsed_string($comment['date']); ?><span>
815 815
 																			</span>
816 816
 																			</span></span>
817
-																			<?php if($comment['likes'] != 0) { ?>
817
+																			<?php if ($comment['likes'] != 0) { ?>
818 818
 																			<span dir="ltr" class="comments-rating-positive" title="9 up, 1 down">
819 819
 																				<?php echo $comment['likes']; ?>
820 820
 																				<img class="comments-rating-thumbs-up" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif">
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 																			</button>
843 843
 																		</span>
844 844
 																	</div>
845
-																<?php if(isset($_SESSION['siteusername'])) { ?> 
845
+																<?php if (isset($_SESSION['siteusername'])) { ?> 
846 846
 																	<li id="reply_to_<?php echo $comment['id']; ?>" style="display: none;" class="comment yt-tile-default  child" data-tag="O" data-author-viewing="" data-id="iRV7EkT9us81mDLFDSB6FAsB156Fdn13HUmTm26C3PE" data-score="34" data-author="<?php echo htmlspecialchars($row['author']); ?>">
847 847
 
848 848
 																	<div class="comment-body">
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 															$stmt2->bindParam(":rid", $comment['id']);
868 868
 															$stmt2->execute();
869 869
 
870
-															while($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { 
870
+															while ($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { 
871 871
 														?>
872 872
 															<li class="comment yt-tile-default " style="margin-left: 30px;" data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="<?php echo $reply['id']; ?>" data-score="0">
873 873
 																<div class="comment-body">
@@ -950,11 +950,11 @@  discard block
 block discarded – undo
950 950
 												<?php
951 951
 													$stmt = $__db->prepare("SELECT * FROM playlists ORDER BY rand() LIMIT 2");
952 952
 													$stmt->execute();
953
-													while($_playlist = $stmt->fetch(PDO::FETCH_ASSOC)) {	
953
+													while ($_playlist = $stmt->fetch(PDO::FETCH_ASSOC)) {	
954 954
 														$_playlist['videos'] = json_decode($_playlist['videos']);
955 955
 														$_playlist['count'] = 1;
956 956
 
957
-														if($__video_h->video_exists($_playlist['videos'][0])) {
957
+														if ($__video_h->video_exists($_playlist['videos'][0])) {
958 958
 															$video = $__video_h->fetch_video_rid($_playlist['videos'][0]);
959 959
 														} else {
960 960
 															$video = [];
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 												<?php
1010 1010
 													$stmt = $__db->prepare("SELECT * FROM videos WHERE visibility = 'n' ORDER BY rand() LIMIT 20");
1011 1011
 													$stmt->execute();
1012
-													while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
1012
+													while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
1013 1013
 														$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
1014 1014
 														$video['duration'] = $__time_h->timestamp($video['duration']);
1015 1015
 														$video['views'] = $__video_h->fetch_video_views($video['rid']);
Please login to merge, or discard this patch.