本文整理汇总了PHP中permissions::add_z方法的典型用法代码示例。如果您正苦于以下问题:PHP permissions::add_z方法的具体用法?PHP permissions::add_z怎么用?PHP permissions::add_z使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类permissions
的用法示例。
在下文中一共展示了permissions::add_z方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>";
}
示例2: 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;
}