Editeur Editez un fichier

Edition d'un fichier

Editez le fichier applications/nuasix/backups.php
<?php 
//_________________________________________________________________________________
?>
                    <div class="content d-flex flex-column flex-column-fluid" id="kt_content">
						<!--begin::Container-->
						<div class="container-xxl" id="kt_content_container">
                            <!--begin::Card-->
							<div class="card">
								<!--begin::Card header-->
								<div class="card-header border-0 pt-6">
								</div>
								<!--end::Card header-->
								<!--begin::Card body-->
								<div class="card-body pt-0">
									<!--begin::Table-->
                                    <table id="datatable_nuasix_default" class="table table-row-bordered gy-5">
                                        <thead>
                                            <tr class="fw-bold fs-6 text-muted">
												<th class="min-w-125px">Fichier</th>
												<th class="min-w-125px">Poids du fichier</th>
												<th class="min-w-125px">Date</th>
                                                <th class="min-w-125px">Heure</th>
												<th class="text-end min-w-70px">Actions</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            foreach($files as $file) {
                                                $time           = DateTime::createFromFormat('Y-m-d_H-i-s', basename($file, '.sql'));
                                                //$interval       = $time->diff($currentDateTime);
                                                $poids_octets   = filesize($file);
                                                $poids_mb       = $poids_octets !== false ? number_format($poids_octets / 1048576, 2) . ' Mb' : '-';
                                            ?>
                                            
											<tr data-id="<?= encrypt_decrypt("encrypt", $file, $key_user, $iv_user)?>" data-method="custom" data-element="<?= encrypt_decrypt("encrypt", "backup", $key_user, $iv_user)?>">
												<!--begin::Nom resource-->
												<td><a href="<?= SITE_URL.'/scripts/dumps/'.basename($file)?>" download><span class="badge badge-secondary position-relative me-5"><?= basename($file)?><span class="position-absolute top-0 start-100 translate-middle  badge badge-circle badge-success"></span></span></a></td>
												<!--end::Nom resource-->
												<!--begin::Poids-->
												<td><?= $poids_mb?></td>
												<!--end::Poids-->
												<!--begin::Date-->
												<td><?= $time->format('d-m-Y')?></td>
												<!--end::Date-->
                                                <!--begin::Heure-->
												<td><?= $time->format('H:i')?></td>
												<!--end::Heure-->
												<!--begin::Action-->
												<td class="text-end">
                                                    <?php
                                                    if($user -> hasPrivilege('nx_edit_backup')) {?>
                                                    <a href="#" class="btn btn-sm btn-icon btn-bg-light btn-active-color-primary" data-bs-toggle="modal" data-bs-target="#restore-<?= basename($file, '.sql')?>">
                                                        <span class="svg-icon svg-icon-muted svg-icon-2hx"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                        <path opacity="0.3" d="M19 15C20.7 15 22 13.7 22 12C22 10.3 20.7 9 19 9C18.9 9 18.9 9 18.8 9C18.9 8.7 19 8.3 19 8C19 6.3 17.7 5 16 5C15.4 5 14.8 5.2 14.3 5.5C13.4 4 11.8 3 10 3C7.2 3 5 5.2 5 8C5 8.3 5 8.7 5.1 9H5C3.3 9 2 10.3 2 12C2 13.7 3.3 15 5 15H19Z" fill="currentColor"/>
                                                        <path d="M13 17.4V12C13 11.4 12.6 11 12 11C11.4 11 11 11.4 11 12V17.4H13Z" fill="currentColor"/>
                                                        <path opacity="0.3" d="M8 17.4H16L12.7 20.7C12.3 21.1 11.7 21.1 11.3 20.7L8 17.4Z" fill="currentColor"/>
                                                        </svg>
                                                        </span>
                                                        <!--end::Svg Icon-->
                                                    </a>    
                                                    <?php
                                                    }
                                                    ?>
                                                    <?php
                                                    if($user -> hasPrivilege('nx_delete_backup')) {?>
                                                    <a href="#" class="btn btn-sm btn-icon btn-bg-light btn-active-color-primary" data-action="delete">
                                                        <!--begin::Svg Icon | path: assets/media/icons/duotune/general/gen027.svg-->
                                                        <span class="svg-icon svg-icon-muted svg-icon-2hx"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
                                                        <path d="M5 9C5 8.44772 5.44772 8 6 8H18C18.5523 8 19 8.44772 19 9V18C19 19.6569 17.6569 21 16 21H8C6.34315 21 5 19.6569 5 18V9Z" fill="black"/>
                                                        <path opacity="0.5" d="M5 5C5 4.44772 5.44772 4 6 4H18C18.5523 4 19 4.44772 19 5V5C19 5.55228 18.5523 6 18 6H6C5.44772 6 5 5.55228 5 5V5Z" fill="black"/>
                                                        <path opacity="0.5" d="M9 4C9 3.44772 9.44772 3 10 3H14C14.5523 3 15 3.44772 15 4V4H9V4Z" fill="black"/>
                                                        </svg></span>
                                                        <!--end::Svg Icon-->
                                                    </a>
                                                    <?php
                                                    }
                                                    ?>
												</td>
												<!--end::Action-->
											</tr>    
                                            <?php
                                            }
                                            ?>
                                        </tbody>
                                    </table>
                                    <!--end::Table-->
								</div>
								<!--end::Card body-->
							</div>
							<!--end::Card-->
                            <?php
                            foreach($files as $file) {
                                $time           = DateTime::createFromFormat('Y-m-d_H-i-s', basename($file, '.sql'));
                            ?>
                            <div class="modal fade" tabindex="-1" id="restore-<?= basename($file, '.sql')?>">
                                <div class="modal-dialog">
                                    <form method="post" action="scripts/post/restore.php">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h5 class="modal-title">Restaurer une sauvegarde</h5>

                                                <!--begin::Close-->
                                                <div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
                                                    <span class="svg-icon svg-icon-1">
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
                                                            <rect opacity="0.5" x="6" y="17.3137" width="16" height="2" rx="1" transform="rotate(-45 6 17.3137)" fill="black" />
                                                            <rect x="7.41422" y="6" width="16" height="2" rx="1" transform="rotate(45 7.41422 6)" fill="black" />
                                                        </svg>
                                                    </span>
                                                </div>
                                                <!--end::Close-->
                                            </div>

                                            <div class="modal-body">
                                                <!--begin::Input group-->
                                                <div class="form-floating">
                                                    <input type="text" class="form-control" id="file" name="file" value="<?= $file?>" hidden/>
                                                </div>
                                                <!--begin::Alert-->
                                                <div class="alert alert-danger d-flex align-items-center p-5">
                                                    <!--begin::Icon-->
                                                    <i class="ki-duotone ki-shield-tick fs-2hx text-danger me-4"><span class="svg-icon svg-icon-muted svg-icon-2hx"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                        <path opacity="0.3" d="M19 15C20.7 15 22 13.7 22 12C22 10.3 20.7 9 19 9C18.9 9 18.9 9 18.8 9C18.9 8.7 19 8.3 19 8C19 6.3 17.7 5 16 5C15.4 5 14.8 5.2 14.3 5.5C13.4 4 11.8 3 10 3C7.2 3 5 5.2 5 8C5 8.3 5 8.7 5.1 9H5C3.3 9 2 10.3 2 12C2 13.7 3.3 15 5 15H19Z" fill="currentColor"/>
                                                        <path d="M13 17.4V12C13 11.4 12.6 11 12 11C11.4 11 11 11.4 11 12V17.4H13Z" fill="currentColor"/>
                                                        <path opacity="0.3" d="M8 17.4H16L12.7 20.7C12.3 21.1 11.7 21.1 11.3 20.7L8 17.4Z" fill="currentColor"/>
                                                        </svg>
                                                        </span></i>
                                                    <!--end::Icon-->

                                                    <!--begin::Wrapper-->
                                                    <div class="d-flex flex-column">
                                                        <!--begin::Title-->
                                                        <h4 class="mb-1 text-dark">Avertissement de restauration</h4>
                                                        <!--end::Title-->

                                                        <!--begin::Content-->
                                                        <span>Effectuez une sauvegarde de la base de donnée avant de procéder à une restauration !</span>
                                                        <!--end::Content-->
                                                    </div>
                                                    <!--end::Wrapper-->
                                                </div>
                                                <!--end::Alert-->
                                                <!--begin::Alert-->
                                                <div class="alert alert-danger d-flex align-items-center p-5">
                                                    <!--begin::Icon-->
                                                    <i class="ki-duotone ki-shield-tick fs-2hx text-danger me-4"><!--begin::Svg Icon | path: /var/www/preview.keenthemes.com/keenthemes/metronic/docs/core/html/src/media/icons/duotune/files/fil011.svg-->
                                                    <span class="svg-icon svg-icon-muted svg-icon-2hx"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                    <path opacity="0.3" d="M19 22H5C4.4 22 4 21.6 4 21V3C4 2.4 4.4 2 5 2H14L20 8V21C20 21.6 19.6 22 19 22Z" fill="currentColor"/>
                                                    <g clip-path="url(#clip0_787_1289)">
                                                    <path d="M9.56133 15.7161C9.72781 15.5251 9.5922 15.227 9.33885 15.227H8.58033C8.57539 15.1519 8.57262 15.0763 8.57262 15C8.57262 13.1101 10.1101 11.5726 12 11.5726C12.7576 11.5726 13.4585 11.8198 14.0265 12.2377C14.2106 12.3731 14.4732 12.3609 14.6216 12.1872L15.1671 11.5491C15.3072 11.3852 15.2931 11.1382 15.1235 11.005C14.2353 10.3077 13.1468 9.92944 12 9.92944C10.6456 9.92944 9.37229 10.4569 8.41458 11.4146C7.4569 12.3723 6.92945 13.6456 6.92945 15C6.92945 15.0759 6.93135 15.1516 6.93465 15.2269H6.29574C6.0424 15.2269 5.90677 15.5251 6.07326 15.7161L7.51455 17.3693L7.81729 17.7166L8.90421 16.4698L9.56133 15.7161Z" fill="currentColor"/>
                                                    <path d="M17.9268 14.7516L16.8518 13.5185L16.1828 12.7511L15.2276 13.8468L14.4388 14.7516C14.2723 14.9426 14.4079 15.2407 14.6612 15.2407H15.4189C15.2949 17.0187 13.809 18.4274 12.0001 18.4274C11.347 18.4274 10.736 18.2437 10.216 17.9253C10.0338 17.8138 9.79309 17.8362 9.6543 17.9985L9.10058 18.6463C8.95391 18.8179 8.97742 19.0782 9.16428 19.2048C9.99513 19.7678 10.9743 20.0706 12.0001 20.0706C13.3545 20.0706 14.6278 19.5432 15.5855 18.5855C16.4863 17.6847 17.0063 16.5047 17.0649 15.2407H17.7043C17.9577 15.2407 18.0933 14.9426 17.9268 14.7516Z" fill="currentColor"/>
                                                    </g>
                                                    <path d="M15 8H20L14 2V7C14 7.6 14.4 8 15 8Z" fill="currentColor"/>
                                                    <defs>
                                                    <clipPath id="clip0_787_1289">
                                                    <rect width="12" height="12" fill="white" transform="translate(6 9)"/>
                                                    </clipPath>
                                                    </defs>
                                                    </svg>
                                                    </span>
                                                    <!--end::Svg Icon--></i>
                                                    <!--end::Icon-->

                                                    <!--begin::Wrapper-->
                                                    <div class="d-flex flex-column">
                                                        <!--begin::Title-->
                                                        <h4 class="mb-1 text-dark">Mise à jour des applications</h4>
                                                        <!--end::Title-->

                                                        <!--begin::Content-->
                                                        <span>Une restauration risquerait de pousser des applications vers une version obsolète. Contrôlez la version des applications et contactez l'administrateur si une mise à jour des applications est nécessaire.</span>
                                                        <!--end::Content-->
                                                    </div>
                                                    <!--end::Wrapper-->
                                                </div>
                                                <!--end::Alert-->
                                                <!--begin::Alert-->
                                                <div class="alert alert-warning d-flex align-items-center p-5">
                                                    <!--begin::Icon-->
                                                    <i class="ki-duotone ki-shield-tick fs-2hx text-warning me-4"><!--begin::Svg Icon | path: /var/www/preview.keenthemes.com/keenthemes/metronic/docs/core/html/src/media/icons/duotune/files/fil007.svg-->
                                                    <span class="svg-icon svg-icon-muted svg-icon-2hx"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                    <path opacity="0.3" d="M5 22H19C19.6 22 20 21.6 20 21V8L14 2H5C4.4 2 4 2.4 4 3V21C4 21.6 4.4 22 5 22Z" fill="currentColor"/>
                                                    <path d="M15 8H20L14 2V7C14 7.6 14.4 8 15 8Z" fill="currentColor"/>
                                                    <rect x="7.55518" y="16.7585" width="10.144" height="2" rx="1" transform="rotate(-45 7.55518 16.7585)" fill="currentColor"/>
                                                    <rect x="9.0174" y="9.60327" width="10.0952" height="2" rx="1" transform="rotate(45 9.0174 9.60327)" fill="currentColor"/>
                                                    </svg>
                                                    </span>
                                                    <!--end::Svg Icon--></i>
                                                    <!--end::Icon-->

                                                    <!--begin::Wrapper-->
                                                    <div class="d-flex flex-column">
                                                        <!--begin::Title-->
                                                        <h4 class="mb-1 text-dark">Perte des logs</h4>
                                                        <!--end::Title-->

                                                        <!--begin::Content-->
                                                        <span>Les logs et résultats de commandes API ne seront pas restaurés.</span>
                                                        <!--end::Content-->
                                                    </div>
                                                    <!--end::Wrapper-->
                                                </div>
                                                <!--end::Alert-->
                                                <!--begin::Alert-->
                                                <div class="alert alert-warning d-flex align-items-center p-5">
                                                    <!--begin::Icon-->
                                                    <i class="ki-duotone ki-shield-tick fs-2hx text-warning me-4"><!--begin::Svg Icon | path: /var/www/preview.keenthemes.com/keenthemes/metronic/docs/core/html/src/media/icons/duotune/coding/cod005.svg-->
                                                    <span class="svg-icon svg-icon-muted svg-icon-2hx"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                    <path d="M12.6 7C12 7 11.6 6.6 11.6 6V3C11.6 2.4 12 2 12.6 2C13.2 2 13.6 2.4 13.6 3V6C13.6 6.6 13.2 7 12.6 7ZM10 7.59998C10.5 7.29998 10.6 6.69995 10.4 6.19995L9 3.80005C8.7 3.30005 8.10001 3.20002 7.60001 3.40002C7.10001 3.70002 7.00001 4.30005 7.20001 4.80005L8.60001 7.19995C8.80001 7.49995 9.1 7.69995 9.5 7.69995C9.7 7.69995 9.9 7.69998 10 7.59998ZM8 9.30005C8.3 8.80005 8.10001 8.20002 7.60001 7.90002L5.5 6.69995C5 6.39995 4.40001 6.59998 4.10001 7.09998C3.80001 7.59998 4 8.2 4.5 8.5L6.60001 9.69995C6.80001 9.79995 6.90001 9.80005 7.10001 9.80005C7.50001 9.80005 7.9 9.70005 8 9.30005ZM7.20001 12C7.20001 11.4 6.80001 11 6.20001 11H4C3.4 11 3 11.4 3 12C3 12.6 3.4 13 4 13H6.20001C6.70001 13 7.20001 12.6 7.20001 12Z" fill="currentColor"/>
                                                    <path opacity="0.3" d="M17.4 5.5C17.4 6.1 17 6.5 16.4 6.5C15.8 6.5 15.4 6.1 15.4 5.5C15.4 4.9 15.8 4.5 16.4 4.5C17 4.5 17.4 5 17.4 5.5ZM5.80001 17.1L7.40001 16.1C7.90001 15.8 8.00001 15.2 7.80001 14.7C7.50001 14.2 6.90001 14.1 6.40001 14.3L4.80001 15.3C4.30001 15.6 4.20001 16.2 4.40001 16.7C4.60001 17 4.90001 17.2 5.30001 17.2C5.50001 17.3 5.60001 17.2 5.80001 17.1ZM8.40001 20.2C8.20001 20.2 8.10001 20.2 7.90001 20.1C7.40001 19.8 7.3 19.2 7.5 18.7L8.30001 17.3C8.60001 16.8 9.20002 16.7 9.70002 16.9C10.2 17.2 10.3 17.8 10.1 18.3L9.30001 19.7C9.10001 20 8.70001 20.2 8.40001 20.2ZM12.6 21.2C12 21.2 11.6 20.8 11.6 20.2V18.8C11.6 18.2 12 17.8 12.6 17.8C13.2 17.8 13.6 18.2 13.6 18.8V20.2C13.6 20.7 13.2 21.2 12.6 21.2ZM16.7 19.9C16.4 19.9 16 19.7 15.8 19.4L15.2 18.5C14.9 18 15.1 17.4 15.6 17.1C16.1 16.8 16.7 17 17 17.5L17.6 18.4C17.9 18.9 17.7 19.5 17.2 19.8C17 19.9 16.8 19.9 16.7 19.9ZM19.4 17C19.2 17 19.1 17 18.9 16.9L18.2 16.5C17.7 16.2 17.6 15.6 17.8 15.1C18.1 14.6 18.7 14.5 19.2 14.7L19.9 15.1C20.4 15.4 20.5 16 20.3 16.5C20.1 16.8 19.8 17 19.4 17ZM20.4 13H19.9C19.3 13 18.9 12.6 18.9 12C18.9 11.4 19.3 11 19.9 11H20.4C21 11 21.4 11.4 21.4 12C21.4 12.6 20.9 13 20.4 13ZM18.9 9.30005C18.6 9.30005 18.2 9.10005 18 8.80005C17.7 8.30005 17.9 7.70002 18.4 7.40002L18.6 7.30005C19.1 7.00005 19.7 7.19995 20 7.69995C20.3 8.19995 20.1 8.79998 19.6 9.09998L19.4 9.19995C19.3 9.19995 19.1 9.30005 18.9 9.30005Z" fill="currentColor"/>
                                                    </svg>
                                                    </span>
                                                    <!--end::Svg Icon--></i>
                                                    <!--end::Icon-->

                                                    <!--begin::Wrapper-->
                                                    <div class="d-flex flex-column">
                                                        <!--begin::Title-->
                                                        <h4 class="mb-1 text-dark">Restauration des données</h4>
                                                        <!--end::Title-->

                                                        <!--begin::Content-->
                                                        <span>Les données seront restaurées à l'état du  <?= dateToFrench($time->format('l d-m-Y'), 'l d-m-Y')?> à <?= $time->format('H:i') ?></span>
                                                        <!--end::Content-->
                                                    </div>
                                                    <!--end::Wrapper-->
                                                </div>
                                                <!--end::Alert-->
                                                <!--begin::Alert-->
                                                <div class="alert alert-primary d-flex align-items-center p-5">
                                                    <!--begin::Icon-->
                                                    <i class="ki-duotone ki-shield-tick fs-2hx text-primary me-4"><!--begin::Svg Icon | path: /var/www/preview.keenthemes.com/keenthemes/metronic/docs/core/html/src/media/icons/duotune/communication/com014.svg-->
                                                    <span class="svg-icon svg-icon-muted svg-icon-2hx"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                                    <path d="M16.0173 9H15.3945C14.2833 9 13.263 9.61425 12.7431 10.5963L12.154 11.7091C12.0645 11.8781 12.1072 12.0868 12.2559 12.2071L12.6402 12.5183C13.2631 13.0225 13.7556 13.6691 14.0764 14.4035L14.2321 14.7601C14.2957 14.9058 14.4396 15 14.5987 15H18.6747C19.7297 15 20.4057 13.8774 19.912 12.945L18.6686 10.5963C18.1487 9.61425 17.1285 9 16.0173 9Z" fill="currentColor"/>
                                                    <rect opacity="0.3" x="14" y="4" width="4" height="4" rx="2" fill="currentColor"/>
                                                    <path d="M4.65486 14.8559C5.40389 13.1224 7.11161 12 9 12C10.8884 12 12.5961 13.1224 13.3451 14.8559L14.793 18.2067C15.3636 19.5271 14.3955 21 12.9571 21H5.04292C3.60453 21 2.63644 19.5271 3.20698 18.2067L4.65486 14.8559Z" fill="currentColor"/>
                                                    <rect opacity="0.3" x="6" y="5" width="6" height="6" rx="3" fill="currentColor"/>
                                                    </svg>
                                                    </span>
                                                    <!--end::Svg Icon--></i>
                                                    <!--end::Icon-->

                                                    <!--begin::Wrapper-->
                                                    <div class="d-flex flex-column">
                                                        <!--begin::Title-->
                                                        <h4 class="mb-1 text-dark">Déconnexion des utilisateurs</h4>
                                                        <!--end::Title-->

                                                        <!--begin::Content-->
                                                        <span>Une restauration forcera les utilisateurs à se reconnecter.</span>
                                                        <!--end::Content-->
                                                    </div>
                                                    <!--end::Wrapper-->
                                                </div>
                                                <!--end::Alert-->
                                                <!--end::Input group-->
                                            </div>

                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-light" data-bs-dismiss="modal">Fermer</button>
                                                <button type="submit" class="btn btn-primary" name="restore">Restaurer</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div> 
                            <?php
                            }
                            ?>
						</div>
						<!--end::Container-->
					</div>

Conseils et liens

Liens vers des ressources utiles pour l'édition de fichier