Some important fix

This commit is contained in:
novgorodschi catalin
2026-08-10 10:34:49 +03:00
parent da58de16b4
commit d325fce01f
9 changed files with 64 additions and 24 deletions
+5 -1
View File
@@ -13,7 +13,11 @@
// #299: load CSRF helpers + admin_deny() before the access check below.
require_once(__DIR__ . '/../csrf.php');
session_start();
// csrf.php porneste deja sesiunea; un al doilea apel doar genereaza un Notice.
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
include_once("../../config.php");
include_once("../../Database.php");
+17
View File
@@ -45,6 +45,23 @@ if ( !defined('AUTOMATION_MANUAL_RUN') ) {
}
}
/**
* Automation.php presupunea ca apelantul a inclus deja config.php. Cand nu era
* asa (de exemplu inclus din alt context), Database.php dadea eroare fatala:
* Undefined constant "SQL_SERVER"
*
* Il incarcam noi daca lipseste. include_once nu-l aduce de doua ori.
*/
if (!defined('SQL_SERVER')) {
$automationConfig = __DIR__ . '/config.php';
if (is_file($automationConfig)) {
include_once($automationConfig);
} elseif (is_file(__DIR__ . '/../config.php')) {
include_once(__DIR__ . '/../config.php');
}
}
include_once("Database.php");
include_once("Data/buidata.php");
include_once("Data/unitdata.php");
+3 -1
View File
@@ -578,7 +578,9 @@ class Units {
$j = 1;
for ( $i = $start; $i <= $end; $i ++ ) {
$units[] = $i;
$amounts[] = $post[ 't' . $j . '' ];
// Formularul trimite doar casutele completate; o unitate necompletata
// inseamna zero trupe din tipul acela.
$amounts[] = isset($post['t'.$j]) ? $post['t'.$j] : 0;
$modes[] = 0;
$j ++;
}