<?php
/*
    CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
    - You may not alter, transform, or build upon this work.
    - Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
  if ( !isset($UserName) ) $UserName = '';
  if ( !isset($UserStatus) ) $UserStatus = '';
  if ( !isset($UserCurrentPassword) ) $UserCurrentPassword = '';
  if ( !isset($UserNewPassword) ) $UserNewPassword = '';
  if ( !isset($UserNewPasswordRepeated) ) $UserNewPasswordRepeated = '';
  if ( !isset($UserEmailadress) ) $UserEmailadress = '';
  if ( !isset($UserLanguage) ) $UserLanguage = '';
  if ( !isset($UserBackendCalenderListCols) ) $UserBackendCalenderListCols = $StandardUserBackendCalenderListCols;
  if ( !isset($UserRightEmail) ) $UserRightEmail = '';
  if ( !isset($UserRightAddNews) ) $UserRightAddNews = '';
  if ( !isset($UserRightEditNews) ) $UserRightEditNews = '';
  if ( !isset($UserRightDeleteNews) ) $UserRightDeleteNews = '';
  if ( !isset($uid) ) $uid = '';
  if ( !isset($senden) ) $senden = '';
  if ( !isset($UserFirstDayOfWeek) ) $UserFirstDayOfWeek = '';
  // Formular überprüfen
    if ( $senden )
    {
      if ( $senden
            && $UserName
            && $UserStatus
            && $UserNewPassword
            && $UserNewPasswordRepeated
            && $UserNewPassword==$UserNewPasswordRepeated
            && $UserEmailadress
            && checkEmail ($UserEmailadress)
            && $UserLanguage
            && $UserBackendCalenderListCols
            && strlen($UserNewPassword)>=$MinUserPasswordChars
            && $UserFirstDayOfWeek
          )
        {
          $FormularKorrektAusgefuellt = true;
        }
        else 
        { 
          $FormularKorrektAusgefuellt = false;
          $uid=$UserName;
        }
    }
    else
    {
      if ( $job=='edit')
      {
        $SQL = "SELECT * FROM ".DB_PREFIX."user Where UserName = '$uid'";
        $resultat = mysql_query($SQL);
        while ($row = mysql_fetch_array($resultat)) { extract($row); }
      }
      $FormularKorrektAusgefuellt = false;
      $senden = ''; 
    }
  if ( !IsUserAdmin() ) echo $L_015;
  else
  {
    // Content Begin
      if ($FormularKorrektAusgefuellt == true)
      {
        if ( $job=='add')
        {
          if (addUser ($UserName, $UserStatus, $UserNewPassword, $UserEmailadress, $UserSession, $UserLanguage, 0, $UserBackendCalenderListCols, $UserRightEmail, $UserRightAddNews, $UserRightEditNews, $UserRightDeleteNews, $UserFirstDayOfWeek))
          {
            echo $L_191.'<br />';
          }
          else
          {
            echo $L_192.'<br />';
          }
        }
        if ( $job=='edit')
        {
          if (editUser($UserName, $UserStatus, $UserNewPassword, $UserEmailadress, $UserNameOld, $UserLanguage, $UserBackendCalenderListCols, $UserRightEmail, $UserRightAddNews, $UserRightEditNews, $UserRightDeleteNews, $UserFirstDayOfWeek))
          {
            echo $L_053.'<br />';
          }
          else
          {
            echo $L_054.'<br />';
          }
        }        
        echo '<br />
              <form method="post" action="index.php?submenu=admin&amp;page=showUsers" accept-charset="UTF-8">
                <fieldset>
                  <input type="submit" value="'.$L_Button26.'" class="button" />
                </fieldset>
              </form>';
      }
      else
      {
        echo '<form id="addUser" method="post" action="index.php?submenu=admin&amp;page=addUser&amp;job='.$job.'" accept-charset="UTF-8">
                <table summary="addUser">';
                  include ('admin/includes/addUser/UserName.php');
                  include ('admin/includes/addUser/UserRightEmail.php');
                  include ('admin/includes/addUser/UserRightAddNews.php');
                  include ('admin/includes/addUser/UserRightEditNews.php');
                  include ('admin/includes/addUser/UserRightDeleteNews.php');
                  include ('admin/includes/addUser/UserSession.php');
                  include ('admin/includes/addUser/UserStatus.php');
                  include ('admin/includes/addUser/UserLanguage.php');
                  include ('admin/includes/addUser/UserFirstDayOfWeek.php');
                  include ('admin/includes/addUser/UserNewPassword.php');
                  include ('admin/includes/addUser/UserNewPasswordRepeated.php');
                  include ('admin/includes/addUser/UserEmailadress.php');
                  include ('admin/includes/addUser/UserBackendCalenderListCols.php');
        // Button
          echo '<tr>
                  <td></td>
                  <td>
                    <input type="submit" name="senden" value="'.$L_Button01.'" class="button" />
                    <input type="button" value="'.$L_Button03.'" onclick="self.location.href=\'index.php?submenu=admin&amp;page=showUsers\'" class="button" />
                    <input type="reset" value="'.$L_Button38.'" class="button" />
                    <input type="hidden" name="DEAKTIVIERT-http-equiv" value="showUsers" />
                    <input type="hidden" name="UserNameOld" value="'.$uid.'" />
                  </td>
                </tr>
              </table>
            </form>';
      }
    // Inhalt zuende
  }
?>