/** * @param bool $check_visibility */ private function _set_topic_visibility($check_visibility) { if ($check_visibility) { $this->store['sql_array']['WHERE'][] = 't.topic_time <= ' . time(); $this->store['sql_array']['WHERE'][] = $this->content_visibility->get_global_visibility_sql('topic', $this->ex_fid_ary, 't.'); } }
/** * @param string $exclude_words * @return array */ private function _get_words_sql($exclude_words) { $sql_where = $this->_exclude_words_sql($exclude_words); return array('SELECT' => 'l.word_text, l.word_count', 'FROM' => array(SEARCH_WORDLIST_TABLE => 'l', SEARCH_WORDMATCH_TABLE => 'm', TOPICS_TABLE => 't', POSTS_TABLE => 'p'), 'WHERE' => 'l.word_common <> 1 AND l.word_count > 0 AND m.word_id = l.word_id AND m.post_id = p.post_id AND t.topic_id = p.topic_id AND t.topic_time <= ' . time() . ' AND ' . $this->content_visibility->get_global_visibility_sql('topic', array_keys($this->auth->acl_getf('!f_read', true)), 't.') . $sql_where, 'GROUP_BY' => 'l.word_text, l.word_count', 'ORDER_BY' => 'l.word_count DESC'); }
/** * @param array $post_ids * @param string $topic_first_or_last_post * @return array */ private function _get_post_data_where(array $post_ids, $topic_first_or_last_post) { $sql_where = array(); if (sizeof($post_ids)) { $sql_where[] = $this->db->sql_in_set('p.post_id', $post_ids); } else { if (sizeof($this->store['topic'])) { $this->_limit_posts_by_topic($sql_where, $topic_first_or_last_post); } } $sql_where[] = $this->content_visibility->get_global_visibility_sql('post', $this->ex_fid_ary, 'p.'); return $sql_where; }
/** * @param array $post_ids * @param string $topic_first_or_last_post * @return array */ private function _get_post_data_where(array $post_ids, $topic_first_or_last_post) { $sql_where = array(); if (sizeof($this->store['topic'])) { $sql_where[] = $this->db->sql_in_set('topic_id', array_keys($this->store['topic'])); if ($topic_first_or_last_post) { $post_ids = array_merge($post_ids, $this->get_topic_post_ids($topic_first_or_last_post)); $sql_where[] = $this->db->sql_in_set('post_id', $post_ids); } } $sql_where[] = $this->content_visibility->get_global_visibility_sql('post', $this->ex_fid_ary, 'p.'); return $sql_where; }