config.sample.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. // Configuration for the PSA order system.
  3. //
  4. // Copy this file to config.php on the server and adjust values for your environment.
  5. // config.php is not tracked in Git (.gitignore).
  6. // Site settings
  7. define('SITE_NAME', 'Stadt Freising');
  8. define('SITE_SERVICE_NAME', 'Bestellservice');
  9. define('SITE_SERVICE_HEADER', 'Amt 32 - Öffentliche Sicherheit und Ordnung');
  10. define('SITE_DEPARTMENT_NAME', 'Amt 32 - Öffentliche Sicherheit und Ordnung');
  11. define('SITE_ADDRESS_LINE', 'Dr.-von-Daller-Straße 7, 85354 Freising');
  12. define('SITE_IMPRINT_URL', 'https://www.freising.de/impressum/');
  13. define('SITE_PRIVACY_URL', 'https://www.freising.de/datenschutz');
  14. define('SITE_FULL_NAME', SITE_NAME . ' - ' . SITE_SERVICE_HEADER);
  15. define('SITE_URL', '/shop'); // Path under web root, or '' for document root
  16. // Optional: scheme + host only (no path) for absolute links in e-mails when HTTP_HOST is wrong behind proxies.
  17. // define('SITE_CANONICAL_ORIGIN', 'https://www.example.org');
  18. // Optional: file-based rate limits (see includes/functions.php). Defaults apply if omitted.
  19. // define('ADMIN_LOGIN_RATE_LIMIT_MAX', 10);
  20. // define('ADMIN_LOGIN_RATE_LIMIT_WINDOW', 900);
  21. // define('CHECKOUT_RATE_LIMIT_MAX', 30);
  22. // define('CHECKOUT_RATE_LIMIT_WINDOW', 3600);
  23. define('DISCLAIMER_LINES', [
  24. 'Dieses System dient der internen Bestellung persönlicher Schutzausrüstung der Stadt Freising.',
  25. 'Die Bearbeitung erfolgt durch Amt 32 - Öffentliche Sicherheit und Ordnung.',
  26. ]);
  27. // Admin settings
  28. // Runtime source of truth for admin logins is data/admins.json.
  29. // Order settings
  30. define('ORDER_PREFIX', 'FS');
  31. define('ORDER_RECIPIENT_EMAIL', 'orders@example.org');
  32. define('ATTACH_ORDER_PDF_TO_ADMIN_EMAIL', true);
  33. // Email settings
  34. define('ADMIN_EMAIL', 'admin@example.org'); // Fallback for admin profile email defaults
  35. define('FROM_EMAIL', 'shop@example.org');
  36. define('FROM_NAME', SITE_FULL_NAME);
  37. // Data file paths
  38. define('DATA_DIR', __DIR__ . '/data/');
  39. define('UPLOADS_DIR', DATA_DIR . 'uploads/');
  40. define('PRODUCTS_FILE', DATA_DIR . 'products.json');
  41. define('ORDERS_FILE', DATA_DIR . 'orders.json');
  42. define('MANUAL_BACKORDERS_FILE', DATA_DIR . 'manual_backorders.json');
  43. define('ORGANIZATIONS_FILE', DATA_DIR . 'organizations.json');
  44. define('SETTINGS_FILE', DATA_DIR . 'settings.json');
  45. define('ADMINS_FILE', DATA_DIR . 'admins.json');
  46. define('CATEGORIES_FILE', DATA_DIR . 'categories.json');
  47. define('FAQ_FILE', DATA_DIR . 'faq.json');
  48. define('UPLOADS_URL', SITE_URL . '/data/uploads');
  49. // Manual update settings
  50. // Point this to the central update server's manifest.php endpoint.
  51. define('UPDATE_MANIFEST_URL', 'https://dev.med0.de/psa/updater/manifest.php');
  52. define('UPDATE_WORK_DIR', DATA_DIR . 'updates/work/');
  53. define('UPDATE_BACKUP_DIR', DATA_DIR . 'updates/backups/');
  54. // Data backup settings
  55. define('BACKUP_DIR', DATA_DIR . 'backups/');
  56. define('BACKUP_LOCAL_RETENTION', 4);
  57. define('BACKUP_AUTO_INTERVAL_SECONDS', 604800);
  58. define('BACKUP_REMOTE_TARGETS', [
  59. // [
  60. // 'name' => 'S3 Backup',
  61. // 'type' => 's3',
  62. // 'bucket' => 'example-bucket',
  63. // 'region' => 'eu-central-1',
  64. // 'prefix' => 'psa-orderform',
  65. // 'access_key' => 'AKIA...',
  66. // 'secret_key' => '...',
  67. // // Optional for S3-compatible storage:
  68. // // 'endpoint' => 'https://s3.example.org',
  69. // ],
  70. // [
  71. // 'name' => 'SFTP Backup',
  72. // 'type' => 'sftp',
  73. // 'host' => 'backup.example.org',
  74. // 'port' => 22,
  75. // 'username' => 'backup-user',
  76. // 'password' => '...',
  77. // 'path' => '/backups/psa-orderform',
  78. // ],
  79. // [
  80. // 'name' => 'Custom Backup',
  81. // 'type' => 'custom',
  82. // 'file' => __DIR__ . '/custom-backup-uploader.php',
  83. // 'callback' => 'uploadPsaOrderformBackup',
  84. // ],
  85. ]);
  86. // Session settings
  87. if (session_status() === PHP_SESSION_NONE) {
  88. $isHttps =
  89. (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
  90. (isset($_SERVER['SERVER_PORT']) &&
  91. (int) $_SERVER['SERVER_PORT'] === 443);
  92. ini_set('session.use_strict_mode', '1');
  93. ini_set('session.cookie_httponly', '1');
  94. ini_set('session.cookie_secure', $isHttps ? '1' : '0');
  95. ini_set('session.cookie_samesite', 'Lax');
  96. session_start();
  97. }