1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-06 14:16:46 +02:00

Version 1.3.7: Image Field for Themes and Plugins

This commit is contained in:
trendschau
2020-06-05 08:27:31 +02:00
parent b5b4a11baf
commit b41ca0a3a1
14 changed files with 252 additions and 73 deletions

View File

@@ -86,7 +86,7 @@ class Fields
}
else
{
$field->unsetAttribute('chhecked');
$field->unsetAttribute('checked');
}
}
else

View File

@@ -506,7 +506,9 @@ class Folder
{
# if it is the first round, create an empty array
if(!$i){ $i = 0; $breadcrumb = array();}
if(!$searchArray){ return $breadcrumb;}
while($i < count($searchArray))
{
if(!isset($content[$searchArray[$i]])){ return false; }

View File

@@ -27,6 +27,15 @@ class Validation
return false;
}, 'invalid values');
Validator::addRule('image_types', function($field, $value, array $params, array $fields) use ($user)
{
$allowed = ['jpg', 'jpeg', 'png'];
$pathinfo = pathinfo($value);
$extension = strtolower($pathinfo['extension']);
if(array_search($extension, $allowed)){ return true; }
return false;
}, 'only jpg, jpeg, png allowed');
Validator::addRule('userAvailable', function($field, $value, array $params, array $fields) use ($user)
{
$userdata = $user->getUser($value);
@@ -434,6 +443,7 @@ class Validation
case "image":
$v->rule('noHTML', $fieldName);
$v->rule('lengthMax', $fieldName, 1000);
$v->rule('image_types', $fieldName);
break;
default:
$v->rule('lengthMax', $fieldName, 1000);