Skip to content

Commit

Permalink
tiny html error in in error code
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann committed May 18, 2024
1 parent 507caaf commit ca02a67
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions generate_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,31 @@
require_once 'setup.php';

if (count($_GET) !== 1) {
echo 'Exactly one parameters must be passed</pre></body></html>';
echo 'Exactly one parameters must be passed</pre></main></body></html>';
exit;
}
$param = array_keys($_GET)[0];
$value = $_GET[$param];

if (!is_string($param) || !is_string($value)) {
echo 'Invalid parameter type error for passed parameter</pre></body></html>';
echo 'Invalid parameter type error for passed parameter</pre></main></body></html>';
exit;
}
if (strlen($value) < 3) {
echo 'Unset parameter error</pre></body></html>';
echo 'Unset parameter error</pre></main></body></html>';
exit;
}
if (strlen($value) > 100) {
exit('Excessive parameter error</pre></body></html>');
echo 'Excessive parameter error</pre></main></body></html>';
exit;
}
if ((strpos($value, "'") !== false) || (strpos($value, '"') !== false) || (strpos($value, "|") !== false) || (strpos($value, " ") !== false)) {
echo 'Invalid parameter value error</pre></body></html>';
echo 'Invalid parameter value error</pre></main></body></html>';
exit;
}
$param = mb_strtolower($param);
if (!in_array($param, ['jstor', 'doi', 'pmc', 's2cid', 'pmid', 'hdl', 'osti', 'isbn', 'lccn', 'ol', 'oclc'], true)) {
echo 'Unexpected parameter passed</pre></body></html>';
echo 'Unexpected parameter passed</pre></main></body></html>';
exit;
}

Expand All @@ -54,6 +55,6 @@
$text = $page->parsed_text();
unset($page);

echo "\n\n" . echoable('<ref>' . $text . '</ref>') . "\n\n</pre></main></body></html>";
echo "\n\n", echoable('<ref>' . $text . '</ref>'), "\n\n</pre></main></body></html>";

?>

0 comments on commit ca02a67

Please sign in to comment.