create-prisma-php-app 1.15.29 → 1.15.30
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.
package/dist/.htaccess
CHANGED
|
@@ -15,7 +15,7 @@ RewriteEngine On
|
|
|
15
15
|
</IfModule>
|
|
16
16
|
|
|
17
17
|
# Exclude static files from being redirected
|
|
18
|
-
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|ico|pdf)$ [NC]
|
|
18
|
+
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|svg|webp|woff|woff2|ttf|eot|ico|pdf)$ [NC]
|
|
19
19
|
RewriteCond %{REQUEST_URI} !^/bootstrap.php
|
|
20
20
|
RewriteRule ^(.*)$ bootstrap.php [QSA,L]
|
|
21
21
|
|
package/dist/bootstrap.php
CHANGED
|
@@ -415,75 +415,68 @@ function convertToArrayObject($data)
|
|
|
415
415
|
return $data;
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
function wireCallback(
|
|
418
|
+
function wireCallback()
|
|
419
419
|
{
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
'success' => true,
|
|
452
|
-
'response' => htmlspecialchars($callbackResponse)
|
|
453
|
-
];
|
|
454
|
-
} else {
|
|
455
|
-
// Handle non-string responses
|
|
456
|
-
$response = [
|
|
457
|
-
'success' => true,
|
|
458
|
-
'response' => $callbackResponse
|
|
459
|
-
];
|
|
460
|
-
}
|
|
420
|
+
try {
|
|
421
|
+
// Read input data
|
|
422
|
+
$input = file_get_contents('php://input');
|
|
423
|
+
$data = json_decode($input, true);
|
|
424
|
+
|
|
425
|
+
// Initialize response
|
|
426
|
+
$response = [
|
|
427
|
+
'success' => false,
|
|
428
|
+
'error' => 'Callback not provided',
|
|
429
|
+
'data' => $data
|
|
430
|
+
];
|
|
431
|
+
|
|
432
|
+
// Validate and call the dynamic function
|
|
433
|
+
if (isset($data['callback'])) {
|
|
434
|
+
// Sanitize and create a dynamic function name
|
|
435
|
+
$callbackName = preg_replace('/[^a-zA-Z0-9_]/', '', $data['callback']); // Sanitize
|
|
436
|
+
|
|
437
|
+
// Check if the dynamic function is defined and callable
|
|
438
|
+
if (function_exists($callbackName) && is_callable($callbackName)) {
|
|
439
|
+
$dataObject = convertToArrayObject($data);
|
|
440
|
+
|
|
441
|
+
// Call the anonymous function dynamically
|
|
442
|
+
$callbackResponse = call_user_func($callbackName, $dataObject);
|
|
443
|
+
|
|
444
|
+
// Ensure the callback response is a string
|
|
445
|
+
if (is_string($callbackResponse)) {
|
|
446
|
+
// Prepare success response
|
|
447
|
+
$response = [
|
|
448
|
+
'success' => true,
|
|
449
|
+
'response' => htmlspecialchars($callbackResponse)
|
|
450
|
+
];
|
|
461
451
|
} else {
|
|
462
|
-
//
|
|
463
|
-
$response
|
|
452
|
+
// Handle non-string responses
|
|
453
|
+
$response = [
|
|
454
|
+
'success' => true,
|
|
455
|
+
'response' => $callbackResponse
|
|
456
|
+
];
|
|
464
457
|
}
|
|
458
|
+
} else {
|
|
459
|
+
// Invalid callback provided
|
|
460
|
+
$response['error'] = 'Invalid callback';
|
|
465
461
|
}
|
|
466
|
-
|
|
467
|
-
if (!empty($response['response'])) echo json_encode($response);
|
|
468
|
-
|
|
469
|
-
if (isset($data['secondRequestC69CD']) && $data['secondRequestC69CD'] === true)
|
|
470
|
-
echo $content;
|
|
471
|
-
} catch (Throwable $e) {
|
|
472
|
-
// Handle any exceptions and prepare error response
|
|
473
|
-
$response = [
|
|
474
|
-
'success' => false,
|
|
475
|
-
'error' => 'Exception occurred',
|
|
476
|
-
'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8'),
|
|
477
|
-
'file' => htmlspecialchars($e->getFile(), ENT_QUOTES, 'UTF-8'),
|
|
478
|
-
'line' => $e->getLine()
|
|
479
|
-
];
|
|
480
|
-
|
|
481
|
-
// Output the error response
|
|
482
|
-
echo json_encode($response);
|
|
483
462
|
}
|
|
484
463
|
|
|
485
|
-
|
|
464
|
+
if (!empty($response['response'])) echo json_encode($response);
|
|
465
|
+
} catch (Throwable $e) {
|
|
466
|
+
// Handle any exceptions and prepare error response
|
|
467
|
+
$response = [
|
|
468
|
+
'success' => false,
|
|
469
|
+
'error' => 'Exception occurred',
|
|
470
|
+
'message' => htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8'),
|
|
471
|
+
'file' => htmlspecialchars($e->getFile(), ENT_QUOTES, 'UTF-8'),
|
|
472
|
+
'line' => $e->getLine()
|
|
473
|
+
];
|
|
474
|
+
|
|
475
|
+
// Output the error response
|
|
476
|
+
echo json_encode($response);
|
|
486
477
|
}
|
|
478
|
+
|
|
479
|
+
exit;
|
|
487
480
|
}
|
|
488
481
|
|
|
489
482
|
try {
|
|
@@ -543,7 +536,8 @@ try {
|
|
|
543
536
|
|
|
544
537
|
if (!$_isContentIncluded && !$_isChildContentIncluded) {
|
|
545
538
|
$content .= $childContent;
|
|
546
|
-
|
|
539
|
+
if ($isWire && !isset($data['secondRequestC69CD']))
|
|
540
|
+
wireCallback();
|
|
547
541
|
ob_start();
|
|
548
542
|
require_once APP_PATH . '/layout.php';
|
|
549
543
|
} else {
|