revert a2f36b6fac
revert Fixed the READMEs and small fix around the project
This commit is contained in:
-30
@@ -1,30 +0,0 @@
|
|||||||
# OS Artifacts
|
|
||||||
.DS_Store
|
|
||||||
.DS_Store?
|
|
||||||
._*
|
|
||||||
.Spotlight-V100
|
|
||||||
.Trashes
|
|
||||||
ehthumbs.db
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
# Environment & IDE
|
|
||||||
.idea/
|
|
||||||
.vscode/
|
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
|
|
||||||
# Scratch & Temporary Folders
|
|
||||||
scratch/
|
|
||||||
*.tmp
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Dynamic Uploaded Favicons (Keep default favicon.png)
|
|
||||||
assets/img/favicon_*.png
|
|
||||||
assets/img/favicon_*.jpg
|
|
||||||
assets/img/favicon_*.jpeg
|
|
||||||
assets/img/favicon_*.webp
|
|
||||||
assets/img/favicon_*.ico
|
|
||||||
assets/img/favicon_*.svg
|
|
||||||
|
|
||||||
# Installer Completed Marker (Optional)
|
|
||||||
first_start.php.completed
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
# 📝 sld-blocknotes - Sistema Moderno de Notas en Bloques y Gestión de Comandos
|
|
||||||
|
|
||||||
> **🌐 Idiomas disponibles**: [🇬🇧 English](README.md) | [🇮🇹 Italiano](README.it.md) | [🇪🇸 Español](README.es.md) | [🇫🇷 Français](README.fr.md)
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
Una potente y moderna aplicación web sin dependencias externas para organizar notas estructuradas en bloques, comandos de terminal, fragmentos de código e instrucciones. Desarrollada en **Pure PHP**, **Vanilla CSS**, **Vanilla JS** y **MySQL/MariaDB**.
|
|
||||||
|
|
||||||
URL del Repositorio: [https://gitea.sld-server.org/sld-admin/sld-blocknotes](https://gitea.sld-server.org/sld-admin/sld-blocknotes)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ✨ Características Principales
|
|
||||||
|
|
||||||
- 📑 **Notas en Bloques y Subnotas Estructuradas**:
|
|
||||||
- Organiza tus notas dentro de blocknotes personalizados.
|
|
||||||
- Las notas contienen título, descripción y múltiples subnotas.
|
|
||||||
- **Notas Plegables**: Las notas están plegadas por defecto para optimizar el espacio vertical, con botones globales de **Expandir Todas / Contraer Todas**.
|
|
||||||
|
|
||||||
- ⚡ **Subnotas de Tipo Comando de Terminal**:
|
|
||||||
- Renderizado diferenciado entre subnotas de texto genérico y comandos de terminal.
|
|
||||||
- **Botón Copiar en 1 Clic**: Copia instantáneamente comandos al portapapeles con retroalimentación visual (`✓ ¡Copiado!`).
|
|
||||||
- Cuadro estilo IDE/Terminal de alto contraste con barra de desplazamiento vertical.
|
|
||||||
|
|
||||||
- 🔍 **Búsqueda en Tiempo Real**:
|
|
||||||
- Filtra títulos de notas, descripciones, subnotas y contenido de comandos en tiempo real dentro del blocknote activo.
|
|
||||||
- Expande automáticamente los bloques coincidentes durante la búsqueda.
|
|
||||||
|
|
||||||
- 📥 / 💾 **Importación y Exportación JSON**:
|
|
||||||
- Descarga el archivo JSON de cualquier blocknote con un clic (`export_blocknote.php`).
|
|
||||||
- Importador JSON interactivo compatible con formato estándar y formato antiguo.
|
|
||||||
|
|
||||||
- 🌐 **Interfaz Multilingüe (IT, EN, ES, FR)**:
|
|
||||||
- Localización completa en **Italiano 🇮🇹, Inglés 🇬🇧, Español 🇪🇸 y Francés 🇫🇷**.
|
|
||||||
- Selector de idioma rápido en la barra de navegación para visitantes y usuarios conectados.
|
|
||||||
- El idioma preferido de cada usuario se guarda en su perfil para futuros accesos.
|
|
||||||
|
|
||||||
- 🏠 **Página de Inicio Personalizable**:
|
|
||||||
- Elige entre acceder directamente al **Panel Principal (Todos los Blocknotes)** o abrir un **Blocknote Predeterminado específico** al iniciar sesión.
|
|
||||||
|
|
||||||
- 👑 **Rol Único de Propietario y Jerarquía Avanzada (`owner` > `admin` > `user`)**:
|
|
||||||
- **Cuenta de Propietario Inmune**: La cuenta inicial de Propietario (`owner`) no puede ser eliminada por ningún administrador ni por sí misma.
|
|
||||||
- Los administradores estándar no pueden degradar ni modificar el rol del Propietario.
|
|
||||||
|
|
||||||
- ⚙️ **Personalización del Sitio (Exclusivo Propietario)**:
|
|
||||||
- Cambia el **Título Global de la Aplicación**.
|
|
||||||
- Sube y valida un **Favicon de Alta Resolución** (mínimo 64x64px) con vista previa en tiempo real.
|
|
||||||
|
|
||||||
- 🚀 **Asistente de Configuración Inicial (`first_start.php`)**:
|
|
||||||
- Instalador automático para configurar credenciales MySQL, crear tablas y registrar los primeros usuarios privilegiados (`owner` y `admin`).
|
|
||||||
- Completamente multilingüe en los 4 idiomas.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🚀 Guía de Instalación
|
|
||||||
|
|
||||||
### Requisitos
|
|
||||||
- Servidor Web (Apache, Nginx, o servidor CLI integrado de PHP)
|
|
||||||
- PHP 7.4 o 8.x (con extensión `mysqli` habilitada)
|
|
||||||
- MySQL 5.7+ o MariaDB 10.x+
|
|
||||||
|
|
||||||
### Instalación Paso a Paso
|
|
||||||
|
|
||||||
1. **Clona el Repositorio**:
|
|
||||||
```bash
|
|
||||||
git clone https://gitea.sld-server.org/sld-admin/sld-blocknotes.git
|
|
||||||
cd sld-blocknotes
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Inicia el Servidor Web**:
|
|
||||||
Puedes utilizar el servidor integrado de PHP:
|
|
||||||
```bash
|
|
||||||
php -S localhost:8000
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Ejecuta el Asistente de Configuración**:
|
|
||||||
Abre tu navegador en `http://localhost:8000/`.
|
|
||||||
El sistema detectará el primer inicio y abrirá automáticamente `first_start.php`:
|
|
||||||
- Introduce los datos de tu **Base de Datos MySQL** (Host, Nombre, Usuario, Contraseña).
|
|
||||||
- Configura las credenciales de la **Cuenta de Propietario**.
|
|
||||||
- Configura las credenciales de la **Primera Cuenta de Admin**.
|
|
||||||
- Haz clic en **⚡ Completar Instalación y Configurar Sistema**.
|
|
||||||
|
|
||||||
4. **Inicia Sesión**:
|
|
||||||
Al finalizar, serás redirigido a la página de inicio de sesión `index.php?page=login`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📄 Licencia
|
|
||||||
|
|
||||||
Este proyecto se distribuye bajo la licencia open-source [MIT License](LICENSE).
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
# 📝 sld-blocknotes - Système Moderne de Notes par Blocs et Gestion de Commandes
|
|
||||||
|
|
||||||
> **🌐 Langues disponibles**: [🇬🇧 English](README.md) | [🇮🇹 Italiano](README.it.md) | [🇪🇸 Español](README.es.md) | [🇫🇷 Français](README.fr.md)
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
Une application Web moderne et puissante, sans dépendance externe, pour organiser des notes structurées en blocs, des commandes de terminal, des extraits de code et des instructions. Développée en **Pure PHP**, **Vanilla CSS**, **Vanilla JS** et **MySQL/MariaDB**.
|
|
||||||
|
|
||||||
URL du Dépôt: [https://gitea.sld-server.org/sld-admin/sld-blocknotes](https://gitea.sld-server.org/sld-admin/sld-blocknotes)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ✨ Fonctionnalités Principales
|
|
||||||
|
|
||||||
- 📑 **Notes en Blocs et Sous-notes Structurées**:
|
|
||||||
- Organisez vos notes au sein de blocknotes personnalisés.
|
|
||||||
- Les notes contiennent un titre, une description et plusieurs sous-notes.
|
|
||||||
- **Notes Repliables**: Les notes sont réduites par défaut pour optimiser l'espace vertical, avec des boutons globaux **Tout Développer / Tout Réduire**.
|
|
||||||
|
|
||||||
- ⚡ **Sous-notes de Type Commande de Terminal**:
|
|
||||||
- Rendu différencié entre sous-notes de texte générique et commandes de terminal.
|
|
||||||
- **Bouton Copier en 1 Clic**: Copiez instantanément les commandes dans le presse-papiers avec retour visuel (`✓ Copié!`).
|
|
||||||
- Cadre style IDE/Terminal à haut contraste avec barre de défilement verticale.
|
|
||||||
|
|
||||||
- 🔍 **Recherche en Temps Réel**:
|
|
||||||
- Filtrez les titres des notes, descriptions, sous-notes et contenus des commandes en temps réel au sein du blocknote ouvert.
|
|
||||||
- Développe automatiquement les blocs correspondants pendant la recherche.
|
|
||||||
|
|
||||||
- 📥 / 💾 **Importation et Exportation JSON**:
|
|
||||||
- Téléchargez le fichier JSON de chaque blocknote en un clic (`export_blocknote.php`).
|
|
||||||
- Importateur JSON interactif compatible avec le format standard et l'ancien format tableau.
|
|
||||||
|
|
||||||
- 🌐 **Interface Multilingue (IT, EN, ES, FR)**:
|
|
||||||
- Localisation complète en **Italien 🇮🇹, Anglais 🇬🇧, Espagnol 🇪🇸 et Français 🇫🇷**.
|
|
||||||
- Sélecteur de langue rapide dans la barre de navigation pour les visiteurs et utilisateurs connectés.
|
|
||||||
- La langue préférée de chaque utilisateur est enregistrée dans son profil pour les futures connexions.
|
|
||||||
|
|
||||||
- 🏠 **Page d'Accueil Personnalisable**:
|
|
||||||
- Choisissez entre accéder directement au **Panneau Principal (Tous les Blocknotes)** ou ouvrir un **Blocknote par Défaut spécifique** lors de la connexion.
|
|
||||||
|
|
||||||
- 👑 **Rôle Unique de Propriétaire et Hiérarchie Avancée (`owner` > `admin` > `user`)**:
|
|
||||||
- **Compte Propriétaire Protégé**: Le compte Propriétaire initial (`owner`) ne peut être supprimé ni par un administrateur ni par lui-même.
|
|
||||||
- Les administrateurs standard ne peuvent ni rétrograder ni modifier le rôle du Propriétaire.
|
|
||||||
|
|
||||||
- ⚙️ **Personnalisation du Site (Exclusif Propriétaire)**:
|
|
||||||
- Modifiez le **Titre Global de l'Application**.
|
|
||||||
- Téléversez et validez un **Favicon Haute Résolution** (minimum 64x64px) avec aperçu en temps réel.
|
|
||||||
|
|
||||||
- 🚀 **Assistant de Configuration Initiale (`first_start.php`)**:
|
|
||||||
- Installateur automatique pour configurer les identifiants MySQL, créer les tables et enregistrer les premiers utilisateurs privilégiés (`owner` et `admin`).
|
|
||||||
- Entièrement multilingue dans les 4 langues.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🚀 Guide d'Installation
|
|
||||||
|
|
||||||
### Prérequis
|
|
||||||
- Serveur Web (Apache, Nginx, ou serveur CLI intégré de PHP)
|
|
||||||
- PHP 7.4 ou 8.x (avec extension `mysqli` activée)
|
|
||||||
- MySQL 5.7+ or MariaDB 10.x+
|
|
||||||
|
|
||||||
### Installation Étape par Étape
|
|
||||||
|
|
||||||
1. **Cloner le Dépôt**:
|
|
||||||
```bash
|
|
||||||
git clone https://gitea.sld-server.org/sld-admin/sld-blocknotes.git
|
|
||||||
cd sld-blocknotes
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Démarrer le Serveur Web**:
|
|
||||||
Vous pouvez utiliser le serveur CLI intégré de PHP:
|
|
||||||
```bash
|
|
||||||
php -S localhost:8000
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Exécuter l'Assistant de Configuration**:
|
|
||||||
Ouvrez votre navigateur sur `http://localhost:8000/`.
|
|
||||||
Le système détectera le premier démarrage et ouvrira automatiquement `first_start.php`:
|
|
||||||
- Entrez les informations de votre **Base de Données MySQL** (Hôte, Nom, Utilisateur, Mot de passe).
|
|
||||||
- Configurez les identifiants du **Compte Propriétaire**.
|
|
||||||
- Configurez les identifiants du **Premier Compte Admin**.
|
|
||||||
- Cliquez sur **⚡ Terminer l'Installation et Configurer le Système**.
|
|
||||||
|
|
||||||
4. **Se Connecter**:
|
|
||||||
Une fois terminé, vous serez redirigé vers la page de connexion `index.php?page=login`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📄 Licence
|
|
||||||
|
|
||||||
Ce projet est distribué sous licence open-source [MIT License](LICENSE).
|
|
||||||
-144
@@ -1,144 +0,0 @@
|
|||||||
# 📝 sld-blocknotes - Sistema Moderno di Note a Blocchi & Gestione Comandi
|
|
||||||
|
|
||||||
> **🌐 Lingue disponibili**: [🇬🇧 English](README.md) | [🇮🇹 Italiano](README.it.md) | [🇪🇸 Español](README.es.md) | [🇫🇷 Français](README.fr.md)
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
Una potente applicazione Web moderna senza dipendenze esterne per organizzare note strutturate a blocchi, comandi di terminale, frammenti di codice ed istruzioni. Realizzata in **Pure PHP**, **Vanilla CSS**, **Vanilla JS** e **MySQL/MariaDB**.
|
|
||||||
|
|
||||||
URL Repository: [https://gitea.sld-server.org/sld-admin/sld-blocknotes](https://gitea.sld-server.org/sld-admin/sld-blocknotes)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ✨ Funzionalità Principali
|
|
||||||
|
|
||||||
- 📑 **Note a Blocchi & Sottonote Strutturate**:
|
|
||||||
- Organizza le tue note all'interno di blocknotes personalizzati.
|
|
||||||
- Le note contengono titolo, descrizione e sottonote multiple.
|
|
||||||
- **Note Richiudibili**: Le note sono ridotte di default per ottimizzare lo spazio verticale, con pulsanti globali **Espandi Tutte / Riduci Tutte**.
|
|
||||||
|
|
||||||
- ⚡ **Sottonote di Tipo Comando Terminale**:
|
|
||||||
- Rendering differenziato tra sottonote di testo generico e comandi di terminale.
|
|
||||||
- **Pulsante Copia con 1-Click**: Copia istantaneamente i comandi negli appunti con feedback visivo (`✓ Copiato!`).
|
|
||||||
- Riquadro stile IDE/Terminale ad alto contrasto con barra di scorrimento verticale ad altezza limitata.
|
|
||||||
|
|
||||||
- 🔍 **Ricerca in Tempo Reale**:
|
|
||||||
- Filtra titoli delle note, descrizioni, sottonote e contenuti dei comandi in tempo reale all'interno del blocknote aperto.
|
|
||||||
- Espande automaticamente i blocchi corrisposti durante la ricerca.
|
|
||||||
|
|
||||||
- 📥 / 💾 **Importazione ed Esportazione JSON**:
|
|
||||||
- Scarica il file JSON di ogni blocknote con un click (`export_blocknote.php`).
|
|
||||||
- Importatore JSON interattivo con supporto per il formato standard e vecchio formato array.
|
|
||||||
|
|
||||||
- 🌐 **Interfaccia Multilingua (IT, EN, ES, FR)**:
|
|
||||||
- Localizzazione completa in **Italiano 🇮🇹, English 🇬🇧, Español 🇪🇸 e Français 🇫🇷**.
|
|
||||||
- Selector di lingua rapido nella navbar per ospiti ed utenti connessi.
|
|
||||||
- La lingua preferita di ciascun utente viene salvata nel profilo DB per i futuri accessi.
|
|
||||||
|
|
||||||
- 🏠 **Pagina di Primo Accesso Personalizzabile**:
|
|
||||||
- Scegli se accedere direttamente alla **Pagina Principale (Tutti i Blocknotes)** oppure aprire un **Blocknote Predefinito specifico** al login.
|
|
||||||
|
|
||||||
- 👑 **Ruolo Unico Owner & Gerarchia Avanzata (`owner` > `admin` > `user`)**:
|
|
||||||
- **Account Owner Ineliminabile**: L'account Owner iniziale (`owner`) non può essere eliminato da nessun admin né da se stesso.
|
|
||||||
- Gli amministratori standard non possono declassare né modificare il ruolo dell'Owner.
|
|
||||||
|
|
||||||
- ⚙️ **Personalizzazione Sito (Riservato Owner)**:
|
|
||||||
- Modifica il **Titolo Globale dell'Applicazione**.
|
|
||||||
- Carica e valida la **Favicon ad Alta Risoluzione** (minimo 64x64px) con anteprima in tempo reale.
|
|
||||||
|
|
||||||
- 🚀 **Wizard di Setup Iniziale (`first_start.php`)**:
|
|
||||||
- Installatore automatico per configurare i dati di connessione MySQL, creare le tabelle ed impostare i primi utenti privilegiati (`owner` ed `admin`).
|
|
||||||
- Completamente multilingua nelle 4 lingue.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🚀 Guida all'Installazione
|
|
||||||
|
|
||||||
### Requisiti
|
|
||||||
- Server Web (Apache, Nginx, o PHP CLI server integrato)
|
|
||||||
- PHP 7.4 o 8.x (con estensione `mysqli` abilitata)
|
|
||||||
- MySQL 5.7+ o MariaDB 10.x+
|
|
||||||
|
|
||||||
### Installazione Passo-Passo
|
|
||||||
|
|
||||||
1. **Clona il Repository**:
|
|
||||||
```bash
|
|
||||||
git clone https://gitea.sld-server.org/sld-admin/sld-blocknotes.git
|
|
||||||
cd sld-blocknotes
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Avvia il Server Web**:
|
|
||||||
Puoi utilizzare il server integrato di PHP:
|
|
||||||
```bash
|
|
||||||
php -S localhost:8000
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Esegui il Wizard di Setup**:
|
|
||||||
Apri il browser su `http://localhost:8000/`.
|
|
||||||
Il sistema rileverà il primo avvio ed aprirà automaticamente `first_start.php`:
|
|
||||||
- Inserisci i dati del tuo **Database MySQL** (Host, Nome Database, Utente, Password).
|
|
||||||
- Configura le credenziali dell'**Account Owner**.
|
|
||||||
- Configura le credenziali del **Primo Account Admin**.
|
|
||||||
- Clicca su **⚡ Completa Installazione & Configura Sistema**.
|
|
||||||
|
|
||||||
4. **Accedi ed Inizia**:
|
|
||||||
Al termine del setup verrai reindirizzato alla pagina di login `index.php?page=login`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📁 Struttura del Progetto
|
|
||||||
|
|
||||||
```text
|
|
||||||
sld-blocknotes/
|
|
||||||
├── assets/
|
|
||||||
│ ├── css/
|
|
||||||
│ │ └── style.css # Design system Vanilla CSS e variabili HSL
|
|
||||||
│ └── js/
|
|
||||||
│ └── main.js # Vanilla JS per modali, note richiudibili, cerca e copia
|
|
||||||
├── blocknotes/ # Cartella di salvataggio JSON dei blocknotes
|
|
||||||
│ └── .gitkeep
|
|
||||||
├── config/
|
|
||||||
│ ├── constants.php # Definizione costanti di percorso
|
|
||||||
│ ├── db.php # Connessione MySQL, auto-migrazione e redirect installer
|
|
||||||
│ ├── functions_init.php # Router e sanificazione pagine
|
|
||||||
│ ├── init.php # Inizializzazione sistema
|
|
||||||
│ └── settings.php # Template configurazione credenziali DB
|
|
||||||
├── functions/
|
|
||||||
│ ├── auth.php # Autenticazione, permessi e protezioni Owner
|
|
||||||
│ ├── blocknotes.php # Engine CRUD JSON blocknotes ed importatore
|
|
||||||
│ ├── functions.php # Autoloader moduli funzioni
|
|
||||||
│ ├── lang.php # Dizionario di traduzione multilingua (IT, EN, ES, FR)
|
|
||||||
│ └── site_settings.php # Gestione titolo sito e favicon ad alta risoluzione
|
|
||||||
├── includes/
|
|
||||||
│ ├── head_links.php # Inclusioni CSS ed head globali
|
|
||||||
│ └── js_footer.php # Inclusioni script footer globali
|
|
||||||
├── pages/
|
|
||||||
│ ├── 404.php # Pagina non trovata
|
|
||||||
│ ├── admin_users.php # Gestione utenti admin ed impostazioni sito Owner
|
|
||||||
│ ├── db-error.php # Template errore database
|
|
||||||
│ ├── export_blocknote.php # Endpoint download JSON blocknote
|
|
||||||
│ ├── home.php # Dashboard principale dei blocknotes
|
|
||||||
│ ├── login.php # Pagina di login multilingua
|
|
||||||
│ ├── logout.php # Disconnessione sessione
|
|
||||||
│ ├── profile.php # Profilo utente, password, colori tema, lingua e landing page
|
|
||||||
│ └── view_blocknote.php # Vista dettaglio blocknote, note richiudibili e cerca
|
|
||||||
├── templates/
|
|
||||||
│ ├── footer.php # Template footer pagina
|
|
||||||
│ └── header.php # Header navbar, logo, badge utenti e selector lingua
|
|
||||||
├── .gitignore
|
|
||||||
├── first_start.php # Wizard di installazione guidata primo avvio
|
|
||||||
├── index.php # Entry point applicazione e router
|
|
||||||
├── README.md # Documentazione Principale in Inglese
|
|
||||||
├── README.it.md # Documentazione in Italiano
|
|
||||||
├── README.es.md # Documentazione in Spagnolo
|
|
||||||
└── README.fr.md # Documentazione in Francese
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📄 Licenza
|
|
||||||
|
|
||||||
Questo progetto è rilasciato sotto licenza open-source [MIT License](LICENSE).
|
|
||||||
@@ -1,144 +1,163 @@
|
|||||||
# 📝 sld-blocknotes - Modern Block-based Notes & Command Management System
|
# SLD PHP Template
|
||||||
|
|
||||||
> **🌐 Languages**: [🇬🇧 English](README.md) | [🇮🇹 Italiano](README.it.md) | [🇪🇸 Español](README.es.md) | [🇫🇷 Français](README.fr.md)
|
A lightweight and modular PHP starter framework for building plain PHP websites without heavy dependencies.
|
||||||
|
|
||||||

|
This project is designed to provide a clean structure, reusable components, and a simple initialization system to speed up development while keeping full control over the codebase.
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
A powerful, modern, zero-dependency Web application for organizing structured block notes, technical commands, code snippets, and instructions. Built with **Pure PHP**, **Vanilla CSS**, **Vanilla JS**, and **MySQL/MariaDB**.
|
|
||||||
|
|
||||||
Repository URL: [https://gitea.sld-server.org/sld-admin/sld-blocknotes](https://gitea.sld-server.org/sld-admin/sld-blocknotes)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ✨ Key Features
|
## 🚀 Features
|
||||||
|
|
||||||
- 📑 **Structured Block Notes & Subnotes**:
|
- ⚡ Lightweight and fast (no external frameworks required)
|
||||||
- Organize notes into customizable blocknotes.
|
- 📁 Clean and scalable folder structure
|
||||||
- Notes contain titles, descriptions, and multiple subnotes.
|
- 🔧 Centralized configuration system
|
||||||
- **Collapsible Notes**: Collapsed by default to maximize vertical screen space, with global **Expand All / Collapse All** buttons.
|
- 🧩 Modular templates (header, footer, includes)
|
||||||
|
- 🎨 Basic frontend setup (CSS variables, animations, JS helpers)
|
||||||
- ⚡ **Terminal Command Subnotes**:
|
- 🛠 Ready-to-use initialization system
|
||||||
- Separate rendering for generic text subnotes vs terminal command subnotes.
|
- ❌ Built-in error pages (environment & database)
|
||||||
- **1-Click Clipboard Copy**: Copy command snippets instantly with visual feedback (`✓ Copied!`).
|
|
||||||
- High-contrast dark IDE code box with max-height vertical scrolling.
|
|
||||||
|
|
||||||
- 🔍 **Real-Time Live Search**:
|
|
||||||
- Filter note titles, descriptions, subnote titles, and terminal command contents instantly inside the active blocknote view.
|
|
||||||
- Automatically expands matched note blocks during search.
|
|
||||||
|
|
||||||
- 📥 / 💾 **JSON Import & Export**:
|
|
||||||
- Download blocknote JSON files with one click (`export_blocknote.php`).
|
|
||||||
- Interactive JSON importer supporting both standard and legacy JSON formats.
|
|
||||||
|
|
||||||
- 🌐 **Multilingual Interface (IT, EN, ES, FR)**:
|
|
||||||
- Full interface localization in **Italian 🇮🇹, English 🇬🇧, Spanish 🇪🇸, and French 🇫🇷**.
|
|
||||||
- Quick navbar language selector for guests and logged-in users.
|
|
||||||
- Each user's language choice is saved to their database profile for future logins.
|
|
||||||
|
|
||||||
- 🏠 **Customizable User Landing Page**:
|
|
||||||
- Choose between launching directly into the **Main Dashboard (All Blocknotes)** or opening a **Specific Default Blocknote** upon login.
|
|
||||||
|
|
||||||
- 👑 **Single Owner Role & Advanced Hierarchy (`owner` > `admin` > `user`)**:
|
|
||||||
- **Immune Owner Account**: The initial Owner account (`owner`) cannot be deleted by any admin or by themselves.
|
|
||||||
- Owners cannot be demoted or altered by standard administrators.
|
|
||||||
|
|
||||||
- ⚙️ **Site Customization (Owner Exclusive)**:
|
|
||||||
- Change the **Global Application / Site Title**.
|
|
||||||
- Upload & validate a **High-Resolution Favicon** (min 64x64px) with real-time preview.
|
|
||||||
|
|
||||||
- 🚀 **First Start Setup Installer Wizard (`first_start.php`)**:
|
|
||||||
- Automated first-time setup wizard for configuring MySQL database credentials, creating database tables, and setting up the initial `owner` and `admin` accounts.
|
|
||||||
- Fully localized in all 4 languages.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🚀 Quickstart & Installation
|
## 📂 Project Structure
|
||||||
|
|
||||||
### Requirements
|
|
||||||
- Web Server (Apache, Nginx, or PHP built-in CLI server)
|
|
||||||
- PHP 7.4 or 8.x (with `mysqli` extension enabled)
|
|
||||||
- MySQL 5.7+ or MariaDB 10.x+
|
|
||||||
|
|
||||||
### Step-by-Step Installation
|
|
||||||
|
|
||||||
1. **Clone the Repository**:
|
|
||||||
```bash
|
|
||||||
git clone https://gitea.sld-server.org/sld-admin/sld-blocknotes.git
|
|
||||||
cd sld-blocknotes
|
|
||||||
```
|
```
|
||||||
|
.
|
||||||
2. **Start Web Server**:
|
├── admin/
|
||||||
You can serve the directory with your local Web server or use PHP's built-in server:
|
|
||||||
```bash
|
|
||||||
php -S localhost:8000
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Run Automated Setup Wizard**:
|
|
||||||
Navigate to `http://localhost:8000/` in your browser.
|
|
||||||
The system will automatically detect first-time run and launch `first_start.php`:
|
|
||||||
- Enter your **MySQL Database Credentials** (Host, Database Name, User, Password).
|
|
||||||
- Configure credentials for the **Owner Account**.
|
|
||||||
- Configure credentials for the **First Admin Account**.
|
|
||||||
- Click **⚡ Complete Installation & Configure System**.
|
|
||||||
|
|
||||||
4. **Login & Enjoy**:
|
|
||||||
After setup completes, you will be redirected to `index.php?page=login` to sign in.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📁 Directory Structure
|
|
||||||
|
|
||||||
```text
|
|
||||||
sld-blocknotes/
|
|
||||||
├── assets/
|
├── assets/
|
||||||
│ ├── css/
|
│ ├── css/
|
||||||
│ │ └── style.css # Vanilla CSS design system & HSL variables
|
│ ├── img/
|
||||||
│ └── js/
|
│ └── js/
|
||||||
│ └── main.js # Vanilla JS modals, collapsible notes, search & copy
|
|
||||||
├── blocknotes/ # Blocknotes JSON storage directory
|
|
||||||
│ └── .gitkeep
|
|
||||||
├── config/
|
├── config/
|
||||||
│ ├── constants.php # Path constants definition
|
|
||||||
│ ├── db.php # MySQL connection, auto-migration & installer redirect
|
|
||||||
│ ├── functions_init.php # Router & page sanitization
|
|
||||||
│ ├── init.php # System initialization
|
|
||||||
│ └── settings.php # Database credentials configuration template
|
|
||||||
├── functions/
|
├── functions/
|
||||||
│ ├── auth.php # Authentication, role permissions & owner protections
|
|
||||||
│ ├── blocknotes.php # Blocknote JSON CRUD engine & JSON importer
|
|
||||||
│ ├── functions.php # Function module autoloader
|
|
||||||
│ ├── lang.php # Multilingual translation dictionary (IT, EN, ES, FR)
|
|
||||||
│ └── site_settings.php # Site title & high-resolution favicon manager
|
|
||||||
├── includes/
|
├── includes/
|
||||||
│ ├── head_links.php # Global CSS & favicon head includes
|
|
||||||
│ └── js_footer.php # Global footer script includes
|
|
||||||
├── pages/
|
├── pages/
|
||||||
│ ├── 404.php # Not found page
|
|
||||||
│ ├── admin_users.php # Admin user management & Owner site settings
|
|
||||||
│ ├── db-error.php # Database error template
|
|
||||||
│ ├── export_blocknote.php # Blocknote JSON download endpoint
|
|
||||||
│ ├── home.php # Main blocknotes dashboard
|
|
||||||
│ ├── login.php # Multilingual login page
|
|
||||||
│ ├── logout.php # Session logout
|
|
||||||
│ ├── profile.php # User profile, password, theme colors, language & landing page
|
|
||||||
│ └── view_blocknote.php # Detail view for blocknotes, collapsible notes & search
|
|
||||||
├── templates/
|
├── templates/
|
||||||
│ ├── footer.php # Page footer template
|
├── themes/
|
||||||
│ └── header.php # Navbar header, logo, user badges & quick language selector
|
├── public/
|
||||||
├── .gitignore
|
├── index.php
|
||||||
├── first_start.php # Automated First Start Installation Wizard
|
└── README.md
|
||||||
├── index.php # Application entry point & router
|
|
||||||
├── README.md # Main English Documentation
|
|
||||||
├── README.it.md # Italian Documentation
|
|
||||||
├── README.es.md # Spanish Documentation
|
|
||||||
└── README.fr.md # French Documentation
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📄 License
|
## ⚙️ Configuration
|
||||||
|
|
||||||
This project is open-source software available under the [MIT License](LICENSE).
|
All core configuration is located inside the `config/` directory:
|
||||||
|
|
||||||
|
- `init.php` → Application bootstrap
|
||||||
|
- `constants.php` → Global constants
|
||||||
|
- `settings.php` → App settings
|
||||||
|
- `db.php` → Database connection
|
||||||
|
- `functions_init.php` → Function loader
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧠 How It Works
|
||||||
|
|
||||||
|
1. The application starts from `index.php`
|
||||||
|
2. Core initialization is handled by the config system
|
||||||
|
3. Templates are loaded dynamically (`header.php`, `footer.php`)
|
||||||
|
4. Pages are rendered from the `pages/` directory
|
||||||
|
5. Custom logic can be added via the `functions/` folder
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎨 Frontend
|
||||||
|
|
||||||
|
The project includes a minimal frontend setup:
|
||||||
|
|
||||||
|
### CSS System
|
||||||
|
- Variables-based color system with multiple shades
|
||||||
|
- Basic layout styles
|
||||||
|
- Animation utilities
|
||||||
|
|
||||||
|
### JavaScript
|
||||||
|
- Simple helper functions like dynamic year rendering
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠 Usage
|
||||||
|
|
||||||
|
1. Clone the repository:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/your-username/sld-php-template.git
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Move it into your web server directory
|
||||||
|
|
||||||
|
3. Configure:
|
||||||
|
- Database (`config/db.php`)
|
||||||
|
- Environment settings (`config/settings.php`)
|
||||||
|
|
||||||
|
4. Open in browser:
|
||||||
|
```
|
||||||
|
http://localhost/your-project
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 Pages
|
||||||
|
|
||||||
|
- `home.php` → Main homepage
|
||||||
|
- `db-error.php` → Database error page
|
||||||
|
- `env-error.php` → Environment error page
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧩 Templates
|
||||||
|
|
||||||
|
Reusable layout components:
|
||||||
|
|
||||||
|
- `templates/header.php`
|
||||||
|
- `templates/footer.php`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧪 Status
|
||||||
|
|
||||||
|
🚧 This project is currently in development.
|
||||||
|
New features and improvements will be added progressively.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📌 Roadmap (Planned)
|
||||||
|
|
||||||
|
- [ ] Routing system
|
||||||
|
- [ ] Theme engine
|
||||||
|
- [ ] Admin panel structure
|
||||||
|
- [ ] CLI tools
|
||||||
|
- [ ] Environment (.env) support
|
||||||
|
- [ ] Basic authentication system
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🤝 Contributing
|
||||||
|
|
||||||
|
Contributions, ideas, and feedback are welcome.
|
||||||
|
Feel free to open issues or pull requests.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📜 License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License.
|
||||||
|
See the `LICENSE` file for details.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👤 Author
|
||||||
|
|
||||||
|
Created by Simone (SLD)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💡 Philosophy
|
||||||
|
|
||||||
|
This project aims to stay:
|
||||||
|
|
||||||
|
- Simple
|
||||||
|
- Transparent
|
||||||
|
- Framework-free
|
||||||
|
- Easy to extend
|
||||||
|
|
||||||
|
No magic, just clean PHP.
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Keep blocknotes directory tracked in git while empty
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"id": "bn_6a8589d13417a",
|
||||||
|
"title": "Comandi Nginx e Server",
|
||||||
|
"username": "admin",
|
||||||
|
"created_at": "2026-08-19 10:47:45",
|
||||||
|
"updated_at": "2026-08-19 10:54:03",
|
||||||
|
"notes": [
|
||||||
|
{
|
||||||
|
"id": "note_6a8589d1343d6",
|
||||||
|
"title": "Configurazione Nginx",
|
||||||
|
"description": "Comandi principali per riavviare e testare Nginx",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_6a8589d1344ba",
|
||||||
|
"title": "Riavvia Nginx",
|
||||||
|
"type": "command",
|
||||||
|
"content": "sudo systemctl restart nginx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_6a8589d1344f5",
|
||||||
|
"title": "Note di Sicurezza",
|
||||||
|
"type": "text",
|
||||||
|
"content": "Assicurarsi che la porta 80 e 443 siano aperte sul firewall UFW."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_6a858a699ba2c",
|
||||||
|
"title": "Test2",
|
||||||
|
"description": "Questa e' una nota di prova .",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_6a858aede4049",
|
||||||
|
"title": "Prova 2",
|
||||||
|
"type": "command",
|
||||||
|
"content": "Questo e' un comando!"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,444 @@
|
|||||||
|
{
|
||||||
|
"id": "bn_positive_internet",
|
||||||
|
"title": "Positive Internet",
|
||||||
|
"username": "admin",
|
||||||
|
"created_at": "2026-08-19 10:56:45",
|
||||||
|
"updated_at": "2026-08-19 10:56:45",
|
||||||
|
"notes": [
|
||||||
|
{
|
||||||
|
"id": "note_1_6a858bed6abbd",
|
||||||
|
"title": "Login Egguburt",
|
||||||
|
"description": "Login details",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abbf",
|
||||||
|
"title": "Eggburt",
|
||||||
|
"type": "command",
|
||||||
|
"content": "I want to Admin Positive Servers!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abc0",
|
||||||
|
"title": "Timpani",
|
||||||
|
"type": "command",
|
||||||
|
"content": "I want to administer Timpani."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_3_6a858bed6abc1",
|
||||||
|
"title": "## How to connect in Timpani ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "From Eggburt: ssh timpani@timpops\r\nPassword: 99flak3\r\ntimpss 'servername'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_2_6a858bed6abcc",
|
||||||
|
"title": "Varnish",
|
||||||
|
"description": "Varnish collection of commands",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abcd",
|
||||||
|
"title": "Varnish Domain Clean Cache",
|
||||||
|
"type": "command",
|
||||||
|
"content": "varnishadm \"ban req.http.host ~ DOMAIN\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abce",
|
||||||
|
"title": "Check the varnish syntax command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "varnishd -C -f \/etc\/varnish\/default.vcl"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_3_6a858bed6abcf",
|
||||||
|
"title": "Find Spam IP",
|
||||||
|
"description": "findspam commands",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abd0",
|
||||||
|
"title": "Spam in fw-a",
|
||||||
|
"type": "command",
|
||||||
|
"content": "tail -n3000 \/var\/log\/nginx\/access.log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abd1",
|
||||||
|
"title": "Spam in Home Dir",
|
||||||
|
"type": "command",
|
||||||
|
"content": "tail -n3000 \/home\/*\/logs\/*access*log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_3_6a858bed6abd2",
|
||||||
|
"title": "Spam in App (apache2)",
|
||||||
|
"type": "command",
|
||||||
|
"content": "tail -n3000 \/var\/log\/apache2\/access.log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_4_6a858bed6abd3",
|
||||||
|
"title": "Check all kind of logs in nginx",
|
||||||
|
"type": "command",
|
||||||
|
"content": "tail -n3000 \/var\/log\/nginx\/*access*log* | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_4_6a858bed6abd4",
|
||||||
|
"title": "Clean Disks Space",
|
||||||
|
"description": "Cleaning Diskspaces for each kind of VMs",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abd5",
|
||||||
|
"title": "## Usually for App VM ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog; logrotate -vf \/etc\/logrotate.d\/apache2; logrotate -vf \/etc\/logrotate.d\/nginx; logrotate -vf \/etc\/logrotate.d\/varnish;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abd6",
|
||||||
|
"title": "## Usually for firewall VM ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog; logrotate -vf \/etc\/logrotate.d\/nginx; logrotate -vf \/etc\/logrotate.d\/varnish;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_3_6a858bed6abd7",
|
||||||
|
"title": "## PHP ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "logrotate -vf \/etc\/logrotate.d\/php5.6-fpm; logrotate -vf \/etc\/logrotate.d\/php7.3-fpm; logrotate -vf \/etc\/logrotate.d\/php7.4-fpm; logrotate -vf \/etc\/logrotate.d\/php8.1-fpm; logrotate -vf \/etc\/logrotate.d\/php8.2-fpm;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_4_6a858bed6abd8",
|
||||||
|
"title": "## ONLY BASIC ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_5_6a858bed6abd9",
|
||||||
|
"title": "VM + only apache2",
|
||||||
|
"type": "command",
|
||||||
|
"content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog; logrotate -vf \/etc\/logrotate.d\/apache2;"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_5_6a858bed6abda",
|
||||||
|
"title": "Add findspam Script",
|
||||||
|
"description": "This is the findspam from the repository.",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abdb",
|
||||||
|
"title": "Command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "apt install -y jq; echo \"\" && echo \"Checking the reachability of the server...\"; ping -c 2 -W 2 scripts.svm.picl.co.uk > \/dev\/null 2>&1 && echo \"Server reachable. Proceeding with script update.\" || { echo \"Server unreachable. Update canceled.\"; exit 1; }; for i in updatebspamscripts findspam blockspamip spamwhat nobanip unblockspams; do echo \"Updating script $i...\"; curl -s -o \/usr\/local\/sbin\/$i https:\/\/scripts.svm.picl.co.uk\/scripts\/$i.sh && chmod 700 \/usr\/local\/sbin\/$i && echo \"Script '$i' updated.\" || echo \"Error updating script '$i'.\"; done"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_6_6a858bed6abdc",
|
||||||
|
"title": "Create New Database",
|
||||||
|
"description": "Command to create new database and database use",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abdd",
|
||||||
|
"title": "## Create Databases ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "CREATE DATABASE unixuser;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abde",
|
||||||
|
"title": "# Create User For DB #",
|
||||||
|
"type": "command",
|
||||||
|
"content": "grant all privileges on `unixuser`.* to `unixuser`@'%' identified by 'password database';"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_7_6a858bed6abdf",
|
||||||
|
"title": "Rsync From Server to the other",
|
||||||
|
"description": "Command to rsync between the servers",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abe0",
|
||||||
|
"title": "## Rsync Command ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "rsync -avzP \/home\/user\/public_html\/ [email protected]:\/home\/user\/public_html\/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_8_6a858bed6abe1",
|
||||||
|
"title": "WP-CLI Commands",
|
||||||
|
"description": "Usefully commands for wp-cli. Note that you need to change \"from-website\" and \"to-website\" with the correct domain.",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abe2",
|
||||||
|
"title": "## Export DB ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp db export"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abe3",
|
||||||
|
"title": "## Change Links for wordpress ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp search-replace 'from-website.Com' 'to-website.com' --all-tables"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_3_6a858bed6abe4",
|
||||||
|
"title": "Add New User (change the '###*' strings with the correct informations)",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp user create ###USERNAME ###EMAIL@DOMAIN --role=administrator --user_pass=\"###PASSWORD\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_4_6a858bed6abe5",
|
||||||
|
"title": "Install WP-CLI (Use this as root user)",
|
||||||
|
"type": "command",
|
||||||
|
"content": "curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar; chmod +x wp-cli.phar; sudo mv wp-cli.phar \/usr\/local\/bin\/wp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_5_6a858bed6abe6",
|
||||||
|
"title": "Install varnish-cache plugin:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp plugin install varnish-http-purge\r\nwp plugin activate varnish-http-purge"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_6_6a858bed6abe7",
|
||||||
|
"title": "Configuration to add in wp-config.php for the cache plugin",
|
||||||
|
"type": "command",
|
||||||
|
"content": "define('VHP_VARNISH_IP','varnish-vip:6081');"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_7_6a858bed6abe8",
|
||||||
|
"title": "(Run as Root) Checksums verify WP CLI on all \/home folders",
|
||||||
|
"type": "command",
|
||||||
|
"content": "for u in \/home\/*; do user=$(basename \"$u\"); for d in httpdocs public_html; do if [ -d \"$u\/$d\" ] && [ -f \"$u\/$d\/wp-config.php\" ]; then echo \"=== $user ($d) ===\"; sudo -u \"$user\" -H wp --path=\"$u\/$d\" core verify-checksums; echo; fi; done; done"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_8_6a858bed6abe9",
|
||||||
|
"title": "verify checksum for a single website",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp core verify-checksums"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_9_6a858bed6abea",
|
||||||
|
"title": "restore corefiles",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp core download --version=$(wp core version) --force"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_10_6a858bed6abeb",
|
||||||
|
"title": "Create posops user",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp user create posops [email protected] --role=administrator --user_pass='P3dsfj7nYLaMxxXk'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_11_6a858bed6abec",
|
||||||
|
"title": "Cambiare la password di un utente",
|
||||||
|
"type": "command",
|
||||||
|
"content": "wp user update posops --user_pass='P3dsfj7nYLaMxxXk'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_9_6a858bed6abed",
|
||||||
|
"title": "Find Killig Process Error",
|
||||||
|
"description": "Command to check what has been killed in the VMs \/ Machine",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abee",
|
||||||
|
"title": "## How to check errors ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "grep -E '(reaper|oom)' \/var\/log\/syslog"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_10_6a858bed6abef",
|
||||||
|
"title": "Generate SSH Key",
|
||||||
|
"description": "Command to generate ssh key",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abf0",
|
||||||
|
"title": "## ED25519 ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "ssh-keygen -t ed25519"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abf1",
|
||||||
|
"title": "## RSA ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "ssh-keygen -t rsa -b 4096"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_11_6a858bed6abf2",
|
||||||
|
"title": "User Basic Auth",
|
||||||
|
"description": "How to create \/ add user for the basicauth.",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abf3",
|
||||||
|
"title": "## CREATE A FILE \/ USER (cancel existing one) ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "htpasswd -c \/etc\/nginx\/.htpasswd-name nuovo_utente"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6abf4",
|
||||||
|
"title": "## ADD EXTRA USER ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "htpasswd \/etc\/nginx\/.htpasswd-name username"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_3_6a858bed6abf5",
|
||||||
|
"title": "Block to add",
|
||||||
|
"type": "command",
|
||||||
|
"content": "auth_basic \"Restricted Access\";\r\n auth_basic_user_file \/etc\/nginx\/.htpasswd;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_4_6a858bed6abf6",
|
||||||
|
"title": "Ownership and privileges",
|
||||||
|
"type": "command",
|
||||||
|
"content": "htpassloc=\"etc\/nginx\/.htpasswd\";\r\nchown www-data:www-data $htpassloc;\r\nchmod 644 $htpassloc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_12_6a858bed6abf7",
|
||||||
|
"title": "Check DB Size",
|
||||||
|
"description": "Command to check the dimension of the databases; (needs to be specified the databases names)",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abf8",
|
||||||
|
"title": "## CHECK DB SIZE ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "SELECT table_schema AS \"Database\", ROUND(SUM(data_length + index_length) \/ 1024 \/ 1024, 2) AS \"Dimension (MB)\" FROM information_schema.tables WHERE table_schema IN (\"dbname1 \", \"dbname2\", \"dbname3\", \"dbname4\") GROUP BY table_schema;"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_13_6a858bed6abf9",
|
||||||
|
"title": "Remove Files and keep the newest one",
|
||||||
|
"description": "Change the variable keep in base to how much newest file you need to keep!",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abfa",
|
||||||
|
"title": "## REMOVE OLDEST FILES CODE ##",
|
||||||
|
"type": "command",
|
||||||
|
"content": "count=0; keep=4; echo \"### FILE THAT WILL BE REMOVED: ###\"; echo \"-------------------------------\"; for i in $(ls -t); do if [ $count -lt $keep ]; then echo \"Keeping: $i\"; else echo \"Removing $i\"; fi; ((count++)); done; echo \"-------------------------------\"; echo \"Do you wish to continue?\"; echo \"y - Yes\"; echo \"default - no\"; read check; check=${check,,}; if [ \"$check\" == \"y\" ]; then echo \"#### REMOVING FILE ####\"; echo \"-------------------------------\"; count=0; for i in $(ls -t); do if [ $count -lt $keep ]; then echo \"Keeping: $i\"; else echo \"Removed $i\"; rm \"$i\"; fi; ((count++)); done; echo \"-------------------------------\"; else echo \"Not Removed\"; fi\r\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_14_6a858bed6abfb",
|
||||||
|
"title": "Add Diskspace Command",
|
||||||
|
"description": "After increased the diskspace of the hard disk on proxmox, we can run this command to add the 100% of the diskspace to the root partition.",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abfc",
|
||||||
|
"title": "Command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "parted \/dev\/vda resizepart 1 100%; pvresize \/dev\/vda1; lvextend -l +100%FREE \/dev\/vgmain\/root; resize2fs \/dev\/vgmain\/root"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_15_6a858bed6abfd",
|
||||||
|
"title": "New Certboot Certificate",
|
||||||
|
"description": "Install new certboot Certificate",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6abfe",
|
||||||
|
"title": "Command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "certbot certonly --webroot -w \/var\/www\/html -d ###DOMAIN"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_16_6a858bed6abff",
|
||||||
|
"title": "Extract pfx key",
|
||||||
|
"description": "Use this command to extract the key and the pem files from a .pfx file.\r\nChange the variables before to run the command.",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6ac00",
|
||||||
|
"title": "Command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "PFX=\"FILE_NAME\";\r\nPASS=\"PASSWORD_PFX\";\r\nopenssl pkcs12 -in \"$PFX\" -passin pass:\"$PASS\" -nocerts -nodes -out server.key && \\\r\nopenssl pkcs12 -in \"$PFX\" -passin pass:\"$PASS\" -nokeys | \\\r\nsed -n '\/BEGIN CERTIFICATE\/,\/END CERTIFICATE\/p' > fullchain.pem\r\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_17_6a858bed6ac01",
|
||||||
|
"title": "check if the ssh-key is valid",
|
||||||
|
"description": "With this command we can check if a ssh key is valid or not",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6ac02",
|
||||||
|
"title": "Command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "FILENAME=\"path\/to\/the\/file\";\r\nssh-keygen -l -f $FILENAME;\r\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_18_6a858bed6ac03",
|
||||||
|
"title": "checking valid rules for studiorep-fw",
|
||||||
|
"description": "This command is checking which of the following rules has been accepted for the php-rules",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6ac04",
|
||||||
|
"title": "Command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "php-fpm8.3 -tt 2>&1 | grep -A50 \"\\[POOL_NAME\\]\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_19_6a858bed6ac05",
|
||||||
|
"title": "Add new VM to spa",
|
||||||
|
"description": "Use this to add the new element to the spa command. Specify the Public IP, the port and the hostname",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6ac06",
|
||||||
|
"title": "Command:",
|
||||||
|
"type": "command",
|
||||||
|
"content": "sudoedit \/home\/posops\/ansible\/hosts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_20_6a858bed6ac07",
|
||||||
|
"title": "PHP-FPM Scripts",
|
||||||
|
"description": "Script Collection for PHP-FPM",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6ac08",
|
||||||
|
"title": "Restarting all php-fpm existing",
|
||||||
|
"type": "command",
|
||||||
|
"content": "for i in \/etc\/php\/*; do version=$(basename \"$i\"); service=\"php${version}-fpm\"; if systemctl list-units --type=service --all | grep -q \"$service\"; then echo \"[ $service ]\"; systemctl restart \"$service\"; systemctl status \"$service\" | grep Active; fi; done"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_2_6a858bed6ac09",
|
||||||
|
"title": "Check the php-version for the vhost",
|
||||||
|
"type": "command",
|
||||||
|
"content": "VERSION=8.3; for i in *; do socket=$(grep -oP 'SetHandler\\s+\"proxy:unix:\\K[^|\"]+' \"$i\"); if [ -n \"$socket\" ]; then domain=$(basename \"$socket\" .sock); match=$(grep -iRl \"$domain\" \/etc\/php\/*\/fpm\/pool.d\/); if [ -n \"$match\" ]; then phpver=$(echo \"$match\" | sed -n 's|\/etc\/php\/\\([^\/]*\\)\/fpm\/.*|\\1|p' | sort -u); if echo \"$phpver\" | grep -q \"^$VERSION$\"; then echo \"[ $domain ]\"; echo \"php-fpm $phpver\"; fi; fi; fi; done"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sub_3_6a858bed6ac0a",
|
||||||
|
"title": "Check the php-version for the vhost",
|
||||||
|
"type": "command",
|
||||||
|
"content": "exver=\"7.4\" instver=\"8.4\" ; for i in $(dpkg -l *php* | awk '{print $2}' | grep $exver); do apt install php$instver${i:6} -y; done"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "note_21_6a858bed6ac0b",
|
||||||
|
"title": "ownership to 755 folder and 644 files",
|
||||||
|
"description": "Changing the ownership from 755 to the folders and 644 to the files (sub-directories included) with find + xarg in the current director.",
|
||||||
|
"subnotes": [
|
||||||
|
{
|
||||||
|
"id": "sub_1_6a858bed6ac0c",
|
||||||
|
"title": "Command",
|
||||||
|
"type": "command",
|
||||||
|
"content": "find . -type d -print0 | xargs -0 chmod 755;\r\nfind . -type f -print0 | xargs -0 chmod 644"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+2
-2
@@ -69,8 +69,8 @@ try {
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
|
||||||
$conn->query($sql_settings);
|
$conn->query($sql_settings);
|
||||||
|
|
||||||
// Seed default site settings if empty
|
// Seed default site settings if missing
|
||||||
$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', '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')");
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
+3
-3
@@ -7,9 +7,9 @@ $php_debug="off";
|
|||||||
$db_needed="yes";
|
$db_needed="yes";
|
||||||
$db_debug="yes";
|
$db_debug="yes";
|
||||||
$db_host="localhost";
|
$db_host="localhost";
|
||||||
$db_name="sld_blocknotes_db";
|
$db_name="blocknotes_db";
|
||||||
$db_user="root";
|
$db_user="simone";
|
||||||
$db_pass="";
|
$db_pass="Angela";
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// --- DON'T CHANGE ALL THE CODE BELOW!!! ---
|
// --- DON'T CHANGE ALL THE CODE BELOW!!! ---
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ $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'] ?? 'blocknotes_db');
|
||||||
$db_user = trim($_POST['db_user'] ?? '');
|
$db_user = trim($_POST['db_user'] ?? '');
|
||||||
$db_pass = $_POST['db_pass'] ?? '';
|
$db_pass = $_POST['db_pass'] ?? '';
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$conn->query($sql_settings);
|
$conn->query($sql_settings);
|
||||||
|
|
||||||
// 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', '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')");
|
||||||
|
|
||||||
// Create Owner account
|
// Create Owner account
|
||||||
@@ -160,7 +160,7 @@ if ($db_needed == "yes"){
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title><?= __('setup_title') ?> - sld-blocknotes</title>
|
<title><?= __('setup_title') ?> - Blocknotes</title>
|
||||||
<link rel="stylesheet" href="assets/css/style.css">
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
@@ -258,7 +258,7 @@ if ($db_needed == "yes"){
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="db_name"><?= __('setup_db_name') ?></label>
|
<label for="db_name"><?= __('setup_db_name') ?></label>
|
||||||
<input type="text" name="db_name" id="db_name" class="form-control" value="<?= htmlspecialchars($_POST['db_name'] ?? 'sld_blocknotes_db') ?>" required>
|
<input type="text" name="db_name" id="db_name" class="form-control" value="<?= htmlspecialchars($_POST['db_name'] ?? 'blocknotes_db') ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ foreach ($all_blocknotes as $bn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$site_title = get_site_setting('site_title', 'sld-blocknotes');
|
$site_title = get_site_setting('site_title', 'Blocknotes');
|
||||||
$site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
|
$site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,368 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../config/init.php';
|
||||||
|
|
||||||
|
$raw_json = <<<'JSON'
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "Login Egguburt",
|
||||||
|
"description": "Login details",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Eggburt",
|
||||||
|
"code": "I want to Admin Positive Servers!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Timpani",
|
||||||
|
"code": "I want to administer Timpani."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "## How to connect in Timpani ##",
|
||||||
|
"code": "From Eggburt: ssh timpani@timpops\r\nPassword: 99flak3\r\ntimpss 'servername'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Varnish",
|
||||||
|
"description": "Varnish collection of commands",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Varnish Domain Clean Cache",
|
||||||
|
"code": "varnishadm \"ban req.http.host ~ DOMAIN\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Check the varnish syntax command:",
|
||||||
|
"code": "varnishd -C -f /etc/varnish/default.vcl"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Find Spam IP",
|
||||||
|
"description": "findspam commands",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Spam in fw-a",
|
||||||
|
"code": "tail -n3000 /var/log/nginx/access.log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Spam in Home Dir",
|
||||||
|
"code": "tail -n3000 /home/*/logs/*access*log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Spam in App (apache2)",
|
||||||
|
"code": "tail -n3000 /var/log/apache2/access.log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Check all kind of logs in nginx",
|
||||||
|
"code": "tail -n3000 /var/log/nginx/*access*log* | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Clean Disks Space",
|
||||||
|
"description": "Cleaning Diskspaces for each kind of VMs",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## Usually for App VM ##",
|
||||||
|
"code": "apt clean; journalctl --vacuum-size=8M; logrotate -vf /etc/logrotate.d/rsyslog; logrotate -vf /etc/logrotate.d/apache2; logrotate -vf /etc/logrotate.d/nginx; logrotate -vf /etc/logrotate.d/varnish;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "## Usually for firewall VM ##",
|
||||||
|
"code": "apt clean; journalctl --vacuum-size=8M; logrotate -vf /etc/logrotate.d/rsyslog; logrotate -vf /etc/logrotate.d/nginx; logrotate -vf /etc/logrotate.d/varnish;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "## PHP ##",
|
||||||
|
"code": "logrotate -vf /etc/logrotate.d/php5.6-fpm; logrotate -vf /etc/logrotate.d/php7.3-fpm; logrotate -vf /etc/logrotate.d/php7.4-fpm; logrotate -vf /etc/logrotate.d/php8.1-fpm; logrotate -vf /etc/logrotate.d/php8.2-fpm;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "## ONLY BASIC ##",
|
||||||
|
"code": "apt clean; journalctl --vacuum-size=8M; logrotate -vf /etc/logrotate.d/rsyslog;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "VM + only apache2",
|
||||||
|
"code": "apt clean; journalctl --vacuum-size=8M; logrotate -vf /etc/logrotate.d/rsyslog; logrotate -vf /etc/logrotate.d/apache2;"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Add findspam Script",
|
||||||
|
"description": "This is the findspam from the repository.",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command:",
|
||||||
|
"code": "apt install -y jq; echo \"\" && echo \"Checking the reachability of the server...\"; ping -c 2 -W 2 scripts.svm.picl.co.uk > /dev/null 2>&1 && echo \"Server reachable. Proceeding with script update.\" || { echo \"Server unreachable. Update canceled.\"; exit 1; }; for i in updatebspamscripts findspam blockspamip spamwhat nobanip unblockspams; do echo \"Updating script $i...\"; curl -s -o /usr/local/sbin/$i https://scripts.svm.picl.co.uk/scripts/$i.sh && chmod 700 /usr/local/sbin/$i && echo \"Script '$i' updated.\" || echo \"Error updating script '$i'.\"; done"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Create New Database",
|
||||||
|
"description": "Command to create new database and database use",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## Create Databases ##",
|
||||||
|
"code": "CREATE DATABASE unixuser;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "# Create User For DB #",
|
||||||
|
"code": "grant all privileges on `unixuser`.* to `unixuser`@'%' identified by 'password database';"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rsync From Server to the other",
|
||||||
|
"description": "Command to rsync between the servers",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## Rsync Command ##",
|
||||||
|
"code": "rsync -avzP /home/user/public_html/ [email protected]:/home/user/public_html/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "WP-CLI Commands",
|
||||||
|
"description": "Usefully commands for wp-cli. Note that you need to change \"from-website\" and \"to-website\" with the correct domain.",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## Export DB ##",
|
||||||
|
"code": "wp db export"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "## Change Links for wordpress ##",
|
||||||
|
"code": "wp search-replace 'from-website.Com' 'to-website.com' --all-tables"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Add New User (change the '###*' strings with the correct informations)",
|
||||||
|
"code": "wp user create ###USERNAME ###EMAIL@DOMAIN --role=administrator --user_pass=\"###PASSWORD\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Install WP-CLI (Use this as root user)",
|
||||||
|
"code": "curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; chmod +x wp-cli.phar; sudo mv wp-cli.phar /usr/local/bin/wp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Install varnish-cache plugin:",
|
||||||
|
"code": "wp plugin install varnish-http-purge\r\nwp plugin activate varnish-http-purge"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Configuration to add in wp-config.php for the cache plugin",
|
||||||
|
"code": "define('VHP_VARNISH_IP','varnish-vip:6081');"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "(Run as Root) Checksums verify WP CLI on all /home folders",
|
||||||
|
"code": "for u in /home/*; do user=$(basename \"$u\"); for d in httpdocs public_html; do if [ -d \"$u/$d\" ] && [ -f \"$u/$d/wp-config.php\" ]; then echo \"=== $user ($d) ===\"; sudo -u \"$user\" -H wp --path=\"$u/$d\" core verify-checksums; echo; fi; done; done"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "verify checksum for a single website",
|
||||||
|
"code": "wp core verify-checksums"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "restore corefiles",
|
||||||
|
"code": "wp core download --version=$(wp core version) --force"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Create posops user",
|
||||||
|
"code": "wp user create posops [email protected] --role=administrator --user_pass='P3dsfj7nYLaMxxXk'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Cambiare la password di un utente",
|
||||||
|
"code": "wp user update posops --user_pass='P3dsfj7nYLaMxxXk'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Find Killig Process Error",
|
||||||
|
"description": "Command to check what has been killed in the VMs / Machine",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## How to check errors ##",
|
||||||
|
"code": "grep -E '(reaper|oom)' /var/log/syslog"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Generate SSH Key",
|
||||||
|
"description": "Command to generate ssh key",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## ED25519 ##",
|
||||||
|
"code": "ssh-keygen -t ed25519"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "## RSA ##",
|
||||||
|
"code": "ssh-keygen -t rsa -b 4096"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "User Basic Auth",
|
||||||
|
"description": "How to create / add user for the basicauth.",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## CREATE A FILE / USER (cancel existing one) ##",
|
||||||
|
"code": "htpasswd -c /etc/nginx/.htpasswd-name nuovo_utente"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "## ADD EXTRA USER ##",
|
||||||
|
"code": "htpasswd /etc/nginx/.htpasswd-name username"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Block to add",
|
||||||
|
"code": "auth_basic \"Restricted Access\";\r\n auth_basic_user_file /etc/nginx/.htpasswd;"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Ownership and privileges",
|
||||||
|
"code": "htpassloc=\"etc/nginx/.htpasswd\";\r\nchown www-data:www-data $htpassloc;\r\nchmod 644 $htpassloc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Check DB Size",
|
||||||
|
"description": "Command to check the dimension of the databases; (needs to be specified the databases names)",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## CHECK DB SIZE ##",
|
||||||
|
"code": "SELECT table_schema AS \"Database\", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS \"Dimension (MB)\" FROM information_schema.tables WHERE table_schema IN (\"dbname1 \", \"dbname2\", \"dbname3\", \"dbname4\") GROUP BY table_schema;"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Remove Files and keep the newest one",
|
||||||
|
"description": "Change the variable keep in base to how much newest file you need to keep!",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "## REMOVE OLDEST FILES CODE ##",
|
||||||
|
"code": "count=0; keep=4; echo \"### FILE THAT WILL BE REMOVED: ###\"; echo \"-------------------------------\"; for i in $(ls -t); do if [ $count -lt $keep ]; then echo \"Keeping: $i\"; else echo \"Removing $i\"; fi; ((count++)); done; echo \"-------------------------------\"; echo \"Do you wish to continue?\"; echo \"y - Yes\"; echo \"default - no\"; read check; check=${check,,}; if [ \"$check\" == \"y\" ]; then echo \"#### REMOVING FILE ####\"; echo \"-------------------------------\"; count=0; for i in $(ls -t); do if [ $count -lt $keep ]; then echo \"Keeping: $i\"; else echo \"Removed $i\"; rm \"$i\"; fi; ((count++)); done; echo \"-------------------------------\"; else echo \"Not Removed\"; fi\r\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Add Diskspace Command",
|
||||||
|
"description": "After increased the diskspace of the hard disk on proxmox, we can run this command to add the 100% of the diskspace to the root partition.",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command:",
|
||||||
|
"code": "parted /dev/vda resizepart 1 100%; pvresize /dev/vda1; lvextend -l +100%FREE /dev/vgmain/root; resize2fs /dev/vgmain/root"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "New Certboot Certificate",
|
||||||
|
"description": "Install new certboot Certificate",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command:",
|
||||||
|
"code": "certbot certonly --webroot -w /var/www/html -d ###DOMAIN"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Extract pfx key",
|
||||||
|
"description": "Use this command to extract the key and the pem files from a .pfx file.\r\nChange the variables before to run the command.",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command:",
|
||||||
|
"code": "PFX=\"FILE_NAME\";\r\nPASS=\"PASSWORD_PFX\";\r\nopenssl pkcs12 -in \"$PFX\" -passin pass:\"$PASS\" -nocerts -nodes -out server.key && \\\r\nopenssl pkcs12 -in \"$PFX\" -passin pass:\"$PASS\" -nokeys | \\\r\nsed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' > fullchain.pem\r\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "check if the ssh-key is valid",
|
||||||
|
"description": "With this command we can check if a ssh key is valid or not",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command:",
|
||||||
|
"code": "FILENAME=\"path/to/the/file\";\r\nssh-keygen -l -f $FILENAME;\r\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "checking valid rules for studiorep-fw",
|
||||||
|
"description": "This command is checking which of the following rules has been accepted for the php-rules",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command:",
|
||||||
|
"code": "php-fpm8.3 -tt 2>&1 | grep -A50 \"\\[POOL_NAME\\]\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Add new VM to spa",
|
||||||
|
"description": "Use this to add the new element to the spa command. Specify the Public IP, the port and the hostname",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command:",
|
||||||
|
"code": "sudoedit /home/posops/ansible/hosts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "PHP-FPM Scripts",
|
||||||
|
"description": "Script Collection for PHP-FPM",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Restarting all php-fpm existing",
|
||||||
|
"code": "for i in /etc/php/*; do version=$(basename \"$i\"); service=\"php${version}-fpm\"; if systemctl list-units --type=service --all | grep -q \"$service\"; then echo \"[ $service ]\"; systemctl restart \"$service\"; systemctl status \"$service\" | grep Active; fi; done"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Check the php-version for the vhost",
|
||||||
|
"code": "VERSION=8.3; for i in *; do socket=$(grep -oP 'SetHandler\\s+\"proxy:unix:\\K[^|\"]+' \"$i\"); if [ -n \"$socket\" ]; then domain=$(basename \"$socket\" .sock); match=$(grep -iRl \"$domain\" /etc/php/*/fpm/pool.d/); if [ -n \"$match\" ]; then phpver=$(echo \"$match\" | sed -n 's|/etc/php/\\([^/]*\\)/fpm/.*|\\1|p' | sort -u); if echo \"$phpver\" | grep -q \"^$VERSION$\"; then echo \"[ $domain ]\"; echo \"php-fpm $phpver\"; fi; fi; fi; done"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sub_title": "Check the php-version for the vhost",
|
||||||
|
"code": "exver=\"7.4\" instver=\"8.4\" ; for i in $(dpkg -l *php* | awk '{print $2}' | grep $exver); do apt install php$instver${i:6} -y; done"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "ownership to 755 folder and 644 files",
|
||||||
|
"description": "Changing the ownership from 755 to the folders and 644 to the files (sub-directories included) with find + xarg in the current director.",
|
||||||
|
"codes": [
|
||||||
|
{
|
||||||
|
"sub_title": "Command",
|
||||||
|
"code": "find . -type d -print0 | xargs -0 chmod 755;\r\nfind . -type f -print0 | xargs -0 chmod 644"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
JSON;
|
||||||
|
|
||||||
|
$legacy_data = json_decode($raw_json, true);
|
||||||
|
|
||||||
|
if (!is_array($legacy_data)) {
|
||||||
|
echo "ERROR: Failed to decode legacy JSON: " . json_last_error_msg() . "\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$bn_id = 'bn_positive_internet';
|
||||||
|
$new_bn = [
|
||||||
|
'id' => $bn_id,
|
||||||
|
'title' => 'Positive Internet',
|
||||||
|
'username' => 'admin',
|
||||||
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
'notes' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($legacy_data as $n_idx => $legacy_note) {
|
||||||
|
$note_id = 'note_' . ($n_idx + 1) . '_' . uniqid();
|
||||||
|
$subnotes = [];
|
||||||
|
|
||||||
|
if (isset($legacy_note['codes']) && is_array($legacy_note['codes'])) {
|
||||||
|
foreach ($legacy_note['codes'] as $s_idx => $legacy_code) {
|
||||||
|
$subnotes[] = [
|
||||||
|
'id' => 'sub_' . ($s_idx + 1) . '_' . uniqid(),
|
||||||
|
'title' => $legacy_code['sub_title'] ?? 'Comando',
|
||||||
|
'type' => 'command',
|
||||||
|
'content' => $legacy_code['code'] ?? ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_bn['notes'][] = [
|
||||||
|
'id' => $note_id,
|
||||||
|
'title' => $legacy_note['title'] ?? 'Nota',
|
||||||
|
'description' => $legacy_note['description'] ?? '',
|
||||||
|
'subnotes' => $subnotes
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
save_blocknote($new_bn);
|
||||||
|
echo "SUCCESS! Converted and saved Positive Internet blocknote with " . count($new_bn['notes']) . " notes.\n";
|
||||||
@@ -12,7 +12,7 @@ if (isset($_GET['set_lang'])) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$current_lang = get_current_lang();
|
$current_lang = get_current_lang();
|
||||||
$site_title = get_site_setting('site_title', 'sld-blocknotes');
|
$site_title = get_site_setting('site_title', 'Blocknotes');
|
||||||
$site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
|
$site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|||||||
Reference in New Issue
Block a user