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-1216026386:v:use_geshi-1:v:type-php

Started by Guest, Jul 14, 2008, 09:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Guest

   $latest_post = !empty($_REQUEST['latest']) ? 'AND m.PosterTime > ' . (int) $_REQUEST['latest'] : '';
   
   $min_message_id = $modSettings['maxMsgID'] - (int) (($modSettings['totalMessages'] / $modSettings['totalTopics']) * $settings['number_recent_topics']);
   
   $context['topics'] = array();
   // Find all the posts in distinct topics.  Newer ones will have higher IDs.
   $request = db_query("
      SELECT
         ms.posterTime as firstTime, m.posterTime as lastTime, ms.subject, m.ID_TOPIC, t.numReplies,
         ms.ID_MEMBER as ID_FIRST_POSTER, m.ID_MEMBER as ID_LAST_POSTER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
         IFNULL(mem2.realName, ms.posterName) AS firstPoster,
         IFNULL(mem.realName, m.posterName) AS lastPoster
      FROM {$db_prefix}topics AS t
         INNER JOIN {$db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
         INNER JOIN {$db_prefix}boards AS b ON (b.id_board = t.id_board)
         INNER JOIN {$db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
         LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = t.ID_MEMBER_STARTED)
      WHERE t.ID_LAST_MSG >= $min_message_id
         AND $query_this_board
         $latest_post
      ORDER BY t.ID_LAST_MSG DESC
      LIMIT " . $settings['number_recent_topics'], __FILE__, __LINE__);

Guest

   $latest_post = !empty($_REQUEST['latest']) ? 'AND m.PosterTime > ' . (int) $_REQUEST['latest'] : '';
   
   $context['topics'] = array();
   // Find all the posts in distinct topics.  Newer ones will have higher IDs.
   $request = db_query("
      SELECT
         ms.posterTime as firstTime, m.posterTime as lastTime, ms.subject, m.ID_TOPIC, t.numReplies,
         ms.ID_MEMBER as ID_FIRST_POSTER, m.ID_MEMBER as ID_LAST_POSTER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
         IFNULL(mem2.realName, ms.posterName) AS firstPoster,
         IFNULL(mem.realName, m.posterName) AS lastPoster
      FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
         LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = t.ID_MEMBER_STARTED)
      WHERE t.ID_LAST_MSG = m.ID_MSG
         AND b.ID_BOARD = t.ID_BOARD
         AND $query_this_board
         AND ms.ID_MSG = t.ID_FIRST_MSG
         $latest_post
      ORDER BY t.ID_LAST_MSG DESC
      LIMIT " . $settings['number_recent_topics'], __FILE__, __LINE__);

Guest

   $latest_pos   
   $context['topics'] = array();
   // Find all the posts in distinct topics.  Newer ones will have higher IDs.
   $request = db_query("
      SELECT
         ms.posterTime as firstTime, m.posterTime as lastTime, ms.subject, m.ID_TOPIC, t.numReplies,
         ms.ID_MEMBER as ID_FIRST_POSTER, m.ID_MEMBER as ID_LAST_POSTER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
         IFNULL(mem2.realName, ms.posterName) AS firstPoster,
         IFNULL(mem.realName, m.posterName) AS lastPoster
      FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
         LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = t.ID_MEMBER_STARTED)
      WHERE t.ID_LAST_MSG = m.ID_MSG
         AND b.ID_BOARD = t.ID_BOARD
         AND $query_this_board
         AND ms.ID_MSG = t.ID_FIRST_MSG
         $latest_post
      ORDER BY t.ID_LAST_MSG DESC
      LIMIT " . $settings['number_recent_topics'], __FILE__, __LINE__);