-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
260 lines (215 loc) · 9.04 KB
/
index.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
<?php
// Central config and libraries.
require(__DIR__.'/source/main.php');
function common_form_redirect($yukon_connection)
{
$result = FALSE;
$request_form = NULL;
$request_list = NULL;
if(isset($_REQUEST['id_form']))
{
$request_form = $_REQUEST['id_form'];
}
else
{
return $result;
}
if(isset($_REQUEST['list']))
{
$request_list = $_REQUEST['list'];
}
$database = new \dc\yukon\Database($yukon_connection);
$_main_data = new \dc\application\CommonEntry();
// Populate from request so that we have an
// ID and KEY ID (if nessesary) to work with.
$_main_data->populate_from_request();
// Set up primary query with parameters and arguments.
$database->set_sql('{call config_form(@param_filter_id = ?)}');
$params = array(array($request_form, SQLSRV_PARAM_IN));
// Apply arguments and execute query.
$database->set_param_array($params);
$database->query_run();
// Skip navigation data and get primary data record set.
$database->get_next_result();
$database->get_line_config()->set_class_name('\dc\application\CommonEntry');
if($database->get_row_exists() === TRUE)
{
$_main_data = $database->get_line_object();
if($_main_data->get_file_name())
{
$base_target = $_main_data->get_file_name();
}
else
{
$base_target = 'common_entry.php';
}
// Open record navigation object so we can
// get variables for redirect URL.
$obj_navigation_rec = new \dc\recordnav\RecordNav();
// Initialize redirect url object and
// populate variables.
$url_query = new \dc\url\URLFix;
$url_query->set_data('action', $obj_navigation_rec->get_action());
$url_query->set_data('id', $obj_navigation_rec->get_id());
$url_query->set_data('id_key', $obj_navigation_rec->get_id_key());
$url_query->set_data('id_form', $request_form);
if($request_list)
{
// Final result, and the target forwarding destination.
$result = '#';
// First thing we need is the self path.
$file = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL);
// List giles are the name of a single record file
// with _list added on, so all we need to do is
// remove the file suffix, and add '_list.php' to
// get the list file's name. This is also all we
// need for forwarding purposes.
$target_name = basename($base_target, '.php').'_list.php';
// To verify the list file exists, we have to target the
// file system path. We can combine the document root
// and self's directory to get it.
$root = filter_input(INPUT_SERVER, 'DOCUMENT_ROOT', FILTER_SANITIZE_URL);
$directory = dirname($file);
$target_file = $root.$directory.'/'.$target_name;
// Does the list file exisit? If so we can
// redirect to it. Otherwise, do nothing.
if(file_exists($target_file))
{
// Set target url.
$result = $target_name;
}
else
{
$result = $base_target;
}
}
else
{
$result = $base_target;
}
$url_query->set_url_base($result);
header('Location: '.$url_query->return_url());
exit;
}
}
common_form_redirect($yukon_connection);
$page_obj = new \dc\cache\PageCache();
$access_obj_process = new \dc\stoeckl\process();
$access_obj_process->get_config()->set_authenticate_url(APPLICATION_SETTINGS::DIRECTORY_PRIME);
$access_obj_process->get_config()->set_database($yukon_database);
$access_obj_process->process_control();
//var_dump($_POST);
//echo '<br />';
//var_dump($_SESSION);
//Get and verify log in status.
$access_obj = new \dc\stoeckl\status();
$access_obj->get_config()->set_authenticate_url(APPLICATION_SETTINGS::DIRECTORY_PRIME);
$access_obj->get_config()->set_database($yukon_database);
$access_obj->verify();
// Set up navigaiton.
$navigation_obj = new class_navigation();
$navigation_obj->generate_markup_nav();
$navigation_obj->generate_markup_footer();
?>
<!DOCtype html>
<html lang="en">
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1" />
<title><?php echo APPLICATION_SETTINGS::NAME; ?></title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="source/css/style.css" />
<link rel="stylesheet" href="source/css/print.css" media="print" />
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Modal -->
<div id="help_link_blue" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Link Blue</h4>
</div>
<div class="modal-body">
<p>Link Blue is the University of Kentucky's campus wide Active Directory login. It is the same account name and password you use to log into a workstation. <a href="//www.uky.edu/UKHome/subpages/linkblue.html" target="_blank">Click here</a> for more information.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="container" class="container">
<?php echo $navigation_obj->get_markup_nav(); ?>
<div class="page-header">
<h1><?php echo APPLICATION_SETTINGS::NAME; ?></h1>
<p class="lead">
<?php
echo '<!--account:'.$access_obj->get_account().'-->';
echo '<!--id:'.$access_obj->get_id().'-->';
// Logged in?
if($access_obj->get_account())
{
// Get current hour in the 24 hour clock format.
$time = date('H');
// Give user a greeting based on hour of the day.
if ($time < '12')
{
echo 'Good morning ';
}
else if ($time >= '12' && $time < '17')
{
echo 'Good afternoon ';
}
else if ($time >= "17")
{
echo 'Good evening ';
}
echo $access_obj->get_name_f();
?>! Thank you for using <?php echo APPLICATION_SETTINGS::NAME; ?>.</p>
<?php
}
else
{
?>
<p class="lead">Welcome to <?php echo APPLICATION_SETTINGS::NAME; ?>. In order to use <?php echo APPLICATION_SETTINGS::NAME; ?>, please log in using your <a href="#" data-toggle="modal" data-target="#help_link_blue">Link Blue</a> account and password.</p>
<p><?php echo $access_obj->dialog(); ?></p>
<!--Note: PHP self is nessesary to override any link vars.-->
<form role="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" class="form-control" name="account" id="account" placeholder="Link Blue Account" required>
</div>
<br>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input type="password" class="form-control" name="credential" id="credential" placeholder="Password" required>
</div>
<br>
<button type="submit" name="access_action" value="<?php echo \dc\stoeckl\ACTION::LOGIN; ?>" class="btn btn-default"><span class="glyphicon glyphicon-log-in"></span> Login</button>
</form>
<?php
}
?>
</div>
<?php echo $navigation_obj->get_markup_footer(); ?>
</div><!--container-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40196994-1', 'uky.edu');
ga('send', 'pageview');
</script>
</body>
</html>
<?php
// Collect and output page markup.
echo $page_obj->markup_and_flush();
?>