Projet

Général

Profil

« Précédent | Suivant » 

Révision 4c291f4c

Ajouté par Renato Botelho il y a plus de 9 ans

Fix indent and whitespaces

Voir les différences:

usr/local/www/system_groupmanager.php
1
<?php 
1
<?php
2 2
/*
3
	$Id: system_groupmanager.php 
3
	$Id: system_groupmanager.php
4 4
	part of m0n0wall (http://m0n0.ch/wall)
5 5

  
6 6
	Copyright (C) 2008 Shrew Soft Inc.
7
	All rights reserved. 
7
	All rights reserved.
8 8

  
9 9
	Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
10
	All rights reserved. 
10
	All rights reserved.
11 11

  
12 12
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
13 13
	All rights reserved.
14
	
14

  
15 15
	Redistribution and use in source and binary forms, with or without
16 16
	modification, are permitted provided that the following conditions are met:
17
	
17

  
18 18
	1. Redistributions of source code must retain the above copyright notice,
19 19
	   this list of conditions and the following disclaimer.
20
	
20

  
21 21
	2. Redistributions in binary form must reproduce the above copyright
22 22
	   notice, this list of conditions and the following disclaimer in the
23 23
	   documentation and/or other materials provided with the distribution.
24
	
24

  
25 25
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
26 26
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27 27
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
......
117 117
	/* input validation */
118 118
	$reqdfields = explode(" ", "groupname");
119 119
	$reqdfieldsn = array(gettext("Group Name"));
120
	
120

  
121 121
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
122
	
122

  
123 123
	if (preg_match("/[^a-zA-Z0-9\.\-_ ]/", $_POST['groupname']))
124 124
		$input_errors[] = gettext("The group name contains invalid characters.");
125
	
125

  
126 126
	if (strlen($_POST['groupname']) > 16)
127 127
		$input_errors[] = gettext("The group name is longer than 16 characters.");
128
	
128

  
129 129
	if (!$input_errors && !(isset($id) && $a_group[$id])) {
130 130
		/* make sure there are no dupes */
131 131
		foreach ($a_group as $group) {
......
135 135
			}
136 136
		}
137 137
	}
138
	
138

  
139 139
	if (!$input_errors) {
140 140
		$group = array();
141 141
		if (isset($id) && $a_group[$id])
142 142
			$group = $a_group[$id];
143
		
143

  
144 144
		$group['name'] = $_POST['groupname'];
145 145
		$group['description'] = $_POST['description'];
146 146

  
......
170 170
		}
171 171

  
172 172
		write_config();
173
		
173

  
174 174
		header("Location: system_groupmanager.php");
175 175
		exit;
176 176
	}
......
248 248
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="group manager">
249 249
	<tr>
250 250
		<td>
251
			<?php 
252
				$tab_array = array();
253
				$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
254
				$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
255
				$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
256
				$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
257
				display_top_tabs($tab_array);
258
			?>
251
<?php
252
			$tab_array = array();
253
			$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
254
			$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
255
			$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
256
			$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
257
			display_top_tabs($tab_array);
258
?>
259 259
		</td>
260
	</tr>    
260
	</tr>
261 261
	<tr>
262 262
		<td id="mainarea">
263 263
			<div class="tabcont">
264 264

  
265
				<?php if($_GET['act']=="new" || $_GET['act']=="edit"): ?>
266

  
265
<?php
266
			if($_GET['act']=="new" || $_GET['act']=="edit"):
267
?>
267 268
				<form action="system_groupmanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
268 269
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
269
	                    <?php
270
	                        $ro = "";
271
	                        if ($pconfig['gtype'] == "system")
272
	                            $ro = "readonly=\"readonly\"";
273
	                    ?>
270
<?php
271
						$ro = "";
272
						if ($pconfig['gtype'] == "system")
273
							$ro = "readonly=\"readonly\"";
274
?>
274 275
						<tr>
275 276
							<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
276 277
							<td width="78%" class="vtable">
......
278 279
								<input name="gtype" type="hidden" value="<?=htmlspecialchars($pconfig['gtype'])?>"/>
279 280
							</td>
280 281
						</tr>
281
						<tr> 
282
						<tr>
282 283
							<td width="22%" valign="top" class="vncellreq"><?=gettext("Group name");?></td>
283
							<td width="78%" class="vtable"> 
