Test Failed
Push — main ( b09f12...0abb31 )
by chief
05:29
created
web/public/player/embed.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if(isset($_GET["v"])) {
2
+if (isset($_GET["v"])) {
3 3
 $vid = htmlspecialchars($_GET["v"]);
4 4
 }
5 5
 
Please login to merge, or discard this patch.
web/public/player/get_video_info.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 //first method, pick your video via URL
3
-if(isset($_GET["video_id"])) {
3
+if (isset($_GET["video_id"])) {
4 4
 $vid = htmlspecialchars($_GET["video_id"]); // this entire if statement is not required if you are using second method
5 5
 }
6 6
 
Please login to merge, or discard this patch.
web/public/player/player.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 $_video = $__video_h->fetch_video_rid($_GET['v']);
14 14
 
15 15
 if(isset($_GET["v"])) {
16
-  $vid = $_video['filename'];
16
+    $vid = $_video['filename'];
17 17
 }
18 18
 
19 19
 //if $vid is null then dont show anything
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 <?php
13 13
 $_video = $__video_h->fetch_video_rid($_GET['v']);
14 14
 
15
-if(isset($_GET["v"])) {
15
+if (isset($_GET["v"])) {
16 16
   $vid = $_video['filename'];
17 17
 }
18 18
 
Please login to merge, or discard this patch.
web/public/channel_videos.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 <?php $__db_h = new db_helper(); ?>
14 14
 <?php $__time_h = new time_helper(); ?>
15 15
 <?php
16
-	if(isset($_SESSION['siteusername']))
17
-	    $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']);
16
+    if(isset($_SESSION['siteusername']))
17
+        $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']);
18 18
 
19 19
     if(!$__user_h->user_exists($_GET['n']))
20 20
         header("Location: /?userdoesntexist");
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
         return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
28 28
     }
29 29
 
30
-	function addhttp($url) {
31
-		if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
32
-			$url = "http://" . $url;
33
-		}
34
-		return $url;
35
-	}
30
+    function addhttp($url) {
31
+        if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
32
+            $url = "http://" . $url;
33
+        }
34
+        return $url;
35
+    }
36 36
 
37 37
     function check_valid_colorhex($colorCode) {
38 38
         // If user accidentally passed along the # sign, strip it off
39 39
         $colorCode = ltrim($colorCode, '#');
40 40
     
41 41
         if (
42
-              ctype_xdigit($colorCode) &&
42
+                ctype_xdigit($colorCode) &&
43 43
               (strlen($colorCode) == 6 || strlen($colorCode) == 3))
44
-                   return true;
44
+                    return true;
45 45
     
46 46
         else return false;
47 47
     }
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; }
77 77
     if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; }
78 78
 
79
-	if(isset($_SESSION['siteusername']))
80
-    	$__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']);
79
+    if(isset($_SESSION['siteusername']))
80
+        $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']);
81 81
 
82 82
     if($_SERVER['REQUEST_METHOD'] == 'POST') {
83 83
         $error = array();
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
         //if(ifBlocked(@$_SESSION['siteusername'], $user['username'], $__db)) { $error = "This user has blocked you!"; $error['status'] = true; } 
92 92
 
93 93
         if(!isset($error['message'])) {
94
-			$text = $_POST['comment'];
94
+            $text = $_POST['comment'];
95 95
             $stmt = $__db->prepare("INSERT INTO profile_comments (toid, author, comment) VALUES (:id, :username, :comment)");
96
-			$stmt->bindParam(":id", $_user['username']);
97
-			$stmt->bindParam(":username", $_SESSION['siteusername']);
98
-			$stmt->bindParam(":comment", $text);
96
+            $stmt->bindParam(":id", $_user['username']);
97
+            $stmt->bindParam(":username", $_SESSION['siteusername']);
98
+            $stmt->bindParam(":comment", $text);
99 99
             $stmt->execute();
100 100
 
101 101
             $_user_update_utils->update_comment_cooldown_time($_SESSION['siteusername']);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             }
106 106
         }
107 107
     }
108
-	?>
108
+    ?>
109 109
 <!DOCTYPE html>
110 110
 <html dir="ltr" xmlns:og="http://opengraphprotocol.org/schema/" lang="en">
