@@ -11,14 +11,14 @@ 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($_video['visibility'] == "v" && @$_SESSION['siteusername'] != $_video['author']) |
|
18 | + if ($_video['visibility'] == "v" && @$_SESSION['siteusername'] != $_video['author']) |
|
19 | 19 | header("Location: /"); |
20 | 20 | |
21 | - if(isset($_SESSION['siteusername'])) |
|
21 | + if (isset($_SESSION['siteusername'])) |
|
22 | 22 | $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
23 | 23 | |
24 | 24 | $_SESSION['current_video'] = $_video['rid']; |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | if (window.yt.timing) {yt.timing.tick("ct");} |
68 | 68 | </script> |
69 | 69 | <?php |
70 | - $_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1); |
|
70 | + $_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1); |
|
71 | 71 | $_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2); |
72 | 72 | |
73 | - $_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4); |
|
74 | - $_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5); |
|
73 | + $_video['likes'] = $__video_h->get_video_stars_level($_video['rid'], 4); |
|
74 | + $_video['likes'] += $__video_h->get_video_stars_level($_video['rid'], 5); |
|
75 | 75 | |
76 | 76 | $_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false); |
77 | 77 | $_video['likes'] += $__video_h->get_video_likes($_video['rid'], true); |
78 | 78 | |
79 | - if($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
79 | + if ($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
80 | 80 | $_video['likeswidth'] = 0; |
81 | 81 | $_video['dislikeswidth'] = 0; |
82 | 82 | } else { |
83 | - $_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100; |
|
83 | + $_video['likeswidth'] = $_video['likes']/($_video['likes'] + $_video['dislikes'])*100; |
|
84 | 84 | $_video['dislikeswidth'] = 100 - $_video['likeswidth']; |
85 | 85 | } |
86 | 86 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | </div> |
115 | 115 | <div id="instream_google_companion_ad_div"></div> |
116 | 116 | </div> |
117 | - <?php if(@$_SESSION['siteusername'] == $_video['author']) { ?> |
|
117 | + <?php if (@$_SESSION['siteusername'] == $_video['author']) { ?> |
|
118 | 118 | <div id="watch-owner-container"> |
119 | 119 | <div id="masthead-subnav" class="yt-nav yt-nav-dark "> |
120 | 120 | <ul class="yt-nav-aside"> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | </div> |
134 | 134 | </div><br> |
135 | 135 | <?php } ?> |
136 | - <?php if($__user_h->if_admin(@$_SESSION['siteusername']) && @$_SESSION['siteusername'] != $_video['author']) { ?> |
|
136 | + <?php if ($__user_h->if_admin(@$_SESSION['siteusername']) && @$_SESSION['siteusername'] != $_video['author']) { ?> |
|
137 | 137 | <div id="watch-owner-container"> |
138 | 138 | <div id="masthead-subnav" class="yt-nav yt-nav-dark "> |
139 | 139 | <ul class="yt-nav-aside"> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | title="" |
169 | 169 | id="subscribe-button" |
170 | 170 | type="button" |
171 | - class="<?php if($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button yt-uix-button yt-uix-button-subscription yt-uix-tooltip" |
|
171 | + class="<?php if ($_video['subscribed']) { echo "subscribed "; } ?>yt-subscription-button yt-uix-button yt-uix-button-subscription yt-uix-tooltip" |
|
172 | 172 | role="button"> |
173 | 173 | <span class="yt-uix-button-icon-wrapper"> |
174 | 174 | <img class="yt-uix-button-icon yt-uix-button-icon-subscribe" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""> |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | <div id="watch-main-container"> |
227 | 227 | <div id="watch-main"> |
228 | 228 | <div id="watch-panel"> |
229 | - <?php if($_video['visibility'] == "u") { ?> |
|
229 | + <?php if ($_video['visibility'] == "u") { ?> |
|
230 | 230 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-warn"> <div class="yt-alert-icon"> |
231 | 231 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
232 | 232 | </div> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | This video is unlisted. Only people who have the link can view this video. |
236 | 236 | </div> |
237 | 237 | </div></div></div> |
238 | - <?php } else if($_video['visibility'] == "v") { ?> |
|
238 | + <?php } else if ($_video['visibility'] == "v") { ?> |
|
239 | 239 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error"> <div class="yt-alert-icon"> |
240 | 240 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
241 | 241 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | <button onclick=";like_video();return false;" |
270 | 270 | title="I like this" |
271 | 271 | type="button" |
272 | - class="start <?php if($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse yt-uix-button yt-uix-button-default yt-uix-tooltip" |
|
272 | + class="start <?php if ($_video['liked']) { echo "liked "; } ?>yt-uix-tooltip-reverse yt-uix-button yt-uix-button-default yt-uix-tooltip" |
|
273 | 273 | id="watch-like" |
274 | 274 | href="/get/like_video?v=<?php echo $_video['rid']; ?>" |
275 | 275 | role="button"><span class="yt-uix-button-icon-wrapper"> |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | type="button" |
284 | 284 | style="margin-left: -2px;" |
285 | 285 | href="/get/dislike_video?v=<?php echo $_video['rid']; ?>" |
286 | - 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" |
|
286 | + 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" |
|
287 | 287 | id="watch-unlike" |
288 | 288 | role="button"> |
289 | 289 | <span class="yt-uix-button-icon-wrapper"> |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | </div> |
304 | 304 | </div> |
305 | 305 | <div id="watch-actions-logged-out" class="watch-actions-panel hid"> |
306 | - <?php if(!isset($_SESSION['siteusername'])) { ?> |
|
306 | + <?php if (!isset($_SESSION['siteusername'])) { ?> |
|
307 | 307 | <div class="yt-alert yt-alert-naked yt-alert-warn "> |
308 | 308 | <div class="yt-alert-icon"> |
309 | 309 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | <?php } else { ?> |
320 | 320 | <h3>Be friends with the creator</h3> |
321 | 321 | |
322 | - <?php if($_SESSION['siteusername'] != $_video['author']) { ?> |
|
322 | + <?php if ($_SESSION['siteusername'] != $_video['author']) { ?> |
|
323 | 323 | <img style="width: 50px;height:50px;" src="/dynamic/pfp/<?php echo $__user_h->fetch_pfp($_video['author']); ?>"> |
324 | 324 | <span style="display: inline-block; vertical-align:top;width: 100px;font-size:11px;"> |
325 | 325 | <b><a href="/user/<?php echo htmlspecialchars($_video['author']); ?>"><?php echo htmlspecialchars($_video['author']); ?></a></b><br> |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | </span><br><br> |
334 | 334 | <?php } ?> |
335 | 335 | |
336 | - <?php if($_SESSION['siteusername'] != $_video['author']) { ?> |
|
337 | - <?php if($_video['friended'] == false) { ?> |
|
336 | + <?php if ($_SESSION['siteusername'] != $_video['author']) { ?> |
|
337 | + <?php if ($_video['friended'] == false) { ?> |
|
338 | 338 | <a href="/friends">Send a friend request</a> |
339 | 339 | <?php } else { ?> |
340 | 340 | Your friend request is pending. |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | <?php } ?> |
345 | 345 | <hr><br> |
346 | 346 | <h3>Add to Favorites</h3> |
347 | - <?php if($_video['favorited'] == false) { ?> |
|
347 | + <?php if ($_video['favorited'] == false) { ?> |
|
348 | 348 | <a href="/get/favorite?v=<?php echo $_video['rid']; ?>">Favorite Video</a> |
349 | 349 | <?php } else { ?> |
350 | 350 | <a href="/get/unfavorite?v=<?php echo $_video['rid']; ?>">Unfavorite Video</a> |
@@ -355,10 +355,10 @@ discard block |
||
355 | 355 | $stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20"); |
356 | 356 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
357 | 357 | $stmt->execute(); |
358 | - while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
358 | + while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
359 | 359 | $buffer = json_decode($playlist['videos']); |
360 | 360 | @$rid = $buffer[0]; |
361 | - if(!empty($rid)) { |
|
361 | + if (!empty($rid)) { |
|
362 | 362 | @$video = $__video_h->fetch_video_rid($rid); |
363 | 363 | } else { |
364 | 364 | $video['thumbnail'] = ""; |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | $stmt->execute(); |
637 | 637 | ?> |
638 | 638 | |
639 | - <?php if($stmt->rowCount() != 0) { ?> |
|
639 | + <?php if ($stmt->rowCount() != 0) { ?> |
|
640 | 640 | <div class="comments-section"> |
641 | 641 | <a class="comments-section-see-all" href="/video_response_view_all?v=<?php echo htmlspecialchars($_video['rid']); ?>"> |
642 | 642 | see all |
@@ -644,8 +644,8 @@ discard block |
||
644 | 644 | <h4>Video Responses</h4> |
645 | 645 | <ul class="video-list"> |
646 | 646 | <?php |
647 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
648 | - if($__video_h->video_exists($video['video'])) { |
|
647 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
648 | + if ($__video_h->video_exists($video['video'])) { |
|
649 | 649 | $video = $__video_h->fetch_video_rid($video['video']); |
650 | 650 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
651 | 651 | $video['duration'] = $__time_h->timestamp($video['duration']); |
@@ -676,18 +676,18 @@ discard block |
||
676 | 676 | </h4> |
677 | 677 | </div> |
678 | 678 | </div> |
679 | - <?php if(!isset($_SESSION['siteusername'])) { ?> |
|
679 | + <?php if (!isset($_SESSION['siteusername'])) { ?> |
|
680 | 680 | <div class="comments-post-container clearfix"> |
681 | 681 | <div class="comments-post-alert"> |
682 | 682 | <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> |
683 | 683 | </div> |
684 | 684 | </div> |
685 | - <?php } else if($_video['commenting'] == "d") { ?> |
|
685 | + <?php } else if ($_video['commenting'] == "d") { ?> |
|
686 | 686 | <div class="comments-disabled-message"> |
687 | 687 | <img src="http://s.ytimg.com/yt/img/icon_comments_disabled-vflxokpZC.png"> |
688 | 688 | <span>Adding comments has been disabled for this video.</span> |
689 | 689 | </div> |
690 | - <?php } else if($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?> |
|
690 | + <?php } else if ($__user_h->if_blocked($_video['author'], $_SESSION['siteusername'])) { ?> |
|
691 | 691 | <div class="comments-post-container clearfix"> |
692 | 692 | <div class="comments-post-alert"> |
693 | 693 | This user has blocked you! |
@@ -741,15 +741,15 @@ discard block |
||
741 | 741 | $stmt->execute(); |
742 | 742 | |
743 | 743 | $number_of_result = $stmt->rowCount(); |
744 | - $number_of_page = ceil ($number_of_result / $results_per_page); |
|
744 | + $number_of_page = ceil($number_of_result/$results_per_page); |
|
745 | 745 | |
746 | - if (!isset ($_GET['page']) ) { |
|
746 | + if (!isset ($_GET['page'])) { |
|
747 | 747 | $page = 1; |
748 | 748 | } else { |
749 | - $page = (int)$_GET['page']; |
|
749 | + $page = (int) $_GET['page']; |
|
750 | 750 | } |
751 | 751 | |
752 | - $page_first_result = ($page - 1) * $results_per_page; |
|
752 | + $page_first_result = ($page - 1)*$results_per_page; |
|
753 | 753 | |
754 | 754 | $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper"); |
755 | 755 | $stmt->bindParam(":rid", $_video['rid']); |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | $stmt->bindParam(":pper", $results_per_page); |
758 | 758 | $stmt->execute(); |
759 | 759 | |
760 | - while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
761 | - if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
760 | + while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
761 | + if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
762 | 762 | $comment['liked'] = true; |
763 | - else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
763 | + else if ($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
764 | 764 | $comment['disliked'] = true; |
765 | 765 | |
766 | 766 | $comment['likes'] = $__video_h->get_comment_likes($comment['id'], true); |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | <span dir="ltr"><?php echo $__time_h->time_elapsed_string($comment['date']); ?><span> |
783 | 783 | </span> |
784 | 784 | </span></span> |
785 | - <?php if($comment['likes'] != 0) { ?> |
|
785 | + <?php if ($comment['likes'] != 0) { ?> |
|
786 | 786 | <span dir="ltr" class="comments-rating-positive" title="9 up, 1 down"> |
787 | 787 | <?php echo $comment['likes']; ?> |
788 | 788 | <img class="comments-rating-thumbs-up" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif"> |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | </button> |
811 | 811 | </span> |
812 | 812 | </div> |
813 | - <?php if(isset($_SESSION['siteusername'])) { ?> |
|
813 | + <?php if (isset($_SESSION['siteusername'])) { ?> |
|
814 | 814 | <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']); ?>"> |
815 | 815 | |
816 | 816 | <div class="comment-body"> |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | $stmt2->bindParam(":rid", $comment['id']); |
836 | 836 | $stmt2->execute(); |
837 | 837 | |
838 | - while($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
838 | + while ($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
839 | 839 | ?> |
840 | 840 | <li class="comment yt-tile-default " style="margin-left: 30px;" data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="<?php echo $reply['id']; ?>" data-score="0"> |
841 | 841 | <div class="comment-body"> |
@@ -918,11 +918,11 @@ discard block |
||
918 | 918 | <?php |
919 | 919 | $stmt = $__db->prepare("SELECT * FROM playlists ORDER BY rand() LIMIT 2"); |
920 | 920 | $stmt->execute(); |
921 | - while($_playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
921 | + while ($_playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
922 | 922 | $_playlist['videos'] = json_decode($_playlist['videos']); |
923 | 923 | $_playlist['count'] = 1; |
924 | 924 | |
925 | - if($__video_h->video_exists($_playlist['videos'][0])) { |
|
925 | + if ($__video_h->video_exists($_playlist['videos'][0])) { |
|
926 | 926 | $video = $__video_h->fetch_video_rid($_playlist['videos'][0]); |
927 | 927 | } else { |
928 | 928 | $video = []; |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | <?php |
978 | 978 | $stmt = $__db->prepare("SELECT * FROM videos WHERE visibility = 'n' ORDER BY rand() LIMIT 20"); |
979 | 979 | $stmt->execute(); |
980 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
980 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
981 | 981 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
982 | 982 | $video['duration'] = $__time_h->timestamp($video['duration']); |
983 | 983 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | - if(isset($_SESSION['siteusername'])) { |
|
2 | + if(isset($_SESSION['siteusername'])) { |
|
3 | 3 | $stmt = $__db->prepare("UPDATE users SET ip = :ip WHERE username = :username"); |
4 | 4 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
5 | - $stmt->bindParam(":ip", $_SERVER["HTTP_CF_CONNECTING_IP"]); |
|
5 | + $stmt->bindParam(":ip", $_SERVER["HTTP_CF_CONNECTING_IP"]); |
|
6 | 6 | $stmt->execute(); |
7 | - } |
|
7 | + } |
|
8 | 8 | ?> |
9 | 9 | <!-- begin masthead --> |
10 | 10 | <div id="masthead" class="" dir="ltr"> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | - if(isset($_SESSION['siteusername'])) { |
|
2 | + if (isset($_SESSION['siteusername'])) { |
|
3 | 3 | $stmt = $__db->prepare("UPDATE users SET ip = :ip WHERE username = :username"); |
4 | 4 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
5 | - $stmt->bindParam(":ip", $_SERVER["HTTP_CF_CONNECTING_IP"]); |
|
5 | + $stmt->bindParam(":ip", $_SERVER["HTTP_CF_CONNECTING_IP"]); |
|
6 | 6 | $stmt->execute(); |
7 | 7 | } |
8 | 8 | ?> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | <a id="logo-container" href="/" title="SubRocks home"> |
12 | 12 | <img id="logo" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="SubRocks home"> |
13 | 13 | </a> |
14 | - <?php if(!isset($_SESSION['siteusername'])) { ?> |
|
14 | + <?php if (!isset($_SESSION['siteusername'])) { ?> |
|
15 | 15 | <div id="yt-masthead-signin"> |
16 | 16 | <div id="masthead-user-display"><span id="masthead-user-wrapper"><button href="/sign_in" type="button" id="masthead-user-button" onclick=";window.location.href=this.getAttribute('href');return false;" class=" yt-uix-button yt-uix-button-text" role="button"><span class="yt-uix-button-content"> <span id="masthead-user-image"> |
17 | 17 | <span class="clip"> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <span id="yt-masthead-user-displayname" dir="ltr" class="yt-valign-container" onclick="yt.www.masthead.toggleExpandedMasthead();"> |
30 | 30 | <?php echo htmlspecialchars($_SESSION['siteusername']); ?> |
31 | 31 | </span> |
32 | - <?php if($__user_h->fetch_unread_pms($_SESSION['siteusername']) != 0) { ?> |
|
32 | + <?php if ($__user_h->fetch_unread_pms($_SESSION['siteusername']) != 0) { ?> |
|
33 | 33 | <a style="border-radius:2px;font-weight:bold;border:1px solid #CE4D34;position:relative;top:1px;color: white;text-decoration: none;background-color: #E26148;padding: 7px;padding-left: 10px;margin-right: 12px;display: inline;" href="/inbox/"> |
34 | 34 | <?php echo $__user_h->fetch_unread_pms($_SESSION['siteusername']); ?> |
35 | 35 | </a> |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | </form> |
52 | 52 | </div> |
53 | 53 | </div></div> |
54 | -<?php if(isset($_SESSION['siteusername'])) { ?> |
|
54 | +<?php if (isset($_SESSION['siteusername'])) { ?> |
|
55 | 55 | <div id="masthead-expanded" class="hid" style="display: none;"> |
56 | 56 | <div id="masthead-expanded-container" class="with-sandbar"> |
57 | 57 | <div class="yt-uix-slider yt-rounded" id="watch-channel-discoverbox" data-slider-slide-selected="3" data-slider-slides="4" |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC LIMIT 20"); |
73 | 73 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
74 | 74 | $stmt->execute(); |
75 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
75 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
76 | 76 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
77 | 77 | $video['duration'] = $__time_h->timestamp($video['duration']); |
78 | 78 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | <?php } ?> |
217 | 217 | </div> |
218 | 218 | <div id="alerts"> |
219 | - <?php if(isset($error['status'])) { ?> |
|
219 | + <?php if (isset($error['status'])) { ?> |
|
220 | 220 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error yt-alert-player"> <div class="yt-alert-icon"> |
221 | 221 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
222 | 222 | </div> |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | </div> |
227 | 227 | </div></div></div> |
228 | 228 | <?php } ?> |
229 | - <?php if(isset($_GET['error'])) { ?> |
|
229 | + <?php if (isset($_GET['error'])) { ?> |
|
230 | 230 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error "> <div class="yt-alert-icon"> |
231 | 231 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
232 | 232 | </div> |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | </div> |
237 | 237 | </div></div></div> |
238 | 238 | <?php } ?> |
239 | - <?php if(isset($_GET['success'])) { ?> |
|
239 | + <?php if (isset($_GET['success'])) { ?> |
|
240 | 240 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-success "> <div class="yt-alert-icon"> |
241 | 241 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
242 | 242 | </div> |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | </div> |
247 | 247 | </div></div></div> |
248 | 248 | <?php } ?> |
249 | - <?php if(isset($_SESSION['error'])) { ?> |
|
249 | + <?php if (isset($_SESSION['error'])) { ?> |
|
250 | 250 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error"> <div class="yt-alert-icon"> |
251 | 251 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
252 | 252 | </div> |
@@ -12,64 +12,64 @@ discard block |
||
12 | 12 | <?php if(!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?> |
13 | 13 | <?php if(!$__user_h->if_admin($_SESSION['siteusername'])) { header("Location: /"); } ?> |
14 | 14 | <?php |
15 | - $__server->page_embeds->page_title = "SubRocks - Admin Panel"; |
|
16 | - $__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube."; |
|
17 | - $__server->page_embeds->page_image = "/yt/imgbin/full-size-logo.png"; |
|
18 | - $__server->page_embeds->page_url = "https://subrock.rocks/"; |
|
15 | + $__server->page_embeds->page_title = "SubRocks - Admin Panel"; |
|
16 | + $__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube."; |
|
17 | + $__server->page_embeds->page_image = "/yt/imgbin/full-size-logo.png"; |
|
18 | + $__server->page_embeds->page_url = "https://subrock.rocks/"; |
|
19 | 19 | |
20 | - function get_server_array_stats() { |
|
21 | - $stat1 = file('/proc/stat'); |
|
22 | - sleep(1); |
|
23 | - $stat2 = file('/proc/stat'); |
|
24 | - $info1 = explode(" ", preg_replace("!cpu +!", "", $stat1[0])); |
|
25 | - $info2 = explode(" ", preg_replace("!cpu +!", "", $stat2[0])); |
|
26 | - $dif = array(); |
|
27 | - $dif['user'] = $info2[0] - $info1[0]; |
|
28 | - $dif['nice'] = $info2[1] - $info1[1]; |
|
29 | - $dif['sys'] = $info2[2] - $info1[2]; |
|
30 | - $dif['idle'] = $info2[3] - $info1[3]; |
|
31 | - $total = array_sum($dif); |
|
32 | - $cpu = array(); |
|
33 | - foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 1); |
|
20 | + function get_server_array_stats() { |
|
21 | + $stat1 = file('/proc/stat'); |
|
22 | + sleep(1); |
|
23 | + $stat2 = file('/proc/stat'); |
|
24 | + $info1 = explode(" ", preg_replace("!cpu +!", "", $stat1[0])); |
|
25 | + $info2 = explode(" ", preg_replace("!cpu +!", "", $stat2[0])); |
|
26 | + $dif = array(); |
|
27 | + $dif['user'] = $info2[0] - $info1[0]; |
|
28 | + $dif['nice'] = $info2[1] - $info1[1]; |
|
29 | + $dif['sys'] = $info2[2] - $info1[2]; |
|
30 | + $dif['idle'] = $info2[3] - $info1[3]; |
|
31 | + $total = array_sum($dif); |
|
32 | + $cpu = array(); |
|
33 | + foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 1); |
|
34 | 34 | |
35 | - return $cpu; |
|
36 | - } |
|
35 | + return $cpu; |
|
36 | + } |
|
37 | 37 | |
38 | - function adjustBrightness($hexCode, $adjustPercent) { |
|
39 | - $hexCode = ltrim($hexCode, '#'); |
|
38 | + function adjustBrightness($hexCode, $adjustPercent) { |
|
39 | + $hexCode = ltrim($hexCode, '#'); |
|
40 | 40 | |
41 | - if (strlen($hexCode) == 3) { |
|
42 | - $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2]; |
|
43 | - } |
|
41 | + if (strlen($hexCode) == 3) { |
|
42 | + $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2]; |
|
43 | + } |
|
44 | 44 | |
45 | - $hexCode = array_map('hexdec', str_split($hexCode, 2)); |
|
45 | + $hexCode = array_map('hexdec', str_split($hexCode, 2)); |
|
46 | 46 | |
47 | - foreach ($hexCode as & $color) { |
|
48 | - $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color; |
|
49 | - $adjustAmount = ceil($adjustableLimit * $adjustPercent); |
|
47 | + foreach ($hexCode as & $color) { |
|
48 | + $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color; |
|
49 | + $adjustAmount = ceil($adjustableLimit * $adjustPercent); |
|
50 | 50 | |
51 | - $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT); |
|
52 | - } |
|
51 | + $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT); |
|
52 | + } |
|
53 | 53 | |
54 | - return '#' . implode($hexCode); |
|
55 | - } |
|
54 | + return '#' . implode($hexCode); |
|
55 | + } |
|
56 | 56 | |
57 | - function get_server_memory_usage() { |
|
58 | - $free = shell_exec('free'); |
|
59 | - $free = (string)trim($free); |
|
60 | - $free_arr = explode("\n", $free); |
|
61 | - $mem = explode(" ", $free_arr[1]); |
|
62 | - $mem = array_filter($mem); |
|
63 | - $mem = array_merge($mem); |
|
64 | - $memory_usage = $mem[2]/$mem[1]*100; |
|
57 | + function get_server_memory_usage() { |
|
58 | + $free = shell_exec('free'); |
|
59 | + $free = (string)trim($free); |
|
60 | + $free_arr = explode("\n", $free); |
|
61 | + $mem = explode(" ", $free_arr[1]); |
|
62 | + $mem = array_filter($mem); |
|
63 | + $mem = array_merge($mem); |
|
64 | + $memory_usage = $mem[2]/$mem[1]*100; |
|
65 | 65 | |
66 | - return $memory_usage; |
|
67 | - } |
|
66 | + return $memory_usage; |
|
67 | + } |
|
68 | 68 | |
69 | - function get_server_cpu_usage() { |
|
70 | - $load = sys_getloadavg(); |
|
71 | - return $load[0]; |
|
72 | - } |
|
69 | + function get_server_cpu_usage() { |
|
70 | + $load = sys_getloadavg(); |
|
71 | + return $load[0]; |
|
72 | + } |
|
73 | 73 | ?> |
74 | 74 | <!DOCTYPE html> |
75 | 75 | <html dir="ltr"> |
@@ -236,30 +236,30 @@ discard block |
||
236 | 236 | <div class="box-gray" style="width: 95%;margin-bottom: 8px;"> |
237 | 237 | <h3>Statistics</h3> |
238 | 238 | <?php |
239 | - $stmt = $__db->prepare("SELECT id FROM videos"); |
|
240 | - $stmt->execute(); |
|
241 | - $videos = $stmt->rowCount(); |
|
239 | + $stmt = $__db->prepare("SELECT id FROM videos"); |
|
240 | + $stmt->execute(); |
|
241 | + $videos = $stmt->rowCount(); |
|
242 | 242 | |
243 | - $stmt = $__db->prepare("SELECT id FROM users"); |
|
244 | - $stmt->execute(); |
|
245 | - $users = $stmt->rowCount(); |
|
243 | + $stmt = $__db->prepare("SELECT id FROM users"); |
|
244 | + $stmt->execute(); |
|
245 | + $users = $stmt->rowCount(); |
|
246 | 246 | |
247 | - $stmt = $__db->prepare("SELECT id FROM comments"); |
|
248 | - $stmt->execute(); |
|
249 | - $comments = $stmt->rowCount(); |
|
247 | + $stmt = $__db->prepare("SELECT id FROM comments"); |
|
248 | + $stmt->execute(); |
|
249 | + $comments = $stmt->rowCount(); |
|
250 | 250 | |
251 | - $stmt = $__db->prepare("SELECT id FROM views"); |
|
252 | - $stmt->execute(); |
|
253 | - $views = $stmt->rowCount(); |
|
251 | + $stmt = $__db->prepare("SELECT id FROM views"); |
|
252 | + $stmt->execute(); |
|
253 | + $views = $stmt->rowCount(); |
|
254 | 254 | |
255 | - $stmt = $__db->prepare("SELECT id FROM pms"); |
|
256 | - $stmt->execute(); |
|
257 | - $pms = $stmt->rowCount(); |
|
255 | + $stmt = $__db->prepare("SELECT id FROM pms"); |
|
256 | + $stmt->execute(); |
|
257 | + $pms = $stmt->rowCount(); |
|
258 | 258 | |
259 | - $stmt = $__db->prepare("SELECT id FROM playlists"); |
|
260 | - $stmt->execute(); |
|
261 | - $playlists = $stmt->rowCount(); |
|
262 | - ?> |
|
259 | + $stmt = $__db->prepare("SELECT id FROM playlists"); |
|
260 | + $stmt->execute(); |
|
261 | + $playlists = $stmt->rowCount(); |
|
262 | + ?> |
|
263 | 263 | <div style="width: 200px;display:inline-block;"> |
264 | 264 | <?php $server = get_server_array_stats(); ?> |
265 | 265 | Videos uploaded: <b style="float:right;"><?php echo $videos; ?></b><br> |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | <?php $__user_u = new user_update($__db); ?> |
10 | 10 | <?php $__db_h = new db_helper(); ?> |
11 | 11 | <?php $__time_h = new time_helper(); ?> |
12 | -<?php if(!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?> |
|
13 | -<?php if(!$__user_h->if_admin($_SESSION['siteusername'])) { header("Location: /"); } ?> |
|
12 | +<?php if (!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?> |
|
13 | +<?php if (!$__user_h->if_admin($_SESSION['siteusername'])) { header("Location: /"); } ?> |
|
14 | 14 | <?php |
15 | 15 | $__server->page_embeds->page_title = "SubRocks - Admin Panel"; |
16 | 16 | $__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube."; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $dif['idle'] = $info2[3] - $info1[3]; |
31 | 31 | $total = array_sum($dif); |
32 | 32 | $cpu = array(); |
33 | - foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 1); |
|
33 | + foreach ($dif as $x=>$y) $cpu[$x] = round($y/$total*100, 1); |
|
34 | 34 | |
35 | 35 | return $cpu; |
36 | 36 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | foreach ($hexCode as & $color) { |
48 | 48 | $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color; |
49 | - $adjustAmount = ceil($adjustableLimit * $adjustPercent); |
|
49 | + $adjustAmount = ceil($adjustableLimit*$adjustPercent); |
|
50 | 50 | |
51 | 51 | $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT); |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | function get_server_memory_usage() { |
58 | 58 | $free = shell_exec('free'); |
59 | - $free = (string)trim($free); |
|
59 | + $free = (string) trim($free); |
|
60 | 60 | $free_arr = explode("\n", $free); |
61 | 61 | $mem = explode(" ", $free_arr[1]); |
62 | 62 | $mem = array_filter($mem); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | CPU Idle Usage: |
275 | 275 | <b style="float:right;color:<?php echo adjustBrightness("#FF0000", $server['idle']); ?>"> |
276 | 276 | <?php echo $server['idle']; ?>%</b><br> |
277 | - RAM Usage: <b style="float:right;"><?php echo round(get_server_memory_usage(), 3) ; ?> megabytes</b> |
|
277 | + RAM Usage: <b style="float:right;"><?php echo round(get_server_memory_usage(), 3); ?> megabytes</b> |
|
278 | 278 | </div> |
279 | 279 | <div style="width: 200px;display:inline-block;margin-right:20px;vertical-align: top;margin-left: 22px;"> |
280 | 280 | <?php $server = get_server_array_stats(); ?> |