//deg C
const MAX_THRESHOLD_VALUE = 100;
//deg C
//NOTE: keys used in $_POST and $config and $user_settings should match text and checkbox inputs' IDs/names in HTML code section
//=========================================================================
//save widget config settings on POST
if ($_POST) {
    saveThresholdSettings($user_settings, $_POST, "thermal_sensors_widget_zone_warning_threshold", "thermal_sensors_widget_zone_critical_threshold");
    saveThresholdSettings($user_settings, $_POST, "thermal_sensors_widget_core_warning_threshold", "thermal_sensors_widget_core_critical_threshold");
    //handle checkboxes separately
    saveGraphDisplaySettings($user_settings, $_POST, "thermal_sensors_widget_show_raw_output");
    saveGraphDisplaySettings($user_settings, $_POST, "thermal_sensors_widget_show_full_sensor_name");
    saveGraphDisplaySettings($user_settings, $_POST, "thermal_sensors_widget_pulsate_warning");
    saveGraphDisplaySettings($user_settings, $_POST, "thermal_sensors_widget_pulsate_critical");
    //write settings to config file
    save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved thermal_sensors_widget settings via Dashboard."));
    header("Location: ../../index.php");
}
function saveThresholdSettings(&$configArray, &$postArray, $warningValueKey, $criticalValueKey)
{
    $warningValue = 0;
    $criticalValue = 0;
    if (isset($postArray[$warningValueKey]) && is_numeric($postArray[$warningValueKey])) {
        $warningValue = (int) $postArray[$warningValueKey];
    }
    if (isset($postArray[$criticalValueKey]) && is_numeric($postArray[$criticalValueKey])) {
        $criticalValue = (int) $postArray[$criticalValueKey];
    }
    if ($warningValue >= MIN_THRESHOLD_VALUE && $warningValue <= MAX_THRESHOLD_VALUE && ($criticalValue >= MIN_THRESHOLD_VALUE && $criticalValue <= MAX_THRESHOLD_VALUE) && $warningValue < $criticalValue) {
        //all validated ok, save to config array
        $configArray[WIDGETS_CONFIG_SECTION_KEY][THERMAL_SENSORS_WIDGET_SUBSECTION_KEY][$warningValueKey] = $warningValue;
    if (is_uploaded_file($_FILES['pictfile']['tmp_name'])) {
        /* read the file contents */
        $fd_pic = fopen($_FILES['pictfile']['tmp_name'], "rb");
        while (($buf = fread($fd_pic, 8192)) != '') {
            // Here, $buf is guaranteed to contain data
            $data .= $buf;
        }
        fclose($fd_pic);
        if (!$data) {
            log_error("Warning, could not read file " . $_FILES['pictfile']['tmp_name']);
            die("Could not read temporary file");
        } else {
            $picname = basename($_FILES['uploadedfile']['name']);
            $user_settings['widgets']['picturewidget'] = base64_encode($data);
            $user_settings['widgets']['picturewidget_filename'] = $_FILES['pictfile']['name'];
            save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Picture widget saved via Dashboard."));
            header("Location: /index.php");
            exit;
        }
    }
}
?>
<a href="/widgets/widgets/picture.widget.php?getpic=true" target="_blank">
	<img style="width:100%; height:100%" src="/widgets/widgets/picture.widget.php?getpic=true" alt="picture" />
</a>

<!-- close the body we're wrapped in and add a configuration-panel -->
</div><div id="widget-<?php 
echo $widgetname;
?>
_panel-footer" class="panel-footer collapse">
        if ($services[$chk]['dispname'] == $name) {
            $services[$chk]['dispname'] .= '_' . $sfx++;
        }
    }
}
if ($_POST) {
    $validNames = array();
    foreach ($services as $service) {
        array_push($validNames, $service['dispname']);
    }
    if (isset($_POST['servicestatusfilter'])) {
        $user_settings['widgets']['servicestatusfilter'] = implode(',', array_intersect($validNames, $_POST['servicestatusfilter']));
    } else {
        $user_settings['widgets']['servicestatusfilter'] = "";
    }
    save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved Service Status Filter via Dashboard."));
    header("Location: /index.php");
}
?>
<table class="table table-striped table-hover">
<thead>
	<tr>
		<th></th>
		<th><?php 
