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
	$pconfig['detail'] = $a_aliases[$id]['detail'];
51
	$pconfig['address'] = $a_aliases[$id]['address'];
52
	$pconfig['descr'] = html_entity_decode($a_aliases[$id]['descr']);
53
	
54
	$addresses = explode(' ', $pconfig['address']);
55
	$address = explode("/", $addresses[0]);
56
	if ($address[1])
57
		$addresssubnettest = true;
58
	else
59
		$addresssubnettest = false;	
60
	
61
	if ($addresssubnettest)
62
		$pconfig['type'] = "network";
63
	else
64
		if (is_ipaddr($address[0]))
65
			$pconfig['type'] = "host";
66
		else
67
			$pconfig['type'] = "port";
68

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

    
86
if ($_POST) {
87

    
88
	unset($input_errors);
89
	$pconfig = $_POST;
90

    
91
	/* input validation */
92
	$reqdfields = explode(" ", "name address");
93
	$reqdfieldsn = explode(",", "Name,Address");
94

    
95
	if ($_POST['type'] == "network") {
96
		$reqdfields[] = "address_subnet";
97
		$reqdfieldsn[] = "Subnet bit count";
98
	}
99

    
100
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
101

    
102
	if(strtolower($_POST['name']) == "lan")
103
		$input_errors[] = "Aliases may not be named LAN.";
104
	if(strtolower($_POST['name']) == "wan")
105
		$input_errors[] = "Aliases may not be named WAN.";
106

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

    
127
	if ($_POST['type'] == "url") {
128
		if(stristr($_POST['address'], "http") == false)
129
			$input_errors[] = "You must provide a valid URL to the resource.";
130
	}
131

    
132
	if ($_POST['type'] == "port")
133
		if (! is_port($_POST['address']) && ! is_portrange($_POST['address']))
134
			$input_errors[] = "Please specify a valid port or portrange.";
135

    
136
	/* check for name conflicts */
137
	foreach ($a_aliases as $alias) {
138
		if (isset($id) && ($a_aliases[$id]) && ($a_aliases[$id] === $alias))
139
			continue;
140

    
141
		if ($alias['name'] == $_POST['name']) {
142
			$input_errors[] = "An alias with this name already exists.";
143
			break;
144
		}
145
	}
146

    
147
	/* check for name interface description conflicts */
148
	foreach($config['interfaces'] as $interface) {
149
		if($interface['descr'] == $_POST['name']) {
150
			$input_errors[] = "An interface description with this name already exists.";
151
			break;
152
		}
153
	}
154
	
155
	$alias = array();
156
	$alias['name'] = $_POST['name'];
157
	if ($_POST['type'] == "network")
158
		$alias['address'] = $_POST['address'] . "/" . $_POST['address_subnet'];
159

    
160
	else
161
		$alias['address'] = $_POST['address'];
162

    
163
	$address = $alias['address'];
164
	$final_address_detail = htmlentities($_POST['detail'], ENT_QUOTES, 'UTF-8');
165
  		if($final_address_detail <> "") {
166
	       	$final_address_details .= $final_address_detail;
167
	} else {
168
		$final_address_details .= "Entry added" . " ";
169
   			$final_address_details .= date('r');
170
		}
171
    	$final_address_details .= "||";
172
	$isfirst = 0;
173

    
174
	if($_POST['type'] == "url") {
175
		$address = "";
176
		$isfirst = 0;
177
		$address_count = 2;
178

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

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

    
257
	if (!$input_errors) {
258
		$alias['address'] = $address;
259
		$alias['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
260
		$alias['type'] = $_POST['type'];
261
		$alias['detail'] = $final_address_details;
262

    
263
		if (isset($id) && $a_aliases[$id])
264
			$a_aliases[$id] = $alias;
265
		else
266
			$a_aliases[] = $alias;
267

    
268
		touch($d_aliasesdirty_path);
269

    
270
		write_config();
271
		filter_configure();
272

    
273
		header("Location: firewall_aliases.php");
274
		exit;		
275
	}
276
	//we received input errors, copy data to prevent retype
277
	else
278
	{
279
		$pconfig['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
280
		$pconfig['address'] = $address;
281
		$pconfig['type'] = $_POST['type'];
282
		$pconfig['detail'] = $final_address_details;;
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 = $pconfig['address'];
499
			$item = explode(" ", $address);
500
			$item3 = explode("||", $pconfig['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/175)