284
							<td width="78%" class="vtable">
284 285
								<input name="groupname" type="text" class="formfld group" id="groupname" size="20" maxlength="16" value="<?=htmlspecialchars($pconfig['name']);?>" <?=$ro;?> />
285 286
							</td>
286 287
						</tr>
287
						<tr> 
288
						<tr>
288 289
							<td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
289
							<td width="78%" class="vtable"> 
290
							<td width="78%" class="vtable">
290 291
								<input name="description" type="text" class="formfld unknown" id="description" size="20" value="<?=htmlspecialchars($pconfig['description']);?>" />
291 292
								<br />
292 293
								<?=gettext("Group description, for your own information only");?>
293 294
							</td>
294 295
						</tr>
295

  
296
						<?php if ($pconfig['gid'] != 1998): // all users group ?>
297

  
296
<?php
297
					if ($pconfig['gid'] != 1998): // all users group
298
?>
298 299
						<tr>
299 300
							<td width="22%" valign="top" class="vncell"><?=gettext("Group Memberships");?></td>
300 301
							<td width="78%" class="vtable" align="center">
......
304 305
											<strong><?=gettext("Not Members");?></strong><br />
305 306
											<br />
306 307
												<select size="10" style="width: 75%" name="notmembers[]" class="formselect" id="notmembers" onchange="clear_selected('members')" multiple="multiple">
307
												<?php
308
													$rowIndex = 0;
309
													foreach ($config['system']['user'] as $user):
