JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
update wfpl and templates
[contractor-progress.git] / tiny_agreement.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 function tiny_agreement_get_fields() {
19         $name = format_oneline($_REQUEST['name']);
20         tem_set('name', $name);
21         
22         $level = format_options($_REQUEST['level'], 'level');
23         
24         return array($name, $level);
25 }
26
27 function tiny_agreement_main() {
28         if(!logged_in()) {
29                 $GLOBALS['url'] = this_url();
30                 return 'login';
31         }
32
33         pulldown('level', array(
34                 array('30', '$30'),
35                 array('40', '$40'),
36                 array('50', '$50'),
37                 array('75', '$75'),
38                 array('100', '$100'),
39                 array('150', '$150'),
40                 array('200', '$200'),
41                 array('300', '$300')), PULLDOWN_2D);
42
43         if(isset($_REQUEST['name'])) {
44                 list($name, $level) = tiny_agreement_get_fields();
45
46                 if($level) {
47                         if($name) {
48                                 db_update('people', 'name,tiny_agreement', $name, $level, 'where id=%i', logged_in());
49                                 message('Thank you for filling out the Tiny User Agreement.');
50                                 return './';
51                         } else {
52                                 message('Please enter your name.');
53                         }
54                 } else {
55                         message('Something went wrong there. Please try again');
56                 }
57         }
58 }
59
60 ?>