News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1205823528:v:use_geshi-1:v:type-php

Started by Guest, Mar 18, 2008, 06:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Guest

   $request = $smcFunc['db_query']('', '
      SELECT
         att.id_attach, att.id_msg, att.filename, IFNULL(att.size, 0) AS filesize, att.downloads, mem.id_member,
         IFNULL(mem.real_name, m.poster_name) AS poster_name, m.id_topic, m.subject, t.id_board, m.poster_time,
         att.width, att.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ', IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . '
      FROM {db_prefix}attachments AS att
         INNER JOIN {db_prefix}messages AS m ON (m.id_msg = att.id_msg)
         INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
         LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : '
         LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = att.id_thumb)') . '
      WHERE att.attachment_type = 0
         ' . (!empty($attachment_ext) ? '
         AND att.fileext IN ({array_string:attachment_ext})' : '') . '
      ORDER BY att.id_attach DESC
      LIMIT {int:num_attachments}',
      array(
         'boards_can_see' => $attachments_boards,
         'attachment_ext' => $attachment_ext,
         'num_attachments' => $num_attachments,
      )
   );