mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-09-25 01:53:03 +02:00
Reintroduce TFE duration metadata: DB columns, form fields, controllers, views, and migration
Add 'unsafe-eval' to CSP script-src directives (htmx requires Function())
This commit is contained in:
+10
-14
@@ -41,18 +41,7 @@ class Database
|
||||
*/
|
||||
private function runMigrations(): void
|
||||
{
|
||||
// Add 'name' column to share_links if missing
|
||||
try {
|
||||
$this->pdo->exec('ALTER TABLE share_links ADD COLUMN name TEXT');
|
||||
} catch (\PDOException $e) {
|
||||
// Column already exists — ignore
|
||||
}
|
||||
// Add 'locked_year' column to share_links if missing
|
||||
try {
|
||||
$this->pdo->exec('ALTER TABLE share_links ADD COLUMN locked_year INTEGER');
|
||||
} catch (\PDOException $e) {
|
||||
// Column already exists — ignore
|
||||
}
|
||||
(new DatabaseMigrations($this->pdo))->run();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2037,7 +2026,7 @@ class Database
|
||||
public function getThesisRawFields(int $thesisId): ?array
|
||||
{
|
||||
$stmt = $this->pdo->prepare(
|
||||
'SELECT license_id, license_custom, access_type_id, context_note, contact_visible, remarks, jury_points, exemplaire_baiu, exemplaire_erg, cc2r, is_published FROM theses WHERE id = ? LIMIT 1'
|
||||
'SELECT license_id, license_custom, access_type_id, context_note, contact_visible, remarks, jury_points, exemplaire_baiu, exemplaire_erg, cc2r, duration_value, duration_unit, is_published FROM theses WHERE id = ? LIMIT 1'
|
||||
);
|
||||
$stmt->execute([$thesisId]);
|
||||
$row = $stmt->fetch();
|
||||
@@ -2181,6 +2170,8 @@ class Database
|
||||
exemplaire_baiu = ?,
|
||||
exemplaire_erg = ?,
|
||||
cc2r = ?,
|
||||
duration_value = ?,
|
||||
duration_unit = ?,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = ?
|
||||
");
|
||||
@@ -2212,6 +2203,8 @@ class Database
|
||||
!empty($data['exemplaire_baiu']) ? 1 : 0,
|
||||
!empty($data['exemplaire_erg']) ? 1 : 0,
|
||||
!empty($data['cc2r']) ? 1 : 0,
|
||||
isset($data['duration_value']) && $data['duration_value'] !== '' ? (float)$data['duration_value'] : null,
|
||||
!empty($data['duration_unit']) ? $data['duration_unit'] : 'pages',
|
||||
$thesisId,
|
||||
]);
|
||||
$stmt->execute($params);
|
||||
@@ -2262,8 +2255,9 @@ class Database
|
||||
remarks, jury_points,
|
||||
exemplaire_baiu, exemplaire_erg,
|
||||
cc2r,
|
||||
duration_value, duration_unit,
|
||||
submitted_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, "draft", ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, "draft", ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
||||
');
|
||||
|
||||
$validObjet = ['tfe', 'thèse', 'frart'];
|
||||
@@ -2296,6 +2290,8 @@ class Database
|
||||
!empty($data['exemplaire_baiu']) ? 1 : 0,
|
||||
!empty($data['exemplaire_erg']) ? 1 : 0,
|
||||
!empty($data['cc2r']) ? 1 : 0,
|
||||
isset($data['duration_value']) && $data['duration_value'] !== '' ? (float)$data['duration_value'] : null,
|
||||
!empty($data['duration_unit']) ? $data['duration_unit'] : 'pages',
|
||||
]);
|
||||
|
||||
$newId = (int)$this->pdo->lastInsertId();
|
||||
|
||||
Reference in New Issue
Block a user