Compare commits

..

59 Commits

Author SHA1 Message Date
theitaliandeveloper
a7a77ebe85 Finish compose and add license comments 2025-12-02 12:22:34 +01:00
65d8c208bf Variabili dentro il file compose e alcuni fix 2025-12-02 10:50:35 +01:00
738811c0f3 Fix configs. 2025-11-24 18:47:37 +01:00
94955a0a42 Get api endpoint from config, not from user input. 2025-11-24 18:34:35 +01:00
theitaliandeveloper
3595e0049e Aggiornare il readme, cosa che dimentico sempre 2025-11-17 11:13:29 +01:00
theitaliandeveloper
9c2ea5b8ff Login Keycloak solo per utenti autorizzati 2025-11-14 11:44:52 +01:00
cf4cb2679b Fix anche qui 2025-11-01 11:41:11 +01:00
4881b824eb Rimosso materia completa 2025-11-01 10:30:52 +01:00
5053db033f Nome della materia corto 2025-11-01 10:24:01 +01:00
59359d33d3 Piccolo fix + importatore da ITIS 2025-10-31 16:51:30 +01:00
54e3818ce6 Fix ore da mobile 2025-10-30 18:24:50 +01:00
56503f618d Readme change 2025-10-30 17:42:43 +01:00
f4122ca342 Fixiamo del codice con del codice non testato 2025-10-30 17:00:17 +01:00
bd3d23a8f8 Riproviamoci dai 2025-10-30 08:55:52 +01:00
04497f56d1 Prova 2025-10-30 08:54:05 +01:00
d998c39778 CSS Testing 2025-10-30 08:48:25 +01:00
081348ef8d CSS Testing 2025-10-30 08:46:01 +01:00
dc159ea173 CSS Testing 2025-10-30 08:43:59 +01:00
1adb7b3a26 CSS Testing 2025-10-30 08:41:44 +01:00
79b4ec78f3 CSS Testing 2025-10-30 08:40:24 +01:00
4f0caf1f52 CSS Testing 2025-10-30 08:38:20 +01:00
e1be9c2b4e Aula -> Laboratorio 2025-10-30 08:31:56 +01:00
48092b7f75 Readme 2025-10-30 08:28:55 +01:00
721cfc386d I don't care about Google SSO 2025-10-30 08:26:16 +01:00
70c7c0d6b9 Fixing untested code with more untested code
Interamente fatto con Claude AI Pro, se ne vedranno delle belle...
2025-10-29 18:42:15 +01:00
f561aa8de5 Update README.md 2025-10-10 11:04:56 +00:00
f800f0ab7f Merge pull request 'Se ce la mandano buona abbiamo un orario decente su telefono.' (#4) from daniele/orario:dev into dev
Reviewed-on: #4
2025-10-04 17:46:39 +00:00
9c9c26a470 Se ce la mandano buona abbiamo un orario decente su telefono. 2025-10-04 19:38:39 +02:00
40da7d0d58 Rimosse schifezze varie 2025-10-03 17:23:01 +02:00
0561902092 revert f91019b884
revert Aggiornamento README.md
2025-10-03 15:19:13 +00:00
8c8d32e0c8 sono impedito e mi dimentico del readme 2025-10-03 10:17:27 +02:00
35ff83d1d0 Introduzione modalita' sviluppatore e vari change 2025-10-03 10:15:25 +02:00
f91019b884 Aggiornamento README.md 2025-10-03 09:03:18 +02:00
6b5b05199c prova di integrazione SSO Google + riscrizionamento di alcune parti 2025-10-03 09:01:59 +02:00
dc1d07c015 fix CSS 2025-10-02 12:01:42 +02:00
d405a0e21c troppe modifiche, non so cosa scrivere 2025-10-02 11:54:59 +02:00
f68162b80b some changes 2025-10-02 08:51:47 +00:00
f98f5a3c07 changes, finishing later 2025-10-02 09:45:24 +02:00
7249325faf fixes 2025-10-02 09:23:38 +02:00
b599691c2e Manage users 2025-10-02 09:17:32 +02:00
8a37f24b40 design fix 2025-10-01 17:10:20 +02:00
725518ca8a move error message 2025-10-01 17:09:19 +02:00
cbf6ef27a2 design fix and add back to link 2025-10-01 17:07:54 +02:00
9c936ed3be how fucking much can I be dumb?? 2025-10-01 16:59:18 +02:00
c3f8b52990 fucking readme 2025-10-01 16:57:57 +02:00
4de8528da2 fix 2025-10-01 16:57:39 +02:00
0265af9dd2 Change password feature (maybe) 2025-10-01 16:55:28 +02:00
e8079c2ce7 fix 2025-10-01 16:33:26 +02:00
fb72f23544 Readme 2025-10-01 15:50:13 +02:00
ddfa3d6dd8 Docker 2025-10-01 15:49:06 +02:00
c619b748fa Docker image integration (beta) 2025-10-01 15:42:34 +02:00
906beaaa4b Integrated auth by default 2025-10-01 15:15:28 +02:00
86826c86bb Merge pull request 'Fixing mobile view and improving some menus.' (#3) from daniele/orario:dev into dev
Reviewed-on: #3
2025-09-27 16:10:38 +00:00
79a4823726 Fixing mobile view and improving some menus. 2025-09-27 18:06:46 +02:00
459663e069 Update README.md 2025-09-22 08:50:14 +00:00
ccbb9806f5 Testo del copyright 2025-09-11 10:30:21 +02:00
07b197c89a Link al codice sorgente 2025-09-11 10:21:10 +02:00
fff1e6cddf altra piccola modifica 2025-09-11 09:58:22 +02:00
9c044b051c Piccola modifica 2025-09-11 09:29:59 +02:00
23 changed files with 545 additions and 40 deletions

View File

@@ -1,3 +1,6 @@
## AVVISO IMPORTANTE
Questo è il ramo di SVILUPPO. È inteso per testare le ultime funzionalità e aiutarmi nello sviluppo. La stabilità e il funzionamento del codice non sono garantiti. Usare a proprio rischio e pericolo.
# Orario Scuola # Orario Scuola
Una piattaforma web per visualizzare gli orari scolastici delle classi, degli insegnanti e dei vari laboratori (se presenti) Una piattaforma web per visualizzare gli orari scolastici delle classi, degli insegnanti e dei vari laboratori (se presenti)
@@ -79,6 +82,9 @@ if (!defined('APP_NAME')) {
if (!defined('YEAR')) { if (!defined('YEAR')) {
define('YEAR', '2025/26'); // Anno Scolastico Corrente define('YEAR', '2025/26'); // Anno Scolastico Corrente
} }
if (!defined('API_URL')) {
define('API_URL', ''); // URL API di importazione, lascia vuoto per disabilitare. Esempio: http://localhost:3006/classe
}
if (!defined('DEV_MODE')) { if (!defined('DEV_MODE')) {
define('DEV_MODE', false); // Modalita' di sviluppo: abilita messaggi di debug aggiuntivi. Imposta su false se sei in produzione define('DEV_MODE', false); // Modalita' di sviluppo: abilita messaggi di debug aggiuntivi. Imposta su false se sei in produzione
} }
@@ -103,6 +109,9 @@ if (AUTH_TYPE === 'keycloak') {
if (!defined('KEYCLOAK_CLIENT_SECRET')) { if (!defined('KEYCLOAK_CLIENT_SECRET')) {
define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm) define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm)
} }
if (!defined('KEYCLOAK_ALLOWED_USERS')) {
define('KEYCLOAK_ALLOWED_USERS',[]); // Contiene i nomi utente degli utenti autorizzati ad accedere all'amministrazione
}
} }
?> ?>
``` ```
@@ -118,13 +127,38 @@ curl -fsSL https://get.docker.com | bash
```bash ```bash
git clone https://git.vichingo455.freeddns.org/emmev-code/orario git clone https://git.vichingo455.freeddns.org/emmev-code/orario
cd orario cd orario
git checkout dev # richiesto per passare alla versione di sviluppo
docker compose up -d --build docker compose up -d --build
``` ```
3. Il container dovrebbe diventare disponibile su ``http://localhost:8080`` 3. Il container dovrebbe diventare disponibile su ``http://localhost:8080``
### Per utenti Docker avanzati ### Personalizzare l'istanza
Se sei un utente Docker avanzato e vuoi personalizzare puoi modificare la configurazione di docker nei file ``docker/php/config.php``, ``docker-compose.yml`` e ``Dockerfile`` per adattare tutto al tuo ambiente. Per cambiare le impostazioni dell'istanza basta aprire ``docker-compose.yml`` con un editor di testo e modificare le variabili d'ambiente:
Per la maggior parte degli utenti consigliamo di usare la configurazione per Docker predefinita. ```yaml
environment:
# --- Configuratione Database ---
DB_HOST: db # Host database
DB_USER: orario # Utente database
DB_PASS: orario # Password dell'utente del database
DB_NAME: school_timetable # Nome del database
# --- Impostazioni sito ---
APP_NAME: "Orario Scuola" # Nome del sito
YEAR: "2025/26" # Anno scolastico corrente
API_URL: "" # URL della API per l'importazione, lascia vuoto per disabilitare
DEV_MODE: "false" # Abilita modalita' di sviluppo per output dettagliato.
# --- Impostazioni Autenticazione ---
AUTH_TYPE: "local" # Tipo di autenticazione: può essere local o keycloak
APP_DOMAIN: "" # Dominio dell'app, ad esempio orario.tuosito.com
# --- Impostazioni di Keycloak (solo se il tipo di autenticazione è Keycloak) ---
KEYCLOAK_DOMAIN: "" # Dominio di Keycloak, ad esempio sso.tuosito.com
KEYCLOAK_REALM: "" # Realm di Keycloak, ad esempio master
KEYCLOAK_CLIENT_ID: "" # Client ID per Keycloak, ad esempio orario
KEYCLOAK_CLIENT_SECRET: "" # Client Secret per Keycloak, ad esempio abcde12345
KEYCLOAK_ALLOWED_USERS: '[]' # Nomi utente che possono accedere al pannello di controllo, lascia vuoto per consentire tutti gli utenti. Esempio: '["admin","prof","segreteria"]'
```
## Segnalare un problema ## Segnalare un problema
Per segnalare un problema puoi usare [Bugzilla](https://bugs.vichingo455.freeddns.org/describecomponents.cgi?product=Orario%20Scuola). Clicca [qui](https://bugs.vichingo455.freeddns.org/describecomponents.cgi?product=Orario%20Scuola) per andare a Bugzilla. Per segnalare un problema puoi usare [Bugzilla](https://bugs.vichingo455.freeddns.org/describecomponents.cgi?product=Orario%20Scuola). Clicca [qui](https://bugs.vichingo455.freeddns.org/describecomponents.cgi?product=Orario%20Scuola) per andare a Bugzilla.

View File

@@ -7,15 +7,38 @@ services:
depends_on: depends_on:
- db - db
restart: unless-stopped restart: unless-stopped
environment:
# --- Configuratione Database ---
DB_HOST: db # Host database
DB_USER: orario # Utente database
DB_PASS: orario # Password dell'utente del database
DB_NAME: school_timetable # Nome del database
# --- Impostazioni sito ---
APP_NAME: "Orario Scuola" # Nome del sito
YEAR: "2025/26" # Anno scolastico corrente
API_URL: "" # URL della API per l'importazione, lascia vuoto per disabilitare
DEV_MODE: "false" # Abilita modalita' di sviluppo per output dettagliato.
# --- Impostazioni Autenticazione ---
AUTH_TYPE: "local" # Tipo di autenticazione: può essere local o keycloak
APP_DOMAIN: "" # Dominio dell'app, ad esempio orario.tuosito.com
# --- Impostazioni di Keycloak (solo se il tipo di autenticazione è Keycloak) ---
KEYCLOAK_DOMAIN: "" # Dominio di Keycloak, ad esempio sso.tuosito.com
KEYCLOAK_REALM: "" # Realm di Keycloak, ad esempio master
KEYCLOAK_CLIENT_ID: "" # Client ID per Keycloak, ad esempio orario
KEYCLOAK_CLIENT_SECRET: "" # Client Secret per Keycloak, ad esempio abcde12345
KEYCLOAK_ALLOWED_USERS: '[]' # Nomi utente che possono accedere al pannello di controllo, lascia vuoto per consentire tutti gli utenti. Esempio: '["admin","prof","segreteria"]'
db: db:
image: mariadb:11 image: mariadb:11
container_name: orario-db container_name: orario-db
restart: unless-stopped restart: unless-stopped
environment: environment:
MYSQL_ROOT_PASSWORD: P@ssw0rd MYSQL_ROOT_PASSWORD: P@ssw0rd # Password dell'utente root del database
MYSQL_DATABASE: school_timetable MYSQL_DATABASE: school_timetable # Nome del database, da impostare in DB_NAME
MYSQL_USER: orario MYSQL_USER: orario # Utente del database, da impostare in DB_USER
MYSQL_PASSWORD: orario MYSQL_PASSWORD: orario # Password del database, da impostare in DB_PASS
volumes: volumes:
- db_data:/var/lib/mysql - db_data:/var/lib/mysql
- ./schema.sql:/docker-entrypoint-initdb.d/init.sql:ro - ./schema.sql:/docker-entrypoint-initdb.d/init.sql:ro

View File

@@ -1,47 +1,147 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
// Impostazioni Database // Impostazioni Database
if (!defined('DB_HOST')) { if (!defined('DB_HOST')) {
$val = getenv('DB_HOST');
if ($val !== false && $val !== '') {
define('DB_HOST', $val);
} else {
define('DB_HOST', 'db'); define('DB_HOST', 'db');
}
} }
if (!defined('DB_USER')) { if (!defined('DB_USER')) {
$val = getenv('DB_USER');
if ($val !== false && $val !== '') {
define('DB_USER', $val);
} else {
define('DB_USER', 'orario'); define('DB_USER', 'orario');
}
} }
if (!defined('DB_PASS')) { if (!defined('DB_PASS')) {
$val = getenv('DB_PASS');
if ($val !== false && $val !== '') {
define('DB_PASS', $val);
} else {
define('DB_PASS', 'orario'); define('DB_PASS', 'orario');
}
} }
if (!defined('DB_NAME')) { if (!defined('DB_NAME')) {
$val = getenv('DB_NAME');
if ($val !== false && $val !== '') {
define('DB_NAME', $val);
} else {
define('DB_NAME', 'school_timetable'); define('DB_NAME', 'school_timetable');
}
} }
// Impostazioni sito generali // Impostazioni sito generali
if (!defined('APP_NAME')) { if (!defined('APP_NAME')) {
$val = getenv('APP_NAME');
if ($val !== false && $val !== '') {
define('APP_NAME', $val);
} else {
define('APP_NAME', 'Orario Scuola'); define('APP_NAME', 'Orario Scuola');
}
} }
if (!defined('YEAR')) { if (!defined('YEAR')) {
$val = getenv('YEAR');
if ($val !== false && $val !== '') {
define('YEAR', $val);
} else {
define('YEAR', '2025/26'); define('YEAR', '2025/26');
}
}
if (!defined('API_URL')) {
$val = getenv('API_URL');
if ($val !== false && $val !== '') {
define('API_URL', $val);
} else {
define('API_URL', '');
}
} }
if (!defined('DEV_MODE')) { if (!defined('DEV_MODE')) {
define('DEV_MODE', false); // Modalita' di sviluppo $val = getenv('DEV_MODE');
if ($val !== false && $val !== '') {
define('DEV_MODE', $val);
} else {
define('DEV_MODE', false);
}
} }
// Impostazioni autenticazione dashboard amministrativa // Impostazioni autenticazione dashboard amministrativa
if (!defined('AUTH_TYPE')) { if (!defined('AUTH_TYPE')) {
define('AUTH_TYPE','local'); // Può essere local (integrata), keycloak, google $val = getenv('AUTH_TYPE');
if ($val !== false && $val !== '') {
define('AUTH_TYPE', $val);
} else {
define('AUTH_TYPE','local');
}
} }
if (!defined('APP_DOMAIN')) { if (!defined('APP_DOMAIN')) {
define('APP_DOMAIN',''); // Dominio del sito (ad esempio orario.yourdomain.com), richiesto per autenticazioni non local $val = getenv('APP_DOMAIN');
if ($val !== false && $val !== '') {
define('APP_DOMAIN', $val);
} else {
define('APP_DOMAIN','');
}
} }
// Impostazioni autenticazione via Keycloak (richiesto solo se AUTH_TYPE sta impostato su keycloak) // Impostazioni autenticazione via Keycloak (richiesto solo se AUTH_TYPE sta impostato su keycloak)
if (AUTH_TYPE === 'keycloak') { if (AUTH_TYPE === 'keycloak') {
if (!defined('KEYCLOAK_DOMAIN')) { if (!defined('KEYCLOAK_DOMAIN')) {
define('KEYCLOAK_DOMAIN',''); // Dominio di Keycloak (ad esempio auth.yourdomain.com) $val = getenv('KEYCLOAK_DOMAIN');
if ($val !== false && $val !== '') {
define('KEYCLOAK_DOMAIN', $val);
} else {
define('KEYCLOAK_DOMAIN','');
}
} }
if (!defined('KEYCLOAK_REALM')) { if (!defined('KEYCLOAK_REALM')) {
define('KEYCLOAK_REALM',''); // Realm di Keycloak (ad esempio master) $val = getenv('KEYCLOAK_REALM');
if ($val !== false && $val !== '') {
define('KEYCLOAK_REALM', $val);
} else {
define('KEYCLOAK_REALM','');
}
} }
if (!defined('KEYCLOAK_CLIENT_ID')) { if (!defined('KEYCLOAK_CLIENT_ID')) {
define('KEYCLOAK_CLIENT_ID',''); // Client ID per Keycloak (ad esempio orario) $val = getenv('KEYCLOAK_CLIENT_ID');
if ($val !== false && $val !== '') {
define('DB_USER', $val);
} else {
define('KEYCLOAK_CLIENT_ID','');
}
} }
if (!defined('KEYCLOAK_CLIENT_SECRET')) { if (!defined('KEYCLOAK_CLIENT_SECRET')) {
define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm) $val = getenv('KEYCLOAK_CLIENT_SECRET');
if ($val !== false && $val !== '') {
define('KEYCLOAK_CLIENT_SECRET', $val);
} else {
define('KEYCLOAK_CLIENT_SECRET','');
}
}
if (!defined('KEYCLOAK_ALLOWED_USERS')) {
$json = getenv('USERS');
if ($json === false || trim($json) === '') {
define('KEYCLOAK_ALLOWED_USERS',[]);
}
$users = json_decode($json, true);
if (json_last_error() !== JSON_ERROR_NONE) {
define('KEYCLOAK_ALLOWED_USERS',[]);
}
define('KEYCLOAK_ALLOWED_USERS',$users);
} }
} }
?> ?>

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
session_start(); session_start();
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
include("../lib/db.php"); include("../lib/db.php");

