當前位置: 首頁>>代碼示例>>PHP>>正文


PHP permissions::get_group方法代碼示例

本文整理匯總了PHP中permissions::get_group方法的典型用法代碼示例。如果您正苦於以下問題:PHP permissions::get_group方法的具體用法?PHP permissions::get_group怎麽用?PHP permissions::get_group使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在permissions的用法示例。


在下文中一共展示了permissions::get_group方法的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>";
 }
開發者ID:BackupTheBerlios,項目名稱:mercuryb-svn,代碼行數:43,代碼來源:forums.php

示例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;
 }
開發者ID:BackupTheBerlios,項目名稱:qsf-svn,代碼行數:35,代碼來源:new_install.php


注:本文中的permissions::get_group方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。