Login   Register  
PHP Classes
elePHPant
Icontem

File: php_package_maker.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Robert Kummer  >  package  >  php_package_maker.php  >  Download  
File: php_package_maker.php
Role: Application script
Content type: text/plain
Description: php-package maker
Class: package
php package maker and installer
Author: By
Last change: now the bug with $PHP_SELF for newer php versions is fixed
Date: 2002-09-05 10:46
Size: 21,836 bytes
 

Contents

Class file image Download
<?php
/*
	package::i.tools
	
	php-packages	v1.0	-	www.ipunkt.biz
	
	(c)	2002 - www.ipunkt.biz (rok)
*/

// FUNCTIONS //
function getDirs()
{
	$d = dir( dirname(__FILE__) );
	while ( $entry = $d->read() )
	{
		if ( $entry != "." && $entry != ".." && is_dir($entry) )
			$result[] = $entry."/";
	}
	$d->close();
	return $result;
}

function getFiles()
{
	$d = dir( dirname(__FILE__) );
	while ( $entry = $d->read() )
	{
		if ( $entry != "." && $entry != ".." && is_file($entry) )
			$result[] = $entry;
	}
	$d->close();
	return $result;
}

// MAIN //
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>php-package-maker v1.0</title>
	<base href="http://www.ipunkt.biz/service/">
	<link rel="stylesheet" href="itools.css" type="text/css" />
</head>

<body>
<?

$okay = ( $_POST['directories'] || $_POST['files'] ) && $_POST['pk_name'];

//	FORM DATA SENT	//
if ( $okay )
{
	require_once("class.package_maker.php");
	
	$pkg = new package($_POST['pk_name']);
	
	if ( !empty($_POST['directories']) )
	{
		foreach ( $_POST['directories'] as $dir )
		{
			$pkg->addDirectory($dir);
		}
	}
	if ( !empty($_POST['files']) )
	{
		foreach ( $_POST['files'] as $file )
		{
			$pkg->add($file);
		}
	}
	if ( !empty($_POST['config']) )
	{
		$pkg->setConfig($_POST['config']);
	}
	$result = $pkg->create();
	
	$pi = $pkg->getPackageInformation();
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr> 
		<td><img height="1" alt="" src="images/spacer.gif" width="12" border="0"></td>
		<td width="100%" class="content"><b>Neues Package erstellt</b>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr><td><img height="15" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" background="images/bgt.gif" border="0">
				<tr valign="top">
					<td><img height="27" alt="" src="images/ctl.gif" width="27" border="0"></td><!--ecke, oben links-->
					<td background="../images/hd_bg.gif" class="headline" nowrap>Package<img height="15" alt="" src="../images/hd_br.gif" width="30" border="0" align="absmiddle"></td><!--headline-->
					<td align="right" width="100%"><img height="27" alt="" src="images/ctr.gif" width="14" border="0"></td><!--abschluss, oben rechts-->
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" border="0">
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>Package Datei</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									<a href="http://www.ipunkt.biz/" target="_new" title="www.ipunkt.biz - mit stil im internet präsent sein"><img src="http://www.ipunkt.biz/images/advertizer.gif" width="88" height="31" border="0" align="right" /></a>
									Hier sehen Sie das Resultat Ihrer Einstellungen.
									<br /><img height="10" alt="" src="images/spacer.gif" width="1" border="0"><br />
									Statusmeldung des php-package-maker: <b><?=( $result ) ? '<span style="color: green">well done</span>' : '<span style="color: red">error occured</span>' ?></b><br /><br/>
									<?=$pkg->getPackageFilename() ?>&nbsp;&nbsp;&nbsp;(<?=filesize($pkg->getPackageFilename()) ?> bytes)<br />
									<dd>creation-time: <?=$pi['creation'] ?></dd>
									<dd>file-count: <?=$pi['files'] ?></dd>
									<dd>size-of-all-files: <?=$pi['files_size'] ?> bytes</dd>
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr>
					<td background="images/bgb.gif"><img height="14" alt="" src="images/cbl.gif" width="27" border="0"></td>
					<td align="right" width="100%" background="images/bgb.gif"><img height="14" alt="" src="images/cbr.gif" width="14" border="0"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr> 
		<td><img height="1" alt="" src="images/spacer.gif" width="12" border="0"></td>
		<td width="100%" class="content"><b>&nbsp;</b>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr><td><img height="15" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" background="images/bgt.gif" border="0">
				<tr valign="top">
					<td><img height="27" alt="" src="images/ctl.gif" width="27" border="0"></td><!--ecke, oben links-->
					<td background="images/hd_bg.gif" class="headline" nowrap>links<img height="15" alt="" src="images/hd_br.gif" width="30" border="0" align="absmiddle"></td><!--headline-->
					<td align="right" width="100%"><img height="27" alt="" src="images/ctr.gif" width="14" border="0"></td><!--abschluss, oben rechts-->
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" border="0">
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>package</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									<a href="<?=$_SERVER['PHP_SELF'] ?>">neues Package erstellen</a>
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>email</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									<a href="mailto:r.kummer@ipunkt.biz">Robert Kummer</a><br />
									<a href="mailto:b.gorke@ipunkt.biz">Bastian Gorke</a>
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr>
					<td background="images/bgb.gif"><img height="14" alt="" src="images/cbl.gif" width="27" border="0"></td>
					<td align="right" width="100%" background="images/bgb.gif"><img height="14" alt="" src="images/cbr.gif" width="14" border="0"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<?
}
else
//	FORM DATA NOT SENT YET	//
{

	$dirs = getDirs();
	$files = getFiles();
	?>
<form action="<?=$_SERVER['PHP_SELF'] ?>" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr> 
		<td><img height="1" alt="" src="images/spacer.gif" width="12" border="0"></td>
		<td width="100%" class="content"><b onclick="javascript:location.href='<?=$_SERVER['PHP_SELF'] ?>'">Neues Package erstellen</b>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr><td><img height="15" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" background="images/bgt.gif" border="0">
				<tr valign="top">
					<td><img height="27" alt="" src="images/ctl.gif" width="27" border="0"></td><!--ecke, oben links-->
					<td background="images/hd_bg.gif" class="headline" nowrap>Package betiteln<img height="15" alt="" src="images/hd_br.gif" width="30" border="0" align="absmiddle"></td><!--headline-->
					<td align="right" width="100%"><img height="27" alt="" src="images/ctr.gif" width="14" border="0"></td><!--abschluss, oben rechts-->
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" border="0">
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>Package Name</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									<a href="http://www.ipunkt.biz/" target="_new" title="www.ipunkt.biz - mit stil im internet präsent sein"><img src="http://www.ipunkt.biz/images/advertizer.gif" width="88" height="31" border="0" align="right" /></a>
									Geben Sie hier bitte den Namen des zu erstellenden Packages an.
									<br /><img height="10" alt="" src="images/spacer.gif" width="1" border="0"><br />
									<input type="text" name="pk_name" value="<?=$_POST['pk_name'] ?>" class="text" />
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr>
					<td background="images/bgb.gif"><img height="14" alt="" src="images/cbl.gif" width="27" border="0"></td>
					<td align="right" width="100%" background="images/bgb.gif"><img height="14" alt="" src="images/cbr.gif" width="14" border="0"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr> 
		<td><img height="1" alt="" src="images/spacer.gif" width="12" border="0"></td>
		<td width="100%" class="content"><b>&nbsp;</b>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr><td><img height="15" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" background="images/bgt.gif" border="0">
				<tr valign="top">
					<td width="27"><img height="27" alt="" src="images/ctl.gif" width="27" border="0"></td><!--ecke, oben links-->
					<td background="images/hd_bg.gif" class="headline" nowrap>Dateien auswählen<img height="15" alt="" src="images/hd_br.gif" width="30" border="0" align="absmiddle"></td><!--headline-->
					<td align="right" width="100%"><img height="27" alt="" src="images/ctr.gif" width="14" border="0"></td><!--abschluss, oben rechts-->
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" border="0">
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>Verzeichnisse</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									Wählen Sie hier bitte die Verzeichnisse aus, die Sie komplett in des Package übernehmen wollen (inklusive aller Unterverzeichnisse).
									<br /><img height="10" alt="" src="images/spacer.gif" width="1" border="0"><br />
							<?
							if ( is_array($dirs) )
							{
								foreach ( $dirs as $dir )
								{
									?>
									<input type="checkbox" name="directories[]" value="<?=$dir ?>" class="check" />&nbsp;&nbsp;&nbsp;<?=$dir ?><br />
									<?
								}
							}
							else
							{
								?>
									Keine Verzeichnisse gefunden.
								<?
							}
							?>
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>Dateien</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									Wählen Sie hier bitte die Dateien aus, die Sie in des Package übernehmen wollen.
									<br /><img height="10" alt="" src="images/spacer.gif" width="1" border="0"><br />
								<?
								foreach ( $files as $file )
								{
									?>
									<input type="checkbox" name="files[]" value="<?=$file ?>" class="check" />&nbsp;&nbsp;&nbsp;<?=$file ?><br />
									<?
								}
								?>
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr>
					<td background="images/bgb.gif"><img height="14" alt="" src="images/cbl.gif" width="27" border="0"></td>
					<td align="right" width="100%" background="images/bgb.gif"><img height="14" alt="" src="images/cbr.gif" width="14" border="0"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr> 
		<td><img height="1" alt="" src="images/spacer.gif" width="12" border="0"></td>
		<td width="100%" class="content"><b>&nbsp;</b>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr><td><img height="15" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" background="images/bgt.gif" border="0">
				<tr valign="top">
					<td><img height="27" alt="" src="images/ctl.gif" width="27" border="0"></td><!--ecke, oben links-->
					<td background="images/hd_bg.gif" class="headline" nowrap>Optionen festlegen<img height="15" alt="" src="images/hd_br.gif" width="30" border="0" align="absmiddle"></td><!--headline-->
					<td align="right" width="100%"><img height="27" alt="" src="images/ctr.gif" width="14" border="0"></td><!--abschluss, oben rechts-->
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" border="0">
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>Optionen</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									Wählen Sie hier bitte die Optionen aus, die Sie dem Package übergeben wollen. Diese werden bei Der Installation berücksichtigt.
									<br /><img height="10" alt="" src="images/spacer.gif" width="1" border="0"><br />
									<input type="checkbox" name="config[do][]" value="setup.php" class="check" />&nbsp;&nbsp;&nbsp;setup.php nach erfolgreicher Installation ausführen<br /><br />
									<input type="checkbox" name="config[cleanup][]" value="package" class="check" />&nbsp;&nbsp;&nbsp;.phi Package nach erfolgreicher Installation löschen<br />
									<input type="checkbox" name="config[cleanup][]" value="installer" class="check" />&nbsp;&nbsp;&nbsp;PHInstaller nach erfolgreicher Installation löschen<br />
									<img height="10" alt="" src="images/spacer.gif" width="1" border="0"><br /><i>Wenn Sie 'self-extracting package erstellen' auswählen genügt es eine der oberen Optionen ('.phi löschen' oder 'PHInstaller löschen') zu aktivieren, um das Package zu löschen.</i><br /><img height="10" alt="" src="images/spacer.gif" width="1" border="0"><br />
									<input type="checkbox" name="config[phx]" value="1"  class="check"/>&nbsp;&nbsp;&nbsp;self-extracting package aus dem .phi Package erstellen<br />
								<?
								if ( extension_loaded('zlib') )
								{
									?>
									<input type="checkbox" name="config[compress]" value="gzip" class="check" />&nbsp;&nbsp;&nbsp;Package mit gzip packen (zlib wird vorausgesetzt)<br />
									<?
								}
								?>
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr>
					<td background="images/bgb.gif"><img height="14" alt="" src="images/cbl.gif" width="27" border="0"></td>
					<td align="right" width="100%" background="images/bgb.gif"><img height="14" alt="" src="images/cbr.gif" width="14" border="0"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr> 
		<td><img height="1" alt="" src="images/spacer.gif" width="12" border="0"></td>
		<td width="100%" class="content"><b>&nbsp;</b>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr><td><img height="15" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" background="images/bgt.gif" border="0">
				<tr valign="top">
					<td><img height="27" alt="" src="images/ctl.gif" width="27" border="0"></td><!--ecke, oben links-->
					<td background="images/hd_bg.gif" class="headline" nowrap>Package erstellen<img height="15" alt="" src="images/hd_br.gif" width="30" border="0" align="absmiddle"></td><!--headline-->
					<td align="right" width="100%"><img height="27" alt="" src="images/ctr.gif" width="14" border="0"></td><!--abschluss, oben rechts-->
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#ffffff" border="0">
				<tr valign="top">
					<td background="images/bgl.gif"><img height="14" alt="" src="images/arrow.gif" width="34" border="0"></td><!--"anstrich"-punkt für die headline-->
<!--main content-->	<td class="content" width="100%"><b>Package erstellen</b><br><img height="6" alt="" src="images/spacer.gif" width="1" border="0"><br>
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
							<tr>
								<td class="content">
									<input type="submit" value="Package erstellen" name="sent" />
								</td>
							</tr>
							<tr><td><img height="9" alt="" src="images/spacer.gif" width="1" border="0"></td></tr><!--space from bottom-->
						</table>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr><td><img height="14" alt="" src="images/spacer.gif" width="1" border="0"></td></tr>
						</table>
					</td>
					<td background="images/bgr.gif"><img height="1" alt="" src="images/spacer.gif" width="14" border="0"></td>
				</tr>
			</table>
			<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tr>
					<td background="images/bgb.gif"><img height="14" alt="" src="images/cbl.gif" width="27" border="0"></td>
					<td align="right" width="100%" background="images/bgb.gif"><img height="14" alt="" src="images/cbr.gif" width="14" border="0"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>
<?
}
?>