示例#1
0
文件: new_group.php 项目: rogerp91/OC
<?php

$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * Check if post names are set
 */
$post_check = Post::Check(array("title", "users", "banned", "history"));
/**
 * If post names are all set, try to insert the group
 */
if ($post_check) {
    $new_user = new UsersAndGroups();
    $result = $new_user->NewGroup($_POST['title'], array($_POST['users'], $_POST['banned'], $_POST['history']));
    /*
     * If result is not true, output the error variable
     */
    if (!$result) {
        $error = $new_user->error;
    }
}
/**
 * Include view template file
 */
include 'views/template/new_group.html';
示例#2
0
<?php

$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * List grous and users and pass the arrays to view template
 */
$groups = UsersAndGroups::ListGroups();
$users = UsersAndGroups::ListUsers();
include 'views/template/users_and_groups.html';
示例#3
0
文件: groupedit.php 项目: rogerp91/OC
<?php

$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * Check if $_GET['id] is set and is greater than 0
 */
$id_check = Post::GCheck(array('id'));
/*
 * If id is ok and we are not editing administrators group proceed with operation
 */
if ($id_check && $_GET['id'] != 1) {
    $id = $_GET['id'];
    $post_check = Post::Check(array("title", "users", "banned", "history"));
    if ($post_check) {
        $edit = new UsersAndGroups();
        $result = $edit->GroupEditor($_POST['title'], $id, array($_POST['users'], $_POST['banned'], $_POST['history']));
        if (!$result) {
            $error = $edit->error;
        }
    }
    $group = UsersAndGroups::GetGroup($id);
    include 'views/template/groupedit.html';
} else {
    /*
     * End with message
     */
    Exceptions::PrintOut("You cannot edit the Administrators group");
}
示例#4
0
 * Check if $_GET variables for id are set
 */
if (isset($_GET['id']) && !empty($_GET['id'])) {
    /**
     * If variable id equals 1. stop the execution and print out error.
     * We cannot delete the administrator group. It is a superuser group and must
     * remain safe at all times.
     */
    if ($_GET['id'] == 1) {
        /**
         * Print out the error
         */
        Exceptions::PrintOut("You cannot delete the Administrator Group");
    } else {
        /**
         * If id is not equal to 1, continue to group delete function
         */
        $delete = UsersAndGroups::GroupDelete($_GET['id']);
    }
    /**
     * If delete is successful, retun the user to back page
     */
    if ($delete) {
        header("Location: index.php?page=users_and_groups");
    } else {
        /**
         * If the group delete failed for some reason, output this as an error
         */
        Exceptions::PrintOut("There is a problem with deleting your group. Either no id has been passed or id does not exists in database");
    }
}
示例#5
0
文件: useredit.php 项目: rogerp91/OC
$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * Check if $_GET['id] is set and is greater than 0
 */
$id_check = Post::GCheck(array('id'));
/*
 * If id is ok and we are not editing administrators group proceed with operation
 */
if ($id_check) {
    $id = $_GET['id'];
    $post_check = Post::Check(array("username", "group"));
    if ($post_check) {
        $edit = new UsersAndGroups();
        $result = $edit->UserEditor($id, $_POST['password'], $_POST['password2'], $_POST['group']);
        if (!$result) {
            $error = $edit->error;
        }
    }
    $user = UsersAndGroups::GetUser($id);
    /**
     * List groups to select element
     */
    $groups = UsersAndGroups::ListGroups();
    include 'views/template/useredit.html';
} else {
    /*
     * End with message
     */
示例#6
0
文件: new_user.php 项目: rogerp91/OC
<?php

$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
    Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
 * Check if post names are set
 */
$post_check = Post::Check(array("username", "password", "password2", "group"));
/**
 * If post names are all set, try to insert the user
 */
if ($post_check) {
    $new_user = new UsersAndGroups();
    $result = $new_user->NewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['group']);
    /*
     * If result is not true, output the error variable
     */
    if (!$result) {
        $error = $new_user->error;
    }
}
/**
 * List groups to select element
 */
$groups = UsersAndGroups::ListGroups();
/**
 * Include view template file
 */
include 'views/template/new_user.html';