Compare commits
12 Commits
dev
...
e370435801
| Author | SHA1 | Date | |
|---|---|---|---|
| e370435801 | |||
| 1453a8028e | |||
| ecbcfe953a | |||
| 5e89fd8b89 | |||
| 4614cd330c | |||
| 7d8760febb | |||
| 940426e45c | |||
| 78eb485ef7 | |||
| 060f05247a | |||
| e5fb838445 | |||
| 72ca358139 | |||
| 0a3de8a846 |
16
Dockerfile
16
Dockerfile
@@ -1,16 +0,0 @@
|
||||
FROM php:8.2-apache
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||
COPY htdocs/ /var/www/html/
|
||||
COPY docker/php/config.php /var/www/html/config/config.php
|
||||
RUN apt-get update && apt-get install -y \
|
||||
unzip \
|
||||
curl \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
RUN composer --version
|
||||
WORKDIR /var/www/html/admin
|
||||
RUN composer install --no-interaction
|
||||
RUN chown -R www-data:www-data /var/www/html
|
||||
RUN a2enmod rewrite
|
||||
EXPOSE 80
|
||||
39
README.md
39
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
|
||||
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')) {
|
||||
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')) {
|
||||
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')) {
|
||||
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
|
||||
}
|
||||
}
|
||||
?>
|
||||
```
|
||||
@@ -132,33 +123,9 @@ docker compose up -d --build
|
||||
```
|
||||
3. Il container dovrebbe diventare disponibile su ``http://localhost:8080``
|
||||
|
||||
### Personalizzare l'istanza
|
||||
Per cambiare le impostazioni dell'istanza basta aprire ``docker-compose.yml`` con un editor di testo e modificare le variabili d'ambiente:
|
||||
```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"]'
|
||||
```
|
||||
### Per utenti Docker avanzati
|
||||
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 la maggior parte degli utenti consigliamo di usare la configurazione per Docker predefinita.
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -7,38 +7,15 @@ services:
|
||||
depends_on:
|
||||
- db
|
||||
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:
|
||||
image: mariadb:11
|
||||
container_name: orario-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: P@ssw0rd # Password dell'utente root del database
|
||||
MYSQL_DATABASE: school_timetable # Nome del database, da impostare in DB_NAME
|
||||
MYSQL_USER: orario # Utente del database, da impostare in DB_USER
|
||||
MYSQL_PASSWORD: orario # Password del database, da impostare in DB_PASS
|
||||
MYSQL_ROOT_PASSWORD: P@ssw0rd
|
||||
MYSQL_DATABASE: school_timetable
|
||||
MYSQL_USER: orario
|
||||
MYSQL_PASSWORD: orario
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
- ./schema.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
|
||||
@@ -1,147 +1,47 @@
|
||||
<?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
|
||||
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')) {
|
||||
$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')) {
|
||||
$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')) {
|
||||
$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
|
||||
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')) {
|
||||
$val = getenv('YEAR');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('YEAR', $val);
|
||||
} else {
|
||||
define('YEAR', '2025/26');
|
||||
}
|
||||
}
|
||||
if (!defined('API_URL')) {
|
||||
$val = getenv('API_URL');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('API_URL', $val);
|
||||
} else {
|
||||
define('API_URL', '');
|
||||
}
|
||||
define('YEAR', '2025/26');
|
||||
}
|
||||
if (!defined('DEV_MODE')) {
|
||||
$val = getenv('DEV_MODE');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('DEV_MODE', $val);
|
||||
} else {
|
||||
define('DEV_MODE', false);
|
||||
}
|
||||
define('DEV_MODE', false); // Modalita' di sviluppo
|
||||
}
|
||||
// Impostazioni autenticazione dashboard amministrativa
|
||||
if (!defined('AUTH_TYPE')) {
|
||||
$val = getenv('AUTH_TYPE');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('AUTH_TYPE', $val);
|
||||
} else {
|
||||
define('AUTH_TYPE','local');
|
||||
}
|
||||
define('AUTH_TYPE','local'); // Può essere local (integrata), keycloak, google
|
||||
}
|
||||
if (!defined('APP_DOMAIN')) {
|
||||
$val = getenv('APP_DOMAIN');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('APP_DOMAIN', $val);
|
||||
} else {
|
||||
define('APP_DOMAIN','');
|
||||
}
|
||||
define('APP_DOMAIN',''); // Dominio del sito (ad esempio orario.yourdomain.com), richiesto per autenticazioni non local
|
||||
}
|
||||
// Impostazioni autenticazione via Keycloak (richiesto solo se AUTH_TYPE sta impostato su keycloak)
|
||||
if (AUTH_TYPE === 'keycloak') {
|
||||
if (!defined('KEYCLOAK_DOMAIN')) {
|
||||
$val = getenv('KEYCLOAK_DOMAIN');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('KEYCLOAK_DOMAIN', $val);
|
||||
} else {
|
||||
define('KEYCLOAK_DOMAIN','');
|
||||
}
|
||||
define('KEYCLOAK_DOMAIN',''); // Dominio di Keycloak (ad esempio auth.yourdomain.com)
|
||||
}
|
||||
if (!defined('KEYCLOAK_REALM')) {
|
||||
$val = getenv('KEYCLOAK_REALM');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('KEYCLOAK_REALM', $val);
|
||||
} else {
|
||||
define('KEYCLOAK_REALM','');
|
||||
}
|
||||
define('KEYCLOAK_REALM',''); // Realm di Keycloak (ad esempio master)
|
||||
}
|
||||
if (!defined('KEYCLOAK_CLIENT_ID')) {
|
||||
$val = getenv('KEYCLOAK_CLIENT_ID');
|
||||
if ($val !== false && $val !== '') {
|
||||
define('DB_USER', $val);
|
||||
} else {
|
||||
define('KEYCLOAK_CLIENT_ID','');
|
||||
}
|
||||
define('KEYCLOAK_CLIENT_ID',''); // Client ID per Keycloak (ad esempio orario)
|
||||
}
|
||||
if (!defined('KEYCLOAK_CLIENT_SECRET')) {
|
||||
$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);
|
||||
define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm)
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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();
|
||||
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
||||
include("../lib/db.php");
|
||||
|
||||
@@ -1,24 +1,8 @@
|
||||
<?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();
|
||||
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");
|
||||
|
||||
$message = "";
|
||||
$messageType = "";
|
||||
|
||||
@@ -26,6 +10,7 @@ $messageType = "";
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
|
||||
$classe_codice = trim($_POST['classe_codice']);
|
||||
$classe_id = intval($_POST['classe_id']);
|
||||
$api_url = trim($_POST['api_url']);
|
||||
|
||||
if (empty($classe_codice) || $classe_id === 0) {
|
||||
$message = "Compila tutti i campi obbligatori.";
|
||||
@@ -33,7 +18,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
|
||||
} else {
|
||||
try {
|
||||
// Chiama l'API Node.js
|
||||
$url = API_URL . "?classe=" . urlencode($classe_codice);
|
||||
$url = $api_url . "?classe=" . urlencode($classe_codice);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
@@ -307,6 +292,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
|
||||
<small>Codice della classe nel sistema esterno</small>
|
||||
</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;">
|
||||
🔄 Importa Orario
|
||||
</button>
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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';
|
||||
session_start();
|
||||
if (!isset($_SESSION['admin'])) {
|
||||
@@ -46,11 +30,7 @@ if (!isset($_SESSION['admin'])) {
|
||||
<a href="classes.php">Gestisci Classi</a>
|
||||
<a href="subjects.php">Gestisci Materie</a>
|
||||
<a href="timetable.php">Gestisci Orario</a>
|
||||
<?php
|
||||
if (defined(API_URL) || API_URL != "") {
|
||||
echo '<a href="importer.php" style="background: #28a745;">🔄 Importa Orario</a>';
|
||||
}
|
||||
?>
|
||||
<a href="importer.php" style="background: #28a745;">🔄 Importa Orario</a>
|
||||
<?php
|
||||
if ($_SESSION['auth_type'] === 'local') {
|
||||
echo '<a href="password.php">Cambia Password</a>';
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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;
|
||||
require 'vendor/autoload.php';
|
||||
session_start();
|
||||
@@ -80,49 +64,18 @@ else if (AUTH_TYPE === 'keycloak') {
|
||||
try {
|
||||
// Configura il client Keycloak
|
||||
$oidc = new OpenIDConnectClient(
|
||||
'https://' . KEYCLOAK_DOMAIN . '/realms/' . KEYCLOAK_REALM . '/',
|
||||
'https://' + KEYCLOAK_DOMAIN + '/realms/' + KEYCLOAK_REALM + '/',
|
||||
KEYCLOAK_CLIENT_ID,
|
||||
KEYCLOAK_CLIENT_SECRET
|
||||
);
|
||||
// Redirect post-login
|
||||
$oidc->setRedirectURL('https://' . APP_DOMAIN . '/admin/login.php');
|
||||
$oidc->setRedirectURL('https://' + APP_DOMAIN + '/admin/login.php');
|
||||
$oidc->authenticate();
|
||||
$userinfo = $oidc->getVerifiedClaims();
|
||||
if (in_array($userinfo->preferred_username, KEYCLOAK_ALLOWED_USERS, true) || empty(KEYCLOAK_ALLOWED_USERS)) {
|
||||
$_SESSION['admin'] = $userinfo->preferred_username;
|
||||
$_SESSION['auth_type'] = 'keycloak';
|
||||
header("Location: index.php");
|
||||
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;
|
||||
}
|
||||
$_SESSION['admin'] = $userinfo->preferred_username;
|
||||
$_SESSION['auth_type'] = 'keycloak';
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
echo <<<HTML
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
<?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");
|
||||
session_start();
|
||||
session_destroy();
|
||||
if (AUTH_TYPE === 'local')
|
||||
header("Location: /index.php");
|
||||
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);
|
||||
?>
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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();
|
||||
include("../lib/db.php");
|
||||
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
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 ===== */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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();
|
||||
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
||||
include("../lib/db.php");
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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();
|
||||
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
||||
include("../lib/db.php");
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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();
|
||||
include("../lib/db.php");
|
||||
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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
|
||||
if (!defined('DB_HOST')) {
|
||||
define('DB_HOST', '<MYSQL_HOST>'); // Host del database (ad esempio localhost)
|
||||
@@ -35,9 +19,6 @@ if (!defined('APP_NAME')) {
|
||||
if (!defined('YEAR')) {
|
||||
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')) {
|
||||
define('DEV_MODE', false); // Modalita' di sviluppo: abilita messaggi di debug aggiuntivi. Imposta su false se sei in produzione
|
||||
}
|
||||
@@ -62,8 +43,5 @@ if (AUTH_TYPE === 'keycloak') {
|
||||
if (!defined('KEYCLOAK_CLIENT_SECRET')) {
|
||||
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
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
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 */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
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 {
|
||||
background-color: #2c3e50;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
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 */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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");
|
||||
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
|
||||
$hours = [
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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");
|
||||
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
|
||||
$hours = [
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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';
|
||||
$host = DB_HOST;
|
||||
$user = DB_USER;
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?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
|
||||
$class_id = intval($_GET['class_id']);
|
||||
$class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc();
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
<?php
|
||||
/*
|
||||
Orario Scuola, Copyright (C) 2025 EmmeV.
|
||||
// Hashed Password Generator
|
||||
// Copyright (C) 2025 EmmeV. All rights reserved.
|
||||
// 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) {
|
||||
$primoArgomento = $argv[1];
|
||||
$password = password_hash($primoArgomento, PASSWORD_DEFAULT);
|
||||
|
||||
Reference in New Issue
Block a user