Completed
Push — 16.1 ( 7ccc73...046888 )
by Nathan
64:46 queued 51:15
created
setup/applications.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@
 block discarded – undo
350 350
 			{
351 351
 				echo lang('because it depends upon') . ':<br />' . "\n";
352 352
 				list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False);
353
-                            $depapp_count = count($depapp);
353
+							$depapp_count = count($depapp);
354 354
 				for ($i=0; $i<$depapp_count; $i++)
355 355
 				{
356 356
 					echo '<br />' . $depapp[$i] . ': ';
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -285,7 +285,10 @@
 block discarded – undo
285 285
 				$val = array2string($val);
286 286
 				break;
287 287
 			default:
288
-				if (is_array($val)) $val = implode(', ', $val);
288
+				if (is_array($val))
289
+				{
290
+					$val = implode(', ', $val);
291
+				}
289 292
 				break;
290 293
 		}
291 294
 		$setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]);
Please login to merge, or discard this patch.
Spacing   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -51,36 +51,36 @@  discard block
 block discarded – undo
51 51
 	Api\Csrf::validate($_POST['csrf_token'], __FILE__);
52 52
 }
53 53
 
54
-$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
55
-$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
56
-$setup_tpl->set_block('T_setup_main','header','header');
57
-$setup_tpl->set_block('T_setup_main','app_header','app_header');
58
-$setup_tpl->set_block('T_setup_main','apps','apps');
59
-$setup_tpl->set_block('T_setup_main','detail','detail');
60
-$setup_tpl->set_block('T_setup_main','table','table');
61
-$setup_tpl->set_block('T_setup_main','hook','hook');
62
-$setup_tpl->set_block('T_setup_main','dep','dep');
63
-$setup_tpl->set_block('T_setup_main','app_footer','app_footer');
64
-$setup_tpl->set_block('T_setup_main','submit','submit');
65
-$setup_tpl->set_block('T_setup_main','footer','footer');
66
-
67
-$bgcolor = array('#DDDDDD','#EEEEEE');
68
-
69
-function parsedep($depends,$main=True)
54
+$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain');
55
+$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain');
56
+$setup_tpl->set_block('T_setup_main', 'header', 'header');
57
+$setup_tpl->set_block('T_setup_main', 'app_header', 'app_header');
58
+$setup_tpl->set_block('T_setup_main', 'apps', 'apps');
59
+$setup_tpl->set_block('T_setup_main', 'detail', 'detail');
60
+$setup_tpl->set_block('T_setup_main', 'table', 'table');
61
+$setup_tpl->set_block('T_setup_main', 'hook', 'hook');
62
+$setup_tpl->set_block('T_setup_main', 'dep', 'dep');
63
+$setup_tpl->set_block('T_setup_main', 'app_footer', 'app_footer');
64
+$setup_tpl->set_block('T_setup_main', 'submit', 'submit');
65
+$setup_tpl->set_block('T_setup_main', 'footer', 'footer');
66
+
67
+$bgcolor = array('#DDDDDD', '#EEEEEE');
68
+
69
+function parsedep($depends, $main = True)
70 70
 {
71 71
 	$depstring = '(';
72
-	foreach($depends as $b)
72
+	foreach ($depends as $b)
73 73
 	{
74
-		foreach($b as $c => $d)
74
+		foreach ($b as $c => $d)
75 75
 		{
76 76
 			if (is_array($d))
77 77
 			{
78
-				$depstring .= $c . ': ' .implode(',',$d) . '; ';
78
+				$depstring .= $c.': '.implode(',', $d).'; ';
79 79
 				$depver[] = $d;
80 80
 			}
81 81
 			else
82 82
 			{
83
-				$depstring .= $c . ': ' . $d . '; ';
83
+				$depstring .= $c.': '.$d.'; ';
84 84
 				$depapp[] = $d;
85 85
 			}
86 86
 		}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 	else
94 94
 	{
95
-		return array($depapp,$depver);
95
+		return array($depapp, $depver);
96 96
 	}
97 97
 }
98 98
 
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 
107 107
 @ksort($setup_info);
108 108
 
109
-if(@$_POST['cancel'])
109
+if (@$_POST['cancel'])
110 110
 {
111 111
 	Header("Location: index.php");
112 112
 	exit;
113 113
 }
114 114
 
115
-if(@$_POST['submit'])
115
+if (@$_POST['submit'])
116 116
 {
117
-	$GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')');
118
-	$setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':');
119
-	$setup_tpl->pparse('out','header');
117
+	$GLOBALS['egw_setup']->html->show_header(lang('Application Management'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')');
118
+	$setup_tpl->set_var('description', lang('App install/remove/upgrade').':');
119
+	$setup_tpl->pparse('out', 'header');
120 120
 
121 121
 	$appname = $_POST['appname'];
122 122
 	$remove  = $_POST['remove'];
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 
126 126
 	$register_hooks = false;
127 127
 
128
-	if(!empty($remove) && is_array($remove))
128
+	if (!empty($remove) && is_array($remove))
129 129
 	{
130 130
 		$historylog = new Api\Storage\History();
131 131
 		$historylog->db = $GLOBALS['egw_setup']->db;
132 132
 
133
-		foreach($remove as $appname => $key)
133
+		foreach ($remove as $appname => $key)
134 134
 		{
135 135
 			$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
136 136
 			$terror = array();
@@ -138,30 +138,30 @@  discard block
 block discarded – undo
138 138
 
139 139
 			if ($setup_info[$appname]['tables'])
140 140
 			{
141
-				$GLOBALS['egw_setup']->process->droptables($terror,$DEBUG);
142
-				echo '<br />' . $app_title . ' ' . lang('tables dropped') . '.';
141
+				$GLOBALS['egw_setup']->process->droptables($terror, $DEBUG);
142
+				echo '<br />'.$app_title.' '.lang('tables dropped').'.';
143 143
 			}
144 144
 
145 145
 			$GLOBALS['egw_setup']->deregister_app($setup_info[$appname]['name']);
146
-			echo '<br />' . $app_title . ' ' . lang('deregistered') . '.';
146
+			echo '<br />'.$app_title.' '.lang('deregistered').'.';
147 147
 
148 148
 			$register_hooks = true;
149 149
 
150 150
 			$historylog->appname = $appname;
151 151
 			if ($historylog->delete(null))
152 152
 			{
153
-				echo '<br />' . $app_title . ' ' . lang('Historylog removed') . '.';
153
+				echo '<br />'.$app_title.' '.lang('Historylog removed').'.';
154 154
 			}
155 155
 
156 156
 			// delete all application categories and ACL
157
-			$GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->cats_table,array('cat_appname' => $appname),__LINE__,__FILE__);
158
-			$GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->acl_table,array('acl_appname' => $appname),__LINE__,__FILE__);
157
+			$GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->cats_table, array('cat_appname' => $appname), __LINE__, __FILE__);
158
+			$GLOBALS['egw_setup']->db->delete($GLOBALS['egw_setup']->acl_table, array('acl_appname' => $appname), __LINE__, __FILE__);
159 159
 		}
160 160
 	}
161 161
 
