Passed
Pull Request — master (#20)
by
unknown
01:51
created
func/func.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -11,133 +11,133 @@
 block discarded – undo
11 11
 }
12 12
 
13 13
 function validateCSS($validate) {
14
-	$DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); 
14
+    $DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); 
15 15
 
16
-	$validated = str_replace($DISALLOWED, "", $validate);
16
+    $validated = str_replace($DISALLOWED, "", $validate);
17 17
     return $validated;
18 18
 }
19 19
 function validateMarkdown($comment) {
20
-	$markdown = new Michelf\Markdown;
21
-	$markdown->no_markup = true;
22
-	$transformed = $markdown->transform($comment);
23
-	return preg_replace(
24
-		"/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i",
25
-		"Attempted XSS: $2 ($1)",
26
-		$transformed
27
-	);
20
+    $markdown = new Michelf\Markdown;
21
+    $markdown->no_markup = true;
22
+    $transformed = $markdown->transform($comment);
23
+    return preg_replace(
24
+        "/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i",
25
+        "Attempted XSS: $2 ($1)",
26
+        $transformed
27
+    );
28 28
 }
29 29
 
30 30
 function validateCaptcha($privatekey, $response) {
31
-	$responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response));
32
-	return $responseData->success;
31
+    $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response));
32
+    return $responseData->success;
33 33
 }
34 34
 
35 35
 function requireLogin() {
36
-	if (!isset($_SESSION['user'])) {
37
-		header("Location: /login.php?r_login"); die();
38
-	}
36
+    if (!isset($_SESSION['user'])) {
37
+        header("Location: /login.php?r_login"); die();
38
+    }
39 39
 }
40 40
 
41 41
 function getID($user, $connection) {
42
-	$stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
43
-	$stmt->bind_param("s", $user);
44
-	$stmt->execute();
45
-	$result = $stmt->get_result();
46
-	if($result->num_rows === 0) return 'error';
47
-	while($row = $result->fetch_assoc()) {
48
-		$id = $row['id'];
49
-	} 
50
-	$stmt->close();
51
-	return $id;
42
+    $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
43
+    $stmt->bind_param("s", $user);
44
+    $stmt->execute();
45
+    $result = $stmt->get_result();
46
+    if($result->num_rows === 0) return 'error';
47
+    while($row = $result->fetch_assoc()) {
48
+        $id = $row['id'];
49
+    } 
50
+    $stmt->close();
51
+    return $id;
52 52
 }
53 53
 
54 54
 function getName($id, $connection) {
55
-	$stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
56
-	$stmt->bind_param("s", $id);
57
-	$stmt->execute();
58
-	$result = $stmt->get_result();
59
-	if($result->num_rows === 0) return('error');
60
-	while($row = $result->fetch_assoc()) {
61
-		$name = htmlspecialchars($row['username']);
62
-	} 
63
-	$stmt->close();
64
-	return $name;
55
+    $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
56
+    $stmt->bind_param("s", $id);
57
+    $stmt->execute();
58
+    $result = $stmt->get_result();
59
+    if($result->num_rows === 0) return('error');
60
+    while($row = $result->fetch_assoc()) {
61
+        $name = htmlspecialchars($row['username']);
62
+    } 
63
+    $stmt->close();
64
+    return $name;
65 65
 }
66 66
 
67 67
 function getPFP($user, $connection) {
68
-	$stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
69
-	$stmt->bind_param("s", $user);
70
-	$stmt->execute();
71
-	$result = $stmt->get_result();
72
-	if($result->num_rows === 0) return('error');
73
-	while($row = $result->fetch_assoc()) {
74
-		$pfp = htmlspecialchars($row['pfp']);
75
-	} 
76
-	$stmt->close();
77
-	return $pfp;
68
+    $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
69
+    $stmt->bind_param("s", $user);
70
+    $stmt->execute();
71
+    $result = $stmt->get_result();
72
+    if($result->num_rows === 0) return('error');
73
+    while($row = $result->fetch_assoc()) {
74
+        $pfp = htmlspecialchars($row['pfp']);
75
+    } 
76
+    $stmt->close();
77
+    return $pfp;
78 78
 }
79 79
 
80 80
 function checkIfFriended($friend1, $friend2, $connection)
81 81
 {
82
-	$stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?");
83
-	$stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1);
84
-	$stmt->execute();
85
-	$result = $stmt->get_result();
86
-	if($result->num_rows === 1){ return true; }
87
-	return false;
82
+    $stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?");
83
+    $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1);
84
+    $stmt->execute();
85
+    $result = $stmt->get_result();
86
+    if($result->num_rows === 1){ return true; }
87
+    return false;
88 88
 }
89 89
 
