Exemplo n.º 1
0
    exit;
}
if ($action == "add") {
    if ($id != "") {
        $pieces = explode("**", $id);
        $id = str_replace("**", ",", $id);
        if ($htaccessAuth == "true") {
            require_once "../includes/htpasswd.class.php";
            $Htpasswd = new Htpasswd();
            $Htpasswd->initialize("../files/" . $projectDetail->pro_id[0] . "/.htpasswd");
            $tmpquery = "WHERE mem.id IN({$id})";
            $listMembers = new request();
            $listMembers->openMembers($tmpquery);
            $comptListMembers = count($listMembers->mem_id);
            for ($i = 0; $i < $comptListMembers; $i++) {
                $Htpasswd->addUser($listMembers->mem_login[$i], $listMembers->mem_password[$i]);
            }
        }
        // if mantis bug tracker enabled
        if ($enableMantis == "true") {
            // include mantis library
            require_once "../mantis/core_API.php";
        }
        $comptTeam = count($pieces);
        for ($i = 0; $i < $comptTeam; $i++) {
            $tmpquery = "INSERT INTO " . $tableCollab["teams"] . "(project, member,published,authorized) VALUES ('" . $projectDetail->pro_id[0] . "','{$pieces[$i]}','1','0')";
            connectSql("{$tmpquery}");
            // if mantis bug tracker enabled
            if ($enableMantis == "true") {
                // Assign user to this project in mantis
                $f_access_level = $client_user_level;
Exemplo n.º 2
0
        if ($htaccessAuth == 'true') {
            $content = <<<STAMP
AuthName "{$setTitle}"
AuthType Basic
Require valid-user
AuthUserFile {$fullPath}/files/{$num}/.htpasswd
STAMP;
            $fp = @fopen('../files/' . $num . '/.htaccess', 'wb+');
            $fw = fwrite($fp, $content);
            $fp = @fopen('../files/' . $num . '/.htpasswd', 'wb+');
            $tmpquery = "WHERE mem.id = '{$pown}'";
            $detailMember = new request();
            $detailMember->openMembers($tmpquery);
            $Htpasswd = new Htpasswd();
            $Htpasswd->initialize('../files/' . $num . '/.htpasswd');
            $Htpasswd->addUser($detailMember->mem_login[0], $detailMember->mem_password[0]);
        }
        // if mantis bug tracker enabled
        if ($enableMantis == 'true') {
            // call mantis function to copy project
            require_once '../mantis/proj_add.php';
        }
        // create phase structure if enable phase was selected as true
        if ($thisPhase != '0') {
            $comptThisPhase = count($phaseArraySets[$thisPhase]);
            for ($i = 0; $i < $comptThisPhase; $i++) {
                $tmpquery = 'INSERT INTO ' . $tableCollab['phases'] . "(project_id,order_num,status,name) VALUES('{$num}','{$i}','0','" . $phaseArraySets[$thisPhase][$i] . "')";
                connectSql($tmpquery);
            }
        }
        header('Location: ../projects/viewproject.php?id=' . $num . '&msg=add');
if ($fh) {
    while (($line = fgets($fh)) !== false) {
        $users[] = explode(":", $line)[0];
    }
    fclose($fh);
}
// Handle requests
if (array_key_exists('action', $_REQUEST)) {
    if ($_REQUEST['action'] == "add-user") {
        $username = trim($_REQUEST['username']);
        $password = trim($_REQUEST['passwd']);
        if ($username && $password) {
            if (!in_array($username, $users)) {
                try {
                    $htpasswd = new Htpasswd($HTPASSWD_FP);
                    $htpasswd->addUser($username, $password, Htpasswd::ENCTYPE_MD5);
                    $messages[] = "User has been added successfully";
                    $users[] = $username;
                } catch (Exception $e) {
                    $errors[] = $e->getMessage();
                }
            } else {
                $errors[] = "User {$username} already exists";
            }
        } else {
            $errors[] = "Username or password not set";
        }
    }
    if ($_REQUEST['action'] == "delete") {
        $username = trim($_REQUEST['username']);
        if ($username) {