-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread.php
75 lines (67 loc) · 2.39 KB
/
read.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
<?php
#acecpts an S3QL query to download the queried file
#Helena F Deus, March 18, 2009
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');
#echo '<pre>';print_r($db);
$query=($_REQUEST['query']!="")?$_REQUEST['query']:$_REQUEST['q'];
if($query=='')
{ echo formatReturn('3','Please input an S3QL query.',$format,'');
exit;
}
$q=compact('query','format','key','user_id','db');
$s3ql=parse_xml_query($q);
$s3ql['db']=$db;
$s3ql['user_id']=$user_id;
$data = S3QLaction($s3ql);
#echo '<pre>';print_r($data);
if(count($data)>1){
$s3ql['order_by']='created_on desc';
$s3ql['limit']='1';
$data = S3QLaction($s3ql);
}
if($data[0]['file_name']==''){
echo $data[0]['value'];
}
else {
$statement_info = $data[0];
pushDownload2Header(compact('statement_info', 'db', 'user_id', 'format'));
}
?>