当前位置: 首页>>代码示例>>PHP>>正文


PHP auth::acl_get方法代码示例

本文整理汇总了PHP中phpbb\auth\auth::acl_get方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::acl_get方法的具体用法?PHP auth::acl_get怎么用?PHP auth::acl_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpbb\auth\auth的用法示例。


在下文中一共展示了auth::acl_get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ucp_prefs_get_data

 public function ucp_prefs_get_data($event)
 {
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('rt_enable' => $this->request->variable('rt_enable', (int) $this->user->data['user_rt_enable']), 'rt_alt_location' => $this->request->variable('rt_alt_location', (int) $this->user->data['user_rt_alt_location']), 'rt_sort_start_time' => $this->request->variable('rt_sort_start_time', (int) $this->user->data['user_rt_sort_start_time']), 'rt_unread_only' => $this->request->variable('rt_unread_only', (int) $this->user->data['user_rt_unread_only'])));
     // Output the data vars to the template (except on form submit)
     if (!$event['submit'] && $this->auth->acl_get('u_rt_view')) {
         $this->user->add_lang_ext('paybas/recenttopics', 'recenttopics_ucp');
         $template_vars = array();
         if ($this->auth->acl_get('u_rt_enable') || $this->auth->acl_get('u_rt_alt_location') || $this->auth->acl_get('u_rt_sort_start_time') || $this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('S_RT_SHOW' => true);
         }
         if ($this->auth->acl_get('u_rt_enable')) {
             $template_vars += array('A_RT_ENABLE' => true, 'S_RT_ENABLE' => $event['data']['rt_enable']);
         }
         if ($this->auth->acl_get('u_rt_alt_location')) {
             $template_vars += array('A_RT_ALT_LOCATION' => true, 'S_RT_ALT_LOCATION' => $event['data']['rt_alt_location']);
         }
         if ($this->auth->acl_get('u_rt_sort_start_time')) {
             $template_vars += array('A_RT_SORT_START_TIME' => true, 'S_RT_SORT_START_TIME' => $event['data']['rt_sort_start_time']);
         }
         if ($this->auth->acl_get('u_rt_unread_only')) {
             $template_vars += array('A_RT_UNREAD_ONLY' => true, 'S_RT_UNREAD_ONLY' => $event['data']['rt_unread_only']);
         }
         $this->template->assign_vars($template_vars);
     }
 }
开发者ID:nachtelb,项目名称:RecentTopics,代码行数:26,代码来源:ucp_listener.php

