function set_userrights($username, $status, $recursion = 1) { if ($this->is_dir() && $recursion == 1) { $this->loadfile(); foreach ($this->filecontents as $file2set) { $file2setobj = new bhfile($file2set['filepath']); $file2setobj->set_userrights($username, $status); } } if ($status >= 0) { $userrows = select_bhdb("aclusers", array("username" => $username, "filepath" => $this->filepath), ""); if (!empty($userrows)) { update_bhdb("aclusers", array("status" => $status), array("username" => $username, "filepath" => $this->filepath)); } else { insert_bhdb("aclusers", array("username" => $username, "filepath" => $this->filepath, "status" => $status)); } } else { delete_bhdb("aclusers", array("username" => $username, "filepath" => $this->filepath)); } }
#iscore 1 # Test for include status if (IN_BH != 1) { header("Location: ../index.php"); die; } # Get the filepath/name $filepath = bh_fpclean($_GET['filepath']); $filename = bh_get_filename($filepath); # Open a file object $fileobj = new bhfile($filepath); # See if we need to respond to an action # Add user if (!empty($_POST['adduser'])) { # Add user to file permissions with inital level 0. $fileobj->set_userrights($_POST['adduser'], 0); bh_log($bhlang['notice:permissions_user_added'], "BH_NOTICE"); } # Delete user if (!empty($_POST['deluser'])) { # Delete user from file db $fileobj->set_userrights($_POST['deluser'], -1); bh_log($bhlang['notice:permissions_user_deleted'], "BH_NOTICE"); } # Add group if (!empty($_POST['addgroup'])) { # Add group to file permissions with inital level 0. $fileobj->set_grouprights($_POST['addgroup'], 0); bh_log($bhlang['notice:permissions_group_added'], "BH_NOTICE"); } # Delete group