Update: 2026-05-15 17:50:52
This commit is contained in:
@@ -1,13 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
// Minimal public verification
|
||||||
* Public Invoice Verification Page
|
if (!defined('ROOT_PATH')) define('ROOT_PATH', realpath(dirname(__DIR__, 2)));
|
||||||
* GET /v1/verify?id=INVOICE_ID
|
|
||||||
*/
|
// Load Env manually
|
||||||
|
$envFile = '/home/intaleqapp-musadaq/env/.env';
|
||||||
|
if (!file_exists($envFile)) $envFile = ROOT_PATH . '/.env';
|
||||||
|
if (file_exists($envFile)) {
|
||||||
|
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (str_starts_with(trim($line), '#')) continue;
|
||||||
|
$parts = explode('=', $line, 2);
|
||||||
|
if (count($parts) === 2) {
|
||||||
|
$n = trim($parts[0]); $v = trim($parts[1], " \t\n\r\0\x0B\"'");
|
||||||
|
$_ENV[$n] = $v; $_SERVER[$n] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use App\Core\Database;
|
use App\Core\Database;
|
||||||
use App\Core\Encryption;
|
use App\Core\Encryption;
|
||||||
|
|
||||||
// die('REACHED VERIFY'); // Debug
|
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$invoiceId = $_GET['id'] ?? null;
|
$invoiceId = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ error_log("Router: Resolved route '{$route}'");
|
|||||||
|
|
||||||
// Route map: route => [allowed_method, module_file]
|
// Route map: route => [allowed_method, module_file]
|
||||||
$routes = [
|
$routes = [
|
||||||
|
'v.php' => ['GET', '../public/v.php'],
|
||||||
'verify' => ['GET', 'invoices/verify_public.php'],
|
'verify' => ['GET', 'invoices/verify_public.php'],
|
||||||
'v1/auth/login' => ['POST', 'auth/login.php'],
|
'v1/auth/login' => ['POST', 'auth/login.php'],
|
||||||
'v1/auth/refresh' => ['POST', 'auth/refresh.php'],
|
'v1/auth/refresh' => ['POST', 'auth/refresh.php'],
|
||||||
|
|||||||
35
public/v.php
35
public/v.php
@@ -1,15 +1,38 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
// Barebones verification script
|
||||||
* Standalone Public Invoice Verification Page
|
define('ROOT_PATH', realpath(dirname(__DIR__)));
|
||||||
* Bypass index.php router to avoid any accidental redirects.
|
define('APP_PATH', ROOT_PATH . '/app');
|
||||||
*/
|
|
||||||
|
|
||||||
// 1. Load Bootstrap
|
// Minimal autoload for Core classes
|
||||||
require_once __DIR__ . '/../app/bootstrap/init.php';
|
spl_autoload_register(function ($class) {
|
||||||
|
$file = ROOT_PATH . '/' . str_replace('\\', '/', $class) . '.php';
|
||||||
|
if (file_exists($file)) require $file;
|
||||||
|
});
|
||||||
|
|
||||||
use App\Core\Database;
|
use App\Core\Database;
|
||||||
use App\Core\Encryption;
|
use App\Core\Encryption;
|
||||||
|
|
||||||
|
// Load Environment variables manually if needed
|
||||||
|
$envFile = '/home/intaleqapp-musadaq/env/.env';
|
||||||
|
if (!file_exists($envFile)) $envFile = ROOT_PATH . '/.env';
|
||||||
|
if (file_exists($envFile)) {
|
||||||
|
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (str_starts_with(trim($line), '#')) continue;
|
||||||
|
$parts = explode('=', $line, 2);
|
||||||
|
if (count($parts) === 2) {
|
||||||
|
$n = trim($parts[0]); $v = trim($parts[1], " \t\n\r\0\x0B\"'");
|
||||||
|
$_ENV[$n] = $v; $_SERVER[$n] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// die('V.PHP REACHED'); // Debug point
|
||||||
|
header('X-Debug-V: Reached');
|
||||||
|
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$invoiceId = $_GET['id'] ?? null;
|
$invoiceId = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user