310
														if (is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members']))
311
															continue;
312
														$rowIndex++;
313
												?>
308
<?php
309
											$rowIndex = 0;
310
											foreach ($config['system']['user'] as $user):
311
												if (is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members']))
312
													continue;
313
												$rowIndex++;
314
?>
314 315
												<option value="<?=$user['uid'];?>" <?=$selected;?>>
315 316
													<?=htmlspecialchars($user['name']);?>
316 317
												</option>
317
												<?php endforeach;
318
												if ($rowIndex == 0)
319
													echo "<option></option>";
320
												?>
318
<?php
319
											endforeach;
320
											if ($rowIndex == 0)
321
												echo "<option></option>";
322
?>
321 323
											</select>
322 324
											<br />
323 325
										</td>
......
335 337
											<strong><?=gettext("Members");?></strong><br />
336 338
											<br />
337 339
											<select size="10" style="width: 75%" name="members[]" class="formselect" id="members" onchange="clear_selected('notmembers')" multiple="multiple">
338
												<?php
339
													$rowIndex = 0;
340
													foreach ($config['system']['user'] as $user):
341
														if (!(is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members'])))
342
															continue;
343
														$rowIndex++;
344
												?>
340
<?php
341
											$rowIndex = 0;
342
											foreach ($config['system']['user'] as $user):
343
												if (!(is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members'])))
344
													continue;
345
												$rowIndex++;
346
?>
345 347
												<option value="<?=$user['uid'];?>">
346 348
													<?=htmlspecialchars($user['name']);?>
347 349
												</option>
348
												<?php endforeach;
349
												if ($rowIndex == 0)
350
													echo "<option></option>";
351
												?>
350
<?php
351
											endforeach;
352
											if ($rowIndex == 0)
353
												echo "<option></option>";
354
?>
352 355
											</select>
353 356
											<br />
354 357
										</td>
......
357 360
								<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
358 361
							</td>
359 362
						</tr>
360

  
361
						<?php endif; ?>
362
						<?php if($_GET['act'] != "new"): ?>
363
						
363
<?php
364
					endif;
365
					if($_GET['act'] != "new"):
366
?>
364 367
						<tr>
365 368
							<td width="22%" valign="top" class="vncell"><?=gettext("Assigned Privileges");?></td>
366 369
							<td width="78%" class="vtable">
......
370 373
										<td width="60%" class="listhdrr"><?=gettext("Description");?></td>
371 374
										<td class="list"></td>
372 375
									</tr>
373
									<?php
374
										if(is_array($pconfig['priv'])):
375
											$i = 0;
376
											foreach ($pconfig['priv'] as $priv):
377
									?>
376
<?php
377
							if(is_array($pconfig['priv'])):
378
								$i = 0;
379
								foreach ($pconfig['priv'] as $priv):
380
?>
378 381
									<tr>
379 382
										<td class="listr">
380 383
											<?=htmlspecialchars($priv_list[$priv]['name']);?>
......
388 391
											</a>
389 392
										</td>
390 393
									</tr>
391
									<?php
392
											$i++;
393
	                      					endforeach;
394
										endif;
395
									?>
394
<?php
395
									$i++;
396
								endforeach;
397
							endif;
398
?>
396 399
									<tr>
397 400
										<td class="list" colspan="2"></td>
398 401
										<td class="list">
......
406 409
								</table>
407 410
							</td>
408 411
						</tr>
409
						<?php endif; ?>
410
						<tr> 
412
<?php
413
					endif;
414
?>
415
						<tr>
411 416
							<td width="22%" valign="top">&nbsp;</td>
412
							<td width="78%"> 
417
							<td width="78%">
413 418
								<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
414 419
								<?php if (isset($id) && $a_group[$id]): ?>
415 420
								<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
......
419 424
						</tr>
420 425
					</table>
421 426
				</form>
422

  
423
				<?php else: ?>
424

  
427
<?php
428
			else:
429
?>
425 430
				<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
426 431
					<thead>
427 432
						<tr>
......
432 437
						</tr>
433 438
					</thead>
434 439
					<tfoot>
435
						<tr> 
440
						<tr>
436 441
							<td class="list" colspan="3"></td>
437 442
							<td class="list">
438 443
								<a href="system_groupmanager.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add group");?>" width="17" height="17" border="0" alt="add" />
......
442 447
						<tr>
443 448
							<td colspan="3">
444 449
								<p>
445
									<?=gettext("Additional webConfigurator groups can be added here. 
450
									<?=gettext("Additional webConfigurator groups can be added here.
446 451
									Group permissions can be assigned which are inherited by users who are members of the group.
447 452
									An icon that appears grey indicates that it is a system defined object.
448 453
									Some system object properties can be modified but they cannot be deleted.");?>
......
451 456
						</tr>
452 457
					</tfoot>
453 458
					<tbody>
454
						<?php
455
							$i = 0;
456
							foreach($a_group as $group):
457

  
458
								if($group['scope'] == "system")
459
									$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png";
460
								else
461
									$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png";
462
								$groupcount = count($group['member']);
463
								if ($group["name"] == "all")
464
									$groupcount = count($config['system']['user']);
465
						?>
459
<?php
460
					$i = 0;
461
					foreach($a_group as $group):
462
						if($group['scope'] == "system")
463
							$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png";
464
						else
465
							$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png";
466
						$groupcount = count($group['member']);
467
						if ($group["name"] == "all")
468
							$groupcount = count($config['system']['user']);
469
?>
466 470
						<tr ondblclick="document.location='system_groupmanager.php?act=edit&amp;id=<?=$i;?>'">
467 471
							<td class="listlr">
468 472
								<table border="0" cellpadding="0" cellspacing="0" summary="">
......
487 491
									<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit group");?>" width="17" height="17" border="0" alt="edit" />
488 492
								</a>
489 493
								&nbsp;
490
								<?php if($group['scope'] != "system"): ?>
494
<?php
495
							if($group['scope'] != "system"):
496
?>
491 497
								<a href="system_groupmanager.php?act=delgroup&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this group?"); ?>')">
492 498
									<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete group"); ?>" width="17" height="17" border="0" alt="delete" />
493 499
								</a>
494
								<?php endif; ?>
500
<?php
501
							endif;
502
?>
495 503
							</td>
496 504
						</tr>
497
						<?php
498
							$i++;
499
							endforeach;
500
						?>
505
<?php
506
						$i++;
507
					endforeach;
508
?>
501 509
					</tbody>
502 510
				</table>
503
			
504
				<?php endif; ?>
505

  
506
			</div>     
511
<?php
512
			endif;
513
?>
514
			</div>
507 515
		</td>
508 516
	</tr>
509 517
</table>
usr/local/www/system_usermanager.php
1 1
<?php
2 2
/* $Id$ */
3 3
/*
4
    system_usermanager.php
5
    part of m0n0wall (http://m0n0.ch/wall)
6

  
7
    Copyright (C) 2008 Shrew Soft Inc.
8
    All rights reserved.
9

  
10
    Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
11
    All rights reserved.
12

  
13
    Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
14
    All rights reserved.
15

  
16
    Redistribution and use in source and binary forms, with or without
17
    modification, are permitted provided that the following conditions are met:
18

  
19
    1. Redistributions of source code must retain the above copyright notice,
20
       this list of conditions and the following disclaimer.
21

  
22
    2. Redistributions in binary form must reproduce the above copyright
23
       notice, this list of conditions and the following disclaimer in the
24
       documentation and/or other materials provided with the distribution.
25

  
26
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
27
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
28
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
    POSSIBILITY OF SUCH DAMAGE.
4
	system_usermanager.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

  
7
	Copyright (C) 2008 Shrew Soft Inc.
8
	All rights reserved.
9

  
10
	Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
11
	All rights reserved.
12

  
13
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
14
	All rights reserved.
15

  
16
	Redistribution and use in source and binary forms, with or without
17
	modification, are permitted provided that the following conditions are met:
18

  
19
	1. Redistributions of source code must retain the above copyright notice,
20
	   this list of conditions and the following disclaimer.
21

  
22
	2. Redistributions in binary form must reproduce the above copyright
23
	   notice, this list of conditions and the following disclaimer in the
24
	   documentation and/or other materials provided with the distribution.
25

  
26
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
27
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
28
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
	POSSIBILITY OF SUCH DAMAGE.
36 36
*/
37 37
/*
38 38
	pfSense_BUILDER_BINARIES:
......
252 252

  
253 253
	if (!empty($_POST['name'])) {
254 254
		$ca = lookup_ca($_POST['caref']);
255
       		if (!$ca)
256
               		$input_errors[] = gettext("Invalid internal Certificate Authority") . "\n";
255
		if (!$ca)
256
			$input_errors[] = gettext("Invalid internal Certificate Authority") . "\n";
257 257
	}
258 258

  
259 259
	/* if this is an AJAX caller then handle via JSON */
......
297 297
			if (!empty($_POST['name'])) {
298 298
				$cert = array();
299 299
				$cert['refid'] = uniqid();
300
                       		$userent['cert'] = array();
300
				$userent['cert'] = array();
301 301

  
302 302
				$cert['descr'] = $_POST['name'];
303 303

  
304
               			$subject = cert_get_subject_array($ca['crt']);
304
				$subject = cert_get_subject_array($ca['crt']);
305 305

  
306
               			$dn = array(
307
                       			'countryName' => $subject[0]['v'],
308
                       			'stateOrProvinceName' => $subject[1]['v'],
309
                       			'localityName' => $subject[2]['v'],
310
                       			'organizationName' => $subject[3]['v'],
311
                       			'emailAddress' => $subject[4]['v'],
312
                       			'commonName' => $userent['name']);
306
				$dn = array(
307
					'countryName' => $subject[0]['v'],
308
					'stateOrProvinceName' => $subject[1]['v'],
309
					'localityName' => $subject[2]['v'],
310
					'organizationName' => $subject[3]['v'],
311
					'emailAddress' => $subject[4]['v'],
312
					'commonName' => $userent['name']);
313 313

  
314 314
				cert_create($cert, $_POST['caref'], $_POST['keylen'],
315 315
					(int)$_POST['lifetime'], $dn);
......
431 431
}
432 432

  
433 433
function sshkeyClicked(obj) {
434
        if (obj.checked) {
435
                document.getElementById("sshkeychck").style.display="none";
436
                document.getElementById("sshkey").style.display="";
437
        } else {
438
                document.getElementById("sshkey").style.display="none";
439
                document.getElementById("sshkeychck").style.display="";
440
        }
434
	if (obj.checked) {
435
		document.getElementById("sshkeychck").style.display="none";
436
		document.getElementById("sshkey").style.display="";
437
	} else {
438
		document.getElementById("sshkey").style.display="none";
439
		document.getElementById("sshkeychck").style.display="";
440
	}
441 441
}
442 442
//]]>
443 443
</script>
......
450 450
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="user manager">
451 451
	<tr>
452 452
		<td>
453
		<?php
453
<?php
454 454
			$tab_array = array();
455 455
			$tab_array[] = array(gettext("Users"), true, "system_usermanager.php");
456 456
			$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
457 457
			$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
458 458
			$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
459 459
			display_top_tabs($tab_array);
460
		?>
460
?>
461 461
		</td>
462 462
	</tr>
463 463
	<tr>
464 464
		<td id="mainarea">
465 465
			<div class="tabcont">
466

  
467
				<?php if ($_GET['act'] == "new" || $_GET['act'] == "edit" || $input_errors): ?>
468

  
466
<?php
467
			if ($_GET['act'] == "new" || $_GET['act'] == "edit" || $input_errors):
468
?>
469 469
				<form action="system_usermanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
470 470
					<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
471
						<?php
472
							$ro = "";
473
							if ($pconfig['utype'] == "system")
474
								$ro = "readonly=\"readonly\"";
475
						?>
476
	                    <tr>
477
	                        <td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
478
	                        <td width="78%" class="vtable">
479
	                            <strong><?=strtoupper(htmlspecialchars($pconfig['utype']));?></strong>
471
<?php
472
						$ro = "";
473
						if ($pconfig['utype'] == "system")
474
							$ro = "readonly=\"readonly\"";
475
?>
476
						<tr>
477
							<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
478
							<td width="78%" class="vtable">
479
								<strong><?=strtoupper(htmlspecialchars($pconfig['utype']));?></strong>
480 480
								<input name="utype" type="hidden" value="<?=htmlspecialchars($pconfig['utype'])?>" />
481
	                        </td>
482
	                    </tr>
481
							</td>
482
						</tr>
483 483
						<tr>
484 484
							<td width="22%" valign="top" class="vncell"><?=gettext("Disabled");?></td>
485 485
							<td width="78%" class="vtable">
......
528 528
											<strong><?=gettext("Not Member Of"); ?></strong><br />
529 529
											<br />
530 530
											<select size="10" style="width: 75%" name="notgroups[]" class="formselect" id="notgroups" onchange="clear_selected('groups')" multiple="multiple">
531
												<?php
532
													$rowIndex = 0;
533
													foreach ($config['system']['group'] as $group):
534
														if ($group['gid'] == 1998) /* all users group */
535
															continue;
536
														if (is_array($pconfig['groups']) && in_array($group['name'],$pconfig['groups']))
537
															continue;
538
														$rowIndex++;
539
												?>
531
<?php
532
												$rowIndex = 0;
533
												foreach ($config['system']['group'] as $group):
534
													if ($group['gid'] == 1998) /* all users group */
535
														continue;
536
													if (is_array($pconfig['groups']) && in_array($group['name'],$pconfig['groups']))
537
														continue;
538
													$rowIndex++;
539
?>
540 540
												<option value="<?=$group['name'];?>" <?=$selected;?>>
541 541
													<?=htmlspecialchars($group['name']);?>
542 542
												</option>
543
												<?php endforeach;
543
<?php
544
												endforeach;
544 545
												if ($rowIndex == 0)
545 546
													echo "<option></option>";
546
												?>
547
?>
547 548
											</select>
548 549
											<br />
549 550
										</td>
......
561 562
											<strong><?=gettext("Member Of"); ?></strong><br />
562 563
											<br />
563 564
											<select size="10" style="width: 75%" name="groups[]" class="formselect" id="groups" onchange="clear_selected('notgroups')" multiple="multiple">
564
												<?php
565
<?php
565 566
												$rowIndex = 0;
566
												if (is_array($pconfig['groups'])) {
567
												if (is_array($pconfig['groups'])):
567 568
													foreach ($config['system']['group'] as $group):
568 569
														if ($group['gid'] == 1998) /* all users group */
569 570
															continue;
570 571
														if (!in_array($group['name'],$pconfig['groups']))
571 572
															continue;
572 573
														$rowIndex++;
573
												?>
574
?>
574 575
												<option value="<?=$group['name'];?>">
575 576
													<?=htmlspecialchars($group['name']);?>
576 577
												</option>
577
												<?php endforeach;
578
												}
578
<?php
579
													endforeach;
580
												endif;
579 581
												if ($rowIndex == 0)
580 582
													echo "<option></option>";
581
												?>
583
?>
582 584
											</select>
583 585
											<br />
584 586
										</td>
......
587 589
								<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
588 590
							</td>
589 591
						</tr>
590

  
591
						<?php if (isset($pconfig['uid'])): ?>
592

  
592
<?php
593
					if (isset($pconfig['uid'])):
594
?>
593 595
						<tr>
594 596
							<td width="22%" valign="top" class="vncell"><?=gettext("Effective Privileges");?></td>
595 597
							<td width="78%" class="vtable">
......
600 602
										<td width="40%" class="listhdrr"><?=gettext("Description");?></td>
601 603
										<td class="list"></td>
602 604
									</tr>
603
									<?php
604

  
605
										$privdesc = get_user_privdesc($a_user[$id]);
606
										if(is_array($privdesc)):
607
											$i = 0;
608
											foreach ($privdesc as $priv):
609
											$group = false;
610
											if ($priv['group'])
611
												$group = $priv['group'];
612
									?>
605
<?php
606
							$privdesc = get_user_privdesc($a_user[$id]);
607
							if(is_array($privdesc)):
608
								$i = 0;
609
								foreach ($privdesc as $priv):
610
									$group = false;
611
									if ($priv['group'])
612
										$group = $priv['group'];
613
?>
613 614
									<tr>
614 615
										<td class="listlr"><?=$group;?></td>
615 616
										<td class="listr">
616 617
											<?=htmlspecialchars($priv['name']);?>
617 618
										</td>
618 619
										<td class="listbg">
619
												<?=htmlspecialchars($priv['descr']);?>
620
											<?=htmlspecialchars($priv['descr']);?>
620 621
										</td>
621 622
										<td valign="middle" class="list nowrap">
622
											<?php if (!$group): ?>
623
<?php
624
										if (!$group):
625
?>
623 626
											<a href="system_usermanager.php?act=delpriv&amp;id=<?=$id?>&amp;privid=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this privilege?");?>')">
624 627
												<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" />
625 628
											</a>
626
											<?php endif; ?>
629
<?php
630
										endif;
631
?>
627 632
										</td>
628 633
									</tr>
629
									<?php
630
											/* can only delete user priv indexes */
631
											if (!$group)
632
												$i++;
633
											endforeach;
634
										endif;
635
									?>
634
<?php
635
										/* can only delete user priv indexes */
636
										if (!$group)
637
											$i++;
638
								endforeach;
639
							endif;
640
?>
636 641
									<tr>
637 642
										<td class="list" colspan="3"></td>
638 643
										<td class="list">
......
653 658
										<td width="45%" class="listhdrr"><?=gettext("CA");?></td>
654 659
										<td class="list"></td>
655 660
									</tr>
656
									<?php
657

  
658
										$a_cert = $a_user[$id]['cert'];
659
										if(is_array($a_cert)):
660
											$i = 0;
661
											foreach ($a_cert as $certref):
662
												$cert = lookup_cert($certref);
663
												$ca = lookup_ca($cert['caref']);
664
									?>
661
<?php
662
							$a_cert = $a_user[$id]['cert'];
663
							if(is_array($a_cert)):
664
								$i = 0;
665
								foreach ($a_cert as $certref):
666
									$cert = lookup_cert($certref);
667
									$ca = lookup_ca($cert['caref']);
668
?>
665 669
									<tr>
666 670
										<td class="listlr">
667 671
											<?=htmlspecialchars($cert['descr']);?>
668
											<?php if (is_cert_revoked($cert)): ?>
672
<?php
673
										if (is_cert_revoked($cert)):
674
?>
669 675
											(<b>Revoked</b>)
670
											<?php endif; ?>
676
<?php
677
										endif;
678
?>
671 679
										</td>
672 680
										<td class="listr">
673 681
											<?=htmlspecialchars($ca['descr']);?>
......
684 692
											</a>
685 693
										</td>
686 694
									</tr>
687
									<?php
688
												$i++;
689
											endforeach;
690
										endif;
691
									?>
695
<?php
696
									$i++;
697
								endforeach;
698
							endif;
699
?>
692 700
									<tr>
693 701
										<td class="list" colspan="2"></td>
694 702
										<td class="list">
......
701 709
							</td>
702 710
						</tr>
703 711

  
704
						<?php else : ?>
705
						<?php 	if (is_array($config['ca']) && count($config['ca']) > 0): ?>
706
						<?php		$i = 0; foreach( $config['ca'] as $ca) {
707
                                                                        	if (!$ca['prv'])
708
                                                                                	continue;
709
										$i++;
710
									}
711
						?>
712
<?php
713
					else:
714
						if (is_array($config['ca']) && count($config['ca']) > 0):
715
							$i = 0;
716
							foreach( $config['ca'] as $ca) {
717
								if (!$ca['prv'])
718
									continue;
719
								$i++;
720
							}
721
?>
712 722

  
713 723
						<tr id="usercertchck">
714 724
							<td width="22%" valign="top" class="vncell"><?=gettext("Certificate");?></td>
715
                                                	<td width="78%" class="vtable">
725
							<td width="78%" class="vtable">
716 726
							<input type="checkbox" onclick="javascript:usercertClicked(this)" /> <?=gettext("Click to create a user certificate."); ?>
717 727
							</td>
718 728
						</tr>
719 729

  
720
						<?php		if ($i > 0): ?>
721

  
730
<?php
731
							if ($i > 0):
732
?>
722 733
						<tr id="usercert" style="display:none">
723 734
							<td width="22%" valign="top" class="vncell"><?=gettext("Certificate");?></td>
724
                                                	<td width="78%" class="vtable">
725
							<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="certificate">
726
							<tr>
727
                                                        	<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
728
                                                        	<td width="78%" class="vtable">
729
									<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
730
                                                        	</td>
731
                                                	</tr>
732
                                                	<tr>
733
                                                        	<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate authority");?></td>
734
                                                        	<td width="78%" class="vtable">
735
                                                                	<select name='caref' id='caref' class="formselect" onchange='internalca_change()'>
736
                                                                <?php
737
																		$rowIndex = 0;
738
                                                                        foreach( $config['ca'] as $ca):
739
                                                                        if (!$ca['prv'])
740
                                                                                continue;
741
																			$rowIndex++;
742
                                                                ?>
743
                                                                        <option value="<?=$ca['refid'];?>"><?=$ca['descr'];?></option>
744
                                                                <?php endforeach;
745
																if ($rowIndex == 0)
746
																	echo "<option></option>";
747
																?>
748
                                                                	</select>
749
                                                        	</td>
750
                                                	</tr>
751
                                                	<tr>
752
                                                        	<td width="22%" valign="top" class="vncellreq"><?=gettext("Key length");?></td>
753
                                                        	<td width="78%" class="vtable">
754
                                                                	<select name='keylen' class="formselect">
755
                                                                <?php
756
									$cert_keylens = array( "2048", "512", "1024", "4096");
757
                                                                        foreach( $cert_keylens as $len):
758
                                                                ?>
759
                                                                        <option value="<?=$len;?>"><?=$len;?></option>
760
                                                                <?php
761
                                                                endforeach;
762
                                                                if (!count($cert_keylens))
763
                                                                	echo "<option></option>";
764
                                                                ?>
765
                                                                	</select>
766
                                                                	bits
767
                                                        	</td>
768
                                                	</tr>
769
							<tr>
770
                                                        	<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
771
                                                        	<td width="78%" class="vtable">
772
                                                                	<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>" />days
773
                                                        	</td>
774
                                                	</tr>
775
						</table>
735
							<td width="78%" class="vtable">
736
								<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="certificate">
737
									<tr>
738
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
739
										<td width="78%" class="vtable">
740
											<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
741
										</td>
742
									</tr>
743
									<tr>
744
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate authority");?></td>
745
										<td width="78%" class="vtable">
746
											<select name='caref' id='caref' class="formselect" onchange='internalca_change()'>
747
<?php
748
											$rowIndex = 0;
749
											foreach( $config['ca'] as $ca):
750
												if (!$ca['prv'])
751
													continue;
752
												$rowIndex++;
753
?>
754
												<option value="<?=$ca['refid'];?>"><?=$ca['descr'];?></option>
755
<?php
756
											endforeach;
757
											if ($rowIndex == 0)
758
												echo "<option></option>";
759
?>
760
											</select>
761
										</td>
762
									</tr>
763
									<tr>
764
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Key length");?></td>
765
										<td width="78%" class="vtable">
766
											<select name='keylen' class="formselect">
767
<?php
768
											$cert_keylens = array( "2048", "512", "1024", "4096");
769
											foreach( $cert_keylens as $len):
770
?>
771
												<option value="<?=$len;?>"><?=$len;?></option>
772
<?php
773
											endforeach;
774
											if (!count($cert_keylens))
775
												echo "<option></option>";
776
?>
777
											</select>
778
											bits
779
										</td>
780
									</tr>
781
									<tr>
782
										<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
783
										<td width="78%" class="vtable">
784
											<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>" />days
785
										</td>
786
									</tr>
787
								</table>
776 788
							</td>
777 789
						</tr>
778

  
779
						<?php 	endif; endif; ?>
780
						<?php endif; ?>
781

  
790
<?php
791
							endif;
792
						endif;
793
					endif;
794
?>
782 795
						<tr id="sshkeychck" <?php if(!empty($pconfig['authorizedkeys'])) echo 'style="display:none"'; ?>>
783
                                                        <td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
784
                                                        <td width="78%" class="vtable">
785
                                                        <input type="checkbox" onclick="javascript:sshkeyClicked(this)" /> <?=gettext("Click to paste an authorized key."); ?>
786
                                                        </td>
787
                                                </tr>
796
							<td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
797
							<td width="78%" class="vtable">
798
								<input type="checkbox" onclick="javascript:sshkeyClicked(this)" /> <?=gettext("Click to paste an authorized key."); ?>
799
							</td>
800
						</tr>
788 801
						<tr id="sshkey" <?php if(empty($pconfig['authorizedkeys'])) echo 'style="display:none"'; ?>>
789 802
							<td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
790 803
							<td width="78%" class="vtable">
......
817 830
						</tr>
818 831
					</table>
819 832
				</form>
820

  
821
				<?php else: ?>
822

  
833
<?php
834
			else:
835
?>
823 836
				<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
824 837
					<thead>
825 838
						<tr>
......
854 867
						</tr>
855 868
					</tfoot>
856 869
					<tbody>
857
						<?php
858
							$i = 0;
859
							foreach($a_user as $userent):
860
						?>
870
<?php
871
					$i = 0;
872
					foreach($a_user as $userent):
873
?>
861 874
						<tr ondblclick="document.location='system_usermanager.php?act=edit&amp;id=<?=$i;?>'">
862 875
							<td class="listlr">
863 876
								<table border="0" cellpadding="0" cellspacing="0" summary="icons">
864 877
									<tr>
865 878
										<td align="left" valign="middle">
866
											<?php
867
												if($userent['scope'] != "user")
868
													$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user-grey.png";
869
												else
870
													$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user.png";
871
											?>
879
<?php
880
											if($userent['scope'] != "user")
881
												$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user-grey.png";
882
											else
883
												$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user.png";
884
?>
872 885
											<img src="<?=$usrimg;?>" alt="<?=gettext("User"); ?>" title="<?=gettext("User"); ?>" border="0" height="16" width="16" />
873 886
										</td>
874 887
										<td align="left" valign="middle">
......
880 893
							<td class="listr"><?=htmlspecialchars($userent['descr']);?>&nbsp;</td>
881 894
							<td class="listr"><?php if(isset($userent['disabled'])) echo "*"; ?></td>
882 895
							<td class="listbg">
883
									<?=implode(",",local_user_get_groups($userent));?>
896
								<?=implode(",",local_user_get_groups($userent));?>
884 897
								&nbsp;
885 898
							</td>
886 899
							<td valign="middle" class="list nowrap">
887 900
								<a href="system_usermanager.php?act=edit&amp;id=<?=$i;?>">
888 901
									<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit user"); ?>" alt="<?=gettext("edit user"); ?>" width="17" height="17" border="0" />
889 902
								</a>
890
								<?php if($userent['scope'] != "system"): ?>
903
<?php
904
							if($userent['scope'] != "system"):
905
?>
891 906
								&nbsp;
892 907
								<a href="system_usermanager.php?act=deluser&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this User?");?>')">
893 908
									<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete user"); ?>" alt="<?=gettext("delete user"); ?>" width="17" height="17" border="0" />
894 909
								</a>
895
								<?php endif; ?>
910
<?php
911
							endif;
912
?>
896 913
							</td>
897 914
						</tr>
898
						<?php
899
								$i++;
900
							endforeach;
901
						?>
915
<?php
916
						$i++;
917
					endforeach;
918
?>
902 919
					</tbody>
903 920
				</table>
904

  
905
				<?php endif; ?>
906

  
921
<?php
922
			endif;
923
?>
907 924
			</div>
908 925
		</td>
909 926
	</tr>

Formats disponibles : Unified diff