-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlinks.php
269 lines (229 loc) · 6.86 KB
/
links.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?php
/*
* links.php
*
* Include file that contains links
* Needs session_start(), config.php
*
*/
if ( !isset( $enable_PAM ) ) {
$enable_PAM = false;
}
$userlevel = ( isset( $_SESSION['userlevel'] ) ) ? $_SESSION['userlevel'] : -1;
$change_my_info_if_not_PAM =
$enable_PAM && $_SESSION['authenticatePAM'] == true
? ""
: "<a href='https://$org_site/profile.php?edit=12'>Change My Info</a>"
;
if ( $userlevel > 0 ) {
$projects_menu = <<<HTML
<h4>Project</h4>
<a href='https://$org_site/view_projects.php'>Projects</a>
<!-- <a href='https://$org_site/edit_images.php'>Edit Image</a> -->
<a href='https://$org_site/supporting_files.php'>Supporting Files</a>
<a href='https://$org_site/view_reports.php'>Reports</a>
<a href='https://$org_site/data_sharing.php'>Sharing</a>
HTML;
}
$analysis_menu = <<<HTML
<h4>Analysis</h4>
<a href='https://$org_site/queue_setup_1.php'>Queue Setup</a>
<a href='https://$org_site/2DSA_1.php'>2DSA Analysis</a>
<a href='https://$org_site/2DSA-CG_1.php'>2DSA Custom Grid</a>
<a href='https://$org_site/GA_1.php'>GA Analysis</a>
<a href='https://$org_site/DMGA_1.php'>Discrete GA</a>
<a href='https://$org_site/PCSA_1.php'>PCSA Analysis</a>
<a href='https://$org_site/runID_info.php'>RunID Info</a></li>
HTML;
$monitor_menu = <<<HTML
<h4>Status Monitor</h4>
<a href='https://$org_site/queue_viewer.php'>Queue Status</a>
<a href='https://$org_site/show_clusters.php'>Cluster Status</a>
HTML;
$general_menu = <<<HTML
<h4>General</h4>
$change_my_info_if_not_PAM
<a href='https://$org_site/view_database_info.php'>Database Login Info</a>
<a href="partners.php">Partners</a>
<a href='contacts.php'>Contacts</a>
<a href='mailto:$admin_email'>Webmaster</a>
<a href='data_security.php'>Data Security</a>
<a href='http://$org_site/logout.php'>Logout</a>
HTML;
$general_menu_1 = <<<HTML
<h4>General</h4>
$change_my_info_if_not_PAM
<a href="partners.php">Partners</a>
<a href='contacts.php'>Contacts</a>
<a href='mailto:$admin_email'>Webmaster</a>
<a href='data_security.php'>Data Security</a>
<a href='http://$org_site/logout.php'>Logout</a>
HTML;
if ( $userlevel == 5 ) // level 5 = super admin ( developer )
{
$sidebar_menu = <<<HTML
<h4>Navigation</h4>
<a href="https://$org_site/index.php">Welcome!</a>
<a href='https://$org_site/admin_links.php'>Admin Info</a>
$projects_menu
$analysis_menu
$monitor_menu
$general_menu
HTML;
}
else if ( $userlevel == 4 ) // userlevel 4 = admin
{
$sidebar_menu = <<<HTML
<h4>Navigation</h4>
<a href="https://$org_site/index.php">Welcome!</a>
<a href='https://$org_site/admin_links.php'>Admin Info</a>
$projects_menu
$analysis_menu
$monitor_menu
$general_menu
HTML;
}
else if ( $userlevel == 3 ) // userlevel 3 = superuser
{
$sidebar_menu = <<<HTML
<h4>Navigation</h4>
<a href="https://$org_site/index.php">Welcome!</a>
<a href='https://$org_site/admin_links.php'>Admin Info</a>
$projects_menu
$analysis_menu
$monitor_menu
$general_menu
HTML;
}
else if ( $userlevel == 2 ) // userlevel 2 = Data analyst
{
$sidebar_menu = <<<HTML
<h4>Navigation</h4>
<a href="https://$org_site/index.php">Welcome!</a>
$projects_menu
$analysis_menu
$monitor_menu
$general_menu
HTML;
}
else if ( $userlevel == 1 ) // level 1 = privileged user
{
$sidebar_menu = <<<HTML
<h4>Navigation</h4>
<a href="https://$org_site/index.php">Welcome!</a>
$projects_menu
$general_menu_1
HTML;
}
else if ( $userlevel == 0 ) // level 0 = regular user
{
$sidebar_menu = <<<HTML
<h4>Navigation</h4>
<a href="https://$org_site/index.php">Welcome!</a>
<a href='https://$org_site/admin_links.php'>Admin Info</a>
$projects_menu
$general_menu_1
HTML;
}
else // not logged in
{
$sidebar_menu = <<<HTML
<a href="http://$org_site/index.php">Welcome!</a>
<a href="partners.php">Partners</a>
<a href='contacts.php'>Contacts</a>
<a href='mailto:$admin_email'>Webmaster</a>
<a href='data_security.php'>Data Security</a>
<a href='https://$org_site/login.php'>Login</a>
HTML;
}
echo<<<HTML
<div id='sidebar'>
$sidebar_menu
<!-- A spacer -->
<!--div style='padding-bottom:20em;'></div-->
</div>
HTML;
// Function used by 2DSA_1.php, 2DSA-CG_1.php, ... to re-determine
// the latest noise associated with latest edits
function set_latest_noises( $link )
{
$nreq = count( $_SESSION['request'] );
$nndiff = 0;
$count = 0;
while ( $count < $nreq )
{ // Loop through latest edits examining associated noises
$editedDataID = $_SESSION['request'][$count]['editedDataID'];
$rawDataID = $_SESSION['request'][$count]['rawDataID'];
$nIDsOld = $_SESSION['request'][$count]['noiseIDs'];
$noiseIDs = array();
$query = "SELECT noiseID, noiseType, timeEntered " .
"FROM noise " .
"WHERE editedDataID = $editedDataID " .
"ORDER BY timeEntered DESC ";
$result = mysqli_query( $link, $query )
or die("Query failed : $query<br />\n" . mysqli_error($link));
$knoise = 0;
$prtype = "";
$prtime = 0;
while ( list( $noiseID, $noiseType, $time ) = mysqli_fetch_array( $result ) )
{ // Loop through noises in reverse date order to save IDs of latest for the edit
if ( $knoise == 0 )
{ // First encountered noise is the latest
$noiseIDs[$knoise] = $noiseID;
$prtype = $noiseType;
$prtime = (int)$time;
$knoise++;
}
else if ( $knoise == 1 )
{ // If second is different type, same time; it is latest
if ( $prtype == $noiseType ) break;
$tdiff = (int)$time - $prtime;
if ( $tdiff > 2 ) break;
$noiseIDs[$knoise] = $noiseID;
$knoise++;
break;
}
}
$_SESSION['request'][$count]['noiseIDs'] = $noiseIDs;
$_SESSION['cells'][$rawDataID]['noiseIDs'] = $noiseIDs;
$nno1 = count( $nIDsOld );
$nno2 = count( $noiseIDs );
if ( $nno1 != $nno2 )
{ // Different count of noises in edit, all are new
$nndiff += $nno2;
}
else
{ // Same count: examine for differing IDs
for ( $ii = 0; $ii < $nno1; $ii++ )
{
if ( $nIDsOld[ $ii ] != $noiseIDs[ $ii ] )
$nndiff++;
}
}
$count++;
}
$new_noise = '';
// Compose additional page string documenting any new noise determination
if ( $nndiff === 0 )
{
$new_noise = "<div style='color:blue;'>" .
"Previously selected latest edits and noises are in force." .
"</div>\n";
}
else if ( $nndiff === 1 )
{
$new_noise = "<div style='color:blue;'>" .
"Previously selected latest edits are in force.<br/>" .
"1 new latest noise was detected." .
"</div>\n";
}
else
{
$new_noise = "<div style='color:blue;'>" .
"Previously selected latest edits are in force.<br/>" .
"$nndiff new latest noises were detected." .
"</div>\n";
}
$_SESSION['new_noise'] = $new_noise;
}
?>