### SQL ### my $sql = "SELECT boards.id as board_id, threads.id as thread_id, messages.position as position, boards.name as board_name, threads.title as thread_title, messages.message_raw as message_raw"; $sql .= " FROM $PBoard::Config::DbTables{boards} AS boards,"; $sql .= " $PBoard::Config::DbTables{threads} as threads,"; $sql .= " $PBoard::Config::DbTables{messages} as messages,"; $sql .= " $PBoard::Config::DbTables{user_groups} as user_groups"; $sql .= " WHERE messages.thread = threads.id AND threads.boardID = boards.id"; $sql .= " AND messages.status != 'deleted' AND threads.status != 'onhold' AND threads.status != 'deleted'"; $sql .= " AND boards.groupRequired <= 2 AND user_groups.level = 'user'"; $sql .= " AND boards.id = ?" if $board_id; $sql .= " AND threads.id = ?" if $thread_id; $sql .= " AND messages.authorId = ?" if $user_id; $sql .= " AND ((UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(messages.posttime)) <= (? * 24 * 60 * 60))" if lc($action) eq lc('lastMessagesDays'); $sql .= " AND messages.position = '1'" if lc($filter) eq 'no_replies'; $sql .= " ORDER BY messages.posttime DESC"; $sql .= " LIMIT ?"; my @placeholders; push @placeholders, $board_id if $board_id; push @placeholders, $thread_id if $thread_id; push @placeholders, $user_id if $user_id; push @placeholders, $last_entries if lc($action) eq lc('lastMessagesDays'); if (lc($action) eq lc('lastMessagesDays')) { push @placeholders, $max_entries; } # if elsif (lc($action) eq lc('lastMessagesNumbers')) { push @placeholders, $last_entries; } # if else { push @placeholders, $max_entries; } # ifelse if ($debug) { print "\n\n$sql\n\n"; foreach my $item (@placeholders) { print "-->".$item."\n"; } # foreach } # if ### DB ### my $storage = PBoard::Storage->new( { dbh => undef } ); my $poard = PBoard->new( { cgi => $cgi, storage => $storage } ); my $dbh = PBoard::DB::ConnectToDB( $poard ); $storage->set_dbh( $dbh ); my $sth = &PBoard::DB::FireSql( $poard, $sql, @placeholders ); ### Feed erzeugen ###