Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
?>

<script>
var rssFeedUrl = 'proxy-xml.php?url=https://blog.freecad.org/feed/';
var rssFeedUrl = 'proxy-xml.php';

var categoryImages = {
'Development Updates': 'images/Development-Updates.avif',
Expand Down
2 changes: 1 addition & 1 deletion downloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function updateLatestCategoryFromFeed(xmlUrl, titleId, bodyId, buttonId, imageId
}

updateLatestCategoryFromFeed(
'proxy-xml.php?url=https://blog.freecad.org/category/releases/feed/',
'proxy-xml.php?category=releases',
'releases-title',
'releases-description',
'releases-link',
Expand Down
2 changes: 1 addition & 1 deletion events.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function updateLatestCategoryFromFeed(xmlUrl, titleId, bodyId, buttonId, imageId
}

updateLatestCategoryFromFeed(
'proxy-xml.php?url=https://blog.freecad.org/category/events/feed/',
'proxy-xml.php?category=events',
'events-title',
'events-description',
'events-link',
Expand Down
23 changes: 10 additions & 13 deletions proxy-xml.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?php
if (isset($_GET['url'])) {
$url = $_GET['url'];

if (filter_var($url, FILTER_VALIDATE_URL)) {
$response = file_get_contents($url);

header('Content-Type: application/xml');
echo $response;
} else {
header("HTTP/1.1 400 Bad Request");
}
} else {
<?php
$category = $_REQUEST['category'] ?? '';
if (!in_array($category, ['', 'events', 'grants', 'releases'])) {
header("HTTP/1.1 400 Bad Request");
die('Unhandled category');
}

$url = 'https://blog.freecad.org'.($category != '' ? '/category/'.$category : '').'/feed/';
$response = file_get_contents($url);

header('Content-Type: application/xml');
echo $response;
2 changes: 1 addition & 1 deletion sponsor.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function updateLatestCategoryFromFeed(xmlUrl, titleId, bodyId, buttonId, imageId
}

updateLatestCategoryFromFeed(
'proxy-xml.php?url=https://blog.freecad.org/category/grants/feed/',
'proxy-xml.php?category=grants',
'grants-title',
'grants-description',
'grants-link',
Expand Down