added some security checks

This commit is contained in:
seek3r 2001-11-12 22:00:32 +00:00
parent ca05d0d9f4
commit c5b92cf216

View File

@ -29,7 +29,7 @@
if ($fn) if ($fn)
{ {
if (preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$fn)) if (preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$fn) || preg_match("/^functions\.inc\.php+$/",$fn))
{ {
$files[] = $fn; $files[] = $fn;
} }
@ -44,7 +44,7 @@
$d = dir('../'.$app.'/inc/'); $d = dir('../'.$app.'/inc/');
while ($x = $d->read()) while ($x = $d->read())
{ {
if (ereg('class',$x) && !ereg('#',$x) && ereg('php',$x)) if (preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$x) || preg_match("/^functions\.inc\.php+$/",$x))
{ {
$files[] = $x; $files[] = $x;
} }
@ -52,17 +52,7 @@
$d->close; $d->close;
reset($files); reset($files);
}
while(list($key, $value) = each($files))
{
if (!preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$value))
{
unset($files[$key]);
}
}
reset($files);
}
while (list($p,$fn) = each($files)) while (list($p,$fn) = each($files))
{ {
@ -84,38 +74,41 @@
{ {
preg_match_all("#@(.*)$#sUi",$val[1],$data); preg_match_all("#@(.*)$#sUi",$val[1],$data);
$new = explode("@",$data[1][0]); $new = explode("@",$data[1][0]);
while (list($x,$y) = each($new))
while (list($x,$y) = each($new))
{ {
$t = trim($new[0]); if (!isset($object) || trim($new[0]) == $object)
if(!$key) //if (trim($new[0]) == $object)
{ {
$class = $t; $t = trim($new[0]);
} if(!$key)
$t = trim(ereg_replace('function','',$t)); {
$class = $t;
}
$t = trim(ereg_replace('function','',$t));
reset($types); reset($types);
while(list($z,$type) = each($types)) while(list($z,$type) = each($types))
{ {
if(ereg($type,$y)) if(ereg($type,$y))
{ {
$xkey = $type; $xkey = $type;
$out = $y; $out = $y;
$out = ereg_replace($type,'',$out); $out = ereg_replace($type,'',$out);
break; break;
} }
else else
{ {
$xkey = 'unknown'; $xkey = 'unknown';
$out = $y; $out = $y;
} }
} }
if($out != $new[0]) if($out != $new[0])
{ {
$elements[$class][$t][$xkey][] = $out; $elements[$class][$t][$xkey][] = $out;
} }
} }
}
} }
echo '<br><pre>'; echo '<br><pre>';
print_r($elements); print_r($elements);