Project

General

Profile

Download (19.5 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	firewall_aliases_edit.php
5
	Copyright (C) 2004 Scott Ullrich
6
	All rights reserved.
7

    
8
	originially part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11

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

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

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

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

    
34
$pgtitle = "Firewall: Aliases: Edit";
35

    
36
require("guiconfig.inc");
37

    
38
if (!is_array($config['aliases']['alias']))
39
	$config['aliases']['alias'] = array();
40

    
41
aliases_sort();
42
$a_aliases = &$config['aliases']['alias'];
43

    
44
$id = $_GET['id'];
45
if (isset($_POST['id']))
46
	$id = $_POST['id'];
47

    
48
if (isset($id) && $a_aliases[$id]) {
49
	$pconfig['name'] = $a_aliases[$id]['name'];
50
	$addresses = explode(' ', $a_aliases[$id]['address']);
51
	if (is_array($addresses))
52
		$address = $addresses[0];
53
	else
54
		$address = $addresses;
55
	list($pconfig['address'],$pconfig['address_subnet']) =
56
		explode('/', $address);
57
	if ($pconfig['address_subnet'])
58
		$pconfig['type'] = "network";
59
	else
60
		if (is_ipaddr($pconfig['address']))
61
			$pconfig['type'] = "host";
62
		else
63
			$pconfig['type'] = "port";
64

    
65
	$pconfig['descr'] = html_entity_decode($a_aliases[$id]['descr']);
66

    
67
	/* Explode out details for entry details */
68
	$address_details = explode('||', $a_aliases[$id]['detail']);
69
	if (is_array($address_details))
70
			$address_detail = $address_details[0];
71
	else
72
		$address_detail = $address_details;
73

    
74
	if($a_aliases[$id]['aliasurl'] <> "") {
75
		$pconfig['type'] = "url";
76
		if(is_array($a_aliases[$id]['aliasurl'])) {
77
			$isfirst = 0;
78
			$pconfig['address'] = "";
79
			foreach($a_aliases[$id]['aliasurl'] as $aa) {
80
				if($isfirst == 1)
81
					$pconfig['address'] .= " ";
82
				$isfirst = 1;
83
				$pconfig['address'] .= $aa;
84
			}
85
		} else {
86
			$pconfig['address'] = $a_aliases[$id]['aliasurl'];
87
		}
88
	}
89
}
90

    
91
if ($_POST) {
92

    
93
	unset($input_errors);
94
	$pconfig = $_POST;
95

    
96
	/* input validation */
97
	$reqdfields = explode(" ", "name address");
98
	$reqdfieldsn = explode(",", "Name,Address");
99

    
100
	if ($_POST['type'] == "network") {
101
		$reqdfields[] = "address_subnet";
102
		$reqdfieldsn[] = "Subnet bit count";
103
	}
104

    
105
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
106

    
107
	if(strtolower($_POST['name']) == "lan")
108
		$input_errors[] = "Aliases may not be named LAN.";
109
	if(strtolower($_POST['name']) == "wan")
110
		$input_errors[] = "Aliases may not be named WAN.";
111

    
112
	$x = is_validaliasname($_POST['name']);
113
	if (!isset($x)) {
114
		$input_errors[] = "Reserved word used for alias name.";
115
	} else {
116
		if (is_validaliasname($_POST['name']) == false)
117
			$input_errors[] = "The alias name may only consist of the characters a-z, A-Z, 0-9, -, _.";
118
	}
119
	if ($_POST['type'] == "host")
120
		if (!is_ipaddr($_POST['address'])) {
121
			$input_errors[] = "A valid address must be specified.";
122
		}
123
	if ($_POST['type'] == "network") {
124
		if (!is_ipaddr($_POST['address'])) {
125
			$input_errors[] = "A valid address must be specified.";
126
		}
127
		if (!is_numeric($_POST['address_subnet'])) {
128
			$input_errors[] = "A valid subnet bit count must be specified.";
129
		}
130
	}
131

    
132
	if ($_POST['type'] == "url") {
133
		if(stristr($_POST['address'], "http") == false)
134
			$input_errors[] = "You must provide a valid URL to the resource.";
135
	}
136

    
137
	if ($_POST['type'] == "port")
138
		if (! is_port($_POST['address']) && ! is_portrange($_POST['address']))
139
			$input_errors[] = "Please specify a valid port or portrange.";
140

    
141
	/* check for name conflicts */
142
	foreach ($a_aliases as $alias) {
143
		if (isset($id) && ($a_aliases[$id]) && ($a_aliases[$id] === $alias))
144
			continue;
145

    
146
		if ($alias['name'] == $_POST['name']) {
147
			$input_errors[] = "An alias with this name already exists.";
148
			break;
149
		}
150
	}
151

    
152
	/* check for name interface description conflicts */
153
	foreach($config['interfaces'] as $interface) {
154
		if($interface['descr'] == $_POST['name']) {
155
			$input_errors[] = "An interface description with this name already exists.";
156
			break;
157
		}
158
	}
159

    
160
	if (!$input_errors) {
161
		$alias = array();
162
		$alias['name'] = $_POST['name'];
163
		if ($_POST['type'] == "network")
164
			$alias['address'] = $_POST['address'] . "/" . $_POST['address_subnet'];
165

    
166
		else
167
			$alias['address'] = $_POST['address'];
168

    
169
		$address = $alias['address'];
170
		$final_address_detail = htmlentities($_POST['detail'], ENT_QUOTES, 'UTF-8');
171
      		if($final_address_detail <> "") {
172
		       	$final_address_details .= $final_address_detail;
173
		} else {
174
   			$final_address_details .= "Entry added" . " ";
175
       			$final_address_details .= date('r');
176
    		}
177
	    	$final_address_details .= "||";
178
		$isfirst = 0;
179

    
180
		if($_POST['type'] == "url") {
181
			$address = "";
182
			$isfirst = 0;
183
			$address_count = 2;
184

    
185
			/* item is a url type */
186
			if($_POST['address'])
187
				$_POST['address0'] = $_POST['address'];
188
			for($x=0; $x<99; $x++) {
189
				if($_POST['address' . $x]) {
190
					/* fetch down and add in */
191
					$isfirst = 0;
192
					$temp_filename = tempnam("/tmp/", "alias_import");
193
					unlink($temp_filename);
194
					$fda = fopen("/tmp/tmpfetch","w");
195
					fwrite($fda, "/usr/bin/fetch -q -o \"{$temp_filename}/aliases\" \"" . $_POST['address' . $x] . "\"");
196
					fclose($fda);
197
					mwexec("mkdir -p {$temp_filename}");
198
					mwexec("/usr/bin/fetch -q -o \"{$temp_filename}/aliases\" \"" . $_POST['address' . $x] . "\"");
199
					/* if the item is tar gzipped then extract */
200
					if(stristr($_POST['address' . $x], ".tgz"))
201
						process_alias_tgz($temp_filename);
202
					if(file_exists("{$temp_filename}/aliases")) {
203
						$file_contents = file_get_contents("{$temp_filename}/aliases");
204
						$file_contents = str_replace("#", "\n#", $file_contents);
205
						$file_contents_split = split("\n", $file_contents);
206
						foreach($file_contents_split as $fc) {
207
							$tmp = trim($fc);
208
							if(stristr($fc, "#")) {
209
								$tmp_split = split("#", $tmp);
210
								$tmp = trim($tmp_split[0]);
211
							}
212
							if(trim($tmp) <> "") {
213
								if($isfirst == 1)
214
									$address .= " ";
215
								$address .= $tmp;
216
								$isfirst = 1;
217
							}
218
						}
219
						if($isfirst == 0) {
220
							/* nothing was found */
221
							$input_errors[] = "You must provide a valid URL. Could not fetch usable data.";
222
							$dont_update = true;
223
							break;
224
						}
225
						$alias['aliasurl'][] = $_POST['address' . $x];
226
						mwexec("/bin/rm -rf {$temp_filename}");
227
					} else {
228
						$input_errors[] = "You must provide a valid URL.";
229
						$dont_update = true;
230
						break;
231
					}
232
				}
233
			}
234
		} else {
235
			/* item is a normal alias type */
236
			for($x=0; $x<99; $x++) {
237
				$comd = "\$subnet = \$_POST['address" . $x . "'];";
238
				eval($comd);
239
				$comd = "\$subnet_address = \$_POST['address_subnet" . $x . "'];";
240
				eval($comd);
241
				if($subnet <> "") {
242
					$address .= " ";
243
					$address .= $subnet;
244
					if($subnet_address <> "") $address .= "/" . $subnet_address;
245

    
246
					/* Compress in details to a single key, data separated by pipes.
247
					   Pulling details here lets us only pull in details for valid
248
					   address entries, saving us from having to track which ones to
249
					   process later. */
250
		       $comd = "\$final_address_detail = htmlentities( \$_POST['detail" . $x . "'], ENT_QUOTES, 'UTF-8' );";
251
		       eval($comd);
252
		       if($final_address_detail <> "") {
253
		       $final_address_details .= $final_address_detail;
254
		       } else {
255
			       $final_address_details .= "Entry added" . " ";
256
			       $final_address_details .= date('r');
257
		       }
258
		       $final_address_details .= "||";
259
				}
260
			}
261
		}
262

    
263
		if($dont_update <> true) {
264

    
265
			$alias['address'] = $address;
266
			$alias['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
267
			$alias['type'] = $_POST['type'];
268
			$alias['detail'] = $final_address_details;
269

    
270
			if (isset($id) && $a_aliases[$id])
271
				$a_aliases[$id] = $alias;
272
			else
273
				$a_aliases[] = $alias;
274

    
275
			touch($d_aliasesdirty_path);
276

    
277
			write_config();
278
			filter_configure();
279

    
280
			header("Location: firewall_aliases.php");
281
			exit;
282
		}
283
	}
284
}
285

    
286
include("head.inc");
287

    
288
$jscriptstr = <<<EOD
289

    
290
<script type="text/javascript">
291
function typesel_change() {
292
	switch (document.iform.type.selectedIndex) {
293
		case 0:	/* host */
294
			var cmd;
295

    
296
			document.iform.address_subnet.disabled = 1;
297
			document.iform.address_subnet.value = "";
298
			document.iform.address_subnet.selected = 0;
299
			newrows = totalrows+1;
300
			for(i=2; i<newrows; i++) {
301
				comd = 'document.iform.address_subnet' + i + '.disabled = 1;';
302
				eval(comd);
303
				comd = 'document.iform.address_subnet' + i + '.value = "";';
304
				eval(comd);
305
			}
306
			break;
307
		case 1:	/* network */
308
			var cmd;
309

    
310
			document.iform.address_subnet.disabled = 0;
311
			newrows = totalrows+1;
312
			for(i=2; i<newrows; i++) {
313
				comd = 'document.iform.address_subnet' + i + '.disabled = 0;';
314
				eval(comd);
315
			}
316
			break;
317
		case 2:	/* port */
318
			var cmd;
319

    
320
			document.iform.address_subnet.disabled = 1;
321
			document.iform.address_subnet.value = "";
322
			newrows = totalrows+1;
323
			for(i=2; i<newrows; i++) {
324
				comd = 'document.iform.address_subnet' + i + '.disabled = 1;';
325
				eval(comd);
326
				comd = 'document.iform.address_subnet' + i + '.value = "32";';
327
				eval(comd);
328
			}
329
			break;
330
		case 3:	/* url */
331
			var cmd;
332
			document.iform.address_subnet.disabled = 0;
333
			newrows = totalrows+1;
334
			for(i=2; i<newrows; i++) {
335
				comd = 'document.iform.address_subnet' + i + '.disabled = 0;';
336
				eval(comd);
337
			}
338
			break;
339
	}
340
}
341

    
342
EOD;
343

    
344
$network_str = gettext("Network");
345
$networks_str = gettext("Network(s)");
346
$cidr_str = gettext("CIDR");
347
$description_str = gettext("Description");
348
$hosts_str = gettext("Host(s)");
349
$ip_str = gettext("IP");
350
$ports_str = gettext("Port(s)");
351
$port_str = gettext("Port");
352
$url_str = gettext("URL");
353
$update_freq_str = gettext("Update Freq.");
354

    
355
$networks_help = gettext("Networks can be expressed like 10.0.0.0 format.  Select the CIDR (network mask) that pertains to each entry.");
356
$hosts_help = gettext("Enter as many hosts as you would like.  Hosts should be expressed in their ip address format.");
357
$ports_help = gettext("Enter as many ports as you wish.  Port ranges can be expressed by seperating with a colon.");
358
$url_help = gettext("Enter as many urls as you wish.  Also set the time that you would like the url refreshed in days.  After saving {$g['product_name']} will download the URL and import the items into the alias.");
359

    
360
$jscriptstr .= <<<EOD
361

    
362
function update_box_type() {
363
	var indexNum = document.forms[0].type.selectedIndex;
364
	var selected = document.forms[0].type.options[indexNum].text;
365
	if(selected == '{$networks_str}') {
366
		document.getElementById ("addressnetworkport").firstChild.data = "{$networks_str}";
367
		document.getElementById ("address_subnet").visible = true;
368
		document.getElementById ("address_subnet").disabled = false;
369
		document.getElementById ("onecolumn").firstChild.data = "{$network_str}";
370
		document.getElementById ("twocolumn").firstChild.data = "{$cidr_str}";
371
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
372
		document.getElementById ("itemhelp").firstChild.data = "{$networks_help}";
373
	} else if(selected == '{$hosts_str}') {
374
		document.getElementById ("addressnetworkport").firstChild.data = "{$hosts_str}";
375
		document.getElementById ("address_subnet").visible = false;
376
		document.getElementById ("address_subnet").disabled = true;
377
		document.getElementById ("onecolumn").firstChild.data = "{$ip_str}";
378
		document.getElementById ("twocolumn").firstChild.data = "";
379
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
380
		document.getElementById ("itemhelp").firstChild.data = "{$hosts_help}";
381
	} else if(selected == '{$ports_str}') {
382
		document.getElementById ("addressnetworkport").firstChild.data = "{$ports_str}";
383
		document.getElementById ("address_subnet").visible = false;
384
		document.getElementById ("address_subnet").disabled = true;
385
		document.getElementById ("onecolumn").firstChild.data = "{$port_str}";
386
		document.getElementById ("twocolumn").firstChild.data = "";
387
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
388
		document.getElementById ("itemhelp").firstChild.data = "{$ports_help}";
389
	} else if(selected == '{$url_str}') {
390
		document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}";
391
		document.getElementById ("address_subnet").visible = true;
392
		document.getElementById ("address_subnet").disabled = false;
393
		document.getElementById ("onecolumn").firstChild.data = "{$url_str}";
394
		document.getElementById ("twocolumn").firstChild.data = "{$update_freq_str}";
395
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
396
		document.getElementById ("itemhelp").firstChild.data = "{$url_help}";
397
	}
398
}
399
</script>
400

    
401
EOD;
402

    
403
?>
404

    
405
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
406
<?php
407
	include("fbegin.inc");
408
	echo $jscriptstr;
409
?>
410

    
411
<script type="text/javascript" src="row_helper.js">
412
</script>
413

    
414
<input type='hidden' name='address_type' value='textbox' />
415
<input type='hidden' name='address_subnet_type' value='select' />
416

    
417
<script type="text/javascript">
418
	rowname[0] = "address";
419
	rowtype[0] = "textbox";
420
	rowsize[0] = "30";
421

    
422
	rowname[1] = "address_subnet";
423
	rowtype[1] = "select";
424
	rowsize[1] = "1";
425

    
426
	rowname[2] = "detail";
427
	rowtype[2] = "textbox";
428
	rowsize[2] = "61";
429
</script>
430

    
431
<p class="pgtitle"><?=$pgtitle?></p>
432

    
433
<?php if ($input_errors) print_input_errors($input_errors); ?>
434
<div id="inputerrors"></div>
435

    
436
<form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
437
<table width="100%" border="0" cellpadding="6" cellspacing="0">
438
<?php if(is_alias_inuse($pconfig['name']) == true): ?>
439
  <tr>
440
    <td valign="top" class="vncellreq">Name</td>
441
    <td class="vtable"> <input name="name" type="hidden" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
442
		  <?php echo $pconfig['name']; ?>
443
      <p>
444
        <span class="vexpl">NOTE: This alias is in use so the name may not be modified!</span>
445
      </p>
446
    </td>
447
  </tr>
448
<?php else: ?>
449
  <tr>
450
    <td valign="top" class="vncellreq">Name</td>
451
    <td class="vtable">
452
      <input name="name" type="text" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
453
      <br />
454
      <span class="vexpl">
455
        The name of the alias may only consist of the characters a-z, A-Z and 0-9.
456
      </span>
457
    </td>
458
  </tr>
459
<?php endif; ?>
460
  <tr>
461
    <td width="22%" valign="top" class="vncell">Description</td>
462
    <td width="78%" class="vtable">
463
      <input name="descr" type="text"  id="descr" size="40" value="<?=$pconfig['descr'];?>" />
464
      <br />
465
      <span class="vexpl">
466
        You may enter a description here for your reference (not parsed).
467
      </span>
468
    </td>
469
  </tr>
470
  <tr>
471
    <td valign="top" class="vncellreq">Type</td>
472
    <td class="vtable">
473
      <select name="type" class="formselect" id="type" onchange="update_box_type(); typesel_change();">
474
        <option value="host" <?php if ($pconfig['type'] == "host") echo "selected"; ?>>Host(s)</option>
475
        <option value="network" <?php if ($pconfig['type'] == "network") echo "selected"; ?>>Network(s)</option>
476
        <option value="port" <?php if ($pconfig['type'] == "port") echo "selected"; ?>>Port(s)</option>
477
      </select>
478
    </td>
479
  </tr>
480
  <tr>
481
    <td width="22%" valign="top" class="vncellreq"><div id="addressnetworkport">Host(s)</div></td>
482
    <td width="78%" class="vtable">
483
      <table id="maintable">
484
        <tbody>
485
          <tr>
486
            <td colspan="4">
487
      		    <div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">Item information</div>
488
            </td>
489
          </tr>
490
          <tr>
491
            <td><div id="onecolumn">Network</div></td>
492
            <td><div id="twocolumn">CIDR</div></td>
493
           <td><div id="threecolumn">Description</div></td>
494
          </tr>
495

    
496
			<?php
497
			$counter = 0;
498
			$address = $a_aliases[$id]['address'];
499
			$item = explode(" ", $address);
500
			$item3 = explode("||", $a_aliases[$id]['detail']);
501
			foreach($item as $ww) {
502
				$address = $item[$counter];
503
				$address_subnet = "";
504
				$item2 = explode("/", $address);
505
				foreach($item2 as $current) {
506
					if($item2[1] <> "") {
507
						$address = $item2[0];
508
						$address_subnet = $item2[1];
509
					}
510
				}
511
				$item4 = $item3[$counter];
512
				if($counter > 0) $tracker = $counter + 1;
513
			?>
514
          <tr>
515
            <td>
516
              <input name="address<?php echo $tracker; ?>" type="text"  id="address<?php echo $tracker; ?>" size="30" value="<?=htmlspecialchars($address);?>" />
517
            </td>
518
            <td>
519
			        <select name="address_subnet<?php echo $tracker; ?>" class="formselect" id="address_subnet<?php echo $tracker; ?>">
520
			          <option></option>
521
			          <?php for ($i = 32; $i >= 1; $i--): ?>
522
			          <option value="<?=$i;?>" <?php if ($i == $address_subnet) echo "selected"; ?>><?=$i;?></option>
523
			          <?php endfor; ?>
524
			        </select>
525
			      </td>
526
            <td>
527
              <input name="detail<?php echo $tracker; ?>" type="text"  id="detail<?php echo $tracker; ?>" size="50" value="<?=$item4;?>" />
528
            </td>
529
            <td>
530
    			  <?php
531
    				if($counter > 0)
532
    					echo "<input type=\"image\" src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" onclick=\"removeRow(this); return false;\" value=\"Delete\" />";
533
    			  ?>
534
			      </td>
535
          </tr>
536
			<?php
537
        $counter++;
538

    
539
        } // end foreach
540
      ?>
541
        </tbody>
542
        <tfoot>
543

    
544
        </tfoot>
545
		  </table>
546
			<a onclick="javascript:addRowTo('maintable'); typesel_change(); return false;" href="#">
547
        <img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" />
548
      </a>
549
		</td>
550
  </tr>
551
  <tr>
552
    <td width="22%" valign="top">&nbsp;</td>
553
    <td width="78%">
554
      <input id="submit" name="submit" type="submit" class="formbtn" value="Save" />
555
      <input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="Cancel" onclick="history.back()" />
556
      <?php if (isset($id) && $a_aliases[$id]): ?>
557
      <input name="id" type="hidden" value="<?=$id;?>" />
558
      <?php endif; ?>
559
    </td>
560
  </tr>
561
</table>
562
</form>
563

    
564
<script type="text/javascript">
565
	field_counter_js = 3;
566
	rows = 1;
567
	totalrows = <?php echo $counter; ?>;
568
	loaded = <?php echo $counter; ?>;
569
	typesel_change();
570
	update_box_type();
571
</script>
572

    
573
<?php include("fend.inc"); ?>
574
</body>
575
</html>
576

    
577
<?php
578
function process_alias_tgz($temp_filename) {
579
	mwexec("/bin/mv {$temp_filename}/aliases {$temp_filename}/aliases.tgz");
580
	mwexec("/usr/bin/tar xzf {$temp_filename}/aliases.tgz -C {$temp_filename}/aliases/");
581
	unlink("{$temp_filename}/aliases.tgz");
582
	$files_to_process = return_dir_as_array("{$temp_filename}/");
583
	/* foreach through all extracted files and build up aliases file */
584
	$fd = fopen("{$temp_filename}/aliases", "a");
585
	foreach($files_to_process as $f2p) {
586
		$file_contents = file_get_contents($f2p);
587
		fwrite($fd, $file_contents);
588
		unlink($f2p);
589
	}
590
	fclose($fd);
591
}
592
?>
(39-39/167)