Subversion Repositories public

Rev

Blame | Last modification | View Log | RSS feed

<?php
$login = $_REQUEST['login'];

require_once('version.inc');
require_once('dbaccess.inc');
require_once('language.inc');
require_once('header.inc');
require_once('settings.inc');
require_once('crypt.inc');
require_once('menu.inc');

$func = $_REQUEST['func'];
$dbname = $_REQUEST['dbname'];
$domain = $_REQUEST['domain'];
$suser = $_REQUEST['suser'];
$pass1 = $_REQUEST['pass1'];
$pass2 = $_REQUEST['pass2'];
$periode = $_REQUEST['periode'];
$verteil = $_REQUEST['verteil'];
$einheit = $_REQUEST['einheit'];
$leneinheit = $_REQUEST['leneinheit'];
$phase = $_REQUEST['phase'];
$numphase = $_REQUEST['numphase'];
$dtformatshort = $_REQUEST['dtformatshort'];
$dtformatlong = $_REQUEST['dtformatlong'];
$datetime = $_REQUEST['datetime'];
$pmlight = $_REQUEST['pmlight'];
$role = $_REQUEST['role'];
$title_str = $_REQUEST['title'];
$pj_lock = $_REQUEST['pj_lock'];
$statusbericht = $_REQUEST['statusbericht'];
$shortcuts = $_REQUEST['shortcuts'];
$verrmodul = $_REQUEST['verrmodul'];
$pjcopy = $_REQUEST['pjcopy'];

