@@ -12,26 +12,26 @@ |
||
| 12 | 12 | <?php $__db_h = new db_helper(); ?> |
| 13 | 13 | <?php $__time_h = new time_helper(); ?> |
| 14 | 14 | <?php |
| 15 | - if(!$__video_h->video_exists($_GET['v'])) |
|
| 16 | - header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag."); |
|
| 15 | + if(!$__video_h->video_exists($_GET['v'])) |
|
| 16 | + header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag."); |
|
| 17 | 17 | |
| 18 | - $_video = $__video_h->fetch_video_rid($_GET['v']); |
|
| 19 | - $_video['video_responses'] = $__video_h->get_video_responses($_video['rid']); |
|
| 20 | - $_video['age'] = $__time_h->time_elapsed_string($_video['publish']); |
|
| 21 | - $_video['duration'] = $__time_h->timestamp($_video['duration']); |
|
| 22 | - $_video['views'] = $__video_h->fetch_video_views($_video['rid']); |
|
| 23 | - $_video['author'] = htmlspecialchars($_video['author']); |
|
| 24 | - $_video['title'] = htmlspecialchars($_video['title']); |
|
| 25 | - $_video['description'] = $__video_h->shorten_description($_video['description'], 50); |
|
| 18 | + $_video = $__video_h->fetch_video_rid($_GET['v']); |
|
| 19 | + $_video['video_responses'] = $__video_h->get_video_responses($_video['rid']); |
|
| 20 | + $_video['age'] = $__time_h->time_elapsed_string($_video['publish']); |
|
| 21 | + $_video['duration'] = $__time_h->timestamp($_video['duration']); |
|
| 22 | + $_video['views'] = $__video_h->fetch_video_views($_video['rid']); |
|
| 23 | + $_video['author'] = htmlspecialchars($_video['author']); |
|
| 24 | + $_video['title'] = htmlspecialchars($_video['title']); |
|
| 25 | + $_video['description'] = $__video_h->shorten_description($_video['description'], 50); |
|
| 26 | 26 | |
| 27 | 27 | if($_SESSION['siteusername'] != $_video['author']) |
| 28 | 28 | header("Location: /"); |
| 29 | 29 | ?> |
| 30 | 30 | <?php |
| 31 | - $__server->page_embeds->page_title = "SubRocks - Uploaded Video"; |
|
| 32 | - $__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube."; |
|
| 33 | - $__server->page_embeds->page_image = "/yt/imgbin/full-size-logo.png"; |
|
| 34 | - $__server->page_embeds->page_url = "https://subrock.rocks/"; |
|
| 31 | + $__server->page_embeds->page_title = "SubRocks - Uploaded Video"; |
|
| 32 | + $__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube."; |
|
| 33 | + $__server->page_embeds->page_image = "/yt/imgbin/full-size-logo.png"; |
|
| 34 | + $__server->page_embeds->page_url = "https://subrock.rocks/"; |
|
| 35 | 35 | ?> |
| 36 | 36 | <!DOCTYPE html> |
| 37 | 37 | <html> |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | <?php $__db_h = new db_helper(); ?> |
| 13 | 13 | <?php $__time_h = new time_helper(); ?> |
| 14 | 14 | <?php |
| 15 | - if(!$__video_h->video_exists($_GET['v'])) |
|
| 15 | + if (!$__video_h->video_exists($_GET['v'])) |
|
| 16 | 16 | header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag."); |
| 17 | 17 | |
| 18 | 18 | $_video = $__video_h->fetch_video_rid($_GET['v']); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $_video['title'] = htmlspecialchars($_video['title']); |
| 25 | 25 | $_video['description'] = $__video_h->shorten_description($_video['description'], 50); |
| 26 | 26 | |
| 27 | - if($_SESSION['siteusername'] != $_video['author']) |
|
| 27 | + if ($_SESSION['siteusername'] != $_video['author']) |
|
| 28 | 28 | header("Location: /"); |
| 29 | 29 | ?> |
| 30 | 30 | <?php |
@@ -12,8 +12,9 @@ discard block |
||
| 12 | 12 | <?php $__db_h = new db_helper(); ?> |
| 13 | 13 | <?php $__time_h = new time_helper(); ?> |
| 14 | 14 | <?php |
| 15 | - if(!$__video_h->video_exists($_GET['v'])) |
|
| 16 | - header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag."); |
|
| 15 | + if(!$__video_h->video_exists($_GET['v'])) { |
|
| 16 | + header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag."); |
|
| 17 | + } |
|
| 17 | 18 | |
| 18 | 19 | $_video = $__video_h->fetch_video_rid($_GET['v']); |
| 19 | 20 | $_video['video_responses'] = $__video_h->get_video_responses($_video['rid']); |
@@ -24,9 +25,10 @@ discard block |
||
| 24 | 25 | $_video['title'] = htmlspecialchars($_video['title']); |
| 25 | 26 | $_video['description'] = $__video_h->shorten_description($_video['description'], 50); |
| 26 | 27 | |
| 27 | - if($_SESSION['siteusername'] != $_video['author']) |
|
| 28 | - header("Location: /"); |
|
| 29 | -?> |
|
| 28 | + if($_SESSION['siteusername'] != $_video['author']) { |
|
| 29 | + header("Location: /"); |
|
| 30 | + } |
|
| 31 | + ?> |
|
| 30 | 32 | <?php |
| 31 | 33 | $__server->page_embeds->page_title = "SubRocks - Uploaded Video"; |
| 32 | 34 | $__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube."; |
@@ -15,26 +15,26 @@ discard block |
||
| 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(isset($_SESSION['siteusername'])) |
|
| 19 | - $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
|
| 18 | + if(isset($_SESSION['siteusername'])) |
|
| 19 | + $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
|
| 20 | 20 | |
| 21 | - $_SESSION['current_video'] = $_video['rid']; |
|
| 21 | + $_SESSION['current_video'] = $_video['rid']; |
|
| 22 | 22 | |
| 23 | - /* |
|
| 23 | + /* |
|
| 24 | 24 | PREPARE EMBEDS CLASS -- function(string $page_title, string $page_description...) |
| 25 | 25 | Returns a list of arrays for compatibility purposes & but downside is ugly for loop codes |
| 26 | 26 | Work on this tomorrow or some shit idk lol |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | - /* |
|
| 29 | + /* |
|
| 30 | 30 | USE THE GOD DAMN __CONFIG MORE -- idiot |
| 31 | 31 | Work on this tomorrow or some shit |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | - $__server->page_embeds->page_title = htmlspecialchars($_video['title']); |
|
| 35 | - $__server->page_embeds->page_description = htmlspecialchars($_video['description']); |
|
| 36 | - $__server->page_embeds->page_image = "/dynamic/thumbs/" . $_video['thumbnail']; |
|
| 37 | - $__server->page_embeds->page_url = "https://subrock.rocks/watch?v=" . htmlspecialchars($_video['rid']); |
|
| 34 | + $__server->page_embeds->page_title = htmlspecialchars($_video['title']); |
|
| 35 | + $__server->page_embeds->page_description = htmlspecialchars($_video['description']); |
|
| 36 | + $__server->page_embeds->page_image = "/dynamic/thumbs/" . $_video['thumbnail']; |
|
| 37 | + $__server->page_embeds->page_url = "https://subrock.rocks/watch?v=" . htmlspecialchars($_video['rid']); |
|
| 38 | 38 | ?> |
| 39 | 39 | <!DOCTYPE html> |
| 40 | 40 | <html> |
@@ -64,29 +64,29 @@ discard block |
||
| 64 | 64 | if (window.yt.timing) {yt.timing.tick("ct");} |
| 65 | 65 | </script> |
| 66 | 66 | <?php |
| 67 | - $_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1); |
|
| 68 | - $_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2); |
|
| 67 | + $_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1); |
|
| 68 | + $_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2); |
|
| 69 | 69 | |
| 70 | - $_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4); |
|
| 71 | - $_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5); |
|
| 70 | + $_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4); |
|
| 71 | + $_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5); |
|
| 72 | 72 | |
| 73 | - $_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false); |
|
| 74 | - $_video['likes'] += $__video_h->get_video_likes($_video['rid'], true); |
|
| 73 | + $_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false); |
|
| 74 | + $_video['likes'] += $__video_h->get_video_likes($_video['rid'], true); |
|
| 75 | 75 | |
| 76 | - if($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
| 77 | - $_video['likeswidth'] = 0; |
|
| 78 | - $_video['dislikeswidth'] = 0; |
|
| 79 | - } else { |
|
| 80 | - $_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100; |
|
| 81 | - $_video['dislikeswidth'] = 100 - $_video['likeswidth']; |
|
| 82 | - } |
|
| 76 | + if($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
| 77 | + $_video['likeswidth'] = 0; |
|
| 78 | + $_video['dislikeswidth'] = 0; |
|
| 79 | + } else { |
|
| 80 | + $_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100; |
|
| 81 | + $_video['dislikeswidth'] = 100 - $_video['likeswidth']; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - $_video['liked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], true); |
|
| 85 | - $_video['disliked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], false); |
|
| 86 | - $_video['author_videos'] = $__video_h->fetch_user_videos($_video['author']); |
|
| 87 | - $_video['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_video['author']); |
|
| 88 | - $_video['favorited'] = $__video_h->if_favorited(@$_SESSION['siteusername'], $_video['rid']); |
|
| 89 | - ?> |
|
| 84 | + $_video['liked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], true); |
|
| 85 | + $_video['disliked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], false); |
|
| 86 | + $_video['author_videos'] = $__video_h->fetch_user_videos($_video['author']); |
|
| 87 | + $_video['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_video['author']); |
|
| 88 | + $_video['favorited'] = $__video_h->if_favorited(@$_SESSION['siteusername'], $_video['rid']); |
|
| 89 | + ?> |
|
| 90 | 90 | </head> |
| 91 | 91 | <body id="" class="date-20120927 en_US ltr ytg-old-clearfix guide-feed-v2 gecko gecko-15" dir="ltr"> |
| 92 | 92 | <form name="logoutForm" method="POST" action="/logout"> |
@@ -310,21 +310,21 @@ discard block |
||
| 310 | 310 | <hr><br> |
| 311 | 311 | <h3>Add to a Playlist</h3> |
| 312 | 312 | <?php |
| 313 | - $stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20"); |
|
| 314 | - $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
| 315 | - $stmt->execute(); |
|
| 316 | - while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 317 | - $buffer = json_decode($playlist['videos']); |
|
| 318 | - @$rid = $buffer[0]; |
|
| 319 | - if(!empty($rid)) { |
|
| 320 | - @$video = $__video_h->fetch_video_rid($rid); |
|
| 321 | - } else { |
|
| 322 | - $video['thumbnail'] = ""; |
|
| 323 | - $video['duration'] = 0; |
|
| 324 | - } |
|
| 313 | + $stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20"); |
|
| 314 | + $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
| 315 | + $stmt->execute(); |
|
| 316 | + while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 317 | + $buffer = json_decode($playlist['videos']); |
|
| 318 | + @$rid = $buffer[0]; |
|
| 319 | + if(!empty($rid)) { |
|
| 320 | + @$video = $__video_h->fetch_video_rid($rid); |
|
| 321 | + } else { |
|
| 322 | + $video['thumbnail'] = ""; |
|
| 323 | + $video['duration'] = 0; |
|
| 324 | + } |
|
| 325 | 325 | |
| 326 | - $videos = count($buffer); |
|
| 327 | - ?> |
|
| 326 | + $videos = count($buffer); |
|
| 327 | + ?> |
|
| 328 | 328 | <a href="/get/add_to_playlist?id=<?php echo $_video['rid']; ?>&playlist=<?php echo $playlist['rid']; ?>">Add to <?php echo htmlspecialchars($playlist['title']); ?></a><br> |
| 329 | 329 | <?php } ?> |
| 330 | 330 | <?php } ?> |
@@ -589,10 +589,10 @@ discard block |
||
| 589 | 589 | </div> |
| 590 | 590 | </div> |
| 591 | 591 | <?php |
| 592 | - $stmt = $__db->prepare("SELECT * FROM video_response WHERE toid = :v ORDER BY id DESC LIMIT 4"); |
|
| 593 | - $stmt->bindParam(":v", $_GET['v']); |
|
| 594 | - $stmt->execute(); |
|
| 595 | - ?> |
|
| 592 | + $stmt = $__db->prepare("SELECT * FROM video_response WHERE toid = :v ORDER BY id DESC LIMIT 4"); |
|
| 593 | + $stmt->bindParam(":v", $_GET['v']); |
|
| 594 | + $stmt->execute(); |
|
| 595 | + ?> |
|
| 596 | 596 | |
| 597 | 597 | <?php if($stmt->rowCount() != 0) { ?> |
| 598 | 598 | <div class="comments-section"> |
@@ -602,16 +602,16 @@ discard block |
||
| 602 | 602 | <h4>Video Responses</h4> |
| 603 | 603 | <ul class="video-list"> |
| 604 | 604 | <?php |
| 605 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 606 | - if($__video_h->video_exists($video['video'])) { |
|
| 607 | - $video = $__video_h->fetch_video_rid($video['video']); |
|
| 608 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 609 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 610 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 611 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 612 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 613 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 614 | - ?> |
|
| 605 | + while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 606 | + if($__video_h->video_exists($video['video'])) { |
|
| 607 | + $video = $__video_h->fetch_video_rid($video['video']); |
|
| 608 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 609 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 610 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 611 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 612 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 613 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 614 | + ?> |
|
| 615 | 615 | <li class="video-list-item yt-tile-default"> |
| 616 | 616 | <a href="/watch?v=<?php echo $video['rid']; ?>" class="related-video yt-uix-contextlink yt-uix-sessionlink" data-sessionlink="<?php echo htmlspecialchars($_video['author']); ?>&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="//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> |
| 617 | 617 | <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"> |
@@ -692,38 +692,38 @@ discard block |
||
| 692 | 692 | </div> |
| 693 | 693 | <ul class="comment-list" id="live_comments"> |
| 694 | 694 | <?php |
| 695 | - $results_per_page = 20; |
|
| 695 | + $results_per_page = 20; |
|
| 696 | 696 | |
| 697 | - $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC"); |
|
| 698 | - $stmt->bindParam(":rid", $_video['rid']); |
|
| 699 | - $stmt->execute(); |
|
| 697 | + $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC"); |
|
| 698 | + $stmt->bindParam(":rid", $_video['rid']); |
|
| 699 | + $stmt->execute(); |
|
| 700 | 700 | |
| 701 | - $number_of_result = $stmt->rowCount(); |
|
| 702 | - $number_of_page = ceil ($number_of_result / $results_per_page); |
|
| 701 | + $number_of_result = $stmt->rowCount(); |
|
| 702 | + $number_of_page = ceil ($number_of_result / $results_per_page); |
|
| 703 | 703 | |
| 704 | - if (!isset ($_GET['page']) ) { |
|
| 705 | - $page = 1; |
|
| 706 | - } else { |
|
| 707 | - $page = (int)$_GET['page']; |
|
| 708 | - } |
|
| 704 | + if (!isset ($_GET['page']) ) { |
|
| 705 | + $page = 1; |
|
| 706 | + } else { |
|
| 707 | + $page = (int)$_GET['page']; |
|
| 708 | + } |
|
| 709 | 709 | |
| 710 | - $page_first_result = ($page - 1) * $results_per_page; |
|
| 710 | + $page_first_result = ($page - 1) * $results_per_page; |
|
| 711 | 711 | |
| 712 | - $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper"); |
|
| 713 | - $stmt->bindParam(":rid", $_video['rid']); |
|
| 714 | - $stmt->bindParam(":pfirst", $page_first_result); |
|
| 715 | - $stmt->bindParam(":pper", $results_per_page); |
|
| 716 | - $stmt->execute(); |
|
| 712 | + $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper"); |
|
| 713 | + $stmt->bindParam(":rid", $_video['rid']); |
|
| 714 | + $stmt->bindParam(":pfirst", $page_first_result); |
|
| 715 | + $stmt->bindParam(":pper", $results_per_page); |
|
| 716 | + $stmt->execute(); |
|
| 717 | 717 | |
| 718 | - while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 719 | - if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
| 720 | - $comment['liked'] = true; |
|
| 721 | - else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
| 722 | - $comment['disliked'] = true; |
|
| 718 | + while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 719 | + if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
| 720 | + $comment['liked'] = true; |
|
| 721 | + else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
| 722 | + $comment['disliked'] = true; |
|
| 723 | 723 | |
| 724 | - $comment['likes'] = $__video_h->get_comment_likes($comment['id'], true); |
|
| 725 | - $comment['likes'] -= $__video_h->get_comment_likes($comment['id'], false); |
|
| 726 | - ?> |
|
| 724 | + $comment['likes'] = $__video_h->get_comment_likes($comment['id'], true); |
|
| 725 | + $comment['likes'] -= $__video_h->get_comment_likes($comment['id'], false); |
|
| 726 | + ?> |
|
| 727 | 727 | |
| 728 | 728 | <li class="comment yt-tile-default " data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="<?php echo $comment['id']; ?>" data-score="0"> |
| 729 | 729 | <div class="comment-body"> |
@@ -789,12 +789,12 @@ discard block |
||
| 789 | 789 | </div> |
| 790 | 790 | </li> |
| 791 | 791 | <?php |
| 792 | - $stmt2 = $__db->prepare("SELECT * FROM comment_reply WHERE toid = :rid ORDER BY id DESC"); |
|
| 793 | - $stmt2->bindParam(":rid", $comment['id']); |
|
| 794 | - $stmt2->execute(); |
|
| 792 | + $stmt2 = $__db->prepare("SELECT * FROM comment_reply WHERE toid = :rid ORDER BY id DESC"); |
|
| 793 | + $stmt2->bindParam(":rid", $comment['id']); |
|
| 794 | + $stmt2->execute(); |
|
| 795 | 795 | |
| 796 | - while($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
| 797 | - ?> |
|
| 796 | + while($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
| 797 | + ?> |
|
| 798 | 798 | <li class="comment yt-tile-default " style="padding-left: 30px;" data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="<?php echo $reply['id']; ?>" data-score="0"> |
| 799 | 799 | <div class="comment-body"> |
| 800 | 800 | <div class="content-container"> |
@@ -875,16 +875,16 @@ discard block |
||
| 875 | 875 | <ul id="watch-related" class="video-list"> |
| 876 | 876 | <div id="ppv-container" class="hid"></div> |
| 877 | 877 | <?php |
| 878 | - $stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 20"); |
|
| 879 | - $stmt->execute(); |
|
| 880 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 881 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 882 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 883 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 884 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 885 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 886 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 887 | - ?> |
|
| 878 | + $stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 20"); |
|
| 879 | + $stmt->execute(); |
|
| 880 | + while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 881 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 882 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 883 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 884 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 885 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 886 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 887 | + ?> |
|
| 888 | 888 | <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&<?php echo htmlspecialchars($_video['author']); ?>&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="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="<?php echo $video['title']; ?>" onerror=";this.src='/dynamic/thumbs/default.jpg';" 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> |
| 889 | 889 | <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"> |
| 890 | 890 | </span><img class="yt-uix-button-arrow" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></button> |
@@ -11,11 +11,11 @@ discard block |
||
| 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(isset($_SESSION['siteusername'])) |
|
| 18 | + if (isset($_SESSION['siteusername'])) |
|
| 19 | 19 | $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
| 20 | 20 | |
| 21 | 21 | $_SESSION['current_video'] = $_video['rid']; |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | if (window.yt.timing) {yt.timing.tick("ct");} |
| 65 | 65 | </script> |
| 66 | 66 | <?php |
| 67 | - $_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1); |
|
| 67 | + $_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1); |
|
| 68 | 68 | $_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2); |
| 69 | 69 | |
| 70 | - $_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4); |
|
| 71 | - $_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5); |
|
| 70 | + $_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4); |
|
| 71 | + $_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5); |
|
| 72 | 72 | |
| 73 | 73 | $_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false); |
| 74 | 74 | $_video['likes'] += $__video_h->get_video_likes($_video['rid'], true); |
| 75 | 75 | |
| 76 | - if($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
| 76 | + if ($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
| 77 | 77 | $_video['likeswidth'] = 0; |
| 78 | 78 | $_video['dislikeswidth'] = 0; |
| 79 | 79 | } else { |
| 80 | - $_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100; |
|
| 80 | + $_video['likeswidth'] = $_video['likes']/($_video['likes'] + $_video['dislikes'])*100; |
|
| 81 | 81 | $_video['dislikeswidth'] = 100 - $_video['likeswidth']; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | </div> |
| 112 | 112 | <div id="instream_google_companion_ad_div"></div> |
| 113 | 113 | </div> |
| 114 | - <?php if(@$_SESSION['siteusername'] == $_video['author']) { ?> |
|
| 114 | + <?php if (@$_SESSION['siteusername'] == $_video['author']) { ?> |
|
| 115 | 115 | <div id="watch-owner-container"> |
| 116 | 116 | <div id="masthead-subnav" class="yt-nav yt-nav-dark "> |
| 117 | 117 | <ul class="yt-nav-aside"> |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | title="" |
| 147 | 147 | id="subscribe-button" |
| 148 | 148 | type="button" |
| 149 | - class="<?php if($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button yt-uix-button yt-uix-button-subscription yt-uix-tooltip" |
|
| 149 | + class="<?php if ($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button yt-uix-button yt-uix-button-subscription yt-uix-tooltip" |
|
| 150 | 150 | role="button"> |
| 151 | 151 | <span class="yt-uix-button-icon-wrapper"> |
| 152 | 152 | <img class="yt-uix-button-icon yt-uix-button-icon-subscribe" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""> |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | <button onclick=";like_video();return false;" |
| 228 | 228 | title="I like this" |
| 229 | 229 | type="button" |
| 230 | - class="start <?php if($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse yt-uix-button yt-uix-button-default yt-uix-tooltip" |
|
| 230 | + class="start <?php if ($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse yt-uix-button yt-uix-button-default yt-uix-tooltip" |
|
| 231 | 231 | id="watch-like" |
| 232 | 232 | href="/get/like_video?v=<?php echo $_video['rid']; ?>" |
| 233 | 233 | role="button"><span class="yt-uix-button-icon-wrapper"> |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | type="button" |
| 242 | 242 | style="margin-left: -2px;" |
| 243 | 243 | href="/get/dislike_video?v=<?php echo $_video['rid']; ?>" |
| 244 | - 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 | + 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" |
|
| 245 | 245 | id="watch-unlike" |
| 246 | 246 | role="button"> |
| 247 | 247 | <span class="yt-uix-button-icon-wrapper"> |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | </div> |
| 262 | 262 | </div> |
| 263 | 263 | <div id="watch-actions-logged-out" class="watch-actions-panel hid"> |
| 264 | - <?php if(!isset($_SESSION['siteusername'])) { ?> |
|
| 264 | + <?php if (!isset($_SESSION['siteusername'])) { ?> |
|
| 265 | 265 | <div class="yt-alert yt-alert-naked yt-alert-warn "> |
| 266 | 266 | <div class="yt-alert-icon"> |
| 267 | 267 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | <?php } else { ?> |
| 278 | 278 | <h3>Be friends with the creator</h3> |
| 279 | 279 | |
| 280 | - <?php if($_SESSION['siteusername'] != $_video['author']) { ?> |
|
| 280 | + <?php if ($_SESSION['siteusername'] != $_video['author']) { ?> |
|
| 281 | 281 | <img style="width: 50px;height:50px;" src="/dynamic/pfp/<?php echo $__user_h->fetch_pfp($_video['author']); ?>"> |
| 282 | 282 | <span style="display: inline-block; vertical-align:top;width: 100px;font-size:11px;"> |
| 283 | 283 | <b><a href="/user/<?php echo htmlspecialchars($_video['author']); ?>"><?php echo htmlspecialchars($_video['author']); ?></a></b><br> |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | </span><br><br> |
| 292 | 292 | <?php } ?> |
| 293 | 293 | |
| 294 | - <?php if($_SESSION['siteusername'] != $_video['author']) { ?> |
|
| 295 | - <?php if($_video['friended'] == false) { ?> |
|
| 294 | + <?php if ($_SESSION['siteusername'] != $_video['author']) { ?> |
|
| 295 | + <?php if ($_video['friended'] == false) { ?> |
|
| 296 | 296 | <a href="/friends">Send a friend request</a> |
| 297 | 297 | <?php } else { ?> |
| 298 | 298 | Your friend request is pending. |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | <?php } ?> |
| 303 | 303 | <hr><br> |
| 304 | 304 | <h3>Add to Favorites</h3> |
| 305 | - <?php if($_video['favorited'] == false) { ?> |
|
| 305 | + <?php if ($_video['favorited'] == false) { ?> |
|
| 306 | 306 | <a href="/get/favorite?v=<?php echo $_video['rid']; ?>">Favorite Video</a> |
| 307 | 307 | <?php } else { ?> |
| 308 | 308 | <a href="/get/unfavorite?v=<?php echo $_video['rid']; ?>">Unfavorite Video</a> |
@@ -313,10 +313,10 @@ discard block |
||
| 313 | 313 | $stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20"); |
| 314 | 314 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
| 315 | 315 | $stmt->execute(); |
| 316 | - while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 316 | + while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 317 | 317 | $buffer = json_decode($playlist['videos']); |
| 318 | 318 | @$rid = $buffer[0]; |
| 319 | - if(!empty($rid)) { |
|
| 319 | + if (!empty($rid)) { |
|
| 320 | 320 | @$video = $__video_h->fetch_video_rid($rid); |
| 321 | 321 | } else { |
| 322 | 322 | $video['thumbnail'] = ""; |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $stmt->execute(); |
| 595 | 595 | ?> |
| 596 | 596 | |
| 597 | - <?php if($stmt->rowCount() != 0) { ?> |
|
| 597 | + <?php if ($stmt->rowCount() != 0) { ?> |
|
| 598 | 598 | <div class="comments-section"> |
| 599 | 599 | <a class="comments-section-see-all" href="/video_response_view_all?v=<?php echo htmlspecialchars($_video['rid']); ?>"> |
| 600 | 600 | see all |
@@ -602,8 +602,8 @@ discard block |
||
| 602 | 602 | <h4>Video Responses</h4> |
| 603 | 603 | <ul class="video-list"> |
| 604 | 604 | <?php |
| 605 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 606 | - if($__video_h->video_exists($video['video'])) { |
|
| 605 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 606 | + if ($__video_h->video_exists($video['video'])) { |
|
| 607 | 607 | $video = $__video_h->fetch_video_rid($video['video']); |
| 608 | 608 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 609 | 609 | $video['duration'] = $__time_h->timestamp($video['duration']); |
@@ -634,18 +634,18 @@ discard block |
||
| 634 | 634 | </h4> |
| 635 | 635 | </div> |
| 636 | 636 | </div> |
| 637 | - <?php if(!isset($_SESSION['siteusername'])) { ?> |
|
| 637 | + <?php if (!isset($_SESSION['siteusername'])) { ?> |
|
| 638 | 638 | <div class="comments-post-container clearfix"> |
| 639 | 639 | <div class="comments-post-alert"> |
| 640 | 640 | <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> |
| 641 | 641 | </div> |
| 642 | 642 | </div> |
| 643 | - <?php } else if($_video['commenting'] == "d") { ?> |
|
| 643 | + <?php } else if ($_video['commenting'] == "d") { ?> |
|
| 644 | 644 | <div class="comments-disabled-message"> |
| 645 | 645 | <img src="http://s.ytimg.com/yt/img/icon_comments_disabled-vflxokpZC.png"> |
| 646 | 646 | <span>Adding comments has been disabled for this video.</span> |
| 647 | 647 | </div> |
| 648 | - <?php } else if($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?> |
|
| 648 | + <?php } else if ($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?> |
|
| 649 | 649 | <div class="comments-post-container clearfix"> |
| 650 | 650 | <div class="comments-post-alert"> |
| 651 | 651 | This user has blocked you! |
@@ -699,15 +699,15 @@ discard block |
||
| 699 | 699 | $stmt->execute(); |
| 700 | 700 | |
| 701 | 701 | $number_of_result = $stmt->rowCount(); |
| 702 | - $number_of_page = ceil ($number_of_result / $results_per_page); |
|
| 702 | + $number_of_page = ceil($number_of_result/$results_per_page); |
|
| 703 | 703 | |
| 704 | - if (!isset ($_GET['page']) ) { |
|
| 704 | + if (!isset ($_GET['page'])) { |
|
| 705 | 705 | $page = 1; |
| 706 | 706 | } else { |
| 707 | - $page = (int)$_GET['page']; |
|
| 707 | + $page = (int) $_GET['page']; |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $page_first_result = ($page - 1) * $results_per_page; |
|
| 710 | + $page_first_result = ($page - 1)*$results_per_page; |
|
| 711 | 711 | |
| 712 | 712 | $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper"); |
| 713 | 713 | $stmt->bindParam(":rid", $_video['rid']); |
@@ -715,10 +715,10 @@ discard block |
||
| 715 | 715 | $stmt->bindParam(":pper", $results_per_page); |
| 716 | 716 | $stmt->execute(); |
| 717 | 717 | |
| 718 | - while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 719 | - if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
| 718 | + while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 719 | + if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
| 720 | 720 | $comment['liked'] = true; |
| 721 | - else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
| 721 | + else if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
| 722 | 722 | $comment['disliked'] = true; |
| 723 | 723 | |
| 724 | 724 | $comment['likes'] = $__video_h->get_comment_likes($comment['id'], true); |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | <span dir="ltr"><?php echo $__time_h->time_elapsed_string($comment['date']); ?><span> |
| 741 | 741 | </span> |
| 742 | 742 | </span></span> |
| 743 | - <?php if($comment['likes'] != 0) { ?> |
|
| 743 | + <?php if ($comment['likes'] != 0) { ?> |
|
| 744 | 744 | <span dir="ltr" class="comments-rating-positive" title="9 up, 1 down"> |
| 745 | 745 | <?php echo $comment['likes']; ?> |
| 746 | 746 | <img class="comments-rating-thumbs-up" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif"> |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | </button> |
| 769 | 769 | </span> |
| 770 | 770 | </div> |
| 771 | - <?php if(isset($_SESSION['siteusername'])) { ?> |
|
| 771 | + <?php if (isset($_SESSION['siteusername'])) { ?> |
|
| 772 | 772 | <li id="reply_to_<?php echo $comment['id']; ?>" style="display: none;" class="comment yt-tile-default child" data-tag="O" data-author-viewing="" data-id="iRV7EkT9us81mDLFDSB6FAsB156Fdn13HUmTm26C3PE" data-score="34" data-author="<?php echo htmlspecialchars($row['author']); ?>"> |
| 773 | 773 | |
| 774 | 774 | <div class="comment-body"> |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | $stmt2->bindParam(":rid", $comment['id']); |
| 794 | 794 | $stmt2->execute(); |
| 795 | 795 | |
| 796 | - while($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
| 796 | + while ($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
| 797 | 797 | ?> |
| 798 | 798 | <li class="comment yt-tile-default " style="padding-left: 30px;" data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="<?php echo $reply['id']; ?>" data-score="0"> |
| 799 | 799 | <div class="comment-body"> |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | <?php |
| 878 | 878 | $stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 20"); |
| 879 | 879 | $stmt->execute(); |
| 880 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 880 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 881 | 881 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 882 | 882 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 883 | 883 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -15,8 +15,9 @@ discard block |
||
| 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(isset($_SESSION['siteusername'])) |
|
| 19 | - $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
|
| 18 | + if(isset($_SESSION['siteusername'])) { |
|
| 19 | + $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | 22 | $_SESSION['current_video'] = $_video['rid']; |
| 22 | 23 | |
@@ -716,10 +717,11 @@ discard block |
||
| 716 | 717 | $stmt->execute(); |
| 717 | 718 | |
| 718 | 719 | while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
| 719 | - if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
| 720 | - $comment['liked'] = true; |
|
| 721 | - else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
| 722 | - $comment['disliked'] = true; |
|
| 720 | + if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) { |
|
| 721 | + $comment['liked'] = true; |
|
| 722 | + } else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) { |
|
| 723 | + $comment['disliked'] = true; |
|
| 724 | + } |
|
| 723 | 725 | |
| 724 | 726 | $comment['likes'] = $__video_h->get_comment_likes($comment['id'], true); |
| 725 | 727 | $comment['likes'] -= $__video_h->get_comment_likes($comment['id'], false); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | <?php $__db_h = new db_helper(); ?> |
| 9 | 9 | <?php $__time_h = new time_helper(); ?> |
| 10 | 10 | <?php |
| 11 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 11 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 12 | 12 | $request = (object) [ |
| 13 | 13 | "username" => $_POST['username'], |
| 14 | 14 | "password" => $_POST['password'], |
@@ -22,25 +22,25 @@ discard block |
||
| 22 | 22 | ]; |
| 23 | 23 | |
| 24 | 24 | if (!filter_var($request->email, FILTER_VALIDATE_EMAIL)) |
| 25 | - { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 26 | - if(strlen($request->username) > 21) |
|
| 25 | + { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 26 | + if (strlen($request->username) > 21) |
|
| 27 | 27 | { $request->error->message = "Your username must be shorter than 20 characters."; $request->error->status = ""; } |
| 28 | - if(strlen($request->password) < 8) |
|
| 28 | + if (strlen($request->password) < 8) |
|
| 29 | 29 | { $request->error->message = "Your password must at least be 8 characters long."; $request->error->status = ""; } |
| 30 | - if(!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 30 | + if (!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 31 | 31 | { $request->error->message = "Include numbers and letters in your password!"; $request->error->status = ""; } |
| 32 | - if(!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 32 | + if (!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 33 | 33 | { $request->error->message = "Your username cannot contain any special characters!"; $request->error->status = ""; } |
| 34 | - if(empty(trim($request->username))) |
|
| 34 | + if (empty(trim($request->username))) |
|
| 35 | 35 | { $request->error->message = "Your username cannot be empty!"; $request->error->status = ""; } |
| 36 | 36 | |
| 37 | 37 | $stmt = $__db->prepare("SELECT username FROM users WHERE username = :username"); |
| 38 | 38 | $stmt->bindParam(":username", $request->username); |
| 39 | 39 | $stmt->execute(); |
| 40 | - if($stmt->rowCount()) |
|
| 40 | + if ($stmt->rowCount()) |
|
| 41 | 41 | { $request->error->message = "There's already a user with that same username!"; $request->error->status = ""; } |
| 42 | 42 | |
| 43 | - if($request->error->status == "OK") { |
|
| 43 | + if ($request->error->status == "OK") { |
|
| 44 | 44 | $stmt = $__db->prepare("INSERT INTO users (username, email, password) VALUES (:username, :email, :password)"); |
| 45 | 45 | $stmt->bindParam(":username", $request->username); |
| 46 | 46 | $stmt->bindParam(":email", $request->email); |
@@ -20,10 +20,10 @@ |
||
| 20 | 20 | ] |
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | -if(empty(trim($request->comment))) { header("Location: /watch?v=" . $_GET['v']); } |
|
| 24 | -if(empty(trim($request->to_id ))) { header("Location: /"); } |
|
| 23 | +if (empty(trim($request->comment))) { header("Location: /watch?v=" . $_GET['v']); } |
|
| 24 | +if (empty(trim($request->to_id))) { header("Location: /"); } |
|
| 25 | 25 | |
| 26 | -if(isset($_SESSION['siteusername'])) { |
|
| 26 | +if (isset($_SESSION['siteusername'])) { |
|
| 27 | 27 | $stmt = $__db->prepare("INSERT INTO comment_reply (toid, author, comment) VALUES (:to_id, :author, :comment)"); |
| 28 | 28 | $stmt->bindParam(":to_id", $request->to_id); |
| 29 | 29 | $stmt->bindParam(":author", $request->sender); |