From 5b54ca34adfe49efa055bbc8d67893505966acb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20SAUVAGE?= Date: Tue, 3 Sep 2013 08:17:49 +0200 Subject: [PATCH] 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 --- lib/zerobin.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/zerobin.php b/lib/zerobin.php index 80f7d0a..0fb350b 100644 --- a/lib/zerobin.php +++ b/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.'; + } } /**