90 90
 function getUser($id, $connection) {
91
-	$userResult = array();
92
-	$stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
93
-	$stmt->bind_param("i", $id);
94
-	$stmt->execute();
95
-	$result = $stmt->get_result();
96
-	if($result->num_rows === 0) echo('That user does not exist.');
97
-	while($row = $result->fetch_assoc()) {
98
-		$userResult['username'] = $row['username'];
99
-		$userResult['id'] = $row['id'];
100
-		$userResult['date'] = $row['date'];
101
-		$userResult['bio'] = $row['bio'];
102
-		$userResult['css'] = $row['css'];
103
-		$userResult['pfp'] = $row['pfp'];
104
-		$userResult['badges'] = explode(';', $row['badges']);
105
-		$userResult['music'] = $row['music'];
106
-	}
107
-	$stmt->close();
108
-
109
-	$stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?");
110
-	$stmt->bind_param("s", $userResult['username']);
111
-	$stmt->execute();
112
-	$result = $stmt->get_result();
113
-
114
-	$userResult['comments'] = 0;
115
-	while($row = $result->fetch_assoc()) {
116
-		$userResult['comments']++;
117
-	}
118
-	$stmt->close();
119
-
120
-	$stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?");
121
-	$stmt->bind_param("s", $userResult['username']);
122
-	$stmt->execute();
123
-	$result = $stmt->get_result();
124
-
125
-	$userResult['profilecomments'] = 0;
126
-	while($row = $result->fetch_assoc()) {
127
-		$userResult['profilecomments']++;
128
-	}
129
-	$stmt->close();
130
-
131
-	$stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'");
132
-	$stmt->bind_param("s", $userResult['username']);
133
-	$stmt->execute();
134
-	$result = $stmt->get_result();
135
-
136
-	$userResult['filesuploaded'] = 0;
137
-	while($row = $result->fetch_assoc()) {
138
-		$userResult['filesuploaded']++;
139
-	}
140
-	$stmt->close();
141
-	return $userResult;
91
+    $userResult = array();
92
+    $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
93
+    $stmt->bind_param("i", $id);
94
+    $stmt->execute();
95
+    $result = $stmt->get_result();
96
+    if($result->num_rows === 0) echo('That user does not exist.');
97
+    while($row = $result->fetch_assoc()) {
98
+        $userResult['username'] = $row['username'];
99
+        $userResult['id'] = $row['id'];
100
+        $userResult['date'] = $row['date'];
101
+        $userResult['bio'] = $row['bio'];
102
+        $userResult['css'] = $row['css'];
103
+        $userResult['pfp'] = $row['pfp'];
104
+        $userResult['badges'] = explode(';', $row['badges']);
105
+        $userResult['music'] = $row['music'];
106
+    }
107
+    $stmt->close();
108
+
109
+    $stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?");
110
+    $stmt->bind_param("s", $userResult['username']);
111
+    $stmt->execute();
112
+    $result = $stmt->get_result();
113
+
114
+    $userResult['comments'] = 0;
115
+    while($row = $result->fetch_assoc()) {
116
+        $userResult['comments']++;
117
+    }
118
+    $stmt->close();
119
+
120
+    $stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?");
121
+    $stmt->bind_param("s", $userResult['username']);
122
+    $stmt->execute();
123
+    $result = $stmt->get_result();
124
+
125
+    $userResult['profilecomments'] = 0;
126
+    while($row = $result->fetch_assoc()) {
127
+        $userResult['profilecomments']++;
128
+    }
129
+    $stmt->close();
130
+
131
+    $stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'");
132
+    $stmt->bind_param("s", $userResult['username']);
133
+    $stmt->execute();
134
+    $result = $stmt->get_result();
135
+
136
+    $userResult['filesuploaded'] = 0;
137
+    while($row = $result->fetch_assoc()) {
138
+        $userResult['filesuploaded']++;
139
+    }
140
+    $stmt->close();
141
+    return $userResult;
142 142
 }
143 143
 ?>
144 144
\ No newline at end of file
Please login to merge, or discard this patch.
register.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     <body> 
15 15
         <?php 
16 16
             require(__DIR__ . "/important/header.php"); 
17
-         ?>
17
+            ?>
18 18
         <center><h1 style="display: inline-block;">4Grounds - Register</h1><br>
19 19
             <?php
20 20
                 if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) 
Please login to merge, or discard this patch.
view/index.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 va                <source src="/dynamic/song/' . $filename . '">
70 70
                 </audio>';
71 71
             } else if($type == "image") {
72
-              echo "<img style='max-width: 100%;' src='/dynamic/image/" . $filename . "'>";
72
+                echo "<img style='max-width: 100%;' src='/dynamic/image/" . $filename . "'>";
73 73
             } else if($type == "midi") {
74 74
                 echo "Note: It may take a few seconds for the MIDI to load.<br>";
75 75
                 echo "<a href='#' onClick=\"MIDIjs.play('/dynamic/midi/" . $filename . "');\">Play " . $title . "</a>";
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
             <script type="text/javascript" src="//cdn.jsdelivr.net/gh/deskjet/chiptune2.js@master/chiptune2.js"></script>';
203 203
             echo '<a class="song" data-modurl="/dynamic/chiptune/' . $filename . '" href="#">Play ' . $title . '</a>';
204 204
             } else if($type == "news" || $type == "review") {
205
-              //do nothing
205
+                //do nothing
206 206
             } else if($type == "video") {
207
-              echo ' <video width="640" height="400" controls>
207
+                echo ' <video width="640" height="400" controls>
208 208
                   <source src="/dynamic/video/' . $filename . '" type="video/mp4">
209 209
                 </video> ';
210 210
             } else {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             <form method="post" enctype="multipart/form-data" id="submitform">
216 216
                 <textarea required cols="77" placeholder="Comment" name="comment"></textarea><br>
217 217
                 <input type="submit" value="Post" <?php 
218
-                  if ($config['use_recaptcha']) 
218
+                    if ($config['use_recaptcha']) 
219 219
                     echo 'class="g-recaptcha" data-sitekey="' . $config['recaptcha_sitekey'] . '" data-callback="onSubmit"'
220 220
                 ?>> <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small>
221 221
             </form>
Please login to merge, or discard this patch.