162
-	if(!empty($install) && is_array($install))
162
+	if (!empty($install) && is_array($install))
163 163
 	{
164
-		foreach($install as $appname => $key)
164
+		foreach ($install as $appname => $key)
165 165
 		{
166 166
 			$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
167 167
 			$terror = array();
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 			{
172 172
 				$terror_c = $GLOBALS['egw_setup']->process->current($terror, $DEBUG);
173 173
 				$terror = $GLOBALS['egw_setup']->process->default_records($terror_c, $DEBUG);
174
-				echo '<br />' . $app_title . ' '
175
-					. lang('tables installed, unless there are errors printed above') . '.';
174
+				echo '<br />'.$app_title.' '
175
+					. lang('tables installed, unless there are errors printed above').'.';
176 176
 			}
177 177
 			else
178 178
 			{
179 179
 				// check default_records for apps without tables, they might need some initial work too
180
-				$terror = $GLOBALS['egw_setup']->process->default_records($terror,$DEBUG);
180
+				$terror = $GLOBALS['egw_setup']->process->default_records($terror, $DEBUG);
181 181
 				if ($GLOBALS['egw_setup']->app_registered($setup_info[$appname]['name']))
182 182
 				{
183 183
 					$GLOBALS['egw_setup']->update_app($setup_info[$appname]['name']);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				{
187 187
 					$GLOBALS['egw_setup']->register_app($setup_info[$appname]['name']);
188 188
 				}
189
-				echo '<br />' . $app_title . ' ' . lang('registered') . '.';
189
+				echo '<br />'.$app_title.' '.lang('registered').'.';
190 190
 
191 191
 				if ($setup_info[$appname]['hooks'])
192 192
 				{
@@ -196,23 +196,23 @@  discard block
 block discarded – undo
196 196
 		}
197 197
 	}
198 198
 
199
-	if(!empty($upgrade) && is_array($upgrade))
199
+	if (!empty($upgrade) && is_array($upgrade))
200 200
 	{
201
-		foreach($upgrade as $appname => $key)
201
+		foreach ($upgrade as $appname => $key)
202 202
 		{
203 203
 			$app_title = $setup_info[$appname]['title'] ? $setup_info[$appname]['title'] : $setup_info[$appname]['name'];
204 204
 			$terror = array();
205 205
 			$terror[$appname] = $setup_info[$appname];
206 206
 
207
-			$GLOBALS['egw_setup']->process->upgrade($terror,$DEBUG);
207
+			$GLOBALS['egw_setup']->process->upgrade($terror, $DEBUG);
208 208
 			if ($setup_info[$appname]['tables'])
209 209
 			{
210
-				echo '<br />' . $app_title . ' ' . lang('tables upgraded') . '.';
210
+				echo '<br />'.$app_title.' '.lang('tables upgraded').'.';
211 211
 				// The process_upgrade() function also handles registration
212 212
 			}
213 213
 			else
214 214
 			{
215
-				echo '<br />' . $app_title . ' ' . lang('upgraded') . '.';
215
+				echo '<br />'.$app_title.' '.lang('upgraded').'.';
216 216
 			}
217 217
 			$register_hooks = true;
218 218
 		}
@@ -221,61 +221,61 @@  discard block
 block discarded – undo
221 221
 	if ($register_hooks)
222 222
 	{
223 223
 		Api\Hooks::read(true);
224
-		echo '<br />' . $app_title . ' ' . lang('hooks registered') . '.';
224
+		echo '<br />'.$app_title.' '.lang('hooks registered').'.';
225 225
 	}
226 226
 
227 227
 	//$setup_tpl->set_var('goback',
228
-	echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>';
228
+	echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>';
229 229
 	//$setup_tpl->pparse('out','submit');
230
-	$setup_tpl->pparse('out','footer');
230
+	$setup_tpl->pparse('out', 'footer');
231 231
 	exit;
232 232
 }
233 233
 else
234 234
 {
235
-	$GLOBALS['egw_setup']->html->show_header(lang('Application Management'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')');
235
+	$GLOBALS['egw_setup']->html->show_header(lang('Application Management'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')');
236 236
 }
237 237
 
238
-if(@$_GET['hooks'])
238
+if (@$_GET['hooks'])
239 239
 {
240 240
 	Api\Cache::flush(Api\Cache::INSTANCE);
241 241
 
242
-	echo lang('Cached cleared') . '<br />';
242
+	echo lang('Cached cleared').'<br />';
243 243
 }
244 244
 $detail = $_GET['detail'];
245 245
 $resolve = $_GET['resolve'];
246
-if(@$detail)
246
+if (@$detail)
247 247
 {
248 248
 	@ksort($setup_info[$detail]);
249
-	$setup_tpl->set_var('description',lang('App details') . ':');
250
-	$setup_tpl->pparse('out','header');
249
+	$setup_tpl->set_var('description', lang('App details').':');
250
+	$setup_tpl->pparse('out', 'header');
251 251
 
252
-	$setup_tpl->set_var('name','application');
252
+	$setup_tpl->set_var('name', 'application');
253 253
 	$setup_tpl->set_var('details', lang($setup_info[$detail]['title']));
254
-	$setup_tpl->pparse('out','detail');
254
+	$setup_tpl->pparse('out', 'detail');
255 255
 
256
-	foreach($setup_info[$detail] as $key => $val)
256
+	foreach ($setup_info[$detail] as $key => $val)
257 257
 	{
258
-		switch($key)
258
+		switch ($key)
259 259
 		{
260 260
 			case 'title':
261 261
 				continue 2;
262 262
 			case 'tables':
263 263
 				$tblcnt = count($setup_info[$detail][$key]);
264
-				if(is_array($val))
264
+				if (is_array($val))
265 265
 				{
266
-					$key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True&apps=True">' . $key . '(' . $tblcnt . ')</a>' . "\n";
267
-					$val = implode(',' . "\n",$val);
266
+					$key = '<a href="sqltoarray.php?appname='.$detail.'&submit=True&apps=True">'.$key.'('.$tblcnt.')</a>'."\n";
267
+					$val = implode(','."\n", $val);
268 268
 				}
269 269
 				break;
270 270
 			case 'hooks':
271
-				foreach($val as &$hooks)
271
+				foreach ($val as &$hooks)
272 272
 				{
273 273
 					$hooks = (array)$hooks;
274 274
 				}
275 275
 				$val = str_replace('EGroupware\\', '', implode(', ', call_user_func_array('array_merge', $val)));
276 276
 				break;
277 277
 			case 'depends':
278
-				foreach($val as &$dep)
278
+				foreach ($val as &$dep)
279 279
 				{
280 280
 					$dep = $dep['appname'].': '.implode(', ', $dep['versions']);
281 281
 				}
@@ -288,174 +288,174 @@  discard block
 block discarded – undo
288 288
 				if (is_array($val)) $val = implode(', ', $val);
289 289
 				break;
290 290
 		}
291
-		$setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]);
292
-		$setup_tpl->set_var('name',$key);
293
-		$setup_tpl->set_var('details',$val);
294
-		$setup_tpl->pparse('out','detail');
291
+		$setup_tpl->set_var('bg_color', $bgcolor[++$i&1]);
292
+		$setup_tpl->set_var('name', $key);
293
+		$setup_tpl->set_var('details', $val);
294
+		$setup_tpl->pparse('out', 'detail');
295 295
 	}
296 296
 
297
-	echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>';
298
-	$setup_tpl->pparse('out','footer');
297
+	echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>';
298
+	$setup_tpl->pparse('out', 'footer');
299 299
 	exit;
300 300
 }
301 301
 elseif (@$resolve)
302 302
 {
303 303
 	$version  = $_GET['version'];
304 304
 	$notables = $_GET['notables'];
305
-	$setup_tpl->set_var('description',lang('Problem resolution'). ':');
306
-	$setup_tpl->pparse('out','header');
305
+	$setup_tpl->set_var('description', lang('Problem resolution').':');
306
+	$setup_tpl->pparse('out', 'header');
307 307
 	$app_title = $setup_info[$resolve]['title'] ? $setup_info[$resolve]['title'] : $setup_info[$resolve]['name'];
308 308
 
309
-	if($_GET['post'])
309
+	if ($_GET['post'])
310 310
 	{
311
-		echo '"' . $app_title . '" ' . lang('may be broken') . ' ';
311
+		echo '"'.$app_title.'" '.lang('may be broken').' ';
312 312
 		echo lang('because an application it depends upon was upgraded');
313 313
 		echo '<br />';
314
-		echo lang('to a version it does not know about') . '.';
314
+		echo lang('to a version it does not know about').'.';
315 315
 		echo '<br />';
316
-		echo lang('However, the application may still work') . '.';
316
+		echo lang('However, the application may still work').'.';
317 317
 	}
318
-	elseif($_GET['badinstall'])
318
+	elseif ($_GET['badinstall'])
319 319
 	{
320
-		echo '"' . $app_title . '" ' . lang('is broken') . ' ';
321
-		echo lang('because of a failed upgrade or install') . '.';
320
+		echo '"'.$app_title.'" '.lang('is broken').' ';
321
+		echo lang('because of a failed upgrade or install').'.';
322 322
 		echo '<br />';
323
-		echo lang('Some or all of its tables are missing') . '.';
323
+		echo lang('Some or all of its tables are missing').'.';
324 324
 		echo '<br />';
325
-		echo lang('You should either uninstall and then reinstall it, or attempt manual repairs') . '.';
325
+		echo lang('You should either uninstall and then reinstall it, or attempt manual repairs').'.';
326 326
 	}
327
-	elseif($_GET['deleted'])
327
+	elseif ($_GET['deleted'])
328 328
 	{
329
-		echo '"' . $app_title . '" ' . lang('is broken') . ' ';
330
-		echo lang('because its sources are missing') . '!';
329
+		echo '"'.$app_title.'" '.lang('is broken').' ';
330
+		echo lang('because its sources are missing').'!';
331 331
 		echo '<br />';
332
-		echo lang('However the tables are still in the database') . '.';
332
+		echo lang('However the tables are still in the database').'.';
333 333
 		echo '<br />';
334
-		echo lang('You should either install the sources or uninstall it, to get rid of the tables') . '.';
334
+		echo lang('You should either install the sources or uninstall it, to get rid of the tables').'.';
335 335
 	}
336 336
 	elseif (!$version)
337 337
 	{
338
-		if($setup_info[$resolve]['enabled'])
338
+		if ($setup_info[$resolve]['enabled'])
339 339
 		{
340
-			echo '"' . $app_title . '" ' . lang('is broken') . ' ';
340
+			echo '"'.$app_title.'" '.lang('is broken').' ';
341 341
 		}
342 342
 		else
343 343
 		{
344
-			echo '"' . $app_title . '" ' . lang('is disabled') . ' ';
344
+			echo '"'.$app_title.'" '.lang('is disabled').' ';
345 345
 		}
346 346
 
347 347
 		if (!$notables)
348 348
 		{
349
-			if($setup_info[$resolve]['status'] == 'D')
349
+			if ($setup_info[$resolve]['status'] == 'D')
350 350
 			{
351
-				echo lang('because it depends upon') . ':<br />' . "\n";
352
-				list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False);
351
+				echo lang('because it depends upon').':<br />'."\n";
352
+				list($depapp, $depver) = parsedep($setup_info[$resolve]['depends'], False);
353 353
                             $depapp_count = count($depapp);
354
-				for ($i=0; $i<$depapp_count; $i++)
354
+				for ($i = 0; $i < $depapp_count; $i++)
355 355
 				{
356
-					echo '<br />' . $depapp[$i] . ': ';
356
+					echo '<br />'.$depapp[$i].': ';
357 357
 					$list = '';
358
-					foreach($depver[$i] as $x => $y)
358
+					foreach ($depver[$i] as $x => $y)
359 359
 					{
360
-						$list .= $y . ', ';
360
+						$list .= $y.', ';
361 361
 					}
362
-					echo substr($list,0,-2)."\n";
362
+					echo substr($list, 0, -2)."\n";
363 363
 				}
364
-				echo '<br /><br />' . lang('The table definition was correct, and the tables were installed') . '.';
364
+				echo '<br /><br />'.lang('The table definition was correct, and the tables were installed').'.';
365 365
 			}
366 366
 			else
367 367
 			{
368
-				echo lang('because it was manually disabled') . '.';
368
+				echo lang('because it was manually disabled').'.';
369 369
 			}
370 370
 		}
371
-		elseif($setup_info[$resolve]['enable'] == 2)
371
+		elseif ($setup_info[$resolve]['enable'] == 2)
372 372
 		{
373
-			echo lang('because it is not a user application, or access is controlled via acl') . '.';
373
+			echo lang('because it is not a user application, or access is controlled via acl').'.';
374 374
 		}
375
-		elseif($setup_info[$resolve]['enable'] == 0)
375
+		elseif ($setup_info[$resolve]['enable'] == 0)
376 376
 		{
377
-			echo lang('because the enable flag for this app is set to 0, or is undefined') . '.';
377
+			echo lang('because the enable flag for this app is set to 0, or is undefined').'.';
378 378
 		}
379 379
 		else
380 380
 		{
381
-			echo lang('because it requires manual table installation, <br />or the table definition was incorrect') . ".\n"
382
-				. lang("Please check for sql scripts within the application's directory") . '.';
381
+			echo lang('because it requires manual table installation, <br />or the table definition was incorrect').".\n"
382
+				. lang("Please check for sql scripts within the application's directory").'.';
383 383
 		}
384
-		echo '<br />' . lang('However, the application is otherwise installed') . '.';
384
+		echo '<br />'.lang('However, the application is otherwise installed').'.';
385 385
 	}
386 386
 	else
387 387
 	{
388
-		echo $app_title . ' ' . lang('has a version mismatch') . ' ';
389
-		echo lang('because of a failed upgrade, or the database is newer than the installed version of this app') . '.';
388
+		echo $app_title.' '.lang('has a version mismatch').' ';
389
+		echo lang('because of a failed upgrade, or the database is newer than the installed version of this app').'.';
390 390
 		echo '<br />';
391
-		echo lang('If the application has no defined tables, selecting upgrade should remedy the problem') . '.';
392
-		echo '<br />' . lang('However, the application is otherwise installed') . '.';
391
+		echo lang('If the application has no defined tables, selecting upgrade should remedy the problem').'.';
392
+		echo '<br />'.lang('However, the application is otherwise installed').'.';
393 393
 	}
394 394
 
395
-	echo '<br /><a href="applications.php?debug='.$DEBUG.'">' . lang('Go back') . '</a>';
396
-	$setup_tpl->pparse('out','footer');
395
+	echo '<br /><a href="applications.php?debug='.$DEBUG.'">'.lang('Go back').'</a>';
396
+	$setup_tpl->pparse('out', 'footer');
397 397
 	exit;
398 398
 }
399 399
 else
400 400
 {
401
-	$setup_tpl->set_var('description',lang('Select the desired action(s) from the available choices'));
402
-	$setup_tpl->set_var('action_url','applications.php');
403
-	$setup_tpl->pparse('out','header');
404
-
405
-	$setup_tpl->set_var('appdata',lang('Application Data'));
406
-	$setup_tpl->set_var('actions',lang('Actions'));
407
-	$setup_tpl->set_var('app_info',lang('Application Name and Status Information'));
408
-	$setup_tpl->set_var('app_title',lang('Application Title'));
409
-	$setup_tpl->set_var('app_currentver',lang('Current Version'));
410
-	$setup_tpl->set_var('app_version',lang('Available Version'));
411
-	$setup_tpl->set_var('app_install',lang('Install'));
412
-	$setup_tpl->set_var('app_remove',lang('Remove'));
413
-	$setup_tpl->set_var('app_upgrade',lang('Upgrade'));
414
-	$setup_tpl->set_var('app_resolve',lang('Resolve'));
415
-	$setup_tpl->set_var('check','check.png');
416
-	$setup_tpl->set_var('install_all',lang('Install All'));
417
-	$setup_tpl->set_var('upgrade_all',lang('Upgrade All'));
418
-	$setup_tpl->set_var('remove_all',lang('Remove All'));
419
-	$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
420
-	$setup_tpl->set_var('debug','<input type="checkbox" name="debug" value="True"' .($DEBUG ? ' checked="checked"' : '') . ' />');
421
-	$setup_tpl->set_var('bg_color',$bgcolor[0]);
422
-
423
-	$setup_tpl->pparse('out','app_header');
401
+	$setup_tpl->set_var('description', lang('Select the desired action(s) from the available choices'));
402
+	$setup_tpl->set_var('action_url', 'applications.php');
403
+	$setup_tpl->pparse('out', 'header');
404
+
405
+	$setup_tpl->set_var('appdata', lang('Application Data'));
406
+	$setup_tpl->set_var('actions', lang('Actions'));
407
+	$setup_tpl->set_var('app_info', lang('Application Name and Status Information'));
408
+	$setup_tpl->set_var('app_title', lang('Application Title'));
409
+	$setup_tpl->set_var('app_currentver', lang('Current Version'));
410
+	$setup_tpl->set_var('app_version', lang('Available Version'));
411
+	$setup_tpl->set_var('app_install', lang('Install'));
412
+	$setup_tpl->set_var('app_remove', lang('Remove'));
413
+	$setup_tpl->set_var('app_upgrade', lang('Upgrade'));
414
+	$setup_tpl->set_var('app_resolve', lang('Resolve'));
415
+	$setup_tpl->set_var('check', 'check.png');
416
+	$setup_tpl->set_var('install_all', lang('Install All'));
417
+	$setup_tpl->set_var('upgrade_all', lang('Upgrade All'));
418
+	$setup_tpl->set_var('remove_all', lang('Remove All'));
419
+	$setup_tpl->set_var('lang_debug', lang('enable for extra debug-messages'));
420
+	$setup_tpl->set_var('debug', '<input type="checkbox" name="debug" value="True"'.($DEBUG ? ' checked="checked"' : '').' />');
421
+	$setup_tpl->set_var('bg_color', $bgcolor[0]);
422
+
423
+	$setup_tpl->pparse('out', 'app_header');
424 424
 
425 425
 	$i = 0;
426
-	foreach($setup_info as $key => $value)
426
+	foreach ($setup_info as $key => $value)
427 427
 	{
428
-		if(@$value['name'])
428
+		if (@$value['name'])
429 429
 		{
430 430
 			$i = ($i ? 0 : 1);
431
-			$setup_tpl->set_var('apptitle',$value['title']?$value['title']:lang($value['name']));
432
-			$setup_tpl->set_var('currentver',@$value['currentver']);
433
-			$setup_tpl->set_var('version',$value['version']);
434
-			$setup_tpl->set_var('bg_color',$bgcolor[$i]);
431
+			$setup_tpl->set_var('apptitle', $value['title'] ? $value['title'] : lang($value['name']));
432
+			$setup_tpl->set_var('currentver', @$value['currentver']);
433
+			$setup_tpl->set_var('version', $value['version']);
434
+			$setup_tpl->set_var('bg_color', $bgcolor[$i]);
435 435
 
436
-			switch($value['status'])
436
+			switch ($value['status'])
437 437
 			{
438 438
 				case 'C':
439
-					$setup_tpl->set_var('remove', $key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
440
-					$setup_tpl->set_var('upgrade','&nbsp;');
439
+					$setup_tpl->set_var('remove', $key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove['.$value['name'].']" />');
440
+					$setup_tpl->set_var('upgrade', '&nbsp;');
441 441
 					if (!$GLOBALS['egw_setup']->detection->check_app_tables($value['name']))
442 442
 					{
443 443
 						// App installed and enabled, but some tables are missing
444
-						$setup_tpl->set_var('instimg','table.png');
445
-						$setup_tpl->set_var('bg_color','FFCCAA');
446
-						$setup_tpl->set_var('instalt',lang('Not Completed'));
447
-						$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>');
448
-						$status = lang('Requires reinstall or manual repair') . ' - ' . $value['status'];
444
+						$setup_tpl->set_var('instimg', 'table.png');
445
+						$setup_tpl->set_var('bg_color', 'FFCCAA');
446
+						$setup_tpl->set_var('instalt', lang('Not Completed'));
447
+						$setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&badinstall=True">'.lang('Potential Problem').'</a>');
448
+						$status = lang('Requires reinstall or manual repair').' - '.$value['status'];
449 449
 					}
450 450
 					else
451 451
 					{
452
-						$setup_tpl->set_var('instimg','completed.png');
453
-						$setup_tpl->set_var('instalt',lang('Completed'));
454
-						$setup_tpl->set_var('install','&nbsp;');
455
-						if($value['enabled'])
452
+						$setup_tpl->set_var('instimg', 'completed.png');
453
+						$setup_tpl->set_var('instalt', lang('Completed'));
454
+						$setup_tpl->set_var('install', '&nbsp;');
455
+						if ($value['enabled'])
456 456
 						{
457
-							$setup_tpl->set_var('resolution','');
458
-							$status = lang('OK') . ' - ' . $value['status'];
457
+							$setup_tpl->set_var('resolution', '');
458
+							$status = lang('OK').' - '.$value['status'];
459 459
 						}
460 460
 						else
461 461
 						{
@@ -463,123 +463,123 @@  discard block
 block discarded – undo
463 463
 							{
464 464
 								$notables = '&notables=True';
465 465
 							}
466
-							$setup_tpl->set_var('bg_color','CCCCFF');
466
+							$setup_tpl->set_var('bg_color', 'CCCCFF');
467 467
 							$setup_tpl->set_var('resolution',
468
-								'<a href="applications.php?resolve=' . $value['name'] .  $notables . '">' . lang('Possible Reasons') . '</a>'
468
+								'<a href="applications.php?resolve='.$value['name'].$notables.'">'.lang('Possible Reasons').'</a>'
469 469
 							);
470
-							$status = lang('Disabled') . ' - ' . $value['status'];
470
+							$status = lang('Disabled').' - '.$value['status'];
471 471
 						}
472 472
 					}
473 473
 					break;
474 474
 				case 'U':
475
-					$setup_tpl->set_var('instimg','incomplete.png');
476
-					$setup_tpl->set_var('instalt',lang('Not Completed'));
475
+					$setup_tpl->set_var('instimg', 'incomplete.png');
476
+					$setup_tpl->set_var('instalt', lang('Not Completed'));
477 477
 					if (!@$value['currentver'])
478 478
 					{
479
-						if ($value['tables'] && $GLOBALS['egw_setup']->detection->check_app_tables($value['name'],True))
479
+						if ($value['tables'] && $GLOBALS['egw_setup']->detection->check_app_tables($value['name'], True))
480 480
 						{
481 481
 							// Some tables missing
482
-							$setup_tpl->set_var('remove',$key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
483
-							$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>');
484
-							$status = lang('Requires reinstall or manual repair') . ' - ' . $value['status'];
482
+							$setup_tpl->set_var('remove', $key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove['.$value['name'].']" />');
483
+							$setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&badinstall=True">'.lang('Potential Problem').'</a>');
484
+							$status = lang('Requires reinstall or manual repair').' - '.$value['status'];
485 485
 						}
486 486
 						else
487 487
 						{
488
-							$setup_tpl->set_var('remove','&nbsp;');
489
-							$setup_tpl->set_var('resolution','');
490
-							$status = lang('Requires upgrade') . ' - ' . $value['status'];
488
+							$setup_tpl->set_var('remove', '&nbsp;');
489
+							$setup_tpl->set_var('resolution', '');
490
+							$status = lang('Requires upgrade').' - '.$value['status'];
491 491
 						}
492 492
 						// show not installed apps without icon
493
-						$setup_tpl->set_var('instimg','spacer.png');
494
-						$setup_tpl->set_var('instalt','');
495
-						$setup_tpl->set_var('bg_color','CCFFCC');
496
-						$setup_tpl->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']" />');
497
-						$setup_tpl->set_var('upgrade','&nbsp;');
498
-						$status = lang('Please install') . ' - ' . $value['status'];
493
+						$setup_tpl->set_var('instimg', 'spacer.png');
494
+						$setup_tpl->set_var('instalt', '');
495
+						$setup_tpl->set_var('bg_color', 'CCFFCC');
496
+						$setup_tpl->set_var('install', '<input type="checkbox" name="install['.$value['name'].']" />');
497
+						$setup_tpl->set_var('upgrade', '&nbsp;');
498
+						$status = lang('Please install').' - '.$value['status'];
499 499
 					}
500 500
 					else
501 501
 					{
502
-						$setup_tpl->set_var('bg_color','CCCCFF');
503
-						$setup_tpl->set_var('install','&nbsp;');
502
+						$setup_tpl->set_var('bg_color', 'CCCCFF');
503
+						$setup_tpl->set_var('install', '&nbsp;');
504 504
 						// TODO display some info about breakage if you mess with this app
505
-						$setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />');
506
-						$setup_tpl->set_var('remove',$key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
507
-						$setup_tpl->set_var('resolution','');
508
-						$status = lang('Requires upgrade') . ' - ' . $value['status'];
505
+						$setup_tpl->set_var('upgrade', '<input type="checkbox" name="upgrade['.$value['name'].']" />');
506
+						$setup_tpl->set_var('remove', $key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove['.$value['name'].']" />');
507
+						$setup_tpl->set_var('resolution', '');
508
+						$status = lang('Requires upgrade').' - '.$value['status'];
509 509
 					}
510 510
 					break;
511 511
 				case 'V':
512
-					$setup_tpl->set_var('instimg','incomplete.png');
513
-					$setup_tpl->set_var('instalt',lang('Not Completed'));
514
-					$setup_tpl->set_var('install','&nbsp;');
515
-					$setup_tpl->set_var('remove',$key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
512
+					$setup_tpl->set_var('instimg', 'incomplete.png');
513
+					$setup_tpl->set_var('instalt', lang('Not Completed'));
514
+					$setup_tpl->set_var('install', '&nbsp;');
515
+					$setup_tpl->set_var('remove', $key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove['.$value['name'].']" />');
516 516
 					if ($value['version'] == 'deleted')
517 517
 					{
518
-						$setup_tpl->set_var('bg_color','CCAAAA');
519
-						$setup_tpl->set_var('upgrade','&nbsp;');
520
-						$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&deleted=True">' . lang('Possible Solutions') . '</a>');
521
-						$status = lang('Sources deleted/missing') . ' - ' . $value['status'];
518
+						$setup_tpl->set_var('bg_color', 'CCAAAA');
519
+						$setup_tpl->set_var('upgrade', '&nbsp;');
520
+						$setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&deleted=True">'.lang('Possible Solutions').'</a>');
521
+						$status = lang('Sources deleted/missing').' - '.$value['status'];
522 522
 					}
523 523
 					else
524 524
 					{
525
-						$setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']" />');
526
-						$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&version=True">' . lang('Possible Solutions') . '</a>');
527
-						$status = lang('Version Mismatch') . ' - ' . $value['status'];
525
+						$setup_tpl->set_var('upgrade', '<input type="checkbox" name="upgrade['.$value['name'].']" />');
526
+						$setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&version=True">'.lang('Possible Solutions').'</a>');
527
+						$status = lang('Version Mismatch').' - '.$value['status'];
528 528
 					}
529 529
 					break;
530 530
 				case 'D':
531
-					$setup_tpl->set_var('bg_color','FFCCCC');
531
+					$setup_tpl->set_var('bg_color', 'FFCCCC');
532 532
 					$depstring = parsedep($value['depends']);
533 533
 					$depstring .= ')';
534
-					$setup_tpl->set_var('instimg','dep.png');
535
-					$setup_tpl->set_var('instalt',lang('Dependency Failure'));
536
-					$setup_tpl->set_var('install','&nbsp;');
534
+					$setup_tpl->set_var('instimg', 'dep.png');
535
+					$setup_tpl->set_var('instalt', lang('Dependency Failure'));
536
+					$setup_tpl->set_var('install', '&nbsp;');
537 537
 					if ($values['currentver'])
538 538
 					{
539
-						$setup_tpl->set_var('remove',$key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
540
-						$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>');
539
+						$setup_tpl->set_var('remove', $key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove['.$value['name'].']" />');
540
+						$setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'">'.lang('Possible Solutions').'</a>');
541 541
 					}
542 542
 					else
543 543
 					{
544
-						$setup_tpl->set_var('remove','&nbsp;');
545
-						$setup_tpl->set_var('resolution','&nbsp;');
544
+						$setup_tpl->set_var('remove', '&nbsp;');
545
+						$setup_tpl->set_var('resolution', '&nbsp;');
546 546
 					}
547
-					$setup_tpl->set_var('upgrade','&nbsp;');
548
-					$status = lang('Dependency Failure') . ':' . $depstring . $value['status'];
547
+					$setup_tpl->set_var('upgrade', '&nbsp;');
548
+					$status = lang('Dependency Failure').':'.$depstring.$value['status'];
549 549
 					break;
550 550
 				case 'P':
551
-					$setup_tpl->set_var('bg_color','FFCCFF');
551
+					$setup_tpl->set_var('bg_color', 'FFCCFF');
552 552
 					$depstring = parsedep($value['depends']);
553 553
 					$depstring .= ')';
554
-					$setup_tpl->set_var('instimg','dep.png');
555
-					$setup_tpl->set_var('instalt',lang('Post-install Dependency Failure'));
556
-					$setup_tpl->set_var('install','&nbsp;');
557
-					$setup_tpl->set_var('remove','&nbsp;');
558
-					$setup_tpl->set_var('upgrade','&nbsp;');
559
-					$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&post=True">' . lang('Possible Solutions') . '</a>');
560
-					$status = lang('Post-install Dependency Failure') . ':' . $depstring . $value['status'];
554
+					$setup_tpl->set_var('instimg', 'dep.png');
555
+					$setup_tpl->set_var('instalt', lang('Post-install Dependency Failure'));
556
+					$setup_tpl->set_var('install', '&nbsp;');
557
+					$setup_tpl->set_var('remove', '&nbsp;');
558
+					$setup_tpl->set_var('upgrade', '&nbsp;');
559
+					$setup_tpl->set_var('resolution', '<a href="applications.php?resolve='.$value['name'].'&post=True">'.lang('Possible Solutions').'</a>');
560
+					$status = lang('Post-install Dependency Failure').':'.$depstring.$value['status'];
561 561
 					break;
562 562
 				default:
563
-					$setup_tpl->set_var('instimg','incomplete.png');
564
-					$setup_tpl->set_var('instalt',lang('Not Completed'));
565
-					$setup_tpl->set_var('install','&nbsp;');
566
-					$setup_tpl->set_var('remove','&nbsp;');
567
-					$setup_tpl->set_var('upgrade','&nbsp;');
568
-					$setup_tpl->set_var('resolution','');
563
+					$setup_tpl->set_var('instimg', 'incomplete.png');
564
+					$setup_tpl->set_var('instalt', lang('Not Completed'));
565
+					$setup_tpl->set_var('install', '&nbsp;');
566
+					$setup_tpl->set_var('remove', '&nbsp;');
567
+					$setup_tpl->set_var('upgrade', '&nbsp;');
568
+					$setup_tpl->set_var('resolution', '');
569 569
 					$status = '';
570 570
 					break;
571 571
 			}
572 572
 			//$setup_tpl->set_var('appname',$value['name'] . '-' . $status . ',' . $value['filename']);
573
-			$setup_tpl->set_var('appinfo',$value['name'] . '-' . $status);
574
-			$setup_tpl->set_var('appname',$value['name']);
573
+			$setup_tpl->set_var('appinfo', $value['name'].'-'.$status);
574
+			$setup_tpl->set_var('appname', $value['name']);
575 575
 
576
-			$setup_tpl->pparse('out','apps',True);
576
+			$setup_tpl->pparse('out', 'apps', True);
577 577
 		}
578 578
 	}
579 579
 
580
-	$setup_tpl->set_var('submit',lang('Save'));
581
-	$setup_tpl->set_var('cancel',lang('Cancel'));
582
-	$setup_tpl->pparse('out','app_footer');
583
-	$setup_tpl->pparse('out','footer');
580
+	$setup_tpl->set_var('submit', lang('Save'));
581
+	$setup_tpl->set_var('cancel', lang('Cancel'));
582
+	$setup_tpl->pparse('out', 'app_footer');
583
+	$setup_tpl->pparse('out', 'footer');
584 584
 	$GLOBALS['egw_setup']->html->show_footer();
585 585
 }
Please login to merge, or discard this patch.
setup/doc/chown.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @version $Id$
12 12
  */
13 13
 
14
-chdir(dirname(__FILE__));	// to enable our relative pathes to work
14
+chdir(dirname(__FILE__)); // to enable our relative pathes to work
15 15
 
16 16
 if (php_sapi_name() !== 'cli')	// security precaution: forbit calling as web-page
17 17
 {
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 }
40 40
 $ids = explode(',', $_SERVER['argv'][0]);
41 41
 $change = array();
42
-while($ids)
42
+while ($ids)
43 43
 {
44 44
 	$from = (int)array_shift($ids);
45 45
 	$to = (int)array_shift($ids);
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
 
67 67
 chown_grp($path, null, $recursive);
68 68
 
69
-function chown_grp($path, array $stat=null, $recursive=false)
69
+function chown_grp($path, array $stat = null, $recursive = false)
70 70
 {
71 71
 	global $change;
72 72
 
73 73
 	if (is_null($stat) && !($stat = stat($path))) return false;
74 74
 
75
-	if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']]))
75
+	if (isset($change[$stat['uid']]) && !chown($path, $uid = $change[$stat['uid']]))
76 76
 	{
77 77
 		echo "Faild to set new owner #$uid for $path\n";
78 78
 	}
79
-	if (isset($change[-$stat['gid']]) && !chgrp($path, $gid=-$change[-$stat['gid']]))
79
+	if (isset($change[-$stat['gid']]) && !chgrp($path, $gid = -$change[-$stat['gid']]))
80 80
 	{
81 81
 		echo "Faild to set new group #$gid for $path\n";
82 82
 	}
83 83
 
84 84
 	if ($recursive && is_dir($path))
85 85
 	{
86
-		foreach(new DirectoryIterator($path) as $child)
86
+		foreach (new DirectoryIterator($path) as $child)
87 87
 		{
88 88
 			if (!$child->isDot())
89 89
 				chown_grp($child->getPathname(), array(
Please login to merge, or discard this patch.
Braces   +11 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,10 +13,13 @@  discard block
 block discarded – undo
13 13
 
14 14
 chdir(dirname(__FILE__));	// to enable our relative pathes to work
15 15
 
16
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling as web-page
16
+if (php_sapi_name() !== 'cli')
17
+{
18
+	// security precaution: forbit calling as web-page
17 19
 {
18 20
 	die('<h1>setup/doc/chown.php must NOT be called as web-page --> exiting !!!</h1>');
19 21
 }
22
+}
20 23
 
21 24
 $recursive = false;
22 25
 
@@ -70,7 +73,10 @@  discard block
 block discarded – undo
70 73
 {
71 74
 	global $change;
72 75
 
73
-	if (is_null($stat) && !($stat = stat($path))) return false;
76
+	if (is_null($stat) && !($stat = stat($path)))
77
+	{
78
+		return false;
79
+	}
74 80
 
75 81
 	if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']]))
76 82
 	{
@@ -86,10 +92,12 @@  discard block
 block discarded – undo
86 92
 		foreach(new DirectoryIterator($path) as $child)
87 93
 		{
88 94
 			if (!$child->isDot())
89
-				chown_grp($child->getPathname(), array(
95
+			{
96
+							chown_grp($child->getPathname(), array(
90 97
 					'uid' => $child->getOwner(),
91 98
 					'gid' => $child->getGroup(),
92 99
 				), $recursive);
100
+			}
93 101
 		}
94 102
 	}
95 103
 }
Please login to merge, or discard this patch.
importexport/setup/setup.inc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
 	'name'  => 'eGroupware core team',
21 21
 	'email' => '[email protected]'
22 22
 );
23
-$setup_info['importexport']['autoinstall'] = true;	// install automatically on update
23
+$setup_info['importexport']['autoinstall'] = true; // install automatically on update
24 24
 
25
-$setup_info['importexport']['license']  = 'GPL';
25
+$setup_info['importexport']['license'] = 'GPL';
26 26
 $setup_info['importexport']['description'] =
27 27
 '';
28 28
 $setup_info['importexport']['note'] =
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 /* Dependencies for this app to work */
38 38
 $setup_info['importexport']['depends'][] = array(
39 39
 	 'appname' => 'api',
40
-	 'versions' => Array('16.1')
40
+	 'versions' => array('16.1')
41 41
 );
42 42
 
43 43
 // installation checks for importexport
Please login to merge, or discard this patch.
importexport/setup/tables_current.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
 $phpgw_baseline = array(
13 13
 	'egw_importexport_definitions' => array(
14 14
 		'fd' => array(
15
-			'definition_id' => array('type' => 'auto','nullable' => False),
16
-			'name' => array('type' => 'varchar','precision' => '255'),
17
-			'application' => array('type' => 'varchar','precision' => '50'),
18
-			'plugin' => array('type' => 'varchar','precision' => '100'),
19
-			'type' => array('type' => 'varchar','precision' => '20'),
20
-			'allowed_users' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '255'),
15
+			'definition_id' => array('type' => 'auto', 'nullable' => False),
16
+			'name' => array('type' => 'varchar', 'precision' => '255'),
17
+			'application' => array('type' => 'varchar', 'precision' => '50'),
18
+			'plugin' => array('type' => 'varchar', 'precision' => '100'),
19
+			'type' => array('type' => 'varchar', 'precision' => '20'),
20
+			'allowed_users' => array('type' => 'varchar', 'meta' => 'account-commasep', 'precision' => '255'),
21 21
 			'plugin_options' => array('type' => 'longtext'),
22
-			'owner' => array('type' => 'int','meta' => 'account','precision' => '4'),
23
-			'description' => array('type' => 'varchar','precision' => '255'),
22
+			'owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '4'),
23
+			'description' => array('type' => 'varchar', 'precision' => '255'),
24 24
 			'modified' => array('type' => 'timestamp'),
25 25
 			'filter' => array('type' => 'longtext')
26 26
 		),
Please login to merge, or discard this patch.
importexport/setup/tables_update.inc.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 function importexport_upgrade0_002()
15 15
 {
16
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','description',array(
16
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'description', array(
17 17
 		'type' => 'varchar',
18 18
 		'precision' => '255'
19 19
 	));
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 
45 45
 function importexport_upgrade1_8()
46 46
 {
47
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_importexport_definitions','definition_id',array(
47
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_importexport_definitions', 'definition_id', array(
48 48
 		'type' => 'auto',
49 49
 		'nullable' => False
50 50
 	));
51
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','modified',array(
51
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'modified', array(
52 52
 		'type' => 'timestamp'
53 53
 	));
54 54
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 function importexport_upgrade1_9_002()
65 65
 {
66
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','filter',array(
66
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'filter', array(
67 67
 		'type' => 'longtext'
68 68
 	));
69 69
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	// import i/e defintions
75 75
 	if (extension_loaded('dom'))
76 76
 	{
77
-		require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.importexport_definitions_bo.inc.php');
77
+		require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.importexport_definitions_bo.inc.php');
78 78
 
79 79
 		// This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db
80 80
 		$GLOBALS['egw_setup']->setup_account_object();
@@ -82,18 +82,18 @@  discard block
 block discarded – undo
82 82
 		// step through every source code intstalled app
83 83
 		$egwdir = dir(EGW_INCLUDE_ROOT);
84 84
 		while (false !== ($appdir = $egwdir->read())) {
85
-			$defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/";
86
-			if ( !is_dir( $defdir ) ) continue;
85
+			$defdir = EGW_INCLUDE_ROOT."/$appdir/setup/";
86
+			if (!is_dir($defdir)) continue;
87 87
 
88 88
 			// step through each file in defdir of app
89 89
 			$d = dir($defdir);
90 90
 			while (false !== ($entry = $d->read())) {
91 91
 				try
92 92
 				{
93
-					$file = $defdir. '/'. $entry;
94
-					list( $filename, $extension) = explode('.',$entry);
95
-					if ( $extension != 'xml' ) continue;
96
-					importexport_definitions_bo::import( $file );
93
+					$file = $defdir.'/'.$entry;
94
+					list($filename, $extension) = explode('.', $entry);
95
+					if ($extension != 'xml') continue;
96
+					importexport_definitions_bo::import($file);
97 97
 				}
98 98
 				catch (Exception $e)
99 99
 				{
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 		}
105 105
 	}
106 106
 	// give Default and Admins group rights for ImportExport
107
-	foreach(array('Default' => 'Default','Admins' => 'Admin') as $account_lid => $name)
107
+	foreach (array('Default' => 'Default', 'Admins' => 'Admin') as $account_lid => $name)
108 108
 	{
109
-		$account_id = $GLOBALS['egw_setup']->add_account($account_lid,$name,'Group',False,False);
110
-		$GLOBALS['egw_setup']->add_acl('importexport','run',$account_id);
109
+		$account_id = $GLOBALS['egw_setup']->add_account($account_lid, $name, 'Group', False, False);
110
+		$GLOBALS['egw_setup']->add_acl('importexport', 'run', $account_id);
111 111
 	}
112 112
 
113 113
 	return $GLOBALS['setup_info']['importexport']['currentver'] = '1.9.004';
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 function importexport_upgrade1_9_003()
117 117
 {
118
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','filter',array(
118
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'filter', array(
119 119
 		'type' => 'longtext'
120 120
 	));
121 121
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,18 +81,26 @@
 block discarded – undo
81 81
 
82 82
 		// step through every source code intstalled app
83 83
 		$egwdir = dir(EGW_INCLUDE_ROOT);
84
-		while (false !== ($appdir = $egwdir->read())) {
84
+		while (false !== ($appdir = $egwdir->read()))
85
+		{
85 86
 			$defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/";
86
-			if ( !is_dir( $defdir ) ) continue;
87
+			if ( !is_dir( $defdir ) )
88
+			{
89
+				continue;
90
+			}
87 91
 
88 92
 			// step through each file in defdir of app
89 93
 			$d = dir($defdir);
90
-			while (false !== ($entry = $d->read())) {
94
+			while (false !== ($entry = $d->read()))
95
+			{
91 96
 				try
92 97
 				{
93 98
 					$file = $defdir. '/'. $entry;
94 99
 					list( $filename, $extension) = explode('.',$entry);
95
-					if ( $extension != 'xml' ) continue;
100
+					if ( $extension != 'xml' )
101
+					{
102
+						continue;
103
+					}
96 104
 					importexport_definitions_bo::import( $file );
97 105
 				}
98 106
 				catch (Exception $e)
Please login to merge, or discard this patch.
importexport/setup/default_records.inc.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 if (!extension_loaded('dom'))
13 13
 {
14 14
 	echo "<p>Required PHP DOM extension missing, installation of ImportExport definitions aborted.</p>\n";
15
-	return;	// otherwise we mess up the whole eGroupware install process
15
+	return; // otherwise we mess up the whole eGroupware install process
16 16
 }
17
-require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.importexport_definitions_bo.inc.php');
17
+require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.importexport_definitions_bo.inc.php');
18 18
 
19 19
 // This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db
20 20
 $GLOBALS['egw_setup']->setup_account_object();
@@ -22,22 +22,22 @@  discard block
 block discarded – undo
22 22
 // step through every source code intstalled app
23 23
 $egwdir = dir(EGW_INCLUDE_ROOT);
24 24
 while (false !== ($appdir = $egwdir->read())) {
25
-	$defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/";
26
-	if ( !is_dir( $defdir ) ) continue;
25
+	$defdir = EGW_INCLUDE_ROOT."/$appdir/setup/";
26
+	if (!is_dir($defdir)) continue;
27 27
 
28 28
 	// step through each file in defdir of app
29 29
 	$d = dir($defdir);
30 30
 	while (false !== ($entry = $d->read())) {
31
-		$file = $defdir. '/'. $entry;
32
-		list( $filename, $extension) = explode('.',$entry);
33
-		if ( $extension != 'xml' ) continue;
34
-		importexport_definitions_bo::import( $file );
31
+		$file = $defdir.'/'.$entry;
32
+		list($filename, $extension) = explode('.', $entry);
33
+		if ($extension != 'xml') continue;
34
+		importexport_definitions_bo::import($file);
35 35
 	}
36 36
 }
37 37
 
38 38
 // give Default and Admins group rights for ImportExport
39
-foreach(array('Default' => 'Default','Admins' => 'Admin') as $account_lid => $name)
39
+foreach (array('Default' => 'Default', 'Admins' => 'Admin') as $account_lid => $name)
40 40
 {
41
-	$account_id = $GLOBALS['egw_setup']->add_account($account_lid,$name,'Group',False,False);
42
-	$GLOBALS['egw_setup']->add_acl('importexport','run',$account_id);
41
+	$account_id = $GLOBALS['egw_setup']->add_account($account_lid, $name, 'Group', False, False);
42
+	$GLOBALS['egw_setup']->add_acl('importexport', 'run', $account_id);
43 43
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,16 +21,24 @@
 block discarded – undo
21 21
 
22 22
 // step through every source code intstalled app
23 23
 $egwdir = dir(EGW_INCLUDE_ROOT);
24
-while (false !== ($appdir = $egwdir->read())) {
24
+while (false !== ($appdir = $egwdir->read()))
25
+{
25 26
 	$defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/";
26
-	if ( !is_dir( $defdir ) ) continue;
27
+	if ( !is_dir( $defdir ) )
28
+	{
29
+		continue;
30
+	}
27 31
 
28 32
 	// step through each file in defdir of app
29 33
 	$d = dir($defdir);
30
-	while (false !== ($entry = $d->read())) {
34
+	while (false !== ($entry = $d->read()))
35
+	{
31 36
 		$file = $defdir. '/'. $entry;
32 37
 		list( $filename, $extension) = explode('.',$entry);
33
-		if ( $extension != 'xml' ) continue;
38
+		if ( $extension != 'xml' )
39
+		{
40
+			continue;
41
+		}
34 42
 		importexport_definitions_bo::import( $file );
35 43
 	}
36 44
 }
Please login to merge, or discard this patch.
importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php 3 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 if (!defined('IMPORTEXPORT_APP'))
16 16
 {
17
-	define('IMPORTEXPORT_APP','importexport');
17
+	define('IMPORTEXPORT_APP', 'importexport');
18 18
 }
19 19
 
20 20
 class importexport_admin_prefs_sidebox_hooks
@@ -35,40 +35,40 @@  discard block
 block discarded – undo
35 35
 				array(
36 36
 					'text' => 'Import',
37 37
 					'link' => "javascript:egw_openWindowCentered2('".
38
-						Egw::link('/index.php','menuaction=importexport.importexport_import_ui.import_dialog',false).
38
+						Egw::link('/index.php', 'menuaction=importexport.importexport_import_ui.import_dialog', false).
39 39
 						"','_blank',850,440,'yes')",
40 40
 					'icon' => 'import'
41 41
 				),
42 42
 			);
43 43
 			$export_limit = Api\Storage\Merge::getExportLimit($appname);
44 44
 			//error_log(__METHOD__.__LINE__.' app:'.$appname.' limit:'.$export_limit);
45
-			if(Api\Storage\Merge::is_export_limit_excepted() || $export_limit !== 'no')
45
+			if (Api\Storage\Merge::is_export_limit_excepted() || $export_limit !== 'no')
46 46
 			{
47 47
 				$file[] = array(
48 48
 					'text' => 'Export',
49 49
 					'link' => "javascript:egw_openWindowCentered2('".
50
-						Egw::link('/index.php','menuaction=importexport.importexport_export_ui.export_dialog',false).
50
+						Egw::link('/index.php', 'menuaction=importexport.importexport_export_ui.export_dialog', false).
51 51
 						"','_blank',850,440,'yes')",
52 52
 					'icon' => 'export'
53 53
 				);
54 54
 			}
55 55
 			$config = Api\Config::read($appname);
56
-			if($config['users_create_definitions'])
56
+			if ($config['users_create_definitions'])
57 57
 			{
58
-				$file['Define imports|exports']	= Egw::link('/index.php',array(
58
+				$file['Define imports|exports'] = Egw::link('/index.php', array(
59 59
 						'menuaction' => 'importexport.importexport_definitions_ui.index',
60 60
 						'ajax' => 'true'
61
-				),$GLOBALS['egw_info']['user']['apps']['admin'] ? 'admin' : 'preferences');
61
+				), $GLOBALS['egw_info']['user']['apps']['admin'] ? 'admin' : 'preferences');
62 62
 			}
63
-			display_sidebox($appname,lang($appname),$file);
63
+			display_sidebox($appname, lang($appname), $file);
64 64
 		}
65 65
 
66 66
 		if ($GLOBALS['egw_info']['user']['apps']['admin'])
67 67
 		{
68 68
 			$file = Array(
69
-				'Site Configuration' => Egw::link('/index.php','menuaction=importexport.importexport_definitions_ui.site_config'),
70
-				'Import definitions' => Egw::link('/index.php','menuaction=importexport.importexport_definitions_ui.import_definition'),
71
-				'Define imports|exports'  => Egw::link('/index.php',array(
69
+				'Site Configuration' => Egw::link('/index.php', 'menuaction=importexport.importexport_definitions_ui.site_config'),
70
+				'Import definitions' => Egw::link('/index.php', 'menuaction=importexport.importexport_definitions_ui.import_definition'),
71
+				'Define imports|exports'  => Egw::link('/index.php', array(
72 72
 					'menuaction' => 'importexport.importexport_definitions_ui.index',
73 73
 					'ajax' => 'true'
74 74
 				)),
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 			);
79 79
 			if ($location == 'admin')
80 80
 			{
81
-				display_section($appname,$file);
81
+				display_section($appname, $file);
82 82
 			}
83 83
 			else
84 84
 			{
85
-				display_sidebox($appname,lang('Admin'),$file);
85
+				display_sidebox($appname, lang('Admin'), $file);
86 86
 			}
87 87
 		}
88 88
 	}
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * Called from framework so Import / Export can add links into other apps' sidebox.
92 92
 	 */
93 93
 	public static function other_apps() {
94
-		if(!$GLOBALS['egw_info']['user']['apps']['importexport']) return array();
95
-		if($GLOBALS['egw_info']['flags']['no_importexport'] === true) return array();
94
+		if (!$GLOBALS['egw_info']['user']['apps']['importexport']) return array();
95
+		if ($GLOBALS['egw_info']['flags']['no_importexport'] === true) return array();
96 96
 
97 97
 		$appname = $GLOBALS['egw_info']['flags']['currentapp'];
98 98
 		$cache = Api\Cache::getCache(Api\Cache::SESSION, 'importexport', 'sidebox_links');
99 99
 
100
-		if(!$cache[$appname] && $GLOBALS['egw_info']['user']['apps']['importexport']) {
100
+		if (!$cache[$appname] && $GLOBALS['egw_info']['user']['apps']['importexport']) {
101 101
 			$cache[$appname]['import'] = importexport_helper_functions::has_definitions($appname, 'import');
102 102
 			$cache[$appname]['export'] = importexport_helper_functions::has_definitions($appname, 'export');
103 103
 			Api\Cache::setCache(Api\Cache::SESSION, 'importexport', 'sidebox_links', $cache);
@@ -106,51 +106,51 @@  discard block
 block discarded – undo
106 106
 		// Add in import / export, if available
107 107
 		$file = array();
108 108
 		$plugins = importexport_helper_functions::get_plugins($appname);
109
-		if($cache[$appname]['import'])
109
+		if ($cache[$appname]['import'])
110 110
 		{
111 111
 			$file['Import CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
112
-				Egw::link('/index.php',array(
112
+				Egw::link('/index.php', array(
113 113
 					'menuaction' => 'importexport.importexport_import_ui.import_dialog',
114 114
 					'appname'=>$appname
115
-				),false)."','_blank',850,440,'yes')",
115
+				), false)."','_blank',850,440,'yes')",
116 116
 				'icon' => 'import',
117 117
 				'app' => 'importexport',
118 118
 				'text' => in_array($appname, array('sitemgr')) || count($plugins[$appname]['import']) > 1 ? 'Import' : 'Import CSV'
119 119
 			);
120
-			if($GLOBALS['egw_info']['flags']['disable_importexport']['import']) {
120
+			if ($GLOBALS['egw_info']['flags']['disable_importexport']['import']) {
121 121
 				$file['Import CSV']['link'] = '';
122 122
 			}
123 123
 		}
124 124
 		$export_limit = Api\Storage\Merge::getExportLimit($appname);
125 125
 		//error_log(__METHOD__.__LINE__.' app:'.$appname.' limit:'.$export_limit);
126
-		if ((Api\Storage\Merge::is_export_limit_excepted() || Api\Storage\Merge::hasExportLimit($export_limit,'ISALLOWED')) && $cache[$appname]['export'])
126
+		if ((Api\Storage\Merge::is_export_limit_excepted() || Api\Storage\Merge::hasExportLimit($export_limit, 'ISALLOWED')) && $cache[$appname]['export'])
127 127
 		{
128 128
 			$file['Export CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
129
-				Egw::link('/index.php',array(
129
+				Egw::link('/index.php', array(
130 130
 					'menuaction' => 'importexport.importexport_export_ui.export_dialog',
131 131
 					'appname'=>$appname
132
-				),false)."','_blank',850,440,'yes')",
132
+				), false)."','_blank',850,440,'yes')",
133 133
 				'icon' => 'export',
134 134
 				'app' => 'importexport',
135 135
 				'text' => in_array($appname, array('sitemgr')) || count($plugins[$appname]['export']) > 1 ? 'Export' : 'Export CSV'
136 136
 			);
137
-			if($GLOBALS['egw_info']['flags']['disable_importexport']['export']) {
137
+			if ($GLOBALS['egw_info']['flags']['disable_importexport']['export']) {
138 138
 				$file['Export CSV']['link'] = '';
139 139
 			}
140 140
 		}
141 141
 		
142 142
 		$config = Api\Config::read('importexport');
143
-		if($appname != 'admin' && ($config['users_create_definitions'] || $GLOBALS['egw_info']['user']['apps']['admin']) &&
143
+		if ($appname != 'admin' && ($config['users_create_definitions'] || $GLOBALS['egw_info']['user']['apps']['admin']) &&
144 144
 			count(importexport_helper_functions::get_plugins($appname)) > 0
145 145
 		)
146 146
 		{
147
-			$file['Define imports|exports']	= Egw::link('/index.php',array(
147
+			$file['Define imports|exports'] = Egw::link('/index.php', array(
148 148
 				'menuaction' => 'importexport.importexport_definitions_ui.index',
149 149
 				'application' => $appname,
150 150
 				'ajax' => 'true'
151
-			),$GLOBALS['egw_info']['user']['apps']['admin'] ? 'admin' : 'preferences');
151
+			), $GLOBALS['egw_info']['user']['apps']['admin'] ? 'admin' : 'preferences');
152 152
 		}
153
-		if($file) display_sidebox($appname,lang('importexport'),$file);
153
+		if ($file) display_sidebox($appname, lang('importexport'), $file);
154 154
 	}
155 155
 	
156 156
 	/**
Please login to merge, or discard this patch.
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -90,14 +90,22 @@  discard block
 block discarded – undo
90 90
 	/**
91 91
 	 * Called from framework so Import / Export can add links into other apps' sidebox.
92 92
 	 */
93
-	public static function other_apps() {
94
-		if(!$GLOBALS['egw_info']['user']['apps']['importexport']) return array();
95
-		if($GLOBALS['egw_info']['flags']['no_importexport'] === true) return array();
93
+	public static function other_apps()
94
+	{
95
+		if(!$GLOBALS['egw_info']['user']['apps']['importexport'])
96
+		{
97
+			return array();
98
+		}
99
+		if($GLOBALS['egw_info']['flags']['no_importexport'] === true)
100
+		{
101
+			return array();
102
+		}
96 103
 
97 104
 		$appname = $GLOBALS['egw_info']['flags']['currentapp'];
98 105
 		$cache = Api\Cache::getCache(Api\Cache::SESSION, 'importexport', 'sidebox_links');
99 106
 
100
-		if(!$cache[$appname] && $GLOBALS['egw_info']['user']['apps']['importexport']) {
107
+		if(!$cache[$appname] && $GLOBALS['egw_info']['user']['apps']['importexport'])
108
+		{
101 109
 			$cache[$appname]['import'] = importexport_helper_functions::has_definitions($appname, 'import');
102 110
 			$cache[$appname]['export'] = importexport_helper_functions::has_definitions($appname, 'export');
103 111
 			Api\Cache::setCache(Api\Cache::SESSION, 'importexport', 'sidebox_links', $cache);
@@ -117,7 +125,8 @@  discard block
 block discarded – undo
117 125
 				'app' => 'importexport',
118 126
 				'text' => in_array($appname, array('sitemgr')) || count($plugins[$appname]['import']) > 1 ? 'Import' : 'Import CSV'
119 127
 			);
120
-			if($GLOBALS['egw_info']['flags']['disable_importexport']['import']) {
128
+			if($GLOBALS['egw_info']['flags']['disable_importexport']['import'])
129
+			{
121 130
 				$file['Import CSV']['link'] = '';
122 131
 			}
123 132
 		}
@@ -134,7 +143,8 @@  discard block
 block discarded – undo
134 143
 				'app' => 'importexport',
135 144
 				'text' => in_array($appname, array('sitemgr')) || count($plugins[$appname]['export']) > 1 ? 'Export' : 'Export CSV'
136 145
 			);
137
-			if($GLOBALS['egw_info']['flags']['disable_importexport']['export']) {
146
+			if($GLOBALS['egw_info']['flags']['disable_importexport']['export'])
147
+			{
138 148
 				$file['Export CSV']['link'] = '';
139 149
 			}
140 150
 		}
@@ -142,15 +152,17 @@  discard block
 block discarded – undo
142 152
 		$config = Api\Config::read('importexport');
143 153
 		if($appname != 'admin' && ($config['users_create_definitions'] || $GLOBALS['egw_info']['user']['apps']['admin']) &&
144 154
 			count(importexport_helper_functions::get_plugins($appname)) > 0
145
-		)
146
-		{
155
+		) {
147 156
 			$file['Define imports|exports']	= Egw::link('/index.php',array(
148 157
 				'menuaction' => 'importexport.importexport_definitions_ui.index',
149 158
 				'application' => $appname,
150 159
 				'ajax' => 'true'
151 160
 			),$GLOBALS['egw_info']['user']['apps']['admin'] ? 'admin' : 'preferences');
152 161
 		}
153
-		if($file) display_sidebox($appname,lang('importexport'),$file);
162
+		if($file)
163
+		{
164
+			display_sidebox($appname,lang('importexport'),$file);
165
+		}
154 166
 	}
155 167
 	
156 168
 	/**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 
66 66
 		if ($GLOBALS['egw_info']['user']['apps']['admin'])
67 67
 		{
68
-			$file = Array(
68
+			$file = array(
69 69
 				'Site Configuration' => Egw::link('/index.php','menuaction=importexport.importexport_definitions_ui.site_config'),
70 70
 				'Import definitions' => Egw::link('/index.php','menuaction=importexport.importexport_definitions_ui.import_definition'),
71 71
 				'Define imports|exports'  => Egw::link('/index.php',array(
Please login to merge, or discard this patch.
importexport/inc/class.importexport_arrayxml.inc.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -30,39 +30,39 @@  discard block
 block discarded – undo
30 30
 	 * @param DOMElement $_node
31 31
 	 * @return string XML string
32 32
 	 */
33
-	public static function array2xml ( $_data, $_name = 'root', $_node=null ) {
33
+	public static function array2xml($_data, $_name = 'root', $_node = null) {
34 34
 		$returnXML = false;
35
-		if ( $_node === null ) {
36
-			$_node = new DOMDocument( '1.0', 'utf-8' );
35
+		if ($_node === null) {
36
+			$_node = new DOMDocument('1.0', 'utf-8');
37 37
 			$_node->formatOutput = true;
38 38
 			$returnXML = true;
39 39
 		}
40 40
 		
41
-		$datatype = gettype( $_data );
42
-		switch ( $datatype ) {
41
+		$datatype = gettype($_data);
42
+		switch ($datatype) {
43 43
 			case 'array' :
44
-				$subnode = new DOMElement( 'entry' );
45
-				$_node->appendChild( $subnode );
46
-				$subnode->setAttribute( 'type', $datatype );
47
-				$subnode->setAttribute( 'name' , $_name );
44
+				$subnode = new DOMElement('entry');
45
+				$_node->appendChild($subnode);
46
+				$subnode->setAttribute('type', $datatype);
47
+				$subnode->setAttribute('name', $_name);
48 48
 					
49
-				foreach ( $_data as $ikey => $ivalue ) {
50
-					self::array2xml( $ivalue, $ikey, $subnode );
49
+				foreach ($_data as $ikey => $ivalue) {
50
+					self::array2xml($ivalue, $ikey, $subnode);
51 51
 				}
52 52
 				break;
53 53
 
54 54
 			default : 
55
-				switch ( $datatype ) {
55
+				switch ($datatype) {
56 56
 					case 'boolean' :
57 57
 						$data = $_data !== false ? 'TRUE' : 'FALSE';
58 58
 						break;
59 59
 					default:
60 60
 						$data = &$_data;
61 61
 				}
62
-				$subnode = new DOMElement( 'entry' , $data );
63
-				$_node->appendChild( $subnode );
64
-				$subnode->setAttribute( 'type', $datatype );
65
-				$subnode->setAttribute( 'name' , $_name );
62
+				$subnode = new DOMElement('entry', $data);
63
+				$_node->appendChild($subnode);
64
+				$subnode->setAttribute('type', $datatype);
65
+				$subnode->setAttribute('name', $_name);
66 66
 				break;
67 67
 		}
68 68
 		return $returnXML ? $_node->saveXML() : '';
@@ -74,28 +74,28 @@  discard block
 block discarded – undo
74 74
 	 * @param string $_xml
75 75
 	 * @return array
76 76
 	 */
77
-	public static function xml2array( $_xml ) {
78
-		if ( $_xml instanceof DOMElement ) {
77
+	public static function xml2array($_xml) {
78
+		if ($_xml instanceof DOMElement) {
79 79
 			$n = &$_xml;
80 80
 		} else {
81 81
 			$n = new DOMDocument;
82 82
 			$loaded = $n->loadXML($_xml);
83
-			if(!$loaded) return array();
83
+			if (!$loaded) return array();
84 84
 		}
85 85
 		$xml_array = array();
86 86
 		
87
-		foreach($n->childNodes as $nc) {
87
+		foreach ($n->childNodes as $nc) {
88 88
 			
89
-			if ( $nc->nodeType != XML_ELEMENT_NODE ) continue;
89
+			if ($nc->nodeType != XML_ELEMENT_NODE) continue;
90 90
 				
91 91
 			$name = $nc->attributes->getNamedItem('name')->nodeValue;
92 92
 			$type = $nc->attributes->getNamedItem('type')->nodeValue;
93 93
 
94 94
 			//echo $nc->nodeType. "(length ): ". $nc->nodeName. " => ". $nc->nodeValue. "; Attriubtes: name=$name, type=$type  \n ";
95
-			if( $nc->childNodes->length >= 2) {
95
+			if ($nc->childNodes->length >= 2) {
96 96
 				$xml_array[$name] = self::xml2array($nc);
97 97
 			} else {
98
-				switch ( $type ) {
98
+				switch ($type) {
99 99
 					case 'boolean' :
100 100
 						$value = $nc->nodeValue == 'FALSE' ? false : true;
101 101
 						break;
Please login to merge, or discard this patch.
Braces   +36 added lines, -15 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@  discard block
 block discarded – undo
20 20
  * @todo deal with other types like objects
21 21
  * @static only namespace here
22 22
  */ 
23
-class importexport_arrayxml {
23
+class importexport_arrayxml
24
+{
24 25
 	
25 26
 	/**
26 27
 	 * converts a php array to an xml string
@@ -30,29 +31,34 @@  discard block
 block discarded – undo
30 31
 	 * @param DOMElement $_node
31 32
 	 * @return string XML string
32 33
 	 */
33
-	public static function array2xml ( $_data, $_name = 'root', $_node=null ) {
34
+	public static function array2xml ( $_data, $_name = 'root', $_node=null )
35
+	{
34 36
 		$returnXML = false;
35
-		if ( $_node === null ) {
37
+		if ( $_node === null )
38
+		{
36 39
 			$_node = new DOMDocument( '1.0', 'utf-8' );
37 40
 			$_node->formatOutput = true;
38 41
 			$returnXML = true;
39 42
 		}
40 43
 		
41 44
 		$datatype = gettype( $_data );
42
-		switch ( $datatype ) {
45
+		switch ( $datatype )
46
+		{
43 47
 			case 'array' :
44 48
 				$subnode = new DOMElement( 'entry' );
45 49
 				$_node->appendChild( $subnode );
46 50
 				$subnode->setAttribute( 'type', $datatype );
47 51
 				$subnode->setAttribute( 'name' , $_name );
48 52
 					
49
-				foreach ( $_data as $ikey => $ivalue ) {
53
+				foreach ( $_data as $ikey => $ivalue )
54
+				{
50 55
 					self::array2xml( $ivalue, $ikey, $subnode );
51 56
 				}
52 57
 				break;
53 58
 
54 59
 			default : 
55
-				switch ( $datatype ) {
60
+				switch ( $datatype )
61
+				{
56 62
 					case 'boolean' :
57 63
 						$data = $_data !== false ? 'TRUE' : 'FALSE';
58 64
 						break;
@@ -74,28 +80,43 @@  discard block
 block discarded – undo
74 80
 	 * @param string $_xml
75 81
 	 * @return array
76 82
 	 */
77
-	public static function xml2array( $_xml ) {
78
-		if ( $_xml instanceof DOMElement ) {
83
+	public static function xml2array( $_xml )
84
+	{
85
+		if ( $_xml instanceof DOMElement )
86
+		{
79 87
 			$n = &$_xml;
80
-		} else {
88
+		}
89
+		else
90
+		{
81 91
 			$n = new DOMDocument;
82 92
 			$loaded = $n->loadXML($_xml);
83
-			if(!$loaded) return array();
93
+			if(!$loaded)
94
+			{
95
+				return array();
96
+			}
84 97
 		}
85 98
 		$xml_array = array();
86 99
 		
87
-		foreach($n->childNodes as $nc) {
100
+		foreach($n->childNodes as $nc)
101
+		{
88 102
 			
89
-			if ( $nc->nodeType != XML_ELEMENT_NODE ) continue;
103
+			if ( $nc->nodeType != XML_ELEMENT_NODE )
104
+			{
105
+				continue;
106
+			}
90 107
 				
91 108
 			$name = $nc->attributes->getNamedItem('name')->nodeValue;
92 109
 			$type = $nc->attributes->getNamedItem('type')->nodeValue;
93 110
 
94 111
 			//echo $nc->nodeType. "(length ): ". $nc->nodeName. " => ". $nc->nodeValue. "; Attriubtes: name=$name, type=$type  \n ";
95
-			if( $nc->childNodes->length >= 2) {
112
+			if( $nc->childNodes->length >= 2)
113
+			{
96 114
 				$xml_array[$name] = self::xml2array($nc);
97
-			} else {
98
-				switch ( $type ) {
115
+			}
116
+			else
117
+			{
118
+				switch ( $type )
119
+				{
99 120
 					case 'boolean' :
100 121
 						$value = $nc->nodeValue == 'FALSE' ? false : true;
101 122
 						break;
Please login to merge, or discard this patch.
importexport/inc/class.importexport_schedule_ui.inc.php 4 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 	}
197 197
 
198 198
 	/**
199
-	* Get options for select boxes
200
-	*/
199
+	 * Get options for select boxes
200
+	 */
201 201
 	public static function get_select_options(Array $data)
202 202
 	{
203 203
 		$options = array(
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 	}
262 262
 
263 263
 	/**
264
-	* Generate a async key
265
-	*/
264
+	 * Generate a async key
265
+	 */
266 266
 	public static function generate_id($data)
267 267
 	{
268 268
 
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	}
279 279
 
280 280
 	/**
281
-	* Check that the target is valid for the type (readable or writable)
282
-	* and that they're not trying to write directly to the filesystem
283
-	*
284
-	* $data should contain target & type
285
-	*/
281
+	 * Check that the target is valid for the type (readable or writable)
282
+	 * and that they're not trying to write directly to the filesystem
283
+	 *
284
+	 * $data should contain target & type
285
+	 */
286 286
 	public static function check_target(Array $data) {
287 287
 		$scheme = parse_url($data['target'], PHP_URL_SCHEME);
288 288
 		if($scheme == '' || $scheme == 'file')
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	}
330 330
 
331 331
 	/**
332
-	* Writable that checks the folder too, in case the file does not exist yet
333
-	* http://ca3.php.net/manual/en/function.is-writable.php#73596
334
-	*
335
-	* @param path Path to check
336
-	*/
332
+	 * Writable that checks the folder too, in case the file does not exist yet
333
+	 * http://ca3.php.net/manual/en/function.is-writable.php#73596
334
+	 *
335
+	 * @param path Path to check
336
+	 */
337 337
 	private static function is__writable($path)
338 338
 	{
339 339
 		if ($path{strlen($path)-1}=='/')
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	}
366 366
 
367 367
 	/**
368
-	* Execute a scheduled import or export
369
-	*/
368
+	 * Execute a scheduled import or export
369
+	 */
370 370
 	public static function exec($data)
371 371
 	{
372 372
 		ob_start();
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	public function index($content = array())
38 38
 	{
39 39
 		$async = new Api\Asyncservice();
40
-		if(is_array($content['scheduled']))
40
+		if (is_array($content['scheduled']))
41 41
 		{
42
-			foreach($content['scheduled'] as $row)
42
+			foreach ($content['scheduled'] as $row)
43 43
 			{
44
-				if($row['delete'])
44
+				if ($row['delete'])
45 45
 				{
46 46
 					$key = urldecode(key($row['delete']));
47 47
 					$async->cancel_timer($key);
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 		}
51 51
 		$async_list = $async->read('importexport%');
52 52
 		$data = array();
53
-		if(is_array($async_list))
53
+		if (is_array($async_list))
54 54
 		{
55
-			foreach($async_list as $id => $async)
55
+			foreach ($async_list as $id => $async)
56 56
 			{
57
-				foreach(array('errors', 'warnings', 'result') as $messages)
57
+				foreach (array('errors', 'warnings', 'result') as $messages)
58 58
 				{
59
-					if(is_array($async['data'][$messages]))
59
+					if (is_array($async['data'][$messages]))
60 60
 					{
61 61
 						$list = array();
62
-						foreach($async['data'][$messages] as $target => $message)
62
+						foreach ($async['data'][$messages] as $target => $message)
63 63
 						{
64 64
 							$list[] = array(
65 65
 								'target' => (is_numeric($target) ? '' : $target),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 						$async['data'][$messages] = $list;
70 70
 					}
71 71
 				}
72
-				if(is_numeric($async['data']['record_count']))
72
+				if (is_numeric($async['data']['record_count']))
73 73
 				{
74 74
 					$async['data']['record_count'] = lang('%1 records processed', $async['data']['record_count']);
75 75
 				}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$data = $content;
101 101
 
102 102
 		// Deal with incoming
103
-		if($content['save'] && self::check_target($content) === true)
103
+		if ($content['save'] && self::check_target($content) === true)
104 104
 		{
105 105
 			unset($content['save']);
106 106
 			$async->cancel_timer($id);
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 			unset($content['schedule']);
112 112
 
113 113
 			// Remove any left blank
114
-			foreach($schedule as $key => &$value)
114
+			foreach ($schedule as $key => &$value)
115 115
 			{
116
-				if($value == '') unset($schedule[$key]);
116
+				if ($value == '') unset($schedule[$key]);
117 117
 			}
118 118
 			$result = $async->set_timer(
119 119
 				$schedule,
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 				'importexport.importexport_schedule_ui.exec',
122 122
 				$content
123 123
 			);
124
-			if($result)
124
+			if ($result)
125 125
 			{
126
-				Framework::refresh_opener('', 'admin',$id,'update','admin');
126
+				Framework::refresh_opener('', 'admin', $id, 'update', 'admin');
127 127
 				Framework::window_close();
128 128
 			}
129 129
 			else
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
 			}
134 134
 		}
135 135
 
136
-		if($id)
136
+		if ($id)
137 137
 		{
138 138
 
139 139
 			$preserve['id'] = $id;
140 140
 			$async = $async->read($id);
141
-			if(is_array($async[$id]['data']))
141
+			if (is_array($async[$id]['data']))
142 142
 			{
143 143
 				$data += $async[$id]['data'];
144 144
 				$data['schedule'] = $async[$id]['times'];
145 145
 				unset($data['times']);
146 146
 
147 147
 				// Async sometimes changes minutes to an array - show user what they typed
148
-				if(is_array($data['schedule']['min']))
148
+				if (is_array($data['schedule']['min']))
149 149
 				{
150 150
 					$data['schedule']['min'] = $data['min'];
151 151
 				}
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 		{
160 160
 			$data['type'] = $content['type'] ? $content['type'] : 'import';
161 161
 
162
-			if((int)$definition_id)
162
+			if ((int)$definition_id)
163 163
 			{
164 164
 				$bo = new importexport_definitions_bo();
165 165
 				$definition = $bo->read($definition_id);
166
-				if($definition['definition_id'])
166
+				if ($definition['definition_id'])
167 167
 				{
168 168
 					$data['type'] = $definition['type'];
169 169
 					$data['appname'] = $definition['application'];
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 			}
174 174
 		}
175 175
 
176
-		if($data['target'] && $data['type'])
176
+		if ($data['target'] && $data['type'])
177 177
 		{
178 178
 			$file_check = self::check_target($data);
179
-			if($file_check !== true)
179
+			if ($file_check !== true)
180 180
 			{
181
-				$data['message'] .= ($data['message'] ? "\n" . $file_check : $file_check);
181
+				$data['message'] .= ($data['message'] ? "\n".$file_check : $file_check);
182 182
 			}
183 183
 		}
184 184
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$data['current_time'] = time();
189 189
 
190 190
 		$sel_options = self::get_select_options($data);
191
-		Framework::includeJS('.','importexport','importexport');
191
+		Framework::includeJS('.', 'importexport', 'importexport');
192 192
 
193 193
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('Schedule import / export');
194 194
 		$this->template->read('importexport.schedule_edit');
@@ -208,21 +208,21 @@  discard block
 block discarded – undo
208 208
 		);
209 209
 
210 210
 		(array)$apps = importexport_helper_functions::get_apps($data['type'] ? $data['type'] : 'all');
211
-		if(count($apps))
211
+		if (count($apps))
212 212
 		{
213
-			$options['appname'] = array('' => lang('Select one')) + array_combine($apps,$apps);
213
+			$options['appname'] = array('' => lang('Select one')) + array_combine($apps, $apps);
214 214
 		}
215 215
 
216 216
 		$plugins = importexport_helper_functions::get_plugins($data['appname'] ? $data['appname'] : 'all', $data['type']);
217
-		if(is_array($plugins))
217
+		if (is_array($plugins))
218 218
 		{
219
-			foreach($plugins as $types)
219
+			foreach ($plugins as $types)
220 220
 			{
221
-				if(!is_array($types[$data['type']]))
221
+				if (!is_array($types[$data['type']]))
222 222
 				{
223 223
 					continue;
224 224
 				}
225
-				foreach($types[$data['type']] as $key => $title)
225
+				foreach ($types[$data['type']] as $key => $title)
226 226
 				{
227 227
 					$options['plugin'][$key] = $title;
228 228
 				}
@@ -285,27 +285,27 @@  discard block
 block discarded – undo
285 285
 	*/
286 286
 	public static function check_target(Array $data) {
287 287
 		$scheme = parse_url($data['target'], PHP_URL_SCHEME);
288
-		if($scheme == '' || $scheme == 'file')
288
+		if ($scheme == '' || $scheme == 'file')
289 289
 		{
290 290
 			return 'Direct file access not allowed';
291 291
 		}
292 292
 
293
-		if($scheme == Vfs::SCHEME  && !in_array(Vfs::SCHEME, stream_get_wrappers())) {
293
+		if ($scheme == Vfs::SCHEME && !in_array(Vfs::SCHEME, stream_get_wrappers())) {
294 294
 			stream_wrapper_register(Vfs::SCHEME, 'vfs_stream_wrapper', STREAM_IS_URL);
295 295
 		}
296 296
 
297 297
 		if ($data['type'] == 'import' && ($scheme == Vfs::SCHEME && !Vfs::is_readable($data['target'])))
298 298
 		{
299
-			return lang('%1 is not readable',$data['target']);
299
+			return lang('%1 is not readable', $data['target']);
300 300
 		}
301
-		elseif ($data['type'] == 'import' && in_array($scheme, array('http','https')))
301
+		elseif ($data['type'] == 'import' && in_array($scheme, array('http', 'https')))
302 302
 		{
303 303
 			// Not supported by is_readable, try headers...
304 304
 			stream_context_set_default(array('http'=>array(
305 305
 				'method'	=> 'HEAD',
306 306
 				'ignore_errors'	=> 1
307 307
 			)));
308
-			$headers = get_headers($data['target'],1);
308
+			$headers = get_headers($data['target'], 1);
309 309
 
310 310
 			// Reset...
311 311
 			stream_context_set_default(array('http'=>array(
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
 				'ignore_errors'	=> 0
314 314
 			)));
315 315
 			// Response code has an integer key, but redirects may add more responses
316
-			for($i = 0; $i < count($headers); $i++)
316
+			for ($i = 0; $i < count($headers); $i++)
317 317
 			{
318
-				if(!$headers[$i]) break;
319
-				if(strpos($headers[$i],'200') !== false) return true;
318
+				if (!$headers[$i]) break;
319
+				if (strpos($headers[$i], '200') !== false) return true;
320 320
 			}
321
-			return lang('%1 is not readable',$data['target']);
321
+			return lang('%1 is not readable', $data['target']);
322 322
 		}
323 323
 		elseif ($data['type'] == 'export' && !self::is__writable($data['target']))
324 324
 		{
325
-			return lang('%1 is not writable',$data['target']);
325
+			return lang('%1 is not writable', $data['target']);
326 326
 		}
327 327
 
328 328
 		return true;
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	*/
337 337
 	private static function is__writable($path)
338 338
 	{
339
-		if ($path{strlen($path)-1}=='/')
339
+		if ($path{strlen($path) - 1} == '/')
340 340
 		{
341 341
 			// recursively return a temporary file path
342 342
 			return self::is__writable($path.uniqid(mt_rand()).'.tmp');
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		$rm = file_exists($path);
351 351
 		$f = @fopen($path, 'a');
352 352
 
353
-		if ($f===false)
353
+		if ($f === false)
354 354
 		{
355 355
 			return false;
356 356
 		}
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 		unset($data['warnings']);
377 377
 		unset($data['result']);
378 378
 
379
-		if($data['lock'])
379
+		if ($data['lock'])
380 380
 		{
381 381
 			// Lock expires
382
-			if($data['lock'] < time())
382
+			if ($data['lock'] < time())
383 383
 			{
384 384
 				unset($data['lock']);
385 385
 				$data['warnings'][][] = lang('Lock expired on previous run');
@@ -400,25 +400,25 @@  discard block
 block discarded – undo
400 400
 
401 401
 		// check file
402 402
 		$file_check = self::check_target($data);
403
-		if($file_check !== true)
403
+		if ($file_check !== true)
404 404
 		{
405 405
 			$data['errors'] = array($file_check=>'');
406 406
 			// Update job with results
407 407
 			self::update_job($data);
408 408
 
409
-			error_log('importexport_schedule: ' . date('c') . ": $file_check \n");
409
+			error_log('importexport_schedule: '.date('c').": $file_check \n");
410 410
 			error_log(ob_get_flush());
411 411
 			return;
412 412
 		}
413 413
 
414 414
 		$definition = new importexport_definition($data['definition']);
415
-		if( $definition->get_identifier() < 1 )
415
+		if ($definition->get_identifier() < 1)
416 416
 		{
417 417
 			$data['errors'] = array('Definition not found!');
418 418
 			// Update job with results
419 419
 			self::update_job($data);
420 420
 
421
-			error_log('importexport_schedule: ' . date('c') . ": Definition not found! \n");
421
+			error_log('importexport_schedule: '.date('c').": Definition not found! \n");
422 422
 			return;
423 423
 		}
424 424
 		$GLOBALS['egw_info']['flags']['currentapp'] = $definition->application;
@@ -427,30 +427,30 @@  discard block
 block discarded – undo
427 427
 
428 428
 		$type = $data['type'];
429 429
 
430
-		if(is_dir($data['target']))
430
+		if (is_dir($data['target']))
431 431
 		{
432
-			if($data['type'] == 'import')
432
+			if ($data['type'] == 'import')
433 433
 			{
434 434
 				$targets = array();
435
-				foreach(scandir($data['target']) as $target)
435
+				foreach (scandir($data['target']) as $target)
436 436
 				{
437 437
 					if ($target == '.' || $target == '..')
438 438
 					{
439 439
 						continue;
440 440
 					}
441
-					$target = $data['target'].(substr($data['target'],-1) == '/' ? '' : '/').$target;
441
+					$target = $data['target'].(substr($data['target'], -1) == '/' ? '' : '/').$target;
442 442
 
443 443
 					// Check modification time, make sure it's not currently being written
444 444
 					// Skip files modified in the last 10 seconds
445 445
 					$mod_time = filemtime($target);
446
-					if($mod_time >= time() - 10)
446
+					if ($mod_time >= time() - 10)
447 447
 					{
448 448
 						$data['result'][$target] = lang('Skipped');
449 449
 						continue;
450 450
 					}
451 451
 					$targets[$mod_time.$target] = $target;
452 452
 				}
453
-				if($targets)
453
+				if ($targets)
454 454
 				{
455 455
 					ksort($targets);
456 456
 				}
@@ -466,27 +466,27 @@  discard block
 block discarded – undo
466 466
 			$targets = array($data['target']);
467 467
 		}
468 468
 
469
-		if($type == 'export')
469
+		if ($type == 'export')
470 470
 		{
471 471
 			// Set to export all or filter, if set
472 472
 			$selection = array('selection' => 'all');
473
-			if($definition->filter)
473
+			if ($definition->filter)
474 474
 			{
475 475
 				$fields = importexport_helper_functions::get_filter_fields($definition->application, $po);
476 476
 				$selection = array('selection' => 'filter');
477 477
 				$filters = array();
478
-				foreach($definition->filter as $field => $value)
478
+				foreach ($definition->filter as $field => $value)
479 479
 				{
480 480
 					 // Handle multiple values
481
-					if(!is_array($value) && strpos($value,',') !== false)
481
+					if (!is_array($value) && strpos($value, ',') !== false)
482 482
 					{
483
-						$value = explode(',',$value);
483
+						$value = explode(',', $value);
484 484
 					}
485 485
 
486 486
 					$filters[$field] = $value;
487 487
 
488 488
 					// Process relative dates into the current absolute date
489
-					if($filters[$field] && strpos($fields[$field]['type'],'date') === 0)
489
+					if ($filters[$field] && strpos($fields[$field]['type'], 'date') === 0)
490 490
 					{
491 491
 						$filters[$field] = importexport_helper_functions::date_rel2abs($value);
492 492
 					}
@@ -494,14 +494,14 @@  discard block
 block discarded – undo
494 494
 				// Update filter to use current absolute dates
495 495
 				$definition->filter = $filters;
496 496
 			}
497
-			if(!is_array($definition->plugin_options))
497
+			if (!is_array($definition->plugin_options))
498 498
 			{
499 499
 				$definition->plugin_options = array();
500 500
 			}
501 501
 			$definition->plugin_options = array_merge($definition->plugin_options, $selection);
502 502
 		}
503 503
 
504
-		foreach($targets as $target)
504
+		foreach ($targets as $target)
505 505
 		{
506 506
 			// Update lock timeout
507 507
 			$data['lock'] = time() + 3600;
@@ -510,16 +510,16 @@  discard block
 block discarded – undo
510 510
 			$resource = null;
511 511
 			try
512 512
 			{
513
-				if (($resource = @fopen( $target, $data['type'] == 'import' ? 'rb' : 'wb' )))
513
+				if (($resource = @fopen($target, $data['type'] == 'import' ? 'rb' : 'wb')))
514 514
 				{
515
-					$result = $po->$type( $resource, $definition );
515
+					$result = $po->$type($resource, $definition);
516 516
 
517 517
 					fclose($resource);
518 518
 				}
519 519
 				else
520 520
 				{
521
-					error_log('importexport_schedule: ' . date('c') . ": File $target not readable! \n");
522
-					$data['errors'][$target][] = lang('%1 is not readable',$target);
521
+					error_log('importexport_schedule: '.date('c').": File $target not readable! \n");
522
+					$data['errors'][$target][] = lang('%1 is not readable', $target);
523 523
 				}
524 524
 			}
525 525
 			catch (Exception $i_ex)
@@ -529,20 +529,20 @@  discard block
 block discarded – undo
529 529
 			}
530 530
 
531 531
 
532
-			if(method_exists($po, 'get_warnings') && $po->get_warnings())
532
+			if (method_exists($po, 'get_warnings') && $po->get_warnings())
533 533
 			{
534
-				$buffer = 'importexport_schedule: ' . date('c') . ": Import warnings:\n#\tWarning\n";
535
-				foreach($po->get_warnings() as $record => $msg)
534
+				$buffer = 'importexport_schedule: '.date('c').": Import warnings:\n#\tWarning\n";
535
+				foreach ($po->get_warnings() as $record => $msg)
536 536
 				{
537 537
 					$data['warnings'][$target][] = "#$record: $msg";
538 538
 					$buffer += "$record\t$msg\n";
539 539
 				}
540 540
 				error_log($buffer);
541 541
 			}
542
-			if(method_exists($po, 'get_errors') && $po->get_errors())
542
+			if (method_exists($po, 'get_errors') && $po->get_errors())
543 543
 			{
544
-				$buffer = 'importexport_schedule: ' . date('c') . ": Import errors:\n#\tError\n";
545
-				foreach($po->get_errors() as $record => $error)
544
+				$buffer = 'importexport_schedule: '.date('c').": Import errors:\n#\tError\n";
545
+				foreach ($po->get_errors() as $record => $error)
546 546
 				{
547 547
 					$data['errors'][$target][] = "#$record: $error";
548 548
 					$buffer += "$record\t$error\n";
@@ -550,22 +550,22 @@  discard block
 block discarded – undo
550 550
 				error_log($buffer);
551 551
 			}
552 552
 
553
-			if($po instanceof importexport_iface_import_plugin)
553
+			if ($po instanceof importexport_iface_import_plugin)
554 554
 			{
555
-				if(is_numeric($result))
555
+				if (is_numeric($result))
556 556
 				{
557 557
 					$data['record_count'] += $result;
558 558
 					$data['result'][$target][] = lang('%1 records processed', $result);
559 559
 				}
560 560
 				$data['result'][$target] = array();
561
-				foreach($po->get_results() as $action => $count)
561
+				foreach ($po->get_results() as $action => $count)
562 562
 				{
563
-					$data['result'][$target][] = lang($action) . ": $count";
563
+					$data['result'][$target][] = lang($action).": $count";
564 564
 				}
565 565
 			}
566 566
 			else
567 567
 			{
568
-				if($result instanceof importexport_iface_export_record)
568
+				if ($result instanceof importexport_iface_export_record)
569 569
 				{
570 570
 					$data['record_count'] += $result->get_num_of_records();
571 571
 					$data['result'][$target][] = lang('%1 records processed', $result->get_num_of_records());
@@ -574,23 +574,23 @@  discard block
 block discarded – undo
574 574
 		}
575 575
 
576 576
 		// Delete file?
577
-		if($data['delete_files'] && $type == 'import' && !$data['errors'])
577
+		if ($data['delete_files'] && $type == 'import' && !$data['errors'])
578 578
 		{
579
-			foreach($targets as $target)
579
+			foreach ($targets as $target)
580 580
 			{
581
-				if(unlink($target))
581
+				if (unlink($target))
582 582
 				{
583
-					$data['result'][$target][] .= "\n..." . lang('deleted');
583
+					$data['result'][$target][] .= "\n...".lang('deleted');
584 584
 				}
585 585
 				else
586 586
 				{
587
-					$data['errors'][$target][] .= "\n..." . lang('Unable to delete');
587
+					$data['errors'][$target][] .= "\n...".lang('Unable to delete');
588 588
 				}
589 589
 			}
590 590
 		}
591 591
 
592 592
 		// Run time in minutes
593
-		$data['run_time'] = round((time() - $data['last_run']) / 60,1);
593
+		$data['run_time'] = round((time() - $data['last_run']) / 60, 1);
594 594
 
595 595
 		// Clear lock
596 596
 		$data['lock'] = 0;
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
 		$contents = ob_get_contents();
602 602
 
603 603
 		// Log to error log
604
-		if($contents)
604
+		if ($contents)
605 605
 		{
606
-			error_log('importexport_schedule: ' . date('c') . ": \n".$contents);
606
+			error_log('importexport_schedule: '.date('c').": \n".$contents);
607 607
 		}
608 608
 
609 609
 		ob_end_clean();
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 		$jobs = $async->read($id);
621 621
 		$job = $jobs[$id];
622 622
 
623
-		if(is_array($job))
623
+		if (is_array($job))
624 624
 		{
625 625
 			$async->cancel_timer($id);
626 626
 			$result = $async->set_timer(
@@ -630,37 +630,37 @@  discard block
 block discarded – undo
630 630
 				$data
631 631
 			);
632 632
 		}
633
-		if($no_notification)
633
+		if ($no_notification)
634 634
 		{
635 635
 			return $result;
636 636
 		}
637 637
 
638 638
 		// Send notification to user
639
-		if($data['warnings'] || $data['errors'])
639
+		if ($data['warnings'] || $data['errors'])
640 640
 		{
641 641
 			$notify = new notifications();
642 642
 			$notify->set_sender($data['account_id']);
643 643
 			$notify->add_receiver($data['account_id']);
644
-			$notify->set_subject(lang('Schedule import | export'). ' ' . lang('errors'));
644
+			$notify->set_subject(lang('Schedule import | export').' '.lang('errors'));
645 645
 			$contents = '';
646 646
 
647
-			if($data['warnings'])
647
+			if ($data['warnings'])
648 648
 			{
649
-				$contents .= lang($data['type']) . ' ' . lang('Warnings') . ' ' . Api\DateTime::to() . ':';
650
-				foreach($data['warnings'] as $target => $message)
649
+				$contents .= lang($data['type']).' '.lang('Warnings').' '.Api\DateTime::to().':';
650
+				foreach ($data['warnings'] as $target => $message)
651 651
 				{
652
-					$contents .= "\n". (is_numeric($target) ? '' : $target."\n");
653
-					$contents .= is_array($message) ? implode("\n",$message) : $message;
652
+					$contents .= "\n".(is_numeric($target) ? '' : $target."\n");
653
+					$contents .= is_array($message) ? implode("\n", $message) : $message;
654 654
 				}
655 655
 				$contents .= "\n";
656 656
 			}
657
-			if($data['errors'])
657
+			if ($data['errors'])
658 658
 			{
659
-				$contents .= lang($data['type']) . ' ' . lang('Errors') . ' ' . Api\DateTime::to() . ':';
660
-				foreach($data['errors'] as $target => $errors)
659
+				$contents .= lang($data['type']).' '.lang('Errors').' '.Api\DateTime::to().':';
660
+				foreach ($data['errors'] as $target => $errors)
661 661
 				{
662
-					$contents .= "\n". (is_numeric($target) ? '' : $target."\n");
663
-					$contents .= is_array($errors) ? implode("\n",$errors) : $errors;
662
+					$contents .= "\n".(is_numeric($target) ? '' : $target."\n");
663
+					$contents .= is_array($errors) ? implode("\n", $errors) : $errors;
664 664
 				}
665 665
 				$contents .= "\n";
666 666
 			}
Please login to merge, or discard this patch.
Braces   +16 added lines, -5 removed lines patch added patch discarded remove patch
@@ -113,7 +113,10 @@  discard block
 block discarded – undo
113 113
 			// Remove any left blank
114 114
 			foreach($schedule as $key => &$value)
115 115
 			{
116
-				if($value == '') unset($schedule[$key]);
116
+				if($value == '')
117
+				{
118
+					unset($schedule[$key]);
119
+				}
117 120
 			}
118 121
 			$result = $async->set_timer(
119 122
 				$schedule,
@@ -283,14 +286,16 @@  discard block
 block discarded – undo
283 286
 	*
284 287
 	* $data should contain target & type
285 288
 	*/
286
-	public static function check_target(Array $data) {
289
+	public static function check_target(Array $data)
290
+	{
287 291
 		$scheme = parse_url($data['target'], PHP_URL_SCHEME);
288 292
 		if($scheme == '' || $scheme == 'file')
289 293
 		{
290 294
 			return 'Direct file access not allowed';
291 295
 		}
292 296
 
293
-		if($scheme == Vfs::SCHEME  && !in_array(Vfs::SCHEME, stream_get_wrappers())) {
297
+		if($scheme == Vfs::SCHEME  && !in_array(Vfs::SCHEME, stream_get_wrappers()))
298
+		{
294 299
 			stream_wrapper_register(Vfs::SCHEME, 'vfs_stream_wrapper', STREAM_IS_URL);
295 300
 		}
296 301
 
@@ -315,8 +320,14 @@  discard block
 block discarded – undo
315 320
 			// Response code has an integer key, but redirects may add more responses
316 321
 			for($i = 0; $i < count($headers); $i++)
317 322
 			{
318
-				if(!$headers[$i]) break;
319
-				if(strpos($headers[$i],'200') !== false) return true;
323
+				if(!$headers[$i])
324
+				{
325
+					break;
326
+				}
327
+				if(strpos($headers[$i],'200') !== false)
328
+				{
329
+					return true;
330
+				}
320 331
 			}
321 332
 			return lang('%1 is not readable',$data['target']);
322 333
 		}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	/**
199 199
 	* Get options for select boxes
200 200
 	*/
201
-	public static function get_select_options(Array $data)
201
+	public static function get_select_options(array $data)
202 202
 	{
203 203
 		$options = array(
204 204
 			'type'	=>	array(
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	*
284 284
 	* $data should contain target & type
285 285
 	*/
286
-	public static function check_target(Array $data) {
286
+	public static function check_target(array $data) {
287 287
 		$scheme = parse_url($data['target'], PHP_URL_SCHEME);
288 288
 		if($scheme == '' || $scheme == 'file')
289 289
 		{
Please login to merge, or discard this patch.