Commit 60c7dc01 authored by Kevin Atkinson's avatar Kevin Atkinson

Fixed docwrapper to pass the http error code (400 or 404) to USERERROR

since setting it before no longer works.
parent ff9ca45a
......@@ -18,8 +18,7 @@ $optargs = OptionalPageArguments("printable", PAGEARG_BOOLEAN);
# Need to sanity check the path! Allow only [word].{html,txt} files
#
if (!preg_match("/^[-\w]+\.(html|txt)$/", $docname)) {
header(' ', true, 400);
USERERROR("Illegal document name: $docname!", 1);
USERERROR("Illegal document name: $docname!", 1, HTTP_400_BAD_REQUEST);
}
#
......@@ -27,8 +26,7 @@ if (!preg_match("/^[-\w]+\.(html|txt)$/", $docname)) {
#
$fh = @fopen("$docname", "r");
if (!$fh) {
header(' ', true, 404);
USERERROR("Can't read document file: $docname!", 1);
USERERROR("Can't read document file: $docname!", 1, HTTP_404_NOT_FOUND);
}
if (!isset($printable))
......
......@@ -16,8 +16,7 @@ $optargs = OptionalPageArguments("printable", PAGEARG_BOOLEAN);
# Need to sanity check the path! Allow only [word].html files
#
if (!preg_match("/^[-\w]+\.(html|txt)$/", $docname)) {
header(' ', true, 400);
USERERROR("Illegal document name: $docname!", 1);
USERERROR("Illegal document name: $docname!", 1, HTTP_400_BAD_REQUEST);
}
$to_wiki = array(
......@@ -39,8 +38,7 @@ if (!$fh) {
header("Location: $WIKIDOCURL/$wikiname", TRUE, 301);
return 0;
} else {
header(' ', true, 404);
USERERROR("Can't read document file: $docname!", 1);
USERERROR("Can't read document file: $docname!", 1, HTTP_404_NOT_FOUND);
}
}
......
......@@ -18,8 +18,7 @@ $optargs = OptionalPageArguments("printable", PAGEARG_BOOLEAN);
# Need to sanity check the path! Allow only [word].html files
#
if (!preg_match("/^[-\w]+\.(html|txt)$/", $docname)) {
header(' ', true, 400);
USERERROR("Illegal document name: $docname!", 1);
USERERROR("Illegal document name: $docname!", 1, HTTP_400_BAD_REQUEST);
}
#
......@@ -27,8 +26,7 @@ if (!preg_match("/^[-\w]+\.(html|txt)$/", $docname)) {
#
$fh = @fopen("$docname", "r");
if (!$fh) {
header(' ', true, 404);
USERERROR("Can't read document file: $docname!", 1);
USERERROR("Can't read document file: $docname!", 1, HTTP_404_NOT_FOUND);
}
if (!isset($printable))
......
......@@ -17,8 +17,7 @@ $optargs = OptionalPageArguments("printable", PAGEARG_BOOLEAN,
# Need to sanity check the path! Allow only [word].{html,txt} files
#
if (!preg_match("/^[-\w]+\.(html|txt)$/", $docname)) {
header(' ', true, 400);
USERERROR("Illegal document name: $docname!", 1);
USERERROR("Illegal document name: $docname!", 1, HTTP_400_BAD_REQUEST);
}
#
......@@ -26,8 +25,7 @@ if (!preg_match("/^[-\w]+\.(html|txt)$/", $docname)) {
#
$fh = @fopen("$docname", "r");
if (!$fh) {
header(' ', true, 404);
USERERROR("Can't read document file: $docname!", 1);
USERERROR("Can't read document file: $docname!", HTTP_404_NOT_FOUND);
}
if (!isset($printable))
......
......@@ -18,8 +18,7 @@ $optargs = OptionalPageArguments("printable", PAGEARG_BOOLEAN);
# Need to sanity check the path! Allow only [word].html files
#
if (!preg_match("/^[-\w\.]+\.(html|txt)$/", $docname)) {
header(' ', true, 400);
USERERROR("Illegal document name: $docname!", 1);
USERERROR("Illegal document name: $docname!", 1, HTTP_400_BAD_REQUEST);
}
$to_wiki = array(
......@@ -37,8 +36,7 @@ if (!$fh) {
header("Location: $WIKIDOCURL/$wikiname", TRUE, 301);
return 0;
} else {
header(' ', true, 404);
USERERROR("Can't read document file: $docname!", 1);
USERERROR("Can't read document file: $docname!", 1, HTTP_404_NOT_FOUND);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment