<?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.
*/
  echo '<p class="Headline">'.$L_Headline42.':</p>';
  if ( IsUserAdmin() )
  {
    $xUserRightAddGuestbookEntries = 1;
    $xUserRightEditGuestbookEntries = 1;
    $xUserRightDeleteGuestbookEntries = 1;
  }
  else
  {
    $xUserRightAddGuestbookEntries = 0;
    $xUserRightEditGuestbookEntries = 0;
    $xUserRightDeleteGuestbookEntries = 0;
  }
  include ('guestbook/functions.php');
  if ( AnzahlEintraege()=='0' )
    {
      echo $L_215.'<br /><br />';
    }
    else
    {
      // Sessioin-Variable 'Anzahl' definieren
        if ( isset($_POST['Anzahl']) ) { $_SESSION["Anzahl"] = $_POST['Anzahl']; $_SESSION['CurrentPageShowAllGuestbookEntries']=1; }
        if ( !isset($_SESSION["Anzahl"]) ) { $_SESSION["Anzahl"] = "25"; }
        $EintraegeProSeite = $_SESSION["Anzahl"];

      $AnzahlEintraege = AnzahlEintraege();
      if ( $EintraegeProSeite!='all' ) { $AnzahlSeiten = ceil($AnzahlEintraege/$EintraegeProSeite); }
          else { $AnzahlSeiten = '0'; }
      if (isset($_REQUEST['page'])) { $_SESSION['CurrentPageShowAllGuestbookEntries'] = $_REQUEST['page']; }
      if ( !isset($_SESSION['CurrentPageShowAllGuestbookEntries']) ) { $_SESSION['CurrentPageShowAllGuestbookEntries'] = "1"; }
      $aktuelleSeite = $_SESSION['CurrentPageShowAllGuestbookEntries'];
      $obersterEintrag  = $EintraegeProSeite*($aktuelleSeite-1);
    
      // Ansichts-Parameter
        echo '<div id="Box_ParameterShowGigs">
                <form method="post" action="index.php?submenue=guestbook&amp;inhalt=backend_showAllGuestbookEntries" accept-charset="UTF-8">
                  <fieldset>
                    <input type="hidden" name="thread[threadid]" value="$thread[threadid]" />
                    <select name="Anzahl" onchange="this.form.submit()">
                      <option value="all"'; if ($EintraegeProSeite=="all") echo ' selected="selected"'; echo'>'.$L_ShowAllGigs.'</option>';
                    for ($i=1; $i<=100; $i++)
                    {
                      echo '<option value="'.$i.'"'; if ($EintraegeProSeite==$i) echo ' selected="selected"'; echo'>'.$i.'</option>';
                    }

                  echo '</select>
                  </fieldset>
                </form>';
        echo GuestbookBackendNavigation();
        echo '</div>';
    
      // Publish or Not
      if (isset($_POST['Publish_x'])) { changePublishing ($_POST['Date']); }

      // Datensatz-Ausgabe festlegen
        $sql = "SELECT * FROM ".$prefix."guestbook order by Datum DESC";
        $sql = $sql." LIMIT ".$obersterEintrag.", ";
        if ( $EintraegeProSeite=='all') { $sql = $sql.$AnzahlEintraege; }
        else { $sql = $sql.$EintraegeProSeite; }
        $resultat = mysqli_query($db, $sql);

      echo '<table id="WideTable" summary="Table_ShowAllGuestbookEntries" style="width:100%">
                  <tr>';
          if ( $xUserRightDeleteGuestbookEntries ) { echo'<th class="SpalteIcon">&nbsp;</th>'; }
          if ( $xUserRightEditGuestbookEntries ) { echo'<th class="SpalteIcon">&nbsp;</th>'; }
          if ( !$xUserRightDeleteGuestbookEntries AND !$xUserRightEditGuestbookEntries )  { echo'<th>&nbsp;</th>'; }
          echo '<th>'.$L_GuestbookDate.'</th>
                <th>'.$L_GuestbookName.'</th>
                <th>'.$L_GuestbookLocation.'</th>
                <th>'.$L_GuestbookEmail.'</th>
                <th>'.$L_GuestbookURL.'</th>
                <th>'.$L_GuestbookICQ.'</th>
                <th>'.$L_GuestbookMessage.'</th>
                <th>'.$L_GuestbookComment.'</th>
                <th>'.$L_GuestbookIP.'</th>
                <th class="TabellenSpalte_Rechts">'.$L_GuestbookCode.'</th>
              </tr>';
          while ($row = mysqli_fetch_array($resultat))
          {
            extract($row);
            //$DateString = DatumMitUhrzeitAusTimestamp($Datum);
            echo '<tr>';
            if ( $xUserRightDeleteGuestbookEntries )
            {
              echo '<td>
                      <a href="index.php?submenue=guestbook&amp;inhalt=backend_delGuestbookEntry&amp;GuestbookID='.$GuestbookID.'">
                        <img src="images/delete.gif" alt="'.$L_009.'" title="'.$L_009.'" /></a>
                    </td>';
            }
            if ( $xUserRightEditGuestbookEntries )
            {
              echo '<td>
                      <a href="index.php?submenue=guestbook&amp;inhalt=backend_addGuestbookEntry&amp;job=edit&amp;GuestbookID='.$GuestbookID.'">
                        <img src="images/edit.gif" alt="'.$L_010.'" title="'.$L_010.'" /></a>
                    </td>';
            }
            if ( !$xUserRightDeleteGuestbookEntries AND !$xUserRightEditGuestbookEntries )
            {
              echo '<td>
                      <a href="index.php?submenue=guestbook&amp;inhalt=backend_showGuestbookEntry&amp;guestbookid='.$GuestbookID.'">
                        <img src="images/show.png" alt="'.$L_153.'" title="'.$L_153.'" /></a>
                    </td>';
            }
            echo '<td>'.date($SetupBackendDateFormat.' - '.$SetupBackendTimeFormat, $Datum).'</td>';
            echo '<td>'; include('guestbook/includes/showAllGuestbookEntries/GuestbookName.php'); echo '</td>';
            echo '<td>'; include('guestbook/includes/showAllGuestbookEntries/GuestbookLocation.php'); echo '</td>';
            echo '<td>'; include('guestbook/includes/showAllGuestbookEntries/GuestbookEmail.php'); echo '</td>';
            echo '<td>'; include('guestbook/includes/showAllGuestbookEntries/GuestbookURL.php'); echo '</td>';
            echo '<td>'; include('guestbook/includes/showAllGuestbookEntries/GuestbookICQ.php'); echo '</td>';
            echo '<td>'; include('guestbook/includes/showAllGuestbookEntries/GuestbookMessage.php'); echo '</td>';
            echo '<td>'; include('guestbook/includes/showAllGuestbookEntries/GuestbookComment.php'); echo '</td>';
            echo '<td>'.$IP.'</td>';
            echo '<td class="TabellenSpalte_Rechts">'.$CODE.'</td>';
            echo '</tr>';
          }
          echo '</table>';
    }
?>