-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.php
82 lines (69 loc) · 2.46 KB
/
api.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
<?php
ini_set('display_errors',0);
if($_REQUEST['su3d']){
ini_set('display_errors',1);
}
if(file_exists('config.inc.php'))
{
include('config.inc.php');
}
else
{
Header('Location: index.php');
exit;
}
include_once(S3DB_SERVER_ROOT.'/dbstruct.php');
include_once(S3DB_SERVER_ROOT.'/s3dbcore/authentication.php');
include_once(S3DB_SERVER_ROOT.'/s3dbcore/display.php');
include_once(S3DB_SERVER_ROOT.'/s3dbcore/callback.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/element_info.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/validation_engine.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/insert_entries.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/file2folder.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/update_entries.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/delete_entries.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/datamatrix.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/create.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/permission.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/list.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/S3QLRestWrapper.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/SQL.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/S3QLaction.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/htmlgen.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/acceptFile.php');
include_once (S3DB_SERVER_ROOT.'/s3dbcore/URIaction.php');
include_once(S3DB_SERVER_ROOT.'/s3dbcore/common_functions.inc.php');
$format = $_REQUEST['format'];
if($format=='') $format='html';
#if a key has been provided, validate the key
$key=$_REQUEST['key'];
include_once('core.header.php');
include_once(S3DB_SERVER_ROOT.'/s3dbcore/api.php');
#$user_proj = $GLOBALS['users_project'];
if(!$_REQUEST['query']){
$s3ql=compact('user_id','db');
$s3ql['from']='authority';
}
#now, if query is not empyt, read it, parse it, interpret it.
if($_REQUEST['query']){
$query = $_REQUEST['query'];
$q=compact('query','format','key','user_proj','user_id','db');
$s3ql=parse_xml_query($q);
##now interpret the query
$s3ql['db']=$db;
$s3ql['user_id']=$user_id;
$s3ql['format']=$format;
}
list($valid, $data, $cols)=apiQuery($s3ql);
if($valid)
{
#now display the data
if(!$cols)
$cols = array('user_id','authentication_id','created_on');
$z = compact('data','cols', 'format');
echo outputFormat($z);
}
else {
echo $data;
}
?>