// das Modul ist deaktiviert $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } // Initialize and check the parameters $getHeadline = admFuncVariableIsValid($_GET, 'headline', 'string', array('defaultValue' => $gL10n->get('GBO_GUESTBOOK'))); // die 10 letzten Eintraege aus der DB fischen... $sql = 'SELECT * FROM ' . TBL_GUESTBOOK . ' WHERE gbo_org_id = ' . $gCurrentOrganization->getValue('org_id') . ' AND gbo_locked = 0 ORDER BY gbo_timestamp_create DESC LIMIT 10 '; $statement = $gDb->query($sql); // ab hier wird der RSS-Feed zusammengestellt // create RSS feed object with channel information $rss = new RSSfeed($gCurrentOrganization->getValue('org_longname') . ' - ' . $getHeadline, $gCurrentOrganization->getValue('org_homepage'), $gL10n->get('GBO_LATEST_GUESTBOOK_ENTRIES_OF_ORGA', $gCurrentOrganization->getValue('org_longname')), $gCurrentOrganization->getValue('org_longname')); $guestbook = new TableGuestbook($gDb); // Dem RSSfeed-Objekt jetzt die RSSitems zusammenstellen und hinzufuegen while ($row = $statement->fetch()) { // ausgelesene Gaestebuchdaten in Guestbook-Objekt schieben $guestbook->clear(); $guestbook->setArray($row); // set data for attributes of this entry $title = $guestbook->getValue('gbo_name'); $description = $guestbook->getValue('gbo_text'); $link = $g_root_path . '/adm_program/modules/guestbook/guestbook.php?id=' . $guestbook->getValue('gbo_id'); $author = $guestbook->getValue('gbo_name'); $pubDate = date('r', strtotime($guestbook->getValue('gbo_timestamp_create'))); // add entry to RSS feed $rss->addItem($title, $description, $link, $author, $pubDate); } // jetzt nur noch den Feed generieren lassen
} } } else { // Der User muss fuer die anderen Modes auf jeden Fall eingeloggt sein require_once '../../system/login_valid.php'; } if ($getMode === 2 || $getMode === 3 || $getMode === 5 || $getMode === 8) { // Fuer die modes 2,3,5,6,7 und 8 werden editGuestbook-Rechte benoetigt if (!$gCurrentUser->editGuestbookRight()) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } } } if ($getMode === 1 || $getMode === 2 || $getMode === 3 || $getMode === 9) { // Gaestebuchobjekt anlegen $guestbook = new TableGuestbook($gDb); if ($getGboId > 0) { $guestbook->readDataById($getGboId); // Pruefung, ob der Eintrag zur aktuellen Organisation gehoert if ($guestbook->getValue('gbo_org_id') != $gCurrentOrganization->getValue('org_id')) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } } } else { // Gaestebuchobjekt anlegen $guestbook_comment = new TableGuestbookComment($gDb); if ($getGboId > 0 && $getMode != 4) { $guestbook_comment->readDataById($getGboId); // Pruefung, ob der Eintrag zur aktuellen Organisation gehoert if ($guestbook_comment->getValue('gbo_org_id') != $gCurrentOrganization->getValue('org_id')) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
AND gbo_id = gbc_gbo_id AND gbc_locked = 1) AS count_locked_comments FROM ' . TBL_ORGANIZATIONS . ' WHERE org_id = ' . $gCurrentOrganization->getValue('org_id'); $pdoStatement = $gDb->query($sql); $row = $pdoStatement->fetch(); $countLockedEntries = $row['count_locked_guestbook'] + $row['count_locked_comments']; if ($countLockedEntries > 0) { $guestbookMenu->addItem('admMenuItemModerate', $g_root_path . '/adm_program/modules/guestbook/guestbook.php?moderation=1&headline=' . $getHeadline, $gL10n->get('GBO_MODERATE_ENTRIES') . '<span class="badge">' . $countLockedEntries . '</span>', 'star.png'); } } if ($gCurrentUser->isWebmaster()) { // show link to system preferences of announcements $guestbookMenu->addItem('admMenuItemPreferencesGuestbook', $g_root_path . '/adm_program/modules/preferences/preferences.php?show_option=guestbook', $gL10n->get('SYS_MODULE_PREFERENCES'), 'options.png', 'right'); } $guestbook = new TableGuestbook($gDb); // Alle Gaestebucheintraege fuer die aktuelle Seite ermitteln $sql = 'SELECT * FROM ' . TBL_GUESTBOOK . ' gbo WHERE gbo_org_id = ' . $gCurrentOrganization->getValue('org_id') . ' ' . $conditions . ' ORDER BY gbo_timestamp_create DESC LIMIT ' . $guestbook_entries_per_page . ' OFFSET ' . $getStart; $guestbookStatement = $gDb->query($sql); $countGuestbookEntries = $guestbookStatement->rowCount(); if ($countGuestbookEntries === 0) { // Keine Gaestebucheintraege gefunden if ($getGboId > 0) { $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRY') . '</p>'); } else { $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRIES') . '</p>');
// das Modul ist deaktiviert $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } elseif ($gPreferences['enable_guestbook_module'] == 2) { // nur eingeloggte Benutzer duerfen auf das Modul zugreifen require_once '../../system/login_valid.php'; } // set headline of the script if ($getGboId > 0) { $headline = $gL10n->get('GBO_EDIT_ENTRY', $getHeadline); } else { $headline = $gL10n->get('GBO_CREATE_VAR_ENTRY', $getHeadline); } // add current url to navigation stack $gNavigation->addUrl(CURRENT_URL, $headline); // Gaestebuchobjekt anlegen $guestbook = new TableGuestbook($gDb); if ($getGboId > 0) { // Falls ein Eintrag bearbeitet werden soll muss geprueft weden ob die Rechte gesetzt sind... require '../../system/login_valid.php'; if (!$gCurrentUser->editGuestbookRight()) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } $guestbook->readDataById($getGboId); // Pruefung, ob der Eintrag zur aktuellen Organisation gehoert if ($guestbook->getValue('gbo_org_id') != $gCurrentOrganization->getValue('org_id')) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } } // Wenn keine ID uebergeben wurde, der User aber eingeloggt ist koennen zumindest // Name, Emailadresse und Homepage vorbelegt werden... if ($getGboId === 0 && $gValidLogin) {