Completed
Push — master ( aa44e9...fa84e5 )
by Ralf
90:14 queued 73:21
created
preferences/inc/class.preferences_hooks.inc.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		);
82 82
 
83 83
 		$account_display = array(
84
-			'firstname' => lang('Firstname'). ' '.lang('Lastname'),
84
+			'firstname' => lang('Firstname').' '.lang('Lastname'),
85 85
 			'lastname'  => lang('Lastname').', '.lang('Firstname'),
86 86
 			'username'  => lang('username'),
87 87
 			'firstall'  => lang('Firstname').' '.lang('Lastname').' ['.lang('username').']',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			$lang = setup::get_lang();
96 96
 		}
97 97
 		if (empty($lang)) $lang = 'en';
98
-		list(,$country) = explode('-',$lang);
98
+		list(,$country) = explode('-', $lang);
99 99
 		if (empty($country) && class_exists('Locale')) $country = Locale::getRegion(Locale::getDefault());
100 100
 		if (empty($country)) $country = 'de';
101 101
 		
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			substr($GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'], -2) == 'px')
105 105
 		{
106 106
 			$prefs = $GLOBALS['egw']->preferences;
107
-			foreach(array('user','default','forced') as $type)
107
+			foreach (array('user', 'default', 'forced') as $type)
108 108
 			{
109 109
 				if (substr($prefs->{$type}['common']['rte_font_size'], -2) == 'px')
110 110
 				{
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 				'size'  => 3,
132 132
 				'xmlrpc' => True,
133 133
 				'admin'  => False,
134
-				'forced' => 20,	// hidden as not used in eTemplate2
134
+				'forced' => 20, // hidden as not used in eTemplate2
135 135
 			),
136 136
 			'template_set' => array(
137 137
 				'type'   => 'select',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 				'type'   => 'select',
158 158
 				'label'  => 'Audio effect',
159 159
 				'name'   => 'audio_effect',
160
-				'values' => array('0'=>lang('Disable'),'1'=>lang('Enable')),
160
+				'values' => array('0'=>lang('Disable'), '1'=>lang('Enable')),
161 161
 				'help'   => 'Audio effect enables|disables sound effects used in the theme',
162 162
 				'xmlrpc' => True,
163 163
 				'admin'  => False,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 				'type'   => 'multiselect',
279 279
 				'label'  => 'Permanent time zone selection',
280 280
 				'name'   => 'tz_selection',
281
-				'values' => $tzs ? call_user_func_array('array_merge',$tzs) : null,	// only flat arrays supported
281
+				'values' => $tzs ? call_user_func_array('array_merge', $tzs) : null, // only flat arrays supported
282 282
 				'help'   => 'Please select timezones, you want to be able to quickly switch between. Switch is NOT shown, if less then two are selected.',
283 283
 				'xmlrpc' => True,
284 284
 				'admin'  => False,
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 				'type'   => 'select',
410 410
 				'label'  => 'Features of the editor',
411 411
 				'name'   => 'rte_features',
412
-				'values' => array('simple'=>'simple','extended'=>'regular','advanced'=>'everything'),
412
+				'values' => array('simple'=>'simple', 'extended'=>'regular', 'advanced'=>'everything'),
413 413
 				'help'   => 'How many toolbar buttons are available',
414 414
 				'admin'  => false,
415 415
 				'default'=> 'extended'
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 	{
431 431
 		$account_id = (int)$data['account_id'];
432 432
 
433
-		if($account_id > 0)	// user
433
+		if ($account_id > 0)	// user
434 434
 		{
435 435
 			$GLOBALS['egw']->preferences->delete_user($account_id);
436 436
 		}
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
 	 */
463 463
 	static function admin($args)
464 464
 	{
465
-		unset($args);	// unused, but required by function signature
465
+		unset($args); // unused, but required by function signature
466 466
 		$appname = 'preferences';
467 467
 		$file = Array(
468
-			'Site configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname.'&ajax=true'),
468
+			'Site configuration' => Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname='.$appname.'&ajax=true'),
469 469
 		);
470 470
 		display_section($appname, $file);
471 471
 	}
Please login to merge, or discard this patch.
Braces   +28 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,14 +90,26 @@  discard block
 block discarded – undo
90 90
 			'all'       => '['.lang('username').'] '.lang('Lastname').','.lang('Firstname'),
91 91
 		);
92 92
 
93
-		if ($hook_data['setup'])	// called via setup
93
+		if ($hook_data['setup'])
94
+		{
95
+			// called via setup
94 96
 		{
95 97
 			$lang = setup::get_lang();
96 98
 		}
97
-		if (empty($lang)) $lang = 'en';
99
+		}
100
+		if (empty($lang))
101
+		{
102
+			$lang = 'en';
103
+		}
98 104
 		list(,$country) = explode('-',$lang);
99
-		if (empty($country) && class_exists('Locale')) $country = Locale::getRegion(Locale::getDefault());
100
-		if (empty($country)) $country = 'de';
105
+		if (empty($country) && class_exists('Locale'))
106
+		{
107
+			$country = Locale::getRegion(Locale::getDefault());
108
+		}
109
+		if (empty($country))
110
+		{
111
+			$country = 'de';
112
+		}
101 113
 		
102 114
 		// check for old rte_font_size pref including px and split it in size and unit
103 115
 		if (!isset($GLOBALS['egw_setup']) &&
@@ -416,7 +428,10 @@  discard block
 block discarded – undo
416 428
 			),
417 429
 		);
418 430
 		// disable thumbnails, if no size configured by admin
419
-		if (!$GLOBALS['egw_info']['server']['link_list_thumbnail']) unset($settings['link_list_thumbnail']);
431
+		if (!$GLOBALS['egw_info']['server']['link_list_thumbnail'])
432
+		{
433
+			unset($settings['link_list_thumbnail']);
434
+		}
420 435
 
421 436
 		return $settings;
422 437
 	}
@@ -430,14 +445,20 @@  discard block
 block discarded – undo
430 445
 	{
431 446
 		$account_id = (int)$data['account_id'];
432 447
 
433
-		if($account_id > 0)	// user
448
+		if($account_id > 0)
449
+		{
450
+			// user
434 451
 		{
435 452
 			$GLOBALS['egw']->preferences->delete_user($account_id);
436 453
 		}
437
-		elseif ($account_id < 0)	// group
454
+		}
455
+		elseif ($account_id < 0)
456
+		{
457
+			// group
438 458
 		{
439 459
 			$GLOBALS['egw']->preferences->delete_group($account_id);
440 460
 		}
461
+		}
441 462
 	}
442 463
 
443 464
 	/**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -464,7 +464,7 @@
 block discarded – undo
464 464
 	{
465 465
 		unset($args);	// unused, but required by function signature
466 466
 		$appname = 'preferences';
467
-		$file = Array(
467
+		$file = array(
468 468
 			'Site configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname.'&ajax=true'),
469 469
 		);
470 470
 		display_section($appname, $file);
Please login to merge, or discard this patch.
preferences/inc/class.preferences_password.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 		if (!is_array($content))
36 36
 		{
37
-			$content= array();
37
+			$content = array();
38 38
 		}
39 39
 		else
40 40
 		{
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
57 57
 		$tmpl = new Etemplate('preferences.password');
58 58
 
59
-		$tmpl->exec('preferences.preferences_password.change', $content,array(),array(),array(),2);
59
+		$tmpl->exec('preferences.preferences_password.change', $content, array(), array(), array(), 2);
60 60
 	}
61 61
 
62 62
 	/**
Please login to merge, or discard this patch.
preferences/inc/class.preferences_categories_ui.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
 	function __construct()
28 28
 	{
29
-		if (false) parent::__construct ();	// parent constructor explicitly not called!
29
+		if (false) parent::__construct(); // parent constructor explicitly not called!
30 30
 
31 31
 		Framework::includeCSS('/admin/templates/default/app.css');
32 32
 	}
Please login to merge, or discard this patch.
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  * Preference UI extends Admin class to give regular users restricted
17 17
  * access to modify Api\Categories
18 18
  */
19
-class preferences_categories_ui extends admin_categories {
19
+class preferences_categories_ui extends admin_categories
20
+{
20 21
 
21 22
 	protected $appname = 'preferences';
22 23
 	protected $get_rows = 'preferences.preferences_categories_ui.get_rows';
@@ -26,7 +27,11 @@  discard block
 block discarded – undo
26 27
 
27 28
 	function __construct()
28 29
 	{
29
-		if (false) parent::__construct ();	// parent constructor explicitly not called!
30
+		if (false)
31
+		{
32
+			parent::__construct ();
33
+		}
34
+		// parent constructor explicitly not called!
30 35
 
31 36
 		Framework::includeCSS('/admin/templates/default/app.css');
32 37
 	}
Please login to merge, or discard this patch.
doc/check_namespace.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 function check_namespace($file)
25 25
 {
26 26
 	global $prog;
27
-	if (basename($file) == $prog) return true;	// dont fix ourself ;-)
27
+	if (basename($file) == $prog) return true; // dont fix ourself ;-)
28 28
 
29 29
 	if (($content = file_get_contents($file)) === false) return false;
30 30
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 	// find classes declared in file itself, in case they are used
38 38
 	$declared = array();
39
-	foreach(explode("\n", $lines) as $num => $line)
39
+	foreach (explode("\n", $lines) as $num => $line)
40 40
 	{
41 41
 		$matches = null;
42 42
 		if (preg_match('/class\s+([^ ]+)/', $line, $matches))
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	$namespace = '';
48 48
 	$use = array();
49 49
 	$allways = array('self', 'parent', 'static');
50
-	foreach(explode("\n", $lines) as $num => $line)
50
+	foreach (explode("\n", $lines) as $num => $line)
51 51
 	{
52 52
 		$matches = null;
53 53
 		if (preg_match('/namespace\s+([A-Za-z0-9_\\\\]+);/', $line, $matches))
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 		if (preg_match('/use\s+([^;]+);/', $line, $matches))
61 61
 		{
62
-			foreach(preg_split('/,\s*/', $matches[1]) as $alias)
62
+			foreach (preg_split('/,\s*/', $matches[1]) as $alias)
63 63
 			{
64 64
 				$parts = explode('\\', $alias);
65 65
 				$use[$alias] = array_pop($parts);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			$all_matches_raw = array_merge($all_matches_raw, $matches[1]);
76 76
 		}
77 77
 		$all_matches = array_unique($all_matches_raw);
78
-		foreach($all_matches as $c => $class)
78
+		foreach ($all_matches as $c => $class)
79 79
 		{
80 80
 			$parts = explode('\\', $class);
81 81
 			$first_part = array_shift($parts);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		}
94 94
 		if ($all_matches)
95 95
 		{
96
-			echo (1+$num).":\t".$line."\n";
96
+			echo (1 + $num).":\t".$line."\n";
97 97
 			echo "--> ".implode(', ', $all_matches)."\n\n";
98 98
 		}
99 99
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 {
112 112
 	if (!is_dir($dir)) return false;
113 113
 
114
-	foreach(scandir($dir) as $file)
114
+	foreach (scandir($dir) as $file)
115 115
 	{
116 116
 		if ($file == '.' || $file == '..') continue;
117 117
 
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 		{
120 120
 			check_namespace_recursive($dir.'/'.$file);
121 121
 		}
122
-		elseif(substr($file,-4) == '.php')
122
+		elseif (substr($file, -4) == '.php')
123 123
 		{
124
-			echo "\r".str_repeat(' ',100)."\r".$dir.'/'.$file.': ';
124
+			echo "\r".str_repeat(' ', 100)."\r".$dir.'/'.$file.': ';
125 125
 			check_namespace($dir.'/'.$file);
126 126
 		}
127 127
 	}
128
-	echo "\r".str_repeat(' ',100)."\r";
128
+	echo "\r".str_repeat(' ', 100)."\r";
129 129
 	return true;
130 130
 }
131 131
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @param string $error =null
136 136
  */
137
-function usage($error=null)
137
+function usage($error = null)
138 138
 {
139 139
 	global $prog;
140 140
 	echo "Usage: $prog [-h|--help] file or dir\n\n";
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 if (!$args) usage();
149 149
 
150 150
 $replace_file = false;
151
-while(($arg = array_shift($args)))
151
+while (($arg = array_shift($args)))
152 152
 {
153
-	switch($arg)
153
+	switch ($arg)
154 154
 	{
155 155
 		case '-h':
156 156
 		case '--help':
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 if (!is_dir($arg))
172 172
 {
173
-	check_namespace($arg,$replace_file);
173
+	check_namespace($arg, $replace_file);
174 174
 }
175 175
 else
176 176
 {
177
-	check_namespace_recursive($arg,$replace_file);
177
+	check_namespace_recursive($arg, $replace_file);
178 178
 }
179 179
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +41 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,10 +10,13 @@  discard block
 block discarded – undo
10 10
  * @version $Id$
11 11
  */
12 12
 
13
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling as web-page
13
+if (php_sapi_name() !== 'cli')
14
+{
15
+	// security precaution: forbit calling as web-page
14 16
 {
15 17
 	die('<h1>check_namespace.php must NOT be called as web-page --> exiting !!!</h1>');
16 18
 }
19
+}
17 20
 
18 21
 /**
19 22
  * Check namespace usage in converted code
@@ -24,9 +27,16 @@  discard block
 block discarded – undo
24 27
 function check_namespace($file)
25 28
 {
26 29
 	global $prog;
27
-	if (basename($file) == $prog) return true;	// dont fix ourself ;-)
30
+	if (basename($file) == $prog)
31
+	{
32
+		return true;
33
+	}
34
+	// dont fix ourself ;-)
28 35
 
29
-	if (($content = file_get_contents($file)) === false) return false;
36
+	if (($content = file_get_contents($file)) === false)
37
+	{
38
+		return false;
39
+	}
30 40
 
31 41
 	// replace commented lines with empty ones
32 42
 	$lines = preg_replace_callback('#(//.*$|/\\*.*\\*/)#msU', function($matches)
@@ -55,7 +65,10 @@  discard block
 block discarded – undo
55 65
 			$namespace = $matches[1];
56 66
 			$use = array();
57 67
 		}
58
-		if ($namespace === '') continue;
68
+		if ($namespace === '')
69
+		{
70
+			continue;
71
+		}
59 72
 
60 73
 		if (preg_match('/use\s+([^;]+);/', $line, $matches))
61 74
 		{
@@ -109,11 +122,17 @@  discard block
 block discarded – undo
109 122
  */
110 123
 function check_namespace_recursive($dir)
111 124
 {
112
-	if (!is_dir($dir)) return false;
125
+	if (!is_dir($dir))
126
+	{
127
+		return false;
128
+	}
113 129
 
114 130
 	foreach(scandir($dir) as $file)
115 131
 	{
116
-		if ($file == '.' || $file == '..') continue;
132
+		if ($file == '.' || $file == '..')
133
+		{
134
+			continue;
135
+		}
117 136
 
118 137
 		if (is_dir($dir.'/'.$file))
119 138
 		{
@@ -138,14 +157,20 @@  discard block
 block discarded – undo
138 157
 {
139 158
 	global $prog;
140 159
 	echo "Usage: $prog [-h|--help] file or dir\n\n";
141
-	if ($error) echo $error."\n\n";
160
+	if ($error)
161
+	{
162
+		echo $error."\n\n";
163
+	}
142 164
 	exit($error ? 1 : 0);
143 165
 }
144 166
 
145 167
 $args = $_SERVER['argv'];
146 168
 $prog = basename(array_shift($args));
147 169
 
148
-if (!$args) usage();
170
+if (!$args)
171
+{
172
+	usage();
173
+}
149 174
 
150 175
 $replace_file = false;
151 176
 while(($arg = array_shift($args)))
@@ -158,15 +183,21 @@  discard block
 block discarded – undo
158 183
 			break;
159 184
 
160 185
 		default:
161
-			if ($args)	// not last argument
186
+			if ($args)
187
+			{
188
+				// not last argument
162 189
 			{
163 190
 				usage("Unknown argument '$arg'!");
164 191
 			}
192
+			}
165 193
 			break 2;
166 194
 	}
167 195
 }
168 196
 
169
-if (!file_exists($arg)) usage("Error: $arg not found!");
197
+if (!file_exists($arg))
198
+{
199
+	usage("Error: $arg not found!");
200
+}
170 201
 
171 202
 if (!is_dir($arg))
172 203
 {
Please login to merge, or discard this patch.
doc/config2xet.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			</columns>
57 57
 			<rows>
58 58
 ';
59
-foreach($trs[2] as $n => $tr)
59
+foreach ($trs[2] as $n => $tr)
60 60
 {
61 61
 	if (strpos($tr, '{title}') || strpos($tr, '<input type="submit"')) continue;
62 62
 
@@ -64,25 +64,25 @@  discard block
 block discarded – undo
64 64
 	{
65 65
 		die("No td tags found in $n. tr: $tr");
66 66
 	}
67
-	if (($commented = !empty($trs[1][$n])? $trs[1][$n] : ''))
67
+	if (($commented = !empty($trs[1][$n]) ? $trs[1][$n] : ''))
68 68
 	{
69 69
 		echo "\t\t\t\t$commented\n";
70 70
 	}
71 71
 	echo "\t\t\t\t<row>\n";
72
-	foreach($tds[2] as $t => $td)
72
+	foreach ($tds[2] as $t => $td)
73 73
 	{
74 74
 		if (preg_match('|^\s*<([^ >]+)\s*([^/>]+)/?>(.*)\s*$|sui', $td, $matches))
75 75
 		{
76 76
 			$attrs = preg_match_all('|\s*([^=]+)="([^"]+)"|', $matches[2], $attrs) ?
77 77
 				array_combine($attrs[1], $attrs[2]) : array();
78 78
 
79
-			switch($matches[1])
79
+			switch ($matches[1])
80 80
 			{
81 81
 				case 'input':
82 82
 				case 'textarea':
83 83
 					echo "\t\t\t\t\t<textbox id=\"".$attrs['name'].'"';
84 84
 					unset($attrs['value'], $attrs['name']);
85
-					foreach($attrs as $name => $value)
85
+					foreach ($attrs as $name => $value)
86 86
 					{
87 87
 						if ($name == 'type' && $value == 'password') $value = 'passwd';
88 88
 						echo " $name=\"$value\"";
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 				case 'select':
104 104
 					echo "\t\t\t\t\t<select id=\"".$attrs['name'].'"';
105 105
 					unset($attrs['name']);
106
-					foreach($attrs as $name => $value)
106
+					foreach ($attrs as $name => $value)
107 107
 					{
108 108
 						echo " $name=\"$value\"";
109 109
 					}
110 110
 					echo ">\n";
111 111
 					if (preg_match_all('|<option\s+value="([^"]*)"\s*({selected_[^}]+})?>(.*)</option>|Usui', $matches[3], $options))
112 112
 					{
113
-						foreach($options[3] as $i => $label)
113
+						foreach ($options[3] as $i => $label)
114 114
 						{
115 115
 							$label = preg_replace_callback('/{lang_([^}]+)}/', function($matches)
116 116
 							{
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			echo "/>\n";
154 154
 			if (!$commented && !empty($matches[3]) && trim($matches[3])) echo "\t\t\t\t\t<!-- ".trim($matches[3])." -->\n";
155 155
 		}
156
-		elseif(!$commented)
156
+		elseif (!$commented)
157 157
 		{
158 158
 			echo "\t\t\t\t\t<!-- ".trim($td)." -->\n";
159 159
 		}
Please login to merge, or discard this patch.
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,10 @@  discard block
 block discarded – undo
58 58
 ';
59 59
 foreach($trs[2] as $n => $tr)
60 60
 {
61
-	if (strpos($tr, '{title}') || strpos($tr, '<input type="submit"')) continue;
61
+	if (strpos($tr, '{title}') || strpos($tr, '<input type="submit"'))
62
+	{
63
+		continue;
64
+	}
62 65
 
63 66
 	if (!preg_match_all('|<td\s*([^>]*)>(.*)</td>|Usui', $tr, $tds, PREG_PATTERN_ORDER))
64 67
 	{
@@ -84,7 +87,10 @@  discard block
 block discarded – undo
84 87
 					unset($attrs['value'], $attrs['name']);
85 88
 					foreach($attrs as $name => $value)
86 89
 					{
87
-						if ($name == 'type' && $value == 'password') $value = 'passwd';
90
+						if ($name == 'type' && $value == 'password')
91
+						{
92
+							$value = 'passwd';
93
+						}
88 94
 						echo " $name=\"$value\"";
89 95
 					}
90 96
 					echo "/>\n";
@@ -139,7 +145,10 @@  discard block
 block discarded – undo
139 145
 		elseif (preg_match('/^\s*([^{]*){lang_([^}]+)}\s*(.*)$/sui',
140 146
 			str_replace(array('&nbsp;', '<b>', '</b>'), '', $td), $matches))
141 147
 		{
142
-			if (!$commented && trim($matches[1])) echo "\t\t\t\t\t<!-- $matches[1] -->\n";
148
+			if (!$commented && trim($matches[1]))
149
+			{
150
+				echo "\t\t\t\t\t<!-- $matches[1] -->\n";
151
+			}
143 152
 			echo "\t\t\t\t\t<description value=\"".htmlspecialchars(str_replace('_', ' ', $matches[2])).'"';
144 153
 			if (trim($matches[3]) == ':')
145 154
 			{
@@ -151,7 +160,10 @@  discard block
 block discarded – undo
151 160
 				echo ' span="all" class="subHeader"';
152 161
 			}
153 162
 			echo "/>\n";
154
-			if (!$commented && !empty($matches[3]) && trim($matches[3])) echo "\t\t\t\t\t<!-- ".trim($matches[3])." -->\n";
163
+			if (!$commented && !empty($matches[3]) && trim($matches[3]))
164
+			{
165
+				echo "\t\t\t\t\t<!-- ".trim($matches[3])." -->\n";
166
+			}
155 167
 		}
156 168
 		elseif(!$commented)
157 169
 		{
Please login to merge, or discard this patch.
doc/rpm-build/header.inc.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // dummy setup file
3 3
 if (strpos($_SERVER['PHP_SELF'],'/setup/') === false)
4 4
 {
5
-        header('Location: /egroupware/setup/');
6
-        exit;
5
+		header('Location: /egroupware/setup/');
6
+		exit;
7 7
 }
8 8
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 // dummy setup file
3
-if (strpos($_SERVER['PHP_SELF'],'/setup/') === false)
3
+if (strpos($_SERVER['PHP_SELF'], '/setup/') === false)
4 4
 {
5 5
         header('Location: /egroupware/setup/');
6 6
         exit;
Please login to merge, or discard this patch.
doc/mail/dovecot_checkpassword_ads.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 //$bind_pw = 'secret';
56 56
 $version = 3;
57 57
 $use_tls = false;
58
-$search_base = $ldap_base;//'o=%d,dc=egroupware';
58
+$search_base = $ldap_base; //'o=%d,dc=egroupware';
59 59
 $passdb_filter = $userdb_filter = '(&(objectCategory=person)(sAMAccountName=%s))';
60 60
 // %d for domain and %s for username given by Dovecot is set automatic
61 61
 $user_attrs = array(
62
-	'%u' => 'samaccountname',	// do NOT remove!
62
+	'%u' => 'samaccountname', // do NOT remove!
63 63
 //	'%n' => 'uidnumber',
64 64
 //	'%h' => 'mailmessagestore',
65 65
 	'%q' => '{quota:}proxyaddresses',
66 66
 	'%x' => 'dn',
67 67
 );
68
-$user_name = '%u';	// '%u@%d';
69
-$user_home = '/var/dovecot/imap/gruene/%u';	//'/var/dovecot/imap/%d/%u';	// mailbox location
68
+$user_name = '%u'; // '%u@%d';
69
+$user_home = '/var/dovecot/imap/gruene/%u'; //'/var/dovecot/imap/%d/%u';	// mailbox location
70 70
 $extra = array(
71 71
 	'userdb_quota_rule' => '*:bytes=%q',
72 72
 /* only for director
@@ -87,26 +87,26 @@  discard block
 block discarded – undo
87 87
 $group_base = $ldap_base;
88 88
 $group_filter = '(&(objectCategory=group)(member=%x))';
89 89
 $group_attr = 'cn';
90
-$group_append = '';	//'@%d';
90
+$group_append = ''; //'@%d';
91 91
 
92
-$master_dn = $bind_dn;	//"cn=admin,dc=egroupware";
92
+$master_dn = $bind_dn; //"cn=admin,dc=egroupware";
93 93
 //$domain_master_dn = "cn=admin,o=%d,dc=egroupware";
94 94
 
95
-ini_set('display_errors',false);
96
-error_reporting(E_ALL & ~E_NOTICE);
97
-if ($log) ini_set('error_log',$log);
95
+ini_set('display_errors', false);
96
+error_reporting(E_ALL&~E_NOTICE);
97
+if ($log) ini_set('error_log', $log);
98 98
 
99 99
 if ($_SERVER['argc'] < 2)
100 100
 {
101
-	fwrite(STDERR,"\nUsage: {$_SERVER['argv'][0]} prog-to-exec\n\n");
102
-	fwrite(STDERR,"To test run:\n");
103
-	fwrite(STDERR,"echo -en 'username\\0000''password\\0000' | {$_SERVER['argv'][0]} env 3<&0 ; echo $?\n");
104
-	fwrite(STDERR,"echo -en 'username\\0000' | AUTHORIZED=1 {$_SERVER['argv'][0]} env 3<&0 ; echo $?\n");
105
-	fwrite(STDERR,"echo -en '(dovecode-admin@domain|dovecot|cyrus)\\0000''master-password\\0000' | AUTH_LOGIN_USER=username {$_SERVER['argv'][0]} env 3<&0 ; echo $?\n\n");
101
+	fwrite(STDERR, "\nUsage: {$_SERVER['argv'][0]} prog-to-exec\n\n");
102
+	fwrite(STDERR, "To test run:\n");
103
+	fwrite(STDERR, "echo -en 'username\\0000''password\\0000' | {$_SERVER['argv'][0]} env 3<&0 ; echo $?\n");
104
+	fwrite(STDERR, "echo -en 'username\\0000' | AUTHORIZED=1 {$_SERVER['argv'][0]} env 3<&0 ; echo $?\n");
105
+	fwrite(STDERR, "echo -en '(dovecode-admin@domain|dovecot|cyrus)\\0000''master-password\\0000' | AUTH_LOGIN_USER=username {$_SERVER['argv'][0]} env 3<&0 ; echo $?\n\n");
106 106
 	exit(2);
107 107
 }
108 108
 
109
-list($username,$password) = explode("\0",file_get_contents('php://fd/3'));
109
+list($username, $password) = explode("\0", file_get_contents('php://fd/3'));
110 110
 if (isset($_SERVER['AUTH_LOGIN_USER']))
111 111
 {
112 112
 	$master = $username;
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
 if (!@ldap_bind($ds, $bind_dn, $bind_pw))
122 122
 {
123 123
 	error_log("Can't connect to LDAP server $ldap_uri!");
124
-	exit(111);	// 111 = temporary problem
124
+	exit(111); // 111 = temporary problem
125 125
 }
126
-list(,$domain) = explode('@',$username);
127
-if (preg_match('/^(.*)\.imapc$/',$domain,$matches))
126
+list(,$domain) = explode('@', $username);
127
+if (preg_match('/^(.*)\.imapc$/', $domain, $matches))
128 128
 {
129 129
 	$domain = $matches[1];
130 130
 
131 131
 	$username = explode('.', $username);
132 132
 	array_pop($username);
133
-	$username = implode('.',$username);
133
+	$username = implode('.', $username);
134 134
 
135 135
 	$user_home = '/var/tmp/imapc-%d/%s';
136 136
 	$extra = array(
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	// master user name is hardcoded "dovecot", "cyrus" or "dovecot-admin@domain" and mapped currently to cn=admin,[o=domain,]dc=egroupware
155 155
 	if (isset($master))
156 156
 	{
157
-		list($n,$d) = explode('@', $master);
158
-		if (!($n === 'dovecot-admin' && $d === $domain || in_array($master,array('dovecot','cyrus'))))
157
+		list($n, $d) = explode('@', $master);
158
+		if (!($n === 'dovecot-admin' && $d === $domain || in_array($master, array('dovecot', 'cyrus'))))
159 159
 		{
160 160
 			// no valid master-user for given domain
161 161
 			exit(1);
162 162
 		}
163
-		$dn = $d ? strtr($domain_master_dn,array('%d'=>$domain)) : $master_dn;
163
+		$dn = $d ? strtr($domain_master_dn, array('%d'=>$domain)) : $master_dn;
164 164
 		if (!@ldap_bind($ds, $dn, $password))
165 165
 		{
166 166
 			if ($log_verbose) error_log("Can't bind as '$dn' with password '$password'! Authentication as master '$master' for user '$username' failed!");
167
-			exit(111);	// 111 = temporary problem
167
+			exit(111); // 111 = temporary problem
168 168
 		}
169 169
 		if ($log_verbose) error_log("Authentication as master '$master' for user '$username' succeeded!");
170 170
 		$passdb_query = false;
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 
181 181
 // remove prefixes eg. "{quota:}proxyaddresses"
182 182
 $attrs = $user_attrs;
183
-foreach($attrs as &$a) if ($a[0] == '{') list(,$a) = explode('}', $a);
183
+foreach ($attrs as &$a) if ($a[0] == '{') list(,$a) = explode('}', $a);
184 184
 
185 185
 if (!($sr = ldap_search($ds, $base, $filter, array_values($attrs))))
186 186
 {
187 187
 	error_log("Error ldap_search(\$ds, '$base', '$filter')!");
188
-	exit(111);	// 111 = temporary problem
188
+	exit(111); // 111 = temporary problem
189 189
 }
190 190
 $entries = ldap_get_entries($ds, $sr);
191 191
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 {
200 200
 	// should not happen for passdb, but could happen for aliases ...
201 201
 	error_log("Error ldap_search(\$ds, '$base', '$filter') returned more then one user!");
202
-	exit(111);	// 111 = temporary problem
202
+	exit(111); // 111 = temporary problem
203 203
 }
204 204
 //print_r($entries);
205 205
 
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
 }
220 220
 
221 221
 // add additional placeholders from $user_attrs
222
-foreach($user_attrs as $placeholder => $attr)
222
+foreach ($user_attrs as $placeholder => $attr)
223 223
 {
224 224
 	if ($attr[0] == '{')	// prefix given --> ignore all values without and remove it
225 225
 	{
226 226
 		list($prefix, $attr) = explode('}', substr($attr, 1));
227
-		foreach($entries[0][$attr] as $key => $value)
227
+		foreach ($entries[0][$attr] as $key => $value)
228 228
 		{
229 229
 			if ($key === 'count') continue;
230 230
 			if (strpos($value, $prefix) !== 0) continue;
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 	{
250 250
 		//print_r($groups);
251 251
 		$system_groups_user = array();
252
-		foreach($groups as $key => $group)
252
+		foreach ($groups as $key => $group)
253 253
 		{
254 254
 			if ($key === 'count') continue;
255 255
 			$system_groups_user[] = $group[$group_attr][0].$append;
256 256
 		}
257
-		$extra['system_groups_user'] = implode(',', $system_groups_user);	// todo: check separator
257
+		$extra['system_groups_user'] = implode(',', $system_groups_user); // todo: check separator
258 258
 	}
259 259
 	else
260 260
 	{
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 // set host attribute for director to old imap
266 266
 if (isset($host_base) && isset($host_filter))
267 267
 {
268
-	if (!($sr = ldap_search($ds, $host_base, $filter=strtr($host_filter, quote($replace)), array($host_attr))))
268
+	if (!($sr = ldap_search($ds, $host_base, $filter = strtr($host_filter, quote($replace)), array($host_attr))))
269 269
 	{
270 270
 		error_log("Error ldap_search(\$ds, '$host_base', '$filter')!");
271
-		exit(111);	// 111 = temporary problem
271
+		exit(111); // 111 = temporary problem
272 272
 	}
273 273
 	$entries = ldap_get_entries($ds, $sr);
274 274
 	if ($entries['count'] && !isset($entries[0][$host_attr]))
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 // build command to run
283 283
 array_shift($_SERVER['argv']);
284 284
 $cmd = array_shift($_SERVER['argv']);
285
-foreach($_SERVER['argv'] as $arg)
285
+foreach ($_SERVER['argv'] as $arg)
286 286
 {
287 287
 	$cmd .= ' '.escapeshellarg($arg);
288 288
 }
@@ -292,17 +292,17 @@  discard block
 block discarded – undo
292 292
 if ($user_home) putenv('HOME='.strtr($user_home, $replace));
293 293
 if ($extra)
294 294
 {
295
-	foreach($extra as $name => $value)
295
+	foreach ($extra as $name => $value)
296 296
 	{
297
-		if (($pos = strpos($value,'%')) !== false)
297
+		if (($pos = strpos($value, '%')) !== false)
298 298
 		{
299 299
 			// check if replacement is set, otherwise skip whole extra-value
300
-			if (!isset($replace[substr($value,$pos,2)]))
300
+			if (!isset($replace[substr($value, $pos, 2)]))
301 301
 			{
302 302
 				unset($extra[$name]);
303 303
 				continue;
304 304
 			}
305
-			$value = strtr($value,$replace);
305
+			$value = strtr($value, $replace);
306 306
 		}
307 307
 		putenv($name.'='.$value);
308 308
 	}
@@ -326,5 +326,5 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function quote($string)
328 328
 {
329
-	return str_replace(array('\\','*','(',')','\0',' '),array('\\\\','\*','\(','\)','\\0','\20'),$string);
329
+	return str_replace(array('\\', '*', '(', ')', '\0', ' '), array('\\\\', '\*', '\(', '\)', '\\0', '\20'), $string);
330 330
 }
Please login to merge, or discard this patch.
Braces   +66 added lines, -18 removed lines patch added patch discarded remove patch
@@ -41,7 +41,10 @@  discard block
 block discarded – undo
41 41
  */
42 42
 
43 43
 // protect from being called via HTTP
44
-if (php_sapi_name() !== 'cli') die('This is a command line only script!');
44
+if (php_sapi_name() !== 'cli')
45
+{
46
+	die('This is a command line only script!');
47
+}
45 48
 
46 49
 // uncomment to write to log-file, otherwise errors go to stderr
47 50
 //$log = '/var/log/dovecot_checkpassword.log';
@@ -94,7 +97,10 @@  discard block
 block discarded – undo
94 97
 
95 98
 ini_set('display_errors',false);
96 99
 error_reporting(E_ALL & ~E_NOTICE);
97
-if ($log) ini_set('error_log',$log);
100
+if ($log)
101
+{
102
+	ini_set('error_log',$log);
103
+}
98 104
 
99 105
 if ($_SERVER['argc'] < 2)
100 106
 {
@@ -115,8 +121,14 @@  discard block
 block discarded – undo
115 121
 //error_log("dovecot_checkpassword '{$_SERVER['argv'][1]}': username='$username', password='$password', master='$master'");
116 122
 
117 123
 $ds = ldap_connect($ldap_uri);
118
-if ($version) ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
119
-if ($use_tls) ldap_start_tls($ds);
124
+if ($version)
125
+{
126
+	ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
127
+}
128
+if ($use_tls)
129
+{
130
+	ldap_start_tls($ds);
131
+}
120 132
 
121 133
 if (!@ldap_bind($ds, $bind_dn, $bind_pw))
122 134
 {
@@ -163,10 +175,16 @@  discard block
 block discarded – undo
163 175
 		$dn = $d ? strtr($domain_master_dn,array('%d'=>$domain)) : $master_dn;
164 176
 		if (!@ldap_bind($ds, $dn, $password))
165 177
 		{
166
-			if ($log_verbose) error_log("Can't bind as '$dn' with password '$password'! Authentication as master '$master' for user '$username' failed!");
178
+			if ($log_verbose)
179
+			{
180
+				error_log("Can't bind as '$dn' with password '$password'! Authentication as master '$master' for user '$username' failed!");
181
+			}
167 182
 			exit(111);	// 111 = temporary problem
168 183
 		}
169
-		if ($log_verbose) error_log("Authentication as master '$master' for user '$username' succeeded!");
184
+		if ($log_verbose)
185
+		{
186
+			error_log("Authentication as master '$master' for user '$username' succeeded!");
187
+		}
170 188
 		$passdb_query = false;
171 189
 		$filter = $userdb_filter;
172 190
 	}
@@ -180,7 +198,10 @@  discard block
 block discarded – undo
180 198
 
181 199
 // remove prefixes eg. "{quota:}proxyaddresses"
182 200
 $attrs = $user_attrs;
183
-foreach($attrs as &$a) if ($a[0] == '{') list(,$a) = explode('}', $a);
201
+foreach($attrs as &$a)
202
+{
203
+	if ($a[0] == '{') list(,$a) = explode('}', $a);
204
+}
184 205
 
185 206
 if (!($sr = ldap_search($ds, $base, $filter, array_values($attrs))))
186 207
 {
@@ -191,7 +212,10 @@  discard block
 block discarded – undo
191 212
 
192 213
 if (!$entries['count'])
193 214
 {
194
-	if ($log_verbose) error_log("User '$username' NOT found!");
215
+	if ($log_verbose)
216
+	{
217
+		error_log("User '$username' NOT found!");
218
+	}
195 219
 	exit(3);
196 220
 }
197 221
 
@@ -208,26 +232,44 @@  discard block
 block discarded – undo
208 232
 	// now authenticate user by trying to bind to found dn with given password
209 233
 	if (!@ldap_bind($ds, $entries[0]['dn'], $password))
210 234
 	{
211
-		if ($log_verbose) error_log("Can't bind as '{$entries[0]['dn']}' with password '$password'! Authentication for user '$username' failed!");
235
+		if ($log_verbose)
236
+		{
237
+			error_log("Can't bind as '{$entries[0]['dn']}' with password '$password'! Authentication for user '$username' failed!");
238
+		}
212 239
 		exit(1);
213 240
 	}
214
-	if ($log_verbose) error_log("Successfull authentication user '$username' dn='{$entries[0]['dn']}'.");
215
-}
241
+	if ($log_verbose)
242
+	{
243
+		error_log("Successfull authentication user '$username' dn='{$entries[0]['dn']}'.");
244
+	}
245
+	}
216 246
 else	// user-db query, no authentication
217 247
 {
218
-	if ($log_verbose) error_log("User-db query for user '$username' dn='{$entries[0]['dn']}'.");
219
-}
248
+	if ($log_verbose)
249
+	{
250
+		error_log("User-db query for user '$username' dn='{$entries[0]['dn']}'.");
251
+	}
252
+	}
220 253
 
221 254
 // add additional placeholders from $user_attrs
222 255
 foreach($user_attrs as $placeholder => $attr)
223 256
 {
224
-	if ($attr[0] == '{')	// prefix given --> ignore all values without and remove it
257
+	if ($attr[0] == '{')
258
+	{
259
+		// prefix given --> ignore all values without and remove it
225 260
 	{
226 261
 		list($prefix, $attr) = explode('}', substr($attr, 1));
262
+	}
227 263
 		foreach($entries[0][$attr] as $key => $value)
228 264
 		{
229
-			if ($key === 'count') continue;
230
-			if (strpos($value, $prefix) !== 0) continue;
265
+			if ($key === 'count')
266
+			{
267
+				continue;
268
+			}
269
+			if (strpos($value, $prefix) !== 0)
270
+			{
271
+				continue;
272
+			}
231 273
 			$replace[$placeholder] = substr($value, strlen($prefix));
232 274
 			break;
233 275
 		}
@@ -251,7 +293,10 @@  discard block
 block discarded – undo
251 293
 		$system_groups_user = array();
252 294
 		foreach($groups as $key => $group)
253 295
 		{
254
-			if ($key === 'count') continue;
296
+			if ($key === 'count')
297
+			{
298
+				continue;
299
+			}
255 300
 			$system_groups_user[] = $group[$group_attr][0].$append;
256 301
 		}
257 302
 		$extra['system_groups_user'] = implode(',', $system_groups_user);	// todo: check separator
@@ -289,7 +334,10 @@  discard block
 block discarded – undo
289 334
 
290 335
 // setting USER, HOME, EXTRA
291 336
 putenv('USER='.strtr($user_name, $replace));
292
-if ($user_home) putenv('HOME='.strtr($user_home, $replace));
337
+if ($user_home)
338
+{
339
+	putenv('HOME='.strtr($user_home, $replace));
340
+}
293 341
 if ($extra)
294 342
 {
295 343
 	foreach($extra as $name => $value)
Please login to merge, or discard this patch.
doc/mail/postfix_tcp_map_ads.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 	'mailboxes' => array(
99 99
 		'base' => $base,
100 100
 		'filter' => '(&(objectCategory=person)(proxyAddresses=smtp:%s))',
101
-		'attrs' => 'samaccountname',	// result-attrs must be lowercase!
101
+		'attrs' => 'samaccountname', // result-attrs must be lowercase!
102 102
 		'port' => 2001,
103 103
 	),
104 104
 	// virtual alias maps
105 105
 	'aliases' => array(
106 106
 		'base' => $base,
107 107
 		'filter' => '(&(objectCategory=person)(proxyAddresses=smtp:%s))',
108
-		'attrs' => array('samaccountname','{forward:}proxyaddresses'),
108
+		'attrs' => array('samaccountname', '{forward:}proxyaddresses'),
109 109
 		'port' => 2002,
110 110
 	),
111 111
 	// groups as distribution list
@@ -115,20 +115,20 @@  discard block
 block discarded – undo
115 115
 		'attrs' => 'dn',
116 116
 		// continue with resulting dn
117 117
 		'filter1' => '(&(objectCategory=person)(proxyAddresses=smtp:*)(memberOf=%s))',
118
-		'attrs1' => array('samaccountname','{forward:}proxyaddresses'),
118
+		'attrs1' => array('samaccountname', '{forward:}proxyaddresses'),
119 119
 		'port' => 2003,
120 120
 	),
121 121
 );
122 122
 
123
-ini_set('display_errors',false);
124
-error_reporting(E_ALL & ~E_NOTICE);
125
-if ($log) ini_set('error_log',$log);
123
+ini_set('display_errors', false);
124
+error_reporting(E_ALL&~E_NOTICE);
125
+if ($log) ini_set('error_log', $log);
126 126
 
127
-function usage($extra=null)
127
+function usage($extra = null)
128 128
 {
129 129
 	global $maps;
130 130
 	fwrite(STDERR, "\nUsage: $cmd [-v|--verbose] [-h|--help] [-l|--log (syslog|path)] [-q|--query <email-addresse> (mailboxes|alias|groups)] [host]\n\n");
131
-	fwrite(STDERR, print_r($maps,true)."\n");
131
+	fwrite(STDERR, print_r($maps, true)."\n");
132 132
 	if ($extra) fwrite(STDERR, "\n\n$extra\n\n");
133 133
 	exit(2);
134 134
 }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
 while (($arg = array_shift($_SERVER['argv'])) && $arg[0] == '-')
139 139
 {
140
-	switch($arg)
140
+	switch ($arg)
141 141
 	{
142 142
 		case '-v': case '--verbose':
143 143
 			$verbose = $log_verbose = true;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 $servers = $clients = $buffers = array();
183 183
 
184 184
 // Create the server socket
185
-foreach($maps as $map => $data)
185
+foreach ($maps as $map => $data)
186 186
 {
187 187
 	$addr = 'tcp://'.$host.':'.$data['port'];
188 188
 	if (!($server = stream_socket_server($addr, $errno, $errstr)))
@@ -198,20 +198,20 @@  discard block
 block discarded – undo
198 198
 {
199 199
 	$read = $servers;
200 200
 	if ($clients) $read = array_merge($read, call_user_func_array('array_merge', array_values($clients)));
201
-	if ($verbose) print 'about to call socket_select(array('.implode(',',$read).', ...) waiting... ';
202
-	if (stream_select($read, $write=null, $except=null, null))	// null = block forever
201
+	if ($verbose) print 'about to call socket_select(array('.implode(',', $read).', ...) waiting... ';
202
+	if (stream_select($read, $write = null, $except = null, null))	// null = block forever
203 203
 	{
204
-		foreach($read as $sock)
204
+		foreach ($read as $sock)
205 205
 		{
206 206
 			if (($port = array_search($sock, $servers)) !== false)
207 207
 			{
208
-				$client = stream_socket_accept($sock,$timeout,$client_addr);	// @ required to get not timeout warning!
208
+				$client = stream_socket_accept($sock, $timeout, $client_addr); // @ required to get not timeout warning!
209 209
 
210 210
 				if ($verbose) echo "accepted connection $client from $client_addr on port $port\n";
211 211
 
212
-				if ($only_client && !preg_match($only_client,$client_addr))
212
+				if ($only_client && !preg_match($only_client, $client_addr))
213 213
 				{
214
-					fwrite($client,"Go away!\r\n");
214
+					fwrite($client, "Go away!\r\n");
215 215
 					fclose($client);
216 216
 					error_log(date('Y-m-d H:i:s').": Connection $client from wrong client $client_addr (does NOT match '$only_client') --> terminated");
217 217
 					continue;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			{
223 223
 				if ($verbose) echo "client $sock closed connection\n";
224 224
 
225
-				foreach($clients as $port => &$socks)
225
+				foreach ($clients as $port => &$socks)
226 226
 				{
227 227
 					if (($key = array_search($sock, $socks, true)) !== false)
228 228
 					{
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			}
233 233
 			else	// client send something
234 234
 			{
235
-				$buffer =& $buffers[$sock];
235
+				$buffer = & $buffers[$sock];
236 236
 
237 237
 				$buffer .= fread($sock, 8096);
238 238
 
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 				{
241 241
 					list($request, $buffer) = explode("\n", $buffer, 2);
242 242
 
243
-					foreach($maps as $map => $data)
243
+					foreach ($maps as $map => $data)
244 244
 					{
245 245
 						if (($key = array_search($sock, $clients[$data['port']], true)) !== false)
246 246
 						{
247 247
 							if ($verbose) echo date('Y-m-d H:i:s').": client send: $request for map $map\n";
248 248
 
249 249
 							// Respond to client
250
-							fwrite($sock,  respond($request, $map));
250
+							fwrite($sock, respond($request, $map));
251 251
 							break;
252 252
 						}
253 253
 					}
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
  */
278 278
 function quote($string)
279 279
 {
280
-	return str_replace(array('\\','*','(',')','\0',' '),array('\\\\','\*','\(','\)','\\0','\20'),$string);
280
+	return str_replace(array('\\', '*', '(', ')', '\0', ' '), array('\\\\', '\*', '\(', '\)', '\\0', '\20'), $string);
281 281
 }
282 282
 
283
-function respond($request, $map, $extra='', $reconnect=false)
283
+function respond($request, $map, $extra = '', $reconnect = false)
284 284
 {
285 285
 	static $ds;
286 286
 	global $ldap_uri, $version, $use_tls, $bind_dn, $bind_pw;
287 287
 	global $maps, $log_verbose;
288 288
 
289
-	if (($map == 'aliases' || $map == 'groups') && strpos($request,'@') === false && !$extra)
289
+	if (($map == 'aliases' || $map == 'groups') && strpos($request, '@') === false && !$extra)
290 290
 	{
291 291
 		return "500 No domain aliases yet\n";
292 292
 	}
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 		{
301 301
 			error_log("$map: Can't connect to LDAP server $ldap_uri!");
302 302
 			$ds = null;
303
-			return "400 Can't connect to LDAP server $ldap_uri!\n";	// 400 (temp.) error
303
+			return "400 Can't connect to LDAP server $ldap_uri!\n"; // 400 (temp.) error
304 304
 		}
305 305
 	}
306 306
 	if (!preg_match('/^get ([^\n]+)\n?$/', $request, $matches))
307 307
 	{
308 308
 		error_log("$map: Wrong format '$request'!");
309
-		return "400 Wrong format '$request'!\n";	// 400 (temp.) error
309
+		return "400 Wrong format '$request'!\n"; // 400 (temp.) error
310 310
 	}
311 311
 	$username = $matches[1];
312 312
 
313
-	list($name,$domain) = explode('@',$username);
313
+	list($name, $domain) = explode('@', $username);
314 314
 
315 315
 	/* check if we are responsible for the given domain
316 316
 	if ($domain && $map != 'domains' && (int)($response = respond("get $domain", 'domains')) != 200)
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	);
325 325
 	$base = strtr($maps[$map]['base'], $replace);
326 326
 	$filter = strtr($maps[$map]['filter'.$extra], $replace);
327
-	$prefix = isset($maps[$map]['prefix'.$extra]) ? str_replace(array('%n','%d','%s'),array($name,$domain,$username),$maps[$map]['prefix']) : '';
327
+	$prefix = isset($maps[$map]['prefix'.$extra]) ? str_replace(array('%n', '%d', '%s'), array($name, $domain, $username), $maps[$map]['prefix']) : '';
328 328
 	$search_attrs = $attrs = (array)$maps[$map]['attrs'.$extra];
329 329
 	// remove prefix like "{smtp:}proxyaddresses"
330
-	foreach($search_attrs as &$attr)
330
+	foreach ($search_attrs as &$attr)
331 331
 	{
332 332
 		if ($attr[0] == '{') list(,$attr) = explode('}', $attr);
333 333
 	}
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 
346 346
 			error_log("$map: get '$username' --> 400 $error: !ldap_search(\$ds, '$base', '$filter')");
347 347
 			ldap_close($ds);
348
-			$ds = null;	// force new connection on next lookup
349
-			return "400 $error\n";	// 400 (temp.) error
348
+			$ds = null; // force new connection on next lookup
349
+			return "400 $error\n"; // 400 (temp.) error
350 350
 		}
351 351
 		else	// happens if base containing domain does not exist
352 352
 		{
353 353
 			if ($log_verbose) error_log("$map: get '$username' --> 500 Not found: $error: !ldap_search(\$ds, '$base', '$filter')");
354
-			return "500 Not found: $error\n";	// 500 not found
354
+			return "500 Not found: $error\n"; // 500 not found
355 355
 		}
356 356
 	}
357 357
 	$entries = ldap_get_entries($ds, $sr);
@@ -359,21 +359,21 @@  discard block
 block discarded – undo
359 359
 	if (!$entries['count'])
360 360
 	{
361 361
 		if ($log_verbose) error_log("$map: get '$username' --> 500 not found ldap_search(\$ds, '$base', '$filter') no entries");
362
-		return "500 Not found\n";	// 500: Query returned no result
362
+		return "500 Not found\n"; // 500: Query returned no result
363 363
 	}
364 364
 	$response = array();
365
-	foreach($entries as $key => $entry)
365
+	foreach ($entries as $key => $entry)
366 366
 	{
367 367
 		if ($key === 'count') continue;
368 368
 
369
-		foreach($attrs as $attr)
369
+		foreach ($attrs as $attr)
370 370
 		{
371 371
 			unset($filter_prefix);
372 372
 			if ($attr[0] == '{')
373 373
 			{
374 374
 				list($filter_prefix, $attr) = explode('}', substr($attr, 1));
375 375
 			}
376
-			foreach((array)$entry[$attr] as $k => $mail)
376
+			foreach ((array)$entry[$attr] as $k => $mail)
377 377
 			{
378 378
 				if ($k !== 'count' && ($mail = trim($mail)))
379 379
 				{
@@ -396,13 +396,13 @@  discard block
 block discarded – undo
396 396
 	if (!$response)
397 397
 	{
398 398
 		if ($log_verbose) error_log("$map: get '$username' --> 500 not found ldap_search(\$ds, '$base', '$filter') no response");
399
-		return "500 Not found\n";	// 500: Query returned no result
399
+		return "500 Not found\n"; // 500: Query returned no result
400 400
 	}
401
-	if (isset($maps[$map]['filter'.(1+$extra)]) && isset($maps[$map]['attrs'.(1+$extra)]))
401
+	if (isset($maps[$map]['filter'.(1 + $extra)]) && isset($maps[$map]['attrs'.(1 + $extra)]))
402 402
 	{
403
-		return respond('get '.$response[0], $map, 1+$extra);
403
+		return respond('get '.$response[0], $map, 1 + $extra);
404 404
 	}
405
-	$response = '200 '.implode(',',$response)."\n";
405
+	$response = '200 '.implode(',', $response)."\n";
406 406
 	if ($log_verbose) error_log("$map: get '$username' --> $response");
407 407
 	return $response;
408 408
 }
Please login to merge, or discard this patch.
Braces   +90 added lines, -23 removed lines patch added patch discarded remove patch
@@ -71,7 +71,10 @@  discard block
 block discarded – undo
71 71
  */
72 72
 
73 73
 // protect from being called via HTTP
74
-if (php_sapi_name() !== 'cli') die('This is a command line only script!');
74
+if (php_sapi_name() !== 'cli')
75
+{
76
+	die('This is a command line only script!');
77
+}
75 78
 
76 79
 // our defaults
77 80
 $default_host = 'localhost';
@@ -122,14 +125,20 @@  discard block
 block discarded – undo
122 125
 
123 126
 ini_set('display_errors',false);
124 127
 error_reporting(E_ALL & ~E_NOTICE);
125
-if ($log) ini_set('error_log',$log);
128
+if ($log)
129
+{
130
+	ini_set('error_log',$log);
131
+}
126 132
 
127 133
 function usage($extra=null)
128 134
 {
129 135
 	global $maps;
130 136
 	fwrite(STDERR, "\nUsage: $cmd [-v|--verbose] [-h|--help] [-l|--log (syslog|path)] [-q|--query <email-addresse> (mailboxes|alias|groups)] [host]\n\n");
131 137
 	fwrite(STDERR, print_r($maps,true)."\n");
132
-	if ($extra) fwrite(STDERR, "\n\n$extra\n\n");
138
+	if ($extra)
139
+	{
140
+		fwrite(STDERR, "\n\n$extra\n\n");
141
+	}
133 142
 	exit(2);
134 143
 }
135 144
 
@@ -152,9 +161,12 @@  discard block
 block discarded – undo
152 161
 			break;
153 162
 
154 163
 		case '-q': case '--query':
155
-			if (count($_SERVER['argv']) == 2)       // need 2 arguments
164
+			if (count($_SERVER['argv']) == 2)
165
+			{
166
+				// need 2 arguments
156 167
 			{
157 168
 				$request = 'get '.array_shift($_SERVER['argv'])."\n";
169
+			}
158 170
 				$map = array_shift($_SERVER['argv']);
159 171
 				echo respond($request, $map)."\n";
160 172
 				exit;
@@ -166,7 +178,10 @@  discard block
 block discarded – undo
166 178
 			usage("Unknown option '$arg'!");
167 179
 	}
168 180
 }
169
-if ($_SERVER['argv']) usage();
181
+if ($_SERVER['argv'])
182
+{
183
+	usage();
184
+}
170 185
 
171 186
 if ($arg)
172 187
 {
@@ -177,7 +192,10 @@  discard block
 block discarded – undo
177 192
 	$host = $default_host;
178 193
 }
179 194
 
180
-if ($verbose) echo "using $host\n";
195
+if ($verbose)
196
+{
197
+	echo "using $host\n";
198
+}
181 199
 
182 200
 $servers = $clients = $buffers = array();
183 201
 
@@ -194,20 +212,36 @@  discard block
 block discarded – undo
194 212
 	$servers[$data['port']] = $server;
195 213
 	$clients[$data['port']] = array();
196 214
 }
197
-while (true)	// mail loop of tcp server --> never exits
215
+while (true)
216
+{
217
+	// mail loop of tcp server --> never exits
198 218
 {
199 219
 	$read = $servers;
200
-	if ($clients) $read = array_merge($read, call_user_func_array('array_merge', array_values($clients)));
201
-	if ($verbose) print 'about to call socket_select(array('.implode(',',$read).', ...) waiting... ';
202
-	if (stream_select($read, $write=null, $except=null, null))	// null = block forever
220
+}
221
+	if ($clients)
222
+	{
223
+		$read = array_merge($read, call_user_func_array('array_merge', array_values($clients)));
224
+	}
225
+	if ($verbose)
226
+	{
227
+		print 'about to call socket_select(array('.implode(',',$read).', ...) waiting... ';
228
+	}
229
+	if (stream_select($read, $write=null, $except=null, null))
230
+	{
231
+		// null = block forever
203 232
 	{
204 233
 		foreach($read as $sock)
205 234
 		{
206 235
 			if (($port = array_search($sock, $servers)) !== false)
207 236
 			{
208
-				$client = stream_socket_accept($sock,$timeout,$client_addr);	// @ required to get not timeout warning!
237
+				$client = stream_socket_accept($sock,$timeout,$client_addr);
238
+	}
239
+	// @ required to get not timeout warning!
209 240
 
210
-				if ($verbose) echo "accepted connection $client from $client_addr on port $port\n";
241
+				if ($verbose)
242
+				{
243
+					echo "accepted connection $client from $client_addr on port $port\n";
244
+				}
211 245
 
212 246
 				if ($only_client && !preg_match($only_client,$client_addr))
213 247
 				{
@@ -218,9 +252,12 @@  discard block
 block discarded – undo
218 252
 				}
219 253
 				$clients[$port][] = $client;
220 254
 			}
221
-			elseif (feof($sock))	// client connection closed
255
+			elseif (feof($sock))
256
+			{
257
+				// client connection closed
222 258
 			{
223 259
 				if ($verbose) echo "client $sock closed connection\n";
260
+			}
224 261
 
225 262
 				foreach($clients as $port => &$socks)
226 263
 				{
@@ -244,7 +281,10 @@  discard block
 block discarded – undo
244 281
 					{
245 282
 						if (($key = array_search($sock, $clients[$data['port']], true)) !== false)
246 283
 						{
247
-							if ($verbose) echo date('Y-m-d H:i:s').": client send: $request for map $map\n";
284
+							if ($verbose)
285
+							{
286
+								echo date('Y-m-d H:i:s').": client send: $request for map $map\n";
287
+							}
248 288
 
249 289
 							// Respond to client
250 290
 							fwrite($sock,  respond($request, $map));
@@ -293,8 +333,14 @@  discard block
 block discarded – undo
293 333
 	if (!isset($ds) || $reconnect)
294 334
 	{
295 335
 		$ds = ldap_connect($ldap_uri);
296
-		if ($version) ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
297
-		if ($use_tls) ldap_start_tls($ds);
336
+		if ($version)
337
+		{
338
+			ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version);
339
+		}
340
+		if ($use_tls)
341
+		{
342
+			ldap_start_tls($ds);
343
+		}
298 344
 
299 345
 		if (!@ldap_bind($ds, $bind_dn, $bind_pw))
300 346
 		{
@@ -329,7 +375,10 @@  discard block
 block discarded – undo
329 375
 	// remove prefix like "{smtp:}proxyaddresses"
330 376
 	foreach($search_attrs as &$attr)
331 377
 	{
332
-		if ($attr[0] == '{') list(,$attr) = explode('}', $attr);
378
+		if ($attr[0] == '{')
379
+		{
380
+			list(,$attr) = explode('}', $attr);
381
+		}
333 382
 	}
334 383
 	unset($attr);
335 384
 
@@ -338,10 +387,13 @@  discard block
 block discarded – undo
338 387
 		$errno = ldap_errno($ds);
339 388
 		$error = ldap_error($ds).' ('.$errno.')';
340 389
 
341
-		if ($errno == -1)		// eg. -1 lost connection to ldap
390
+		if ($errno == -1)
391
+		{
392
+			// eg. -1 lost connection to ldap
342 393
 		{
343 394
 			// as DC closes connections quickly, first try to reconnect once, before returning a temp. failure
344 395
 			if (!$reconnect) return respond($request, $map, $extra, true);
396
+		}
345 397
 
346 398
 			error_log("$map: get '$username' --> 400 $error: !ldap_search(\$ds, '$base', '$filter')");
347 399
 			ldap_close($ds);
@@ -350,7 +402,10 @@  discard block
 block discarded – undo
350 402
 		}
351 403
 		else	// happens if base containing domain does not exist
352 404
 		{
353
-			if ($log_verbose) error_log("$map: get '$username' --> 500 Not found: $error: !ldap_search(\$ds, '$base', '$filter')");
405
+			if ($log_verbose)
406
+			{
407
+				error_log("$map: get '$username' --> 500 Not found: $error: !ldap_search(\$ds, '$base', '$filter')");
408
+			}
354 409
 			return "500 Not found: $error\n";	// 500 not found
355 410
 		}
356 411
 	}
@@ -358,13 +413,19 @@  discard block
 block discarded – undo
358 413
 
359 414
 	if (!$entries['count'])
360 415
 	{
361
-		if ($log_verbose) error_log("$map: get '$username' --> 500 not found ldap_search(\$ds, '$base', '$filter') no entries");
416
+		if ($log_verbose)
417
+		{
418
+			error_log("$map: get '$username' --> 500 not found ldap_search(\$ds, '$base', '$filter') no entries");
419
+		}
362 420
 		return "500 Not found\n";	// 500: Query returned no result
363 421
 	}
364 422
 	$response = array();
365 423
 	foreach($entries as $key => $entry)
366 424
 	{
367
-		if ($key === 'count') continue;
425
+		if ($key === 'count')
426
+		{
427
+			continue;
428
+		}
368 429
 
369 430
 		foreach($attrs as $attr)
370 431
 		{
@@ -395,7 +456,10 @@  discard block
 block discarded – undo
395 456
 	}
396 457
 	if (!$response)
397 458
 	{
398
-		if ($log_verbose) error_log("$map: get '$username' --> 500 not found ldap_search(\$ds, '$base', '$filter') no response");
459
+		if ($log_verbose)
460
+		{
461
+			error_log("$map: get '$username' --> 500 not found ldap_search(\$ds, '$base', '$filter') no response");
462
+		}
399 463
 		return "500 Not found\n";	// 500: Query returned no result
400 464
 	}
401 465
 	if (isset($maps[$map]['filter'.(1+$extra)]) && isset($maps[$map]['attrs'.(1+$extra)]))
@@ -403,6 +467,9 @@  discard block
 block discarded – undo
403 467
 		return respond('get '.$response[0], $map, 1+$extra);
404 468
 	}
405 469
 	$response = '200 '.implode(',',$response)."\n";
406
-	if ($log_verbose) error_log("$map: get '$username' --> $response");
470
+	if ($log_verbose)
471
+	{
472
+		error_log("$map: get '$username' --> $response");
473
+	}
407 474
 	return $response;
408 475
 }
Please login to merge, or discard this patch.
doc/ldap/nis2rfc2307bis.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  * @version $Id: class.accounts.inc.php 22048 2006-07-08 21:41:42Z ralfbecker $
22 22
  */
23 23
 
24
-if ($argc <= 1 || in_array($argv[1],array('-v','--help')) || $argv[1] == '--accounts-dn' && $argc <= 3|| 
25
-	!is_readable($file = $argv[$argc-1]))
24
+if ($argc <= 1 || in_array($argv[1], array('-v', '--help')) || $argv[1] == '--accounts-dn' && $argc <= 3 || 
25
+	!is_readable($file = $argv[$argc - 1]))
26 26
 {
27 27
 	if ($file)
28 28
 	{
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 $lines = file($file);
35
-foreach($lines as $l => $line)
35
+foreach ($lines as $l => $line)
36 36
 {
37 37
 	$lines[$l] = rtrim($line);
38 38
 }
@@ -42,23 +42,23 @@  discard block
 block discarded – undo
42 42
 {
43 43
 	$group2account = $argv[2];
44 44
 }
45
-$parts = explode('/',$group2account);
45
+$parts = explode('/', $group2account);
46 46
 if (count($parts) != 4)
47 47
 {
48 48
 	die("Wrong format for --group2accounts-dn, use something like '/cn=[^,]+,ou=groups/ou=accounts/'\n");
49 49
 }
50 50
 $replace_with = $parts[2]; unset($parts[2]);
51
-$replace = implode('/',$parts);
51
+$replace = implode('/', $parts);
52 52
 
53 53
 $block = array();
54 54
 $i = 0;
55
-$lines[] = '';	// extra empty line, if none is behind the last block
56
-foreach($lines as $l => $line)
55
+$lines[] = ''; // extra empty line, if none is behind the last block
56
+foreach ($lines as $l => $line)
57 57
 {
58 58
 	if ($line)
59 59
 	{
60
-		@list($attr,$value) = explode(': ',$line,2);
61
-		switch($attr)
60
+		@list($attr, $value) = explode(': ', $line, 2);
61
+		switch ($attr)
62 62
 		{
63 63
 			case 'dn':
64 64
 				$dn = $value;
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 				$structural = $value;
71 71
 				break;
72 72
 			case 'memberUid':
73
-				$member_dn = 'uid='.$value.','.preg_replace($replace,$replace_with,$dn);
74
-				if (!in_array('dn: '.$member_dn,$lines)) continue;	// member does not exist --> ignore him!
73
+				$member_dn = 'uid='.$value.','.preg_replace($replace, $replace_with, $dn);
74
+				if (!in_array('dn: '.$member_dn, $lines)) continue; // member does not exist --> ignore him!
75 75
 				$members[] = 'member: '.$member_dn;
76 76
 				// fall-through
77 77
 			default:
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
 	if (!$block) continue;
85 85
 
86 86
 	// got a complete block
87
-	if (in_array('posixGroup',$objectclasses))
87
+	if (in_array('posixGroup', $objectclasses))
88 88
 	{
89
-		switch($structural)
89
+		switch ($structural)
90 90
 		{
91 91
 			case 'namedObject':	// regular SuSE
92
-				unset($objectclasses[array_search('namedObject',$objectclasses)]);
92
+				unset($objectclasses[array_search('namedObject', $objectclasses)]);
93 93
 				// fall-through
94 94
 			case 'posixGroup':	// nis
95 95
 				$objectclasses[] = $structural = 'groupOfNames';
96
-				if (!$members) $members[] = 'member: '.$dn;	// member is a required attribute!
97
-				$data = array_merge($members,$data);
96
+				if (!$members) $members[] = 'member: '.$dn; // member is a required attribute!
97
+				$data = array_merge($members, $data);
98 98
 				break;
99 99
 			case 'groupOfNames':	// ok, already what we want
100 100
 				break;
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 				die("\nposixGroup dn: $dn has as structrualObjectClass $structural, not posixGroup, namedObject or groupOfNames!\n");
103 103
 		}
104 104
 		$block = array('dn: '.$dn,);
105
-		foreach($objectclasses as $class)
105
+		foreach ($objectclasses as $class)
106 106
 		{
107 107
 			$block[] = 'objectClass: '.$class;
108 108
 		}
109 109
 		$block[] = 'structuralObjectClass: '.$class;
110
-		$block = array_merge($block,$data);
110
+		$block = array_merge($block, $data);
111 111
 	}
112
-	echo implode("\n",$block)."\n\n";
112
+	echo implode("\n", $block)."\n\n";
113 113
 
114 114
 	// process next block
115 115
 	$block = $objectclasses = $members = $data = array();
Please login to merge, or discard this patch.
Braces   +14 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,11 @@  discard block
 block discarded – undo
71 71
 				break;
72 72
 			case 'memberUid':
73 73
 				$member_dn = 'uid='.$value.','.preg_replace($replace,$replace_with,$dn);
74
-				if (!in_array('dn: '.$member_dn,$lines)) continue;	// member does not exist --> ignore him!
74
+				if (!in_array('dn: '.$member_dn,$lines))
75
+				{
76
+					continue;
77
+				}
78
+				// member does not exist --> ignore him!
75 79
 				$members[] = 'member: '.$member_dn;
76 80
 				// fall-through
77 81
 			default:
@@ -81,7 +85,10 @@  discard block
 block discarded – undo
81 85
 		$block[] = $line;
82 86
 		continue;
83 87
 	}
84
-	if (!$block) continue;
88
+	if (!$block)
89
+	{
90
+		continue;
91
+	}
85 92
 
86 93
 	// got a complete block
87 94
 	if (in_array('posixGroup',$objectclasses))
@@ -93,7 +100,11 @@  discard block
 block discarded – undo
93 100
 				// fall-through
94 101
 			case 'posixGroup':	// nis
95 102
 				$objectclasses[] = $structural = 'groupOfNames';
96
-				if (!$members) $members[] = 'member: '.$dn;	// member is a required attribute!
103
+				if (!$members)
104
+				{
105
+					$members[] = 'member: '.$dn;
106
+				}
107
+				// member is a required attribute!
97 108
 				$data = array_merge($members,$data);
98 109
 				break;
99 110
 			case 'groupOfNames':	// ok, already what we want
Please login to merge, or discard this patch.