Files
html/api/ambre-wtp-wire.php
opus 758b8409a0
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
auto-sync-0405
2026-04-22 04:05:02 +02:00

58 lines
1.9 KiB
PHP

<?php
header("Content-Type: application/json");
$path = "/var/www/html/weval-technology-platform.html";
$c = @file_get_contents($path);
if (strpos($c, "dashboards-hub-unified") !== false) {
echo json_encode(["already"=>true]);
exit;
}
// Add the link in banner (find "Arsenal History" or similar anchor)
// Use safer approach: add a link block AFTER <body> or before first </div>
// Find the existing banner Mega/Arsenal link
$anchors = [
"href=\"/dashboards-index.html\"" => "AFTER",
"href=\"/e2e-dashboard.html\"" => "BEFORE",
];
$injected = false;
foreach ($anchors as $anchor => $where) {
$pos = strpos($c, $anchor);
if ($pos !== false) {
// Find surrounding <a> element boundary
$a_start = strrpos(substr($c, 0, $pos), "<a ");
if ($a_start !== false) {
// End of the </a>
$a_end = strpos($c, "</a>", $pos);
if ($a_end !== false) {
$a_end += 4;
$link_html = "<a href=\"/dashboards-hub-unified.html\" style=\"display:inline-flex;align-items:center;gap:6px;padding:6px 12px;background:linear-gradient(135deg,#4338ca,#6366f1);color:#fff;border-radius:6px;text-decoration:none;font-size:12px;font-weight:500;margin-right:8px\">📊 Hub Unifié</a>";
if ($where === "BEFORE") {
$new_c = substr($c, 0, $a_start) . $link_html . substr($c, $a_start);
} else {
$new_c = substr($c, 0, $a_end) . $link_html . substr($c, $a_end);
}
$c = $new_c;
$injected = true;
break;
}
}
}
}
if (!$injected) {
echo json_encode(["error"=>"no anchor found to inject link"]);
exit;
}
$backup = "/opt/wevads/vault/wtp.GOLD-" . date("Ymd-His") . "-wave246-hub";
@copy($path, $backup);
$wrote = @file_put_contents($path, $c);
echo json_encode([
"wrote" => $wrote,
"size" => strlen($c),
"backup" => basename($backup),
]);