[tor-commits] [donate/master] Fixed line endings

peterh at torproject.org peterh at torproject.org
Wed Jul 10 18:31:22 UTC 2019


commit 8a6c7e939ebd189e25ef85107804e2a260547df0
Author: Peter Haight <peterh at giantrabbit.com>
Date:   Tue Jul 9 16:44:03 2019 -0700

    Fixed line endings
    
    It had DOS line endings for some reason.
---
 src/Captcha.php | 68 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/Captcha.php b/src/Captcha.php
index a07630dd..5aa4dd52 100644
--- a/src/Captcha.php
+++ b/src/Captcha.php
@@ -1,34 +1,34 @@
-<?php
-
-namespace Tor;
-
-class Captcha {
-  function generate($request, $response, $args) {
-    $letters = substr(str_shuffle("ACDJKMNOPSTVWXYZ"),0,4);
-    $image = imagecreate(40,13);
-    imagecolorallocate($image, 255, 255, 255);
-    imagecolorallocate($image, 0, 0, 0);
-    imagecolorallocate($image, rand(50,175), rand(125,225), rand(125,225));
-    imagecolorallocate($image, rand(125,225), rand(50,175), rand(125,225));
-    imageline($image, 0, rand(9,14), 40, rand(2,7), 2);
-    imagestring($image, 5, 3, 0, " " . $letters[0] . " " . $letters[1], 1);
-    imagestring($image, 5, 3, 0, $letters[2] . " " . $letters[3], 1);
-    $_SESSION["captcha"] = hash('sha256', $letters[2] . $letters[0] . $letters[3] . $letters[1]);
-
-    $stream = fopen('php://memory', 'r+');
-    imagepng($image, $stream);
-    rewind($stream);
-    $content = stream_get_contents($stream);
-    $response->write($content);
-    return $response->withHeader('Content-Type', 'image/png');
-  }
-
-  function is_valid($fields, $session) {
-    $valid = TRUE;
-    $captcha = trim(ArrayExt::fetch($fields, "captcha"));
-    if (($captcha == '') || (hash("sha256", strtoupper($captcha)) != $session["captcha"])) {
-      $valid = FALSE;
-    }
-    return $valid;
-  }
-}
+<?php
+
+namespace Tor;
+
+class Captcha {
+  function generate($request, $response, $args) {
+    $letters = substr(str_shuffle("ACDJKMNOPSTVWXYZ"),0,4);
+    $image = imagecreate(40,13);
+    imagecolorallocate($image, 255, 255, 255);
+    imagecolorallocate($image, 0, 0, 0);
+    imagecolorallocate($image, rand(50,175), rand(125,225), rand(125,225));
+    imagecolorallocate($image, rand(125,225), rand(50,175), rand(125,225));
+    imageline($image, 0, rand(9,14), 40, rand(2,7), 2);
+    imagestring($image, 5, 3, 0, " " . $letters[0] . " " . $letters[1], 1);
+    imagestring($image, 5, 3, 0, $letters[2] . " " . $letters[3], 1);
+    $_SESSION["captcha"] = hash('sha256', $letters[2] . $letters[0] . $letters[3] . $letters[1]);
+
+    $stream = fopen('php://memory', 'r+');
+    imagepng($image, $stream);
+    rewind($stream);
+    $content = stream_get_contents($stream);
+    $response->write($content);
+    return $response->withHeader('Content-Type', 'image/png');
+  }
+
+  function is_valid($fields, $session) {
+    $valid = TRUE;
+    $captcha = trim(ArrayExt::fetch($fields, "captcha"));
+    if (($captcha == '') || (hash("sha256", strtoupper($captcha)) != $session["captcha"])) {
+      $valid = FALSE;
+    }
+    return $valid;
+  }
+}





More information about the tor-commits mailing list