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


PHP get_forum_branch函数代码示例

本文整理汇总了PHP中get_forum_branch函数的典型用法代码示例。如果您正苦于以下问题:PHP get_forum_branch函数的具体用法?PHP get_forum_branch怎么用?PHP get_forum_branch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: acp_manage_forums_request_data

    /**
     * Store user input
     *
     * @param $event
     */
    public function acp_manage_forums_request_data($event)
    {
        $sort_topics_by = $this->request->variable('sk', $this->default_sort_by);
        $sort_topics_order = $this->request->variable('sd', $this->default_sort_order);
        $sort_topics_subforums = $this->request->variable('sort_topics_subforums', false);
        $sort_options = array('sort_topics_by' => $sort_topics_by, 'sort_topics_order' => $sort_topics_order);
        $event['forum_data'] = array_merge($event['forum_data'], $sort_options);
        // Apply this forum's sorting to all sub-forums
        if ($event['action'] == 'edit' && $sort_topics_subforums) {
            $subforum_ids = array();
            foreach (get_forum_branch($event['forum_data']['forum_id'], 'children', 'descending', false) as $subforum) {
                $subforum_ids[] = (int) $subforum['forum_id'];
            }
            if ($subforum_ids) {
                $sql = 'UPDATE ' . FORUMS_TABLE . '
					SET ' . $this->db->sql_build_array('UPDATE', $sort_options) . '
					WHERE ' . $this->db->sql_in_set('forum_id', $subforum_ids);
                $this->db->sql_query($sql);
            }
        }
    }
开发者ID:kasimi,项目名称:phpbb-ext-sorttopics,代码行数:26,代码来源:acp_listener.php

示例2: acp_manage_forums_request_data

    /**
     * Store user input
     *
     * Event: core.acp_manage_forums_request_data
     */
    public function acp_manage_forums_request_data($event)
    {
        $sort_topics_by = $this->request->variable('sk', $this->default_sort_by);
        $sort_topics_order = $this->request->variable('sd', $this->default_sort_order);
        $sort_topics_subforums = $this->request->variable('sort_topics_subforums', 0);
        $event['forum_data'] = array_merge($event['forum_data'], array('sort_topics_by' => $sort_topics_by, 'sort_topics_order' => $sort_topics_order));
        // Apply this forum's sorting to all sub-forums
        if ($sort_topics_subforums) {
            $subforum_ids = array();
            foreach (get_forum_branch($event['forum_data']['forum_id'], 'children', 'descending', false) as $subforum) {
                $subforum_ids[] = (int) $subforum['forum_id'];
            }
            if (!empty($subforum_ids)) {
                $this->db->sql_transaction('begin');
                foreach ($subforum_ids as $subforum_id) {
                    $sql_ary = 'UPDATE ' . FORUMS_TABLE . '
								SET ' . sprintf("sort_topics_by = '%s', sort_topics_order = '%s'", $sort_topics_by, $sort_topics_order) . '
								WHERE forum_id = ' . (int) $subforum_id;
                    $this->db->sql_query($sql_ary);
                }
                $this->db->sql_transaction('commit');
            }
        }
    }
开发者ID:Mauron,项目名称:phpbb-ext-sorttopics,代码行数:29,代码来源:acp_listener.php

