Location: PHPKode > projects > Netautor Professional > netautor/napro4/admin/exchange/appl_inspector.php
<?php
/* +----------------------------------------------------------------------+
   | Netautor Professional Application Server                             |
   +----------------------------------------------------------------------+
   | Copyright (C) 1998-2005 digiconcept GmbH. <www.digiconcept.net>      |
   +----------------------------------------------------------------------+
   | This file is subject to license, that is bundled with this package   |
   | in the file LICENSE.TXT, and is available at through the             |
   | world-wide-web at http://www.netautor.com/license/                   |
   |                                                                      |
   | If you did not receive a copy of the license and are unable to       |
   | obtain it through the world-wide-web, please send a note to          |
   | hide@address.com so we can mail you a copy.                      |
   +----------------------------------------------------------------------+
   | Authors: Stefan Rottensteiner <hide@address.com>    |
   |          Marek  Kadziela      <hide@address.com>	      |
   |          Gregor Wollner                                              |
   |          Christian Unger                                             |
   |          Helli  Kleinhans  									      |
   +----------------------------------------------------------------------+*/

   /**
    * See whats in your import-directory
	*
	* @author	Stefan Rottensteiner
	* @version	$Revision: 1.13 $
    */

	require_once('../../include/init.inc');
	if(!$USER->check_feature('Admin') && !$USER->check_feature('ac_import') && !$USER->check_feature('ac_export'))
	{
		$USER->login_call();
	}

	includeNapro('file,xml,array');
	$CRLF="\r\n";

	$app_path = str_replace("//",'/',str_replace("\\",'/',$_GET['app_path'].'/'.$_GET['app_name'])).'/';

	$Summary	= array();
	$files 		= Read_Dir($app_path,'.xml');

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>/digiconcept/netautor/export/inspector</title>
	<meta http-equiv="pragma" 			content="no-cache"> 
	<meta http-equiv="cache-control" 	content="no-cache">
	<meta name		="robots" 			content="noindex">			
	<link rel="stylesheet" type="TEXT/CSS" media="screen" href="../../include/netautor.css">	
<script language="JavaScript"><!-- 
	function closeFrame()
	{
		top.main.document.getElementById('f_import').rows='*,0';
	}
// --></script>
</head>
<body class="blue" onLoad="window.focus();">

<?php if (empty($files)) : ?>
	<br/>
	<br/>
	<center>
	<span class="text">
	<b>
	<?php echo($LOCALE->dgettext('exchange','msg_invalid_import_name')); ?>
	</b>
	</span>
	</center>
<?php else :?>
<a href="details"></a>
<table align="center" width="99%" border="0" cellspacing="1" cellpadding="0">
	<tr class="textwhite">
		<th class="textwhite" colspan="5" align="right">
			<a class="link"  href="#summary">&raquo; <?php echo($LOCALE->dgettext('exchange','summary')); ?></a>
		</th>
	</tr>
	<TR>
	<TH class="textwhite"><?php echo($LOCALE->dgettext('exchange','file')); ?></th>
	 <TH class="textwhite"><?php echo($LOCALE->dgettext('exchange','appl_parts')); ?></th>
	 <TH class="textwhite"><?php echo($LOCALE->dgettext('exchange','counter')); ?></th>
	 <TH class="textwhite"><?php echo($LOCALE->dgettext('exchange','time')); ?></th>
	 <TH class="textwhite"><?php echo($LOCALE->dgettext('exchange','version'));; ?></th>
	</tr>
<?php 