View File

@@ -1,8 +1,24 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
session_start(); session_start();
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
else if (!defined(API_URL) || API_URL == "") { header("Location: index.php"); exit; }
include("../lib/db.php"); include("../lib/db.php");
$message = ""; $message = "";
$messageType = ""; $messageType = "";
@@ -10,7 +26,6 @@ $messageType = "";
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) { if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
$classe_codice = trim($_POST['classe_codice']); $classe_codice = trim($_POST['classe_codice']);
$classe_id = intval($_POST['classe_id']); $classe_id = intval($_POST['classe_id']);
$api_url = trim($_POST['api_url']);
if (empty($classe_codice) || $classe_id === 0) { if (empty($classe_codice) || $classe_id === 0) {
$message = "Compila tutti i campi obbligatori."; $message = "Compila tutti i campi obbligatori.";
@@ -18,7 +33,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
} else { } else {
try { try {
// Chiama l'API Node.js // Chiama l'API Node.js
$url = $api_url . "?classe=" . urlencode($classe_codice); $url = API_URL . "?classe=" . urlencode($classe_codice);
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
@@ -292,13 +307,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
<small>Codice della classe nel sistema esterno</small> <small>Codice della classe nel sistema esterno</small>
</div> </div>
<div class="form-group">
<label for="api_url">URL API Node.js</label>
<input type="text" name="api_url" id="api_url"
value="http://localhost:3006/classe" required>
<small>Endpoint dell'API Node.js per lo scraping</small>
</div>
<button type="submit" name="import" style="width: 100%; padding: 12px; font-size: 16px;"> <button type="submit" name="import" style="width: 100%; padding: 12px; font-size: 16px;">
🔄 Importa Orario 🔄 Importa Orario
</button> </button>

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
include_once __DIR__ . '/../config/config.php'; include_once __DIR__ . '/../config/config.php';
session_start(); session_start();
if (!isset($_SESSION['admin'])) { if (!isset($_SESSION['admin'])) {
@@ -30,7 +46,11 @@ if (!isset($_SESSION['admin'])) {
<a href="classes.php">Gestisci Classi</a> <a href="classes.php">Gestisci Classi</a>
<a href="subjects.php">Gestisci Materie</a> <a href="subjects.php">Gestisci Materie</a>
<a href="timetable.php">Gestisci Orario</a> <a href="timetable.php">Gestisci Orario</a>
<a href="importer.php" style="background: #28a745;">🔄 Importa Orario</a> <?php
if (defined(API_URL) || API_URL != "") {
echo '<a href="importer.php" style="background: #28a745;">🔄 Importa Orario</a>';
}
?>
<?php <?php
if ($_SESSION['auth_type'] === 'local') { if ($_SESSION['auth_type'] === 'local') {
echo '<a href="password.php">Cambia Password</a>'; echo '<a href="password.php">Cambia Password</a>';

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
use Jumbojett\OpenIDConnectClient; use Jumbojett\OpenIDConnectClient;
require 'vendor/autoload.php'; require 'vendor/autoload.php';
session_start(); session_start();
@@ -72,10 +88,41 @@ else if (AUTH_TYPE === 'keycloak') {
$oidc->setRedirectURL('https://' . APP_DOMAIN . '/admin/login.php'); $oidc->setRedirectURL('https://' . APP_DOMAIN . '/admin/login.php');
$oidc->authenticate(); $oidc->authenticate();
$userinfo = $oidc->getVerifiedClaims(); $userinfo = $oidc->getVerifiedClaims();
if (in_array($userinfo->preferred_username, KEYCLOAK_ALLOWED_USERS, true) || empty(KEYCLOAK_ALLOWED_USERS)) {
$_SESSION['admin'] = $userinfo->preferred_username; $_SESSION['admin'] = $userinfo->preferred_username;
$_SESSION['auth_type'] = 'keycloak'; $_SESSION['auth_type'] = 'keycloak';
header("Location: index.php"); header("Location: index.php");
exit; exit;
} else {
http_response_code(403);
echo <<<HTML
<!DOCTYPE html>
<html>
<head>
<title>Login Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="navbar">
<div class="logo">Admin Dashboard</div>
<div class="links">
<a href="/">Torna al sito</a>
</div>
</div>
<!-- Container login -->
<div class="login-container">
<h1>Login Admin</h1>
<br><div class='error'>Non sei autorizzato ad accedere a questa parte del sito.</div>
</div>
<p style="text-align: center;">Copyright (C) 2025 EmmeV. - Released under <a href="https://git.vichingo455.freeddns.org/emmev-code/orario/src/branch/stable/LICENSE.txt" target="_blank">GNU AGPL 3.0 License</a>.</p>
</body>
</html>
HTML;
exit;
}
} catch (Exception $e) { } catch (Exception $e) {
http_response_code(500); http_response_code(500);
echo <<<HTML echo <<<HTML

View File

@@ -1,9 +1,25 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
include("../config/config.php"); include("../config/config.php");
session_start(); session_start();
session_destroy(); session_destroy();
if (AUTH_TYPE === 'local') if (AUTH_TYPE === 'local')
header("Location: /index.php"); header("Location: /index.php");
else if (AUTH_TYPE === 'keycloak') else if (AUTH_TYPE === 'keycloak')
header('Location: https://' . KEYCLOAK_DOMAIN . '/realms/' . KEYCLOAK_REALM . '/protocol/openid-connect/logout?post_logout_redirect_uri=https://' . APP_DOMAIN . '&client_id=' . KEYCLOAK_CLIENT_ID); header('Location: https://' . KEYCLOAK_DOMAIN . '/realms/' . KEYCLOAK_REALM . '/protocol/openid-connect/logout?post_logout_redirect_uri=https://' . APP_DOMAIN + '&client_id=' . KEYCLOAK_CLIENT_ID);
?> ?>

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
session_start(); session_start();
include("../lib/db.php"); include("../lib/db.php");

View File

@@ -1,3 +1,19 @@
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
/* ===== BASE ===== */ /* ===== BASE ===== */
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
session_start(); session_start();
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
include("../lib/db.php"); include("../lib/db.php");

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
session_start(); session_start();
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
include("../lib/db.php"); include("../lib/db.php");

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
session_start(); session_start();
include("../lib/db.php"); include("../lib/db.php");

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
// Impostazioni Database // Impostazioni Database
if (!defined('DB_HOST')) { if (!defined('DB_HOST')) {
define('DB_HOST', '<MYSQL_HOST>'); // Host del database (ad esempio localhost) define('DB_HOST', '<MYSQL_HOST>'); // Host del database (ad esempio localhost)
@@ -19,6 +35,9 @@ if (!defined('APP_NAME')) {
if (!defined('YEAR')) { if (!defined('YEAR')) {
define('YEAR', '2025/26'); // Anno Scolastico Corrente define('YEAR', '2025/26'); // Anno Scolastico Corrente
} }
if (!defined('API_URL')) {
define('API_URL', ''); // URL API di importazione, lascia vuoto per disabilitare. Esempio: http://localhost:3006/classe
}
if (!defined('DEV_MODE')) { if (!defined('DEV_MODE')) {
define('DEV_MODE', false); // Modalita' di sviluppo: abilita messaggi di debug aggiuntivi. Imposta su false se sei in produzione define('DEV_MODE', false); // Modalita' di sviluppo: abilita messaggi di debug aggiuntivi. Imposta su false se sei in produzione
} }
@@ -43,5 +62,8 @@ if (AUTH_TYPE === 'keycloak') {
if (!defined('KEYCLOAK_CLIENT_SECRET')) { if (!defined('KEYCLOAK_CLIENT_SECRET')) {
define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm) define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm)
} }
if (!defined('KEYCLOAK_ALLOWED_USERS')) {
define('KEYCLOAK_ALLOWED_USERS',[]); // Contiene i nomi utente degli utenti autorizzati ad accedere all'amministrazione
}
} }
?> ?>

View File

@@ -1,3 +1,19 @@
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
/* Base styles */ /* Base styles */
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;

View File

@@ -1,3 +1,19 @@
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
/* Navbar */ /* Navbar */
.navbar { .navbar {
background-color: #2c3e50; background-color: #2c3e50;

View File

@@ -1,3 +1,19 @@
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
/* Base styles */ /* Base styles */
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
include("lib/db.php"); include("lib/db.php");
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]; $days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
$hours = [ $hours = [

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
include("lib/db.php"); include("lib/db.php");
?> ?>
<!DOCTYPE html> <!DOCTYPE html>

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
include("lib/db.php"); include("lib/db.php");
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]; $days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
$hours = [ $hours = [

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
include_once __DIR__ . '/../config/config.php'; include_once __DIR__ . '/../config/config.php';
$host = DB_HOST; $host = DB_HOST;
$user = DB_USER; $user = DB_USER;

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
Orario Scuola, Copyright (C) 2025 EmmeV.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
include("lib/db.php"); // FIX: Decommentato include("lib/db.php"); // FIX: Decommentato
$class_id = intval($_GET['class_id']); $class_id = intval($_GET['class_id']);
$class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc(); $class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc();

View File

@@ -1,9 +1,20 @@
<?php <?php
// Hashed Password Generator /*
// Copyright (C) 2025 EmmeV. All rights reserved. Orario Scuola, Copyright (C) 2025 EmmeV.
// Usage: php generate_hash.php password_to_hash
// Example: php generate_hash.php admin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
*/
if ($argc > 1) { if ($argc > 1) {
$primoArgomento = $argv[1]; $primoArgomento = $argv[1];
$password = password_hash($primoArgomento, PASSWORD_DEFAULT); $password = password_hash($primoArgomento, PASSWORD_DEFAULT);