Project

General

Profile

« Previous | Next » 

Revision e173dd74

Added by Phil Davis over 10 years ago

Code style for etc files

View differences:

etc/rc.expireaccounts
4 4
/*
5 5
	rc.expireaccounts
6 6
	part of pfSense
7
	
7

  
8 8
	Copyright (C) 2009 Shrew Soft Inc.
9 9
	All rights reserved.
10
	
10

  
11 11
	Redistribution and use in source and binary forms, with or without
12 12
	modification, are permitted provided that the following conditions are met:
13
	
13

  
14 14
	1. Redistributions of source code must retain the above copyright notice,
15 15
	   this list of conditions and the following disclaimer.
16
	
16

  
17 17
	2. Redistributions in binary form must reproduce the above copyright
18 18
	   notice, this list of conditions and the following disclaimer in the
19 19
	   documentation and/or other materials provided with the distribution.
20
	
20

  
21 21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22 22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23 23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
......
39 39

  
40 40
	$count = count($config['system']['user']);
41 41
	$index = 0;
42
	for(; $index < $count; $index++) {
42
	for (; $index < $count; $index++) {
43 43
		$user =& $config['system']['user'][$index];
44
		if($user['scope'] == "system")
44
		if ($user['scope'] == "system")
45 45
			continue;
46 46
		echo "1\n";
47 47
		echo "User {$user['name']} expires {$user['expires']}\n";
48
		if(!$user['expires'] || isset($user['disabled']))
48
		if (!$user['expires'] || isset($user['disabled']))
49 49
			continue;
50 50
		echo "1\n";
51
		if(strtotime("-1 day") > strtotime($user['expires'])) {
51
		if (strtotime("-1 day") > strtotime($user['expires'])) {
52 52
			echo "Disabling user {$user['name']} at index #{$index}\n";
53 53
			//unset($config['system']['user'][$index]);
54 54
			$user['disabled'] = true;
......
58 58
		}
59 59
	}
60 60

  
61
	if($removed > 0)
61
	if ($removed > 0) {
62 62
		write_config("Expired {$removed} user accounts");
63
	}
63 64

  
64 65
	//print_r($config);
65 66

  

Also available in: Unified diff