Admin, ru.php fr.php
This commit is contained in:
1 parent
d81efe93b1
commit
1deb30fcd1
3 files changed
+38
-16
No files matched your search
@@ -1,17 +1,39 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
/**
|
||||
* clean_uploads.php
|
||||
* Compatible:
|
||||
* - accès direct /admin/tools/clean_uploads.php
|
||||
* - inclusion via /admin/index.php?page=clean_uploads
|
||||
* Outil admin destructif : suppression des fichiers orphelins dans /public/uploads
|
||||
*/
|
||||
|
||||
// Si APP_HTDOCS n'existe pas, c'est qu'on n'est pas passé par le bootstrap admin
|
||||
if (! defined('APP_HTDOCS')) {
|
||||
require_once __DIR__ . '/../../public/includes/init_admin.php';
|
||||
require_once __DIR__ . '/../../public/includes/init_admin.php'; // ✅ impose admin + strict super-admin + CSRF
|
||||
|
||||
// Anti-cache (évite de conserver un token / résultat en cache)
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
// Reauth (10 min) avant action destructive
|
||||
$mustReauth = static function (int $ttl = 600): bool {
|
||||
$t = (int) ($_SESSION['admin_reauth_at'] ?? 0);
|
||||
return ($t === 0 || (time() - $t) > $ttl);
|
||||
};
|
||||
|
||||
if ($mustReauth()) {
|
||||
$qs = http_build_query([
|
||||
'page' => 'reauth',
|
||||
'redir' => ($_SERVER['REQUEST_URI'] ?? 'index.php?page=clean_uploads'),
|
||||
]);
|
||||
header('Location: ?' . $qs);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Durcir PDO
|
||||
if (! isset($pdo) || ! ($pdo instanceof PDO)) {
|
||||
http_response_code(500);
|
||||
exit('PDO introuvable (DB non initialisée).');
|
||||
}
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
||||
|
||||
// Dossier uploads (chez toi: htdocs/public/uploads/)
|
||||
$uploadDir = rtrim(APP_HTDOCS, '/\\') . '/public/uploads/';
|
||||
if (! is_dir($uploadDir)) {
|
||||
@@ -74,20 +96,19 @@
|
||||
foreach ($files as $f) {
|
||||
if ($f === '.' || $f === '..') {
|
||||
continue;
|
||||
if ($f[0] === '.') {
|
||||
}
|
||||
|
||||
if ($f !== '' && $f[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
// ignore fichiers cachés (.htaccess, .DS_Store, etc.)
|
||||
|
||||
}
|
||||
|
||||
// ignore fichiers système fréquents
|
||||
if ($f === '.DS_Store' || $f === 'Thumbs.db' || $f === '.htaccess') {
|
||||
// ignore fichiers système fréquents (si tu veux garder explicite)
|
||||
if ($f === 'Thumbs.db') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$full = $uploadDir . $f;
|
||||
|
||||
// uniquement les fichiers (pas sous-dossiers)
|
||||
if (! is_file($full)) {
|
||||
continue;
|
||||
}
|
||||
@@ -185,8 +206,7 @@
|
||||
code{background:#f6f6f6;padding:2px 6px;border-radius:6px}
|
||||
.muted{color:#666}
|
||||
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
|
||||
.btn{display:inline-block;padding:10px 14px;border-radius:10px;border:1px solid #ccc;background:#fff;cursor:pointer}
|
||||
.btn-danger{border-color:#e3a4a4;background:#fff1f1}
|
||||
|
||||
.btn:disabled{opacity:.5;cursor:not-allowed}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -2011,4 +2011,5 @@ Cliquez simplement sur le lien pour vous connecter.<br>',
|
||||
'home_pro_point_3' => 'Secrétariat',
|
||||
'home_pro_point_4' => 'Gestion des rendez-vous',
|
||||
'home_pro_point_5' => 'Synchronisation des calendriers',
|
||||
'supp_uploads' => 'Supprimer orpheline',
|
||||
];
|
||||
@@ -2021,4 +2021,5 @@ return [
|
||||
'home_pro_point_3' => 'Секретариат',
|
||||
'home_pro_point_4' => 'Управление записью и расписанием',
|
||||
'home_pro_point_5' => 'Синхронизация календарей',
|
||||
'supp_uploads' => 'Удалить лишние',
|
||||
];
|
||||
Reference in new issue
Block a user