Test Failed
Pull Request — main (#32)
by
unknown
02:53
created
web/public/s/mod/channel_playlists.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 								<div class="channel-tab-content channel-layout-two-column selected blogger-template">
3 3
 									<div class="tab-content-body">
4 4
 										<div class="primary-pane">
5
-                                            <?php if($_user['featured'] != false && $__video_h->video_exists($_user['featured'])) { ?>
5
+                                            <?php if ($_user['featured'] != false && $__video_h->video_exists($_user['featured'])) { ?>
6 6
 											<div class="channels-featured-video channel-module yt-uix-c3-module-container has-visible-edge">
7 7
 												<div class="module-view featured-video-view-module">
8 8
 												<div id="watch-video" >
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
                                                         $stmt->bindParam(":search", $_user['username']);
55 55
                                                         $stmt->execute();
56 56
 
57
-                                                        if($stmt->rowCount() != 0) {
58
-                                                            while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
57
+                                                        if ($stmt->rowCount() != 0) {
58
+                                                            while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
59 59
                                                                 $playlist['videos'] = json_decode($playlist['videos']);
60 60
                                                     ?>
61 61
                                                     <div class="playlist yt-tile-visible yt-uix-tile">
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 														</div>
127 127
 														<hr class="yt-horizontal-rule ">
128 128
 													</div>
129
-													<?php if(!empty($_user['website'])) { ?>
129
+													<?php if (!empty($_user['website'])) { ?>
130 130
 														<div class="user-profile-item">
131 131
 															<div class="yt-c3-profile-custom-url field-container ">
132 132
 																<a href="<?php echo addhttp(htmlspecialchars($_user['website'])); ?>" rel="me nofollow" target="_blank" title="<?php echo htmlspecialchars($_user['website']); ?>" class="yt-uix-redirect-link">
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 															<h5>Country</h5>
176 176
 															<span class="value"><?php echo htmlspecialchars($_user['country']); ?></span>
177 177
 														</div>
178
-														<?php if($_user['genre'] != "none") { ?>
178
+														<?php if ($_user['genre'] != "none") { ?>
179 179
 															<div class="user-profile-item ">
180 180
 																<h5>Channel Genre</h5>
181 181
 																<span class="value"><?php echo htmlspecialchars(ucfirst($_user['genre'])); ?></span>
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 											</div>
188 188
 											<div class="channel-module other-channels yt-uix-c3-module-container other-channels-compact">
189 189
 												<?php $_user['featured_channels'] = explode(",", $_user['featured_channels']); ?>
190
-												<?php if(count($_user['featured_channels']) != 0) { ?>
190
+												<?php if (count($_user['featured_channels']) != 0) { ?>
191 191
 												<div class="module-view other-channels-view">
192
-													<h2 <?php if(@$_SESSION['siteusername'] == $_user['username']) { ?>style="display: inline-block;position: relative;bottom: 10px;"<?php } ?>>Featured Channels</h2> 
193
-													<?php if(@$_SESSION['siteusername'] == $_user['username']) { 
192
+													<h2 <?php if (@$_SESSION['siteusername'] == $_user['username']) { ?>style="display: inline-block;position: relative;bottom: 10px;"<?php } ?>>Featured Channels</h2> 
193
+													<?php if (@$_SESSION['siteusername'] == $_user['username']) { 
194 194
 														echo "<a href='#' style='float:right;font-size:11px;color:black;' onclick=';open_featured_channels();return false;'>edit</a>"; 
195 195
 													} ?>
196 196
 													<ul class="channel-summary-list ">
197 197
 														<?php 
198
-															foreach($_user['featured_channels'] as $user) {
199
-																if($__user_h->user_exists($user)) {
198
+															foreach ($_user['featured_channels'] as $user) {
199
+																if ($__user_h->user_exists($user)) {
200 200
 														?>
201 201
 															<li class="yt-tile-visible yt-uix-tile">
202 202
 																<div class="channel-summary clearfix channel-summary-compact">
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 												$stmt->bindParam(":search", $_user['username']);
226 226
 												$stmt->execute();
227 227
 
228
-												if($stmt->rowCount() != 0) {
228
+												if ($stmt->rowCount() != 0) {
229 229
 											?>
230 230
 												<div class="playlists-narrow channel-module yt-uix-c3-module-container">
231 231
 													<div class="module-view gh-featured">
232 232
 														<h2>Featured Playlists</h2>     
233 233
 														<?php
234
-														while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
234
+														while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
235 235
 															$playlist['videos'] = json_decode($playlist['videos']);
236 236
 														?> 
237 237
 															<div class="playlist yt-tile-visible yt-uix-tile">
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 												<div class="module-view other-channels-view">
216 216
 													<h2 <?php if(@$_SESSION['siteusername'] == $_user['username']) { ?>style="display: inline-block;position: relative;bottom: 10px;"<?php } ?>>Featured Channels</h2> 
217 217
 													<?php if(@$_SESSION['siteusername'] == $_user['username']) { 
218
-														echo "<a href='#' style='float:right;font-size:11px;color:black;' onclick=';open_featured_channels();return false;'>edit</a>"; 
219
-													} ?>
218
+                                                        echo "<a href='#' style='float:right;font-size:11px;color:black;' onclick=';open_featured_channels();return false;'>edit</a>"; 
219
+                                                    } ?>
220 220
 													<ul class="channel-summary-list ">
221 221
 														<?php 
222
-															foreach($_user['featured_channels'] as $user) {
223
-																if($__user_h->user_exists($user)) {
224
-														?>
222
+                                                            foreach($_user['featured_channels'] as $user) {
223
+                                                                if($__user_h->user_exists($user)) {
224
+                                                        ?>
225 225
 															<li class="yt-tile-visible yt-uix-tile">
226 226
 																<div class="channel-summary clearfix channel-summary-compact">
227 227
 																	<div class="channel-summary-thumb">
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 											</div>
246 246
 
247 247
 											<?php 
248
-												$stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :search ORDER BY id DESC LIMIT 10");
249
-												$stmt->bindParam(":search", $_user['username']);
250
-												$stmt->execute();
248
+                                                $stmt = $__db->prepare("SELECT * FROM playlists WHERE author = :search ORDER BY id DESC LIMIT 10");
249
+                                                $stmt->bindParam(":search", $_user['username']);
250
+                                                $stmt->execute();
251 251
 
252
-												if($stmt->rowCount() != 0) {
253
-											?>
252
+                                                if($stmt->rowCount() != 0) {
253
+                                            ?>
254 254
 												<div class="playlists-narrow channel-module yt-uix-c3-module-container">
255 255
 													<div class="module-view gh-featured">
256 256
 														<h2>Featured Playlists</h2>     
257 257
 														<?php
258
-														while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
259
-															$playlist['videos'] = json_decode($playlist['videos']);
260
-														?> 
258
+                                                        while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { 
259
+                                                            $playlist['videos'] = json_decode($playlist['videos']);
260
+                                                        ?> 
261 261
 															<div class="playlist yt-tile-visible yt-uix-tile">
262 262
 																<a href="/view_playlist?v=<?php echo $playlist['rid']; ?>">
263 263
 																<span class="playlist-thumb-strip playlist-thumb-strip-252"><span class="videos videos-4 horizontal-cutoff"><span class="clip"><span class="centering-offset"><span class="centering">
Please login to merge, or discard this patch.
web/public/das_captcha.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 if (isset($_POST['submit']))
19 19
 {
20
-    header("Location: " . $_SERVER['DOCUMENT_ROOT']. $next);
20
+    header("Location: " . $_SERVER['DOCUMENT_ROOT'] . $next);
21 21
 }
22 22
 ?>
23 23
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         <div id="page" class="">
47 47
         <!-- begin pagetop -->
48 48
   
49
-        <div id="masthead-container"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/header.php");?> </div>
49
+        <div id="masthead-container"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/header.php"); ?> </div>
50 50
   <!-- end pagetop -->
51 51
   <!-- begin pagemiddle -->
52 52
   <div id="content-container">
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
       
63 63
   <p class="largeText">Sorry for the interruption. We have been receiving a large volume of requests from your network. To continue with your SubRocks experience, please enter the verification code below.</p>
64 64
 
65
-<form method="post" action="/das_captcha?next=<?php echo $next;?>">
65
+<form method="post" action="/das_captcha?next=<?php echo $next; ?>">
66 66
 <script type="text/javascript" src="/s/captcha.js"></script>
67 67
 <noscript>
68 68
 You need JavaScript to pass the captcha!
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 if (isset($_GET['next']))
10 10
 {
11 11
     $next = $_GET['next'];
12
-}
13
-else
12
+} else
14 13
 {
15 14
     $next = "/";
16 15
 }
Please login to merge, or discard this patch.
web/public/admin/bans.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
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 - Ban User";
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 - Ban User";
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 20
 <!DOCTYPE html>
21 21
 <html dir="ltr">
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
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 - Ban User";
16 16
 	$__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube.";
Please login to merge, or discard this patch.
web/public/comment_service_ajax.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 <?php
15 15
 $_video = $__video_h->fetch_video_rid($_SESSION['current_video']);
16 16
 
17
-if($_SERVER['REQUEST_METHOD'] == 'POST') {
17
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
18 18
     $error = array();
19 19
 
20
-    if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; }
21
-    if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
22
-    if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
23
-    if($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before posting another comment."; $error['status'] = true; }
20
+    if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; }
21
+    if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; }
22
+    if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; }
23
+    if ($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before posting another comment."; $error['status'] = true; }
24 24
 
25
-    if(!isset($error['message'])) {
25
+    if (!isset($error['message'])) {
26 26
         $text = $_POST['comment'];
27 27
         $stmt = $__db->prepare("INSERT INTO comments (toid, author, comment) VALUES (:v, :username, :comment)");
28 28
         $stmt->bindParam(":v", $_SESSION['current_video']);
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
         $stmt->execute();
32 32
 
33 33
         $__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment");
34
-        if(@$_SESSION['siteusername'] != $_video['author'])
34
+        if (@$_SESSION['siteusername'] != $_video['author'])
35 35
             $__user_i->send_message($_SESSION['siteusername'], "New comment", $_video['author'], "I commented \"" . $_POST['comment'] . "\" on your video!", $_video['rid'], "nt");
36 36
     }
37 37
 }
38 38
 
39 39
 header("Content-type: text/xml");
40 40
 // ugly solution
41
-if(!isset($error['status'])) {
41
+if (!isset($error['status'])) {
42 42
     $xml = '<?xml version="1.0" encoding="utf-8"?><root><str_code><![CDATA[OK]]></str_code><html_content><![CDATA[<li class="comment yt-tile-default " data-author-viewing="" data-author-id="-uD01K8FQTeOSS5sniRFzQ" data-id="420" data-score="0"><div class="comment-body"><div class="content-container"><div class="content"><div class="comment-text" dir="ltr"><p>' . $__video_h->shorten_description($_POST['comment'], 2048, true) . '</p></div><p class="metadata"><span class="author "><a href="/user/' . htmlspecialchars($_SESSION['siteusername']) . '" class="yt-uix-sessionlink yt-user-name " data-sessionlink="' . htmlspecialchars($_SESSION['siteusername']) . '" dir="ltr">' . htmlspecialchars($_SESSION['siteusername']) . '</a></span><span class="time" dir="ltr"><span dir="ltr">just now<span></span></span></span></p></div><div class="comment-actions"><span class="yt-uix-button-group"><button type="button" class="start comment-action-vote-up comment-action yt-uix-button yt-uix-button-default yt-uix-tooltip yt-uix-button-empty" onclick=";return false;" title="Vote Up" data-action="vote-up" data-tooltip-show-delay="300" role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-watch-comment-vote-up" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Vote Up"><span class="yt-valign-trick"></span></span></button><button type="button" class="end comment-action-vote-down comment-action yt-uix-button yt-uix-button-default yt-uix-tooltip yt-uix-button-empty" onclick=";return false;" title="Vote Down" data-action="vote-down" data-tooltip-show-delay="300" role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-watch-comment-vote-down" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Vote Down"><span class="yt-valign-trick"></span></span></button></span><span class="yt-uix-button-group"><!--<button type="button" class="start comment-action yt-uix-button yt-uix-button-default" onclick=";return false;" data-action="reply" role="button"><span class="yt-uix-button-content">Reply </span></button>--><button type="button" class="end flip yt-uix-button yt-uix-button-default yt-uix-button-empty" onclick=";return false;" data-button-has-sibling-menu="true" role="button" aria-pressed="false" aria-expanded="false" aria-haspopup="true" aria-activedescendant=""><img class="yt-uix-button-arrow" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""><div class=" yt-uix-button-menu yt-uix-button-menu-default" style="display: none;"><ul><li class="comment-action" data-action="share"><span class="yt-uix-button-menu-item">Share</span></li><li class="comment-action-remove comment-action" data-action="remove"><span class="yt-uix-button-menu-item">Remove</span></li><li class="comment-action" data-action="flag"><span class="yt-uix-button-menu-item">Flag for spam</span></li><li class="comment-action-block comment-action" data-action="block"><span class="yt-uix-button-menu-item">Block User</span></li><li class="comment-action-unblock comment-action" data-action="unblock"><span class="yt-uix-button-menu-item">Unblock User</span></li></ul></div></button></span></div></div></div></li>]]></html_content><return_code><![CDATA[0]]></return_code></root>';
43 43
 } else {
44 44
     $xml = '<?xml version="1.0" encoding="utf-8"?><root><str_code><![CDATA[OK]]></str_code><html_content><![CDATA[<div class="yt-alert yt-alert-default yt-alert-error ">  <div class="yt-alert-icon"><img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"></div><div class="yt-alert-buttons"></div><div class="yt-alert-content" role="alert"><span class="yt-alert-vertical-trick"></span><div class="yt-alert-message">You are under a cooldown!</div></div></div>]]></html_content><return_code><![CDATA[0]]></return_code></root>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@
 block discarded – undo
31 31
         $stmt->execute();
32 32
 
33 33
         $__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment");
34
-        if(@$_SESSION['siteusername'] != $_video['author'])
35
-            $__user_i->send_message($_SESSION['siteusername'], "New comment", $_video['author'], "I commented \"" . $_POST['comment'] . "\" on your video!", $_video['rid'], "nt");
34
+        if(@$_SESSION['siteusername'] != $_video['author']) {
35
+                    $__user_i->send_message($_SESSION['siteusername'], "New comment", $_video['author'], "I commented \"" . $_POST['comment'] . "\" on your video!", $_video['rid'], "nt");
36
+        }
36 37
     }
37 38
 }
38 39
 
Please login to merge, or discard this patch.
web/public/d/reply.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
     ]
22 22
 ];
23 23
 
24
-if(empty(trim($request->comment))) { header("Location: /watch?v=" . $_GET['v']); }
25
-if(empty(trim($request->to_id  ))) { header("Location: /"); }
26
-if(isset($_SESSION['siteusername'])) {
24
+if (empty(trim($request->comment))) { header("Location: /watch?v=" . $_GET['v']); }
25
+if (empty(trim($request->to_id))) { header("Location: /"); }
26
+if (isset($_SESSION['siteusername'])) {
27 27
     $stmt = $__db->prepare("INSERT INTO comment_reply (toid, author, comment) VALUES (:to_id, :author, :comment)");
28
-    $stmt->bindParam(":to_id",   $request->to_id);
29
-    $stmt->bindParam(":author",  $request->sender);
28
+    $stmt->bindParam(":to_id", $request->to_id);
29
+    $stmt->bindParam(":author", $request->sender);
30 30
     $stmt->bindParam(":comment", $request->comment);
31 31
     $stmt->execute();
32 32
 
Please login to merge, or discard this patch.
web/public/d/admin.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 <?php $__db_h = new db_helper(); ?>
12 12
 <?php $__time_h = new time_helper(); ?>
13 13
 <?php
14
-    if(!isset($_SESSION['siteusername'])) { die(); }
15
-    if(!$__user_h->if_admin($_SESSION['siteusername'])) { die(); }
14
+    if (!isset($_SESSION['siteusername'])) { die(); }
15
+    if (!$__user_h->if_admin($_SESSION['siteusername'])) { die(); }
16 16
 
17 17
     $request = (object) [
18 18
         "action" => $_GET['action'],
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
     );
49 49
     $request->tables_increment = 0;
50 50
 
51
-    if($request->action == "ban_users") {        
52
-        foreach($request->users as $username) {
51
+    if ($request->action == "ban_users") {        
52
+        foreach ($request->users as $username) {
53 53
             $stmt = $__db->prepare("DELETE FROM users WHERE username=:username");
54 54
             $stmt->execute(array(
55 55
                 ':username' => $username,
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 
133 133
             header("Location: /admin/bans");
134 134
         }
135
-    } else if($request->action == "delete_videos") {
136
-        foreach($request->videos as $video) {
135
+    } else if ($request->action == "delete_videos") {
136
+        foreach ($request->videos as $video) {
137 137
             $stmt = $__db->prepare("DELETE FROM videos WHERE rid=:video");
138 138
             $stmt->execute(array(
139 139
                 ':video' => $video,
Please login to merge, or discard this patch.
web/public/get/delete_user_admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
 <?php $__db_h = new db_helper(); ?>
12 12
 <?php $__time_h = new time_helper(); ?>
13 13
 <?php
14
-    if(!isset($_SESSION['siteusername'])) { die(); }
15
-    if(!$__user_h->if_admin($_SESSION['siteusername'])) { die(); }
14
+    if (!isset($_SESSION['siteusername'])) { die(); }
15
+    if (!$__user_h->if_admin($_SESSION['siteusername'])) { die(); }
16 16
 
17 17
     $request = (object) [
18 18
         "username" => $_GET['v'],
Please login to merge, or discard this patch.
web/public/get/delete_video_admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
 <?php $__db_h = new db_helper(); ?>
12 12
 <?php $__time_h = new time_helper(); ?>
13 13
 <?php
14
-    if(!isset($_SESSION['siteusername'])) { die(); }
15
-    if(!$__user_h->if_admin($_SESSION['siteusername'])) { die(); }
14
+    if (!isset($_SESSION['siteusername'])) { die(); }
15
+    if (!$__user_h->if_admin($_SESSION['siteusername'])) { die(); }
16 16
 
17 17
     $request = (object) [
18 18
         "video" => $_GET['v'],
Please login to merge, or discard this patch.
web/public/admin/index.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
26 26
 		$dif['idle'] = $info2[3] - $info1[3]; 
27 27
 		$total = array_sum($dif); 
28 28
 		$cpu = array(); 
29
-		foreach($dif as $x=>$y) $cpu[$x] = round($y / $total * 100, 1);
29
+		foreach($dif as $x=>$y) {
30
+		    $cpu[$x] = round($y / $total * 100, 1);
31
+		}
30 32
 
31 33
 		return $cpu;
32 34
 	}
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -12,64 +12,64 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(); ?>
Please login to merge, or discard this patch.