示例2: article

 /**
  * Display an article
  *
  * @param	string	$article	URL of the article
  * @return	object
  */
 public function article($article)
 {
     $this->user->add_lang_ext('tas2580/wiki', 'common');
     if (!$this->auth->acl_get('u_wiki_view')) {
         trigger_error('NOT_AUTHORISED');
     }
     $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['WIKI'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_index', array())));
     $this->template->assign_vars(array('WIKI_FOOTER' => $this->user->lang('WIKI_FOOTER', base64_decode('aHR0cHM6Ly90YXMyNTgwLm5ldA=='), base64_decode('dGFzMjU4MA=='))));
     include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
     include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
     $action = $this->request->variable('action', '');
     $id = $this->request->variable('id', 0);
     switch ($action) {
         case 'edit':
             return $this->edit->edit_article($article);
         case 'versions':
             return $this->compare->view_versions($article);
         case 'compare':
             $from = $this->request->variable('from', 0);
             $to = $this->request->variable('to', 0);
             return $this->compare->compare_versions($article, $from, $to);
         case 'delete':
             return $this->delete->version($id);
         case 'detele_article':
             return $this->delete->article($article);
         case 'active':
             return $this->edit->active($id);
         case 'deactivate':
             return $this->edit->deactivate($article);
         default:
             return $this->view->view_article($article, $id);
     }
 }
开发者ID:tas2580,项目名称:wiki,代码行数:39,代码来源:main.php

示例3: prepare_user_reputation_data

 /**
  * Display user reputation on user profile page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function prepare_user_reputation_data($event)
 {
     $data = $event['data'];
     $template_data = $event['template_data'];
     $template_data = array_merge($template_data, array('USER_REPUTATION' => $data['user_reputation'], 'U_VIEW_USER_REPUTATION' => $this->helper->route('reputation_details_controller', array('uid' => $data['user_id'])), 'U_RATE_USER' => $this->helper->route('reputation_user_rating_controller', array('uid' => $data['user_id'])), 'U_REPUTATION_REFERER' => $this->helper->get_current_url(), 'S_RATE_USER' => $this->config['rs_user_rating'] && $this->auth->acl_get('u_rs_rate') ? true : false, 'S_VIEW_REPUTATION' => $this->auth->acl_get('u_rs_view') ? true : false));
     $event['template_data'] = $template_data;
 }
开发者ID:rampmaster,项目名称:phpBB-Reputation-System,代码行数:14,代码来源:memberlist_listener.php

示例4: like_post

 /**
  * Likes controller for route /like_post/{like}
  *
  * @param  int   @post_id  The post to be edited.
  */
 public function like_post($post_id)
 {
     // If unknown user or bot, cannot like.
     if ($this->user->data['user_id'] == ANONYMOUS || $this->user->data['is_bot']) {
         return;
     }
     // Add language variables for response.
     $this->user->add_lang_ext('nuleaf/likes', 'likes');
     // Grab forum id for permission.
     $sql = 'SELECT forum_id
 FROM ' . POSTS_TABLE . '
 WHERE post_id = ' . $post_id;
     $result = $this->db->sql_query_limit($sql, 1);
     $forum_id = $this->db->sql_fetchrow($result)['forum_id'];
     $this->db->sql_freeresult($result);
     // Does the user have permission to like posts in this forum?
     if ($this->auth->acl_get('!f_like', $forum_id)) {
         $json_response = new json_response();
         $json_response->send(array('error' => $this->user->lang('LIKE_NOT_AUTHORIZED')));
         return;
     }
     if ($this->request->is_ajax()) {
         $liked = $this->likes_manager->is_liked($post_id);
         if ($liked) {
             // If post is already liked, unlike it.
             $likes_count = $this->likes_manager->unlike($post_id);
         } else {
             // Else like the post.
             $likes_count = $this->likes_manager->like($post_id);
         }
         // Since the post has now been liked/unliked, $liked is reversed.
         $json_response = new json_response();
         $json_response->send(array('likes_count' => $likes_count, 'liked' => !$liked, 'LIKE_POST' => $this->user->lang('LIKE_POST'), 'UNLIKE_POST' => $this->user->lang('UNLIKE_POST'), 'LIKE_BUTTON' => $this->user->lang('LIKE_BUTTON'), 'UNLIKE_BUTTON' => $this->user->lang('UNLIKE_BUTTON')));
     }
 }
开发者ID:NuLeaf,项目名称:nuleaf-forum,代码行数:40,代码来源:main.php

示例5: memberlist_view_profile

    /**
     * Display zodiac on viewing user profile
     *
     * @param object $event The event object
     * @return null
     * @access public
     */
    public function memberlist_view_profile($event)
    {
        $user_id = $event['member']['user_id'];
        $reg_date = $event['member']['user_regdate'];
        $this->user->add_lang_ext('rmcgirr83/searchusertopics', 'common');
        // get all topics started by the user and make sure they are visible
        $sql = 'SELECT t.*, p.post_visibility
			FROM ' . TOPICS_TABLE . ' t
			LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
			WHERE t.topic_poster = ' . $user_id . '
			ORDER BY t.topic_time ASC';
        $result = $this->db->sql_query($sql);
        $topics_num = 0;
        while ($row = $this->db->sql_fetchrow($result)) {
            if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
                continue;
            }
            if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
                continue;
            }
            ++$topics_num;
        }
        $this->db->sql_freeresult($result);
        if ($topics_num) {
            // Do the relevant calculations
            $users_days = max(1, round((time() - $reg_date) / 86400));
            $topics_per_day = $topics_num / $users_days;
            $topics_percent = $this->config['num_topics'] ? min(100, $topics_num / $this->config['num_topics'] * 100) : 0;
            $this->template->assign_vars(array('TOPICS' => $topics_num, 'L_TOTAL_TOPICS' => $this->user->lang('TOTAL_TOPICS', $topics_num), 'TOPICS_PER_DAY' => $this->user->lang('TOPICS_PER_DAY', $topics_per_day), 'TOPICS_PERCENT' => $this->user->lang('TOPICS_PERCENT', $topics_percent), 'U_SEARCH_TOPICS' => $this->auth->acl_get('u_search') ? append_sid("{$this->root_path}search.{$this->php_ext}", "author_id={$user_id}&sr=topics&sf=firstpost") : ''));
        }
    }
