create-prisma-php-app 1.19.500 → 1.19.502

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ {
2
+ "pieces.cloudCapabilities": "Blended",
3
+ "pieces.telemetry": true
4
+ }
@@ -4,8 +4,8 @@ if (session_status() == PHP_SESSION_NONE) {
4
4
  session_start();
5
5
  }
6
6
 
7
- require_once __DIR__ . '/settings/paths.php';
8
7
  require_once __DIR__ . '/vendor/autoload.php';
8
+ require_once __DIR__ . '/settings/paths.php';
9
9
 
10
10
  use Lib\Middleware\AuthMiddleware;
11
11
  use Dotenv\Dotenv;
@@ -13,6 +13,8 @@ use Dotenv\Dotenv;
13
13
  $dotenv = Dotenv::createImmutable(\DOCUMENT_PATH);
14
14
  $dotenv->load();
15
15
 
16
+ date_default_timezone_set($_ENV['APP_TIMEZONE'] ?? 'UTC');
17
+
16
18
  function determineContentToInclude()
17
19
  {
18
20
  $scriptUrl = $_SERVER['REQUEST_URI'];
@@ -200,8 +202,8 @@ function findGroupFolder($uri): string
200
202
 
201
203
  function dynamicRoute($uri)
202
204
  {
203
- global $_filesListRoutes;
204
- global $dynamicRouteParams;
205
+ global $_filesListRoutes, $dynamicRouteParams;
206
+
205
207
  $uriMatch = null;
206
208
  $normalizedUri = ltrim(str_replace('\\', '/', $uri), './');
207
209
  $normalizedUriEdited = "src/app/$normalizedUri";
@@ -522,18 +524,20 @@ function wireCallback()
522
524
 
523
525
  function getLoadingsFiles()
524
526
  {
525
- global $_filesListRoutes;
527
+ global $_filesListRoutes, $uri, $pathname, $dynamicRouteParams, $params, $referer;
526
528
 
527
529
  $loadingFiles = array_filter($_filesListRoutes, function ($route) {
528
530
  $normalizedRoute = str_replace('\\', '/', $route);
529
- $isLoadingFile = preg_match('/\/loading\.php$/', $normalizedRoute);
530
- return $isLoadingFile;
531
+ return preg_match('/\/loading\.php$/', $normalizedRoute);
531
532
  });
532
533
 
533
- $haveLoadingFileContent = array_reduce($loadingFiles, function ($carry, $route) {
534
+ $haveLoadingFileContent = array_reduce($loadingFiles, function ($carry, $route) use ($uri, $pathname, $dynamicRouteParams, $params, $referer) {
534
535
  $normalizeUri = str_replace('\\', '/', $route);
535
536
  $fileUrl = str_replace('./src/app', '', $normalizeUri);
536
- $content = @file_get_contents($route);
537
+
538
+ ob_start();
539
+ include($route); // This will execute the PHP code in loading.php
540
+ $content = ob_get_clean();
537
541
 
538
542
  if ($content !== false) {
539
543
  $url = $fileUrl === '/loading.php' ? '/' : str_replace('/loading.php', '', $fileUrl);