Server IP : 85.193.89.191 / Your IP : 3.149.242.80 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bitrix/www/local/php_interface/include/ |
Upload File : |
<? require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_before.php');?> <?IncludeModuleLangFile(__FILE__);?> <? require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php');?> <?$APPLICATION->SetTitle('Параметры сайтов');?> <? $module_id = 'main'; $aTabs = array(); //Sites data $arSites = array(); $rsSites = CSite::GetList($by = 'sort', $order = 'desc', array()); while ($arSite = $rsSites->Fetch()){ $arSites[] = $arSite; } $arAllOptions['s1'][] = [ 'TITLE' => 'Настройка цен', 'OPTIONS' => array( array('basket_id_price_opt', 'ID оптовой цены', '', array('text', 50)), array('basket_id_price_base', 'ID базовой цен', '', array('text', 50)), array('basket_recalc_summ', 'Сумма с которой пересчитывать на оптовую цену', '', array('text', 50)), ) ]; //Tabs by sites foreach($arSites as $arSite){ $aTabs[] = array( 'DIV' => 'edit_'.$arSite['ID'], 'TAB' => 'Дополнительные настройки', 'ICON' => '', 'TITLE' => ' ['.$arSite['SITE_NAME'].']' . ' - Дополнительные настройки'); } //Process form if($_SERVER['REQUEST_METHOD'] == 'POST' && check_bitrix_sessid()){ foreach($arSites as $arSite){ foreach($arAllOptions[$arSite['ID']] as $arGroup) { foreach($arGroup['OPTIONS'] as $arOption){ $fieldName = $arOption[0].'_'.$arSite['ID']; $name = $arOption[0]; $defaultValue = $arOption[2]; $type = $arOption[3][0]; $value = $defaultValue; if($type == 'file'){ $oldFileID = COption::GetOptionString($module_id, $name, $defaultValue, $arSite['ID']); $arFile = array(); if($_REQUEST[$fieldName.'_del'] == 'Y'){ CFile::Delete($oldFileID); $value = ''; }else{ if(!empty($_FILES[$fieldName]['name'])){ $arFile = $_FILES[$fieldName]; }elseif(!empty($_REQUEST[$fieldName])){ $filePath = $_REQUEST[$fieldName]; $arFile = CFile::MakeFileArray($filePath); } $fileDescription = $_REQUEST[$fieldName.'_descr']; $arAddFile = array( 'old_file' => $oldFileID, 'del' => ($arFile['name'] != '' ? 'Y' : ''), 'MODULE_ID' => $module_id, 'description' => $fileDescription, ); $newFileID = CFile::SaveFile(array_merge($arFile, $arAddFile), '/price-list/'); $value = ($newFileID > 0 ? $newFileID : $oldFileID); } }else{ $value = $_REQUEST[$fieldName]; if($type == 'combobox'){ $value = serialize($value); } } COption::SetOptionString($module_id, $name, $value, $arOption[1], $arSite['ID']); } } } } ?> <form method='POST' action='<?=$APPLICATION->GetCurPage()?>' name='ycaweb_site_settings' enctype='multipart/form-data'> <?=bitrix_sessid_post()?> <? $tabControl = new CAdminTabControl('tabControl', $aTabs); $tabControl->Begin(); ?> <?foreach($arSites as $arSite):?> <?$tabControl->BeginNextTab();?> <?foreach($arAllOptions[$arSite['ID']] as $arGroup):?> <?if($arGroup['TITLE']):?> <tr class="heading"><td colspan="2"><b><?=$arGroup['TITLE']?></b></td></tr> <?endif;?> <?foreach($arGroup['OPTIONS'] as $arOption): $fieldName = $arOption[0].'_'.$arSite['ID']; $type = $arOption[3]; $val = COption::GetOptionString($module_id, $arOption[0], $arOption[2], $arSite['ID']); ?> <tr> <td width="40%" nowrap <?if($type[0]=='textarea') echo 'class="adm-detail-valign-top"'?>> <label for="<?echo htmlspecialcharsbx($fieldName)?>"><?echo $arOption[1]?>:</label> <td width='60%'> <?if($type[0] == 'checkbox'):?> <input type="checkbox" id="<?echo htmlspecialcharsbx($fieldName)?>" name="<?echo htmlspecialcharsbx($fieldName)?>" value="Y"<?if($val=='Y')echo' checked';?>> <?elseif($type[0] == 'text'):?> <input id="<?echo htmlspecialcharsbx($fieldName)?>" type="text" size="<?echo $type[1]?>" maxlength="255" value="<?echo htmlspecialcharsbx($val)?>" name="<?echo htmlspecialcharsbx($fieldName)?>"> <?elseif($type[0] == 'textarea'):?> <textarea id="<?echo htmlspecialcharsbx($fieldName)?>" rows="<?echo $type[1]?>" cols="<?echo $type[2]?>" name="<?echo htmlspecialcharsbx($fieldName)?>"><?echo htmlspecialcharsbx($val)?></textarea> <?elseif($type[0] == 'select'):?> <select name="<?echo htmlspecialcharsbx($fieldName)?>"> <?foreach($type[1] as $value=>$name):?> <option value="<?=$value?>"<?if($value == $val):?> selected<?endif;?>><?=$name?></option> <?endforeach;?> </select> <?elseif($type[0] == 'combobox'): $val = unserialize($val); ?> <select name="<?echo htmlspecialcharsbx($fieldName)?>[]" multiple> <?foreach($type[1] as $value=>$name):?> <option value="<?=$value?>"<?if(in_array($value, $val)):?> selected<?endif;?>><?=$name?></option> <?endforeach;?> </select> <?elseif($type[0] == 'file'):?> <?echo CFileInput::Show($fieldName, (int)$val, array( 'PATH' => 'Y', 'FILE_SIZE' => 'Y', 'DIMENSIONS' => 'Y', ), array( 'upload' => true, 'medialib' => true, 'file_dialog' => true, 'description' => true, ) ); ?> <?endif?> </td> </tr> <?endforeach;?> <?endforeach;?> <?$tabControl->EndTab();?> <?endforeach;?> <?$tabControl->Buttons();?> <input type='submit' name='Save' value='<?=GetMessage('MAIN_SAVE')?>' title='<?=GetMessage('MAIN_OPT_SAVE_TITLE')?>' class='adm-btn-save'> <?$tabControl->End();?> </form> <? require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_admin.php');?>