开发者ID:TWEagle,项目名称:phpBB-3.1-searchusertopics,代码行数:38,代码来源:listener.php

示例6: display_24_hour_stats

 /**
  * Display stats on index page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function display_24_hour_stats($event)
 {
     // if the user is a bot
     if ($this->user->data['is_bot']) {
         return;
     }
     $this->user->add_lang_ext('rmcgirr83/activity24hours', 'common');
     // obtain posts/topics/new users activity
     $activity = $this->obtain_activity_data();
     // obtain user activity data
     $active_users = $this->obtain_active_user_data();
     // Obtain guests data
     $total_guests_online_24 = $this->obtain_guest_count_24();
     $user_count = 0;
     foreach ((array) $active_users as $row) {
         if (!$row['session_viewonline'] && !empty($row['session_time']) || !$row['user_allow_viewonline']) {
             if ($this->auth->acl_get('u_viewonline') || $row['user_id'] === $this->user->data['user_id']) {
                 $row['username'] = '<em>' . $row['username'] . '</em>';
             } else {
                 continue;
             }
         }
         if ($row['user_lastvisit'] < $this->interval && $row['session_time'] < $this->interval) {
             continue;
         }
         $max_last_visit = max($row['user_lastvisit'], $row['session_time']);
         $hover_info = ' title="' . $this->user->format_date($max_last_visit) . '"';
         ++$user_count;
         $this->template->assign_block_vars('lastvisit', array('USERNAME_FULL' => '<span' . $hover_info . '>' . get_username_string($row['user_type'] == USER_IGNORE ? 'no_profile' : 'full', $row['user_id'], $row['username'], $row['user_colour']) . '</span>'));
     }
     // assign the forum stats to the template.
     $this->template->assign_vars(array('USERS_24HOUR_TOTAL' => $this->user->lang('USERS_24HOUR_TOTAL', $user_count), 'USERS_ACTIVE' => $user_count, 'GUEST_ONLINE_24' => $this->config['load_online_guests'] ? $this->user->lang('GUEST_ONLINE_24', $total_guests_online_24) : '', 'HOUR_TOPICS' => $this->user->lang('24HOUR_TOPICS', $activity['topics']), 'HOUR_POSTS' => $this->user->lang('24HOUR_POSTS', $activity['posts']), 'HOUR_USERS' => $this->user->lang('24HOUR_USERS', $activity['users']), 'S_CAN_VIEW_24_HOURS' => true));
 }
开发者ID:rmcgirr83,项目名称:phpBB-3.1-activity24hours,代码行数:40,代码来源:listener.php

示例7: display_edit_form

 /**
  * Display the edit form
  *
  * @param bool $preview
  */
 protected function display_edit_form($preview = false)
 {
     generate_smilies('inline', 0);
     display_custom_bbcodes();
     add_form_key('article');
     $this->template->assign_vars(array('S_PREVIEW' => $preview, 'TITLE' => $this->data['article_title'], 'MESSAGE' => $preview ? $this->data['article_text'] : $this->message_parser->message, 'PREVIEW_MESSAGE' => $this->message_parser->message, 'SOURCES' => $this->data['article_sources'], 'S_BBCODE_ALLOWED' => $this->option['bbcode'], 'S_LINKS_ALLOWED' => $this->option['url'], 'S_BBCODE_IMG' => $this->option['img'], 'S_BBCODE_FLASH' => $this->option['flash'], 'S_BBCODE_QUOTE' => $this->option['quote'], 'BBCODE_STATUS' => $this->option['bbcode'] ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->option['img'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $this->option['flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $this->option['smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->option['bbcode'] && $this->option['url'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'EDIT_REASON' => $this->data['article_edit_reason'], 'TOPIC_ID' => (int) $this->data['article_topic_id'], 'S_AUTH_ACTIVATE' => $this->auth->acl_get('u_wiki_set_active'), 'S_AUTH_EDIT_TOPIC' => $this->auth->acl_get('u_wiki_edit_topic'), 'S_AUTH_REDIRECT' => $this->auth->acl_get('u_wiki_set_redirect'), 'S_AUTH_STICKY' => $this->auth->acl_get('u_wiki_set_sticky'), 'S_ACTIVE' => $preview ? $this->data['article_approved'] : 1, 'S_STICKY' => $this->data['article_sticky'], 'ARTICLE_REDIRECT' => $this->data['article_redirect'], 'ARTICLE_DESCRIPTION' => $this->data['article_description']));
 }
开发者ID:tas2580,项目名称:wiki,代码行数:12,代码来源:functions.php

示例8: page_header

 /**
  * Add link to header
  *
  * @param	object	$event	The event object
  * @return	null
  * @access	public
  */
 public function page_header($event)
 {
     if ($this->auth->acl_get('u_usermap_view')) {
         $this->user->add_lang_ext('tas2580/usermap', 'link');
         $this->template->assign_vars(array('U_USERMAP' => $this->helper->route('tas2580_usermap_index', array())));
     }
 }
开发者ID:phpbb-addons,项目名称:usermap,代码行数:14,代码来源:listener.php

示例9: display

    /**
     * Display the user ranks page
     *
     * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
     * @access public
     */
    public function display($name)
    {
        // Get the rank details
        $sql = 'SELECT *
			FROM ' . RANKS_TABLE . '
			ORDER BY rank_special DESC, rank_min ASC, rank_title ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            if ($this->config['userranks_special'] || $this->config['userranks_special_admin'] && $this->auth->acl_get('a_') || !$this->config['userranks_special'] && !$row['rank_special']) {
                $rank_row = array('S_RANK_IMAGE' => $row['rank_image'] ? true : false, 'S_SPECIAL_RANK' => $row['rank_special'] ? true : false, 'RANK_IMAGE' => $this->path_helper->get_web_root_path() . $this->config['ranks_path'] . '/' . $row['rank_image'], 'RANK_TITLE' => $row['rank_title'], 'MIN_POSTS' => $row['rank_min']);
                $this->template->assign_block_vars('ranks', $rank_row);
                // Are we displaying members?
                if ($this->config['userranks_members'] || $this->config['userranks_members_admin'] && $this->auth->acl_get('a_')) {
                    $rank_users = $this->get_user_rank_data($row['rank_id']);
                    if (sizeof($rank_users) > 0) {
                        foreach ($rank_users as $row_rank) {
                            $this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => get_username_string('full', $row_rank['user_id'], $row_rank['username'], $row_rank['user_colour'])));
                        }
                    } else {
                        $this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => $this->user->lang('NO_MEMBERS')));
                    }
                }
            }
        }
        $this->db->sql_freeresult($result);
        // Assign breadcrumb template vars for the user ranks page
        $this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('david63_userranks_main_controller', array('name' => 'ranks')), 'FORUM_NAME' => $this->user->lang('USER_RANKS')));
        // Send all data to the template file
        return $this->helper->render('user_ranks.html', $name);
    }
