Skip to content

Commit b89bf4a

Browse files
CopilotRello
andcommitted
Add enterprise version endpoint returning JSON
Co-authored-by: Rello <[email protected]>
1 parent c5069ea commit b89bf4a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

index.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,28 @@
99
require_once __DIR__ . '/vendor/autoload.php';
1010
require_once __DIR__ . '/src/Response.php';
1111

12+
// Check if this is a request for the enterprise version endpoint
13+
if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] === '/enterprise-version') {
14+
// Set Content-Type to JSON
15+
header('Content-Type: application/json');
16+
// Enforce browser based XSS filters
17+
header('X-XSS-Protection: 1; mode=block');
18+
// Disable sniffing the content type for IE
19+
header('X-Content-Type-Options: nosniff');
20+
// Disallow iFraming from other domains
21+
header('X-Frame-Options: Sameorigin');
22+
// https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag
23+
header('X-Robots-Tag: none');
24+
25+
// Extract enterpriseVersion from the config file by parsing it
26+
$configContent = file_get_contents(__DIR__ . '/config/config.php');
27+
preg_match('/\$enterpriseVersion\s*=\s*[\'"]([^\'"]+)[\'"]/', $configContent, $matches);
28+
$enterpriseVersion = isset($matches[1]) ? $matches[1] : null;
29+
30+
echo json_encode(['enterpriseVersion' => $enterpriseVersion]);
31+
exit();
32+
}
33+
1234
// Set Content-Type to XML
1335
header('Content-Type: application/xml');
1436
// Enforce browser based XSS filters

0 commit comments

Comments
 (0)