<?php
  
ECHO "<div class='navi'>";
ECHO "<a href='?'>".ICONS('home', 25)."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "<a href='?path=system'>".LG('Настройки системы')."</a> ";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "".LG('Файловая среда')."";
ECHO "</div>";

IF (POST('ok')){
  
  $maxsize = INTVAL(POST('maxsize'));
  $file_access = INTVAL(POST('file_access'));
  $video_screen = INTVAL(POST('video_screen'));
  
  INI::UPGRADE(ROOT.'/system/config/global/settings.ini', 'MAXFILESIZE', $maxsize);
  INI::UPGRADE(ROOT.'/system/config/global/settings.ini', 'FILE_ACCESS', $file_access);
  INI::UPGRADE(ROOT.'/system/config/global/settings.ini', 'VIDEO_SCREEN', $video_screen);
  
  SUCCESS('Изменения успешно приняты', 'session');
  REDIRECT('?path=system&section=files');

}

ECHO "<div class='fon'>";

ECHO "<form method='post'>";

ECHO "<b>".LG('Выгрузка файлов на сайте').":</b><br />";
ECHO "<select name='file_access' class='form-control-select'>";

ECHO "<option value='1' ".(CONFIG('FILE_ACCESS') == 1?" selected='selected'" : NULL)."> ".LG('Разрешена')."</option>";
ECHO "<option value='0' ".(CONFIG('FILE_ACCESS') == 0?" selected='selected'" : NULL)."> ".LG('Запрещена')."</option>";

ECHO "</select><br /><br />";

ECHO "<b>".LG('Максимальный размер выгружаемых файлов на сайте').":</b><br />";
ECHO "<select name='maxsize' class='form-control-select'>";

ECHO "<option value='5242880' ".(CONFIG('MAXFILESIZE') == 5242880?" selected='selected'" : NULL)."> 5 MB</option>";
ECHO "<option value='10485760' ".(CONFIG('MAXFILESIZE') == 10485760?" selected='selected'" : NULL)."> 10 MB</option>";
ECHO "<option value='15728640' ".(CONFIG('MAXFILESIZE') == 15728640?" selected='selected'" : NULL)."> 15 MB</option>";
ECHO "<option value='20971520' ".(CONFIG('MAXFILESIZE') == 20971520?" selected='selected'" : NULL)."> 20 MB</option>";
ECHO "<option value='26214400' ".(CONFIG('MAXFILESIZE') == 26214400?" selected='selected'" : NULL)."> 25 MB</option>";
ECHO "<option value='31457280' ".(CONFIG('MAXFILESIZE') == 31457280?" selected='selected'" : NULL)."> 30 MB</option>";
ECHO "<option value='36700160' ".(CONFIG('MAXFILESIZE') == 36700160?" selected='selected'" : NULL)."> 35 MB</option>";
ECHO "<option value='41943040' ".(CONFIG('MAXFILESIZE') == 41943040?" selected='selected'" : NULL)."> 40 MB</option>";
ECHO "<option value='47185920' ".(CONFIG('MAXFILESIZE') == 47185920?" selected='selected'" : NULL)."> 45 MB</option>";
ECHO "<option value='52428800' ".(CONFIG('MAXFILESIZE') == 52428800?" selected='selected'" : NULL)."> 50 MB</option>";
ECHO "<option value='57671680' ".(CONFIG('MAXFILESIZE') == 57671680?" selected='selected'" : NULL)."> 55 MB</option>";
ECHO "<option value='62914560' ".(CONFIG('MAXFILESIZE') == 62914560?" selected='selected'" : NULL)."> 60 MB</option>";
ECHO "<option value='68157440' ".(CONFIG('MAXFILESIZE') == 68157440?" selected='selected'" : NULL)."> 65 MB</option>";
ECHO "<option value='73400320' ".(CONFIG('MAXFILESIZE') == 73400320?" selected='selected'" : NULL)."> 70 MB</option>";
ECHO "<option value='78643200' ".(CONFIG('MAXFILESIZE') == 78643200?" selected='selected'" : NULL)."> 75 MB</option>";
ECHO "<option value='83886080' ".(CONFIG('MAXFILESIZE') == 83886080?" selected='selected'" : NULL)."> 80 MB</option>";
ECHO "<option value='89128960' ".(CONFIG('MAXFILESIZE') == 89128960?" selected='selected'" : NULL)."> 85 MB</option>";
ECHO "<option value='94371840' ".(CONFIG('MAXFILESIZE') == 94371840?" selected='selected'" : NULL)."> 90 MB</option>";
ECHO "<option value='99614720' ".(CONFIG('MAXFILESIZE') == 99614720?" selected='selected'" : NULL)."> 95 MB</option>";
ECHO "<option value='104857600' ".(CONFIG('MAXFILESIZE') == 104857600?" selected='selected'" : NULL)."> 100 MB</option>";
ECHO "<option value='125829120' ".(CONFIG('MAXFILESIZE') == 125829120?" selected='selected'" : NULL)."> 120 MB</option>";
ECHO "<option value='146800640' ".(CONFIG('MAXFILESIZE') == 146800640?" selected='selected'" : NULL)."> 140 MB</option>";
ECHO "<option value='167772160' ".(CONFIG('MAXFILESIZE') == 167772160?" selected='selected'" : NULL)."> 160 MB</option>";
ECHO "<option value='188743680' ".(CONFIG('MAXFILESIZE') == 188743680?" selected='selected'" : NULL)."> 180 MB</option>";
ECHO "<option value='209715200' ".(CONFIG('MAXFILESIZE') == 209715200?" selected='selected'" : NULL)."> 200 MB</option>";
ECHO "<option value='262144000' ".(CONFIG('MAXFILESIZE') == 262144000?" selected='selected'" : NULL)."> 250 MB</option>";
ECHO "<option value='314572800' ".(CONFIG('MAXFILESIZE') == 314572800?" selected='selected'" : NULL)."> 300 MB</option>";
ECHO "<option value='367001600' ".(CONFIG('MAXFILESIZE') == 367001600?" selected='selected'" : NULL)."> 350 MB</option>";
ECHO "<option value='419430400' ".(CONFIG('MAXFILESIZE') == 419430400?" selected='selected'" : NULL)."> 400 MB</option>";
ECHO "<option value='471859200' ".(CONFIG('MAXFILESIZE') == 471859200?" selected='selected'" : NULL)."> 450 MB</option>";
ECHO "<option value='524288000' ".(CONFIG('MAXFILESIZE') == 524288000?" selected='selected'" : NULL)."> 500 MB</option>";

ECHO "</select><br />";

ECHO "* ".LG('рекомендуется уточнить максимальный размер для выгрузки файлов на сервере')."<br /><br />";

ECHO "<label class='custom-checkbox'><input type='checkbox' name='video_screen' value='1'".(CONFIG('VIDEO_SCREEN') == 1?" checked='checked'" : NULL)."><span>".LG('Показ скриншотов к видео')."</span></label><br /><br />";  

HTML::BUTTON('panel-button2', 'ok', 'save', 'Сохранить изменения');

ECHO "</form>";

ECHO "</div>";