Add add and fix lots of minor staff: topic watching, a:target thingie, etc

This commit is contained in:
Aleksei Miheev
2012-12-18 01:27:36 +04:00
parent eb5c3e7480
commit 52fc76145e
7 changed files with 65 additions and 21 deletions

View File

@@ -466,10 +466,11 @@ function UnreadTopics()
{
$request = db_query("
SELECT COUNT(DISTINCT t.ID_TOPIC), MIN(t.ID_LAST_MSG)
FROM ({$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ml, {$db_prefix}messages AS m)
FROM ({$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ml, {$db_prefix}messages AS m, {$db_prefix}watch_topics as w)
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE m.ID_TOPIC = t.ID_TOPIC
AND w.ID_TOPIC=t.ID_TOPIC AND w.ID_MEMBER=$ID_MEMBER AND w.watch=1
AND m.ID_MEMBER = $ID_MEMBER
AND ml.ID_MSG = t.ID_LAST_MSG
AND b.ID_BOARD = t.ID_BOARD