Passed
Push — master ( 6913f4...c18235 )
by a
02:27
created
view/group.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
         
22 22
         <div class="container">
23 23
             <?php
24
-                if($_SERVER['REQUEST_METHOD'] == 'POST')  {
25
-                    if(!isset($_SESSION['user'])) {
24
+                if ($_SERVER['REQUEST_METHOD'] == 'POST') {
25
+                    if (!isset($_SESSION['user'])) {
26 26
                         $error = "you are not logged in";
27 27
                         goto skipcomment;
28 28
                     }
29
-                    if(!$_POST['comment']) {
29
+                    if (!$_POST['comment']) {
30 30
                         $error = "your comment cannot be blank";
31 31
                         goto skipcomment;
32 32
                     }
33
-                    if(strlen($_POST['comment']) > 500) {
33
+                    if (strlen($_POST['comment']) > 500) {
34 34
                         $error = "your comment must be shorter than 500 characters";
35 35
                         goto skipcomment;
36 36
                     }
@@ -43,26 +43,26 @@  discard block
 block discarded – undo
43 43
                 }
44 44
                 skipcomment:
45 45
 
46
-                if(isset($_GET['id'])) {
46
+                if (isset($_GET['id'])) {
47 47
                     $stmt = $conn->prepare("SELECT * FROM `groups` WHERE id = ?");
48 48
                     $stmt->bind_param("i", $_GET['id']);
49 49
                     $stmt->execute();
50 50
                     $result = $stmt->get_result();
51
-                    if($result->num_rows === 0) echo('Group doesnt exist.');
52
-                    while($row = $result->fetch_assoc()) {
51
+                    if ($result->num_rows === 0) echo('Group doesnt exist.');
52
+                    while ($row = $result->fetch_assoc()) {
53 53
                         $id = $row['id'];
54 54
                         ?>
55 55
                         <img style='border: 1px solid white; width: 5em;'
56
-                             src='/dynamic/pfp/<?php echo getPFP($row["author"], $conn);?>'>
56
+                             src='/dynamic/pfp/<?php echo getPFP($row["author"], $conn); ?>'>
57 57
                         <span style='float: right;text-align: right;'>
58
-                            <a href='/view/group?id=<?php echo $row["id"];?>' style='color: gold;font-size:1.5em'>
59
-                                <?php echo $row['title'];?>
58
+                            <a href='/view/group?id=<?php echo $row["id"]; ?>' style='color: gold;font-size:1.5em'>
59
+                                <?php echo $row['title']; ?>
60 60
                             </a><br>
61 61
                             <small>
62 62
                                 <i>
63 63
                                     Created by
64
-                                    <a href='/view/profile?id=<?php echo getID($row["author"], $conn);?>'>
65
-                                        <?php echo $row['author'];?>
64
+                                    <a href='/view/profile?id=<?php echo getID($row["author"], $conn); ?>'>
65
+                                        <?php echo $row['author']; ?>
66 66
                                     </a>
67 67
                                 </i><br>
68 68
                                 <?php echo $row['date']?>
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
                     $stmt->bind_param("i", $id);
79 79
                     $stmt->execute();
80 80
                     $result = $stmt->get_result();
81
-                    if($result->num_rows === 0) echo('There are no users.');
81
+                    if ($result->num_rows === 0) echo('There are no users.');
82 82
                     $members = 0;
83
-                    while($row = $result->fetch_assoc()) {
83
+                    while ($row = $result->fetch_assoc()) {
84 84
                         $members++;
85 85
                     }
86
-                    echo "<span style='float:right;'><a href='/joingroup?id=" . $id. "'><button>Join</button></a></span>";
86
+                    echo "<span style='float:right;'><a href='/joingroup?id=" . $id . "'><button>Join</button></a></span>";
87 87
                 } else {
88 88
                     header("Location: view/groups.php");
89 89
                 }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             <hr>
93 93
             <div>
94 94
                 <div class="left">
95
-                    <?php if(isset($error)) {echo "<small style='color:red'>" . $error . "</small>";}?>
95
+                    <?php if (isset($error)) {echo "<small style='color:red'>" . $error . "</small>"; }?>
96 96
                     <h2>Comments</h2>
97 97
                     <?php if (isset($_SESSION['user'])) { ?>
98 98
                         <form method="post" enctype="multipart/form-data">
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
                             $stmt->execute();
110 110
                             $result = $stmt->get_result();
111 111
                 
112
-                            while($row = $result->fetch_assoc()) { ?>
112
+                            while ($row = $result->fetch_assoc()) { ?>
113 113
                                 <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'>
114 114
                                     <div class="commentText" style="word-wrap: break-word;">
115 115
                                         <small><?php echo $row['date']; ?></small><br>
116
-                                        <?php echo validateMarkdown($row['text']);?>
116
+                                        <?php echo validateMarkdown($row['text']); ?>
117 117
                                     </div>
118 118
                                     <div>
119 119
                                         <a style='float: right;' href='/view/profile?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                     </div>
126 126
                 </div>
127 127
                 <div class="right">
128
-                    <h2>Members (<?php echo $members;?>)</h2>
128
+                    <h2>Members (<?php echo $members; ?>)</h2>
129 129
                     <?php
130 130
                         $stmt = $conn->prepare("SELECT `username`, `id` FROM `users` WHERE `currentgroup` = ?");
131 131
                         $stmt->bind_param("i", $id);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
                         echo "<ul>";
136 136
                         while ($row = $result->fetch_assoc()) {
137
-                            echo "<li><a href='/view/profile?id=" . $row['id'] . "'>". $row['username'] . "</a></li>";
137
+                            echo "<li><a href='/view/profile?id=" . $row['id'] . "'>" . $row['username'] . "</a></li>";
138 138
                         }
139 139
                         echo "</ul>";
140 140
                     ?>
Please login to merge, or discard this patch.