function FormInitDB($dbname, $suser, $domain) {
        global $periode;
        global $verteil;
        global $einheit;
        global $leneinheit;
        global $phase;
        global $numphase;
        global $dtformatshort;
        global $dtformatlong;
        global $datetime;
        global $pmlight;
        global $role;
        global $pj_lock;
        global $statusbericht;
        global $shortcuts;
        global $verrmodul;
        global $pjcopy;

        if (!isset($dtformatshort))
           $dtformatshort = "d.m.Y";

        if (!isset($dtformatlong))
           $dtformatlong = "d F y";

        if (!isset($datetime))
           $datetime = "d.m.Y H:i:s"

        if (!isset($statusbericht))
           $statusbericht = false;

        if (!isset($shortcuts))
           $shortcuts = false;

        if (!isset($verrmodul))
           $verrmodul = false;

        if (!isset($pjcopy))
           $pjcopy = 3;
?>
<form action="initdb.php" method="post">
   <input type="hidden" name="func" value="FormInitDB">
   <input type="hidden" name="statusbericht" value="<? echo "$statusbericht"; ?>">
   <input type="hidden" name="headline" value="2">
<table class="input">
   <tr>
      <th colspan=2 class="sel"><? Output(-1, 221, "Datenbank"); ?></th>
   <tr>
      <td><? Output(-1, 222, "Datenbankname:"); ?></td>
      <td><input type="text" name="dbname" value="<? echo "$dbname"; ?>" size=16 maxlength=16></td>
   </tr>
   <tr>
      <td><? Output(-1, 223, "Domainname:"); ?></td>
      <td><input type="text" name="domain" value="<? echo "$domain"; ?>" size=30 maxlength=80></td>
   </tr>
   <tr>
      <th colspan=2 class="sel"><? Output(-1, 91, "Einstellungen f&uuml;r die Planung"); ?></th>
   </tr>
   <tr>
      <td><? Output(-1, 92, "L&auml;nge einer Periode:"); ?></td>
      <td><select name="periode">
             <option value="1" <? if ($periode == 1) echo "selected"; ?>><? Output(-1, 93, "Jahr"); ?></option>
             <option value="2" <? if ($periode == 2) echo "selected"; ?>><? Output(-1, 94, "Quartal"); ?></option>
             <option value="3" <? if ($periode == 3) echo "selected"; ?>><? Output(-1, 95, "Monat"); ?></option>
             <option value="4" <? if ($periode == 4) echo "selected"; ?>><? Output(-1, 96, "Woche"); ?></option>
             <option value="5" <? if ($periode == 5) echo "selected"; ?>><? Output(-1, 97, "Tag"); ?></option>
          </select>
      </td>
   </tr>
   <tr>
      <td><? Output(-1, 98, "Verteilung der Auw&auml;nde:"); ?></td>
      <td><select name="verteil">
             <option value="1" <? if ($verteil == 1) echo "selected"; ?>><? Output(-1, 99, "Normalverteilung"); ?></option>
             <option value="2" <? if ($verteil == 2) echo "selected"; ?>><? Output(-1, 100, "Endlastig"); ?></option>
             <option value="3" <? if ($verteil == 3) echo "selected"; ?>><? Output(-1, 101, "Anfangslastig"); ?></option>
             <option value="4" <? if ($verteil == 4) echo "selected"; ?>><? Output(-1, 102, "Anfang&minus; und Endlasig"); ?></option>
             <option value="5" <? if ($verteil == 5) echo "selected"; ?>><? Output(-1, 103, "Mittellastig"); ?></option>
             <option value="6" <? if ($verteil == 6) echo "selected"; ?>><? Output(-1, 104, "Individuell"); ?></option>
          </select>
      </td>
   </tr>
   <tr>
      <td><? Output(-1, 105, "Gr&ouml;&szlig;e einer Arbeitseiheit:"); ?></td>
      <td><select name="einheit">
             <option value="1" <? if ($einheit == 1) echo "selected"; ?>><? Output(-1, 106, "Stunde"); ?></option>
             <option value="2" <? if ($einheit == 2) echo "selected"; ?>><? Output(-1, 107, "Tag"); ?></option>
             <option value="3" <? if ($einheit == 3) echo "selected"; ?>><? Output(-1, 108, "Woche"); ?></option>
             <option value="4" <? if ($einheit == 4) echo "selected"; ?>><? Output(-1, 109, "Monat"); ?></option>
             <option value="5" <? if ($einheit == 5) echo "selected"; ?>><? Output(-1, 110, "Quartal"); ?></option>
             <option value="6" <? if ($einheit == 6) echo "selected"; ?>><? Output(-1, 111, "Jahr"); ?></option>
          </select>
      </td>
   </tr>
   <tr>
      <td><? Output(-1, 112, "L&auml;nge einer Arbeitseinh. in Stunden:"); ?></td>
      <td><input type="text" name="leneinheit" value="<? echo "$leneinheit"; ?>" size=5 maxlength=5></td>
   </tr>
   <tr>
      <td><? Output(-1, 113, "Projektphasen verwenden?"); ?></td>
      <td><input type="checkbox" name="phase" value="1" <? if (isset($phase) && $phase) echo "checked"; ?>></td>
   </tr>
   <tr>
      <td><? Output(-1, 114, "Tasks nach Phasen nummerieren?"); ?></td>
      <td><input type="checkbox" name="numphase" value="1" <? if (isset($numphase) && $numphase) echo "checked"; ?>></td>
   </tr>
   <tr>
      <td><? Output(-1, 115, "Datumsformat:"); ?></td>
      <td><select name="dtformatshort">
             <option value="d.m.Y" <? if ($dtformatshort == "d.m.Y") echo "selected"; ?>>TT.MM.JJJJ</option>
             <option value="d.m.y" <? if ($dtformatshort == "d.m.y") echo "selected"; ?>>TT.MM.JJ</option>
             <option value="j.n.Y" <? if ($dtformatshort == "j.n.Y") echo "selected"; ?>>T.M.JJJJ</option>
             <option value="j.n.y" <? if ($dtformatshort == "j.n.y") echo "selected"; ?>>T.M.JJ</option>
             <option value="m/d/Y" <? if ($dtformatshort == "m/d/Y") echo "selected"; ?>>MM/DD/YYYY</option>
             <option value="m/d/y" <? if ($dtformatshort == "m/d/y") echo "selected"; ?>>MM/DD/YY</option>
             <option value="Y-m-d" <? if ($dtformatshort == "Y-m-d") echo "selected"; ?>>YYYY-MM-DD</option>
          </select>
      </td>
   </tr>
   <tr>
      <td><? Output(-1, 116, "Periodensicht:"); ?></td>
      <td><input type="checkbox" name="pmlight" value="1" <? if (isset($pmlight) && $pmlight) echo "checked"; ?>></td>
   </td>
   <tr>
      <td><? Output(-1, 117, "Mitarbeiterrolle in Plan:"); ?></td>
      <td><input type="checkbox" name="role" value="1" <? (isset($role) && $role) ? echo "checked" : ""; ?>></td>
   </tr>
   <tr>
      <td><? Output(-1, 123, "Shortcuts:"); ?></td>
      <td><input type="checkbox" name="shortcuts" value="1" <? if (isset($shortcuts) && $shortcuts) echo "checked"; ?>></td>
   </tr>
   <tr>
      <th colspan=2 class="sel"><? Output(-1, 224, "Verwaltungsanwender definieren"); ?></th>
   </tr>
   <tr>
      <td><? Output(-1, 225, "Superuser:"); ?></td>
      <td><input type="text" name="suser" value="<? echo "$suser"; ?>" size=8 maxlength=8></td>
   </tr>
   <tr>
      <td><? Output(-1, 226, "Passwort:"); ?></td>
      <td><input type="password" name="pass1" size=8 maxlength=8></td>
   </tr>
   <tr>
      <td><? Output(-1, 227, "Passwort Vergleich:"); ?></td>
      <td><input type="password" name="pass2" size=8 maxlength=8></td>
   </tr>
</table>
<br>
<input type="submit" value="<? Output(-1, 217, "Weiter -->"); ?>"> <input type="reset">
</form>
<?php
}

