* topics.moved_to - removed NULL
This commit is contained in:
parent
3c79787879
commit
7a35e0d862
8 changed files with 15 additions and 14 deletions
|
@ -32,7 +32,7 @@ class CalcStat extends Method
|
|||
|
||||
$sql = 'SELECT t.last_post, t.last_post_id, t.last_poster, t.subject as last_topic
|
||||
FROM ::topics AS t
|
||||
WHERE t.forum_id=?i:fid AND t.moved_to IS NULL
|
||||
WHERE t.forum_id=?i:fid AND t.moved_to=0
|
||||
ORDER BY t.last_post DESC
|
||||
LIMIT 1';
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class LoadTree extends Action
|
|||
LEFT JOIN ::mark_of_topic AS mot ON (mot.uid=?i:uid AND mot.tid=t.id)
|
||||
WHERE t.forum_id IN(?ai:forums)
|
||||
AND t.last_post>?i:max
|
||||
AND t.moved_to IS NULL
|
||||
AND t.moved_to=0
|
||||
AND (mot.mt_last_visit IS NULL OR t.last_post>mot.mt_last_visit)';
|
||||
$stmt = $this->c->DB->query($sql, $vars);
|
||||
while ($cur = $stmt->fetch()) {
|
||||
|
|
|
@ -779,7 +779,7 @@ class Install extends Page
|
|||
'closed' => ['TINYINT(1)', false, 0],
|
||||
'sticky' => ['TINYINT(1)', false, 0],
|
||||
'stick_fp' => ['TINYINT(1)', false, 0],
|
||||
'moved_to' => ['INT(10) UNSIGNED', true],
|
||||
'moved_to' => ['INT(10) UNSIGNED', false, 0],
|
||||
'forum_id' => ['INT(10) UNSIGNED', false, 0],
|
||||
'poll_type' => ['TINYINT(4)', false, 0],
|
||||
'poll_time' => ['INT(10) UNSIGNED', false, 0],
|
||||
|
|
|
@ -40,20 +40,20 @@ class ActionP extends Method
|
|||
$sql = 'SELECT p.id
|
||||
FROM ::posts AS p
|
||||
INNER JOIN ::topics AS t ON t.id=p.topic_id
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL AND p.poster_id=?i:uid
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0 AND p.poster_id=?i:uid
|
||||
ORDER BY p.posted DESC';
|
||||
break;
|
||||
|
||||
# case 'last':
|
||||
# $sql = 'SELECT t.id
|
||||
# FROM ::topics AS t
|
||||
# WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL
|
||||
# WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0
|
||||
# ORDER BY t.last_post DESC';
|
||||
# break;
|
||||
# case 'unanswered':
|
||||
# $sql = 'SELECT t.id
|
||||
# FROM ::topics AS t
|
||||
# WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL AND t.num_replies=0
|
||||
# WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0 AND t.num_replies=0
|
||||
# ORDER BY t.last_post DESC';
|
||||
# break;
|
||||
default:
|
||||
|
|
|
@ -39,20 +39,20 @@ class ActionT extends Method
|
|||
case 'latest_active_topics':
|
||||
$sql = 'SELECT t.id
|
||||
FROM ::topics AS t
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0
|
||||
ORDER BY t.last_post DESC';
|
||||
break;
|
||||
case 'unanswered_topics':
|
||||
$sql = 'SELECT t.id
|
||||
FROM ::topics AS t
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL AND t.num_replies=0
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0 AND t.num_replies=0
|
||||
ORDER BY t.last_post DESC';
|
||||
break;
|
||||
case 'topics_with_your_posts':
|
||||
$sql = 'SELECT t.id
|
||||
FROM ::topics AS t
|
||||
INNER JOIN ::posts AS p ON t.id=p.topic_id
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL AND p.poster_id=?i:uid
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0 AND p.poster_id=?i:uid
|
||||
GROUP BY t.id
|
||||
ORDER BY t.last_post DESC';
|
||||
break;
|
||||
|
@ -60,7 +60,7 @@ class ActionT extends Method
|
|||
$sql = 'SELECT t.id
|
||||
FROM ::topics AS t
|
||||
INNER JOIN ::posts AS p ON t.first_post_id=p.id
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL AND p.poster_id=?i:uid
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0 AND p.poster_id=?i:uid
|
||||
ORDER BY t.last_post DESC';
|
||||
break;
|
||||
case 'new':
|
||||
|
@ -70,7 +70,7 @@ class ActionT extends Method
|
|||
LEFT JOIN ::mark_of_forum AS mof ON (mof.uid=?i:uid AND mof.fid=t.forum_id)
|
||||
WHERE t.forum_id IN (?ai:forums)
|
||||
AND t.last_post>?i:max
|
||||
AND t.moved_to IS NULL
|
||||
AND t.moved_to=0
|
||||
AND (mot.mt_last_visit IS NULL OR t.last_post>mot.mt_last_visit)
|
||||
AND (mof.mf_mark_all_read IS NULL OR t.last_post>mof.mf_mark_all_read)
|
||||
ORDER BY t.last_post DESC';
|
||||
|
|
|
@ -75,7 +75,7 @@ class Delete extends Action
|
|||
$sql = 'SELECT p.poster_id
|
||||
FROM ::topics AS t
|
||||
INNER JOIN ::posts AS p ON t.first_post_id=p.id
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to IS NULL
|
||||
WHERE t.forum_id IN (?ai:forums) AND t.moved_to=0
|
||||
GROUP BY p.poster_id';
|
||||
$usersUpd = $this->c->DB->query($sql, $vars)->fetchAll(PDO::FETCH_COLUMN);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class Delete extends Action
|
|||
$sql = 'SELECT p.poster_id
|
||||
FROM ::topics AS t
|
||||
INNER JOIN ::posts AS p ON t.first_post_id=p.id
|
||||
WHERE t.id IN (?ai:topics) AND t.moved_to IS NULL
|
||||
WHERE t.id IN (?ai:topics) AND t.moved_to=0
|
||||
GROUP BY p.poster_id';
|
||||
$usersUpd = $this->c->DB->query($sql, $vars)->fetchAll(PDO::FETCH_COLUMN);
|
||||
}
|
||||
|
|
|
@ -327,6 +327,7 @@ class Model extends DataModel
|
|||
if (false !== $this->hasUnread && $this->timeMax > $this->hasUnread) {
|
||||
$flag = true;
|
||||
$vars[':read'] = $this->timeMax;
|
||||
$vars[':visit'] = $this->last_post;
|
||||
}
|
||||
|
||||
if ($flag) {
|
||||
|
|
|
@ -45,7 +45,7 @@ class UpdateCountTopics extends Action
|
|||
SELECT COUNT(t.id)
|
||||
FROM ::topics AS t
|
||||
INNER JOIN ::posts AS p ON t.first_post_id=p.id
|
||||
WHERE p.poster_id=u.id AND t.moved_to IS NULL
|
||||
WHERE p.poster_id=u.id AND t.moved_to=0
|
||||
GROUP BY p.poster_id
|
||||
)
|
||||
WHERE ' . $where;
|
||||
|
|
Loading…
Add table
Reference in a new issue