<?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($Input_UserCurrentPassword) ) $Input_UserCurrentPassword = '';
  if ( !isset($UserNewPassword) ) $UserNewPassword = '';
  if ( !isset($UserNewPasswordRepeated) ) $UserNewPasswordRepeated = '';
  if ( !isset($UserEmailadress) ) $UserEmailadress = '';
  if ( !isset($UserLanguage) ) $UserLanguage = '';
  if ( !isset($UserBackendCalenderListCols) ) $UserBackendCalenderListCols = $StandardUserBackendCalenderListCols;
  if ( !isset($uid) ) $uid = '';
  if ( !isset($senden) ) $senden = '';
  if ( !isset($job) ) $job = '';
  // POST-Variablen definieren
    if (!$senden) {
      $SQLQuery = "SELECT * FROM ".$prefix."user Where UserName = '".getCurrentUser()."'";
      $Result = mysqli_query($db, $SQLQuery);
      while ($row = mysqli_fetch_array($Result))
        extract($row); }
  // Formular überprüfen
    if ( $senden
         && $Input_UserCurrentPassword
         && $_POST['Input_UserCurrentPassword']==getCurrentUserVar('UserCurrentPassword')
         && $UserNewPassword==$UserNewPasswordRepeated
         && $UserEmailadress
         && checkEmail ($UserEmailadress)
         && loggedIn()
         && ($UserNewPassword=='' OR strlen($UserNewPassword)>=$MinUserPasswordChars)
       )
    { $FormularKorrektAusgefuellt = true; }
    else { $FormularKorrektAusgefuellt = false; }

  echo '<p class="Headline">'.$L_Headline21.'</p>';
  if ( !loggedIn() ) { echo $L_003; }
  else
  {
    // Inhalt hier einfügen
      if ($FormularKorrektAusgefuellt==true) {
        if (empty($_POST['UserNewPassword']))
          $UserNewPassword = getCurrentUserVar('UserCurrentPassword');
        else
          $UserNewPassword = $_POST['UserNewPassword'];
        if (getCurrentUserVar('UserLanguage')!=$UserLanguage) clearCache();
        if (editCurrentUser($UserNewPassword, $UserEmailadress,
          $UserLanguage, $UserBackendCalenderListCols)) {
          echo $L_053.'<br />'; }
        else { echo $L_054.'<br />'; }
        echo '<br />
                <form method="post" action="index.php?submenue=user&amp;content=editCurrentUser" 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?submenue=user&amp;content=editCurrentUser" accept-charset="UTF-8">
                <table summary="addUser">';
        //  UserName
          echo '<tr>
                  <td>'.$L_UserName.':</td>
    		          <td>'.getCurrentUser().'</td>
  	            </tr>';
        include ('admin/includes/addUser/UserCurrentPassword.php');
        include ('admin/includes/addUser/UserNewPassword.php');
        include ('admin/includes/addUser/UserNewPasswordRepeated.php');
        include ('admin/includes/addUser/UserEmailadress.php');
        include ('admin/includes/addUser/UserLanguage.php');
        include ('admin/includes/addUser/UserBackendCalenderListCols.php');       
        // Buttons
          echo '<tr>
                  <td></td>
                  <td>
                    <input type="submit" name="senden" value="'.$L_Button01.'" class="button" />
      		          <input type="hidden" name="CurrentUserName" value="'.getCurrentUser().'" />
      		          <input type="hidden" name="UserSession" maxlength="32" value="'.$UserSession.'" readonly="readonly" />
                    <input type="reset" value="'.$L_Button38.'" class="button" />
                  </td>
                </tr>
              </table>
            </form>';
      }
  }
?>