mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
fix(partage): smtp view missing in schema + thanks redirect broken
- Add v_smtp_active VIEW to schema.sql (was only in migration 012,
causing SmtpRelay::isConfigured() to always return false on fresh installs)
- Change thanks redirect from /partage/thanks.php to /partage/thanks
(nginx 'location ~ \.php$ { deny all }' blocked the .php URL)
- Route /partage/thanks in index.php before slug validation
- Guard App::boot() in thanks.php to avoid double-boot when included
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -9,4 +9,5 @@
|
|||||||
- [x] Lock body scroll on all pages (admin + public); only `main` or inner element scrolls
|
- [x] Lock body scroll on all pages (admin + public); only `main` or inner element scrolls
|
||||||
- [x] Unify form CSS between admin `add.php` and student partage form: move licence/share-badge styles into `admin.css`, remove inline `<style>` from `partage/index.php`, switch to `common.css` + `admin.css`
|
- [x] Unify form CSS between admin `add.php` and student partage form: move licence/share-badge styles into `admin.css`, remove inline `<style>` from `partage/index.php`, switch to `common.css` + `admin.css`
|
||||||
- [x] Extract form CSS into `form.css`; load it in admin add/edit via `$extraCss` and in student partage form directly; `system.css` now only used by `system.php`; `partage/thanks.php` rewritten to use design-system classes
|
- [x] Extract form CSS into `form.css`; load it in admin add/edit via `$extraCss` and in student partage form directly; `system.css` now only used by `system.php`; `partage/thanks.php` rewritten to use design-system classes
|
||||||
|
- [x] Fix student form: add missing `v_smtp_active` view to `schema.sql` (SMTP was silently skipped on fresh installs); fix `thanks.php` redirect (was `/partage/thanks.php` — blocked by nginx PHP deny rule); route `/partage/thanks` through `index.php` special-case handler
|
||||||
- [x] Fix student form scroll (add `overflow-y:auto` to `.student-body`); move all remaining inline styles from partage error/password-gate pages into `form.css`
|
- [x] Fix student form scroll (add `overflow-y:auto` to `.student-body`); move all remaining inline styles from partage error/password-gate pages into `form.css`
|
||||||
|
|||||||
@@ -21,6 +21,13 @@ $parts = explode('/', $path);
|
|||||||
$slug = $parts[0] ?? '';
|
$slug = $parts[0] ?? '';
|
||||||
$action = $parts[1] ?? '';
|
$action = $parts[1] ?? '';
|
||||||
|
|
||||||
|
// Special route: /partage/thanks?id=N
|
||||||
|
if ($slug === 'thanks' || $slug === 'thanks.php') {
|
||||||
|
App::boot();
|
||||||
|
require_once __DIR__ . '/thanks.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Validate slug format: YYYYMMDD-XXXXXXXX (17 chars)
|
// Validate slug format: YYYYMMDD-XXXXXXXX (17 chars)
|
||||||
if (!preg_match('#^\d{8}-[A-Z0-9+/]{8}$#', $slug)) {
|
if (!preg_match('#^\d{8}-[A-Z0-9+/]{8}$#', $slug)) {
|
||||||
App::boot();
|
App::boot();
|
||||||
@@ -481,7 +488,7 @@ function handleShareLinkSubmission(string $slug): void
|
|||||||
$_SESSION['share_email_sent'] = $emailSent;
|
$_SESSION['share_email_sent'] = $emailSent;
|
||||||
|
|
||||||
// Redirect to thanks page
|
// Redirect to thanks page
|
||||||
header('Location: /partage/thanks.php?id=' . urlencode((string)$thesisId));
|
header('Location: /partage/thanks?id=' . urlencode((string)$thesisId));
|
||||||
exit();
|
exit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
error_log('Share link submission error: ' . $e->getMessage());
|
error_log('Share link submission error: ' . $e->getMessage());
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
* Thanks page for share-link submissions.
|
* Thanks page for share-link submissions.
|
||||||
* Displays a centered confirmation with a link to create another thesis via the same link.
|
* Displays a centered confirmation with a link to create another thesis via the same link.
|
||||||
*/
|
*/
|
||||||
require_once __DIR__ . '/../../bootstrap.php';
|
if (!defined('APP_ROOT')) {
|
||||||
|
require_once __DIR__ . '/../../bootstrap.php';
|
||||||
App::boot();
|
App::boot();
|
||||||
|
}
|
||||||
|
|
||||||
$thesisId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
$thesisId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
|
|
||||||
|
|||||||
@@ -341,6 +341,9 @@ CREATE TABLE IF NOT EXISTS smtp_settings (
|
|||||||
|
|
||||||
INSERT OR IGNORE INTO smtp_settings (id) VALUES (1);
|
INSERT OR IGNORE INTO smtp_settings (id) VALUES (1);
|
||||||
|
|
||||||
|
CREATE VIEW IF NOT EXISTS v_smtp_active AS
|
||||||
|
SELECT * FROM smtp_settings WHERE id = 1;
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- APROPOS CONTENTS (structured data for the "À propos" page)
|
-- APROPOS CONTENTS (structured data for the "À propos" page)
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user