424fa5f89005c772770c3f753c274c0500e0f975
[memberdb.git] / index.php
1 <?php
2
3 header('Content-type: text/html; charset=utf-8');
4 if (function_exists('date_default_timezone_set')) {
5     date_default_timezone_set('UTC');
6 }
7 bcscale(2);
8
9 require_once('config.php');
10 require_once('include/database.php');
11 require_once('include/misc.php');
12 require_once('include/installation.php');
13 require_once('include/html.php');
14
15 require_once('include/finances.php');
16 require_once('include/fees.php');
17 require_once('include/cryptography.php');
18 require_once('include/earnings.php');
19 require_once('include/events.php');
20 require_once('include/expenses.php');
21 require_once('include/members.php');
22 require_once('include/payments.php');
23 require_once('include/directdebit.php');
24 require_once('include/xlsexport.php');
25
26
27 try {
28
29     db_connect();
30
31     if (!defined('IS_INSTALLED') || !IS_INSTALLED) {
32         install_database();
33     }
34
35     $action = 'list_members';
36     if (isset($_REQUEST['action'])) {
37         $action = $_REQUEST['action'];
38     }
39
40     ob_start();
41
42     switch ($action) {
43         case 'list_members'   :
44             action_list_members();
45             break;
46         case 'view_member'    :
47             action_view_member();
48             break;
49         case 'export_email'   :
50             action_export_email();
51             break;
52         case 'create_member'  :
53             action_create_member();
54             break;
55         case 'change_member'  :
56             action_change_member();
57             break;
58         case 'export_ibanhin' :
59             action_export_ibanhin();
60             break;
61         case 'create_event'   :
62             action_create_event();
63             break;
64         case 'change_event'   :
65             action_change_event();
66             break;
67         case 'delete_event'   :
68             action_delete_event();
69             break;
70         case 'create_earnings':
71             action_create_earnings();
72             break;
73         case 'create_earning' :
74             action_create_earning();
75             break;
76         case 'change_earning' :
77             action_change_earning();
78             break;
79         case 'delete_earning' :
80             action_delete_earning();
81             break;
82         case 'create_expense' :
83             action_create_expense();
84             break;
85         case 'change_expense' :
86             action_change_expense();
87             break;
88         case 'delete_expense' :
89             action_delete_expense();
90             break;
91         case 'cryptography'   :
92             action_cryptography();
93             break;
94         case 'fees'           :
95             action_fees();
96             break;
97         case 'directdebit'    :
98             action_directdebit();
99             break;
100         case 'finances'       :
101             action_finances();
102             break;
103         case 'export'         :
104             action_export_payments();
105             break;
106         case 'export_members' :
107             action_export_members();
108             break;
109         default:
110             action_404();
111     }
112
113     $content = ob_get_contents();
114     ob_end_clean();
115
116     ?>
117     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
118             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
119
120     <html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
121     <head>
122         <title>Mitgliedsverwaltung - Chaos Computer Club Frankfurt am Main</title>
123         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
124         <style type="text/css">
125             form {
126                 line-height: 2em;
127             }
128
129             fieldset {
130                 line-height: 2em;
131                 border: 1px solid #ccc;
132                 margin-bottom: 1em;
133                 float: left;
134                 border-width: 1px 0 0 0;
135                 width: 27em;
136             }
137
138             /*fieldset { border: 1px solid #ccc; margin-bottom: 1em; float:left; border-width: 1px 0 0 0; } */
139             legend {
140                 font-size: 1.4em;
141             }
142
143             label {
144                 clear: left;
145                 display: block;
146                 width: 10em;
147                 float: left;
148             }
149
150             input, select {
151                 display: block;
152                 width: 20em;
153                 float: left;
154             }
155
156             form small {
157                 clear: left;
158                 display: block;
159                 text-align: right;
160                 margin-right: 1.8em;
161                 line-height: 1em;
162                 margin-bottom: 1.5em;
163             }
164
165             fieldset small {
166                 clear: left;
167                 display: block;
168                 text-align: right;
169                 margin-right: 1.8em;
170                 line-height: 1em;
171                 margin-bottom: 1.5em;
172             }
173
174             .checkbox label {
175                 clear: none;
176                 margin-left: 0.5em;
177             }
178
179             .checkbox input {
180                 clear: left;
181                 width: auto;
182             }
183
184             #header {
185                 margin: 0;
186                 padding: 1px 0;
187                 background-color: #464646;
188             }
189
190             #content {
191                 font-size: 1.4em;
192             }
193
194             .content {
195                 margin: 0 auto;
196                 width: 960px;
197             }
198
199             .submit {
200                 clear: left;
201             }
202
203             h1 {
204                 color: #fff;
205             }
206
207             body {
208                 margin: 0;
209                 padding: 0;
210                 font-family: Arial, Verdana, Tahoma;
211                 font-size: 62.5%;
212                 color: #333;
213             }
214
215             html {
216                 margin: 0;
217                 padding: 0;
218             }
219
220             table {
221                 border-collapse: collapse;
222                 margin-bottom: 1em;
223                 border: 1px solid #ccc;
224             }
225
226             th, td {
227                 padding: 0.3em 2em 0.3em 0.3em;
228             }
229
230             tr:hover {
231                 background-color: #eee;
232             }
233
234             tr.earning {
235                 background-color: #efe;
236             }
237
238             tr.expense {
239                 background-color: #fee;
240             }
241
242             tr.earning:hover {
243                 background-color: #dfd;
244             }
245
246             tr.expense:hover {
247                 background-color: #fdd;
248             }
249
250             tr.total {
251                 background-color: #eee;
252                 font-weight: bold;
253             }
254
255             tr.current {
256                 background-color: #eee;
257                 font-weight: bold;
258             }
259
260             tr.inactive {
261                 color: #999;
262             }
263
264             #earning_form {
265                 background-color: #efe;
266             }
267
268             #expense_form {
269                 background-color: #fee;
270             }
271
272             th {
273                 text-align: left;
274                 background-color: #eee;
275                 font-weight: normal;
276                 border-bottom: 1px solid #ccc;
277             }
278
279             h1, h2, h3, legend {
280                 font-family: Georgia, Sans-Serif, Verdana;
281                 font-weight: normal;
282                 color: #333;
283             }
284
285             #header h1 {
286                 font-size: 4em;
287                 color: #fff;
288             }
289
290             h2 {
291                 font-size: 2.2em;
292             }
293
294             h3 {
295                 font-size: 1.8em;
296             }
297
298             #pagemenu {
299                 background-color: #e0e0e0;
300                 border-top: 1px solid #e4f2fd;
301                 font-size: 1.4em;
302             }
303
304             #pagemenu ul {
305                 list-style: none;
306                 padding: 0px 10px;
307                 display: block;
308                 margin-top: 6px;
309             }
310
311             #pagemenu li {
312                 line-height: 28px;
313                 font-weight: bold;
314                 display: inline;
315                 float: left;
316                 margin-left: 5px;
317             }
318
319             #pagemenu li a {
320                 display: block;
321                 color: #888;
322                 background-color: #eee;
323                 padding: 0px 20px;
324                 text-decoration: none;
325             }
326
327             #pagemenu li a:hover {
328                 color: #000;
329                 background: #fff;
330             }
331
332             #footer {
333                 background-color: #eee;
334                 border-top: 1px solid #ddd;
335                 height: 50px;
336                 margin-top: 3em;
337             }
338
339             .clearfix:after {
340                 content: " ";
341                 display: block;
342                 clear: both;
343                 visibility: hidden;
344                 line-height: 0;
345                 height: 0;
346             }
347
348             .clearfix {
349                 display: inline-block;
350             }
351
352             html[xmlns] .clearfix {
353                 display: block;
354             }
355
356             * html .clearfix {
357                 height: 1%;
358             }
359
360             .log_messages {
361                 color: #cc0000;
362             }
363
364             p.error {
365                 border: 1px solid #900;
366                 padding: 1em;
367                 color: #cc0000;
368                 background-color: #fff9f9;
369             }
370
371             #content a {
372                 text-decoration: none;
373                 padding: 0 1px;
374                 color: #21759B;
375                 border-bottom: 1px solid #ccc;
376             }
377
378             #content a:hover {
379                 color: #D54E21;
380                 background: #F5D1C5;
381                 border-bottom: 1px solid #D54E21;
382             }
383
384             .modal_window {
385                 position: absolute;
386                 display: none;
387                 background-color: #fff;
388                 padding: 1em;
389             }
390
391             #mask {
392                 position: absolute;
393                 top: 0px;
394                 left: 0px;
395                 height: 100%;
396                 width: 100%;
397                 display: none;
398                 background-color: black;
399             }
400
401             .pagination {
402                 text-align: center;
403                 margin: 10px 0;
404                 font-weight: bold;
405             }
406
407             .pagination .prev {
408                 float: left;
409             }
410
411             .pagination .next {
412                 float: right;
413             }
414
415         </style>
416         <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
417         <script type="text/javascript" src="js/crypto-js/crypto/crypto-min.js"></script>
418         <script type="text/javascript" src="js/crypto-js/sha1/sha1-min.js"></script>
419         <script type="text/javascript" src="js/crypto-js/hmac/hmac-min.js"></script>
420         <script type="text/javascript" src="js/crypto-js/pbkdf2/pbkdf2-min.js"></script>
421         <script type="text/javascript" src="js/crypto-js/ofb/ofb-min.js"></script>
422         <script type="text/javascript" src="js/crypto-js/aes/aes_modified.js"></script>
423         <script type="text/javascript" src="js/date.js"></script>
424         <script type="text/javascript" src="js/utils.js"></script>
425         <script type="text/javascript" src="js/dtaus.js"></script>
426         <script type="text/javascript" src="js/sepa-CORE.js"></script>
427     </head>
428     <body>
429     <div id="header">
430         <div class="content"><h1>Mitgliedsverwaltung</h1></div>
431     </div>
432     <div id="pagemenu">
433         <ul class="content clearfix">
434             <li><a href="<?= link_to() ?>">Mitglieder</a></li>
435             <li><a href="<?= link_to('finances') ?>">Finanzen</a></li>
436             <li><a href="<?= link_to('fees') ?>">Mitgliedsbeitr&auml;ge</a></li>
437             <li><a href="<?= link_to('directdebit') ?>">Bankeinzug</a></li>
438             <li><a href="<?= link_to('cryptography') ?>">Kryptographie</a></li>
439         </ul>
440     </div>
441     <div id="content" class="content"><?= $content ?></div>
442     <div id="footer"></div>
443     </body>
444     </html>
445
446     <?php
447
448 } catch (Exception $e) {
449     echo 'Caught exception: ', $e->getMessage(), "\n";
450 }