<?php
/* Smarty version 4.5.2, created on 2024-05-17 05:49:58
  from '/home/life/public_html/yzb.lifestyle.uz/admin/templates/views/file-manager/index.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.2',
  'unifunc' => 'content_6646f006c08248_42037244',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'f4d8b6b04063f227f52fc76d52bfe3a115b9e64c' => 
    array (
      0 => '/home/life/public_html/yzb.lifestyle.uz/admin/templates/views/file-manager/index.tpl',
      1 => 1679753941,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:components/page-header.tpl' => 2,
  ),
),false)) {
function content_6646f006c08248_42037244 (Smarty_Internal_Template $_smarty_tpl) {
if ((isset($_smarty_tpl->tpl_vars['action']->value)) && $_smarty_tpl->tpl_vars['action']->value == 'edit') {?>

	<?php echo '<script'; ?>
 type="text/javascript" src="/admin/assets/js/vendor/editors/codemirror/codemirror.js"><?php echo '</script'; ?>
>
	<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/vendor/editors/codemirror/mode/htmlmixed/htmlmixed.js"><?php echo '</script'; ?>
>
	<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/vendor/editors/codemirror/mode/xml/xml.js"><?php echo '</script'; ?>
>
	<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/vendor/editors/codemirror/mode/javascript/javascript.js"><?php echo '</script'; ?>
>
	<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/vendor/editors/codemirror/mode/css/css.js"><?php echo '</script'; ?>
>
	<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/vendor/editors/codemirror/mode/clike/clike.js"><?php echo '</script'; ?>
>
	<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/vendor/editors/codemirror/mode/php/php.js"><?php echo '</script'; ?>
>

	<form class="content-inner" action="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager" method="post" id="template">
		<input type="hidden" name="path" value="<?php if ((isset($_smarty_tpl->tpl_vars['path']->value))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['path']->value, ENT_QUOTES, 'UTF-8', true);
}?>" />
		<input type="hidden" name="file[name]" value="<?php if ((isset($_smarty_tpl->tpl_vars['file']->value['name']))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['file']->value['name'], ENT_QUOTES, 'UTF-8', true);
}?>" />

		<!-- Page header -->
        <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "buttons", null, null);?>
	        <button class="btn btn-sm btn-primary me-2" type="submit" name="action" value="save" id="submitButton"><i class="ph-floppy-disk me-2"></i>Сохранить</button>
	        <a class="btn btn-sm btn-light" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager<?php if ((isset($_smarty_tpl->tpl_vars['path']->value))) {?>?path=<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['path']->value, ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);
}?>">Отменить</a>
        <?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

        <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "breadcrumb", null, null);?>
			<a href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager" class="breadcrumb-item"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8', true);?>
</a>
        <?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

        <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "showBy", null, null);
$_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

        <?php $_smarty_tpl->_subTemplateRender("file:components/page-header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('buttons'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'buttons'),'breadcrumb'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'breadcrumb'),'showBy'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'showBy')), 0, false);
?>
		<!-- /page header -->

		<div class="content">
			<div class="row">
				<div class="col-md-12">
					<div class="card border shadow-sm">
						<div class="card-header d-flex flex-wrap">
							<h6 class="mb-0">Редактирование файла <b><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['file']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
</h6>
						</div>
						<div class="collapse show">
							<textarea id="codeEditor" name="file[content]"><?php if ((isset($_smarty_tpl->tpl_vars['file']->value['content']))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['file']->value['content'], ENT_QUOTES, 'UTF-8', true);
}?></textarea>
						</div>
					</div>

					<div class="d-flex justify-content-center p-2">
						<?php echo $_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'buttons');?>

					</div>

				</div>
			</div>
		</div>

	</form>

	<?php echo '<script'; ?>
>
        window.onload = function() {
            var editor = CodeMirror.fromTextArea(document.getElementById("codeEditor"), {
                indentUnit: 4,
                lineNumbers: true,
                lineWrapping: true,
                matchBrackets: true,
                mode: "application/x-httpd-php",
                indentWithTabs: true,
                enterMode: "keep",
                tabMode: "shift",
                styleActiveLine: true,
                styleActiveSelected: true,
            });
            editor.setSize('100%','420px');
        };
	<?php echo '</script'; ?>
>


<?php } else { ?>

	<!-- Page header -->
    <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "buttons", null, null);?>
	    <button class="btn btn-sm btn-primary" data-bs-toggle="collapse" data-bs-target="#add_folder">Добавить директорию</button>&nbsp;&nbsp;
	    <button class="btn btn-sm btn-primary" data-bs-toggle="collapse" data-bs-target="#file_upload">Загрузить файл</button>
    <?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

    <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "breadcrumb", null, null);?>
		<a href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager" class="breadcrumb-item"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8', true);?>
</a>
    <?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

    <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "showBy", null, null);
$_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

    <?php $_smarty_tpl->_subTemplateRender("file:components/page-header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('buttons'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'buttons'),'breadcrumb'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'breadcrumb'),'showBy'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'showBy')), 0, true);
?>
	<!-- /page header -->

	<div class="content">
		<div class="row">
			<div class="col-md-12">
                				<div class="collapse" id="file_upload">
					<div class="card border shadow-sm">
						<div class="card-header d-flex flex-wrap">
							<h6 class="mb-0">Загрузить файл</h6>
						</div>
						<div class="collapse show">
							<div class="card-body">
								<div id="upload_files" class="dropzone">
									<div class="dz-default dz-message"></div>
									<input type="hidden" name="send_path" value="<?php if ((isset($_smarty_tpl->tpl_vars['path']->value))) {
echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['path']->value, ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);
} else { ?>/<?php }?>" id="send_path">
								</div>
							</div>
						</div>
					</div>
				</div>
                
								<div class="collapse" id="add_folder">
					<div class="card border shadow-sm bg-light p-2 d-sm-flex align-items-sm-center">
						<div class="mb-0"></div>
						<div class="ms-sm-auto">
							<ul class="list-inline list-inline-condensed mb-0">
								<li class="list-inline-item text-muted">Добавить директорию</li>
								<li class="list-inline-item">
									<form method="post">
										<div class="input-group">
											<input class="form-control" type="text" name="folder[name]" placeholder="Имя директории" data-width="300">
											<button class="btn btn-sm btn-primary" type="submit" name="action" value="add_folder"><i class="icon-folder-plus2 me-2"></i> Добавить</button>
										</div>
									</form>
								</li>
							</ul>
						</div>
					</div>
				</div>
                
				<div class="card border shadow-sm">
					<div class="table-responsive">
						<table class="table table-xs table-striped table-hover">
							<thead>
							<tr>
								<th class="text-left pl-4">Файл</th>
								<th class="text-center" width="80">Размер</th>
								<th class="text-center" width="120">Изменено</th>
								<th class="text-center" width="100">Действие</th>
							</tr>
							</thead>
							<tbody>
		                    <?php if ($_smarty_tpl->tpl_vars['upPath']->value != $_smarty_tpl->tpl_vars['path']->value) {?>
								<tr>
									<td colspan="4">
										<a href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager<?php if ((isset($_smarty_tpl->tpl_vars['upPath']->value))) {?>?path=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['upPath']->value, ENT_QUOTES, 'UTF-8', true);
}?>">
											<i class="icon-undo2 text-primary"></i> Назад
										</a>
									</td>
								</tr>
		                    <?php }?>

		                    <?php if ((isset($_smarty_tpl->tpl_vars['list']->value))) {?>
		                        <?php if ((isset($_smarty_tpl->tpl_vars['list']->value['dirs']))) {?>
		                            <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['list']->value['dirs'], 'dir');
$_smarty_tpl->tpl_vars['dir']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['dir']->value) {
$_smarty_tpl->tpl_vars['dir']->do_else = false;
?>
										<tr>
											<td class="text-start">
												<a href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager?path=<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['path']->value, ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['dir']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
">
													<i class="ph-folder-notch text-primary me-2"></i><span class="text-body"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['dir']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
</span>
												</a>
											</td>
											<td class="text-start text-nowrap"></td>
											<td class="text-center text-nowrap"><?php echo htmlspecialchars((string)call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'format_time' ][ 0 ], array( $_smarty_tpl->tpl_vars['dir']->value['mtime'],"d.m.Y H:i" )), ENT_QUOTES, 'UTF-8', true);?>
</td>
											<td class="text-end">
												<button type="button" class="btn btn-sm btn-link text-danger" onclick="deleteFile('<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['path']->value, ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);?>
', '<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['dir']->value['name'], ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);?>
', 'filemanager')" >
													<i class="ph-trash"></i>
												</button>
											</td>
										</tr>
		                            <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
		                        <?php }?>

		                        <?php if ((isset($_smarty_tpl->tpl_vars['list']->value['files']))) {?>
		                            <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['list']->value['files'], 'file');
$_smarty_tpl->tpl_vars['file']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['file']->value) {
$_smarty_tpl->tpl_vars['file']->do_else = false;
?>
										<tr>
											<td><i class="ph-file-code me-2 text-primary"></i> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['file']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
</td>
											<td class="text-start text-nowrap"><?php echo htmlspecialchars((string)call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'fsize_format' ][ 0 ], array( $_smarty_tpl->tpl_vars['file']->value['size'] )), ENT_QUOTES, 'UTF-8', true);?>
</td>
											<td class="text-center text-nowrap"><?php echo htmlspecialchars((string)call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'format_time' ][ 0 ], array( $_smarty_tpl->tpl_vars['file']->value['mtime'],"d.m.Y H:i" )), ENT_QUOTES, 'UTF-8', true);?>
</td>
											<td class="text-end">
												<div class="d-inline-flex">
													<a class="btn btn-sm btn-default text-primary" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager?action=edit&path=<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['path']->value, ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);?>
&file[name]=<?php echo htmlspecialchars((string)rawurlencode((string)$_smarty_tpl->tpl_vars['file']->value['name']), ENT_QUOTES, 'UTF-8', true);?>
"><i class="ph-note-pencil"></i></a>
													<button type="button" class="btn btn-sm btn-link text-danger" onclick="deleteFile('<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['path']->value, ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);?>
', '<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['file']->value['name'], ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);?>
', 'filemanager')" ><i class="ph-trash"></i></button>
												</div>
											</td>
										</tr>
		                            <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
		                        <?php }?>
		                    <?php }?>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>

<?php }?>

<?php echo '<script'; ?>
>
    $(document).ready(function () {
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['upload']))) {?> new Noty({ text: 'Невозможно сохранить загруженный файл. Возможно, стоит ограничение на создание файлов.', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['folder']))) {?> new Noty({ text: 'Невозможно создать директорию. Возможно, уже существует или стоит ограничение на создание директорий.', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['deleteFile']))) {?> new Noty({ text: 'Невозможно удалить файл.', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['deleteFolder']))) {?> new Noty({ text: 'Невозможно удалить директорию. (Директория должна быть пустой и скрипт должен иметь соответствующие права)', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['save']))) {?> new Noty({ text: 'Невозможно сохранить файл. Возможно, скрипт не наделен соответствующими правами.', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['fileNameCharacters']))) {?> new Noty({ text: 'Имя файла/директории может состоять только из следующих: A-Z a-z 0-9 . , - _ ( ).', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['fileNameNoDot']))) {?> new Noty({ text: 'Имя файла/директории не может начинаться с точки.', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['fileNameProhibited']))) {?> new Noty({ text: 'Введенное имя файла/директории запрещено.', type: 'error' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['accessDenied']))) {?> new Noty({ text: 'Доступ к указанному пути запрещен.', type: 'error' }).show();<?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['fileNotFound']))) {?> new Noty({ text: 'Файл не найден.', type: 'error' }).show(); <?php }?>

        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['folder']))) {?> new Noty({ text: 'Директория создана.', type: 'success' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['uploaded']))) {?> new Noty({ text: 'Файл загружен.', type: 'success' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['deletedFile']))) {?> new Noty({ text: 'Файл удален.', type: 'success' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['deletedFolder']))) {?> new Noty({ text: 'Директория удалена.', type: 'success' }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['saved']))) {?> new Noty({ text: 'Файл сохранен.', type: 'success' }).show(); <?php }?>
    });
    function uploadMessage(){ new Noty({ text: 'Файл(ы) загружен(ы)', layout: 'topRight', type: 'success' }).show(); }

    Dropzone.autoDiscover = false;
    $(document).ready(function () {
        $("#upload_files").dropzone({
            dictDefaultMessage:             lang['dictDefaultMessage'],
            dictFallbackMessage:            lang['dictFallbackMessage'],
            dictFallbackText:               lang['dictFallbackText'],
            dictFileTooBig:                 lang['dictFileTooBig'],
            dictInvalidFileType:            lang['dictInvalidFileType'],
            dictResponseError:              lang['dictResponseError'],
            dictCancelUpload:               lang['dictCancelUpload'],
            dictCancelUploadConfirmation:   lang['dictCancelUploadConfirmation'],
            dictRemoveFile:                 lang['dictRemoveFile'],
            dictRemoveFileConfirmation:     lang['dictRemoveFileConfirmation'],
            dictMaxFilesExceeded:           lang['dictMaxFilesExceeded'],
            paramName: "file",
            url: "<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/filemanager",
            addRemoveLinks: true,
            maxFilesize: 256,
            maxFiles: 100,
            params: { action: 'upload' },
            init: function () {
                this.on('sending', function (file, xhr, formData) {
                    $('.dz-message').css('opacity', 0);
                    formData.append('path', $('#send_path').val());
                });
                this.on("success", function (file, response) {
                    console.log('dropzone success => ', response)
                    if (response.status === 200) {
                        new Noty({ text: response.message, type: 'success' }).show();
                        setTimeout(function(){
                            location.reload();
                        }, 600);
                    } else {
                        $(file.previewElement).find('.dz-error-mark').css('display', 'block').css('opacity', 1);
                        new Noty({ text: response.message, type: 'error' }).show();
                    }
                });
                this.on("queuecomplete", function () {

                });
                this.on('error', function (file, response) {
                    $(file.previewElement).find('.dz-error-message');
                    new Noty({ text: response.error, type: 'error' }).show();
                });
            },
            accept: function(file, done) {
                return done();
            }
        });
    });
<?php echo '</script'; ?>
>




<?php }
}
