<commit_before><?php
/*
 * rss.widget.php
 *
 * part of pfSense (https://www.pfsense.org)
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

$nocsrf = true;

require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
require_once("functions.inc");

if ($_POST['rssfeed']) {
	$user_settings['widgets']['rssfeed'] = str_replace("\n", ",", htmlspecialchars($_POST['rssfeed'], ENT_QUOTES | ENT_HTML401));
	$user_settings['widgets']['rssmaxitems'] = str_replace("\n", ",", htmlspecialchars($_POST['rssmaxitems'], ENT_QUOTES | ENT_HTML401));
	$user_settings['widgets']['rsswidgetheight'] = htmlspecialchars($_POST['rsswidgetheight'], ENT_QUOTES | ENT_HTML401);
	$user_settings['widgets']['rsswidgettextlength'] = htmlspecialchars($_POST['rsswidgettextlength'], ENT_QUOTES | ENT_HTML401);
	save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved RSS Widget feed via Dashboard."));
	header("Location: /");
}

// Use saved feed and max items
if ($user_settings['widgets']['rssfeed']) {
	$rss_feed_s = explode(",", $user_settings['widgets']['rssfeed']);
}

if ($user_settings['widgets']['rssmaxitems']) {
	$max_items =  $user_settings['widgets']['rssmaxitems'];
}

if (is_numeric($user_settings['widgets']['rsswidgetheight'])) {
	$rsswidgetheight =	$user_settings['widgets']['rsswidgetheight'];
}

if (is_numeric($user_settings['widgets']['rsswidgettextlength'])) {
	$rsswidgettextlength =	$user_settings['widgets']['rsswidgettextlength'];
}

// Set a default feed if none exists
if (!$rss_feed_s) {
	$rss_feed_s = "https://blog.pfsense.org";
	$user_settings['widgets']['rssfeed'] = "https://blog.pfsense.org";
}

if (!$max_items || !is_numeric($max_items)) {
	$max_items = 10;
}

if (!$rsswidgetheight || !is_numeric($rsswidgetheight)) {
	$rsswidgetheight = 300;
}
<commit_msg>Set new blog URL (https://www.netgate.com/blog/) as default for RSS widget<commit_after><?php
/*
 * rss.widget.php
 *
 * part of pfSense (https://www.pfsense.org)
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

$nocsrf = true;

require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
require_once("functions.inc");

if ($_POST['rssfeed']) {
	$user_settings['widgets']['rssfeed'] = str_replace("\n", ",", htmlspecialchars($_POST['rssfeed'], ENT_QUOTES | ENT_HTML401));
	$user_settings['widgets']['rssmaxitems'] = str_replace("\n", ",", htmlspecialchars($_POST['rssmaxitems'], ENT_QUOTES | ENT_HTML401));
	$user_settings['widgets']['rsswidgetheight'] = htmlspecialchars($_POST['rsswidgetheight'], ENT_QUOTES | ENT_HTML401);
	$user_settings['widgets']['rsswidgettextlength'] = htmlspecialchars($_POST['rsswidgettextlength'], ENT_QUOTES | ENT_HTML401);
	save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved RSS Widget feed via Dashboard."));
	header("Location: /");
}

// Use saved feed and max items
if ($user_settings['widgets']['rssfeed']) {
	$rss_feed_s = explode(",", $user_settings['widgets']['rssfeed']);
}

if ($user_settings['widgets']['rssmaxitems']) {
	$max_items =  $user_settings['widgets']['rssmaxitems'];
}

if (is_numeric($user_settings['widgets']['rsswidgetheight'])) {
	$rsswidgetheight =	$user_settings['widgets']['rsswidgetheight'];
}

if (is_numeric($user_settings['widgets']['rsswidgettextlength'])) {
	$rsswidgettextlength =	$user_settings['widgets']['rsswidgettextlength'];
}

// Set a default feed if none exists
if (!$rss_feed_s) {
	$rss_feed_s = "https://www.netgate.com/blog/";
	$user_settings['widgets']['rssfeed'] = "https://www.netgate.com/blog/";
}

if (!$max_items || !is_numeric($max_items)) {
	$max_items = 10;
}

if (!$rsswidgetheight || !is_numeric($rsswidgetheight)) {
	$rsswidgetheight = 300;
}

{'fraction_non_alphanumeric': 0.1675897435897436, 'fraction_numerical': 0.011897435897435898, 'mean_word_length': 6.432926829268292, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 7, 'lorem ipsum': 0, 'www.': 7, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6881638', 'n_tokens_mistral': 1590, 'n_tokens_neox': 1530, 'n_words': 357}