コード例 #1
0
/**
 * Sets the phpBB permissions for a group if they don't have permission to do that already
 * @param int $id phpBB ID
 * @param string $perm phPBB WP-United permission
 */
function wpu_set_phpbb_group_permissions($groupName, $perm, $type = ACL_YES)
{
    global $phpbbForum;
    // Not a valid WP-United permission
    if (!in_array($perm, array_keys(wpu_permissions_list()))) {
        return false;
    }
    $phpbbForum->update_group_permissions('grant', $groupName, $perm, $type);
    return true;
}
コード例 #2
0
function wpu_process_perms()
{
    global $phpbbForum;
    $conns = stripslashes(base64_decode(str_replace(array('%2B', '%3D', '%2F'), array('+', '=', '/'), (string) $_POST['wpusetperms'])));
    $conns = explode(',', $conns);
    $nevers = stripslashes(base64_decode(str_replace(array('%2B', '%3D', '%2F'), array('+', '=', '/'), (string) $_POST['wpusetnevers'])));
    $nevers = explode(',', $nevers);
    $permsList = array_keys(wpu_permissions_list());
    $phpbbForum->clear_group_permissions();
    foreach ($conns as $conn) {
        list($phpbbGroup, $wpuPermName) = explode('=', $conn);
        $wpuPerm = base64_decode(str_replace(array('_pls', '_eq', '_sl'), array('+', '=', '/'), $wpuPermName));
        if (in_array($wpuPerm, $permsList)) {
            wpu_set_phpbb_group_permissions(base64_decode(str_replace(array('_pls', '_eq', '_sl'), array('+', '=', '/'), $phpbbGroup)), $wpuPerm);
        }
    }
    foreach ($nevers as $never) {
        list($phpbbGroup, $wpuPermName) = explode('=', $never);
        $wpuPerm = base64_decode(str_replace(array('_pls', '_eq', '_sl'), array('+', '=', '/'), $wpuPermName));
        if (in_array($wpuPerm, $permsList)) {
            wpu_set_phpbb_group_permissions(base64_decode(str_replace(array('_pls', '_eq', '_sl'), array('+', '=', '/'), $phpbbGroup)), $wpuPerm, ACL_NEVER);
        }
    }
    die('OK');
}
コード例 #3
0
ファイル: phpbb.php プロジェクト: snitchashor/wp-united
 /**
  * Remove all WP-United permissions from phpBB groups
  */
 public function clear_group_permissions()
 {
     global $db;
     $perms = array_keys(wpu_permissions_list());
     $fStateChanged = $this->foreground();
     $sql = 'SELECT group_name FROM ' . GROUPS_TABLE;
     $result = $db->sql_query($sql);
     $groups = array();
     while ($row = $db->sql_fetchrow($result)) {
         $groups[] = $row['group_name'];
     }
     $db->sql_freeresult($result);
     foreach ($groups as $group) {
         $this->update_group_permissions('remove', $group, $perms);
     }
     $this->restore_state($fStateChanged);
 }