mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Add log size limit to Advanced tab, validate + set session var
This commit is contained in:
parent
cf53c575ff
commit
2a5241fb62
2 changed files with 19 additions and 2 deletions
|
@ -39,6 +39,16 @@ function DisplaySystem(&$extraFooterScripts)
|
|||
$serverBind = escapeshellarg($_POST['serverBind']);
|
||||
}
|
||||
}
|
||||
// Validate log limit
|
||||
if (isset($_POST['logLimit'])) {
|
||||
if ( strlen($_POST['logLimit']) > 4 || !is_numeric($_POST['logLimit']) ) {
|
||||
$status->addMessage('Invalid value for log size limit', 'danger');
|
||||
$good_input = false;
|
||||
} else {
|
||||
$_SESSION['log_limit'] = intval($_POST['logLimit']);
|
||||
$status->addMessage(sprintf(_('Changing log limit size to %s KB'), $_SESSION['log_limit']), 'info');
|
||||
}
|
||||
}
|
||||
// Save settings
|
||||
if ($good_input) {
|
||||
exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort $serverBind " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return);
|
||||
|
@ -141,6 +151,7 @@ function DisplaySystem(&$extraFooterScripts)
|
|||
|
||||
$extraFooterScripts[] = array('src'=>'dist/huebee/huebee.pkgd.min.js', 'defer'=>false);
|
||||
$extraFooterScripts[] = array('src'=>'app/js/huebee.js', 'defer'=>false);
|
||||
$logLimit = isset($_SESSION['log_limit']) ? $_SESSION['log_limit'] : RASPI_LOG_SIZE_LIMIT;
|
||||
|
||||
echo renderTemplate("system", compact(
|
||||
"arrLocales",
|
||||
|
@ -166,6 +177,7 @@ function DisplaySystem(&$extraFooterScripts)
|
|||
"hostapd_status",
|
||||
"hostapd_led",
|
||||
"themes",
|
||||
"selectedTheme"
|
||||
"selectedTheme",
|
||||
"logLimit"
|
||||
));
|
||||
}
|
||||
|
|
|
@ -16,10 +16,15 @@
|
|||
<input type="text" class="form-control" name="serverBind" value="<?php echo htmlspecialchars($serverBind, ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="code"><?php echo _("Diagnostic log size limit (KB)") ;?></label>
|
||||
<input type="text" class="form-control" name="logLimit" value="<?php echo htmlspecialchars($logLimit, ENT_QUOTES); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-outline btn-primary" name="SaveServerSettings" value="<?php echo _("Save settings"); ?>" />
|
||||
<input type="submit" class="btn btn-warning" name="RestartLighttpd" value="<?php echo _("Restart lighttpd"); ?>" />
|
||||
</form>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue