Project

General

Profile

Download (19.7 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
	if(strtolower($_POST['name']) == "pptp")
107
		$input_errors[] = gettext("Aliases may not be named PPTP.");
108

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

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

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

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

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

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

    
162
	else
163
		$alias['address'] = $_POST['address'];
164

    
165
	$address = $alias['address'];
166
	$final_address_detail = mb_convert_encoding($_POST['detail'],"HTML-ENTITIES","auto");
167
  		if($final_address_detail <> "") {
168
	       	$final_address_details .= $final_address_detail;
169
	} else {
170
		$final_address_details .= "Entry added" . " ";
171
   			$final_address_details .= date('r');
172
		}
173
    	$final_address_details .= "||";
174
	$isfirst = 0;
175

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

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

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

    
259
	if (!$input_errors) {
260
		$alias['address'] = $address;
261
                $alias['descr']  =  mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto");
262
                $alias['type'] = $_POST['type'];
263
		$alias['detail'] = $final_address_details;
264

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

    
270
		touch($d_aliasesdirty_path);
271

    
272
		write_config();
273
		filter_configure();
274

    
275
		header("Location: firewall_aliases.php");
276
		exit;		
277
	}
278
	//we received input errors, copy data to prevent retype
279
	else
280
	{
281
                $pconfig['descr']  =  mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto");
282
                $pconfig['address'] = $address;
283
		$pconfig['type'] = $_POST['type'];
284
		$pconfig['detail'] = $final_address_details;
285
	}
286
}
287

    
288
include("head.inc");
289

    
290
$jscriptstr = <<<EOD
291

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

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

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

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

    
344
EOD;
345

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

    
357
$networks_help = gettext("Networks can be expressed like 10.0.0.0 format.  Select the CIDR (network mask) that pertains to each entry.");
358
$hosts_help = gettext("Enter as many hosts as you would like.  Hosts should be expressed in their ip address format.");
359
$ports_help = gettext("Enter as many ports as you wish.  Port ranges can be expressed by seperating with a colon.");
360
$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.");
361

    
362
$jscriptstr .= <<<EOD
363

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

    
403
EOD;
404

    
405
?>
406

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

    
413
<script type="text/javascript" src="row_helper.js">
414
</script>
415

    
416
<input type='hidden' name='address_type' value='textbox' />
417
<input type='hidden' name='address_subnet_type' value='select' />
418

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

    
424
	rowname[1] = "address_subnet";
425
	rowtype[1] = "select";
426
	rowsize[1] = "1";
427

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

    
433
<p class="pgtitle"><?=$pgtitle?></p>
434

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

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

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

    
541
        } // end foreach
542
      ?>
543
        </tbody>
544
        <tfoot>
545

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

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

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

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