diff --git a/src/app/controller/submit.php b/src/app/controller/submit.php index 844e49c..834d407 100644 --- a/src/app/controller/submit.php +++ b/src/app/controller/submit.php @@ -106,12 +106,23 @@ class AppControllerSubmit ), ] ], + 'image' => (object) + [ + 'error' => [], + 'attribute' => (object) + [ + 'required' => $this->_validator->getPageImageRequired(), + 'accept' => implode(',', $this->_validator->getPageImageMimeTypes()), + 'placeholder' => sprintf( + _('Image file (use Ctrl to select multiple files)') + ), + ], + ], 'torrent' => (object) [ 'error' => [], 'attribute' => (object) [ - 'value' => null, 'required' => $this->_validator->getPageTorrentRequired(), 'accept' => implode(',', $this->_validator->getPageTorrentMimeTypes()), 'placeholder' => sprintf( diff --git a/src/app/model/validator.php b/src/app/model/validator.php index 5f98697..fdf63b9 100644 --- a/src/app/model/validator.php +++ b/src/app/model/validator.php @@ -298,6 +298,17 @@ class AppModelValidator return true; } + /// Page image + public function getPageImageRequired() : bool + { + return $this->_config->page->image->required; + } + + public function getPageImageMimeTypes() : array + { + return $this->_config->page->image->mime; + } + /// Page torrent public function getPageTorrentRequired() : bool { diff --git a/src/app/view/theme/default/submit.phtml b/src/app/view/theme/default/submit.phtml index ed70c89..cec2769 100644 --- a/src/app/view/theme/default/submit.phtml +++ b/src/app/view/theme/default/submit.phtml @@ -89,9 +89,34 @@ minlength="keywords->attribute->minlength ?>" maxlength="keywords->attribute->maxlength ?>">keywords->attribute->value ?> +
+ + + + + + + image->error as $errors) { ?> + +
+ +
+ + + image->attribute->required ? 'required="required"' : false ?> /> +
diff --git a/src/config/validator.json b/src/config/validator.json index 4cbe476..aaab291 100644 --- a/src/config/validator.json +++ b/src/config/validator.json @@ -39,6 +39,21 @@ "max": 20 } }, + "image": + { + "required": false, + "mime": [ + "image/png", + "image/gif", + "image/jpeg", + "image/webp" + ], + "quantity": + { + "min": 0, + "max": 20 + } + }, "torrent": { "required": true,