Skip to content

Commit

Permalink
Switched htmlspecialchars to use new TBX_SPECIAL_CHARS constant from …
Browse files Browse the repository at this point in the history
…TBX library
  • Loading branch information
darkain committed Oct 25, 2016
1 parent ecaf752 commit 5c144e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
26 changes: 13 additions & 13 deletions error.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class aferror {
}

$error = (ob_get_level() && $die)
? htmlspecialchars(ob_get_clean(),ENT_SUBSTITUTE)
? htmlspecialchars(ob_get_clean(),TBX_SPECIAL_CHARS)
: '';

$arr = $arrout = self::process($data);
Expand Down Expand Up @@ -164,20 +164,20 @@ class aferror {
$html .= '<tr><td>' . ($key+1) . '</td><td class="nobr">Line: ';
$html .= htmlspecialchars(
array_key_exists('line', $value) ? $value['line'] : '?',
ENT_SUBSTITUTE
TBX_SPECIAL_CHARS
);
$html .= '</td><td>File: ';
$html .= htmlspecialchars(
array_key_exists('file', $value) ? $value['file'] : '?',
ENT_SUBSTITUTE
TBX_SPECIAL_CHARS
);
if (!empty($value['function'])) {
$html .= '<br/>' . $value['function'] . '(';
if (!empty($value['args'])) {
$html .= substr(
htmlspecialchars(
json_encode($value['args'], JSON_UNESCAPED_SLASHES),
ENT_SUBSTITUTE
TBX_SPECIAL_CHARS
),
1, -1
);
Expand All @@ -189,9 +189,9 @@ class aferror {

foreach ($arr as $key => $value) {
$html .= '<tr><td colspan="2" class="nobr">';
$html .= htmlspecialchars($key,ENT_SUBSTITUTE);
$html .= htmlspecialchars($key,TBX_SPECIAL_CHARS);
$html .= '</td><td>';
$html .= htmlspecialchars($value,ENT_SUBSTITUTE);
$html .= htmlspecialchars($value,TBX_SPECIAL_CHARS);
$html .= '</td></tr>';
}

Expand Down Expand Up @@ -245,7 +245,7 @@ function error401($text='', $log=false, $details=false) {
aferror::render('HTTP/1.1 401 Unauthorized', [
'<div id="af-fatal"><h1>ERROR: 401</h1>',
'<h2>AUTHORIZATION REQUIRED</h2>',
'<h3>' . htmlspecialchars($details,ENT_SUBSTITUTE) . '</h3>',
'<h3>' . htmlspecialchars($details,TBX_SPECIAL_CHARS) . '</h3>',
'<i>' . $text . '</i></div>',
], $log, 'error401.tpl');
}
Expand All @@ -256,7 +256,7 @@ function error403($text='', $log=false, $details=false) {
aferror::render('HTTP/1.1 403 Forbidden', [
'<div id="af-fatal"><h1>ERROR: 403</h1>',
'<h2>FORBIDDEN</h2>',
'<h3>' . htmlspecialchars($details,ENT_SUBSTITUTE) . '</h3>',
'<h3>' . htmlspecialchars($details,TBX_SPECIAL_CHARS) . '</h3>',
'<i>' . $text . '</i></div>',
], $log, 'error403.tpl');
}
Expand All @@ -272,7 +272,7 @@ function error404($text='', $log=false, $details=false) {
$afurl->redirect("$afurl->host$afurl->base/", 302);
}

$text = htmlspecialchars($afurl->all,ENT_SUBSTITUTE) . '<br/>' . $text;
$text = htmlspecialchars($afurl->all,TBX_SPECIAL_CHARS) . '<br/>' . $text;

if (!empty($afconfig->debug)) {
$text .= '<br/><pre>' . print_r($afurl,true) . '</pre>';
Expand All @@ -282,7 +282,7 @@ function error404($text='', $log=false, $details=false) {
aferror::render('HTTP/1.1 404 File Not Found', [
'<div id="af-fatal"><h1>ERROR: 404</h1>',
'<h2>FILE NOT FOUND</h2>',
'<h3>' . htmlspecialchars($details,ENT_SUBSTITUTE) . '</h3>',
'<h3>' . htmlspecialchars($details,TBX_SPECIAL_CHARS) . '</h3>',
'<i>' . $text . '</i></div>',
], $log, 'error404.tpl');
}
Expand All @@ -293,7 +293,7 @@ function error405($text='', $log=true, $details=false) {
aferror::render('HTTP/1.1 405 Method Not Allowed', [
'<div id="af-fatal"><h1>ERROR: 405</h1>',
'<h2>METHOD NOT ALLOWED</h2>',
'<h3>' . htmlspecialchars($details,ENT_SUBSTITUTE) . '</h3>',
'<h3>' . htmlspecialchars($details,TBX_SPECIAL_CHARS) . '</h3>',
'<i>' . $text . '</i></div>',
], $log, 'error405.tpl');
}
Expand All @@ -304,7 +304,7 @@ function error422($text='', $log=true, $details=false) {
aferror::render('HTTP/1.1 422 Unprocessable Entity', [
'<div id="af-fatal"><h1>ERROR: 422</h1>',
'<h2>UNPROCESSABLE ENTITY</h2>',
'<h3>' . htmlspecialchars($details,ENT_SUBSTITUTE) . '</h3>',
'<h3>' . htmlspecialchars($details,TBX_SPECIAL_CHARS) . '</h3>',
'<i>' . $text . '</i></div>',
], $log, 'error422.tpl');
}
Expand All @@ -317,7 +317,7 @@ function error500($text='', $log=true, $details=false) {
aferror::render('HTTP/1.1 500 Internal Server Error', [
'<div id="af-fatal"><h1>ERROR: 500</h1>',
'<h2>INTERNAL SERVER ERROR</h2>',
'<h3>' . htmlspecialchars($details,ENT_SUBSTITUTE) . '</h3>',
'<h3>' . htmlspecialchars($details,TBX_SPECIAL_CHARS) . '</h3>',
'<i>' . $text . '</i></div>',
], $log, 'error500.tpl');
}
Expand Down
5 changes: 3 additions & 2 deletions url.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,10 @@ class afurl {

if (!headers_sent()) header("Location: $url", true, $type);
echo '<html><head><meta http-equiv="refresh" content="0;URL=\'';
echo htmlspecialchars($url) . '\'" /></head><body>';
echo htmlspecialchars($url,TBX_SPECIAL_CHARS) . '\'" /></head><body>';
echo "<script>top.location.href='";
echo htmlspecialchars(addslashes($url)) . "';</script></body></html>";
echo htmlspecialchars(addslashes($url),TBX_SPECIAL_CHARS);
echo "';</script></body></html>";
if ($die) exit;
}

Expand Down

0 comments on commit 5c144e1

Please sign in to comment.