Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
marcus-lodspeakr
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
marcus-lodspeakr
Commits
1e0a2a93
Commit
1e0a2a93
authored
12 years ago
by
alvaro
Browse files
Options
Downloads
Patches
Plain Diff
Possible to create pages for different http status (e.g., 404)
TODO: Apply Haanga to it
parent
b3ac76ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/HTTPStatus.php
+44
-12
44 additions, 12 deletions
classes/HTTPStatus.php
common.inc.php
+5
-4
5 additions, 4 deletions
common.inc.php
with
49 additions
and
16 deletions
classes/HTTPStatus.php
+
44
−
12
View file @
1e0a2a93
...
...
@@ -3,37 +3,69 @@
class
HTTPStatus
{
public
static
function
send303
(
$uri
,
$ext
){
global
$conf
;
$file
=
$conf
[
'home'
]
.
$conf
[
'httpStatus'
][
'directory'
]
.
"/303.template"
;
if
(
file_exists
(
$file
)){
$content
=
file_get_contents
(
$file
);
}
else
{
$content
=
$uri
.
"
\n\n
"
;
}
header
(
"HTTP/1.0 303 See Other"
);
header
(
"Location: "
.
$uri
);
header
(
"Content-type: "
.
$ext
);
echo
$
uri
.
"
\n\n
"
;
echo
$
content
;
exit
(
0
);
}
public
static
function
send401
(
$msg
){
public
static
function
send401
(
$uri
){
global
$conf
;
$file
=
$conf
[
'home'
]
.
$conf
[
'httpStatus'
][
'directory'
]
.
"/401.template"
;
if
(
file_exists
(
$file
)){
$content
=
file_get_contents
(
$file
);
}
else
{
$content
=
$uri
.
"
\n\n
"
;
}
header
(
"HTTP/1.0 401 Forbidden"
);
echo
$
msg
;
echo
$
content
;
exit
(
0
);
}
public
static
function
send404
(
$uri
){
header
(
"HTTP/1.0 404 Not Found"
);
echo
"LODSPeaKr could not find "
.
$uri
.
" or information about it.
\n
No URIs in the triple store, or services configured with that URI
\n
"
;
global
$conf
;
$file
=
$conf
[
'home'
]
.
$conf
[
'httpStatus'
][
'directory'
]
.
"/404.template"
;
if
(
file_exists
(
$file
)){
$content
=
file_get_contents
(
$file
);
}
else
{
$content
=
"LODSPeaKr could not find "
.
$uri
.
" or information about it.
\n
No URIs in the triple store, or services configured with that URI
\n
"
;
}
header
(
"HTTP/1.0 404 Not Found"
);
echo
$content
;
exit
(
0
);
}
public
static
function
send406
(
$uri
){
header
(
"HTTP/1.0 406 Not Acceptable"
);
echo
"LODSPeaKr can't find a representation suitable for the content type you accept
\n\n
"
;
global
$conf
;
$file
=
$conf
[
'home'
]
.
$conf
[
'httpStatus'
][
'directory'
]
.
"/406.template"
;
if
(
file_exists
(
$file
)){
$content
=
file_get_contents
(
$file
);
}
else
{
$content
=
"LODSPeaKr can't find a representation suitable for the content type you accept for
$uri
\n\n
"
;
}
header
(
"HTTP/1.0 406 Not Acceptable"
);
echo
$content
;
exit
(
0
);
}
public
static
function
send500
(
$msg
=
null
){
public
static
function
send500
(
$uri
){
global
$conf
;
$file
=
$conf
[
'home'
]
.
$conf
[
'httpStatus'
][
'directory'
]
.
"/406.template"
;
if
(
file_exists
(
$file
)){
$content
=
file_get_contents
(
$file
);
}
else
{
$content
=
"An internal error ocurred. Please try later
\n\n
"
;
}
header
(
"HTTP/1.0 500 Internal Server Error"
);
echo
"An internal error ocurred. Please try later
\n\n
"
;
if
(
$msg
!=
null
){
echo
$msg
;
}
echo
$content
;
exit
(
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
common.inc.php
+
5
−
4
View file @
1e0a2a93
...
...
@@ -9,6 +9,7 @@ $conf['endpoint']['dbpedia'] = 'http://dbpedia.org/sparql';
$conf
[
'endpoint'
][
'logd'
]
=
'http://logd.tw.rpi.edu/sparql'
;
$conf
[
'metadata'
][
'db'
][
'location'
]
=
'meta/db.sqlite'
;
$conf
[
'httpStatus'
][
'directory'
]
=
'components/status'
;
include_once
(
'namespaces.php'
);
...
...
@@ -33,10 +34,10 @@ $conf['http_accept']['json'] = array('application/json', 'application/x-javascri
$conf
[
'http_accept'
][
'nt'
]
=
array
(
'text/plain'
);
$conf
[
'service'
][
'prefix'
]
=
'services'
;
$conf
[
'
type
'
][
'prefix'
]
=
'type
s'
;
$conf
[
'
uri
'
][
'prefix'
]
=
'uris
'
;
$conf
[
'service'
][
'prefix'
]
=
'services'
;
$conf
[
'type'
][
'prefix'
]
=
'types'
;
$conf
[
'
uri
'
][
'prefix'
]
=
'uri
s'
;
$conf
[
'
redirect
'
][
'prefix'
]
=
'redirect
'
;
//Frontpage when user goes to http://example.org/
$conf
[
'root'
]
=
'index.html'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment