<?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.
*/
  $_SESSION['MenuReminderWebsite'] = $page;
  if ( !loggedIn() ) echo $L_003;
  else
  {
    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
    {
      // moreChars
        if ( isset($_REQUEST['job']) AND $_REQUEST['job']=='moreChars' ) { setUserVar('UserCharsGuestbookListFields', getUserVar(getCurrentUser(), 'UserCharsGuestbookListFields')+1); }
      // lessChars
        if ( isset($_REQUEST['job']) AND  $_REQUEST['job']=='lessChars' ) { setUserVar('UserCharsGuestbookListFields', getUserVar(getCurrentUser(), 'UserCharsGuestbookListFields')-1); }
      // Seiten-Navigation definieren
        $UserCharsGuestbookListFields = getCurrentUserVar('UserCharsGuestbookListFields');
        // Session-Variable 'Anzahl' definieren
          if ( isset($_POST['Anzahl']) ) { $_SESSION["Anzahl"] = $_POST['Anzahl']; $_SESSION['CurrentPageShowAllGuestbookEntries']=1; }
          if ( !isset($_SESSION["Anzahl"]) ) { $_SESSION["Anzahl"] = "20"; }
          $EintraegeProSeite = $_SESSION["Anzahl"];
          $AnzahlEintraege = AnzahlEintraege();
        if ( $EintraegeProSeite!='all' ) { $AnzahlSeiten = ceil($AnzahlEintraege/$EintraegeProSeite); }
          else { $AnzahlSeiten = '0'; }
        if (isset($_REQUEST['subpage'])) { $_SESSION['CurrentPageShowAllGuestbookEntries'] = $_REQUEST['subpage']; }
        if ( !isset($_SESSION['CurrentPageShowAllGuestbookEntries']) ) { $_SESSION['CurrentPageShowAllGuestbookEntries'] = "1"; }
        $aktuelleSeite = $_SESSION['CurrentPageShowAllGuestbookEntries'];
        $obersterEintrag  = $EintraegeProSeite*($aktuelleSeite-1);
        // Ansichts-Parameter
          echo '<form name="myForm" method="post" action="index.php?submenu=website&amp;page=backend_showAllGuestbookEntries" accept-charset="UTF-8">
                  <fieldset id="PageMenu">
                    <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>
                  ';
        // Navigation
          include('guestbook/includes/buttonPageNavigation.php');
        // Button 'Delete Gigs'
          include('guestbook/includes/buttonDeleteGuestbookEntries.php');
        // Spaltenbreite
          include('guestbook/includes/buttonColumnsWidth.php');
        echo '</fieldset>';

      // Publish or Not
      if (isset($_POST['Publish_x'])) { changePublishing ($_POST['Date']); }

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

      echo '<table id="WideTable" summary="Table_ShowAllGuestbookEntries" style="width:100%">
                  <tr>';
          if ( $xUserRightDeleteGuestbookEntries ) { echo'<th><input class="checkbox" type="checkbox" name="Delete" value="1" onClick="changeCheckboxes(this.checked)"  /></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 = mysql_fetch_array($resultat))
          {
            extract($row);
            echo '<tr>';
            if ( $xUserRightDeleteGuestbookEntries )
            {
              echo '<td>
                      <input type="checkbox" name="selectedListItems[]" value="'.$GuestbookID.'" class="checkbox" />
                    </td>';
            }
            if ( $xUserRightEditGuestbookEntries )
            {
              echo '<td>
                      <a href="index.php?submenu=guestbook&amp;page=backend_addGuestbookEntry&amp;job=edit&amp;GuestbookID='.$GuestbookID.'">
                        <img src="images/edit.png" alt="'.$L_010.'" title="'.$L_010.'" /></a>
                    </td>';
            }
            if ( !$xUserRightDeleteGuestbookEntries AND !$xUserRightEditGuestbookEntries )
            {
              echo '<td>
                      <a href="index.php?submenu=guestbook&amp;page=backend_showGuestbookEntry&amp;guestbookid='.$GuestbookID.'">
                        <img src="images/show.png" alt="'.$L_153.'" title="'.$L_153.'" /></a>
                    </td>';
            }
            echo '<td>'.date(getSetup('SetupGeneralBackendDateFormat').' - '.getSetup('SetupGeneralBackendTimeFormat'), $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></form>';
    }
  }
  
?>