本文整理汇总了PHP中permissions::set_xyz方法的典型用法代码示例。如果您正苦于以下问题:PHP permissions::set_xyz方法的具体用法?PHP permissions::set_xyz怎么用?PHP permissions::set_xyz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类permissions
的用法示例。
在下文中一共展示了permissions::set_xyz方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
$perms_obj = new permissions();
$perms_obj->db =& $this->db;
$perms_obj->pre =& $this->pre;
if (isset($this->get['s']) && $this->get['s'] == 'user') {
if (!isset($this->get['id'])) {
header("Location: {$this->self}?a=member&s=perms");
}
$this->post['group'] = intval($this->get['id']);
$mode = 'user';
$title = 'User Control';
$link = '&s=user&id=' . $this->post['group'];
$perms_obj->get_perms(-1, $this->post['group']);
} else {
if (!isset($this->post['group'])) {
return $this->message('User Groups', "\r\n\t\t\t\t<form action='{$this->self}?a=perms' method='post'>\r\n\t\t\t\t\tEdit permissions for\r\n\t\t\t\t\t<select name='group'>\r\n\t\t\t\t\t" . $this->select_groups(-1) . "\r\n\t\t\t\t\t</select>\r\n\t\t\t\t\t<input type='submit' value='Submit'>\r\n\t\t\t\t</form>");
}
$this->post['group'] = intval($this->post['group']);
$mode = 'group';
$title = 'User Group Control';
$link = null;
$perms_obj->get_perms($this->post['group'], -1);
}
$this->set_title($title);
$this->tree($title);
$forums_only = $this->db->query('SELECT forum_id, forum_name FROM ' . $this->pre . 'forums ORDER BY forum_name');
$forums_list = array();
while ($forum = $this->db->nqfetch($forums_only)) {
$forums_list[] = $forum;
}
$perms = array('board_view' => 'View the board index', 'board_view_closed' => 'Use MercuryBoard when it is closed', 'do_anything' => 'Use MercuryBoard', 'is_admin' => 'Access the admin control panel', 'edit_avatar' => 'Can edit user avatar', 'edit_profile' => 'Can edit user profile', 'email_use' => 'Send emails to members via the board', 'topic_global' => 'Make a topic visible from all forums', 'pm_noflood' => 'Exempt from personal messenger flood control', 'search_noflood' => 'Exempt from search flood control', 'view_invisible_users' => 'View hidden members using the board', 'forum_view' => 'View the forum', 'forum_subscribe' => 'Can subscribe to this forum and all its topics', 'post_viewip' => 'View user IP addresses', 'topic_view' => 'View topics', 'topic_view_unpublished' => 'View Unpublished topics', 'poll_create' => 'Create polls', 'poll_vote' => 'Create votes', 'post_create' => 'Create replies', 'post_counting' => 'Posts contribute to users post count', 'topic_create' => 'Create topics', 'post_noflood' => 'Exempt from post flood control', 'post_delete' => 'Delete any post', 'post_delete_own' => 'Delete only posts the user has created', 'topic_delete' => 'Delete any topic', 'topic_delete_own' => 'Delete only topics the user has created', 'post_edit' => 'Edit any post', 'post_edit_own' => 'Edit only posts the user has created', 'topic_edit' => 'Edit any topic', 'topic_edit_own' => 'Edit only topics the user has created', 'topic_lock' => 'Lock any topic', 'topic_lock_own' => 'Lock topics the user has created', 'topic_unlock' => 'Unlock any topic', 'topic_unlock_mod' => 'Unlock a moderator\'s lock', 'topic_unlock_own' => 'Unlock only topics the user has created', 'topic_pin' => 'Pin any topic', 'topic_pin_own' => 'Pin topics the user has created', 'topic_publish' => 'Publish or unpublish any topic', 'topic_publish_auto' => 'New topics are marked as published', 'topic_rate' => 'Rate topics in this forum', 'topic_split' => 'Split any topic into multiple topics', 'topic_split_own' => 'Split only topics the user has created into multiple topics', 'topic_unpin' => 'Unpin any topic', 'topic_unpin_own' => 'Unpin only topics the user has created', 'topic_move' => 'Move any topic', 'topic_move_own' => 'Move only topics the user has created', 'post_attach' => 'Attach uploads to posts', 'post_attach_download' => 'Download post attachments');
if (!isset($this->post['submit'])) {
$count = count($forums_list) + 1;
if ($mode == 'user') {
$query = $this->db->fetch("SELECT user_name, user_perms FROM {$this->pre}users WHERE user_id={$this->post['group']}");
$label = "User '{$query['user_name']}'";
} else {
$query = $this->db->fetch("SELECT group_name FROM {$this->pre}groups WHERE group_id={$this->post['group']}");
$label = "Group '{$query['group_name']}'";
}
$out = "\r\n\t\t\t<script language='javascript'>\r\n\t\t\t<!--\r\n\t\t\tfunction checkrow(element, check)\r\n\t\t\t{\r\n\t\t\t\tvar elements = document.forms['form'].elements;\r\n\t\t\t\tvar count = elements.length;\r\n\r\n\t\t\t\tfor (var i=0; i<count; i++) {\r\n\t\t\t\t\tvar current = elements[i];\r\n\t\t\t\t\tvar temp = current.name.split('[');\r\n\r\n\t\t\t\t\tif (!temp[1]) continue;\r\n\t\t\t\t\ttemp2 = temp[1].split(']');\r\n\r\n\t\t\t\t\tif (temp2[0] == element) {\r\n\t\t\t\t\t\tcurrent.checked = check;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tfunction changeall(element, check)\r\n\t\t\t{\r\n\t\t\t\tif (!check) {\r\n\t\t\t\t\tcheckallbox(element, false);\r\n\t\t\t\t} else if (areallchecked(element)) {\r\n\t\t\t\t\tcheckallbox(element, true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tfunction checkallbox(element, check)\r\n\t\t\t{\r\n\t\t\t\tvar elements = document.forms['form'].elements;\r\n\t\t\t\tvar count = elements.length;\r\n\r\n\t\t\t\tvar allchecked = true;\r\n\r\n\t\t\t\tfor (var i=0; i<count; i++) {\r\n\t\t\t\t\tvar current = elements[i];\r\n\r\n\t\t\t\t\tif (current.name == ('perms[' + element + '][-1]')) {\r\n\t\t\t\t\t\tcurrent.checked = check;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tfunction areallchecked(element)\r\n\t\t\t{\r\n\t\t\t\tvar elements = document.forms['form'].elements;\r\n\t\t\t\tvar count = elements.length;\r\n\r\n\t\t\t\tvar allchecked = true;\r\n\r\n\t\t\t\tfor (var i=0; i<count; i++) {\r\n\t\t\t\t\tvar current = elements[i];\r\n\r\n\t\t\t\t\tif (current.name == ('perms[' + element + '][-1]')) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar temp = current.name.split('[');\r\n\r\n\t\t\t\t\tif (!temp[1]) continue;\r\n\t\t\t\t\ttemp2 = temp[1].split(']');\r\n\r\n\t\t\t\t\tif (temp2[0] == element) {\r\n\t\t\t\t\t\tif (!current.checked) {\r\n\t\t\t\t\t\t\tallchecked = false;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn allchecked;\r\n\t\t\t}\r\n\t\t\t//-->\r\n\t\t\t</script>\r\n\r\n\t\t\t<form name='form' action='{$this->self}?a=perms{$link}' method='post'>\r\n\t\t\t<center><span style='font-size:14px'><b>Permissions For {$label}</b></span>";
if ($mode == 'user') {
$out .= "<br />This will override the group permissions for this user.<br /><br />\r\n\t\t\t\t<div style='border:1px dashed #ff0000; width:25%; padding:5px'><input type='checkbox' name='usegroup' id='usegroup' style='vertical-align:middle'" . (!$query['user_perms'] ? ' checked' : '') . "> <label for='usegroup' style='vertical-align:middle'>Use only group permissions for this user</label></div>";
}
$out .= "</center><br />" . $this->table . "\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='" . ($count + 1) . "' class='header'>{$label}</td>\r\n\t\t\t</tr>\r\n\r\n\t\t\t<input type='hidden' name='group' value='{$this->post['group']}'>";
$out .= $this->show_headers($forums_list);
$this->iterator_init('tablelight', 'tabledark');
$i = 0;
foreach ($perms as $perm => $label) {
$out .= "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='" . $this->iterate() . "'>{$label}</td>\r\n\t\t\t\t\t<td class='" . $this->lastValue() . "' align='center'>\r\n\t\t\t\t\t\t<input type='checkbox' name='perms[{$perm}][-1]' id='perms_{$perm}' onclick='checkrow(\"{$perm}\", this.checked)'" . ($perms_obj->auth($perm) ? ' checked' : '') . ">All\r\n\t\t\t\t\t</td>";
if (!isset($perms_obj->globals[$perm])) {
foreach ($forums_list as $forum) {
if ($perms_obj->auth($perm, $forum['forum_id'])) {
$checked = ' checked';
} else {
$checked = '';
}
$out .= "\n<td class='" . $this->lastValue() . "' align='center'><input type='checkbox' name='perms[{$perm}][{$forum['forum_id']}]' onclick='changeall(\"{$perm}\", this.checked)'{$checked}></td>";
}
} elseif ($forums_list) {
$out .= "\n<td class='" . $this->lastValue() . "' colspan='{$count}' align='center'>N/A</td>";
}
$out .= "\r\n\t\t\t\t</tr>";
$i++;
if ($i % 12 == 0) {
$out .= $this->show_headers($forums_list);
}
}
return $out . "\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='" . ($count + 1) . "' class='footer' align='center'><input type='submit' name='submit' value='Update Permissions'></td>\r\n\t\t\t</tr>\r\n\t\t\t</form>" . $this->etable;
} else {
if ($mode == 'user' && isset($this->post['usegroup'])) {
$perms_obj->cube = '';
$perms_obj->update();
return $this->message('Permissions', 'The user will inherit the group\'s permissions.');
}
$perms_obj->reset_cube(false);
if (!isset($this->post['perms'])) {
$this->post['perms'] = array();
}
if ($mode == 'user') {
if (!isset($this->post['perms']['do_anything']) && $this->post['group'] == USER_GUEST_UID) {
return $this->message('User Group Control', 'You cannot stop Guests from using MercuryBoard, this would cause your board to become unusable');
}
} else {
if (!isset($this->post['perms']['do_anything']) && $this->post['group'] == USER_GUEST) {
return $this->message('User Group Control', 'You cannot stop the Guest Group from using MercuryBoard, this would cause your board to become unusable');
}
}
foreach ($this->post['perms'] as $name => $data) {
if (isset($data[-1]) || isset($data['-1']) || count($data) == count($forums_list)) {
$perms_obj->set_xy($name, true);
} else {
foreach ($data as $forum => $on) {
$perms_obj->set_xyz($name, intval($forum), true);
}
}
}
$perms_obj->update();
$this->check_subscriptions($mode, $this->post['group']);
//.........这里部分代码省略.........
示例2: execute
function execute()
{
$perms_obj = new permissions();
$perms_obj->db =& $this->db;
$perms_obj->pre =& $this->pre;
if (isset($this->get['s']) && $this->get['s'] == 'user') {
if (!isset($this->get['id'])) {
header("Location: {$this->self}?a=member&s=perms");
}
$this->post['group'] = intval($this->get['id']);
$mode = 'user';
$title = 'User Control';
$link = '&s=user&id=' . $this->post['group'];
$perms_obj->get_perms(-1, $this->post['group']);
} else {
if (!isset($this->post['group'])) {
return $this->message('User Groups', "\n\t\t\t\t<form action='{$this->self}?a=perms' method='post'><div>\n\t\t\t\t\t{$this->lang->perms_edit_for}\n\t\t\t\t\t<select name='group'>\n\t\t\t\t\t" . $this->select_groups(-1) . "\n\t\t\t\t\t</select>\n\t\t\t\t\t<input type='submit' value='{$this->lang->submit}' /></div>\n\t\t\t\t</form>");
}
$this->post['group'] = intval($this->post['group']);
$mode = 'group';
$title = $this->lang->perms_title;
$link = null;
$perms_obj->get_perms($this->post['group'], -1);
}
$this->set_title($title);
$this->tree($title);
$forums_only = $this->db->query('SELECT forum_id, forum_name FROM ' . $this->pre . 'forums ORDER BY forum_name');
$forums_list = array();
while ($forum = $this->db->nqfetch($forums_only)) {
$forums_list[] = $forum;
}
$perms = array('board_view' => $this->lang->perms_board_view, 'board_view_closed' => $this->lang->perms_board_view_closed, 'do_anything' => $this->lang->perms_do_anything, 'is_admin' => $this->lang->perms_is_admin, 'email_use' => $this->lang->perms_email_use, 'topic_global' => $this->lang->perms_topic_global, 'pm_noflood' => $this->lang->perms_pm_noflood, 'search_noflood' => $this->lang->perms_search_noflood, 'forum_view' => $this->lang->perms_forum_view, 'post_viewip' => $this->lang->perms_post_viewip, 'topic_view' => $this->lang->perms_topic_view, 'poll_create' => $this->lang->perms_poll_create, 'poll_vote' => $this->lang->perms_poll_vote, 'post_create' => $this->lang->perms_post_create, 'topic_create' => $this->lang->perms_topic_create, 'post_noflood' => $this->lang->perms_post_noflood, 'post_delete' => $this->lang->perms_post_delete, 'post_delete_own' => $this->lang->perms_post_delete_own, 'topic_delete' => $this->lang->perms_topic_delete, 'topic_delete_own' => $this->lang->perms_topic_delete_own, 'post_edit' => $this->lang->perms_post_edit, 'post_edit_own' => $this->lang->perms_post_edit_own, 'topic_edit' => $this->lang->perms_topic_edit, 'topic_edit_own' => $this->lang->perms_topic_edit_own, 'topic_lock' => $this->lang->perms_topic_lock, 'topic_lock_own' => $this->lang->perms_topic_lock_own, 'topic_unlock' => $this->lang->perms_topic_unlock, 'topic_unlock_mod' => $this->lang->perms_topic_unlock_mod, 'topic_unlock_own' => $this->lang->perms_topic_unlock_own, 'topic_pin' => $this->lang->perms_topic_pin, 'topic_pin_own' => $this->lang->perms_topic_pin_own, 'topic_split' => $this->lang->perms_topic_split, 'topic_split_own' => $this->lang->perms_topic_split_own, 'topic_unpin' => $this->lang->perms_topic_unpin, 'topic_unpin_own' => $this->lang->perms_topic_unpin_own, 'topic_move' => $this->lang->perms_topic_move, 'topic_move_own' => $this->lang->perms_topic_move_own, 'post_attach' => $this->lang->perms_post_attach, 'post_attach_download' => $this->lang->perms_post_attach_download);
if (!isset($this->post['submit'])) {
$count = count($forums_list) + 1;
if ($mode == 'user') {
$query = $this->db->fetch("SELECT user_name, user_perms FROM {$this->pre}users WHERE user_id={$this->post['group']}");
$label = "User '{$query['user_name']}'";
} else {
$query = $this->db->fetch("SELECT group_name FROM {$this->pre}groups WHERE group_id={$this->post['group']}");
$label = "Group '{$query['group_name']}'";
}
$out = "\n\t\t\t<script type='text/javascript'>\n\t\t\t<!--\n\t\t\tfunction checkrow(element, check)\n\t\t\t{\n\t\t\t\tvar elements = document.forms['form'].elements;\n\t\t\t\tvar count = elements.length;\n\n\t\t\t\tfor (var i=0; i<count; i++) {\n\t\t\t\t\tvar current = elements[i];\n\t\t\t\t\tvar temp = current.name.split('[');\n\n\t\t\t\t\tif (!temp[1]) continue;\n\t\t\t\t\ttemp2 = temp[1].split(']');\n\n\t\t\t\t\tif (temp2[0] == element) {\n\t\t\t\t\t\tcurrent.checked = check;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction changeall(element, check)\n\t\t\t{\n\t\t\t\tif (!check) {\n\t\t\t\t\tcheckallbox(element, false);\n\t\t\t\t} else if (areallchecked(element)) {\n\t\t\t\t\tcheckallbox(element, true);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction checkallbox(element, check)\n\t\t\t{\n\t\t\t\tvar elements = document.forms['form'].elements;\n\t\t\t\tvar count = elements.length;\n\n\t\t\t\tvar allchecked = true;\n\n\t\t\t\tfor (var i=0; i<count; i++) {\n\t\t\t\t\tvar current = elements[i];\n\n\t\t\t\t\tif (current.name == ('perms[' + element + '][-1]')) {\n\t\t\t\t\t\tcurrent.checked = check;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction areallchecked(element)\n\t\t\t{\n\t\t\t\tvar elements = document.forms['form'].elements;\n\t\t\t\tvar count = elements.length;\n\n\t\t\t\tvar allchecked = true;\n\n\t\t\t\tfor (var i=0; i<count; i++) {\n\t\t\t\t\tvar current = elements[i];\n\n\t\t\t\t\tif (current.name == ('perms[' + element + '][-1]')) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar temp = current.name.split('[');\n\n\t\t\t\t\tif (!temp[1]) continue;\n\t\t\t\t\ttemp2 = temp[1].split(']');\n\n\t\t\t\t\tif (temp2[0] == element) {\n\t\t\t\t\t\tif (!current.checked) {\n\t\t\t\t\t\t\tallchecked = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn allchecked;\n\t\t\t}\n\t\t\t//-->\n\t\t\t</script>\n\n\t\t\t<form id='form' action='{$this->self}?a=perms{$link}' method='post'>\n\t\t\t<div align='center'><span style='font-size:14px;'><b>Permissions For {$label}</b></span>";
if ($mode == 'user') {
$out .= "<br />{$this->lang->perms_override_user}<br /><br />\n\t\t\t\t<div style='border:1px dashed #ff0000; width:25%; padding:5px'><input type='checkbox' name='usegroup' id='usegroup' style='vertical-align:middle'" . (!$query['user_perms'] ? ' checked' : '') . " /> <label for='usegroup' style='vertical-align:middle'>{$this->lang->perms_only_user}</label></div>";
}
$out .= "</div>" . $this->table . "\n\t\t\t<tr>\n\t\t\t\t<td colspan='" . ($count + 1) . "' class='header'>{$label}</td>\n\t\t\t</tr>";
$out .= $this->show_headers($forums_list);
$this->iterator_init('tablelight', 'tabledark');
$i = 0;
foreach ($perms as $perm => $label) {
$out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='" . $this->iterate() . "'>{$label}</td>\n\t\t\t\t\t<td class='" . $this->lastValue() . "' align='center'>\n\t\t\t\t\t\t<input type='checkbox' name='perms[{$perm}][-1]' id='perms_{$perm}' onclick='checkrow(\"{$perm}\", this.checked)'" . ($perms_obj->auth($perm) ? ' checked=\'checked\'' : '') . " />All\n\t\t\t\t\t</td>";
if (!isset($perms_obj->globals[$perm])) {
foreach ($forums_list as $forum) {
if ($perms_obj->auth($perm, $forum['forum_id'])) {
$checked = " checked='checked'";
} else {
$checked = '';
}
$out .= "\n<td class='" . $this->lastValue() . "' align='center'><input type='checkbox' name='perms[{$perm}][{$forum['forum_id']}]' onclick='changeall(\"{$perm}\", this.checked)'{$checked} /></td>";
}
} elseif ($forums_list) {
$out .= "\n<td class='" . $this->lastValue() . "' colspan='{$count}' align='center'>N/A</td>";
}
$out .= "\n\t\t\t\t</tr>";
$i++;
if ($i % 12 == 0) {
$out .= $this->show_headers($forums_list);
}
}
return $out . "\n\t\t\t<tr>\n\t\t\t\t<td colspan='" . ($count + 1) . "' class='footer' align='center'><input type='hidden' name='group' value='{$this->post['group']}' /><input type='submit' name='submit' value='Update Permissions' /></td>\n\t\t\t</tr>" . $this->etable . "</form>";
} else {
if ($mode == 'user' && isset($this->post['usegroup'])) {
$perms_obj->cube = '';
$perms_obj->update();
return $this->message($this->lang->perms, $this->lang->perms_user_inherit);
}
$perms_obj->reset_cube(false);
if (!isset($this->post['perms'])) {
$this->post['perms'] = array();
}
foreach ($this->post['perms'] as $name => $data) {
if (isset($data[-1]) || isset($data['-1']) || count($data) == count($forums_list)) {
$perms_obj->set_xy($name, true);
} else {
foreach ($data as $forum => $on) {
$perms_obj->set_xyz($name, intval($forum), true);
}
}
}
$perms_obj->update();
return $this->message($this->lang->perms, $this->lang->perms_updated);
}
}
示例3: AddForum
/**
* Adds a forum with parameters from $this->post
*
* @author Mark Elliot <mark.elliot@mercuryboard.com>
* @since Beta 2.1
* @return string Completion message
**/
function AddForum()
{
if (trim($this->post['name']) == '') {
return "The forum name is empty. (Please press back and enter a name)";
}
$forums = $this->forum_grab();
$forums_arr = $this->forum_array($forums, $this->post['parent']);
$position = $forums_arr ? count($forums_arr) : 0;
$this->db->query("INSERT INTO {$this->pre}forums\r\n\t\t(forum_tree, forum_parent, forum_name, forum_description, forum_position) VALUES\r\n\t\t('" . $this->CreateTree($forums, $this->post['parent']) . "', '{$this->post['parent']}', '{$this->post['name']}', '{$this->post['description']}', '{$position}')");
$id = $this->db->insert_id();
$perms = new permissions();
$perms->db =& $this->db;
$perms->pre =& $this->pre;
while ($perms->get_group()) {
// Full permissions (note: the banned group is still false)
if ($this->post['sync'] == -2) {
$perms->add_z($id, $perms->group != USER_BANNED);
// Default permissions (only works if there are no forums already created)
} elseif ($this->post['sync'] == -3) {
$perms->add_z($id);
// No permissions
} elseif ($this->post['sync'] == -1) {
$perms->add_z($id, false);
// Copy another forum
} else {
$perms->add_z($id, false);
foreach ($perms->standard as $perm => $false) {
if (!isset($perms->globals[$perm])) {
$perms->set_xyz($perm, $id, $perms->auth($perm, $this->post['sync']));
}
}
}
$perms->update();
}
return "Forum added!<br/><br/><a href='{$this->self}'>Continue</a>";
}
示例4: permissions
/**
* Creates a category or forum
*
* @param string $name Name of the forum
* @param string $desc Description of the forum
* @param int $parent Parent id of the forum (0 if a category)
* @author Geoffrey Dunn <geoff@warmage.com>
* @since 1.1.9
* @return int id of the forum created
**/
function create_forum($name, $desc, $parent)
{
$parent ? $tree = $parent : ($tree = '');
$this->db->query("INSERT INTO {$this->pre}forums\n\t\t\t(forum_tree, forum_parent, forum_name, forum_description, forum_position, forum_subcat) VALUES\n\t\t\t('{$tree}', '{$parent}', '{$name}', '{$desc}', '0', '0')");
$forumId = $this->db->insert_id();
$perms = new permissions();
$perms->db =& $this->db;
$perms->pre =& $this->pre;
while ($perms->get_group()) {
if (!$parent) {
// Default permissions
$perms->add_z($forumId);
} else {
// Copy permissions
$perms->add_z($forumId, false);
foreach ($perms->standard as $perm => $false) {
if (!isset($perms->globals[$perm])) {
$perms->set_xyz($perm, $forumId, $perms->auth($perm, $parent));
}
}
}
$perms->update();
}
return $forumId;
}