Пример #1
0
    /**
     * Get an array of forums
     * return all forums where the extension is active
     *
     * @return forum id array
     * @access private
     */
    private function get_sfpo_forums()
    {
        $forum_ids = array();
        $sql = 'SELECT forum_id
			FROM ' . FORUMS_TABLE . '
			WHERE sfpo_guest_enable = ' . true;
        $result = $this->db->sql_query($sql);
        $forums = $this->db->sql_fetchrowset($result);
        $this->db->sql_freeresult($result);
        foreach ($forums as $forum) {
            foreach ($forum as $id) {
                $forum_ids[] = $id;
            }
        }
        return $forum_ids;
    }
    /**
     * Display flag
     *
     * @param $flag_id		int		the id of the flag
     * @param $start		int		page number we start at
     * @param $limit		int		limit to display for pagination
     * @return null
     * @access public
     */
    protected function display_flag($flag_id, $start, $limit)
    {
        //let's get the flag requested
        $sql = 'SELECT flag_id, flag_name, flag_image
			FROM ' . $this->flags_table . '
			WHERE flag_id = ' . (int) $flag_id;
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        // now users that have the flag
        $sql = 'SELECT *
			FROM ' . USERS_TABLE . '
			WHERE user_flag = ' . (int) $row['flag_id'] . '
				AND ' . $this->db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . '
			ORDER BY username_clean';
        $result = $this->db->sql_query_limit($sql, $limit, $start);
        $rows = $this->db->sql_fetchrowset($result);
        $this->db->sql_freeresult($result);
        // for counting of total flag users
        $result = $this->db->sql_query($sql);
        $row2 = $this->db->sql_fetchrowset($result);
        $total_users = (int) count($row2);
        $this->db->sql_freeresult($result);
        unset($row2);
        foreach ($rows as $userrow) {
            $user_id = $userrow['user_id'];
            $username = $this->auth->acl_get('u_viewprofile') ? get_username_string('full', $user_id, $userrow['username'], $userrow['user_colour']) : get_username_string('no_profile', $user_id, $userrow['username'], $userrow['user_colour']);
            $this->template->assign_block_vars('user_row', array('JOINED' => $this->user->format_date($userrow['user_regdate']), 'VISITED' => empty($userrow['user_lastvisit']) ? ' - ' : $this->user->format_date($userrow['user_lastvisit']), 'POSTS' => $userrow['user_posts'] ? $userrow['user_posts'] : 0, 'USERNAME_FULL' => $username, 'U_SEARCH_USER' => $this->auth->acl_get('u_search') ? append_sid("{$this->root_path}search.{$this->php_ext}", "author_id={$user_id}&sr=posts") : ''));
        }
        $this->pagination->generate_template_pagination(array('routes' => array('rmcgirr83_nationalflags_getflags', 'rmcgirr83_nationalflags_getflags_page'), 'params' => array('flag_id' => $flag_id)), 'pagination', 'page', $total_users, $limit, $start);
        $flag_image = $this->functions->get_user_flag($row['flag_id']);
        $users_count = $total_users;
        $total_users = $this->user->lang('FLAG_USERS', (int) $total_users);
        $this->template->assign_vars(array('FLAG' => html_entity_decode($row['flag_name']), 'FLAG_IMAGE' => $flag_image, 'TOTAL_USERS' => $total_users, 'S_VIEWONLINE' => $this->auth->acl_get('u_viewonline'), 'S_FLAGS' => true, 'S_FLAG_USERS' => !empty($users_count) ? true : false, 'MESSAGE_TEXT' => empty($users_count) ? $this->user->lang['NO_USER_HAS_FLAG'] : ''));
        // Assign breadcrumb template vars for the flags page
        $this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('rmcgirr83_nationalflags_display'), 'FORUM_NAME' => $this->user->lang('NATIONAL_FLAGS')));
        // Assign breadcrumb template vars for the flags page
        $this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('rmcgirr83_nationalflags_getflags', array('flag_id' => $flag_id)), 'FORUM_NAME' => $row['flag_name']));
    }