Subversion Repositories public

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 andreas 1
<?php
2
$login = $_REQUEST['login'];
3
 
4
require_once('version.inc');
5
require_once('dbaccess.inc');
6
require_once('language.inc');
7
require_once('header.inc');
8
require_once('settings.inc');
9
require_once('crypt.inc');
10
require_once('menu.inc');
11
 
12
$func = $_REQUEST['func'];
13
$dbname = $_REQUEST['dbname'];
14
$domain = $_REQUEST['domain'];
15
$suser = $_REQUEST['suser'];
16
$pass1 = $_REQUEST['pass1'];
17
$pass2 = $_REQUEST['pass2'];
18
$periode = $_REQUEST['periode'];
19
$verteil = $_REQUEST['verteil'];
20
$einheit = $_REQUEST['einheit'];
21
$leneinheit = $_REQUEST['leneinheit'];
22
$phase = $_REQUEST['phase'];
23
$numphase = $_REQUEST['numphase'];
24
$dtformatshort = $_REQUEST['dtformatshort'];
25
$dtformatlong = $_REQUEST['dtformatlong'];
26
$datetime = $_REQUEST['datetime'];
27
$pmlight = $_REQUEST['pmlight'];
28
$role = $_REQUEST['role'];
29
$title_str = $_REQUEST['title'];
30
$pj_lock = $_REQUEST['pj_lock'];
31
$statusbericht = $_REQUEST['statusbericht'];
32
$shortcuts = $_REQUEST['shortcuts'];
33
$verrmodul = $_REQUEST['verrmodul'];
34
$pjcopy = $_REQUEST['pjcopy'];
35
 
