fix custom rss feed for customers on dashboard

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-10-17 19:30:58 +02:00
parent b4ba8f9225
commit c91047bb62
2 changed files with 16 additions and 6 deletions

View File

@@ -120,23 +120,33 @@ class Ajax
// Check for simplexml_load_file
if (!function_exists("simplexml_load_file")) {
return $this->errorResponse(
return $this->errorResponse([
"Newsfeed not available due to missing php-simplexml extension",
"Please install the php-simplexml extension in order to view our newsfeed."
);
]);
}
// Check for curl_version
if (!function_exists('curl_version')) {
return $this->errorResponse(
return $this->errorResponse([
"Newsfeed not available due to missing php-curl extension",
"Please install the php-curl extension in order to view our newsfeed."
);
]);
}
$output = HttpClient::urlGet($feed);
$news = simplexml_load_string(trim($output));
if ($news === false) {
$err = [];
foreach(libxml_get_errors() as $error) {
$err[] = $error->message;
}
return $this->errorResponse(
$err
);
}
// Handle items
if ($news) {
$items = null;

View File

@@ -280,10 +280,10 @@
{% endif %}
{% if (get_setting('admin.show_news_feed') == 1 and userinfo.adminsession == 1) or (get_setting('customer.show_news_feed') == 1 and userinfo.adminsession == 0) %}
<div id="newsfeed" class="card">
<div id="newsfeed" class="card"{% if userinfo.adminsession == 0 %}data-role="customer"{% endif %}>
<div class="card-header">
<i class="fa-solid fa-info-circle me-1"></i>
Froxlor Newsfeed
{% if get_setting('customer.news_feed_url') is empty %}Froxlor {% endif %}Newsfeed
</div>
<div class="list-group list-group-flush" id="newsfeeditems">
<div class="list-group-item d-flex justify-content-between align-items-start">