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

Started by Shitiz Garg, Dec 08, 2007, 06:01 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Shitiz Garg

SELECT
                     t.ID_TOPIC AS tID_TOPIC, t.ID_BOARD AS tID_BOARD, t.ID_FIRST_MSG, t.isSticky, t.numReplies, t.numViews,
                     m.posterTime, m.ID_TOPIC AS mID_TOPIC, m.ID_MSG, m.subject, m.body, m.ID_MEMBER,  
                     b.name AS bname, b.memberGroups, b.ID_BOARD AS bID_BOARD, b.ID_CAT AS bCAT_ID,
                     c.ID_CAT as catID, c.name, mem.realName
                     \".(!$show_newIcon ? \'\' : \",IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead\" ).\"                     
                   FROM
                         ({$db_prefix}topics AS t, {$db_prefix}categories AS c, {$db_prefix}boards AS b)
                     LEFT JOIN {$db_prefix}messages AS m ON (m.ID_TOPIC = t.ID_FIRST_MSG)
                     LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = m.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
                     LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = m.ID_BOARD AND lmr.ID_MEMBER=$ID_MEMBER)
                     LEFT JOIN {$db_prefix}members AS mem ON (m.ID_MEMBER = mem.ID_MEMBER)
                  WHERE
                     t.ID_BOARD = b.ID_BOARD
                     AND c.ID_CAT = b.ID_CAT
                     AND $user_info[query_see_board]
                     \".(empty($modSettings[\'recycle_enamle\'])?\'\':\"AND b.ID_BOARD != $modSettings[recycle_board]\").\"
                            \".(empty($boards_id)?\'\':\"AND t.ID_BOARD IN(\".implode(\',\',$boards_id).\") AND b.ID_BOARD IN(\".implode(\',\',$boards_id).\")\").\"
                            \".(empty($cats_id)?\'\':\"AND t.ID_BOARD IN(\".implode(\',\',$cats_id).\") AND b.ID_BOARD IN(\".implode(\',\',$cats_id).\")\").\"
                     \".(!$stickyOnly?\'\':\"AND t.isSticky = 1\").\"
                     \".($mode == 2 ? \"AND m.ID_TOPIC = t.ID_TOPIC\" : \"AND m.ID_MSG = t.ID_FIRST_MSG\").\"                     
                  ORDER BY m.\".($mode == 3 ? \"numViews\" : $mode==4 ? \"numReplies\" : \"posterTime\").\" DESC
                  LIMIT $limit\"

Guest

\"SELECT
   t.ID_TOPIC AS tID_TOPIC, t.ID_BOARD AS tID_BOARD, t.ID_FIRST_MSG, t.isSticky, t.numReplies, t.numViews,
   m.posterTime, m.ID_TOPIC AS mID_TOPIC, m.ID_MSG, m.subject, m.body, m.ID_MEMBER,  
   b.name AS bname, b.memberGroups, b.ID_BOARD AS bID_BOARD, b.ID_CAT AS bCAT_ID,
   c.ID_CAT as catID, c.name, mem.realName
   \".(!$show_newIcon ? \'\' : \",IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead\" ).\"                     
    FROM
     ({$db_prefix}topics AS t, {$db_prefix}categories AS c, {$db_prefix}boards AS b)
   LEFT JOIN {$db_prefix}messages AS m ON (m.ID_TOPIC = t.ID_FIRST_MSG)
   LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = m.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = m.ID_BOARD AND lmr.ID_MEMBER=$ID_MEMBER)
   LEFT JOIN {$db_prefix}members AS mem ON (m.ID_MEMBER = mem.ID_MEMBER)
      WHERE
   t.ID_BOARD = b.ID_BOARD
   AND c.ID_CAT = b.ID_CAT
   AND $user_info[query_see_board]
   \".(empty($modSettings[\'recycle_enamle\'])?\'\':\"AND b.ID_BOARD != $modSettings[recycle_board]\").\"
    \".(empty($boards_id)?\'\':\"AND t.ID_BOARD IN(\".implode(\',\',$boards_id).\") AND b.ID_BOARD IN(\".implode(\',\',$boards_id).\")\").\"
     \".(empty($cats_id)?\'\':\"AND t.ID_BOARD IN(\".implode(\',\',$cats_id).\") AND b.ID_BOARD IN(\".implode(\',\',$cats_id).\")\").\"
    \".(!$stickyOnly?\'\':\"AND t.isSticky = 1\").\"
   \".($mode == 2 ? \"AND m.ID_TOPIC = t.ID_TOPIC\" : \"AND m.ID_MSG = t.ID_FIRST_MSG\").\"                     
ORDER BY m.\".($mode == 3 ? \"numViews\" : $mode==4 ? \"numReplies\" : \"posterTime\").\" DESC
   LIMIT $limit\"