Compare commits
17 Commits
dev
...
44f29a2552
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44f29a2552 | ||
|
|
adfb14f6c7 | ||
| 03c0a975ce | |||
| 2d2583e62b | |||
| d9d16a7ae2 | |||
| e370435801 | |||
| 1453a8028e | |||
| ecbcfe953a | |||
| 5e89fd8b89 | |||
| 4614cd330c | |||
| 7d8760febb | |||
| 940426e45c | |||
| 78eb485ef7 | |||
| 060f05247a | |||
| e5fb838445 | |||
| 72ca358139 | |||
| 0a3de8a846 |
40
README.md
40
README.md
@@ -1,6 +1,3 @@
|
|||||||
## 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)
|
||||||
|
|
||||||
@@ -82,9 +79,6 @@ 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
|
||||||
}
|
}
|
||||||
@@ -109,9 +103,6 @@ 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
@@ -127,38 +118,13 @@ 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``
|
||||||
|
|
||||||
### Personalizzare l'istanza
|
### Per utenti Docker avanzati
|
||||||
Per cambiare le impostazioni dell'istanza basta aprire ``docker-compose.yml`` con un editor di testo e modificare le variabili d'ambiente:
|
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.
|
||||||
```yaml
|
Per la maggior parte degli utenti consigliamo di usare la configurazione per Docker predefinita.
|
||||||
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.
|
||||||
|
|||||||
@@ -7,38 +7,15 @@ 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 # Password dell'utente root del database
|
MYSQL_ROOT_PASSWORD: P@ssw0rd
|
||||||
MYSQL_DATABASE: school_timetable # Nome del database, da impostare in DB_NAME
|
MYSQL_DATABASE: school_timetable
|
||||||
MYSQL_USER: orario # Utente del database, da impostare in DB_USER
|
MYSQL_USER: orario
|
||||||
MYSQL_PASSWORD: orario # Password del database, da impostare in DB_PASS
|
MYSQL_PASSWORD: orario
|
||||||
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
|
||||||
|
|||||||
@@ -17,131 +17,47 @@ 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')) {
|
||||||
$val = getenv('DEV_MODE');
|
define('DEV_MODE', false); // Modalita' di sviluppo
|
||||||
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')) {
|
||||||
$val = getenv('AUTH_TYPE');
|
define('AUTH_TYPE','local'); // Può essere local (integrata), keycloak, google
|
||||||
if ($val !== false && $val !== '') {
|
|
||||||
define('AUTH_TYPE', $val);
|
|
||||||
} else {
|
|
||||||
define('AUTH_TYPE','local');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!defined('APP_DOMAIN')) {
|
if (!defined('APP_DOMAIN')) {
|
||||||
$val = getenv('APP_DOMAIN');
|
define('APP_DOMAIN',''); // Dominio del sito (ad esempio orario.yourdomain.com), richiesto per autenticazioni non local
|
||||||
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')) {
|
||||||
$val = getenv('KEYCLOAK_DOMAIN');
|
define('KEYCLOAK_DOMAIN',''); // Dominio di Keycloak (ad esempio auth.yourdomain.com)
|
||||||
if ($val !== false && $val !== '') {
|
|
||||||
define('KEYCLOAK_DOMAIN', $val);
|
|
||||||
} else {
|
|
||||||
define('KEYCLOAK_DOMAIN','');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!defined('KEYCLOAK_REALM')) {
|
if (!defined('KEYCLOAK_REALM')) {
|
||||||
$val = getenv('KEYCLOAK_REALM');
|
define('KEYCLOAK_REALM',''); // Realm di Keycloak (ad esempio master)
|
||||||
if ($val !== false && $val !== '') {
|
|
||||||
define('KEYCLOAK_REALM', $val);
|
|
||||||
} else {
|
|
||||||
define('KEYCLOAK_REALM','');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!defined('KEYCLOAK_CLIENT_ID')) {
|
if (!defined('KEYCLOAK_CLIENT_ID')) {
|
||||||
$val = getenv('KEYCLOAK_CLIENT_ID');
|
define('KEYCLOAK_CLIENT_ID',''); // Client ID per Keycloak (ad esempio orario)
|
||||||
if ($val !== false && $val !== '') {
|
|
||||||
define('DB_USER', $val);
|
|
||||||
} else {
|
|
||||||
define('KEYCLOAK_CLIENT_ID','');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!defined('KEYCLOAK_CLIENT_SECRET')) {
|
if (!defined('KEYCLOAK_CLIENT_SECRET')) {
|
||||||
$val = getenv('KEYCLOAK_CLIENT_SECRET');
|
define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm)
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -17,8 +17,8 @@ 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 = "";
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ $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.";
|
||||||
@@ -33,7 +34,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);
|
||||||
@@ -307,6 +308,13 @@ 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>
|
||||||
|
|||||||
@@ -46,11 +46,7 @@ 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>
|
||||||
<?php
|
<a href="importer.php" style="background: #28a745;">🔄 Importa Orario</a>
|
||||||
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>';
|
||||||
|
|||||||
@@ -88,41 +88,10 @@ 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
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ 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);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ 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
|
||||||
}
|
}
|
||||||
@@ -62,8 +59,5 @@ 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -15,6 +15,7 @@ GNU Affero General Public License for more details.
|
|||||||
You should have received a copy of the GNU Affero General Public License
|
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/.
|
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user