Initial commit

This commit is contained in:
Ronald Huynen
2026-03-23 21:37:59 +01:00
commit 2547717edb
2193 changed files with 972171 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Symfony\Component\HttpFoundation\Response;
class StaticController extends Controller
{
/**
* Download the full privacy policy for the current locale
*/
public function downloadPrivacyPolicy(Request $request)
{
$locale = app()->getLocale();
$platform = config('timebank-cc.platform_name', env('TIMEBANK_CONFIG', 'timebank_cc'));
// Get the base path for GDPR references
$basePath = base_path("references/gdpr/{$platform}");
// Find the most recent date folder
$dateFolders = File::directories($basePath);
if (empty($dateFolders)) {
abort(404, 'Privacy policy not found');
}
// Sort folders by name (dates in YYYY-MM-DD format) descending
rsort($dateFolders);
$latestFolder = $dateFolders[0];
// Construct the file path
$fileName = "privacy-policy-FULL-{$locale}.md";
$filePath = "{$latestFolder}/{$fileName}";
if (!File::exists($filePath)) {
abort(404, 'Privacy policy not found for this language');
}
// Return the file as a download
return response()->download($filePath, $fileName, [
'Content-Type' => 'text/markdown',
]);
}
}