-
Notifications
You must be signed in to change notification settings - Fork 3
/
header.php
139 lines (133 loc) · 4.12 KB
/
header.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
include 'settings.php';
if($isLocal == 1){
putenv('PATH=/usr/local/bin:');
}
$link = mysqli_connect($dbHost,$dbUser,$dbPass, $dbName);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if(!array_key_exists('graphDetail', $_GET)){
$graphDetail=0;
}else{
$graphDetail=$_GET['graphDetail'];
}
$graphType = 'default';
$sessionID = 'startup';
$timestep = 0;
//$command = "sh runTrust.sh ". $_GET['xmlfile']." ". $_GET['outputfile'];
if(array_key_exists('xmlfile', $_GET)){
if (isset($_COOKIE["userID"])){
// echo "james said so";
// echo "python testZML_C.py -i ".$_GET['xmlfile'] ." -u ".$_COOKIE['userID'];
$sessionID=exec("python testZML_C.py -i ".$_GET['xmlfile'] ." -u ".$_COOKIE['userID']);
setcookie("sessionID", $sessionID, time()+3600);
}else{
// echo "james missed it so";
$sessionID=exec("python testZML_C.py -i ".$_GET['xmlfile'] ."");
}
// $sessionID2=exec("/usr/bin/python2.7 --version 2>&1");
// echo "Session ID: (";
// echo $sessionID;
// echo $sessionID2;
// echo ") END";
$timestep=1;
ob_start();
include 'datagen_db.php';
$contents = ob_get_contents();
ob_end_clean();
$fp = file_put_contents("graphs2/".$sessionID.".debug",$contents);
ob_start();
include 'views/dotgen_high.php';
$contents = ob_get_contents();
ob_end_clean();
$fp = file_put_contents("graphs2/".$sessionID.".dot",$contents);
$output = exec("dot graphs2/".$sessionID.".dot -Txdot -o graphs2/".$sessionID.".gv");
}else if(array_key_exists('sessionID', $_GET)){
$sessionID=$_GET['sessionID'];
$timestep=$_GET['timestep'];
$contents = file_get_contents("graphs2/".$sessionID.".vars");
$store = unserialize($contents);
// TODO: look at issues with extract - is it bad to use extract?
extract($store);
//FOCUS is 'belief' DETAIL can be 'default' or 'low-level'
if(array_key_exists('beliefID', $_GET)){
$graphType = 'belief';
$beliefID=$_GET['beliefID'];
$graphDetail=$_GET['graphDetail'];
ob_start();
if($graphDetail=='2'){
//include 'views/belief_low.php';
} else {
include 'views/dotgen_observed.php';
}
$contents = ob_get_contents();
ob_end_clean();
//FOCUS is 'rule' DETAIL only 'expert'
}else if(array_key_exists('ruleID', $_GET)){
$graphType = 'rule';
$ruleID=$_GET['ruleID'];
ob_start();
include 'views/dotgen_inferred.php';
$contents = ob_get_contents();
ob_end_clean();
//FOCUS is 'agent' DETAIL can be 'expert', 'low-level', or 'mid-level'
}else if(array_key_exists('agentID', $_GET)){
$graphType = 'agent';
$agentID=$_GET['agentID'];
ob_start();
/*if($graphDetail=='2'){
include 'views/agent_low.php';
} else if($graphDetail=='1') {
include 'views/agent_mid.php';
} else {*/
include 'views/dotgen_agent.php';
//}
$contents = ob_get_contents();
ob_end_clean();
//FOCUS is 'argument' DETAIL can be 'expert', 'low-level', 'mid-level' or 'high-level'
}else if(array_key_exists('argumentID', $_GET)){
$graphType = 'argument';
$argumentID=$_GET['argumentID'];
$graphDetail=$_GET['graphDetail'];
ob_start();
if($graphDetail=='0'){
include 'views/dotgen_argument_high.php';
} else if($graphDetail=='1') {
include 'views/dotgen_argument_mid.php';
} else if($graphDetail=='2') {
include 'views/dotgen_argument_low.php';
} else {
include 'views/dotgen_argument.php';
}
$contents = ob_get_contents();
ob_end_clean();
}else{
exec("python testZML_C.py -s ".$sessionID . " -t ".$timestep);
// echo "python testZML_A.py -s ".$sessionID . " -t ".$timestep;
ob_start();
include 'datagen_db.php';
$contents = ob_get_contents();
ob_end_clean();
$fp = file_put_contents("graphs2/".$sessionID.".debug",$contents);
ob_start();
if($graphDetail=='0'){
include 'views/dotgen_high.php';
}else if($graphDetail=='1'){
include 'views/dotgen_mid.php';
}else if($graphDetail=='2'){
include 'views/dotgen_low.php';
} else {
include 'views/dotgen_hw.php';
}
$contents = ob_get_contents();
ob_end_clean();
}
$fp = file_put_contents("graphs2/".$sessionID.".dot",$contents);
$output = exec("dot graphs2/".$sessionID.".dot -Txdot -o graphs2/".$sessionID.".gv");
}else{
// echo "Upload a file on the right side";
$sessionID = "";
$timestep = 1;
}
?>