<?php
// EditorJS ImageTool byUrl endpoint — just validates & returns the URL as-is
session_start();
header('Content-Type: application/json');
if (!isset($_SESSION['admin_logged_in'])) {
    echo json_encode(['success' => 0, 'message' => 'Unauthorized']);
    exit;
}
$url = trim($_POST['url'] ?? '');
if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
    echo json_encode(['success' => 0, 'message' => 'Invalid URL']);
    exit;
}
echo json_encode(['success' => 1, 'file' => ['url' => $url]]);
