DB = $reg->DB(); $this->tbl = ips_DBRegistry::getPrefix(); } /** * Restores a recent post from the posts table * * @param array $data Query arguments * @return @e string */ public function restoreRecentPost( $data ) { $this->DB->allow_sub_select = true; $query ="REPLACE INTO {$this->tbl}forums_recent_posts (post_id, post_topic_id, post_forum_id, post_author_id, post_date) ( SELECT p.pid, p.topic_id, ( SELECT t.forum_id FROM {$this->tbl}topics t where t.tid=p.topic_id), p.author_id, p.post_date FROM {$this->tbl}posts p WHERE p." . implode ( 'AND p.', $data['query'] ) . " AND p.author_id > 0 AND p.post_date > " . $data['date'] .")"; return $query; } }