JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fixed css so prioritize links don't make a horizontal scroll bar
[contractor-progress.git] / su.php
1 <?php
2
3 #  Copyright (C) 2008  Jason Woofenden
4 #
5 #  This program is free software: you can redistribute it and/or modify
6 #  it under the terms of the GNU Affero General Public License as published by
7 #  the Free Software Foundation, either version 3 of the License, or
8 #  (at your option) any later version.
9 #
10 #  This program is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #  GNU Affero General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Affero General Public License
16 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 require_once('code/wfpl/format.php');
19
20 function su_main() {
21         if(!logged_in_as_contractor()) {
22                 $GLOBALS['url'] = this_url();
23                 message('You must be logged in as an administrator to access that function');
24                 return 'login';
25         }
26
27         $ret = _su_main();
28         if($ret) {
29                 return $ret;
30         }
31         tem_show('main_body');
32 }
33
34 function _su_main() {
35         $client_id = format_int($_REQUEST['as']);
36         if($client_id) {
37                 session_set('auth_username', $client_id);
38                 message('Switched Login');
39                 return './';
40         }
41
42         $rows = db_get_rows('people', 'id,name');
43
44         if($rows) foreach($rows as $row) {
45                 list($id, $name) = $row;
46                 tem_set('client_id', $id);
47                 tem_set('client_name', $name);
48                 tem_show('su_row');
49         }
50 }
51
52 ?>