Fixed o_avatars_dir field validation

This commit is contained in:
Visman 2020-12-20 13:37:27 +07:00
parent 14b578d25a
commit caa0f160da
3 changed files with 22 additions and 4 deletions

View file

@ -145,7 +145,13 @@ class Options extends Admin
*/
public function vCheckDir(Validator $v, $dir)
{
$dir = '/' . \trim(\str_replace(['\\', '.', '//', ':'], ['/', '', '', ''], $dir), '/'); //?????
$dir = '/' . \trim(\str_replace(['\\', '.', '//', ':'], ['/', '', '', ''], $dir), '/');
if (! \is_dir($dir)) {
$v->addError('The folder for uploading avatars is incorrectly');
} elseif (! \is_writable($dir)) {
$v->addError('For PHP, it is forbidden to write in the folder for uploading avatars');
}
return $dir;
}
@ -515,7 +521,7 @@ class Options extends Admin
'maxlength' => '255',
'value' => $config->o_avatars_dir,
'caption' => __('Upload directory label'),
'info' => __('Upload directory help'),
'info' => __('Upload directory help', $this->c->PUBLIC_URL),
'required' => true,
],
'i_avatars_width' => [

View file

@ -253,7 +253,7 @@ msgid "Upload directory label"
msgstr "Upload directory"
msgid "Upload directory help"
msgstr "The upload directory for avatars (relative to the ForkBB root directory). PHP must have write permissions to this directory."
msgstr "The upload directory for avatars (relative to %s). PHP must have write permissions to this directory."
msgid "Max width label"
msgstr "Max width"
@ -446,3 +446,9 @@ msgstr "Result for guest"
msgid "Result for guest help"
msgstr "The guests see the voting results."
msgid "The folder for uploading avatars is incorrectly"
msgstr "The folder for uploading avatars is incorrectly."
msgid "For PHP, it is forbidden to write in the folder for uploading avatars"
msgstr "For PHP, it is forbidden to write in the folder for uploading avatars."

View file

@ -253,7 +253,7 @@ msgid "Upload directory label"
msgstr "Папка для загрузки"
msgid "Upload directory help"
msgstr "Папка загрузки аватар (относительно корня форума). Необходимо дать PHP права на запись в эту папку."
msgstr "Папка загрузки аватар (относительно %s). Необходимо дать PHP права на запись в эту папку."
msgid "Max width label"
msgstr "Макс. ширина"
@ -446,3 +446,9 @@ msgstr "Результат для гостя"
msgid "Result for guest help"
msgstr "Гости видят результаты голосования."
msgid "The folder for uploading avatars is incorrectly"
msgstr "Неправильно указана папка для аватарок."
msgid "For PHP, it is forbidden to write in the folder for uploading avatars"
msgstr "Для PHP установлен запрет на запись в папку аватарок."