36
function FormInitDB($dbname, $suser, $domain) {
37
	global $periode;
38
	global $verteil;
39
	global $einheit;
40
	global $leneinheit;
41
	global $phase;
42
	global $numphase;
43
	global $dtformatshort;
44
	global $dtformatlong;
45
	global $datetime;
46
	global $pmlight;
47
	global $role;
48
	global $pj_lock;
49
	global $statusbericht;
50
	global $shortcuts;
51
	global $verrmodul;
52
	global $pjcopy;
53
 
54
	if (!isset($dtformatshort))
55
	   $dtformatshort = "d.m.Y";
56
 
57
	if (!isset($dtformatlong))
58
	   $dtformatlong = "d F y";
59
 
60
	if (!isset($datetime))
61
	   $datetime = "d.m.Y H:i:s"
62
 
63
	if (!isset($statusbericht))
64
	   $statusbericht = false;
65
 
66
	if (!isset($shortcuts))
67
	   $shortcuts = false;
68
 
69
	if (!isset($verrmodul))
70
	   $verrmodul = false;
71
 
72
	if (!isset($pjcopy))
73
	   $pjcopy = 3;
74
?>
75
<form action="initdb.php" method="post">
76
   <input type="hidden" name="func" value="FormInitDB">
77
   <input type="hidden" name="statusbericht" value="<? echo "$statusbericht"; ?>">
78
   <input type="hidden" name="headline" value="2">
79
<table class="input">
80
   <tr>
81
      <th colspan=2 class="sel"><? Output(-1, 221, "Datenbank"); ?></th>
82
   <tr>
83
      <td><? Output(-1, 222, "Datenbankname:"); ?></td>
84
      <td><input type="text" name="dbname" value="<? echo "$dbname"; ?>" size=16 maxlength=16></td>
85
   </tr>
86
   <tr>
87
      <td><? Output(-1, 223, "Domainname:"); ?></td>
88
      <td><input type="text" name="domain" value="<? echo "$domain"; ?>" size=30 maxlength=80></td>
89
   </tr>
90
   <tr>
91
      <th colspan=2 class="sel"><? Output(-1, 91, "Einstellungen f&uuml;r die Planung"); ?></th>
92
   </tr>
93
   <tr>
94
      <td><? Output(-1, 92, "L&auml;nge einer Periode:"); ?></td>
95
      <td><select name="periode">
96
             <option value="1" <? if ($periode == 1) echo "selected"; ?>><? Output(-1, 93, "Jahr"); ?></option>
97
	     <option value="2" <? if ($periode == 2) echo "selected"; ?>><? Output(-1, 94, "Quartal"); ?></option>
98
	     <option value="3" <? if ($periode == 3) echo "selected"; ?>><? Output(-1, 95, "Monat"); ?></option>
99
	     <option value="4" <? if ($periode == 4) echo "selected"; ?>><? Output(-1, 96, "Woche"); ?></option>
100
	     <option value="5" <? if ($periode == 5) echo "selected"; ?>><? Output(-1, 97, "Tag"); ?></option>
101
	  </select>
102
      </td>
103
   </tr>
104
   <tr>
105
      <td><? Output(-1, 98, "Verteilung der Auw&auml;nde:"); ?></td>
106
      <td><select name="verteil">
107
             <option value="1" <? if ($verteil == 1) echo "selected"; ?>><? Output(-1, 99, "Normalverteilung"); ?></option>
108
	     <option value="2" <? if ($verteil == 2) echo "selected"; ?>><? Output(-1, 100, "Endlastig"); ?></option>
109
	     <option value="3" <? if ($verteil == 3) echo "selected"; ?>><? Output(-1, 101, "Anfangslastig"); ?></option>
110
	     <option value="4" <? if ($verteil == 4) echo "selected"; ?>><? Output(-1, 102, "Anfang&minus; und Endlasig"); ?></option>
111
	     <option value="5" <? if ($verteil == 5) echo "selected"; ?>><? Output(-1, 103, "Mittellastig"); ?></option>
112
	     <option value="6" <? if ($verteil == 6) echo "selected"; ?>><? Output(-1, 104, "Individuell"); ?></option>
113
	  </select>
114
      </td>
115
   </tr>
116
   <tr>
117
      <td><? Output(-1, 105, "Gr&ouml;&szlig;e einer Arbeitseiheit:"); ?></td>
118
      <td><select name="einheit">
119
             <option value="1" <? if ($einheit == 1) echo "selected"; ?>><? Output(-1, 106, "Stunde"); ?></option>
120
	     <option value="2" <? if ($einheit == 2) echo "selected"; ?>><? Output(-1, 107, "Tag"); ?></option>
121
	     <option value="3" <? if ($einheit == 3) echo "selected"; ?>><? Output(-1, 108, "Woche"); ?></option>
122
	     <option value="4" <? if ($einheit == 4) echo "selected"; ?>><? Output(-1, 109, "Monat"); ?></option>
123
	     <option value="5" <? if ($einheit == 5) echo "selected"; ?>><? Output(-1, 110, "Quartal"); ?></option>
124
	     <option value="6" <? if ($einheit == 6) echo "selected"; ?>><? Output(-1, 111, "Jahr"); ?></option>
125
	  </select>
126
      </td>
127
   </tr>
128
   <tr>
129
      <td><? Output(-1, 112, "L&auml;nge einer Arbeitseinh. in Stunden:"); ?></td>
130
      <td><input type="text" name="leneinheit" value="<? echo "$leneinheit"; ?>" size=5 maxlength=5></td>
131
   </tr>
132
   <tr>
133
      <td><? Output(-1, 113, "Projektphasen verwenden?"); ?></td>
134
      <td><input type="checkbox" name="phase" value="1" <? if (isset($phase) && $phase) echo "checked"; ?>></td>
135
   </tr>
136
   <tr>
137
      <td><? Output(-1, 114, "Tasks nach Phasen nummerieren?"); ?></td>
138
      <td><input type="checkbox" name="numphase" value="1" <? if (isset($numphase) && $numphase) echo "checked"; ?>></td>
139
   </tr>
140
   <tr>
141
      <td><? Output(-1, 115, "Datumsformat:"); ?></td>
142
      <td><select name="dtformatshort">
143
             <option value="d.m.Y" <? if ($dtformatshort == "d.m.Y") echo "selected"; ?>>TT.MM.JJJJ</option>
144
	     <option value="d.m.y" <? if ($dtformatshort == "d.m.y") echo "selected"; ?>>TT.MM.JJ</option>
145
	     <option value="j.n.Y" <? if ($dtformatshort == "j.n.Y") echo "selected"; ?>>T.M.JJJJ</option>
146
	     <option value="j.n.y" <? if ($dtformatshort == "j.n.y") echo "selected"; ?>>T.M.JJ</option>
147
	     <option value="m/d/Y" <? if ($dtformatshort == "m/d/Y") echo "selected"; ?>>MM/DD/YYYY</option>
148
	     <option value="m/d/y" <? if ($dtformatshort == "m/d/y") echo "selected"; ?>>MM/DD/YY</option>
149
	     <option value="Y-m-d" <? if ($dtformatshort == "Y-m-d") echo "selected"; ?>>YYYY-MM-DD</option>
150
	  </select>
151
      </td>
152
   </tr>
153
   <tr>
154
      <td><? Output(-1, 116, "Periodensicht:"); ?></td>
155
      <td><input type="checkbox" name="pmlight" value="1" <? if (isset($pmlight) && $pmlight) echo "checked"; ?>></td>
156
   </td>
157
   <tr>
158
      <td><? Output(-1, 117, "Mitarbeiterrolle in Plan:"); ?></td>
159
      <td><input type="checkbox" name="role" value="1" <? (isset($role) && $role) ? echo "checked" : ""; ?>></td>
160
   </tr>
161
   <tr>
162
      <td><? Output(-1, 123, "Shortcuts:"); ?></td>
163
      <td><input type="checkbox" name="shortcuts" value="1" <? if (isset($shortcuts) && $shortcuts) echo "checked"; ?>></td>
164
   </tr>
165
   <tr>
166
      <th colspan=2 class="sel"><? Output(-1, 224, "Verwaltungsanwender definieren"); ?></th>
167
   </tr>
168
   <tr>
169
      <td><? Output(-1, 225, "Superuser:"); ?></td>
170
      <td><input type="text" name="suser" value="<? echo "$suser"; ?>" size=8 maxlength=8></td>
171
   </tr>
172
   <tr>
173
      <td><? Output(-1, 226, "Passwort:"); ?></td>
174
      <td><input type="password" name="pass1" size=8 maxlength=8></td>
175
   </tr>
176
   <tr>
177
      <td><? Output(-1, 227, "Passwort Vergleich:"); ?></td>
178
      <td><input type="password" name="pass2" size=8 maxlength=8></td>
179
   </tr>
180
</table>
181
<br>
182
<input type="submit" value="<? Output(-1, 217, "Weiter -->"); ?>"> <input type="reset">
183
</form>
184
<?php
185
}
186
 
