<?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 |
+----------------------------------------------------------------------+
| @version $Revision: 1.12 $ |
+----------------------------------------------------------------------+*/
/**
* Search mask for Netautor functions
* @author Stefan Rottensteiner
*/
require_once('../../include/init.inc');
if(!$GLOBALS['USER']->check_feature('Admin') && !$GLOBALS['USER']->check_feature('ac_functions'))
{
$GLOBALS['USER']->login_call();
}
$GLOBALS['LOCALE']->textdomain('functions');
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>/digiconcept/netautor/functionmanager/search</title>
<meta http-equiv="pragma" content="no-cache" >
<meta http-equiv="cache-control" content="no-cache" >
<meta name ="robots" content="noindex" >
<link href="../../include/netautor.css" rel="stylesheet" type="text/css">
</head>
<script language="JavaScript" type="text/javascript">
<!--
/**
* Brings desired function into editor formular
*/
function editFunction(FunctionName,FunctionLocation){
if (window.opener){
window.opener.document.location.href = "npf_edit.php?read_from_xml=yes&function_def[name]="+escape(FunctionName)+"&function_def[location]="+escape(FunctionLocation);
if (window.opener.focus) window.opener.focus();
window.close();
}
else
{
parent.frames['npf_edit'].document.location.href = "npf_edit.php?read_from_xml=yes&function_def[name]="+escape(FunctionName)+"&function_def[location]="+escape(FunctionLocation);
parent.document.getElementById('f_funktionen').rows="*,24";
top.scrollFrames('npf_search');
}
}
//-->
</script>
<?php
includeNaPro('file,array');
function scanFunctions($dir)
{
$FunctionList = array();
$FileList = File_getFiles($dir,'xml');
foreach ($FileList as $index => $FileName)
{
$FullFileName = $dir.$FileName;
set_time_limit(0);
echo "<!-- scanning file [{$FullFileName}] for functions -->\r\n";
echo str_repeat('<!-- -->',500);
ob_flush();
$FileContent = implode('',file($FullFileName));
$FunctionMatches = array();
$erg = preg_match_all("/\<FUNCTION.*\>/im",$FileContent,$FunctionMatches);
$FunctionDef = array ('name'=>'','status'=>0,'internal'=>0,'location'=> $FullFileName);
foreach($FunctionMatches[0] as $index2 => $FunctionHeader)
{
/* Funktionsnamen auslesen */
$Match = array();
$erg = preg_match("/name\w*=\w*\"([^\"]+)\"/im",$FunctionHeader,$Match);
$FunctionDef['name'] = $Match[1];
/* Parameter zählen */
$pos_1 = strpos($FileContent,$FunctionHeader);
$pos_2 = strpos($FileContent,'</FUNCTION>',$pos_1);
$Match= array();
$erg = preg_match_all( '/\<PARAM name=".*"/im',substr($FileContent,$pos_1,$pos_2-$pos_1),$Match);
$FunctionDef['param_count'] = count( $Match[0]);
/* Funktion ist aktiv oder veraltet - spricht hat Deprecated-Datum oder nicht */
$Match = array();
$erg = preg_match("/depricated\w*=\w*\"([^\"]+)\"/im",$FunctionHeader,$Match);
$FunctionDef['status'] = empty($Match[1]);
/* Interne oder externe Funktiontion */
$Match = array();
$erg = preg_match("/internal\w*=\w*\"([^\"]+)\"/im",$FunctionHeader,$Match);
$FunctionDef['internal'] = !empty($Match[1]);
/* Kontext der Funktion */
$Match = array();
$erg = preg_match("/context\w*=\w*\"([^\"]+)\"/im",$FunctionHeader,$Match);
$FunctionDef['context'] = $Match[1];
/* Funktionsinformationen merken */
$FunctionList[ $FunctionDef['name'] ] = $FunctionDef;
}
}
return $FunctionList;
}
$FunctionList = array();
$InternalFunctionList = scanFunctions($GLOBALS['DC_ENV']->includepath.'npf_lib/');
$ExternalFunctionList = scanFunctions($GLOBALS['DC_ENV']->external_func_path);
$FunctionList = array_merge($InternalFunctionList,$ExternalFunctionList);
ksort($FunctionList);
?>
<body class="blue">
<table widtrh="520" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="457" align="left" valign="center" class="text">
<img src="../../grafik/pixel.gif" width="457" height="4"><br>
<img src="../../grafik/pixel.gif" width="4" height="1"><a href="#" class="text" onClick="parent.document.getElementById('f_funktionen').rows='150,*';"><?php echo $GLOBALS['LOCALE']->gettext('txt_search_functions');?></a><br>
</td>
<td width="63" align="left" valign="top">
<img src="../../grafik/updown.gif" width="63" height="21" border="0" usemap="#updown"><br>
<map name="updown">
<area shape="circle" coords="12,9,9" href="#" onClick="parent.document.getElementById('f_funktionen').rows='150,*';">
<area shape="circle" coords="50,9,9" href="#" onClick="parent.document.getElementById('f_funktionen').rows='*,24';top.scrollFrames('npf_search');">
</map>
</td>
</tr>
</table>
<table width="975" border="0" cellspacing="0" cellpadding="4">
<form method="get">
<tr>
<td width="975" align="left" valign="top">
<span class="head"><?php echo $GLOBALS['LOCALE']->gettext('descr_context');?> </span>
<select class="select202" name="SelectedContext" onChange="this.form.submit();">
<option value="" selected></option>
<?php
$ContextList = array();
foreach ($FunctionList as $FunctionName => $FunctionDef) $ContextList[ $FunctionDef['context'] ] = $FunctionDef['context'];
ksort($ContextList);
foreach ($ContextList as $index => $ContextName)
{
$ContextSelected = ( $_GET['SelectedContext'] == $ContextName ? 'selected' : '' );
?><option <?php echo $ContextSelected; ?> value="<?php echo $ContextName;?>" ><?php echo strtoupper($ContextName);?></option>
<?php
}
?>
</select><br>
<img src="../../grafik/pixel.gif" width="747" height="12"><br>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="left" valign="top" class="textwhite">
<?php echo $GLOBALS['LOCALE']->gettext('descr_name');?><br>
</td>
<td align="left" valign="top" class="textwhite">
<?php echo $GLOBALS['LOCALE']->gettext('descr_status');?><br>
</td>
<td align="left" valign="top" class="textwhite">
<?php echo $GLOBALS['LOCALE']->gettext('descr_type');?><br>
</td>
<td align="left" valign="top" class="textwhite">
<?php echo $GLOBALS['LOCALE']->gettext('descr_parameter_count');?><br>
</td>
<td align="left" valign="top" class="textwhite">
<?php echo $GLOBALS['LOCALE']->gettext('descr_location');?><br>
</td>
<td align="left" valign="top" class="textwhite">
<br>
</td>
</tr>
<?php
foreach ($FunctionList as $FunctionName => $FunctionDef)
{
if (!empty($_GET['SelectedContext']) && ( $SelectedContext != $FunctionDef['context'])) continue;
?>
<tr class="bglist">
<td align="left" valign="top" class="text">
<a href="#" onClick="editFunction('<?php echo $FunctionDef['name'];?>','<?php echo $FunctionDef['location'];?>');" class="link"><?php echo $FunctionDef['name'];?></a><br>
</td>
<td align="left" valign="top" class="text">
<?php echo ( empty($FunctionDef['status']) ? $GLOBALS['LOCALE']->gettext('descr_deprecated') : $GLOBALS['LOCALE']->gettext('descr_activ'));?><br>
</td>
<td align="left" valign="top" class="text">
<?php echo ( empty($FunctionDef['internal']) ? 'Extern':'Intern');?><br>
</td>
<td align="left" valign="top" class="text">
<?php echo $FunctionDef['param_count'];?><br>
</td>
<td align="left" valign="top" class="text">
<?php echo $FunctionDef['location'];?><br>
</td>
<td align="right" valign="top" class="text">
<a href="#" onClick="editFunction('<?php echo $FunctionDef['name'];?>','<?php echo $FunctionDef['location'];?>');" class="link"><?php echo $GLOBALS['LOCALE']->gettext('action_edit');?> »</a><br>
</td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td width="975"><img src="../../grafik/pixel.gif" width="967" height="1"><br></td>
</tr>
</table>
<br>
</form>
</body>
</html>