@@ -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> |
@@ -15,29 +15,29 @@ 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($_video['visibility'] == "v" && @$_SESSION['siteusername'] != $_video['author']) |
|
19 | - header("Location: /"); |
|
18 | + if($_video['visibility'] == "v" && @$_SESSION['siteusername'] != $_video['author']) |
|
19 | + header("Location: /"); |
|
20 | 20 | |
21 | - if(isset($_SESSION['siteusername'])) |
|
22 | - $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
|
21 | + if(isset($_SESSION['siteusername'])) |
|
22 | + $__video_h->check_view($_GET['v'], @$_SESSION['siteusername']); |
|
23 | 23 | |
24 | - $_SESSION['current_video'] = $_video['rid']; |
|
24 | + $_SESSION['current_video'] = $_video['rid']; |
|
25 | 25 | |
26 | - /* |
|
26 | + /* |
|
27 | 27 | PREPARE EMBEDS CLASS -- function(string $page_title, string $page_description...) |
28 | 28 | Returns a list of arrays for compatibility purposes & but downside is ugly for loop codes |
29 | 29 | Work on this tomorrow or some shit idk lol |
30 | 30 | */ |
31 | 31 | |
32 | - /* |
|
32 | + /* |
|
33 | 33 | USE THE GOD DAMN __CONFIG MORE -- idiot |
34 | 34 | Work on this tomorrow or some shit |
35 | 35 | */ |
36 | 36 | |
37 | - $__server->page_embeds->page_title = htmlspecialchars($_video['title']); |
|
38 | - $__server->page_embeds->page_description = htmlspecialchars($_video['description']); |
|
39 | - $__server->page_embeds->page_image = "/dynamic/thumbs/" . $_video['thumbnail']; |
|
40 | - $__server->page_embeds->page_url = "https://subrock.rocks/watch?v=" . htmlspecialchars($_video['rid']); |
|
37 | + $__server->page_embeds->page_title = htmlspecialchars($_video['title']); |
|
38 | + $__server->page_embeds->page_description = htmlspecialchars($_video['description']); |
|
39 | + $__server->page_embeds->page_image = "/dynamic/thumbs/" . $_video['thumbnail']; |
|
40 | + $__server->page_embeds->page_url = "https://subrock.rocks/watch?v=" . htmlspecialchars($_video['rid']); |
|
41 | 41 | ?> |
42 | 42 | <!DOCTYPE html> |
43 | 43 | <html> |
@@ -67,29 +67,29 @@ 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); |
|
71 | - $_video['dislikes'] += $__video_h->get_video_stars_level($_video['rid'], 2); |
|
70 | + $_video['dislikes'] = $__video_h->get_video_stars_level($_video['rid'], 1); |
|
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 | - $_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false); |
|
77 | - $_video['likes'] += $__video_h->get_video_likes($_video['rid'], true); |
|
76 | + $_video['dislikes'] += $__video_h->get_video_likes($_video['rid'], false); |
|
77 | + $_video['likes'] += $__video_h->get_video_likes($_video['rid'], true); |
|
78 | 78 | |
79 | - if($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
80 | - $_video['likeswidth'] = 0; |
|
81 | - $_video['dislikeswidth'] = 0; |
|
82 | - } else { |
|
83 | - $_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100; |
|
84 | - $_video['dislikeswidth'] = 100 - $_video['likeswidth']; |
|
85 | - } |
|
79 | + if($_video['likes'] == 0 && $_video['dislikes'] == 0) { |
|
80 | + $_video['likeswidth'] = 0; |
|
81 | + $_video['dislikeswidth'] = 0; |
|
82 | + } else { |
|
83 | + $_video['likeswidth'] = $_video['likes'] / ($_video['likes'] + $_video['dislikes']) * 100; |
|
84 | + $_video['dislikeswidth'] = 100 - $_video['likeswidth']; |
|
85 | + } |
|
86 | 86 | |
87 | - $_video['liked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], true); |
|
88 | - $_video['disliked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], false); |
|
89 | - $_video['author_videos'] = $__video_h->fetch_user_videos($_video['author']); |
|
90 | - $_video['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_video['author']); |
|
91 | - $_video['favorited'] = $__video_h->if_favorited(@$_SESSION['siteusername'], $_video['rid']); |
|
92 | - ?> |
|
87 | + $_video['liked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], true); |
|
88 | + $_video['disliked'] = $__video_h->if_liked(@$_SESSION['siteusername'], $_video['rid'], false); |
|
89 | + $_video['author_videos'] = $__video_h->fetch_user_videos($_video['author']); |
|
90 | + $_video['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_video['author']); |
|
91 | + $_video['favorited'] = $__video_h->if_favorited(@$_SESSION['siteusername'], $_video['rid']); |
|
92 | + ?> |
|
93 | 93 | </head> |
94 | 94 | <body id="" class="date-20120927 en_US ltr ytg-old-clearfix guide-feed-v2 gecko gecko-15" dir="ltr"> |
95 | 95 | <form name="logoutForm" method="POST" action="/logout"> |
@@ -154,21 +154,21 @@ discard block |
||
154 | 154 | |
155 | 155 | <?php $_user = $__user_h->fetch_user_username($_video['author']); ?> |
156 | 156 | <?php |
157 | - $stmt = $__db->prepare("SELECT ip, username FROM users WHERE ip = :ip"); |
|
158 | - $stmt->bindParam(":ip", $_user['ip']); |
|
159 | - $stmt->execute(); |
|
160 | - $alts = $stmt->rowCount(); |
|
157 | + $stmt = $__db->prepare("SELECT ip, username FROM users WHERE ip = :ip"); |
|
158 | + $stmt->bindParam(":ip", $_user['ip']); |
|
159 | + $stmt->execute(); |
|
160 | + $alts = $stmt->rowCount(); |
|
161 | 161 | |
162 | - if($alts != 0) { echo "<span style='font-size:11px;color:grey;'>Alts will pop up below here...</span><br>"; } |
|
162 | + if($alts != 0) { echo "<span style='font-size:11px;color:grey;'>Alts will pop up below here...</span><br>"; } |
|
163 | 163 | |
164 | - while($username = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
165 | - if($username['username'] != $_video['author'] && $username['ip'] != "0.0.0.0") |
|
166 | - echo " |
|
164 | + while($username = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
165 | + if($username['username'] != $_video['author'] && $username['ip'] != "0.0.0.0") |
|
166 | + echo " |
|
167 | 167 | <a style='font-size:10px;' href='/user/" . htmlspecialchars($username['username']) . "'>" . |
168 | - htmlspecialchars($username['username']) |
|
169 | - . "</a><br>"; |
|
170 | - } |
|
171 | - ?> |
|
168 | + htmlspecialchars($username['username']) |
|
169 | + . "</a><br>"; |
|
170 | + } |
|
171 | + ?> |
|
172 | 172 | <hr> |
173 | 173 | <?php } ?> |
174 | 174 | <h1 id="watch-headline-title"> |
@@ -371,21 +371,21 @@ discard block |
||
371 | 371 | <hr><br> |
372 | 372 | <h3>Add to a Playlist</h3> |
373 | 373 | <?php |
374 | - $stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20"); |
|
375 | - $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
376 | - $stmt->execute(); |
|
377 | - while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
378 | - $buffer = json_decode($playlist['videos']); |
|
379 | - @$rid = $buffer[0]; |
|
380 | - if(!empty($rid)) { |
|
381 | - @$video = $__video_h->fetch_video_rid($rid); |
|
382 | - } else { |
|
383 | - $video['thumbnail'] = ""; |
|
384 | - $video['duration'] = 0; |
|
385 | - } |
|
374 | + $stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :username ORDER BY id DESC LIMIT 20"); |
|
375 | + $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
376 | + $stmt->execute(); |
|
377 | + while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
378 | + $buffer = json_decode($playlist['videos']); |
|
379 | + @$rid = $buffer[0]; |
|
380 | + if(!empty($rid)) { |
|
381 | + @$video = $__video_h->fetch_video_rid($rid); |
|
382 | + } else { |
|
383 | + $video['thumbnail'] = ""; |
|
384 | + $video['duration'] = 0; |
|
385 | + } |
|
386 | 386 | |
387 | - $videos = count($buffer); |
|
388 | - ?> |
|
387 | + $videos = count($buffer); |
|
388 | + ?> |
|
389 | 389 | <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> |
390 | 390 | <?php } ?> |
391 | 391 | <?php } ?> |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | </div> |
651 | 651 | </div> |
652 | 652 | <?php |
653 | - $stmt = $__db->prepare("SELECT * FROM video_response WHERE toid = :v ORDER BY id DESC LIMIT 4"); |
|
654 | - $stmt->bindParam(":v", $_GET['v']); |
|
655 | - $stmt->execute(); |
|
656 | - ?> |
|
653 | + $stmt = $__db->prepare("SELECT * FROM video_response WHERE toid = :v ORDER BY id DESC LIMIT 4"); |
|
654 | + $stmt->bindParam(":v", $_GET['v']); |
|
655 | + $stmt->execute(); |
|
656 | + ?> |
|
657 | 657 | |
658 | 658 | <?php if($stmt->rowCount() != 0) { ?> |
659 | 659 | <div class="comments-section"> |
@@ -663,16 +663,16 @@ discard block |
||
663 | 663 | <h4>Video Responses</h4> |
664 | 664 | <ul class="video-list"> |
665 | 665 | <?php |
666 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
667 | - if($__video_h->video_exists($video['video'])) { |
|
668 | - $video = $__video_h->fetch_video_rid($video['video']); |
|
669 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
670 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
671 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
672 | - $video['author'] = htmlspecialchars($video['author']); |
|
673 | - $video['title'] = htmlspecialchars($video['title']); |
|
674 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
675 | - ?> |
|
666 | + while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
667 | + if($__video_h->video_exists($video['video'])) { |
|
668 | + $video = $__video_h->fetch_video_rid($video['video']); |
|
669 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
670 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
671 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
672 | + $video['author'] = htmlspecialchars($video['author']); |
|
673 | + $video['title'] = htmlspecialchars($video['title']); |
|
674 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
675 | + ?> |
|
676 | 676 | <li class="video-list-item yt-tile-default"> |
677 | 677 | <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> |
678 | 678 | <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"> |
@@ -753,38 +753,38 @@ discard block |
||
753 | 753 | </div> |
754 | 754 | <ul class="comment-list" id="live_comments"> |
755 | 755 | <?php |
756 | - $results_per_page = 20; |
|
756 | + $results_per_page = 20; |
|
757 | 757 | |
758 | - $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC"); |
|
759 | - $stmt->bindParam(":rid", $_video['rid']); |
|
760 | - $stmt->execute(); |
|
758 | + $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC"); |
|
759 | + $stmt->bindParam(":rid", $_video['rid']); |
|
760 | + $stmt->execute(); |
|
761 | 761 | |
762 | - $number_of_result = $stmt->rowCount(); |
|
763 | - $number_of_page = ceil ($number_of_result / $results_per_page); |
|
762 | + $number_of_result = $stmt->rowCount(); |
|
763 | + $number_of_page = ceil ($number_of_result / $results_per_page); |
|
764 | 764 | |
765 | - if (!isset ($_GET['page']) ) { |
|
766 | - $page = 1; |
|
767 | - } else { |
|
768 | - $page = (int)$_GET['page']; |
|
769 | - } |
|
765 | + if (!isset ($_GET['page']) ) { |
|
766 | + $page = 1; |
|
767 | + } else { |
|
768 | + $page = (int)$_GET['page']; |
|
769 | + } |
|
770 | 770 | |
771 | - $page_first_result = ($page - 1) * $results_per_page; |
|
771 | + $page_first_result = ($page - 1) * $results_per_page; |
|
772 | 772 | |
773 | - $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper"); |
|
774 | - $stmt->bindParam(":rid", $_video['rid']); |
|
775 | - $stmt->bindParam(":pfirst", $page_first_result); |
|
776 | - $stmt->bindParam(":pper", $results_per_page); |
|
777 | - $stmt->execute(); |
|
773 | + $stmt = $__db->prepare("SELECT * FROM comments WHERE toid = :rid ORDER BY id DESC LIMIT :pfirst, :pper"); |
|
774 | + $stmt->bindParam(":rid", $_video['rid']); |
|
775 | + $stmt->bindParam(":pfirst", $page_first_result); |
|
776 | + $stmt->bindParam(":pper", $results_per_page); |
|
777 | + $stmt->execute(); |
|
778 | 778 | |
779 | - while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
780 | - if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
781 | - $comment['liked'] = true; |
|
782 | - else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
783 | - $comment['disliked'] = true; |
|
779 | + while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
780 | + if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], true)) |
|
781 | + $comment['liked'] = true; |
|
782 | + else if($__video_h->if_comment_liked($comment['id'], $_SESSION['siteusername'], false)) |
|
783 | + $comment['disliked'] = true; |
|
784 | 784 | |
785 | - $comment['likes'] = $__video_h->get_comment_likes($comment['id'], true); |
|
786 | - $comment['likes'] -= $__video_h->get_comment_likes($comment['id'], false); |
|
787 | - ?> |
|
785 | + $comment['likes'] = $__video_h->get_comment_likes($comment['id'], true); |
|
786 | + $comment['likes'] -= $__video_h->get_comment_likes($comment['id'], false); |
|
787 | + ?> |
|
788 | 788 | |
789 | 789 | <li class="comment yt-tile-default " data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="<?php echo $comment['id']; ?>" data-score="0"> |
790 | 790 | <div class="comment-body"> |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | </div> |
851 | 851 | </li> |
852 | 852 | <?php |
853 | - $stmt2 = $__db->prepare("SELECT * FROM comment_reply WHERE toid = :rid ORDER BY id DESC"); |
|
854 | - $stmt2->bindParam(":rid", $comment['id']); |
|
855 | - $stmt2->execute(); |
|
853 | + $stmt2 = $__db->prepare("SELECT * FROM comment_reply WHERE toid = :rid ORDER BY id DESC"); |
|
854 | + $stmt2->bindParam(":rid", $comment['id']); |
|
855 | + $stmt2->execute(); |
|
856 | 856 | |
857 | - while($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
858 | - ?> |
|
857 | + while($reply = $stmt2->fetch(PDO::FETCH_ASSOC)) { |
|
858 | + ?> |
|
859 | 859 | <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"> |
860 | 860 | <div class="comment-body"> |
861 | 861 | <div class="content-container"> |
@@ -935,19 +935,19 @@ discard block |
||
935 | 935 | <div id="watch-related-container" class="watch-sidebar-body"> |
936 | 936 | <ul id="watch-related" class="video-list"> |
937 | 937 | <?php |
938 | - $stmt = $__db->prepare("SELECT * FROM playlists ORDER BY rand() LIMIT 2"); |
|
939 | - $stmt->execute(); |
|
940 | - while($_playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
941 | - $_playlist['videos'] = json_decode($_playlist['videos']); |
|
942 | - $_playlist['count'] = 1; |
|
938 | + $stmt = $__db->prepare("SELECT * FROM playlists ORDER BY rand() LIMIT 2"); |
|
939 | + $stmt->execute(); |
|
940 | + while($_playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
941 | + $_playlist['videos'] = json_decode($_playlist['videos']); |
|
942 | + $_playlist['count'] = 1; |
|
943 | 943 | |
944 | - if($__video_h->video_exists($_playlist['videos'][0])) { |
|
945 | - $video = $__video_h->fetch_video_rid($_playlist['videos'][0]); |
|
946 | - } else { |
|
947 | - $video = []; |
|
948 | - $video['thumbnail'] = "default.jpg"; |
|
949 | - } |
|
950 | - ?> |
|
944 | + if($__video_h->video_exists($_playlist['videos'][0])) { |
|
945 | + $video = $__video_h->fetch_video_rid($_playlist['videos'][0]); |
|
946 | + } else { |
|
947 | + $video = []; |
|
948 | + $video['thumbnail'] = "default.jpg"; |
|
949 | + } |
|
950 | + ?> |
|
951 | 951 | <li class="video-list-item"> |
952 | 952 | <a href="/view_playlist?v=<?php echo $_playlist['rid']; ?>" class="related-playlist yt-uix-contextlink yt-uix-sessionlink" data-sessionlink="ved=CAMQzhooAA%3D%3D&ei=CKf4md_r7rMCFYMfRAodLGlRiA%3D%3D&feature=list_other"> |
953 | 953 | <span class="ux-thumb-wrap"> |
@@ -994,16 +994,16 @@ discard block |
||
994 | 994 | <?php } ?> |
995 | 995 | <div id="ppv-container" class="hid"></div> |
996 | 996 | <?php |
997 | - $stmt = $__db->prepare("SELECT * FROM videos WHERE visibility = 'n' ORDER BY rand() LIMIT 20"); |
|
998 | - $stmt->execute(); |
|
999 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
1000 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
1001 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
1002 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
1003 | - $video['author'] = htmlspecialchars($video['author']); |
|
1004 | - $video['title'] = htmlspecialchars($video['title']); |
|
1005 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
1006 | - ?> |
|
997 | + $stmt = $__db->prepare("SELECT * FROM videos WHERE visibility = 'n' ORDER BY rand() LIMIT 20"); |
|
998 | + $stmt->execute(); |
|
999 | + while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
1000 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
1001 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
1002 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
1003 | + $video['author'] = htmlspecialchars($video['author']); |
|
1004 | + $video['title'] = htmlspecialchars($video['title']); |
|
1005 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
1006 | + ?> |
|
1007 | 1007 | <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> |
1008 | 1008 | <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"> |
1009 | 1009 | </span><img class="yt-uix-button-arrow" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></button> |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | - if(isset($_SESSION['siteusername'])) |
|
3 | - if(!$__user_h->user_exists($_SESSION['siteusername'])) |
|
4 | - header("Location: /logout"); |
|
2 | + if(isset($_SESSION['siteusername'])) |
|
3 | + if(!$__user_h->user_exists($_SESSION['siteusername'])) |
|
4 | + header("Location: /logout"); |
|
5 | 5 | |
6 | - if(isset($_SESSION['siteusername'])) { |
|
6 | + if(isset($_SESSION['siteusername'])) { |
|
7 | 7 | $stmt = $__db->prepare("UPDATE users SET ip = :ip WHERE username = :username"); |
8 | 8 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
9 | - $stmt->bindParam(":ip", $_SERVER["HTTP_CF_CONNECTING_IP"]); |
|
9 | + $stmt->bindParam(":ip", $_SERVER["HTTP_CF_CONNECTING_IP"]); |
|
10 | 10 | $stmt->execute(); |
11 | - } |
|
11 | + } |
|
12 | 12 | ?> |
13 | 13 | <!-- begin masthead --> |
14 | 14 | <div id="masthead" class="" dir="ltr"> |