开发者ID:Galixte,项目名称:david63-userranks,代码行数:36,代码来源:main_controller.php

示例10: delete_post

 /**
  * Delete a shoutbox post
  *
  * @param int $id
  *
  * @throws \paul999\ajaxshoutbox\exceptions\shoutbox_exception
  */
 public function delete_post($id)
 {
     if (!$id) {
         $id = $this->request->variable('id', 0);
     }
     $sql = 'SELECT user_id FROM ' . $this->table . ' WHERE shout_id = ' . (int) $id;
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow();
     $this->db->sql_freeresult($result);
     if (!$row) {
         throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
     }
     if (!$this->auth->acl_get('m_shoutbox_delete')) {
         // User has no m_ permission.
         if ($row['user_id'] != $this->user->data['user_id']) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
         }
         if (!$this->auth->acl_get('u_shoutbox_delete')) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_NO_PERMISSION');
         }
     }
     if ($this->push->canPush()) {
         if ($this->push->delete($id) === false) {
             throw new shoutbox_exception('AJAX_SHOUTBOX_PUSH_NOT_AVAIL');
         }
     }
     $sql = 'DELETE FROM ' . $this->table . ' WHERE shout_id =  ' . (int) $id;
     $this->db->sql_query($sql);
 }
开发者ID:alhitary,项目名称:ajax-shoutbox-ext,代码行数:36,代码来源:delete.php

