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
This commit is contained in:
Sébastien SAUVAGE 2013-09-03 08:17:49 +02:00 committed by El RIDO
parent bc8b23d35e
commit 5b54ca34ad

View file

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