Explorar o código

Update index.php

Removed ugly error message when paste identifier is invalid (eg. http://mydomain.com/zerobin?foo)
(cherry picked from commit 43fa904979a29e4c205b9f4f08e1c487555bbe1c)

Conflicts:
	index.php
Sébastien SAUVAGE %!s(int64=13) %!d(string=hai) anos
pai
achega
5b54ca34ad
Modificáronse 1 ficheiros con 7 adicións e 3 borrados
  1. 7 3
      lib/zerobin.php

+ 7 - 3
lib/zerobin.php

@@ -272,8 +272,8 @@ class zerobin
             $pasteid  = $_POST['pasteid'];
             $parentid = $_POST['parentid'];
             if (
-                !preg_match('/\A[a-f\d]{16}\z/', $pasteid) ||
-                !preg_match('/\A[a-f\d]{16}\z/', $parentid)
+                !preg_match('#\A[a-f\d]{16}\z#', $pasteid) ||
+                !preg_match('#\A[a-f\d]{16}\z#', $parentid)
             ) $this->_return_message(1, 'Invalid data.');
 
             // Comments do not expire (it's the paste that expires)
@@ -340,7 +340,7 @@ class zerobin
     private function _delete($dataid, $deletetoken)
     {
         // Is this a valid paste identifier?
-        if (preg_match('\A[a-f\d]{16}\z', $dataid))
+        if (preg_match('#\A[a-f\d]{16}\z#', $dataid))
         {
             // Check that paste exists.
             if (!$this->_model()->exists($dataid))
@@ -426,6 +426,10 @@ class zerobin
                 $this->_error = 'Paste does not exist or has expired.';
             }
         }
+        else
+        {
+            $this->_error = 'Invalid paste ID.';
+        }
     }
 
     /**