Added the email for the owner and changed the admin123 for the login page
This commit is contained in:
@@ -74,6 +74,7 @@ try {
|
|||||||
// Seed default site settings if empty
|
// Seed default site settings if empty
|
||||||
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_title', 'sld-blocknotes')");
|
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_title', 'sld-blocknotes')");
|
||||||
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_favicon', 'assets/img/favicon.png')");
|
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_favicon', 'assets/img/favicon.png')");
|
||||||
|
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('admin_email', '[email protected]')");
|
||||||
|
|
||||||
// Seed default owner account if table is empty or ensure admin user is owner if no owner exists
|
// Seed default owner account if table is empty or ensure admin user is owner if no owner exists
|
||||||
$res = $conn->query("SELECT COUNT(*) AS total FROM users");
|
$res = $conn->query("SELECT COUNT(*) AS total FROM users");
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@ $db_needed="yes";
|
|||||||
$db_debug="yes";
|
$db_debug="yes";
|
||||||
$db_host="localhost";
|
$db_host="localhost";
|
||||||
$db_name="sld_blocknotes_db";
|
$db_name="sld_blocknotes_db";
|
||||||
$db_user="simone";
|
$db_user="root";
|
||||||
$db_pass="Angela";
|
$db_pass="";
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// --- DON'T CHANGE ALL THE CODE BELOW!!! ---
|
// --- DON'T CHANGE ALL THE CODE BELOW!!! ---
|
||||||
|
|||||||
+2
-1
@@ -33,7 +33,7 @@ $current_lang = get_current_lang();
|
|||||||
$msg_error = "";
|
$msg_error = "";
|
||||||
$msg_success = "";
|
$msg_success = "";
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if (($_SERVER['REQUEST_METHOD'] ?? '') === 'POST') {
|
||||||
$db_host = trim($_POST['db_host'] ?? 'localhost');
|
$db_host = trim($_POST['db_host'] ?? 'localhost');
|
||||||
$db_name = trim($_POST['db_name'] ?? 'sld_blocknotes_db');
|
$db_name = trim($_POST['db_name'] ?? 'sld_blocknotes_db');
|
||||||
$db_user = trim($_POST['db_user'] ?? '');
|
$db_user = trim($_POST['db_user'] ?? '');
|
||||||
@@ -92,6 +92,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
// Insert site_settings default values
|
// Insert site_settings default values
|
||||||
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_title', 'sld-blocknotes')");
|
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_title', 'sld-blocknotes')");
|
||||||
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_favicon', 'assets/img/favicon.png')");
|
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('site_favicon', 'assets/img/favicon.png')");
|
||||||
|
$conn->query("INSERT IGNORE INTO site_settings (setting_key, setting_value) VALUES ('admin_email', '[email protected]')");
|
||||||
|
|
||||||
// Create Owner account
|
// Create Owner account
|
||||||
$hash_owner = password_hash($owner_pass, PASSWORD_DEFAULT);
|
$hash_owner = password_hash($owner_pass, PASSWORD_DEFAULT);
|
||||||
|
|||||||
+28
-7
@@ -53,7 +53,8 @@ function get_translations() {
|
|||||||
'placeholder_username' => 'Inserisci username',
|
'placeholder_username' => 'Inserisci username',
|
||||||
'placeholder_password' => 'Inserisci password',
|
'placeholder_password' => 'Inserisci password',
|
||||||
'btn_submit_login' => '🔑 Accedi',
|
'btn_submit_login' => '🔑 Accedi',
|
||||||
'login_hint_footer' => 'Accredito predefinito per il primo accesso',
|
'login_hint_footer' => 'Richiedi un account all\'amministratore',
|
||||||
|
'login_request_account' => 'Se hai bisogno di un account, richiedilo all\'amministratore di sistema:',
|
||||||
'login_installed_success' => '🎉 Setup completato! Accedi con le credenziali create.',
|
'login_installed_success' => '🎉 Setup completato! Accedi con le credenziali create.',
|
||||||
|
|
||||||
// Navbar
|
// Navbar
|
||||||
@@ -152,6 +153,14 @@ function get_translations() {
|
|||||||
'btn_reset_pass' => '🔑 Reset Pass',
|
'btn_reset_pass' => '🔑 Reset Pass',
|
||||||
'modal_create_user' => '➕ Registra Nuovo Utente',
|
'modal_create_user' => '➕ Registra Nuovo Utente',
|
||||||
'modal_reset_pass' => '🔑 Reset Password Utente',
|
'modal_reset_pass' => '🔑 Reset Password Utente',
|
||||||
|
'card_site_settings_title' => '⚙️ Impostazioni Sito (Esclusivo Owner)',
|
||||||
|
'label_site_title' => 'Titolo Globale Applicazione / Sito',
|
||||||
|
'label_favicon' => 'Favicon del Sito (Alta Risoluzione, min 64x64px)',
|
||||||
|
'btn_save_site_title' => '💾 Salva Titolo Sito',
|
||||||
|
'btn_upload_favicon' => '📤 Carica Nuova Favicon',
|
||||||
|
'label_admin_email' => 'Email Amministratore di Sistema',
|
||||||
|
'btn_save_admin_email' => '💾 Salva Email Admin',
|
||||||
|
'placeholder_admin_email' => 'es. [email protected]',
|
||||||
// Confirm Dialogs
|
// Confirm Dialogs
|
||||||
'confirm_delete_blocknote' => 'Sei sicuro di voler eliminare questo blocknote e tutte le sue note?',
|
'confirm_delete_blocknote' => 'Sei sicuro di voler eliminare questo blocknote e tutte le sue note?',
|
||||||
'confirm_delete_note' => 'Sei sicuro di voler eliminare questa nota e tutte le sue sottonote?',
|
'confirm_delete_note' => 'Sei sicuro di voler eliminare questa nota e tutte le sue sottonote?',
|
||||||
@@ -317,6 +326,10 @@ function get_translations() {
|
|||||||
'label_favicon' => 'Site Favicon (High Resolution, min 64x64px)',
|
'label_favicon' => 'Site Favicon (High Resolution, min 64x64px)',
|
||||||
'btn_save_site_title' => '💾 Save Site Title',
|
'btn_save_site_title' => '💾 Save Site Title',
|
||||||
'btn_upload_favicon' => '📤 Upload New Favicon',
|
'btn_upload_favicon' => '📤 Upload New Favicon',
|
||||||
|
'label_admin_email' => 'System Administrator Email',
|
||||||
|
'btn_save_admin_email' => '💾 Save Admin Email',
|
||||||
|
'placeholder_admin_email' => 'e.g. [email protected]',
|
||||||
|
'login_request_account' => 'If you need an account, please contact the system administrator:',
|
||||||
|
|
||||||
// Confirm Dialogs
|
// Confirm Dialogs
|
||||||
'confirm_delete_blocknote' => 'Are you sure you want to delete this blocknote and all its notes?',
|
'confirm_delete_blocknote' => 'Are you sure you want to delete this blocknote and all its notes?',
|
||||||
@@ -479,10 +492,14 @@ function get_translations() {
|
|||||||
'modal_create_user' => '➕ Registrar Nuevo Usuario',
|
'modal_create_user' => '➕ Registrar Nuevo Usuario',
|
||||||
'modal_reset_pass' => '🔑 Resetear Contraseña',
|
'modal_reset_pass' => '🔑 Resetear Contraseña',
|
||||||
'card_site_settings_title' => '⚙️ Ajustes del Sitio (Solo Propietario)',
|
'card_site_settings_title' => '⚙️ Ajustes del Sitio (Solo Propietario)',
|
||||||
'label_site_title' => 'Título del Sitio / Aplicación',
|
'label_site_title' => 'Título Global de la Aplicación / Sitio',
|
||||||
'label_favicon' => 'Favicon del Sitio (Alta resolución, mín 64x64px)',
|
'label_favicon' => 'Favicon del Sitio (Alta Resolución, min 64x64px)',
|
||||||
'btn_save_site_title' => '💾 Guardar Título',
|
'btn_save_site_title' => '💾 Guardar Título',
|
||||||
'btn_upload_favicon' => '📤 Subir Nueva Favicon',
|
'btn_upload_favicon' => '📤 Subir Favicon',
|
||||||
|
'label_admin_email' => 'Correo del Administrador del Sistema',
|
||||||
|
'btn_save_admin_email' => '💾 Guardar Correo Admin',
|
||||||
|
'placeholder_admin_email' => 'ej. [email protected]',
|
||||||
|
'login_request_account' => 'Si necesitas una cuenta, contacta al administrador del sistema:',
|
||||||
|
|
||||||
// Confirm Dialogs
|
// Confirm Dialogs
|
||||||
'confirm_delete_blocknote' => '¿Estás seguro de que quieres eliminar este blocknote y todas sus notas?',
|
'confirm_delete_blocknote' => '¿Estás seguro de que quieres eliminar este blocknote y todas sus notas?',
|
||||||
@@ -645,10 +662,14 @@ function get_translations() {
|
|||||||
'modal_create_user' => '➕ Enregistrer un Utilisateur',
|
'modal_create_user' => '➕ Enregistrer un Utilisateur',
|
||||||
'modal_reset_pass' => '🔑 Réinitialiser le Mot de Passe',
|
'modal_reset_pass' => '🔑 Réinitialiser le Mot de Passe',
|
||||||
'card_site_settings_title' => '⚙️ Paramètres du Site (Propriétaire Uniquement)',
|
'card_site_settings_title' => '⚙️ Paramètres du Site (Propriétaire Uniquement)',
|
||||||
'label_site_title' => 'Titre Global du Site',
|
'label_site_title' => 'Titre Global del Application / Site',
|
||||||
'label_favicon' => 'Favicon du Site (Haute résolution, min 64x64px)',
|
'label_favicon' => 'Favicon du Site (Haute Résolution, min 64x64px)',
|
||||||
'btn_save_site_title' => '💾 Enregistrer le Titre',
|
'btn_save_site_title' => '💾 Enregistrer le Titre',
|
||||||
'btn_upload_favicon' => '📤 Téléverser la Favicon',
|
'btn_upload_favicon' => '📤 Téléverser le Favicon',
|
||||||
|
'label_admin_email' => 'E-mail de l\'Administrateur Système',
|
||||||
|
'btn_save_admin_email' => '💾 Enregistrer l\'E-mail Admin',
|
||||||
|
'placeholder_admin_email' => 'ex. [email protected]',
|
||||||
|
'login_request_account' => 'Si vous avez besoin d\'un compte, contactez l\'administrateur système:',
|
||||||
|
|
||||||
// Confirm Dialogs
|
// Confirm Dialogs
|
||||||
'confirm_delete_blocknote' => 'Êtes-vous sûr de vouloir supprimer ce blocknote et toutes ses notes?',
|
'confirm_delete_blocknote' => 'Êtes-vous sûr de vouloir supprimer ce blocknote et toutes ses notes?',
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
} elseif ($action === 'upload_favicon' && is_owner()) {
|
} elseif ($action === 'upload_favicon' && is_owner()) {
|
||||||
$res = upload_site_favicon($_FILES['favicon_file'] ?? null);
|
$res = upload_site_favicon($_FILES['favicon_file'] ?? null);
|
||||||
if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message'];
|
if ($res['success']) $msg_success = $res['message']; else $msg_error = $res['message'];
|
||||||
|
} elseif ($action === 'update_admin_email' && is_owner()) {
|
||||||
|
$new_email = trim($_POST['admin_email'] ?? '');
|
||||||
|
if (!empty($new_email) && filter_var($new_email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
update_site_setting('admin_email', $new_email);
|
||||||
|
$msg_success = "Email dell'amministratore di sistema aggiornata con successo!";
|
||||||
|
} else {
|
||||||
|
$msg_error = "Inserisci un indirizzo email valido per l'amministratore di sistema.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +56,7 @@ foreach ($all_blocknotes as $bn) {
|
|||||||
|
|
||||||
$site_title = get_site_setting('site_title', 'sld-blocknotes');
|
$site_title = get_site_setting('site_title', 'sld-blocknotes');
|
||||||
$site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
|
$site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
|
||||||
|
$admin_email = get_site_setting('admin_email', '[email protected]');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<main class="main-content">
|
<main class="main-content">
|
||||||
@@ -96,6 +105,18 @@ $site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- Modifica Email Amministratore -->
|
||||||
|
<form action="index.php?page=admin_users" method="POST">
|
||||||
|
<input type="hidden" name="action" value="update_admin_email">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="admin_email"><?= __('label_admin_email') ?></label>
|
||||||
|
<input type="email" name="admin_email" id="admin_email" class="form-control" value="<?= htmlspecialchars($admin_email) ?>" required placeholder="<?= htmlspecialchars(__('placeholder_admin_email')) ?>">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary" style="margin-top: 0.5rem;">
|
||||||
|
<?= __('btn_save_admin_email') ?>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
<!-- Caricamento Favicon -->
|
<!-- Caricamento Favicon -->
|
||||||
<form action="index.php?page=admin_users" method="POST" enctype="multipart/form-data">
|
<form action="index.php?page=admin_users" method="POST" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="action" value="upload_favicon">
|
<input type="hidden" name="action" value="upload_favicon">
|
||||||
|
|||||||
+9
-4
@@ -62,10 +62,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div style="margin-top: 1.5rem; text-align: center; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.82rem; color: #64748b;">
|
<?php $admin_email = get_site_setting('admin_email', '[email protected]'); ?>
|
||||||
<?= __('login_hint_footer') ?>:<br>
|
<?php if (!empty($admin_email)): ?>
|
||||||
<strong style="color: #94a3b8;"><?= __('label_username') ?>:</strong> admin | <strong style="color: #94a3b8;"><?= __('label_password') ?>:</strong> admin123
|
<div style="margin-top: 1.5rem; text-align: center; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.85rem; color: #94a3b8;">
|
||||||
</div>
|
<?= __('login_request_account') ?><br>
|
||||||
|
<a href="mailto:<?= htmlspecialchars($admin_email) ?>" style="color: #7dd3fc; font-weight: 600; text-decoration: underline; margin-top: 0.35rem; display: inline-block;">
|
||||||
|
✉️ <?= htmlspecialchars($admin_email) ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user