if (isset($func) && $func == "FormInitDB") {
   $err = 0;

   switch ($periode) {
      case 5: if ($einheit > 1) $err = 1; break;
      case 4: if ($einheit > 2) $err = 1; break;
      case 3: if ($einheit > 3) $err = 1; break;
      case 2: if ($einheit > 4) $err = 1; break;
      case 1: if ($einheit > 5) $err = 1; break;
   }

   if ($err == 1) {
      Error("Eine Arbeitseinheit muss immer kleiner als die eingestellte Periode sein!<br>");
   }

   switch ($einheit) {
      case 1: $maxlen = 1; break;
      case 2: $maxlen = 24; break;
      case 3: $maxlen = 24 * 7; break;
      case 4: $maxlen = 24 * 30; break;
      case 5: $maxlen = 24 * 91; break;
      case 6: $maxlen = 24 * 364; break;
   }

   if ($leneinheit > $maxlen) {
      Error("Die von ihnen eingestellte L&auml;nge einer Arbeitseinheit &uuml;bersteigt die maximale L&auml;nge von $maxlen Stunden!<br>");
      $err = 1;
   }

   if ($pass1 != $pass2) {
      Error("Die von Ihnen angegebenen Passw&ouml;rter stimmen nicht &uuml;berein!");
      $err = 1;
   }

   if (strlen ($dbname) < 1) {
      Error("Es wurde keine Datenbank angegeben!");
      $err = 1;
   }

   if (strlen ($suser) < 4) {
      Error("Der \"Superusername\" muss mindestens 4 Zeichen lang sein!");
      $err = 1;
   }

   if ($err == 1) {
      FormInitDB($dbname, $suser, $domain);
      require('footer.inc');
      return;
   }

   # Datenbankeinstellung speichern
   $fp = fopen("setup/setup.dat", "w+");

   if (!$fp) {
      Error("Datei \"setup.dat\" konnte nicht angelegt werden!");
      return;
   }

   fwrite($fp, "[pm]\ndbname=\"$dbname\"\ndomain=\"$domain\"\nsuser=\"$suser\"\n");
   $hash = md5($pass1);
   fwrite($fp, "password=\"$hash\"\n");
   fclose($fp);

   # Planungseinstellungen speichern
   $fp = fopen("setup/settings.dat", "w+");

   if (!$fp) {
      Error("Datei \"settings.dat\" konnte nicht angelegt werden!");
      return;
   }

   $title_str = urlencode($title_str);
   $dat = "[pm]\nperiode=$periode\nverteil=$verteil\neinheit=$einheit\n";
   $dat .= "leneinheit=$leneinheit\nphase=$phase\nnumphase=$numphase\n";
   $dat .= "dtformatshort=$dtformatshort\ndtformatlong=$dtformatlong\n";
   $dat .= "datetime=$datetime\npmlight=$pmlight\nrole=$role\n";
   $dat .= "ist_erledigung=$ist_erledigung\nmenucolor=$menucolor\ntitle=$title_str\n";
   $dat .= "ist_future=$ist_future\npj_lock=$pj_lock\nstatusbericht=$statusbericht\n";
   $dat .= "shortcuts=$shortcuts\nverrmodul=$verrmodul\npjcopy=$pjcopy";
   fwrite($fp, $dat);
   fclose($fp);

   CreateCryptKey();
}

require('footer.inc');
?>