-
Notifications
You must be signed in to change notification settings - Fork 9
/
404.php
84 lines (80 loc) · 1.43 KB
/
404.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
include $_SERVER['DOCUMENT_ROOT']."/php/brainspell.php";
header($_SERVER['SERVER_PROTOCOL'] . " 200 OK");
$uri=$_SERVER['REQUEST_URI'];
$parts=preg_split("/[\/?]/",$uri);
if($parts[1]=="article")
{
$id="";
for($i=2;$i<count($parts);$i++)
{
$id.=$parts[$i];
if($i<count($parts)-1)
$id.="/";
}
article($id);
}
else
if($parts[1]=="json")
{
if($parts[2]=="pmid")
article_json_pmid($parts[3]);
else
if($parts[2]=="doi")
{
$doi="";
for($i=3;$i<count($parts);$i++)
{
$doi.=$parts[$i];
if($i<count($parts)-1)
$doi.="/";
}
article_json_doi($doi);
}
}
else
if($parts[1]=="search")
{
$parts=explode("=",$parts[2]);
$q=urldecode($parts[1]);
search_lucene($q);
}
else
if($parts[1]=="list")
{
$parts=explode("=",$parts[2]);
$q=json_encode($parts[1]);
article_list($q);
/*
$getdata = http_build_query(array("query" => $q,'action' => 'article_list'));
$opts = array('http' =>array('method'=>'POST','header'=>'Content-type: application/x-www-form-urlencoded'));
$context = stream_context_create($opts);
$result = file_get_contents('http://'.$_SERVER['HTTP_HOST'].'/php/brainspell.php?'.$getdata, false, $context);
echo $result;
*/
}
else
if($parts[1]=="about")
{
about();
}
else
if($parts[1]=="blog")
{
blog();
}
else
if($parts[1]=="download")
{
download();
}
else
if($parts[1]=="user")
{
user_update($parts[2]);
}
else
{
home();
}
?>