PHP settings: add option to show errors on screen

This commit is contained in:
bergware
2023-02-04 01:39:46 +01:00
parent 87015a03f0
commit 16e4777dc5
+21 -2
View File
@@ -26,6 +26,8 @@ if (!file_exists($log)) touch($log);
<style>
div#templateWindow,div#dialogWindow{display:none}
span.dim{opacity:0.2}
#screenlog{margin-left:0}
</style>
<div markdown="1" style="width:43%;margin-bottom:40px;padding:5px 15px;border:solid 1px">
@@ -46,10 +48,10 @@ under normal running conditions.
<input type="hidden" name="#file" value="<?=$ini?>">
<input type="hidden" name="error_log" value="<?=$log?>">
<input type="hidden" name="display_startup_errors" value="0">
<input type="hidden" name="display_errors" value="0">
<input type="hidden" name="display_errors" value="<?=$conf['display_errors']??0?>">
<input type="hidden" name="log_errors" value="1">
_(Error reporting level)_:
: <select name="error_reporting">
: <select name="error_reporting" onchange="toggleScreen(this.selectedIndex)">
<?=mk_option($conf['error_reporting']??'', "", "_(Default)_");?>
<?=mk_option($conf['error_reporting']??'', "32767", "_(All Categories)_");?>
<?=mk_option($conf['error_reporting']??'', "1", "_(Errors Only)_");?>
@@ -58,6 +60,9 @@ _(Error reporting level)_:
<?=mk_option($conf['error_reporting']??'', "8192", "_(Deprecated Only)_");?>
</select>
&nbsp;
: <input type="checkbox" id="screenlog" onclick="screenLog()" <?=($conf['display_errors']??0)?'checked':''?> disabled><span id="screentext" class="dim">_(Show errors on screen)_</span>
<input type="button" value="_(PHP Info)_" onclick="PHPinfo()"><input type="button" id="clearlog" value="_(Clear Log)_" onclick="clearLog()"<?=filesize($log)>0?'':' disabled'?>><input type="button" id="viewlog" value="_(View Log)_" onclick="viewLog()" disabled>
: <input type="submit" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
</form>
@@ -111,6 +116,9 @@ String.prototype.build = function(){return this.replace(/\n(<!--!|!-->)\n/g,'');
var box = null;
function screenLog() {
$('input[name="display_errors"]').val($('#screenlog').prop('checked')?1:0);
}
function viewLog() {
openTerminal('log','PHP Error Log','phplog');
}
@@ -154,9 +162,20 @@ function preset(form) {
}
$.cookie('reload_php',1);
}
function toggleScreen(index) {
if (index > 0) {
$('#screenlog').prop('disabled',false);
$('#screentext').removeClass('dim');
} else {
$('#screenlog').prop('disabled',true);
$('#screentext').addClass('dim');
}
}
$(function(){
if (document.php_settings.error_reporting.selectedIndex > 0) {
$('#viewlog').prop('disabled',false);
$('#screenlog').prop('disabled',false);
$('#screentext').removeClass('dim');
}
if ($.cookie('reload_php')==1) {
$.removeCookie('reload_php');