echo gettext('Service');
?>
</th>
		<th><?php 
echo gettext('Description');
?>
</th>
Example #4
0
        $user_settings['widgets']['filterlogentriesacts'] = implode(" ", $acts);
    } else {
        unset($user_settings['widgets']['filterlogentriesacts']);
    }
    unset($acts);
    if ($_POST['filterlogentriesinterfaces'] and $_POST['filterlogentriesinterfaces'] != "All") {
        $user_settings['widgets']['filterlogentriesinterfaces'] = trim($_POST['filterlogentriesinterfaces']);
    } else {
        unset($user_settings['widgets']['filterlogentriesinterfaces']);
    }
    if (is_numeric($_POST['filterlogentriesinterval'])) {
        $user_settings['widgets']['filterlogentriesinterval'] = $_POST['filterlogentriesinterval'];
    } else {
        unset($user_settings['widgets']['filterlogentriesinterval']);
    }
    save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved Filter Log Entries via Dashboard."));
    Header("Location: /");
    exit(0);
}
$nentries = isset($user_settings['widgets']['filterlogentries']) ? $user_settings['widgets']['filterlogentries'] : 5;
//set variables for log
$nentriesacts = isset($user_settings['widgets']['filterlogentriesacts']) ? $user_settings['widgets']['filterlogentriesacts'] : 'All';
$nentriesinterfaces = isset($user_settings['widgets']['filterlogentriesinterfaces']) ? $user_settings['widgets']['filterlogentriesinterfaces'] : 'All';
$filterfieldsarray = array("act" => $nentriesacts, "interface" => $nentriesinterfaces);
$nentriesinterval = isset($user_settings['widgets']['filterlogentriesinterval']) ? $user_settings['widgets']['filterlogentriesinterval'] : 60;
$filter_logfile = "{$g['varlog_path']}/filter.log";
$filterlog = conv_log_filter($filter_logfile, $nentries, 50, $filterfieldsarray);
?>
<script type="text/javascript">
//<![CDATA[
	var logWidgetLastRefresh = <?php 
Example #5
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'];
}
Example #6
0
if (!is_array($config['widgets'])) {
    $config['widgets'] = array();
}
if (!is_array($user_settings['widgets'])) {
    $user_settings['widgets'] = array();
}
if ($_POST && $_POST['sequence']) {
    // Start with the user's widget settings.
    $widget_settings = $user_settings['widgets'];
    $widget_settings['sequence'] = rtrim($_POST['sequence'], ',');
    foreach ($widgets as $widgetname => $widgetconfig) {
        if ($_POST[$widgetname . '-config']) {
            $widget_settings[$widgetname . '-config'] = $_POST[$widgetname . '-config'];
        }
    }
    save_widget_settings($_SESSION['Username'], $widget_settings);
    header("Location: /");
    exit;
}
## Load Functions Files
require_once 'includes/functions.inc.php';
## Check to see if we have a swap space,
## if true, display, if false, hide it ...
if (file_exists("/usr/sbin/swapinfo")) {
    $swapinfo = `/usr/sbin/swapinfo`;
    if (stristr($swapinfo, '%') == true) {
        $showswap = true;
    }
}
## User recently restored his config.
## If packages are installed lets resync
require_once "pfsense-utils.inc";
require_once "functions.inc";
require_once "/usr/local/www/widgets/include/gateways.inc";
// Compose the table contents and pass it back to the ajax caller
if ($_REQUEST && $_REQUEST['ajax']) {
    print compose_table_body_contents();
    exit;
}
if ($_POST) {
    if (!is_array($user_settings["widgets"]["gateways_widget"])) {
        $user_settings["widgets"]["gateways_widget"] = array();
    }
    if (isset($_POST["display_type"])) {
        $user_settings["widgets"]["gateways_widget"]["display_type"] = $_POST["display_type"];
    }
    save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Updated gateways widget settings via dashboard."));
    header("Location: /");
    exit(0);
}
$widgetperiod = isset($config['widgets']['period']) ? $config['widgets']['period'] * 1000 : 10000;
?>

<div class="table-responsive">
	<table class="table table-striped table-hover table-condensed">
		<thead>
			<tr>
				<th><?php 
echo gettext("Name");
?>
</th>
				<th>RTT</th>