App/bin/__errors.php

34 lines
1.2 KiB
PHP
Executable File

<?php #bin/errors.php
//Check if errors were reported
if (count($err["out"])>0)
{
$etpl = tplExtrSection(tplLoadFile(TPLERRORS), "###ERRORS###");
$eshow = true;
$elog = true;
$edet = true;
//0: none, 1: report in output, 2: report to file (log/errors.txt), 4: just count, 8: only if admin, 16: only if param
//Sums are possible (e.g. 3 means reporting both to file and output
if ((DEBUGLVL > 16) && !isset($input["debug"])) {$eshow = false; $elog = false;}
if ((DEBUGLVL % 16 > 8) && !access(USRADMIN)) {$eshow = false; $elog = false;}
if (DEBUGLVL % 8 >= 4) $edet = false;
if (DEBUGLVL % 4 < 2) $elog = false;
if (DEBUGLVL % 2 < 1) $eshow = false;
if ($edet)
{
$eent = tplExtrSection($etpl, "###ERRORENTRY###");
foreach ($err["out"] as $emsg)
{
$output["error"].= tplReplMarker($eent, "###ERRORMSG###", $emsg);
###### TODO: ##### log into file ##### if ($elog) ...
}
}
else
{
$output["error"] = count($err["out"])." errors occured!";
##### TODO: ##### log into file #### if ($elog) ...
}
if ($eshow) $output["error"] = tplReplSection($etpl, "###ERRORENTRY###", $output["error"]); else $output["error"] = "";
}
?>