187
if (isset($func) && $func == "FormInitDB") {
188
   $err = 0;
189
 
190
   switch ($periode) {
191
      case 5: if ($einheit > 1) $err = 1; break;
192
      case 4: if ($einheit > 2) $err = 1; break;
193
      case 3: if ($einheit > 3) $err = 1; break;
194
      case 2: if ($einheit > 4) $err = 1; break;
195
      case 1: if ($einheit > 5) $err = 1; break;
196
   }
197
 
198
   if ($err == 1) {
199
      Error("Eine Arbeitseinheit muss immer kleiner als die eingestellte Periode sein!<br>");
200
   }
201
 
202
   switch ($einheit) {
203
      case 1: $maxlen = 1; break;
204
      case 2: $maxlen = 24; break;
205
      case 3: $maxlen = 24 * 7; break;
206
      case 4: $maxlen = 24 * 30; break;
207
      case 5: $maxlen = 24 * 91; break;
208
      case 6: $maxlen = 24 * 364; break;
209
   }
210
 
211
   if ($leneinheit > $maxlen) {
212
      Error("Die von ihnen eingestellte L&auml;nge einer Arbeitseinheit &uuml;bersteigt die maximale L&auml;nge von $maxlen Stunden!<br>");
213
      $err = 1;
214
   }
215
 
216
   if ($pass1 != $pass2) {
217
      Error("Die von Ihnen angegebenen Passw&ouml;rter stimmen nicht &uuml;berein!");
218
      $err = 1;
219
   }
220
 
221
   if (strlen ($dbname) < 1) {
222
      Error("Es wurde keine Datenbank angegeben!");
223
      $err = 1;
224
   }
225
 
226
   if (strlen ($suser) < 4) {
227
      Error("Der \"Superusername\" muss mindestens 4 Zeichen lang sein!");
228
      $err = 1;
229
   }
230
 
231
   if ($err == 1) {
232
      FormInitDB($dbname, $suser, $domain);
233
      require('footer.inc');
234
      return;
235
   }
236
 
237
   # Datenbankeinstellung speichern
238
   $fp = fopen("setup/setup.dat", "w+");
239
 
240
   if (!$fp) {
241
      Error("Datei \"setup.dat\" konnte nicht angelegt werden!");
242
      return;
243
   }
244
 
245
   fwrite($fp, "[pm]\ndbname=\"$dbname\"\ndomain=\"$domain\"\nsuser=\"$suser\"\n");
246
   $hash = md5($pass1);
247
   fwrite($fp, "password=\"$hash\"\n");
248
   fclose($fp);
249
 
250
   # Planungseinstellungen speichern
251
   $fp = fopen("setup/settings.dat", "w+");
252
 
253
   if (!$fp) {
254
      Error("Datei \"settings.dat\" konnte nicht angelegt werden!");
255
      return;
256
   }
257
 
258
   $title_str = urlencode($title_str);
259
   $dat = "[pm]\nperiode=$periode\nverteil=$verteil\neinheit=$einheit\n";
260
   $dat .= "leneinheit=$leneinheit\nphase=$phase\nnumphase=$numphase\n";
261
   $dat .= "dtformatshort=$dtformatshort\ndtformatlong=$dtformatlong\n";
262
   $dat .= "datetime=$datetime\npmlight=$pmlight\nrole=$role\n";
263
   $dat .= "ist_erledigung=$ist_erledigung\nmenucolor=$menucolor\ntitle=$title_str\n";
264
   $dat .= "ist_future=$ist_future\npj_lock=$pj_lock\nstatusbericht=$statusbericht\n";
265
   $dat .= "shortcuts=$shortcuts\nverrmodul=$verrmodul\npjcopy=$pjcopy";
266
   fwrite($fp, $dat);
267
   fclose($fp);
268
 
269
   CreateCryptKey();
270
}
271
 
272
require('footer.inc');
273
?>