Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 54bb6292

Přidáno uživatelem David Raška před asi 9 roky(ů)

refs #935: Set minimum limit for post_max_size and upload_max_filesize to 1M.

Zobrazit rozdíly:

application/controllers/settings.php
$upload_max_filesize_changed = FALSE;
$post_max_size_changed = FALSE;
$max_filesize = $form_data['upload_max_filesize'];
if (network::str2bytes($max_filesize) < 1024*1024) // If less than 1M, set to 1M
{
$max_filesize = network::speed(1024*1024);
}
// do not save to DB, it's useless
unset($form_data['upload_max_filesize']);
foreach ($htaccessFile as $line_num => $line)
{
// find line with RewriteBase
......
{
$htaccessFile[$line_num] = preg_replace(
"/^(php_value upload_max_filesize )(.+)/",
'${1}'.$form_data['upload_max_filesize'], $line
'${1}'.$max_filesize, $line
);
$upload_max_filesize_changed = TRUE;
}
......
{
$htaccessFile[$line_num] = preg_replace(
"/^(php_value post_max_size )(.+)/",
'${1}'.$form_data['upload_max_filesize'], $line
'${1}'.$max_filesize, $line
);
$post_max_size_changed = TRUE;
}
......
if (!$upload_max_filesize_changed)
{
$htaccessFile[] = "\nphp_value upload_max_filesize ".$form_data['upload_max_filesize']."\n";
$htaccessFile[] = "\nphp_value upload_max_filesize ".$max_filesize."\n";
}
if (!$post_max_size_changed)
{
$htaccessFile[] = "\nphp_value post_max_size ".$form_data['upload_max_filesize']."\n";
$htaccessFile[] = "\nphp_value post_max_size ".$max_filesize."\n";
}
$handle = @fopen('.htaccess', 'w');

Také k dispozici: Unified diff