Test Failed
Push — main ( 0c12e7...ee73bc )
by chief
04:22
created
web/public/channel.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 <?php $__db_h = new db_helper(); ?>
13 13
 <?php $__time_h = new time_helper(); ?>
14 14
 <?php
15
-	if(isset($_SESSION['siteusername']))
15
+	if (isset($_SESSION['siteusername']))
16 16
 	    $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']);
17 17
 
18
-    if(!$__user_h->user_exists($_GET['n']))
18
+    if (!$__user_h->user_exists($_GET['n']))
19 19
         header("Location: /?userdoesntexist");
20 20
 
21 21
     $_user = $__user_h->fetch_user_username($_GET['n']);
@@ -67,28 +67,28 @@  discard block
 block discarded – undo
67 67
     $_user['genre'] = strtolower($_user['genre']);
68 68
 	$_user['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_user['username']);
69 69
 
70
-    if(!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; }
71
-    if(!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; }
72
-    if(!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; }
73
-    if(!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; }
74
-    if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; }
75
-    if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; }
70
+    if (!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; }
71
+    if (!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; }
72
+    if (!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; }
73
+    if (!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; }
74
+    if (!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; }
75
+    if (!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; }
76 76
 
77
-	if(isset($_SESSION['siteusername']))
77
+	if (isset($_SESSION['siteusername']))
78 78
     	$__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']);
79 79
 
80
-    if($_SERVER['REQUEST_METHOD'] == 'POST') {
80
+    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
81 81
         $error = array();
82 82
 
83
-        if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; }
84
-        if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
85
-        if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
83
+        if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; }
84
+        if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
85
+        if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
86 86
         //if(!isset($_POST['g-recaptcha-response'])){ $error['message'] = "captcha validation failed"; $error['status'] = true; }
87 87
         //if(!$_user_insert_utils->validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error['message'] = "captcha validation failed"; $error['status'] = true; }
88
-        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; }
88
+        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; }
89 89
         //if(ifBlocked(@$_SESSION['siteusername'], $user['username'], $__db)) { $error = "This user has blocked you!"; $error['status'] = true; } 
90 90
 
