Initial commit
[clearscm.git] / cc / msl / private / mknusers.php
1 <!--
2 File:           mknusers.php,v
3 Revision:       1.1.1.1
4
5 Description:    Add a user to the exclusion list (-nusers). 
6
7 Author:         Andrew@DeFaria.com
8 Created:        Fri Jul 14 09:44:04 PDT 2006
9 Modified:       2007/05/17 07:45:48
10 Language:       PHP
11
12 (c) Copyright 2006, Andrew@DeFaria.com, all rights reserved.
13 -->
14
15 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
16    "http://www.w3.org/TR/html4/strict.dtd">
17 <html>
18 <head>
19   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
20   <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
21   <link rel="stylesheet" type="text/css" href="/css/default.css">
22 <?php
23 include_once ("../streams.php");
24 $version = "1.0";
25
26 # "Command line" parameters...
27 if (!empty ($_GET ["stream"])) {
28   $stream = $_GET ["stream"];
29 } // if 
30 if (!empty ($_GET ["user"])) {
31   $user = $_GET ["user"];
32 } // if 
33
34 if (!empty ($stream)) {
35   if (!empty ($user)) {
36     $heading = "Opening up $stream for $user";
37   } else {
38     $heading = "Opening up $stream for &lt;unknown&gt;";
39   } // if
40 } else {
41   $heading = "Opening up &lt;unknown&gt; for $user";
42 } // if
43 ?>
44   <title><?php echo $heading?></title>
45 </head>
46
47 <center><h1><?php echo $heading?></h1></center>
48
49 <?php
50 // Santity check
51 if (empty ($stream)) {
52   error ("Stream parameter not supplied");
53 } // if
54
55 if (empty ($user)) {
56   error ("User parameter not supplied");
57 } // if
58
59 $usernames = get_usernames ();
60
61 foreach ($usernames as $key => $value) {
62   if ($user == $value) {
63     $user = $key;
64     break;
65   } // if
66 } // foreach 
67
68 $nusers = get_nusers ($stream);
69
70 if (count ($nusers) == 0) {
71   $nusers [0] = $user;
72   $status = chnusers ($stream, $nusers);
73
74   if ($status == 0) {
75     print "$user is now allowed to access $stream";
76   } else {
77     print "<font color=red><b>ERROR:</b></font> Unable to add $user to nuser list of $stream";
78   } // if
79 } elseif (is_member ($user, $nusers)) {
80   print "<font color=red><b>ERROR:</b></font> $user is already allowed access to $stream<br>";
81 } else {
82   array_push ($nusers, $user);
83   $status = chnusers ($stream, $nusers);
84
85   if ($status == 0) {
86     print "$user is now allowed to access $stream";
87   } else {
88     print "<font color=red><b>ERROR:</b></font> Unable to add $user to nuser list of $stream";
89   } // if
90 } // if
91 ?>
92
93 <center>
94 <p><small><a href="/nusers_stream/lsnusers.php?stream=<?=$stream?>">Manage Stream Locks for <?=$stream?></a></small></p>
95 <?php copyright (null ,$version);?>
96 </center>
97 </body>
98 </html>