Test Failed
Push — main ( e8e3a0...05a218 )
by chief
03:07
created
web/public/comment_service_ajax.php 1 patch
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.
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/upload.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
     // $_FILES['video_file']['tmp_name'] = substr_replace($_FILES['video_file']['tmp_name'], '/', 8, 0);
41 41
     /* -- /tmp/phpfAN4Xu -- Why in the fuck does this happen? I love PHP */
42 42
 
43
-    if($__user_h->if_upload_cooldown($_SESSION['siteusername'])) { 
43
+    if ($__user_h->if_upload_cooldown($_SESSION['siteusername'])) { 
44 44
         $video_validation->upload_error = "Under an upload cooldown";
45 45
         $video_validation->upload_ok = 0;
46 46
     }
47 47
 
48
-    if(move_uploaded_file(
48
+    if (move_uploaded_file(
49 49
         $_FILES['video_file']['tmp_name'], 
50 50
         "../dynamic/temp/" . $video_properties->video_rid . $video_validation->video_file_type
51 51
     )) {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $video_validation->upload_ok = 0;
56 56
     }
57 57
 
58
-    if( $video_validation->video_file_type == ".png" || 
58
+    if ($video_validation->video_file_type == ".png" || 
59 59
         $video_validation->video_file_type == ".jpg" || 
60 60
         $video_validation->video_file_type == ".jpeg" || 
61 61
         $video_validation->video_file_type == ".gif"
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/s/mod/sidebar_inbox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@
 block discarded – undo
35 35
     </a>
36 36
 </div>
37 37
     <ol class="navigation-menu">
38
-        <?php foreach($__tabs as $_tab) { 
39
-            if($_SERVER['REQUEST_URI'] != $_tab->url)
38
+        <?php foreach ($__tabs as $_tab) { 
39
+            if ($_SERVER['REQUEST_URI'] != $_tab->url)
40 40
                 $_tab->selected = true;
41 41
             ?>
42 42
             <li class="menu-item">
Please login to merge, or discard this patch.
web/public/admin/index.php 1 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.
web/public/api/get_user_info.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
     "status" => 201,
15 15
 ];
16 16
 
17
-if(!isset($_GET['u']))                  { $response->status = 400; die(json_encode($response)); } 
18
-if(!$__user_h->user_exists($_GET['u'])) { $response->status = 400; die(json_encode($response)); }
17
+if (!isset($_GET['u'])) { $response->status = 400; die(json_encode($response)); } 
18
+if (!$__user_h->user_exists($_GET['u'])) { $response->status = 400; die(json_encode($response)); }
19 19
 
20 20
 $_user = $__user_h->fetch_user_username($_GET['u']);
21 21
 $response = (object) [
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 $_user['featured_channels'] = explode($_user['featured_channels'], ",");
41 41
 $_user['featured_channels_object'] = (object) [];
42 42
 $i = 0;
43
-foreach($_user['featured_channels'] as $channel) {
43
+foreach ($_user['featured_channels'] as $channel) {
44 44
     $_user['featured_channels_object']->$i = $channel;
45 45
 }
46 46
 
Please login to merge, or discard this patch.
web/public/d/admin.php 1 patch
Spacing   +8 added lines, -8 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'],
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
     );
50 50
     $request->tables_increment = 0;
51 51
 
52
-    if($request->action == "ban_users") {        
53
-        foreach($request->users as $username) {
52
+    if ($request->action == "ban_users") {        
53
+        foreach ($request->users as $username) {
54 54
             $stmt = $__db->prepare("DELETE FROM users WHERE username=:username");
55 55
             $stmt->execute(array(
56 56
                 ':username' => $username,
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 
134 134
             header("Location: /admin/bans");
135 135
         }
136
-    } else if($request->action == "delete_videos") {
137
-        foreach($request->videos as $video) {
136
+    } else if ($request->action == "delete_videos") {
137
+        foreach ($request->videos as $video) {
138 138
             $stmt = $__db->prepare("DELETE FROM videos WHERE rid=:video");
139 139
             $stmt->execute(array(
140 140
                 ':video' => $video,
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
             header("Location: /admin/bans");
144 144
         }
145
-    } else if($request->action == "actually_just_ban") {
145
+    } else if ($request->action == "actually_just_ban") {
146 146
         $stmt = $__db->prepare("INSERT INTO bans (username, reason, expire, moderator) VALUES (:username, :reason, now(), :moderator)");
147 147
         $stmt->execute(array(
148 148
             ':username'  => $_POST['users'],
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         ));
152 152
 
153 153
         header("Location: /admin/bans");
154
-    } else if($request->action == "actually_just_ban_ip") {
154
+    } else if ($request->action == "actually_just_ban_ip") {
155 155
         $_user = $__user_h->fetch_user_username($_POST['users']);
156 156
 
157 157
         $stmt = $__db->prepare("INSERT INTO bans (username, reason, expire, moderator) VALUES (:username, :reason, now(), :moderator)");
Please login to merge, or discard this patch.