function Import_readMetaData($filename)
{
	if (!file_exists($filename)) return false;

	@$file = fopen($filename,'rb');
	if (!$file) 
	{
 		echo $LOCALE->dgettext('exchange','msg_file_not_dound') ;return false;
	}

	$line	='';
	$buffer='';
	$Meta	=array();

	do
	{
		$line 				= fgets($file,2048);
		$meta_start_found 	= strstr($line,'<METADATA>');
	}
	while((!feof($file)) && empty($meta_start_found));

	if (!empty($meta_start_found))
	{
	 	$buffer 	= substr($line,strpos($line,'<METADATA>'));
		do
		{
			$line			= 	fgets($file,2048);
			$meta_end_found = 	strstr($line,'</METADATA>');
			$buffer.=			$line;
		}
		while((!feof($file)) && empty($meta_end_found));

	 	if (!empty($meta_end_found))
		{
		 $params['unique']=false;
		 $Meta = array();
		 XML_ToArray($buffer,$Meta,$params);
		 $Meta = $Meta['METADATA'][0];
		 if (!empty($Meta['TABLEDEF'][0]['DEPENDENCY']))
		 {
			for ($i=count($Meta['TABLEDEF'][0]['DEPENDENCY'])-1;$i>=0;$i--)
			{
				$depend = $Meta['TABLEDEF'][0]['DEPENDENCY'][$i];
				if ($depend['TABLE'][0]==$Meta['TABLEDEF'][0]['NAME'][0])
				{
					$Inner[] = $depend;
				}
				else
				{
					$Outer[]= $depend;
				}
			}
			unset($Meta['TABLEDEF'][0]['DEPENDENCY']);
			if (isset($Inner)) $Meta['TABLEDEF']["inner_dependency"]=$Inner;
			if (isset($Outer)) $Meta['TABLEDEF']["outer_dependency"]=$Outer;
		 }
		return $Meta;
		}
		else
		{
		 return false;
		}
	}
	else
	{
	 return false;
	}
}
	if (!empty($files))
	{
		$f = "&nbsp;";
		for ($index=count($files)-1;$index>=0;$index--)
		{
			$App_part = '???';
			$filename = $app_path.$files[$index];
			$Meta=Import_readMetaData($filename);

			if ($Meta['TABLEDEF'][0]['NAME'][0]=='mdocs') 		$App_part=$LOCALE->dgettext('exchange','docs');
			if ($Meta['TABLEDEF'][0]['NAME'][0]=='melements') 	$App_part=$LOCALE->dgettext('exchange','fields');
			if ($Meta['TABLEDEF'][0]['NAME'][0]=='mlayouts') 	$App_part=$LOCALE->dgettext('exchange','layouts');
			if ($Meta['TABLEDEF'][0]['NAME'][0]=='mnames') 		$App_part=$LOCALE->dgettext('exchange','tables');
			if ($Meta['TABLEDEF'][0]['NAME'][0]=='gto') 		$App_part=$LOCALE->dgettext('exchange','gto');
			if ($Meta['TABLEDEF'][0]['NAME'][0]=='fto') 		$App_part=$LOCALE->dgettext('exchange','fto');
			if ($Meta['TABLEDEF'][0]['NAME'][0]=='feature')		$App_part=$LOCALE->dgettext('exchange','feature');
			if ($Meta['TABLEDEF'][0]['NAME'][0]=='users') 		
			{
				$App_part= ( strpos($filename,'group_')===false ? $LOCALE->dgettext('exchange','user') : $LOCALE->dgettext('exchange','groups') );
			}
			@$Summary[$App_part]['rows']+=intval($Meta['TABLEDEF'][0]['ROWS'][0]);
			echo("<tr class='bglist'>
					<td class='text'				>$f ".$files[$index]."</td>
					<td class='text'				>$f $App_part</td>
					<td class='text' align='center'	>$f ".$Meta['TABLEDEF'][0]['ROWS'][0]."</td>
					<td class='text' align='center'	> $f".($Meta['TIME'][0])."</td>
					<td class='text' align='center'	>$f ".($Meta['VERSION'][0])."</td>
					</tr>$CRLF");
		}
	}
?>
</table>
<br clear="all">
<a name='summary'></a>
<table width="50%" border="0" cellspacing="1" cellpadding="0" align="center" cols="2" widht="50%">
	<tr  class="textwhite">
		<td class="textwhite">
			<?php echo($LOCALE->dgettext('exchange','summary')); ?>
		</td>
		<td align='right' class="textwhite">
			<a class="link"  href='#details'>&raquo; <?php echo($LOCALE->dgettext('exchange','details')); ?></a>
		</td>
	</tr>
<?php 
if (count($Summary)>0)
{
	ksort($Summary);
	reset($Summary);
	while (list($Key,$Value)=each($Summary))
	{
 		echo("<tr class='bglist'>
				<td class='text'				>$f ".$Key."</td>
				<td class='text' align='center'	>$f".$Value["rows"]."</td>
				</tr>$CRLF");
	}
}
?>
</table>
<?php endif; ?>
<br>
<br>
<br>
<center>
	<a href="javascript:closeFrame();" class="link"><?php echo($LOCALE->dgettext('exchange','window_close')); ?></a>
</center>

</body>
</html>
Return current item: Netautor Professional