示例11: modify_profile_info

 /**
  * Allow to change their colour
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function modify_profile_info($event)
 {
     $this->user->add_lang_ext('dmzx/usernamecolourchanger', 'common');
     // Request the user option vars and add them to the data array
     $event['data'] = array_merge($event['data'], array('user_colour' => $this->request->variable('user_colour', $this->user->data['user_colour'], true)));
     $this->template->assign_vars(array('COLOUR' => $event['data']['user_colour'], 'USE_USERNAMECOLOURCHANGER' => $this->auth->acl_get('u_usernamecolourchanger_use')));
 }
开发者ID:rmcgirr83,项目名称:Username-Colour-Changer,代码行数:14,代码来源:listener.php

示例12: memberlist_view_profile

    /**
     * Display zodiac on viewing user profile
     *
     * @param object $event The event object
     * @return null
     * @access public
     */
    public function memberlist_view_profile($event)
    {
        $user_id = $event['member']['user_id'];
        $this->user->add_lang_ext('rmcgirr83/topicsbyuser', 'common');
        // get all topics started by the user and make sure they are visible
        $sql = 'SELECT t.*, p.post_visibility
			FROM ' . TOPICS_TABLE . ' t
			LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
			WHERE t.topic_poster = ' . $user_id . '
			ORDER BY t.topic_time ASC';
        $result = $this->db->sql_query($sql);
        $count = 0;
        $topic_options = '<option value="">' . $this->user->lang['CHOOSE_A_TOPIC'] . '</option>';
        while ($row = $this->db->sql_fetchrow($result)) {
            if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
                continue;
            }
            if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
                continue;
            }
            ++$count;
            $topic_color = $row['post_visibility'] != ITEM_APPROVED ? 'class="error"' : '';
            $topic_options .= '<option value="' . append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']) . '" ' . $topic_color . '>&nbsp;&nbsp;' . truncate_string($row['topic_title'], 30, 255, false, $this->user->lang['ELLIPSIS']) . '</option>';
        }
        $this->db->sql_freeresult($result);
        if (!empty($count)) {
            $this->template->assign_vars(array('HAS_TOPICS' => true, 'S_TOPIC_OPTIONS' => $topic_options));
        }
    }
开发者ID:rmcgirr83,项目名称:phpBB-3.1-topicsbyuser,代码行数:36,代码来源:listener.php

示例13: handle_downloadlog

    public function handle_downloadlog()
    {
        if (!$this->auth->acl_get('a_')) {
            trigger_error('Access Denied');
        } else {
            $this->user->add_lang_ext('dmzx/downloadlog', 'common');
            $fileid = $this->request->variable('file', 0);
            $start = $this->request->variable('start', 0);
            // Pagination number from ACP
            $dll = $this->config['downloadlog_value'];
            // Generate pagination
            $sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs
				FROM ' . $this->userdownloadslog_table . '
				WHERE user_id = user_id
				AND file_id = ' . $fileid;
            $result = $this->db->sql_query($sql);
            $total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs');
            $sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
				FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u
				WHERE u.user_id = d.user_id
				AND file_id = ' . $fileid . '
				ORDER BY d.down_date DESC';
            $top_result = $this->db->sql_query_limit($sql, $dll, $start);
            while ($row = $this->db->sql_fetchrow($top_result)) {
                $this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date'])));
            }
        }
        $pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid));
        //Start pagination
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start);
        $this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version']));
        page_header('Downloaders Log', false);
        $this->template->set_filenames(array('body' => 'DownloadLog.html'));
        page_footer();
    }
