implement version 2 format validation, changing ID checksum algorithm, resolves #49

This commit is contained in:
El RIDO 2019-05-03 23:03:57 +02:00
parent ed676acac3
commit 3338bd792e
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
12 changed files with 233 additions and 185 deletions

View file

@ -15,7 +15,7 @@ namespace PrivateBin\Model;
use Exception;
use PrivateBin\Controller;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Sjcl;
use PrivateBin\FormatV2;
/**
* Paste
@ -195,7 +195,7 @@ class Paste extends AbstractModel
*/
public function setAttachment($attachment)
{
if (!$this->_conf->getKey('fileupload') || !Sjcl::isValid($attachment)) {
if (!$this->_conf->getKey('fileupload') || !FormatV2::isValid($attachment)) {
throw new Exception('Invalid attachment.', 71);
}
$this->_data->meta->attachment = $attachment;
@ -210,7 +210,7 @@ class Paste extends AbstractModel
*/
public function setAttachmentName($attachmentname)
{
if (!$this->_conf->getKey('fileupload') || !Sjcl::isValid($attachmentname)) {
if (!$this->_conf->getKey('fileupload') || !FormatV2::isValid($attachmentname)) {
throw new Exception('Invalid attachment.', 72);
}
$this->_data->meta->attachmentname = $attachmentname;