Skip to content

Commit

Permalink
crud
Browse files Browse the repository at this point in the history
  • Loading branch information
asilvafx committed Dec 29, 2024
1 parent a9a1276 commit 589ca0d
Show file tree
Hide file tree
Showing 4 changed files with 305 additions and 234 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ package-lock.json
.env
*.local
*.lock
app/vendor
app/vendor/*
public/manifest/*

# Editor directories and files
.vscode/*
Expand Down
18 changes: 11 additions & 7 deletions app/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

// Load api routes
$f3->route('GET|POST|PUT|DELETE /v1/@slug', 'Api->Base');
$f3->route('GET|PUT|DELETE /v1/@slug/@search/@value', 'Api->Base');
$f3->route('GET|PUT|DELETE /v1/@slug/@search', 'Api->Base');

// Load WebAuthn Routes
$f3->route('GET|POST /web/authn/attestation/options', 'WebAuthn->Options');
Expand Down Expand Up @@ -199,19 +199,23 @@
);

// Get 2 char lang code
$lang2 = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$lang2 = $f3->get('SITE.lang');

// Set default language if a `$lang` version of site is not available
if (!in_array($lang2, array_keys($languages))) {
$lang2 = $f3->get('SITE.lang');
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$lang2 = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
// Set default language if a `$lang` version of site is not available
if (!in_array($lang2, array_keys($languages))) {
$lang2 = $f3->get('SITE.lang');
}
}

if (is_null($f3->get('SESSION.locale')) || empty($f3->get('SESSION.locale'))) {
if (empty($f3->get('SESSION.locale'))) {
// Auto site translation
$f3->set('SESSION.locale', $languages[$lang2]);
$f3->set('SESSION.locale', $lang2);
}

$f3->set('YearNow', date("Y"));


// Load application
$f3->run();
Loading

0 comments on commit 589ca0d

Please sign in to comment.