Passed
Push — master ( 6cff26...798cae )
by Cody
02:58
created
functions/login.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2
-if($password != "" && isset($_POST['auth_submit'])){
3
-  if($password != $_POST['password']){
2
+if ($password != "" && isset($_POST['auth_submit'])) {
3
+  if ($password != $_POST['password']) {
4 4
     ?>
5 5
       <b>wrong password</b>, try again.
6 6
     <?php
7
-  } else{
7
+  }else {
8 8
     $_SESSION['logged_in'] = true;
9 9
     echo 'logged in!';
10 10
     header("refresh:0;");
Please login to merge, or discard this patch.
functions/display_messages.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
     return $result;
17 17
   }
18 18
 
19
-  function build_message($message){
19
+  function build_message($message) {
20 20
     $result = "";
21 21
     $result = $result . "<div class='message'>";
22 22
     $result = $result . "<div class='title' id='" . $message['id'] . "'><span class='name'>Anonymous</span> " . $message['date'] . " id. <a href='#" . $message['id'] . "'>" . $message['id'] . "</a></div><div class = 'message-inside'>";
23 23
     if ($message['file'] != "") {
24
-      if(substr($message['file'], -4) == "webm" || substr($message['file'], -3) == "mp4"){
24
+      if (substr($message['file'], -4) == "webm" || substr($message['file'], -3) == "mp4") {
25 25
         $result = $result . '<div><video width="600" controls loop><source src="images/' . $message['file'] . '" type="video/mp4"></video></div><br />';
26
-      }else{
26
+      }else {
27 27
         $result = $result . "<div><a href='images/" . $message['file'] . "'><img src = 'images/" . $message['file'] . "' class='message-image'/></a></div>";
28 28
       }
29 29
     }
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
     return $result;
32 32
   }
33 33
 
34
-  function check_empty($msgs){
34
+  function check_empty($msgs) {
35 35
     if (isset($msgs) && $msgs != "") {
36 36
       $msg = $msgs;
37
-    } else {
37
+    }else {
38 38
       $msg = "something's wrong, this nerve is either empty or our brain doesn't have access to this nerve's messages...";
39 39
     }
40 40
     return $msg;
41 41
   }
42 42
 
43
-  function build_result($msg, $last_msg, $action){
43
+  function build_result($msg, $last_msg, $action) {
44 44
     if ($action == "messages") {
45 45
       $result = $msg;
46
-    } else if ($action == "last_msg") {
46
+    }else if ($action == "last_msg") {
47 47
       $result = $last_msg;
48
-    } else {
48
+    }else {
49 49
       $result = "show_messages: parameters <b>must</b> be \$messages and either 'messages' or 'last_msg'";
50 50
     }
51 51
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     if ($message['file'] != "") {
24 24
       if(substr($message['file'], -4) == "webm" || substr($message['file'], -3) == "mp4"){
25 25
         $result = $result . '<div><video width="600" controls loop><source src="images/' . $message['file'] . '" type="video/mp4"></video></div><br />';
26
-      }else{
26
+      } else{
27 27
         $result = $result . "<div><a href='images/" . $message['file'] . "'><img src = 'images/" . $message['file'] . "' class='message-image'/></a></div>";
28 28
       }
29 29
     }
Please login to merge, or discard this patch.
functions/post_messages.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
         $file_name_for_db = uploadFile($max_file_size, $last_msg);
10 10
       }
11 11
 
12
-      if($file_name_for_db != "not uploaded"){
12
+      if ($file_name_for_db != "not uploaded") {
13 13
           $jsondata = messageToJSON($file_name_for_db, $messages, $last_msg);
14 14
           file_put_contents($file, $jsondata);
15 15
       }
16 16
 
17
-      if(!isset($_SESSION['response']) || (!$_SESSION['response'] && is_bool($_SESSION['response']))){
17
+      if (!isset($_SESSION['response']) || (!$_SESSION['response'] && is_bool($_SESSION['response']))) {
18 18
         $_SESSION['response'] = true;
19 19
       }
20 20
 
21
-    } else {
21
+    }else {
22 22
       $_SESSION['response'] = "The message field is <b>required</b>.";
23 23
     }
24 24
   }
25 25
 
26
-  function greenText($msg){
26
+  function greenText($msg) {
27 27
     preg_match_all('/(?<!&gt;)&gt;(?!&gt;).*/', $msg, $matches, PREG_SET_ORDER, 0);
28 28
 
29 29
     foreach ($matches as $m) {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     return $msg;
46 46
   }
47 47
 
48
-  function uploadFile($max_file_size, $last_msg){
48
+  function uploadFile($max_file_size, $last_msg) {
49 49
     $target_dir = "images/";
50 50
     $target_file_for_base_name = explode(".", $_FILES["file"]["name"]); //sorry, this is horrid, I know.
51 51
     $target_file_for_base_name = $last_msg + 1 . "." . $target_file_for_base_name[1];
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
     $uploadOk = true;
54 54
     $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
55 55
     $check = getimagesize($_FILES["file"]["tmp_name"]);
56
-    if($imageFileType != "webm" && $imageFileType != "mp4"){
56
+    if ($imageFileType != "webm" && $imageFileType != "mp4") {
57 57
       if ($check !== false) {
58 58
         $uploadOk = true;
59
-      } else {
59
+      }else {
60 60
         $_SESSION['response'] = "what are you doing anon? that file was not an image or a webm...";
61 61
         $uploadOk = false;
62 62
       }
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
         move_uploaded_file($_FILES["file"]["tmp_name"], $target_file);
80 80
     }
81 81
 
82
-    if($uploadOk)return $target_file_for_base_name;else return 'not uploaded';
82
+    if ($uploadOk)return $target_file_for_base_name; else return 'not uploaded';
83 83
   }
84 84
 
85
-  function messageToJSON($file_name_for_db, $messages, $last_msg){
85
+  function messageToJSON($file_name_for_db, $messages, $last_msg) {
86 86
     $new_message = array(
87 87
       'id' => $last_msg + 1,
88 88
       'message' => nl2br(greenText(postLink(str_replace(">", "&gt;", str_replace("<", "&lt;", $_POST['message'])))), false),
Please login to merge, or discard this patch.
Braces   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,11 @@
 block discarded – undo
79 79
         move_uploaded_file($_FILES["file"]["tmp_name"], $target_file);
80 80
     }
81 81
 
82
-    if($uploadOk)return $target_file_for_base_name;else return 'not uploaded';
82
+    if($uploadOk) {
83
+      return $target_file_for_base_name;
84
+    } else {
85
+      return 'not uploaded';
86
+    }
83 87
   }
84 88
 
85 89
   function messageToJSON($file_name_for_db, $messages, $last_msg){
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
     }
45 45
     // post messages
46 46
     require_once("functions/post_messages.php");
47
-    if(isset($_SESSION['response']) && $_SESSION['response'] && is_bool($_SESSION['response'])){
47
+    if (isset($_SESSION['response']) && $_SESSION['response'] && is_bool($_SESSION['response'])) {
48 48
       $_SESSION['response'] = false;
49 49
       echo '<meta http-equiv="refresh" content="1">';
50 50
     }elseif (isset($_SESSION['response'])) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
   if (!$_SESSION['logged_in'] && $password != "") {
30 30
     require_once("functions/login.php");
31
-  }else if ($_SESSION['logged_in'] || $password == "") {
31
+  } else if ($_SESSION['logged_in'] || $password == "") {
32 32
     // display messages
33 33
     require_once("functions/display_messages.php");
34 34
     $messages = get_messages($file);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     if(isset($_SESSION['response']) && $_SESSION['response'] && is_bool($_SESSION['response'])){
48 48
       $_SESSION['response'] = false;
49 49
       echo '<meta http-equiv="refresh" content="1">';
50
-    }elseif (isset($_SESSION['response'])) {
50
+    } elseif (isset($_SESSION['response'])) {
51 51
       echo $_SESSION['response'];
52 52
       $_SESSION['response'] = false;
53 53
     }
Please login to merge, or discard this patch.