111 111
 	<!-- machid: sNW5tN3Z2SWdXaDRqNGxuNEF5MFBxM1BxWXd0VGo0Rkg3UXNTTTNCUGRDWjR0WGpHR3R1YzFR -->
@@ -294,17 +294,17 @@  discard block
 block discarded – undo
294 294
                                             <div class="channel-filtered-content">
295 295
                                                 <ol class="channel-videos-list">
296 296
 													<?php
297
-														$stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC");
298
-														$stmt->bindParam(":username", $_user['username']);
299
-														$stmt->execute();
300
-														while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
301
-															$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
302
-															$video['duration'] = $__time_h->timestamp($video['duration']);
303
-															$video['views'] = $__video_h->fetch_video_views($video['rid']);
304
-															$video['author'] = htmlspecialchars($video['author']);		
305
-															$video['title'] = htmlspecialchars($video['title']);
306
-															$video['description'] = $__video_h->shorten_description($video['description'], 50);
307
-													?>
297
+                                                        $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC");
298
+                                                        $stmt->bindParam(":username", $_user['username']);
299
+                                                        $stmt->execute();
300
+                                                        while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
301
+                                                            $video['age'] = $__time_h->time_elapsed_string($video['publish']);		
302
+                                                            $video['duration'] = $__time_h->timestamp($video['duration']);
303
+                                                            $video['views'] = $__video_h->fetch_video_views($video['rid']);
304
+                                                            $video['author'] = htmlspecialchars($video['author']);		
305
+                                                            $video['title'] = htmlspecialchars($video['title']);
306
+                                                            $video['description'] = $__video_h->shorten_description($video['description'], 50);
307
+                                                    ?>
308 308
                                                     <li class="yt-c3-grid-item">
309 309
                                                         <a href="/watch?v=<?php echo htmlspecialchars($video['rid']); ?>" class="ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto " data-sessionlink="feature=plcp&amp;context=C4e80d7cVDvjVQa1PpcFPHxNkhfeSQg8_nJHnhVurQf82C2OenNiw%3D"><span class="video-thumb ux-thumb yt-thumb-default-234 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" alt="Thumbnail" width="234"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span>
310 310
                                                         <button onclick=";return false;" title="Watch Later" type="button" class="addto-button video-actions addto-watch-later-button-sign-in yt-uix-button yt-uix-button-default yt-uix-button-short yt-uix-tooltip" data-button-menu-id="shared-addto-watch-later-login" data-video-ids="yBlvNSfqAj0" role="button"><span class="yt-uix-button-content">  <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later">
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 <?php $__db_h = new db_helper(); ?>
14 14
 <?php $__time_h = new time_helper(); ?>
15 15
 <?php
16
-	if(isset($_SESSION['siteusername']))
16
+	if (isset($_SESSION['siteusername']))
17 17
 	    $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']);
18 18
 
19
-    if(!$__user_h->user_exists($_GET['n']))
19
+    if (!$__user_h->user_exists($_GET['n']))
20 20
         header("Location: /?userdoesntexist");
21 21
 
22 22
     $_user = $__user_h->fetch_user_username($_GET['n']);
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
     $_user['genre'] = strtolower($_user['genre']);
70 70
     $_user['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_user['username']);
71 71
 
72
-    if(!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; }
73
-    if(!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; }
74
-    if(!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; }
75
-    if(!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; }
76
-    if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; }
77
-    if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; }
72
+    if (!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; }
73
+    if (!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; }
74
+    if (!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; }
75
+    if (!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; }
76
+    if (!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; }
77
+    if (!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; }
78 78
 
79
-	if(isset($_SESSION['siteusername']))
79
+	if (isset($_SESSION['siteusername']))
80 80
     	$__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']);
81 81
 
82
-    if($_SERVER['REQUEST_METHOD'] == 'POST') {
82
+    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
83 83
         $error = array();
84 84
 
85
-        if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; }
86
-        if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
87
-        if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
85
+        if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; }
86
+        if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
87
+        if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
88 88
         //if(!isset($_POST['g-recaptcha-response'])){ $error['message'] = "captcha validation failed"; $error['status'] = true; }
89 89
         //if(!$_user_insert_utils->validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error['message'] = "captcha validation failed"; $error['status'] = true; }
