<?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 {
    // Session-Variable 'Anzahl' definieren
      if (isset($_POST['Anzahl'])) {
        $_SESSION["Anzahl"] = $_POST['Anzahl'];
        $_SESSION['CurrentPageShowAllGuestbookEntries'] = 1; }
      if (!isset($_SESSION["Anzahl"]))
        { $_SESSION["Anzahl"] = "25"; }
      $EntriesPerPage = $_SESSION["Anzahl"];
      $NumberOfEntries = AnzahlEintraege();
      if ( $EntriesPerPage!='all' ) {
        $NumberOfPages = ceil($NumberOfEntries/$EntriesPerPage); }
      else {
        $NumberOfPages = 0;
        $EntriesPerPage = 99999; } // Bugfix v1.2.77_012
      if (isset($_REQUEST['page'])) {
        $_SESSION['CurrentPageShowAllGuestbookEntries'] = $_REQUEST['page']; }
      else
        $_SESSION['CurrentPageShowAllGuestbookEntries'] = 1; // For new Pagination since v1.2.80_038
      if (!isset($_SESSION['CurrentPageShowAllGuestbookEntries'])) {
        $_SESSION['CurrentPageShowAllGuestbookEntries'] = "1"; }
      $CurrentPage = $_SESSION['CurrentPageShowAllGuestbookEntries'];
      $TopEntry  = $EntriesPerPage*($CurrentPage-1);
      // Ansichts-Parameter
        echo '<div id="Box_ParameterShowGigs">
                <form method="post" action="index.php?submenue=guestbook&amp;content=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 ($EntriesPerPage=="all") echo ' selected="selected"'; echo'>'.$L_ShowAllGigs.'</option>';
                    for ($i=10; $i<=100; $i++) {
                      echo '<option value="'.$i.'"'; if ($EntriesPerPage==$i) echo ' selected="selected"'; echo'>'.$i.'</option>'; }
                  echo '</select>
                  </fieldset>
                </form>';
      // Pagination
        echo getGuestbookBackEndPagination();
      echo '</div>';
      // Publish or Not
      if (isset($_POST['Publish_x'])) {
        changePublishing ($_POST['Date']); }
      // Datensatz-Ausgabe festlegen
        $SQLQuery = "SELECT * FROM ".$prefix."guestbook order by Datum DESC";
        $SQLQuery = $SQLQuery." LIMIT ".$TopEntry.", ";
        if ($EntriesPerPage=='all') {
          $SQLQuery = $SQLQuery.$NumberOfEntries; }
        else {
          $SQLQuery = $SQLQuery.$EntriesPerPage; }
        $Result = mysqli_query($db, $SQLQuery);
      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($Result)) {
        extract($row);
        //$DateString = DatumMitUhrzeitAusTimestamp($Datum);
        echo '<tr>';
        if ($xUserRightDeleteGuestbookEntries) {
          echo '<td>
                  <a href="index.php?submenue=guestbook&amp;content=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;content=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;content=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>'.getAnonymIp($IP).'</td>';
        echo '<td class="TabellenSpalte_Rechts">'.$CODE.'</td>';
        echo '</tr>'; }
      echo '</table>'; }
?>