开发者ID:phpbb-es,项目名称:Downloadlog,代码行数:35,代码来源:downloadlog.php

示例14: page_header

    public function page_header($event)
    {
        if ($this->auth->acl_get('u_did_you_know')) {
            $sql_layer = $this->db->get_sql_layer();
            switch ($sql_layer) {
                case 'postgres':
                    $random = 'RANDOM()';
                    break;
                case 'mssql':
                case 'mssql_odbc':
                    $random = 'NEWID()';
                    break;
                default:
                    $random = 'RAND()';
                    break;
            }
            $sql = 'SELECT word, bbcode_uid, bbcode_bitfield, bbcode_options
				FROM ' . $this->did_you_know . "\n\t\t\t\tWHERE lang_iso = '{$this->user->data['user_lang']}'\n\t\t\t\t\tOR lang_iso = 'default'\n\t\t\t\tORDER BY {$random}";
            $result = $this->db->sql_query_limit($sql, 1);
            $row = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            $word = generate_text_for_display($row['word'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
            $this->template->assign_vars(array('DID_YOU_KNOW' => str_replace("&quot;", '"', $word), 'S_DIDYOUKNOW' => !empty($this->user->data['user_didyouknow']) ? true : false, 'U_DYK_HIDE' => $this->helper->route('dmzx_didyouknow_controller', array('mode' => 'hide'))));
        }
    }
开发者ID:phpbb-es,项目名称:Did-You-Know,代码行数:25,代码来源:listener.php

示例15: array

    /**
     * Modified version of the jumpbox, just lists authed forums (in the correct order)
     */
    function get_forum_list($ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false)
    {
        // This query is identical to the jumpbox one
        $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id
			FROM ' . FORUMS_TABLE . '
			ORDER BY left_id ASC';
        $result = $this->db->sql_query($sql, 600);
        // We include the forum root/index to make tree traversal easier
        $forum_list[0] = array('forum_id' => '0', 'forum_name' => $this->user->lang['FORUMS'], 'forum_type' => '0', 'link' => append_sid("{$this->root_path}index.{$this->phpEx}"), 'parent_id' => false, 'current' => false, 'current_child' => false, 'disabled' => false);
        // Sometimes it could happen that forums will be displayed here not be displayed within the index page
        // This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions.
        // If this happens, the padding could be "broken"
        while ($row = $this->db->sql_fetchrow($result)) {
            $disabled = false;
            if (!$ignore_acl && $this->auth->acl_gets(array('f_list', 'f_read'), $row['forum_id'])) {
                if ($only_acl_post && !$this->auth->acl_get('f_post', $row['forum_id']) || !$this->auth->acl_get('m_approve', $row['forum_id']) && !$this->auth->acl_get('f_noapprove', $row['forum_id'])) {
                    $disabled = true;
                }
            } else {
                if (!$ignore_acl) {
                    continue;
                }
            }
            if (is_array($ignore_id) && in_array($row['forum_id'], $ignore_id) || $row['forum_id'] == $ignore_id || $row['forum_type'] == FORUM_CAT && $row['left_id'] + 1 == $row['right_id'] && $ignore_emptycat || $row['forum_type'] != FORUM_POST && $ignore_nonpost) {
                $disabled = true;
            }
            $u_viewforum = append_sid("{$this->root_path}viewforum.{$this->phpEx}", 'f=' . $row['forum_id']);
            $forum_list[$row['forum_id']] = array('forum_id' => $row['forum_id'], 'forum_name' => $row['forum_name'], 'forum_type' => $row['forum_type'], 'link' => $u_viewforum, 'parent_id' => $row['parent_id'], 'current' => false, 'current_child' => false, 'disabled' => $disabled);
        }
        $this->db->sql_freeresult($result);
        return $forum_list;
    }
开发者ID:Sajaki,项目名称:BreadcrumbMenu,代码行数:35,代码来源:listener.php


注:本文中的phpbb\auth\auth::acl_get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。