UnknownSec Bypass
403
:
/
mnt
/
lmsestudio-instance-vol002
/
lms_4cd92d08affc
/
app
/
Validator
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
CustomValidator.php
<?php namespace EstudioLMS\Validator; use Illuminate\Support\Arr; use Illuminate\Support\Str; use Illuminate\Validation\Validator; use Symfony\Component\Translation\TranslatorInterface; class CustomValidator extends Validator { /** * Create a new Validator instance. * * @param \Symfony\Component\Translation\TranslatorInterface $translator * @param array $data * @param array $rules * @param array $messages * @param array $customAttributes */ public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = []) { $this->translator = $translator; $this->customMessages = $messages; $this->data = $this->parseData($data); $this->customAttributes = $customAttributes; // Explode the rules first so that the implicit ->each calls are made... $rules = $this->explodeRules($rules); $this->rules = array_merge((array) $this->rules, $rules); } /** * Explode the rules into an array of rules. * * @param string|array $rules * @return array */ protected function explodeRules($rules) { foreach ($rules as $key => $rule) { if (Str::contains($key, '*')) { $this->each($key, $rule); unset($rules[$key]); } else { $rules[$key] = (is_string($rule)) ? explode('|', $rule) : $rule; } } return $rules; } /** * Define a set of rules that apply to each element in an array attribute. * * @param string $attribute * @param string|array $rules * @return void * * @throws \InvalidArgumentException */ public function each($attribute, $rules) { $data = Arr::dot($this->data); foreach ($data as $key => $value) { if (Str::startsWith($key, $attribute) || Str::is($attribute, $key)) { foreach ((array) $rules as $ruleKey => $ruleValue) { if (! is_string($ruleKey) || Str::endsWith($key, $ruleKey)) { $this->mergeRules($key, $ruleValue); } } } } } /** * Get the inline message for a rule if it exists. * * @param string $attribute * @param string $lowerRule * @param array $source * @return string|null */ protected function getInlineMessage($attribute, $lowerRule, $source = null) { $source = $source ?: $this->customMessages; $keys = ["{$attribute}.{$lowerRule}", $lowerRule]; // First we will check for a custom message for an attribute specific rule // message for the fields, then we will check for a general custom line // that is not attribute specific. If we find either we'll return it. foreach ($keys as $key) { foreach (array_keys($source) as $sourceKey) { if (Str::is($sourceKey, $key)) { return $source[$sourceKey]; } } } } /** * Get the custom error message from translator. * * @param string $customKey * @return string */ protected function getCustomMessageFromTranslator($customKey) { $shortKey = str_replace('validation.custom.', '', $customKey); $customMessages = Arr::dot( (array) $this->translator->trans('validation.custom') ); foreach ($customMessages as $key => $message) { if ($key === $shortKey || (Str::contains($key, ['*']) && Str::is($key, $shortKey))) { return $message; } } return $customKey; } }
Copyright © 2026 - UnknownSec