prefs system: markup cleanup

master
Andrew Dolgov 4 years ago
parent aa63014073
commit 5127c29297

@ -139,7 +139,7 @@ class Pref_Labels extends Handler_Protected {
$sth->execute([$caption, $old_caption, $_SESSION['uid']]);
print clean($_REQUEST["value"]);
print clean($_REQUEST["caption"]);
} else {
print $old_caption;
}

@ -31,7 +31,7 @@ class Pref_System extends Handler_Protected {
$info = ob_get_contents();
ob_end_clean();
print preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $info);
print preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', (string)$info);
}
private function log_viewer(int $page, int $severity) {
@ -71,54 +71,58 @@ class Pref_System extends Handler_Protected {
$total_pages = 0;
}
print "<div dojoType='dijit.layout.BorderContainer' gutters='false'>";
print "<div region='top' dojoType='fox.Toolbar'>";
print "<button dojoType='dijit.form.Button'
onclick='Helpers.EventLog.refresh()'>".__('Refresh')."</button>";
$prev_page_disabled = $page <= 0 ? "disabled" : "";
?>
<div dojoType='dijit.layout.BorderContainer' gutters='false'>
<div region='top' dojoType='fox.Toolbar'>
print "<button dojoType='dijit.form.Button' $prev_page_disabled
onclick='Helpers.EventLog.prevPage()'>".__('&lt;&lt;')."</button>";
<button dojoType='dijit.form.Button' onclick='Helpers.EventLog.refresh()'>
<?php echo __('Refresh') ?>
</button>
print "<button dojoType='dijit.form.Button' disabled>".T_sprintf('Page %d of %d', $page+1, $total_pages+1)."</button>";
<button dojoType='dijit.form.Button' <?php echo ($page <= 0 ? "disabled" : "") ?>
onclick='Helpers.EventLog.prevPage()'>
<?php echo __('&lt;&lt;') ?>
</button>
$next_page_disabled = $page >= $total_pages ? "disabled" : "";
<button dojoType='dijit.form.Button' disabled>
<?php echo T_sprintf('Page %d of %d', $page+1, $total_pages+1) ?>
</button>
print "<button dojoType='dijit.form.Button' $next_page_disabled
onclick='Helpers.EventLog.nextPage()'>".__('&gt;&gt;')."</button>";
<button dojoType='dijit.form.Button' <?php echo ($page >= $total_pages ? "disabled" : "") ?>
onclick='Helpers.EventLog.nextPage()'>
<?php echo __('&gt;&gt;') ?>
</button>
print "<button dojoType='dijit.form.Button'
onclick='Helpers.EventLog.clear()'>".__('Clear')."</button>";
<button dojoType='dijit.form.Button'
onclick='Helpers.EventLog.clear()'>
<?php echo __('Clear') ?>
</button>
print "<div class='pull-right'>";
<div class='pull-right'>
<?php echo __("Severity:") ?>
print __("Severity:") . " ";
print_select_hash("severity", $severity,
<?php print_select_hash("severity", $severity,
[
E_USER_ERROR => __("Errors"),
E_USER_WARNING => __("Warnings"),
E_USER_NOTICE => __("Everything")
], 'dojoType="fox.form.Select" onchange="Helpers.EventLog.refresh()"');
print "</div>"; # pull-right
print "</div>"; # toolbar
], 'dojoType="fox.form.Select" onchange="Helpers.EventLog.refresh()"') ?>
</div>
</div>
print '<div style="padding : 0px" dojoType="dijit.layout.ContentPane" region="center">';
<div style="padding : 0px" dojoType="dijit.layout.ContentPane" region="center">
print "<table width='100%' class='event-log'>";
<table width='100%' class='event-log'>
print "<tr class='title'>
<td width='5%'>".__("Error")."</td>
<td>".__("Filename")."</td>
<td>".__("Message")."</td>
<td width='5%'>".__("User")."</td>
<td width='5%'>".__("Date")."</td>
</tr>";
<tr class='title'>
<td width='5%'><?php echo __("Error") ?></td>
<td><?php echo __("Filename") ?></td>
<td><?php echo __("Message") ?></td>
<td width='5%'><?php echo __("User") ?></td>
<td width='5%'><?php echo __("Date") ?></td>
</tr>
<?php
$sth = $this->pdo->prepare("SELECT
errno, errstr, filename, lineno, created_at, login, context
FROM
@ -132,26 +136,24 @@ class Pref_System extends Handler_Protected {
$sth->execute($errno_values);
while ($line = $sth->fetch()) {
print "<tr>";
foreach ($line as $k => $v) {
$line[$k] = htmlspecialchars($v);
}
print "<td class='errno'>" . Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")</td>";
print "<td class='filename'>" . $line["filename"] . ":" . $line["lineno"] . "</td>";
print "<td class='errstr'>" . $line["errstr"] . "\n" . $line["context"] . "</td>";
print "<td class='login'>" . $line["login"] . "</td>";
print "<td class='timestamp'>" .
TimeHelper::make_local_datetime($line["created_at"], false) . "</td>";
print "</tr>";
}
print "</table>";
print "</div>";
print "</div>";
foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v); }
?>
<tr>
<td class='errno'>
<?php echo Logger::$errornames[$line["errno"]] . " (" . $line["errno"] . ")" ?>
</td>
<td class='filename'><?php echo $line["filename"] . ":" . $line["lineno"] ?></td>
<td class='errstr'><?php echo $line["errstr"] . "\n" . $line["context"] ?></td>
<td class='login'><?php echo $line["login"] ?></td>
<td class='timestamp'>
<?php TimeHelper::make_local_datetime($line["created_at"], false) ?>
</td>
</tr>
<?php } ?>
</table>
</div>
</div>
<?php
}
function index() {

Loading…
Cancel
Save