dcc202fb249a446ac15c7cf413b9f1b4a3f31b58
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

10) 
11) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
12) */
13) 
14) require_once('session/start.php');
15) 
16) require_once('invoice.php');
17) 
18) require_role(ROLE_CUSTOMER);
19) 
20) $section = $_SESSION['more_storage_section'];
21) 
22) title('Zusätzlichen Speicherplatz buchen');
23) 
24) 
25) check_form_token('more_storage');
26) 
27) $valid = false;
28) if (isset($_POST['more_storage_handle']) && isset($_SESSION['more_storage_handle']) &&
29)   $_POST['more_storage_handle'] == $_SESSION['more_storage_handle']) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

30)     $valid = true;
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

31) }
32) if (!$valid) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

33)     system_failure("Ungültige Session");
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

34) }
35) 
36) if (!isset($_SESSION['more_storage_items']) || !isset($_SESSION['more_storage_count'])) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

37)     system_failure('Keine Daten');
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

38) }
39) 
40) $items = $_SESSION['more_storage_items'];
41) $count = $_SESSION['more_storage_count'];
42) 
43) if (count($items) < 2) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

44)     system_failure("Ungültige Daten");
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

45) }
46) 
47) $stub = $items[0];
48) if ($stub['anzahl'] == 0) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

49)     $stub = null;
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

50) }
51) $regular = $items[1];
52) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

53) $clean_items = [];
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

54) 
55) if ($stub) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

56)     $i = [];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

57)     $i['beschreibung'] = $stub['beschreibung'];
58)     $i['datum'] = $stub['startdatum'];
59)     $i['kuendigungsdatum'] = $stub['enddatum'];
60)     $i['betrag'] = $stub['betrag'];
61)     $i['brutto'] = $stub['brutto'];
62)     $i['monate'] = $stub['anzahl'];
63)     $i['anzahl'] = $stub['anzahl'];
64)     $clean_items[] = $i;
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

65) }
66) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

67) $i = [];
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

68) $i['beschreibung'] = $regular['beschreibung'];
69) $i['datum'] = $regular['startdatum'];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

70) $i['kuendigungsdatum'] = null;
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

71) $i['betrag'] = $regular['betrag'];
72) $i['brutto'] = $regular['brutto'];
73) $i['monate'] = $regular['anzahl'];
74) $i['anzahl'] = $regular['anzahl'];
75) $clean_items[] = $i;
76) 
77) save_more_storage($clean_items, $count);
78) 
79) if (have_module('systemuser')) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

80)     require('modules/systemuser/include/useraccounts.php');
81)     $useraccounts = list_useraccounts();
82)     if (isset($_POST['more_storage_user'])) {
83)         foreach ($useraccounts as $u) {
84)             if ($u['uid'] == $_POST['more_storage_user']) {
85)                 $account = get_account_details($u['uid']);
86)                 $account['quota'] = $account['quota'] + $count;
87)                 set_account_details($account);
88)             }
89)         }
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

90)     }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

91)     unset($_SESSION['more_storage_user']);
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

92) }
93) 
94) 
95) unset($_SESSION['more_storage_handle']);
96) unset($_SESSION['more_storage_items']);
97) unset($_SESSION['more_storage_count']);
98) 
99) if (isset($_SESSION['more_storage_section'])) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

100)     DEBUG('Weiterleitung zu: '.$prefix.'go/'.str_replace('_', '/', $_SESSION['more_storage_section']));
101)     redirect($prefix.'go/'.str_replace('_', '/', $_SESSION['more_storage_section']));
Bernd Wurst Zwischenversion

Bernd Wurst authored 7 years ago

102) } else {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

103)     redirect($prefix.'go/invoice/current');