示例3: acp_manage_forums_request_data

    /**
     * Event: core.acp_manage_forums_request_data
     */
    public function acp_manage_forums_request_data($event)
    {
        $move_topics = $this->request->variable('move_topics_when_locked', 0);
        $move_topics_to = $this->request->variable('move_topics_when_locked_to', 0);
        $event['forum_data'] = array_merge($event['forum_data'], array('move_topics_when_locked' => $move_topics, 'move_topics_when_locked_to' => $move_topics_to));
        // Apply this forum's preferences to all sub-forums
        if ($this->request->variable('move_topics_when_locked_subforums', 0)) {
            $subforum_ids = array();
            foreach (get_forum_branch($event['forum_data']['forum_id'], 'children', 'descending', false) as $subforum) {
                $subforum_ids[] = (int) $subforum['forum_id'];
            }
            if (!empty($subforum_ids)) {
                $this->db->sql_transaction('begin');
                foreach ($subforum_ids as $subforum_id) {
                    $sql_ary = 'UPDATE ' . FORUMS_TABLE . '
						SET move_topics_when_locked = ' . (int) $move_topics . ',
							move_topics_when_locked_to = ' . (int) $move_topics_to . '
						WHERE forum_id = ' . (int) $subforum_id;
                    $this->db->sql_query($sql_ary);
                }
                $this->db->sql_transaction('commit');
            }
        }
    }
开发者ID:phpbb-addons,项目名称:phpbb-ext-movetopicswhenlocked,代码行数:27,代码来源:listener.php

