Replaced die()-calls with exceptions where appropriate.
[memberdb.git] / index.php
1 <?php
2
3 header('Content-type: text/html; charset=utf-8');
4 if (function_exists('date_default_timezone_set')) date_default_timezone_set('UTC');
5 bcscale(2);
6
7 require_once('config.php');
8 require_once('include/database.php');
9 require_once('include/misc.php');
10 require_once('include/installation.php');
11 require_once('include/html.php');
12
13 require_once('include/finances.php');
14 require_once('include/fees.php');
15 require_once('include/cryptography.php');
16 require_once('include/earnings.php');
17 require_once('include/events.php');
18 require_once('include/expenses.php');
19 require_once('include/members.php');
20 require_once('include/payments.php');
21 require_once('include/dtaus.php');
22 require_once('include/export.php');
23
24
25 try {
26
27     db_connect();
28
29     if (!defined('IS_INSTALLED') || !IS_INSTALLED) install_database();
30
31     $action = 'list_members';
32     if (isset($_REQUEST['action'])) $action = $_REQUEST['action'];
33
34     ob_start();
35
36     switch ($action) {
37         case 'list_members'   : action_list_members();    break;
38         case 'view_member'    : action_view_member();     break;
39         case 'export_email'   : action_export_email();    break;
40         case 'create_member'  : action_create_member();   break;
41         case 'change_member'  : action_change_member();   break;
42         case 'create_event'   : action_create_event();    break;
43         case 'change_event'   : action_change_event();    break;
44         case 'delete_event'   : action_delete_event();    break;
45         case 'create_earnings': action_create_earnings(); break;
46         case 'create_earning' : action_create_earning();  break;
47         case 'change_earning' : action_change_earning();  break;
48         case 'delete_earning' : action_delete_earning();  break;
49         case 'create_expense' : action_create_expense();  break;
50         case 'change_expense' : action_change_expense();  break;
51         case 'delete_expense' : action_delete_expense();  break;
52         case 'cryptography'   : action_cryptography();    break;
53         case 'fees'           : action_fees();            break;
54         case 'dtaus'          : action_dtaus();           break;
55         case 'finances'       : action_finances();        break;
56         case 'export'         : action_export();          break;
57         default: action_404();
58     }
59
60     $content = ob_get_contents();
61     ob_end_clean();
62
63 ?>
64 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
65
66 <html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
67     <head>
68         <title>Mitgliedsverwaltung - Chaos Computer Club Frankfurt am Main</title>
69         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
70         <style type="text/css">
71             form  { line-height: 2em; }
72             fieldset { line-height: 2em; border: 1px solid #ccc; margin-bottom: 1em; float:left; border-width: 1px 0 0 0; width: 27em; }
73             /*fieldset { border: 1px solid #ccc; margin-bottom: 1em; float:left; border-width: 1px 0 0 0; } */
74             legend { font-size: 1.4em; }
75             label { clear: left; display: block; width: 10em; float: left; }
76             input, select { display: block; width: 20em; float: left; }
77             form small { clear: left; display: block; text-align: right; margin-right: 1.8em; line-height: 1em; margin-bottom: 1.5em; }
78             fieldset small { clear: left; display: block; text-align: right; margin-right: 1.8em; line-height: 1em; margin-bottom: 1.5em; }
79             .checkbox label { clear: none; margin-left: 0.5em; }
80             .checkbox input { clear: left; width: auto;  }
81             #header { margin: 0; padding: 1px 0; background-color: #464646; }
82             #content { font-size: 1.4em; }
83             .content { margin: 0 auto; width: 960px; }
84             .submit { clear: left; }
85             h1 { color: #fff; }
86             body { margin: 0; padding: 0; font-family:  Arial, Verdana, Tahoma; font-size: 62.5%; color: #333; }
87             html { margin: 0; padding: 0; }
88             table { border-collapse: collapse; margin-bottom: 1em; border: 1px solid #ccc; }
89             th, td { padding: 0.3em 2em 0.3em 0.3em;}
90             tr:hover { background-color: #eee; }
91             tr.earning { background-color: #efe; }
92             tr.expense { background-color: #fee; }
93             tr.earning:hover { background-color: #dfd; }
94             tr.expense:hover { background-color: #fdd; }
95             tr.total { background-color: #eee; font-weight: bold; }
96             tr.current { background-color: #eee; font-weight: bold; }
97             tr.inactive { color: #999; }
98             #earning_form { background-color: #efe; }
99             #expense_form { background-color: #fee; }
100             th { text-align: left; background-color: #eee; font-weight: normal; border-bottom: 1px solid #ccc;  }
101             h1, h2, h3, legend { font-family: Georgia, Sans-Serif, Verdana; font-weight: normal; color: #333;}
102             #header h1 { font-size: 4em; color: #fff; }
103             h2 { font-size: 2.2em; }
104             h3 { font-size: 1.8em; }
105             #pagemenu { background-color: #e0e0e0; border-top: 1px solid #e4f2fd; font-size: 1.4em; }
106             #pagemenu ul { list-style: none; padding: 0px 10px; display:block; margin-top: 6px; }
107             #pagemenu li { line-height:28px; font-weight: bold; display: inline; float: left; margin-left: 5px; }
108             #pagemenu li a { display: block; color: #888; background-color: #eee; padding: 0px 20px; text-decoration: none; }
109             #pagemenu li a:hover { color: #000; background: #fff; }
110             #footer { background-color: #eee; border-top: 1px solid #ddd; height: 50px; margin-top: 3em; }
111             .clearfix:after { content: " "; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; }
112             .clearfix { display: inline-block; }
113             html[xmlns] .clearfix { display: block; }
114             * html .clearfix { height: 1%; }
115             .log_messages { color: #cc0000; }
116             p.error { border: 1px solid #900;  padding: 1em; color: #cc0000; background-color: #fff9f9;}
117
118             #content a { text-decoration: none; padding: 0 1px; color: #21759B; border-bottom: 1px solid #ccc; }
119             #content a:hover { color: #D54E21; background: #F5D1C5; border-bottom: 1px solid #D54E21; }
120             .modal_window { position:absolute; display:none; background-color: #fff; padding: 1em; }
121             #mask { position:absolute; top:0px; left:0px; height:100%; width:100%; display:none; background-color: black; }
122
123             .pagination { text-align: center; margin: 10px 0; font-weight: bold; }
124             .pagination .prev { float: left; }
125             .pagination .next { float: right; }
126
127         </style>
128         <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
129         <script type="text/javascript" src="js/crypto-js/crypto/crypto-min.js"></script>
130         <script type="text/javascript" src="js/crypto-js/sha1/sha1-min.js"></script>
131         <script type="text/javascript" src="js/crypto-js/hmac/hmac-min.js"></script>
132         <script type="text/javascript" src="js/crypto-js/pbkdf2/pbkdf2-min.js"></script>
133         <script type="text/javascript" src="js/crypto-js/ofb/ofb-min.js"></script>
134         <script type="text/javascript" src="js/crypto-js/aes/aes_modified.js"></script>
135         <script type="text/javascript" src="js/dtaus.js"></script>
136     </head>
137     <body>
138     <div id="header"><div class="content"><h1>Mitgliedsverwaltung</h1></div></div>
139     <div id="pagemenu">
140         <ul class="content clearfix">
141             <li><a href="<?=link_to()?>">Mitglieder</a></li>
142             <li><a href="<?=link_to('finances')?>">Finanzen</a></li>
143             <li><a href="<?=link_to('fees')?>">Mitgliedsbeitr&auml;ge</a></li>
144             <li><a href="<?=link_to('dtaus')?>">Bankeinzug</a></li>
145             <li><a href="<?=link_to('cryptography')?>">Kryptographie</a></li>
146         </ul>
147     </div>
148     <div id="content" class="content"><?=$content?></div>
149     <div id="footer"></div>
150     </body>
151 </html>
152
153 <?php
154
155 }
156 catch (Exception $e) {
157     echo 'Caught exception: ',  $e->getMessage(), "\n";
158 }