%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.141.19.212 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/main.file.input/templates/mobile/ |
Upload File : |
<?php if(!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die(); use Bitrix\Main\Context; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Text\HtmlFilter; /** * @var array $arParams * @var array $arResult */ CJSCore::Init(['uploader']); $request = Context::getCurrent()->getRequest(); if($arParams['ALLOW_UPLOAD'] === 'N' && empty($arResult['FILES'])) { return ''; } $cnt = count($arResult['FILES']); $id = CUtil::JSEscape($arParams['CONTROL_ID']); if($arParams['MULTIPLE'] === 'Y' && mb_substr($arParams['INPUT_NAME'], -2) !== '[]') { $arParams['INPUT_NAME'] .= '[]'; } $thumbForUploaded = <<<HTML <div class="webform-field-item-wrap"> <span class="webform-field-upload-icon webform-field-upload-icon-#ext#"> <img alt="" src="#preview_url#" onerror="BX.remove(this);"> </span> <a href="#url#" target="_blank" data-bx-role="file-name" class="upload-file-name">#name#</a> <span class="upload-file-size" data-bx-role="file-size">#size#</span> <i></i> <del data-bx-role="file-delete"></del> <input id="file-#file_id#" data-bx-role="file-id" type="hidden" name="#input_name#" value="#file_id#"> </div> HTML; $thumb = <<<HTML <div class="webform-field-item-wrap"> <span class="webform-field-upload-icon webform-field-upload-icon-#ext#" data-bx-role="file-preview"></span> <a href="#" target="_blank" data-bx-role="file-name" class="upload-file-name">#name#</a> <span class="upload-file-size" data-bx-role="file-size">#size#</span> <i></i> <del data-bx-role="file-delete"></del> </div> HTML; $listClass = ($arParams['MULTIPLE'] === 'Y' ? 'multiple' : 'single'); ?> <div class="file-input"> <ol class="webform-field-upload-list webform-field-upload-list-<?= $listClass ?>" id="mfi-<?= $arParams['CONTROL_ID'] ?>" > <?php $i = 0; foreach($arResult['FILES'] as $file) { $isImage = CFile::IsImage($file['ORIGINAL_NAME'], $file['CONTENT_TYPE']); $t = ( $isImage ? CFile::ResizeImageGet( $file, ['width' => 100, 'height' => 100], BX_RESIZE_IMAGE_EXACT, false ) : ['src' => '/bitrix/images/1.gif'] ); ?> <li class="saved"> <?= str_replace( ['#input_name#', '#file_id#', '#name#', '#size#', '#url#', '#url_delete#', '#preview_url#', '#ext#'], [ str_replace('[]', '[' . $i++ . ']', $arParams['INPUT_NAME']), (int)$file['ID'], htmlspecialcharsEx($file['ORIGINAL_NAME']), CFile::FormatSize($file['FILE_SIZE']), $file['URL'], $file['URL_DELETE'], $t['src'], GetFileExtension($file['ORIGINAL_NAME']) ], $thumbForUploaded ) ?> </li> <?php } ?> </ol> <?php if($arParams['ALLOW_UPLOAD'] !== 'N') { ?> <div class="webform-field-upload" id="mfi-<?= $arParams['CONTROL_ID'] ?>-button" > <?php if(!empty($arParams['INPUT_CAPTION'])) { $inputCaption = $arParams['INPUT_CAPTION']; } else { $inputCaption = ( $arParams['ALLOW_UPLOAD'] === 'I' ? Loc::getMessage('MFI_INPUT_CAPTION_ADD_IMAGE') : Loc::getMessage('MFI_INPUT_CAPTION_ADD') ); } ?> <span class="webform-small-button webform-button-upload add-field-button"> <?= $inputCaption ?> </span> <?php if($arParams['MULTIPLE'] === 'N') { ?> <span class="webform-small-button webform-button-replace add-field-button"> <?= ($arParams['ALLOW_UPLOAD'] === 'I' ? Loc::getMessage('MFI_INPUT_CAPTION_REPLACE_IMAGE') : Loc::getMessage('MFI_INPUT_CAPTION_REPLACE') ) ?> </span> <?php } if($arParams['SHOW_AVATAR_EDITOR'] === 'Y' && $arParams['ALLOW_UPLOAD'] === 'I') { ?> <input type="button" id="mfi-<?= $arParams['CONTROL_ID'] ?>-editor" > <?php } else { ?> <input type="file" id="file_input_<?= $arParams['CONTROL_ID'] ?>" <?= ($arParams['MULTIPLE'] === 'Y' ? ' multiple="multiple"' : '') ?> > <?php } ?> </div> <?php if(!empty($arParams['ALLOW_UPLOAD_EXT']) || $arParams['MAX_FILE_SIZE'] > 0) { $message = ( (!empty($arParams['ALLOW_UPLOAD_EXT']) && $arParams['MAX_FILE_SIZE'] > 0) ? Loc::getMessage('MFI_NOTICE_1') : ( !empty($arParams['ALLOW_UPLOAD_EXT']) ? Loc::getMessage('MFI_NOTICE_2') : Loc::getMessage('MFI_NOTICE_3') ) ); ?> <div class='webform-field-upload-notice'> <?= str_replace( ['#ext#', '#size#'], [HtmlFilter::encode($arParams['ALLOW_UPLOAD_EXT']), CFile::FormatSize($arParams['MAX_FILE_SIZE'])], $message ) ?> </div> <?php } } ?> <script type='text/javascript'> BX.message(<?=CUtil::PhpToJSObject([ 'MFI_THUMB' => $thumb, 'MFI_THUMB2' => $thumbForUploaded, 'MFI_UPLOADING_ERROR' => Loc::getMessage('MFI_UPLOADING_ERROR') ])?>); BX.ready(function () { BX.MFInput.init(<?=CUtil::PhpToJSObject([ 'controlId' => $arParams['CONTROL_ID'], 'controlUid' => $arParams['CONTROL_UID'], 'controlSign' => $arParams['CONTROL_SIGN'], 'inputName' => $arParams['INPUT_NAME'], 'maxCount' => ($arParams['MULTIPLE'] === 'N' ? 1 : 0), 'moduleId' => $arParams['MODULE_ID'], 'forceMd5' => $arParams['FORCE_MD5'], 'allowUpload' => $arParams['ALLOW_UPLOAD'], 'allowUploadExt' => $arParams['ALLOW_UPLOAD_EXT'], 'uploadMaxFilesize' => $arParams['MAX_FILE_SIZE'], 'enableCamera' => ($arParams['ENABLE_CAMERA'] !== 'N'), 'urlUpload' => $arParams['URL_TO_UPLOAD'] ])?>); }); </script> </div>