本文整理汇总了PHP中copy_forum_permissions函数的典型用法代码示例。如果您正苦于以下问题:PHP copy_forum_permissions函数的具体用法?PHP copy_forum_permissions怎么用?PHP copy_forum_permissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy_forum_permissions函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add(&$forum_data, $forum_perm_from = 0)
{
$forum_data += array('parent_id' => $this->config['sitemaker_parent_forum_id'], 'forum_type' => FORUM_POST, 'type_action' => '', 'forum_status' => ITEM_UNLOCKED, 'forum_parents' => '', 'forum_name' => '', 'forum_link' => '', 'forum_link_track' => false, 'forum_desc' => '', 'forum_desc_uid' => '', 'forum_desc_options' => 7, 'forum_desc_bitfield' => '', 'forum_rules' => '', 'forum_rules_uid' => '', 'forum_rules_options' => 7, 'forum_rules_bitfield' => '', 'forum_rules_link' => '', 'forum_image' => '', 'forum_style' => 0, 'display_subforum_list' => false, 'display_on_index' => false, 'forum_topics_per_page' => 0, 'enable_indexing' => true, 'enable_icons' => false, 'enable_prune' => false, 'enable_post_review' => true, 'enable_quick_reply' => false, 'prune_days' => 7, 'prune_viewed' => 7, 'prune_freq' => 1, 'prune_old_polls' => false, 'prune_announce' => false, 'prune_sticky' => false, 'show_active' => false, 'forum_password' => '', 'forum_password_confirm' => '', 'forum_password_unset' => false);
$errors = $this->forum->update_forum_data($forum_data);
if (!sizeof($errors)) {
$forum_data['forum_id'] = (int) $forum_data['forum_id'];
// Copy permissions?
if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id']) {
copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], false, false);
phpbb_cache_moderators($this->db, $this->cache, $this->auth);
}
$this->auth->acl_clear_prefetch();
$this->cache->destroy('sql', FORUMS_TABLE);
}
return $errors;
}
示例2: add
public function add(array &$forum_data, $forum_perm_from = 0)
{
$forum_data += array('parent_id' => $this->config['sitemaker_parent_forum_id']);
$errors = admin::save($forum_data);
if (!sizeof($errors)) {
$forum_data['forum_id'] = (int) $forum_data['forum_id'];
// Copy permissions?
if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id']) {
copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], false, false);
phpbb_cache_moderators($this->db, $this->cache, $this->auth);
}
$this->auth->acl_clear_prefetch();
$this->cache->destroy('sql', FORUMS_TABLE);
}
return $errors;
}
示例3: copy_forum_permissions
/**
* Handles copying permissions from one forum to others
*/
function copy_forum_permissions()
{
global $db, $auth, $cache, $template, $user, $request;
$user->add_lang('acp/forums');
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$src = $request->variable('src_forum_id', 0);
$dest = $request->variable('dest_forum_ids', array(0));
if (confirm_box(true)) {
if (copy_forum_permissions($src, $dest)) {
phpbb_cache_moderators($db, $cache, $auth);
$auth->acl_clear_prefetch();
$cache->destroy('sql', FORUMS_TABLE);
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
} else {
trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
}
} else {
$s_hidden_fields = array('submit' => $submit, 'src_forum_id' => $src, 'dest_forum_ids' => $dest);
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
confirm_box(false, $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields);
}
}
$template->assign_vars(array('S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false)));
}
示例4: _create_forums
/**
* The function actually creating the forums
*/
private function _create_forums($forum_type, $cnt, $acp_forums, $parent_id = 0)
{
global $user, $auth;
$forum_name = $forum_type == FORUM_CAT ? sprintf($user->lang['TEST_CAT_NAME'], $cnt) : sprintf($user->lang['TEST_FORUM_NAME'], $cnt);
$forum_desc = $forum_type == FORUM_CAT ? sprintf($user->lang['TEST_FORUM_NAME'], $cnt) : '';
// Setting up the data to be used
$forum_data = array('parent_id' => $parent_id, 'forum_type' => $forum_type, 'forum_status' => ITEM_UNLOCKED, 'forum_parents' => '', 'forum_options' => 0, 'forum_name' => utf8_normalize_nfc($forum_name), 'forum_link' => '', 'forum_link_track' => false, 'forum_desc' => utf8_normalize_nfc($forum_desc), 'forum_desc_uid' => '', 'forum_desc_options' => 7, 'forum_desc_bitfield' => '', 'forum_rules' => '', 'forum_rules_uid' => '', 'forum_rules_options' => 7, 'forum_rules_bitfield' => '', 'forum_rules_link' => '', 'forum_image' => '', 'forum_style' => 0, 'forum_password' => '', 'forum_password_confirm' => '', 'display_subforum_list' => true, 'display_on_index' => true, 'forum_topics_per_page' => 0, 'enable_indexing' => true, 'enable_icons' => false, 'enable_prune' => false, 'enable_post_review' => true, 'enable_quick_reply' => false, 'prune_days' => 7, 'prune_viewed' => 7, 'prune_freq' => 1, 'prune_old_polls' => false, 'prune_announce' => false, 'prune_sticky' => false, 'forum_password_unset' => false, 'show_active' => 1);
// The description should not need this, but who knows what people will come up with.
generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], false, false, false);
// Create that thing.
$errors = $acp_forums->update_forum_data($forum_data);
if (sizeof($errors)) {
trigger_error(implode('<br />', $errors));
}
// Copy the permissions from our default forums
copy_forum_permissions($this->def_forum_id, $forum_data['forum_id']);
$auth->acl_clear_prefetch();
if ($forum_type == FORUM_POST) {
// A normal forum. There is no link type forums installed with phpBB.
$this->forum_arr[$forum_data['forum_id']] = array('forum_id' => $forum_data['forum_id'], 'parent_id' => $forum_data['parent_id'], 'forum_topics_real' => 0, 'forum_last_post_id' => 0, 'forum_last_poster_id' => 0, 'forum_last_post_subject' => '', 'forum_last_post_time' => 0, 'forum_last_poster_name' => '');
if (defined('PHPBB_31')) {
$this->forum_arr[$forum_data['forum_id']]['forum_posts_approved'] = 0;
$this->forum_arr[$forum_data['forum_id']]['forum_topics_approved'] = 0;
} else {
$this->forum_arr[$forum_data['forum_id']]['forum_posts'] = 0;
$this->forum_arr[$forum_data['forum_id']]['forum_topics'] = 0;
}
}
return $forum_data['forum_id'];
}
示例5: main
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
$user->add_lang('acp/forums');
$this->tpl_name = 'acp_forums';
$this->page_title = 'ACP_MANAGE_FORUMS';
$form_key = 'acp_forums';
add_form_key($form_key);
$action = request_var('action', '');
$update = isset($_POST['update']) ? true : false;
$forum_id = request_var('f', 0);
$this->parent_id = request_var('parent_id', 0);
$forum_data = $errors = array();
if ($update && !check_form_key($form_key)) {
$update = false;
$errors[] = $user->lang['FORM_INVALID'];
}
// Check additional permissions
switch ($action) {
case 'progress_bar':
$start = request_var('start', 0);
$total = request_var('total', 0);
$this->display_progress_bar($start, $total);
break;
case 'delete':
if (!$auth->acl_get('a_forumdel')) {
trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);
}
break;
case 'add':
if (!$auth->acl_get('a_forumadd')) {
trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);
}
break;
}
// Major routines
if ($update) {
switch ($action) {
case 'delete':
$action_subforums = request_var('action_subforums', '');
$subforums_to_id = request_var('subforums_to_id', 0);
$action_posts = request_var('action_posts', '');
$posts_to_id = request_var('posts_to_id', 0);
$errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id);
if (sizeof($errors)) {
break;
}
$auth->acl_clear_prefetch();
$cache->destroy('sql', FORUMS_TABLE);
trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
break;
case 'edit':
$forum_data = array('forum_id' => $forum_id);
// No break here
// No break here
case 'add':
$forum_data += array('parent_id' => request_var('forum_parent_id', $this->parent_id), 'forum_type' => request_var('forum_type', FORUM_POST), 'type_action' => request_var('type_action', ''), 'forum_status' => request_var('forum_status', ITEM_UNLOCKED), 'forum_parents' => '', 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), 'forum_link' => request_var('forum_link', ''), 'forum_link_track' => request_var('forum_link_track', false), 'forum_desc' => utf8_normalize_nfc(request_var('forum_desc', '', true)), 'forum_desc_uid' => '', 'forum_desc_options' => 7, 'forum_desc_bitfield' => '', 'forum_rules' => utf8_normalize_nfc(request_var('forum_rules', '', true)), 'forum_rules_uid' => '', 'forum_rules_options' => 7, 'forum_rules_bitfield' => '', 'forum_rules_link' => request_var('forum_rules_link', ''), 'forum_image' => request_var('forum_image', ''), 'forum_style' => request_var('forum_style', 0), 'display_subforum_list' => request_var('display_subforum_list', false), 'display_on_index' => request_var('display_on_index', false), 'forum_topics_per_page' => request_var('topics_per_page', 0), 'enable_indexing' => request_var('enable_indexing', true), 'enable_icons' => request_var('enable_icons', false), 'enable_prune' => request_var('enable_prune', false), 'enable_post_review' => request_var('enable_post_review', true), 'enable_quick_reply' => request_var('enable_quick_reply', false), 'prune_days' => request_var('prune_days', 7), 'prune_viewed' => request_var('prune_viewed', 7), 'prune_freq' => request_var('prune_freq', 1), 'prune_old_polls' => request_var('prune_old_polls', false), 'prune_announce' => request_var('prune_announce', false), 'prune_sticky' => request_var('prune_sticky', false), 'forum_password' => request_var('forum_password', '', true), 'forum_password_confirm' => request_var('forum_password_confirm', '', true), 'forum_password_unset' => request_var('forum_password_unset', false));
// On add, add empty forum_options... else do not consider it (not updating it)
if ($action == 'add') {
$forum_data['forum_options'] = 0;
}
// Use link_display_on_index setting if forum type is link
if ($forum_data['forum_type'] == FORUM_LINK) {
$forum_data['display_on_index'] = request_var('link_display_on_index', false);
}
// Linked forums and categories are not able to be locked...
if ($forum_data['forum_type'] == FORUM_LINK || $forum_data['forum_type'] == FORUM_CAT) {
$forum_data['forum_status'] = ITEM_UNLOCKED;
}
$forum_data['show_active'] = $forum_data['forum_type'] == FORUM_POST ? request_var('display_recent', true) : request_var('display_active', false);
// Get data for forum rules if specified...
if ($forum_data['forum_rules']) {
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_parse_bbcode', false), request_var('rules_parse_urls', false), request_var('rules_parse_smilies', false));
}
// Get data for forum description if specified
if ($forum_data['forum_desc']) {
generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_parse_bbcode', false), request_var('desc_parse_urls', false), request_var('desc_parse_smilies', false));
}
$errors = $this->update_forum_data($forum_data);
if (!sizeof($errors)) {
$forum_perm_from = request_var('forum_perm_from', 0);
$cache->destroy('sql', FORUMS_TABLE);
$copied_permissions = false;
// Copy permissions?
if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] && ($action != 'edit' || empty($forum_id) || $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) {
copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], $action == 'edit' ? true : false);
cache_moderators();
$copied_permissions = true;
}
/* Commented out because of questionable UI workflow - re-visit for 3.0.7
else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))
{
$this->copy_permission_page($forum_data);
return;
}
*/
$auth->acl_clear_prefetch();
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'];
$message = $action == 'add' ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED'];
//.........这里部分代码省略.........