示例4: main

    function main($id, $mode)
    {
        global $db, $user, $auth, $template, $phpbb_container, $request;
        global $config, $phpbb_root_path, $phpEx;
        if (!function_exists('user_get_id_name')) {
            include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        }
        if (!class_exists('auth_admin')) {
            include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
        }
        $this->permissions = $phpbb_container->get('acl.permissions');
        $auth_admin = new auth_admin();
        $user->add_lang('acp/permissions');
        add_permission_language();
        $this->tpl_name = 'acp_permissions';
        // Trace has other vars
        if ($mode == 'trace') {
            $user_id = $request->variable('u', 0);
            $forum_id = $request->variable('f', 0);
            $permission = $request->variable('auth', '');
            $this->tpl_name = 'permission_trace';
            if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth')) {
                $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission));
                $this->permission_trace($user_id, $forum_id, $permission);
                return;
            }
            trigger_error('NO_MODE', E_USER_ERROR);
        }
        // Copy forum permissions
        if ($mode == 'setting_forum_copy') {
            $this->tpl_name = 'permission_forum_copy';
            if ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) {
                $this->page_title = 'ACP_FORUM_PERMISSIONS_COPY';
                $this->copy_forum_permissions();
                return;
            }
            trigger_error('NO_MODE', E_USER_ERROR);
        }
        // Set some vars
        $action = $request->variable('action', array('' => 0));
        $action = key($action);
        $action = isset($_POST['psubmit']) ? 'apply_permissions' : $action;
        $all_forums = $request->variable('all_forums', 0);
        $subforum_id = $request->variable('subforum_id', 0);
        $forum_id = $request->variable('forum_id', array(0));
        $username = $request->variable('username', array(''), true);
        $usernames = $request->variable('usernames', '', true);
        $user_id = $request->variable('user_id', array(0));
        $group_id = $request->variable('group_id', array(0));
        $select_all_groups = $request->variable('select_all_groups', 0);
        $form_name = 'acp_permissions';
        add_form_key($form_name);
        // If select all groups is set, we pre-build the group id array (this option is used for other screens to link to the permission settings screen)
        if ($select_all_groups) {
            // Add default groups to selection
            $sql_and = !$config['coppa_enable'] ? " AND group_name <> 'REGISTERED_COPPA'" : '';
            $sql = 'SELECT group_id
				FROM ' . GROUPS_TABLE . '
				WHERE group_type = ' . GROUP_SPECIAL . "\n\t\t\t\t{$sql_and}";
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $group_id[] = $row['group_id'];
            }
            $db->sql_freeresult($result);
        }
        // Map usernames to ids and vice versa
        if ($usernames) {
            $username = explode("\n", $usernames);
        }
        unset($usernames);
        if (sizeof($username) && !sizeof($user_id)) {
            user_get_id_name($user_id, $username);
            if (!sizeof($user_id)) {
                trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
            }
        }
        unset($username);
        // Build forum ids (of all forums are checked or subforum listing used)
        if ($all_forums) {
            $sql = 'SELECT forum_id
				FROM ' . FORUMS_TABLE . '
				ORDER BY left_id';
            $result = $db->sql_query($sql);
            $forum_id = array();
            while ($row = $db->sql_fetchrow($result)) {
                $forum_id[] = (int) $row['forum_id'];
            }
            $db->sql_freeresult($result);
        } else {
            if ($subforum_id) {
                $forum_id = array();
                foreach (get_forum_branch($subforum_id, 'children') as $row) {
                    $forum_id[] = (int) $row['forum_id'];
                }
            }
        }
        // Define some common variables for every mode
        $permission_scope = strpos($mode, '_global') !== false ? 'global' : 'local';
        // Showing introductionary page?
        if ($mode == 'intro') {
//.........这里部分代码省略.........
开发者ID:phpbb,项目名称:phpbb,代码行数:101,代码来源:acp_permissions.php

示例5: delete_forum

    /**
     * Remove complete forum
     */
    function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0)
    {
        global $db, $user, $cache;
        $forum_data = $this->get_forum_info($forum_id);
        $errors = array();
        $log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = '';
        $forum_ids = array($forum_id);
        if ($action_posts == 'delete') {
            $log_action_posts = 'POSTS';
            $errors = array_merge($errors, $this->delete_forum_content($forum_id));
        } else {
            if ($action_posts == 'move') {
                if (!$posts_to_id) {
                    $errors[] = $user->lang['NO_DESTINATION_FORUM'];
                } else {
                    $log_action_posts = 'MOVE_POSTS';
                    $sql = 'SELECT forum_name
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . $posts_to_id;
                    $result = $db->sql_query($sql);
                    $row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    if (!$row) {
                        $errors[] = $user->lang['NO_FORUM'];
                    } else {
                        $posts_to_name = $row['forum_name'];
                        $errors = array_merge($errors, $this->move_forum_content($forum_id, $posts_to_id));
                    }
                }
            }
        }
        if (sizeof($errors)) {
            return $errors;
        }
        if ($action_subforums == 'delete') {
            $log_action_forums = 'FORUMS';
            $rows = get_forum_branch($forum_id, 'children', 'descending', false);
            foreach ($rows as $row) {
                $forum_ids[] = $row['forum_id'];
                $errors = array_merge($errors, $this->delete_forum_content($row['forum_id']));
            }
            if (sizeof($errors)) {
                return $errors;
            }
            $diff = sizeof($forum_ids) * 2;
            $sql = 'DELETE FROM ' . FORUMS_TABLE . '
				WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
            $db->sql_query($sql);
            $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
				WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
            $db->sql_query($sql);
            $sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
				WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
            $db->sql_query($sql);
        } else {
            if ($action_subforums == 'move') {
                if (!$subforums_to_id) {
                    $errors[] = $user->lang['NO_DESTINATION_FORUM'];
                } else {
                    $log_action_forums = 'MOVE_FORUMS';
                    $sql = 'SELECT forum_name
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . $subforums_to_id;
                    $result = $db->sql_query($sql);
                    $row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    if (!$row) {
                        $errors[] = $user->lang['NO_FORUM'];
                    } else {
                        $subforums_to_name = $row['forum_name'];
                        $sql = 'SELECT forum_id
						FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE parent_id = {$forum_id}";
                        $result = $db->sql_query($sql);
                        while ($row = $db->sql_fetchrow($result)) {
                            $this->move_forum($row['forum_id'], $subforums_to_id);
                        }
                        $db->sql_freeresult($result);
                        // Grab new forum data for correct tree updating later
                        $forum_data = $this->get_forum_info($forum_id);
                        $sql = 'UPDATE ' . FORUMS_TABLE . "\n\t\t\t\t\t\tSET parent_id = {$subforums_to_id}\n\t\t\t\t\t\tWHERE parent_id = {$forum_id}";
                        $db->sql_query($sql);
                        $diff = 2;
                        $sql = 'DELETE FROM ' . FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id = {$forum_id}";
                        $db->sql_query($sql);
                        $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id = {$forum_id}";
                        $db->sql_query($sql);
                        $sql = 'DELETE FROM ' . ACL_USERS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id = {$forum_id}";
                        $db->sql_query($sql);
                    }
                }
                if (sizeof($errors)) {
                    return $errors;
                }
            } else {
                $diff = 2;
                $sql = 'DELETE FROM ' . FORUMS_TABLE . "\n\t\t\t\tWHERE forum_id = {$forum_id}";
                $db->sql_query($sql);
//.........这里部分代码省略.........
开发者ID:PetsFundation,项目名称:Pets,代码行数:101,代码来源:acp_forums.php

示例6: main


//.........这里部分代码省略.........
                        $cache->destroy('sql', FORUMS_TABLE);
                    }
                    break;
                case 'add':
                case 'edit':
                    if ($update) {
                        $forum_data['forum_flags'] = 0;
                        $forum_data['forum_flags'] += request_var('forum_link_track', false) ? FORUM_FLAG_LINK_TRACK : 0;
                        $forum_data['forum_flags'] += request_var('prune_old_polls', false) ? FORUM_FLAG_PRUNE_POLL : 0;
                        $forum_data['forum_flags'] += request_var('prune_announce', false) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0;
                        $forum_data['forum_flags'] += request_var('prune_sticky', false) ? FORUM_FLAG_PRUNE_STICKY : 0;
                        $forum_data['forum_flags'] += $forum_data['show_active'] ? FORUM_FLAG_ACTIVE_TOPICS : 0;
                        $forum_data['forum_flags'] += request_var('enable_post_review', true) ? FORUM_FLAG_POST_REVIEW : 0;
                    }
                    // Show form to create/modify a forum
                    if ($action == 'edit') {
                        $this->page_title = 'EDIT_PROJECT';
                        $row = $this->parent->get_forum_info($forum_id);
                        $old_forum_type = $row['forum_type'];
                        // Get the project's id name
                        $sql = 'SELECT project_name
							FROM ' . BUGS_PROJECTS_TABLE . "\n\t\t\t\t\t\t\tWHERE forum_id = {$forum_id}";
                        $result = $db->sql_query($sql);
                        $row['project_idname'] = $db->sql_fetchfield('project_name', false, $result);
                        $db->sql_freeresult($result);
                        if (!$update) {
                            $forum_data = $row;
                        } else {
                            $forum_data['left_id'] = $row['left_id'];
                            $forum_data['right_id'] = $row['right_id'];
                        }
                        // Make sure no direct child forums are able to be selected as parents.
                        $exclude_forums = array();
                        foreach (get_forum_branch($forum_id, 'children') as $row) {
                            $exclude_forums[] = $row['forum_id'];
                        }
                        $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false);
                        $forum_data['forum_password_confirm'] = $forum_data['forum_password'];
                    } else {
                        $this->page_title = 'CREATE_PROJECT';
                        $forum_id = BUGS_FORUM_ID;
                        // Fill forum data with default values
                        if (!$update) {
                            $forum_data = array('parent_id' => BUGS_FORUM_ID, 'forum_type' => FORUM_POST, 'forum_status' => ITEM_UNLOCKED, 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), 'project_idname' => '', 'forum_link' => '', 'forum_link_track' => false, 'forum_desc' => '', 'forum_rules' => '', 'forum_rules_link' => '', 'forum_image' => '', 'forum_style' => 0, 'display_on_index' => false, 'forum_topics_per_page' => 0, 'enable_indexing' => true, 'enable_icons' => false, 'enable_prune' => false, 'prune_days' => 7, 'prune_viewed' => 7, 'prune_freq' => 1, 'forum_flags' => FORUM_FLAG_POST_REVIEW, 'forum_password' => '', 'forum_password_confirm' => '');
                        }
                    }
                    $forum_rules_data = array('text' => $forum_data['forum_rules'], 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
                    $forum_desc_data = array('text' => $forum_data['forum_desc'], 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
                    $forum_rules_preview = '';
                    // Parse rules if specified
                    if ($forum_data['forum_rules']) {
                        if (!isset($forum_data['forum_rules_uid'])) {
                            // Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
                            $forum_data['forum_rules_uid'] = '';
                            $forum_data['forum_rules_bitfield'] = '';
                            $forum_data['forum_rules_options'] = 0;
                            generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smilies', false));
                        }
                        // Generate preview content
                        $forum_rules_preview = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']);
                        // decode...
                        $forum_rules_data = generate_text_for_edit($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_options']);
                    }
                    // Parse desciption if specified
                    if ($forum_data['forum_desc']) {
                        if (!isset($forum_data['forum_desc_uid'])) {
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:67,代码来源:acp_bugs.php

示例7: get_subforum_ids

 /**
  * Returns an array containing all IDs of the forum's sub-forums (and their sub-forums)
  *
  * @param int $forum_id
  * @return array
  */
 protected function get_subforum_ids($forum_id)
 {
     $subforum_ids = array();
     foreach (get_forum_branch((int) $forum_id, 'children', 'descending', false) as $subforum) {
         $subforum_ids[] = (int) $subforum['forum_id'];
     }
     return $subforum_ids;
 }
开发者ID:kasimi,项目名称:phpbb-ext-movetopicswhenlocked,代码行数:14,代码来源:acp_listener.php

示例8: delete_forum

function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0)
{
    global $_CLASS;
    $row = get_forum_info($forum_id);
    extract($row);
    $errors = array();
    $log_action_posts = $log_action_forums = '';
    if ($action_posts == 'delete') {
        $_CLASS['core_db']->query('UPDATE ' . FORUMS_FORUMS_TABLE . ' SET forum_status = ' . ITEM_DELETING . ' WHERE forum_id = ' . $forum_id);
        $log_action_posts = 'POSTS';
        if ($delete_error = delete_forum_content($forum_id)) {
            $errors[] = $delete_error;
        }
    } elseif ($action_posts == 'move') {
        if (!$posts_to_id) {
            $errors[] = $_CLASS['core_user']->lang['NO_DESTINATION_FORUM'];
        } else {
            $log_action_posts = 'MOVE_POSTS';
            $sql = 'SELECT forum_name 
				FROM ' . FORUMS_FORUMS_TABLE . '
				WHERE forum_id = ' . $posts_to_id;
            $result = $_CLASS['core_db']->query($sql);
            if (!($row = $_CLASS['core_db']->fetch_row_assoc($result))) {
                $errors[] = $_CLASS['core_user']->lang['NO_FORUM'];
            } else {
                $posts_to_name = $row['forum_name'];
                unset($row);
                $errors[] = move_forum_content($forum_id, $subforums_to_id);
            }
        }
    }
    if (count($errors)) {
        return $errors;
    }
    if ($action_subforums == 'delete') {
        $log_action_forums = 'FORUMS';
        $forum_ids = array($forum_id);
        $rows = get_forum_branch($forum_id, 'children', 'descending', FALSE);
        // Maybe add feild to the get_forum_branch
        foreach ($rows as $row) {
            $forum_ids[] = $row['forum_id'];
        }
        unset($rows);
        $_CLASS['core_db']->query('UPDATE ' . FORUMS_FORUMS_TABLE . '  SET forum_status = ' . ITEM_DELETING . ' WHERE forum_id  IN (' . implode(', ', $forum_ids) . ')');
        foreach ($forum_ids as $forum_id) {
            if ($delete_error = delete_forum_content($forum_id)) {
                $errors[] = $delete_error;
            }
        }
        if (count($errors)) {
            return $errors;
        }
        $diff = count($forum_ids) * 2;
        $sql = 'DELETE FROM ' . FORUMS_FORUMS_TABLE . '
			WHERE forum_id IN (' . implode(', ', $forum_ids) . ')';
        $_CLASS['core_db']->query($sql);
    } elseif ($action_subforums == 'move') {
        if (!$subforums_to_id) {
            $errors[] = $_CLASS['core_user']->lang['NO_DESTINATION_FORUM'];
        } else {
            $log_action_forums = 'MOVE_FORUMS';
            $sql = 'SELECT forum_name 
				FROM ' . FORUMS_FORUMS_TABLE . '
				WHERE forum_id = ' . $subforums_to_id;
            $result = $_CLASS['core_db']->query($sql);
            if (!($row = $_CLASS['core_db']->fetch_row_assoc($result))) {
                $errors[] = $_CLASS['core_user']->lang['NO_FORUM'];
            } else {
                $subforums_to_name = $row['forum_name'];
                unset($row);
                $sql = 'SELECT forum_id
					FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\t\tWHERE parent_id = {$forum_id}";
                $result = $_CLASS['core_db']->query($sql);
                while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                    move_forum($row['forum_id'], intval($_POST['subforums_to_id']));
                }
                $_CLASS['core_db']->free_result($result);
                $sql = 'UPDATE ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\t\tSET parent_id = {$subforums_to_id}\n\t\t\t\t\tWHERE parent_id = {$forum_id}";
                $_CLASS['core_db']->query($sql);
                $diff = 2;
                $sql = 'DELETE FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\t\tWHERE forum_id = {$forum_id}";
                $_CLASS['core_db']->query($sql);
            }
        }
        if (count($errors)) {
            return $errors;
        }
    } else {
        $diff = 2;
        $sql = 'DELETE FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\tWHERE forum_id = {$forum_id}";
        $_CLASS['core_db']->query($sql);
    }
    // Resync tree
    $sql = 'UPDATE ' . FORUMS_FORUMS_TABLE . "\n\t\tSET right_id = right_id - {$diff}\n\t\tWHERE left_id < {$right_id} AND right_id > {$right_id}";
    $_CLASS['core_db']->query($sql);
    $sql = 'UPDATE ' . FORUMS_FORUMS_TABLE . "\n\t\tSET left_id = left_id - {$diff}, right_id = right_id - {$diff}\n\t\tWHERE left_id > {$right_id}";
    $_CLASS['core_db']->query($sql);
    if (!is_array($forum_ids)) {
        $forum_ids = array($forum_id);
    }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:admin_forums.php

示例9: main

    function main($id, $mode)
    {
        global $db, $user, $auth, $template, $cache;
        global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
        include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        include_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
        $auth_admin = new auth_admin();
        $user->add_lang('acp/permissions');
        $user->add_lang('acp/permissions_phpbb');
        $this->tpl_name = 'acp_permissions';
        // Trace has other vars
        if ($mode == 'trace') {
            $user_id = request_var('u', 0);
            $forum_id = request_var('f', 0);
            $permission = request_var('auth', '');
            $this->tpl_name = 'permission_trace';
            if ($user_id && isset($auth_admin->option_ids[$permission]) && $auth->acl_get('a_viewauth')) {
                $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']);
                $this->permission_trace($user_id, $forum_id, $permission);
                return;
            }
            trigger_error('NO_MODE');
        }
        // Set some vars
        $action = request_var('action', array('' => 0));
        $action = key($action);
        $action = isset($_POST['psubmit']) ? 'apply_permissions' : $action;
        $all_forums = request_var('all_forums', 0);
        $subforum_id = request_var('subforum_id', 0);
        $forum_id = request_var('forum_id', array(0));
        $username = request_var('username', array(''), true);
        $usernames = request_var('usernames', '', true);
        $user_id = request_var('user_id', array(0));
        $group_id = request_var('group_id', array(0));
        $select_all_groups = request_var('select_all_groups', 0);
        // If select all groups is set, we pre-build the group id array (this option is used for other screens to link to the permission settings screen)
        if ($select_all_groups) {
            // Add default groups to selection
            $sql_and = $config['coppa_hide_groups'] ? " AND group_name NOT IN ('INACTIVE_COPPA', 'REGISTERED_COPPA')" : '';
            $sql = 'SELECT group_id
				FROM ' . GROUPS_TABLE . '
				WHERE group_type = ' . GROUP_SPECIAL . "\n\t\t\t\t{$sql_and}";
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $group_id[] = $row['group_id'];
            }
            $db->sql_freeresult($result);
        }
        // Map usernames to ids and vice versa
        if ($usernames) {
            $username = explode("\n", $usernames);
        }
        unset($usernames);
        if (sizeof($username) && !sizeof($user_id)) {
            user_get_id_name($user_id, $username);
            if (!sizeof($user_id)) {
                trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action));
            }
        }
        unset($username);
        // Build forum ids (of all forums are checked or subforum listing used)
        if ($all_forums) {
            $sql = 'SELECT forum_id
				FROM ' . FORUMS_TABLE . '
				ORDER BY left_id';
            $result = $db->sql_query($sql);
            $forum_id = array();
            while ($row = $db->sql_fetchrow($result)) {
                $forum_id[] = $row['forum_id'];
            }
            $db->sql_freeresult($result);
        } else {
            if ($subforum_id) {
                $forum_id = array();
                foreach (get_forum_branch($subforum_id, 'children') as $row) {
                    $forum_id[] = $row['forum_id'];
                }
            }
        }
        // Define some common variables for every mode
        $error = array();
        $permission_scope = strpos($mode, '_global') !== false ? 'global' : 'local';
        // Showing introductionary page?
        if ($mode == 'intro') {
            $this->page_title = 'ACP_PERMISSIONS';
            $template->assign_vars(array('S_INTRO' => true));
            return;
        }
        switch ($mode) {
            case 'setting_user_global':
            case 'setting_group_global':
                $this->permission_dropdown = array('u_', 'm_', 'a_');
                $permission_victim = $mode == 'setting_user_global' ? array('user') : array('group');
                $this->page_title = $mode == 'setting_user_global' ? 'ACP_USERS_PERMISSIONS' : 'ACP_GROUPS_PERMISSIONS';
                break;
            case 'setting_user_local':
            case 'setting_group_local':
                $this->permission_dropdown = array('f_', 'm_');
                $permission_victim = $mode == 'setting_user_local' ? array('user', 'forums') : array('group', 'forums');
                $this->page_title = $mode == 'setting_user_local' ? 'ACP_USERS_FORUM_PERMISSIONS' : 'ACP_GROUPS_FORUM_PERMISSIONS';
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:acp_permissions.php

示例10: get_forum_branch

            ?>
" value="*"<?php 
            echo $selected_ignore;
            ?>
 /></td>
<?php 
        }
        ?>
			</tr>
<?php 
    }
    // If we're setting forum or moderator options and a single forum has
    // been selected then look to see if any subforums exist. If they do
    // give user the option of cascading permissions to them
    if (($mode == 'forum' || $mode == 'mod') && empty($submode) && sizeof($forum_id[$which_mode]) == 1) {
        $children = get_forum_branch($forum_id[$which_mode][0], 'children', 'descending', false);
        if (!empty($children)) {
            ?>
			<tr>
				<th colspan="<?php 
            echo $colspan;
            ?>
"><?php 
            echo $_CLASS['core_user']->lang['ACL_SUBFORUMS'];
            ?>
</th>
			</tr>
			<tr>
				<td class="row1" colspan="<?php 
            echo $colspan;
            ?>
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:admin_permissions.php


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