90
-        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; }
90
+        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; }
91 91
         //if(ifBlocked(@$_SESSION['siteusername'], $user['username'], $__db)) { $error = "This user has blocked you!"; $error['status'] = true; } 
92 92
 
93
-        if(!isset($error['message'])) {
93
+        if (!isset($error['message'])) {
94 94
 			$text = $_POST['comment'];
95 95
             $stmt = $__db->prepare("INSERT INTO profile_comments (toid, author, comment) VALUES (:id, :username, :comment)");
96 96
 			$stmt->bindParam(":id", $_user['username']);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
             $_user_update_utils->update_comment_cooldown_time($_SESSION['siteusername']);
102 102
 
103
-            if(@$_SESSION['siteusername'] != $_user['username']) { 
103
+            if (@$_SESSION['siteusername'] != $_user['username']) { 
104 104
                 $_user_insert_utils->send_message($_user['username'], "New comment", 'I commented "' . $_POST['comment'] . '" on your profile!', $_SESSION['siteusername']);
105 105
             }
106 106
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		<link rel="stylesheet" href="/yt/cssbin/www-extra.css">
127 127
 		<style>
128 128
 			#content-container {
129
-				background-color: <?php echo $_user['primary_color'];  ?>;
129
+				background-color: <?php echo $_user['primary_color']; ?>;
130 130
 				background-image: url(/dynamic/banners/<?php echo $_user['2009_bg']; ?>);
131 131
 				background-repeat: repeat;
132 132
 				background-position: center top;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 			<div id="masthead-container"><?php echo require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/header.php"); ?></div>
143 143
 			<div id="content-container">
144 144
 				<!-- begin content -->
145
-				<?php if(isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?>
145
+				<?php if (isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?>
146 146
 					<div class="channel_customization"><?php echo require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/channel_customization.php"); ?></div>
147 147
 				<?php } ?> 
148 148
 				<div id="content">
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 												<h1><?php echo htmlspecialchars($_user['username']); ?></h1>
198 198
 											</div>
199 199
 											<div class="upper-left-section enable-fancy-subscribe-button">
200
-												<?php if($_user['username'] != @$_SESSION['siteusername']) { ?>
200
+												<?php if ($_user['username'] != @$_SESSION['siteusername']) { ?>
201 201
 													<div class="yt-subscription-button-hovercard yt-uix-hovercard">
202 202
 														<button href="https://accounts.google.com/ServiceLogin?uilel=3&amp;service=youtube&amp;passive=true&amp;continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dsubscribe%26nomobiletemp%3D1%26hl%3Den_US%26next%3D%252Fuser%252F<?php echo htmlspecialchars($_user['username']); ?>%253Ffeature%253Dg-logo-xit&amp;hl=en_US&amp;ltmpl=sso" onclick=";window.location.href=this.getAttribute('href');return false;" title="" type="button" class="yt-subscription-button subscription-button-with-recommended-channels   yt-uix-button yt-uix-button-subscription yt-uix-tooltip" data-enable-hovercard="true" data-subscription-value="UCIwFjwMjI0y7PDBVEO9-bkQ" data-force-position="" data-position="" data-subscription-feature="channels3" data-subscription-type="channel" role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-subscribe" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></span><span class="yt-uix-button-content">  <span class="subscribe-label">Subscribe</span>
203 203
 														<span class="subscribed-label">Subscribed</span>
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 									</div>
264 264
 								</div>
265 265
 							</div>
266
-                            <?php if($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?>
266
+                            <?php if ($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?>
267 267
 							<div id="branded-page-body">
268 268
                                 <div class="channel-tab-content channel-layout-full-width">
269 269
                                     <div class="tab-content-body">
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 														$stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC");
298 298
 														$stmt->bindParam(":username", $_user['username']);
299 299
 														$stmt->execute();
300
-														while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
300
+														while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
301 301
 															$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
302 302
 															$video['duration'] = $__time_h->timestamp($video['duration']);
303 303
 															$video['views'] = $__video_h->fetch_video_views($video['rid']);
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 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@
 block discarded – undo
26 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 28
         if(!isset($error['message'])) {
29
-			$text = $_POST['comment'];
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']);
32
-			$stmt->bindParam(":username", $_SESSION['siteusername']);
33
-			$stmt->bindParam(":comment", $text);
32
+            $stmt->bindParam(":username", $_SESSION['siteusername']);
33
+            $stmt->bindParam(":comment", $text);
34 34
             $stmt->execute();
35 35
 
36
-			$__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment");
36
+            $__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment");
37 37
         }
38 38
 
39 39
         die(json_encode($request));
Please login to merge, or discard this 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/uploaded_video.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
     $video['title'] = htmlspecialchars($video['title']);
19 19
     $video['description'] = $__video_h->shorten_description($video['description'], 50);
20 20
 
21
-	if(!$__video_h->video_exists($_GET['v']))
22
-		header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag.");
21
+    if(!$__video_h->video_exists($_GET['v']))
22
+        header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag.");
23 23
 
24 24
     if($_SESSION['siteusername'] != $video['author'])
25 25
         header("Location: /");
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
     $video['title'] = htmlspecialchars($video['title']);
19 19
     $video['description'] = $__video_h->shorten_description($video['description'], 50);
20 20
 
21
-	if(!$__video_h->video_exists($_GET['v']))
21
+	if (!$__video_h->video_exists($_GET['v']))
22 22
 		header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag.");
23 23
 
24
-    if($_SESSION['siteusername'] != $video['author'])
24
+    if ($_SESSION['siteusername'] != $video['author'])
25 25
         header("Location: /");
26 26
 ?>
27 27
 <!DOCTYPE html>
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,12 +18,14 @@
 block discarded – undo
18 18
     $video['title'] = htmlspecialchars($video['title']);
19 19
     $video['description'] = $__video_h->shorten_description($video['description'], 50);
20 20
 
21
-	if(!$__video_h->video_exists($_GET['v']))
22
-		header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag.");
21
+	if(!$__video_h->video_exists($_GET['v'])) {
22
+			header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag.");
23
+	}
23 24
 
24
-    if($_SESSION['siteusername'] != $video['author'])
25
-        header("Location: /");
26
-?>
25
+    if($_SESSION['siteusername'] != $video['author']) {
26
+            header("Location: /");
27
+    }
28
+    ?>
27 29
 <!DOCTYPE html>
28 30
 <html>
29 31
 	<head>
Please login to merge, or discard this patch.
web/public/watch_2.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
         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; }
24 24
 
25 25
         if(!isset($error['message'])) {
26
-			$text = $_POST['comment'];
26
+            $text = $_POST['comment'];
27 27
             $stmt = $__db->prepare("INSERT INTO comments (toid, author, comment) VALUES (:v, :username, :comment)");
28 28
             $stmt->bindParam(":v", $_GET['v']);
29
-			$stmt->bindParam(":username", $_SESSION['siteusername']);
30
-			$stmt->bindParam(":comment", $text);
29
+            $stmt->bindParam(":username", $_SESSION['siteusername']);
30
+            $stmt->bindParam(":comment", $text);
31 31
             $stmt->execute();
32 32
 
33
-			$__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment");
33
+            $__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment");
34 34
         }
35 35
     }
36 36
 ?>
@@ -53,28 +53,28 @@  discard block
 block discarded – undo
53 53
 			if (window.yt.timing) {yt.timing.tick("ct");}    
54 54
 		</script>
55 55
 		<?php
56
-			$_video['dislikes'] =  $__video_h->get_video_stars_level($_video['rid'], 1);
57
-			$_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2);
56
+            $_video['dislikes'] =  $__video_h->get_video_stars_level($_video['rid'], 1);
57
+            $_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2);
58 58
 
59
-			$_video['likes'] =     $__video_h->get_video_stars_level($_video['rid'], 4);
60
-			$_video['likes'] +=    $__video_h->get_video_stars_level($_video['rid'], 5);
59
+            $_video['likes'] =     $__video_h->get_video_stars_level($_video['rid'], 4);
60
+            $_video['likes'] +=    $__video_h->get_video_stars_level($_video['rid'], 5);
61 61
 
62
-			$_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false);
63
-			$_video['likes'] += $__video_h->get_video_likes($_video['rid'], true);
62
+            $_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false);
63
+            $_video['likes'] += $__video_h->get_video_likes($_video['rid'], true);
64 64
 
65
-			if($_video['likes'] == 0 && $_video['dislikes'] == 0) {
66
-				$_video['likeswidth'] = 50;
67
-				$_video['dislikeswidth'] = 50;
68
-			} else {
69
-				$_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100;
70
-				$_video['dislikeswidth'] = 100 - $_video['likeswidth'];
71
-			}
65
+            if($_video['likes'] == 0 && $_video['dislikes'] == 0) {
66
+                $_video['likeswidth'] = 50;
67
+                $_video['dislikeswidth'] = 50;
68
+            } else {
69
+                $_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100;
70
+                $_video['dislikeswidth'] = 100 - $_video['likeswidth'];
71
+            }
72 72
 
73
-			$_video['liked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], true);
74
-			$_video['disliked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], false);
75
-			$_video['author_videos'] = $__video_h->fetch_user_videos($_video['author']);
76
-			$_video['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_video['author']);
77
-		?>
73
+            $_video['liked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], true);
74
+            $_video['disliked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], false);
75
+            $_video['author_videos'] = $__video_h->fetch_user_videos($_video['author']);
76
+            $_video['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_video['author']);
77
+        ?>
78 78
 	</head>
79 79
 	<body id="" class="date-20120927 en_US ltr   ytg-old-clearfix guide-feed-v2 gecko gecko-15" dir="ltr">
80 80
 		<form name="logoutForm" method="POST" action="/logout">
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 												</div>
358 358
 											</div>
359 359
 											<?php 
360
-												$stmt = $__db->prepare("SELECT * FROM video_response WHERE toid = :v ORDER BY id DESC LIMIT 4");
361
-												$stmt->bindParam(":v", $_GET['v']);
362
-												$stmt->execute();
363
-											?>
360
+                                                $stmt = $__db->prepare("SELECT * FROM video_response WHERE toid = :v ORDER BY id DESC LIMIT 4");
361
+                                                $stmt->bindParam(":v", $_GET['v']);
362
+                                                $stmt->execute();
363
+                                            ?>
364 364
 
365 365
 											<?php if($stmt->rowCount() != 0) { ?>
366 366
 												<div class="comments-section">
@@ -370,16 +370,16 @@  discard block
 block discarded – undo
370 370
 													<h4>Video Responses</h4>
371 371
 													<ul class="video-list">
372 372
 													<?php 
373
-														while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
374
-															if($__video_h->video_exists($video['video'])) { 
375
-																$video = $__video_h->fetch_video_rid($video['video']);
376
-																$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
377
-																$video['duration'] = $__time_h->timestamp($video['duration']);
378
-																$video['views'] = $__video_h->fetch_video_views($video['rid']);
379
-																$video['author'] = htmlspecialchars($video['author']);		
380
-																$video['title'] = htmlspecialchars($video['title']);
381
-																$video['description'] = $__video_h->shorten_description($video['description'], 50);
382
-													?>
373
+                                                        while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
374
+                                                            if($__video_h->video_exists($video['video'])) { 
375
+                                                                $video = $__video_h->fetch_video_rid($video['video']);
376
+                                                                $video['age'] = $__time_h->time_elapsed_string($video['publish']);		
377
+                                                                $video['duration'] = $__time_h->timestamp($video['duration']);
378
+                                                                $video['views'] = $__video_h->fetch_video_views($video['rid']);
379
+                                                                $video['author'] = htmlspecialchars($video['author']);		
380
+                                                                $video['title'] = htmlspecialchars($video['title']);
381
+                                                                $video['description'] = $__video_h->shorten_description($video['description'], 50);
382
+                                                    ?>
383 383
 														<li class="video-list-item yt-tile-default">
384 384
 															<a href="/watch?v=<?php echo $video['rid']; ?>" class="related-video yt-uix-contextlink  yt-uix-sessionlink" data-sessionlink="<?php echo htmlspecialchars($_video['author']); ?>&amp;feature=watch_response"><span class="ux-thumb-wrap contains-addto "><span class="video-thumb ux-thumb yt-thumb-default-120 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="<?php echo $video['title']; ?>" data-thumb="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" width="120"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span>
385 385
 															<button onclick=";return false;" title="Watch Later" type="button" class="addto-button video-actions addto-watch-later-button-sign-in yt-uix-button yt-uix-button-default yt-uix-button-short yt-uix-tooltip" data-button-menu-id="shared-addto-watch-later-login" data-video-ids="cjls0QsHOBE" role="button"><span class="yt-uix-button-content">  <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later">
@@ -461,31 +461,31 @@  discard block
 block discarded – undo
461 461
 												</div>
462 462
 												<ul class="comment-list" id="live_comments">
463 463
 														<?php
464
-														$results_per_page = 20;
464
+                                                        $results_per_page = 20;
465 465
 
466
-														$stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC");
467
-														$stmt->bindParam(":rid", $_video['rid']);
468
-														$stmt->execute();
466
+                                                        $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC");
467
+                                                        $stmt->bindParam(":rid", $_video['rid']);
468
+                                                        $stmt->execute();
469 469
 
470
-														$number_of_result = $stmt->rowCount();
471
-														$number_of_page = ceil ($number_of_result / $results_per_page);  
470
+                                                        $number_of_result = $stmt->rowCount();
471
+                                                        $number_of_page = ceil ($number_of_result / $results_per_page);  
472 472
 
473
-														if (!isset ($_GET['page']) ) {  
474
-															$page = 1;  
475
-														} else {  
476
-															$page = (int)$_GET['page'];  
477
-														}  
473
+                                                        if (!isset ($_GET['page']) ) {  
474
+                                                            $page = 1;  
475
+                                                        } else {  
476
+                                                            $page = (int)$_GET['page'];  
477
+                                                        }  
478 478
 
479
-														$page_first_result = ($page - 1) * $results_per_page;  
479
+                                                        $page_first_result = ($page - 1) * $results_per_page;  
480 480
 
481
-														$stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper");
482
-														$stmt->bindParam(":rid", $_video['rid']);
483
-														$stmt->bindParam(":pfirst", $page_first_result);
484
-														$stmt->bindParam(":pper", $results_per_page);
485
-														$stmt->execute();
481
+                                                        $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper");
482
+                                                        $stmt->bindParam(":rid", $_video['rid']);
483
+                                                        $stmt->bindParam(":pfirst", $page_first_result);
484
+                                                        $stmt->bindParam(":pper", $results_per_page);
485
+                                                        $stmt->execute();
486 486
 
487
-														while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
488
-													?>
487
+                                                        while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
488
+                                                    ?>
489 489
 
490 490
 													<li class="comment yt-tile-default " data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="HdQrMeklJ_5hd_uPDRcvtdaMk2pMVS8d9sufcfiGx0U" data-score="0">
491 491
 														<div class="comment-body">
@@ -564,16 +564,16 @@  discard block
 block discarded – undo
564 564
 											<ul id="watch-related" class="video-list">
565 565
 												<div id="ppv-container" class="hid"></div>
566 566
 												<?php
567
-													$stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 20");
568
-													$stmt->execute();
569
-													while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
570
-														$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
571
-														$video['duration'] = $__time_h->timestamp($video['duration']);
572
-														$video['views'] = $__video_h->fetch_video_views($video['rid']);
573
-														$video['author'] = htmlspecialchars($video['author']);		
574
-														$video['title'] = htmlspecialchars($video['title']);
575
-														$video['description'] = $__video_h->shorten_description($video['description'], 50);
576
-												?>
567
+                                                    $stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 20");
568
+                                                    $stmt->execute();
569
+                                                    while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
570
+                                                        $video['age'] = $__time_h->time_elapsed_string($video['publish']);		
571
+                                                        $video['duration'] = $__time_h->timestamp($video['duration']);
572
+                                                        $video['views'] = $__video_h->fetch_video_views($video['rid']);
573
+                                                        $video['author'] = htmlspecialchars($video['author']);		
574
+                                                        $video['title'] = htmlspecialchars($video['title']);
575
+                                                        $video['description'] = $__video_h->shorten_description($video['description'], 50);
576
+                                                ?>
577 577
 												<li class="video-list-item"><a href="/watch?v=<?php echo $video['rid']; ?>" class="related-video yt-uix-contextlink  yt-uix-sessionlink" data-sessionlink="ved=CAIQzRooAA%3D%3D&amp;<?php echo htmlspecialchars($_video['author']); ?>&amp;feature=relmfu"><span class="ux-thumb-wrap contains-addto "><span class="video-thumb ux-thumb yt-thumb-default-120 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="<?php echo $video['title']; ?>" data-thumb="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" width="120"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span>
578 578
 													<button onclick=";return false;" title="Watch Later" type="button" class="addto-button video-actions addto-watch-later-button-sign-in yt-uix-button yt-uix-button-default yt-uix-button-short yt-uix-tooltip" data-button-menu-id="shared-addto-watch-later-login" data-video-ids="gyAaIKF6tSQ" role="button"><span class="yt-uix-button-content">  <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later">
579 579
 													</span><img class="yt-uix-button-arrow" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></button>
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,19 +10,19 @@  discard block
 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
 
20
-        if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; }
21
-        if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
22
-        if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
23
-        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; }
20
+        if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; }
21
+        if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
22
+        if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
23
+        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; }
24 24
 
25
-        if(!isset($error['message'])) {
25
+        if (!isset($error['message'])) {
26 26
 			$text = $_POST['comment'];
27 27
             $stmt = $__db->prepare("INSERT INTO comments (toid, author, comment) VALUES (:v, :username, :comment)");
28 28
             $stmt->bindParam(":v", $_GET['v']);
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 			if (window.yt.timing) {yt.timing.tick("ct");}    
54 54
 		</script>
55 55
 		<?php
56
-			$_video['dislikes'] =  $__video_h->get_video_stars_level($_video['rid'], 1);
56
+			$_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1);
57 57
 			$_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2);
58 58
 
59
-			$_video['likes'] =     $__video_h->get_video_stars_level($_video['rid'], 4);
60
-			$_video['likes'] +=    $__video_h->get_video_stars_level($_video['rid'], 5);
59
+			$_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4);
60
+			$_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5);
61 61
 
62 62
 			$_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false);
63 63
 			$_video['likes'] += $__video_h->get_video_likes($_video['rid'], true);
64 64
 
65
-			if($_video['likes'] == 0 && $_video['dislikes'] == 0) {
65
+			if ($_video['likes'] == 0 && $_video['dislikes'] == 0) {
66 66
 				$_video['likeswidth'] = 50;
67 67
 				$_video['dislikeswidth'] = 50;
68 68
 			} else {
69
-				$_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100;
69
+				$_video['likeswidth'] = $_video['likes']/($_video['likes'] + $_video['dislikes'])*100;
70 70
 				$_video['dislikeswidth'] = 100 - $_video['likeswidth'];
71 71
 			}
72 72
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 									</div>
100 100
 									<div id="instream_google_companion_ad_div"></div>
101 101
 								</div>
102
-								<?php if(@$_SESSION['siteusername'] == $_video['author']) { ?>
102
+								<?php if (@$_SESSION['siteusername'] == $_video['author']) { ?>
103 103
 									<div id="watch-owner-container">
104 104
 										<div id="masthead-subnav" class="yt-nav yt-nav-dark ">
105 105
 											<ul class="yt-nav-aside">
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 											title="" 
135 135
 											id="subscribe-button"
136 136
 											type="button" 
137
-											class="<?php if($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
137
+											class="<?php if ($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
138 138
 											role="button">
139 139
 											<span class="yt-uix-button-icon-wrapper">
140 140
 												<img class="yt-uix-button-icon yt-uix-button-icon-subscribe" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="">
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 											<button onclick=";window.location.href=this.getAttribute('href');return false;"
227 227
 											title="I like this" 
228 228
 											type="button" 
229
-											class="start <?php if($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse  yt-uix-button yt-uix-button-default yt-uix-tooltip" 
229
+											class="start <?php if ($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse  yt-uix-button yt-uix-button-default yt-uix-tooltip" 
230 230
 											id="watch-like"  
231 231
 											href="/get/like_video?v=<?php echo $_video['rid']; ?>"
232 232
 											role="button"><span class="yt-uix-button-icon-wrapper">
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 											type="button" 
241 241
 											style="margin-left: -2px;"
242 242
 											href="/get/dislike_video?v=<?php echo $_video['rid']; ?>"
243
-											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" 
243
+											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" 
244 244
 											id="watch-unlike" 
245 245
 											role="button">
246 246
 												<span class="yt-uix-button-icon-wrapper">
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 												$stmt->execute();
363 363
 											?>
364 364
 
365
-											<?php if($stmt->rowCount() != 0) { ?>
365
+											<?php if ($stmt->rowCount() != 0) { ?>
366 366
 												<div class="comments-section">
367 367
 													<a class="comments-section-see-all" href="/video_response_view_all?v=<?php echo htmlspecialchars($_video['rid']); ?>">
368 368
 													see all
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 													<h4>Video Responses</h4>
371 371
 													<ul class="video-list">
372 372
 													<?php 
373
-														while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
374
-															if($__video_h->video_exists($video['video'])) { 
373
+														while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
374
+															if ($__video_h->video_exists($video['video'])) { 
375 375
 																$video = $__video_h->fetch_video_rid($video['video']);
376 376
 																$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
377 377
 																$video['duration'] = $__time_h->timestamp($video['duration']);
@@ -402,19 +402,19 @@  discard block
 block discarded – undo
402 402
 														</h4>
403 403
 													</div>
404 404
 												</div>
405
-												<?php if(!isset($_SESSION['siteusername'])) { ?>
405
+												<?php if (!isset($_SESSION['siteusername'])) { ?>
406 406
 													<div class="comments-post-container clearfix">
407 407
 														<div class="comments-post-alert">
408 408
 															<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>
409 409
 														</div>
410 410
 													</div>
411
-												<?php } else if($_video['commenting'] == "d") { ?>
411
+												<?php } else if ($_video['commenting'] == "d") { ?>
412 412
 													<div class="comments-post-container clearfix">
413 413
 														<div class="comments-post-alert">
414 414
 															This video has comemnting disabled!
415 415
 														</div>
416 416
 													</div>
417
-												<?php } else if($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?>
417
+												<?php } else if ($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?>
418 418
 													<div class="comments-post-container clearfix">
419 419
 														<div class="comments-post-alert">
420 420
 															This user has blocked you!
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
 														$stmt->execute();
469 469
 
470 470
 														$number_of_result = $stmt->rowCount();
471
-														$number_of_page = ceil ($number_of_result / $results_per_page);  
471
+														$number_of_page = ceil($number_of_result/$results_per_page);  
472 472
 
473
-														if (!isset ($_GET['page']) ) {  
473
+														if (!isset ($_GET['page'])) {  
474 474
 															$page = 1;  
475 475
 														} else {  
476
-															$page = (int)$_GET['page'];  
476
+															$page = (int) $_GET['page'];  
477 477
 														}  
478 478
 
479
-														$page_first_result = ($page - 1) * $results_per_page;  
479
+														$page_first_result = ($page - 1)*$results_per_page;  
480 480
 
481 481
 														$stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper");
482 482
 														$stmt->bindParam(":rid", $_video['rid']);
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 														$stmt->bindParam(":pper", $results_per_page);
485 485
 														$stmt->execute();
486 486
 
487
-														while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
487
+														while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
488 488
 													?>
489 489
 
490 490
 													<li class="comment yt-tile-default " data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="HdQrMeklJ_5hd_uPDRcvtdaMk2pMVS8d9sufcfiGx0U" data-score="0">
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 												<?php
567 567
 													$stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 20");
568 568
 													$stmt->execute();
569
-													while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
569
+													while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
570 570
 														$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
571 571
 														$video['duration'] = $__time_h->timestamp($video['duration']);
572 572
 														$video['views'] = $__video_h->fetch_video_views($video['rid']);
Please login to merge, or discard this patch.
web/public/playlists.php 2 patches
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.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@
 block discarded – undo
26 26
         if(!isset($error['message'])) {
27 27
             $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
28 28
             $result = '';
29
-            for ($i = 0; $i < 11; $i++)
30
-                $rid .= $characters[mt_rand(0, 63)];
29
+            for ($i = 0; $i < 11; $i++) {
30
+                            $rid .= $characters[mt_rand(0, 63)];
31
+            }
31 32
             $stmt = $__db->prepare("INSERT INTO playlists (title, description, rid, author) VALUES (:title, :desc, :rid, :username)");
32 33
             $stmt->bindParam(":title", $_POST['title']);
33 34
             $stmt->bindParam(":desc", $_POST['comment']);
Please login to merge, or discard this patch.