91
-        if(!isset($error['message'])) {
91
+        if (!isset($error['message'])) {
92 92
 			$text = $_POST['comment'];
93 93
             $stmt = $__db->prepare("INSERT INTO profile_comments (toid, author, comment) VALUES (:id, :username, :comment)");
94 94
 			$stmt->bindParam(":id", $_user['username']);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
             $_user_update_utils->update_comment_cooldown_time($_SESSION['siteusername']);
100 100
 
101
-            if(@$_SESSION['siteusername'] != $_user['username']) { 
101
+            if (@$_SESSION['siteusername'] != $_user['username']) { 
102 102
                 $_user_insert_utils->send_message($_user['username'], "New comment", 'I commented "' . $_POST['comment'] . '" on your profile!', $_SESSION['siteusername']);
103 103
             }
104 104
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		<link rel="stylesheet" href="/yt/cssbin/www-extra.css">
137 137
 		<style>
138 138
 			#content-container {
139
-				background-color: <?php echo $_user['primary_color'];  ?>;
139
+				background-color: <?php echo $_user['primary_color']; ?>;
140 140
 				background-image: url(/dynamic/banners/<?php echo $_user['2009_bg']; ?>);
141 141
 				background-repeat: repeat;
142 142
 				background-position: center top;
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 			<div id="masthead-container"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/header.php"); ?></div>
164 164
 			<div id="content-container">
165 165
 				<!-- begin content -->
166
-				<?php if(isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?>
166
+				<?php if (isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?>
167 167
 					<div class="channel_customization"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/channel_customization.php"); ?></div>
168 168
 				<?php } ?>
169 169
 				<?php
170
-					if(empty(trim($_user['bio'])))
170
+					if (empty(trim($_user['bio'])))
171 171
 						$_user['bio'] = "This user has no description.";
172 172
 				?>
173 173
 				<div id="content">
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 												<h1><?php echo htmlspecialchars($_user['username']); ?></h1>
223 223
 											</div>
224 224
 											<div class="upper-left-section enable-fancy-subscribe-button">
225
-												<?php if($_user['username'] != @$_SESSION['siteusername']) { ?>
225
+												<?php if ($_user['username'] != @$_SESSION['siteusername']) { ?>
226 226
 													<div class="yt-subscription-button-hovercard yt-uix-hovercard">
227 227
 														<button 
228 228
 															href="#" 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 															title="" 
231 231
 															id="subscribe-button"
232 232
 															type="button" 
233
-															class="yt-subscription-button <?php if($_user['subscribed']) { echo "subscribed "; } ?>  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
233
+															class="yt-subscription-button <?php if ($_user['subscribed']) { echo "subscribed "; } ?>  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
234 234
 															role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-subscribe" 
235 235
 															src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></span><span class="yt-uix-button-content">  <span class="subscribe-label">Subscribe</span>
236 236
 														<span class="subscribed-label">Subscribed</span>
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 												<div class="header-stats">
252 252
 													<div class="stat-entry">
253 253
 														<span class="stat-value"><?php echo $_user['subscribers']; ?></span>
254
-														<span class="stat-name"><?php if($_user['subscribers'] == 1){ ?>subscriber<?php }else{ ?>subscribers<?php } ?></span>
254
+														<span class="stat-name"><?php if ($_user['subscribers'] == 1) { ?>subscriber<?php } else { ?>subscribers<?php } ?></span>
255 255
 													</div>
256 256
 													<div class="stat-entry">
257 257
 														<span class="stat-value"><?php echo $_user['views']; ?></span>
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 									</div>
297 297
 								</div>
298 298
 							</div>
299
-                            <?php if($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?>
299
+                            <?php if ($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?>
300 300
 							<div id="branded-page-body">
301 301
 								<div class="channel-tab-content channel-layout-two-column selected blogger-template">
302 302
 									<div class="tab-content-body">
303 303
 										<div class="primary-pane">
304
-                                            <?php if($_user['featured'] != false && $__video_h->video_exists($_user['featured'])) { ?>
304
+                                            <?php if ($_user['featured'] != false && $__video_h->video_exists($_user['featured'])) { ?>
305 305
 											<div class="channels-featured-video channel-module yt-uix-c3-module-container has-visible-edge">
306 306
 												<div class="module-view featured-video-view-module">
307 307
 												<div id="watch-video" >
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 													<div class="playlist-info">
359 359
 														<h2>Uploaded videos</h2>
360 360
 														<div class="yt-horizontal-rule "><span class="first"></span><span class="second"></span><span class="third"></span></div>
361
-														<?php if($_user['videos'] == 0) { ?>
361
+														<?php if ($_user['videos'] == 0) { ?>
362 362
 															<h4>This user has not uploaded a video yet.</h4>
363 363
 														<?php } ?>
364 364
 													</div>
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                                                             $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC LIMIT 20");
368 368
                                                             $stmt->bindParam(":username", $_user['username']);
369 369
                                                             $stmt->execute();
370
-                                                            while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
370
+                                                            while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
371 371
                                                         ?>
372 372
 														<li class="blogger-video">
373 373
 															<div class="video yt-tile-visible">
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 														</div>
450 450
 														<hr class="yt-horizontal-rule ">
451 451
 													</div>
452
-													<?php if(!empty($_user['website'])) { ?>
452
+													<?php if (!empty($_user['website'])) { ?>
453 453
 														<div class="user-profile-item">
454 454
 															<div class="yt-c3-profile-custom-url field-container ">
455 455
 																<a href="<?php echo addhttp(htmlspecialchars($_user['website'])); ?>" rel="me nofollow" target="_blank" title="<?php echo htmlspecialchars($_user['website']); ?>" class="yt-uix-redirect-link">
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 															<h5>Country</h5>
499 499
 															<span class="value"><?php echo htmlspecialchars($_user['country']); ?></span>
500 500
 														</div>
501
-														<?php if($_user['genre'] != "none") { ?>
501
+														<?php if ($_user['genre'] != "none") { ?>
502 502
 															<div class="user-profile-item ">
503 503
 																<h5>Channel Genre</h5>
504 504
 																<span class="value"><?php echo htmlspecialchars($_user['genre']); ?></span>
@@ -510,13 +510,13 @@  discard block
 block discarded – undo
510 510
 											</div>
511 511
 											<div class="channel-module other-channels yt-uix-c3-module-container other-channels-compact">
512 512
 												<?php $_user['featured_channels'] = explode(",", $_user['featured_channels']); ?>
513
-												<?php if(count($_user['featured_channels']) != 0) { ?>
513
+												<?php if (count($_user['featured_channels']) != 0) { ?>
514 514
 												<div class="module-view other-channels-view">
515 515
 													<h2>Featured Channels</h2>
516 516
 													<ul class="channel-summary-list ">
517 517
 														<?php 
518
-															foreach($_user['featured_channels'] as $user) {
519
-																if($__user_h->user_exists($user)) {
518
+															foreach ($_user['featured_channels'] as $user) {
519
+																if ($__user_h->user_exists($user)) {
520 520
 														?>
521 521
 															<li class="yt-tile-visible yt-uix-tile">
522 522
 																<div class="channel-summary clearfix channel-summary-compact">
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
 												$stmt->bindParam(":search", $_user['username']);
546 546
 												$stmt->execute();
547 547
 
548
-												if($stmt->rowCount() != 0) {
548
+												if ($stmt->rowCount() != 0) {
549 549
 											?>
550 550
 												<div class="playlists-narrow channel-module yt-uix-c3-module-container">
551 551
 													<div class="module-view gh-featured">
552 552
 														<h2>Featured Playlists</h2>     
553 553
 														<?php
554
-														while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
554
+														while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
555 555
 															$playlist['videos'] = json_decode($playlist['videos']);
556 556
 														?> 
557 557
 															<div class="playlist yt-tile-visible yt-uix-tile">
Please login to merge, or discard this patch.
web/public/s/classes/video_helper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 
13 13
     public function sh_exec(string $cmd, string $outputfile = "", string $pidfile = "", bool $mergestderror = true, bool $bg = false) {
14 14
         $fullcmd = $cmd;
15
-        if(strlen($outputfile) > 0) $fullcmd .= " >> " . $outputfile;
16
-        if($mergestderror) $fullcmd .= " 2>&1";
15
+        if (strlen($outputfile) > 0) $fullcmd .= " >> " . $outputfile;
16
+        if ($mergestderror) $fullcmd .= " 2>&1";
17 17
         
18
-        if($bg) {
18
+        if ($bg) {
19 19
             $fullcmd = "nohup " . $fullcmd . " &";
20
-            if(strlen($pidfile)) $fullcmd .= " echo $! > " . $pidfile;
20
+            if (strlen($pidfile)) $fullcmd .= " echo $! > " . $pidfile;
21 21
         } else {
22
-            if(strlen($pidfile) > 0) $fullcmd .= "; echo $$ > " . $pidfile;
22
+            if (strlen($pidfile) > 0) $fullcmd .= "; echo $$ > " . $pidfile;
23 23
         }
24 24
         shell_exec($fullcmd);
25 25
     }
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
             $handle = fopen($file, "r");
30 30
             $i = 0;
31 31
             while (!feof($handle)) {
32
-                call_user_func_array($callback,array(fread($handle,$chunk_size),&$handle,$i));
32
+                call_user_func_array($callback, array(fread($handle, $chunk_size), &$handle, $i));
33 33
                 $i++;
34 34
             }
35 35
     
36 36
             fclose($handle);
37 37
         }
38
-        catch(Exception $e) {
39
-            trigger_error("file_get_contents_chunked::" . $e->getMessage(),E_USER_NOTICE);
38
+        catch (Exception $e) {
39
+            trigger_error("file_get_contents_chunked::" . $e->getMessage(), E_USER_NOTICE);
40 40
             return false;
41 41
         }
42 42
 
43 43
         return true;
44 44
     }
45 45
 
46
-	public function __construct($conn){
46
+	public function __construct($conn) {
47 47
         $this->__db = $conn;
48 48
 	}
49 49
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $stmt->execute();
62 62
         
63 63
         $views = 0;
64
-        while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
64
+        while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
65 65
             $views = $views + $this->fetch_video_views($video['rid']);
66 66
         }
67 67
         return $views;
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 
79 79
     function shorten_description(string $description, int $limit, bool $newlines = false) {
80 80
         $description = trim($description);
81
-        if(strlen($description) >= $limit) {
81
+        if (strlen($description) >= $limit) {
82 82
             $description = substr($description, 0, $limit) . "...";
83 83
         } 
84 84
 
85 85
         $description = htmlspecialchars($description);
86
-        if($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); }
86
+        if ($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); }
87 87
         return $description;
88 88
     }
89 89
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     }
97 97
 
98 98
     function get_video_likes($reciever, $liked) {
99
-        if($liked) {
99
+        if ($liked) {
100 100
             $stmt = $this->__db->prepare("SELECT `sender` FROM likes WHERE reciever = :reciever AND type = 'l'");
101 101
             $stmt->bindParam(":reciever", $reciever);
102 102
             $stmt->execute();
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     function if_liked($user, $reciever, $liked) {
115
-        if($liked) {
115
+        if ($liked) {
116 116
             $stmt = $this->__db->prepare("SELECT `sender` FROM likes WHERE sender = :sender AND reciever = :reciever AND type = 'l'");
117 117
             $stmt->bindParam(":sender", $user);
118 118
             $stmt->bindParam(":reciever", $reciever);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     }
131 131
 
132 132
     function if_comment_liked($user, $reciever, $liked) {
133
-        if($liked) {
133
+        if ($liked) {
134 134
             $stmt = $this->__db->prepare("SELECT `sender` FROM comment_likes WHERE sender = :sender AND reciever = :reciever AND type = 'l'");
135 135
             $stmt->bindParam(":sender", $user);
136 136
             $stmt->bindParam(":reciever", $reciever);
Please login to merge, or discard this patch.
web/public/results.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 
18 18
    $results_per_page = 12;
19 19
    $number_of_result = $request->search_amount;
20
-   $number_of_page = ceil ($number_of_result / $results_per_page);  
20
+   $number_of_page = ceil($number_of_result/$results_per_page);  
21 21
 
22
-   if (!isset ($_GET['page']) ) {  
22
+   if (!isset ($_GET['page'])) {  
23 23
        $page = 1;  
24 24
    } else {  
25
-       $page = (int)$_GET['page'];  
25
+       $page = (int) $_GET['page'];  
26 26
    }  
27 27
 
28
-   $page_first_result = ($page - 1) * $results_per_page;  
28
+   $page_first_result = ($page - 1)*$results_per_page;  
29 29
 
30 30
    $stmt6 = $__db->prepare("SELECT * FROM videos WHERE lower(title) LIKE lower(:search) ORDER BY id DESC LIMIT :pfirst, :pper");
31 31
    $stmt6->bindParam(":search", $request->like_search_term);
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                   <div id="results-main-content">
220 220
                      <ol id="search-results">
221 221
                         <?php
222
-                           while($video = $stmt6->fetch(PDO::FETCH_ASSOC)) { 
222
+                           while ($video = $stmt6->fetch(PDO::FETCH_ASSOC)) { 
223 223
                               $video['video_responses'] = $__video_h->get_video_responses($video['rid']);
224 224
                               $video['age'] = $__time_h->time_elapsed_string($video['publish']);		
225 225
                               $video['duration'] = $__time_h->timestamp($video['duration']);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                                  </div>
254 254
                               </li>
255 255
                         <?php } ?>
256
-                        <?php if($request->search_amount == 0)
256
+                        <?php if ($request->search_amount == 0)
257 257
                            echo "Your search query has brought no results.<br><br>";
258 258
                         ?>
259 259
                      </ol>
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             </div>
268 268
             <div id="search-footer-box" class="searchFooterBox">
269 269
                <div class="yt-uix-pager" role="navigation">
270
-                  <?php for($page = 1; $page<= $number_of_page; $page++) { ?>
270
+                  <?php for ($page = 1; $page <= $number_of_page; $page++) { ?>
271 271
                      <a href="/results?search_query=<?php echo $request->search_term; ?>&page=<?php echo $page; ?>">
272 272
                         <button class="yt-uix-button yt-uix-button-default"><?php echo $page; ?></button>
273 273
                      </a>
Please login to merge, or discard this patch.
web/public/view_playlist.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 <?php
15 15
     $_playlist = $__video_h->fetch_playlist_rid($_GET['v']);
16 16
 
17
-    if(!$__user_h->user_exists($_playlist['author']))
17
+    if (!$__user_h->user_exists($_playlist['author']))
18 18
         header("Location: /?userdoesntexist");    
19 19
 
20 20
     $_user = $__user_h->fetch_user_username($_playlist['author']);
@@ -66,28 +66,28 @@  discard block
 block discarded – undo
66 66
     $_user['genre'] = strtolower($_user['genre']);
67 67
 	$_user['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_user['username']);
68 68
 
69
-    if(!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; }
70
-    if(!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; }
71
-    if(!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; }
72
-    if(!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; }
73
-    if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; }
74
-    if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; }
69
+    if (!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; }
70
+    if (!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; }
71
+    if (!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; }
72
+    if (!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; }
73
+    if (!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; }
74
+    if (!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; }
75 75
 
76
-	if(isset($_SESSION['siteusername']))
76
+	if (isset($_SESSION['siteusername']))
77 77
     	$__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']);
78 78
 
79
-    if($_SERVER['REQUEST_METHOD'] == 'POST') {
79
+    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
80 80
         $error = array();
81 81
 
82
-        if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; }
83
-        if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
84
-        if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
82
+        if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; }
83
+        if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
84
+        if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
85 85
         //if(!isset($_POST['g-recaptcha-response'])){ $error['message'] = "captcha validation failed"; $error['status'] = true; }
86 86
         //if(!$_user_insert_utils->validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error['message'] = "captcha validation failed"; $error['status'] = true; }
87
-        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; }
87
+        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; }
88 88
         //if(ifBlocked(@$_SESSION['siteusername'], $user['username'], $__db)) { $error = "This user has blocked you!"; $error['status'] = true; } 
89 89
 
90
-        if(!isset($error['message'])) {
90
+        if (!isset($error['message'])) {
91 91
 			$text = $_POST['comment'];
92 92
             $stmt = $__db->prepare("INSERT INTO profile_comments (toid, author, comment) VALUES (:id, :username, :comment)");
93 93
 			$stmt->bindParam(":id", $_user['username']);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
             $_user_update_utils->update_comment_cooldown_time($_SESSION['siteusername']);
99 99
 
100
-            if(@$_SESSION['siteusername'] != $_user['username']) { 
100
+            if (@$_SESSION['siteusername'] != $_user['username']) { 
101 101
                 $_user_insert_utils->send_message($_user['username'], "New comment", 'I commented "' . $_POST['comment'] . '" on your profile!', $_SESSION['siteusername']);
102 102
             }
103 103
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		<link rel="stylesheet" href="/yt/cssbin/www-extra.css">
132 132
 		<style>
133 133
 			#content-container {
134
-				background-color: <?php echo $_user['primary_color'];  ?>;
134
+				background-color: <?php echo $_user['primary_color']; ?>;
135 135
 				background-image: url(/dynamic/banners/<?php echo $_user['2009_bg']; ?>);
136 136
 				background-repeat: repeat;
137 137
 				background-position: center top;
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 			<div id="masthead-container"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/header.php"); ?></div>
148 148
 			<div id="content-container">
149 149
 				<!-- begin content -->
150
-				<?php if(isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?>
150
+				<?php if (isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?>
151 151
 					<div class="channel_customization"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/channel_customization.php"); ?></div>
152 152
 				<?php } ?>
153 153
 				<?php
154
-					if(empty(trim($_user['bio'])))
154
+					if (empty(trim($_user['bio'])))
155 155
 						$_user['bio'] = "This user has no description.";
156 156
 				?>
157 157
 				<div id="content">
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 												</div>
212 212
 											</div>
213 213
 											<div class="upper-left-section enable-fancy-subscribe-button">
214
-												<?php if($_user['username'] != @$_SESSION['siteusername']) { ?>
214
+												<?php if ($_user['username'] != @$_SESSION['siteusername']) { ?>
215 215
 													<div class="yt-subscription-button-hovercard yt-uix-hovercard">
216 216
 														<button 
217 217
 															href="#" 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 															title="" 
220 220
 															id="subscribe-button"
221 221
 															type="button" 
222
-															class="yt-subscription-button <?php if($_user['subscribed']) { echo "subscribed "; } ?>  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
222
+															class="yt-subscription-button <?php if ($_user['subscribed']) { echo "subscribed "; } ?>  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
223 223
 															role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-subscribe" 
224 224
 															src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></span><span class="yt-uix-button-content">  <span class="subscribe-label">Subscribe</span>
225 225
 														<span class="subscribed-label">Subscribed</span>
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 									</div>
254 254
 								</div>
255 255
 							</div>
256
-                            <?php if($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?>
256
+                            <?php if ($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?>
257 257
 							<div id="branded-page-body">
258 258
 								<div class="channel-tab-content channel-layout-two-column selected blogger-template">
259 259
 									<div class="tab-content-body">
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 															<?php
288 288
 																$_playlist['videos'] = json_decode($_playlist['videos']);
289 289
 																$_playlist['count'] = 1;
290
-																foreach($_playlist['videos'] as $video) {
291
-																	if($__video_h->video_exists($video)) {
290
+																foreach ($_playlist['videos'] as $video) {
291
+																	if ($__video_h->video_exists($video)) {
292 292
 																		$_video = $__video_h->fetch_video_rid($video);
293 293
 																		$_video['video_responses'] = $__video_h->get_video_responses($_video['rid']);
294 294
 																		$_video['age'] = $__time_h->time_elapsed_string($_video['publish']);		
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 														</div>
388 388
 														<hr class="yt-horizontal-rule ">
389 389
 													</div>
390
-													<?php if(!empty($_user['website'])) { ?>
390
+													<?php if (!empty($_user['website'])) { ?>
391 391
 														<div class="user-profile-item">
392 392
 															<div class="yt-c3-profile-custom-url field-container ">
393 393
 																<a href="<?php echo addhttp(htmlspecialchars($_user['website'])); ?>" rel="me nofollow" target="_blank" title="<?php echo htmlspecialchars($_user['website']); ?>" class="yt-uix-redirect-link">
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 															<h5>Country</h5>
437 437
 															<span class="value"><?php echo htmlspecialchars($_user['country']); ?></span>
438 438
 														</div>
439
-														<?php if($_user['genre'] != "none") { ?>
439
+														<?php if ($_user['genre'] != "none") { ?>
440 440
 															<div class="user-profile-item ">
441 441
 																<h5>Channel Genre</h5>
442 442
 																<span class="value"><?php echo htmlspecialchars($_user['genre']); ?></span>
@@ -448,13 +448,13 @@  discard block
 block discarded – undo
448 448
 											</div>
449 449
 											<div class="channel-module other-channels yt-uix-c3-module-container other-channels-compact">
450 450
 												<?php $_user['featured_channels'] = explode(",", $_user['featured_channels']); ?>
451
-												<?php if(count($_user['featured_channels']) != 0) { ?>
451
+												<?php if (count($_user['featured_channels']) != 0) { ?>
452 452
 												<div class="module-view other-channels-view">
453 453
 													<h2>Featured Channels</h2>
454 454
 													<ul class="channel-summary-list ">
455 455
 														<?php 
456
-															foreach($_user['featured_channels'] as $user) {
457
-																if($__user_h->user_exists($user)) {
456
+															foreach ($_user['featured_channels'] as $user) {
457
+																if ($__user_h->user_exists($user)) {
458 458
 														?>
459 459
 															<li class="yt-tile-visible yt-uix-tile">
460 460
 																<div class="channel-summary clearfix channel-summary-compact">
@@ -483,13 +483,13 @@  discard block
 block discarded – undo
483 483
 												$stmt->bindParam(":search", $_user['username']);
484 484
 												$stmt->execute();
485 485
 
486
-												if($stmt->rowCount() != 0) {
486
+												if ($stmt->rowCount() != 0) {
487 487
 											?>
488 488
 												<div class="playlists-narrow channel-module yt-uix-c3-module-container">
489 489
 													<div class="module-view gh-featured">
490 490
 														<h2>Featured Playlists</h2>     
491 491
 														<?php
492
-														while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
492
+														while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
493 493
 															$playlist['videos'] = json_decode($playlist['videos']);
494 494
 														?> 
495 495
 															<div class="playlist yt-tile-visible yt-uix-tile">
Please login to merge, or discard this patch.
web/public/watch.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@  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($_SERVER['REQUEST_METHOD'] == 'POST') {
18
+    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
19 19
         $error = array();
20 20
 
21
-        if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; }
22
-        if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
23
-        if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment 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 posting another comment."; $error['status'] = true; }
21
+        if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; }
22
+        if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
23
+        if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment 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 posting another comment."; $error['status'] = true; }
25 25
 
26
-        if(!isset($error['message'])) {
26
+        if (!isset($error['message'])) {
27 27
 			$text = $_POST['comment'];
28 28
             $stmt = $__db->prepare("INSERT INTO comments (toid, author, comment) VALUES (:v, :username, :comment)");
29 29
             $stmt->bindParam(":v", $_GET['v']);
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
          if (window.yt.timing) {yt.timing.tick("ct");}    
81 81
       </script>
82 82
 		<?php
83
-			$_video['dislikes'] =  $__video_h->get_video_stars_level($_video['rid'], 1);
83
+			$_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1);
84 84
 			$_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2);
85 85
 
86
-			$_video['likes'] =     $__video_h->get_video_stars_level($_video['rid'], 4);
87
-			$_video['likes'] +=    $__video_h->get_video_stars_level($_video['rid'], 5);
86
+			$_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4);
87
+			$_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5);
88 88
 
89 89
 			$_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false);
90 90
 			$_video['likes'] += $__video_h->get_video_likes($_video['rid'], true);
91 91
 
92
-			if($_video['likes'] == 0 && $_video['dislikes'] == 0) {
92
+			if ($_video['likes'] == 0 && $_video['dislikes'] == 0) {
93 93
 				$_video['likeswidth'] = 50;
94 94
 				$_video['dislikeswidth'] = 50;
95 95
 			} else {
96
-				$_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100;
96
+				$_video['likeswidth'] = $_video['likes']/($_video['likes'] + $_video['dislikes'])*100;
97 97
 				$_video['dislikeswidth'] = 100 - $_video['likeswidth'];
98 98
 			}
99 99
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 									</div>
128 128
 									<div id="instream_google_companion_ad_div"></div>
129 129
 								</div>
130
-								<?php if(@$_SESSION['siteusername'] == $_video['author']) { ?>
130
+								<?php if (@$_SESSION['siteusername'] == $_video['author']) { ?>
131 131
 									<div id="watch-owner-container">
132 132
 										<div id="masthead-subnav" class="yt-nav yt-nav-dark ">
133 133
 											<ul class="yt-nav-aside">
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 											title="" 
163 163
 											id="subscribe-button"
164 164
 											type="button" 
165
-											class="<?php if($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
165
+											class="<?php if ($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button  yt-uix-button yt-uix-button-subscription yt-uix-tooltip" 
166 166
 											role="button">
167 167
 											<span class="yt-uix-button-icon-wrapper">
168 168
 												<img class="yt-uix-button-icon yt-uix-button-icon-subscribe" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="">
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 											<button onclick=";like_video();return false;"
244 244
 											title="I like this" 
245 245
 											type="button" 
246
-											class="start <?php if($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse  yt-uix-button yt-uix-button-default yt-uix-tooltip" 
246
+											class="start <?php if ($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse  yt-uix-button yt-uix-button-default yt-uix-tooltip" 
247 247
 											id="watch-like"  
248 248
 											href="/get/like_video?v=<?php echo $_video['rid']; ?>"
249 249
 											role="button"><span class="yt-uix-button-icon-wrapper">
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 											type="button" 
258 258
 											style="margin-left: -2px;"
259 259
 											href="/get/dislike_video?v=<?php echo $_video['rid']; ?>"
260
-											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" 
260
+											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" 
261 261
 											id="watch-unlike" 
262 262
 											role="button">
263 263
 												<span class="yt-uix-button-icon-wrapper">
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 												not implemented ismnf
276 276
 											</div>
277 277
 											<div id="watch-actions-logged-out" class="watch-actions-panel hid">
278
-												<?php if(!isset($_SESSION['siteusername'])) { ?>
278
+												<?php if (!isset($_SESSION['siteusername'])) { ?>
279 279
 												<div class="yt-alert yt-alert-naked yt-alert-warn  ">
280 280
 													<div class="yt-alert-icon">
281 281
 														<img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon">
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 												<?php } else { ?>
292 292
 													<h3>Be friends with the creator</h3>
293 293
 
294
-													<?php if($_SESSION['siteusername'] != $_video['author']) { ?>
294
+													<?php if ($_SESSION['siteusername'] != $_video['author']) { ?>
295 295
 														<img style="width: 50px;height:50px;" src="/dynamic/pfp/<?php echo $__user_h->fetch_pfp($_video['author']); ?>">
296 296
 														<span style="display: inline-block; vertical-align:top;width: 100px;font-size:11px;">
297 297
 															<b><a href="/user/<?php echo htmlspecialchars($_video['author']); ?>"><?php echo htmlspecialchars($_video['author']); ?></a></b><br>
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 														</span><br><br>
306 306
 													<?php } ?>
307 307
 
308
-													<?php if($_SESSION['siteusername'] != $_video['author']) { ?>
309
-														<?php if($_video['friended'] == false) { ?>
308
+													<?php if ($_SESSION['siteusername'] != $_video['author']) { ?>
309
+														<?php if ($_video['friended'] == false) { ?>
310 310
 															<a href="/friends">Send a friend request</a>
311 311
 														<?php } else { ?>
312 312
 															Your friend request is pending.
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 													<?php } ?>
317 317
 													<hr><br>
318 318
 													<h3>Add to Favorites</h3>
319
-													<?php if($_video['favorited'] == false) { ?>
319
+													<?php if ($_video['favorited'] == false) { ?>
320 320
 														<a href="/get/favorite?v=<?php echo $_video['rid']; ?>">Favorite Video</a>
321 321
 													<?php } else { ?>
322 322
 														<a href="/get/unfavorite?v=<?php echo $_video['rid']; ?>">Unfavorite Video</a>
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 														$stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20");
328 328
 														$stmt->bindParam(":username", $_SESSION['siteusername']);
329 329
 														$stmt->execute();
330
-														while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
330
+														while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
331 331
 															$buffer = json_decode($playlist['videos']);
332 332
 															@$rid = $buffer[0];
333
-															if(!empty($rid)) {
333
+															if (!empty($rid)) {
334 334
 																@$video = $__video_h->fetch_video_rid($rid);
335 335
 															} else {
336 336
 																$video['thumbnail'] = "";
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 												$stmt->execute();
609 609
 											?>
610 610
 
611
-											<?php if($stmt->rowCount() != 0) { ?>
611
+											<?php if ($stmt->rowCount() != 0) { ?>
612 612
 												<div class="comments-section">
613 613
 													<a class="comments-section-see-all" href="/video_response_view_all?v=<?php echo htmlspecialchars($_video['rid']); ?>">
614 614
 													see all
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 													<h4>Video Responses</h4>
617 617
 													<ul class="video-list">
618 618
 													<?php 
619
-														while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
620
-															if($__video_h->video_exists($video['video'])) { 
619
+														while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { 
620
+															if ($__video_h->video_exists($video['video'])) { 
621 621
 																$video = $__video_h->fetch_video_rid($video['video']);
622 622
 																$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
623 623
 																$video['duration'] = $__time_h->timestamp($video['duration']);
@@ -648,19 +648,19 @@  discard block
 block discarded – undo
648 648
 														</h4>
649 649
 													</div>
650 650
 												</div>
651
-												<?php if(!isset($_SESSION['siteusername'])) { ?>
651
+												<?php if (!isset($_SESSION['siteusername'])) { ?>
652 652
 													<div class="comments-post-container clearfix">
653 653
 														<div class="comments-post-alert">
654 654
 															<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>
655 655
 														</div>
656 656
 													</div>
657
-												<?php } else if($_video['commenting'] == "d") { ?>
657
+												<?php } else if ($_video['commenting'] == "d") { ?>
658 658
 													<div class="comments-post-container clearfix">
659 659
 														<div class="comments-post-alert">
660 660
 															This video has comemnting disabled!
661 661
 														</div>
662 662
 													</div>
663
-												<?php } else if($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?>
663
+												<?php } else if ($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?>
664 664
 													<div class="comments-post-container clearfix">
665 665
 														<div class="comments-post-alert">
666 666
 															This user has blocked you!
@@ -714,15 +714,15 @@  discard block
 block discarded – undo
714 714
 														$stmt->execute();
715 715
 
716 716
 														$number_of_result = $stmt->rowCount();
717
-														$number_of_page = ceil ($number_of_result / $results_per_page);  
717
+														$number_of_page = ceil($number_of_result/$results_per_page);  
718 718
 
719
-														if (!isset ($_GET['page']) ) {  
719
+														if (!isset ($_GET['page'])) {  
720 720
 															$page = 1;  
721 721
 														} else {  
722
-															$page = (int)$_GET['page'];  
722
+															$page = (int) $_GET['page'];  
723 723
 														}  
724 724
 
725
-														$page_first_result = ($page - 1) * $results_per_page;  
725
+														$page_first_result = ($page - 1)*$results_per_page;  
726 726
 
727 727
 														$stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper");
728 728
 														$stmt->bindParam(":rid", $_video['rid']);
@@ -730,10 +730,10 @@  discard block
 block discarded – undo
730 730
 														$stmt->bindParam(":pper", $results_per_page);
731 731
 														$stmt->execute();
732 732
 
733
-														while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
734
-															if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true))
733
+														while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
734
+															if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true))
735 735
 																$comment['liked'] = true;
736
-															else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false))
736
+															else if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false))
737 737
 																$comment['disliked'] = true;	
738 738
 													?>
739 739
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 												<?php
817 817
 													$stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 20");
818 818
 													$stmt->execute();
819
-													while($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
819
+													while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) {	
820 820
 														$video['age'] = $__time_h->time_elapsed_string($video['publish']);		
821 821
 														$video['duration'] = $__time_h->timestamp($video['duration']);
822 822
 														$video['views'] = $__video_h->fetch_video_views($video['rid']);
Please login to merge, or discard this patch.
web/public/comment_voting.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
     "action" => "l" /* fallback */
15 15
 ];
16 16
 
17
-if(!isset($_SESSION['siteusername']) || !isset($_GET['id'])) 
17
+if (!isset($_SESSION['siteusername']) || !isset($_GET['id'])) 
18 18
     header('Location: ' . $_SERVER['HTTP_REFERER']); 
19 19
 
20
-if(isset($_GET['a']) && $_GET['a'] == "-1") 
20
+if (isset($_GET['a']) && $_GET['a'] == "-1") 
21 21
     $request->action = "d";
22 22
 
23 23
 $stmt = $__db->prepare("SELECT * FROM comment_likes WHERE sender = :username AND reciever = :reciever AND type = 'l'");
24 24
 $stmt->bindParam(":username", $_SESSION['siteusername']);
25 25
 $stmt->bindParam(":reciever", $request->comment_id);
26 26
 $stmt->execute();
27
-while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
27
+while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
28 28
     $stmt = $__db->prepare("DELETE FROM comment_likes WHERE sender = :username AND reciever = :reciever");
29 29
     $stmt->execute(array(
30 30
         ':username' => $_SESSION['siteusername'],
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 $stmt->bindParam(":username", $_SESSION['siteusername']);
38 38
 $stmt->bindParam(":reciever", $request->comment_id);
39 39
 $stmt->execute();
40
-while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
40
+while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { 
41 41
     $stmt = $__db->prepare("DELETE FROM comment_likes WHERE sender = :username AND reciever = :reciever");
42 42
     $stmt->execute(array(
43 43
         ':username' => $_SESSION['siteusername'],
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     header('Location: ' . $_SERVER['HTTP_REFERER']);
47 47
 }
48 48
 
49
-if($request->action == "l") {
49
+if ($request->action == "l") {
50 50
     $stmt = $__db->prepare("INSERT INTO comment_likes (sender, reciever, type) VALUES (:sender, :reciever, 'l')");
51 51
     $stmt->bindParam(":sender", $_SESSION['siteusername']);
52 52
     $stmt->bindParam(":reciever", $request->comment_id);
Please login to merge, or discard this patch.
web/public/comment_service_ajax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 header('Content-Type: application/json');
3 3
 parse_str(file_get_contents("php://input"), $data);
4 4
 // Cast it to an object
5
-$data = (object)$data;
5
+$data = (object) $data;
6 6
 
7 7
 ?>
8 8
 <?php 
Please login to merge, or discard this patch.