لدي هذا السكربت cgi بحث
ولكن لا يجد العربي أي النتيجة صفر علما بأن الكلمة موجودة
الرجو ابداء الرأي و التعديل حتي يقبل العربي
sub DeHTML{
#########################################################
# next we'll remove all the <script> tags
#########################################################
$data =~ s/<script.*?<\/script>//gsix;
#########################################################
# next we'll remove all the <tags>
#########################################################
$data =~ s/<[^>]+>//gsx;
#########################################################
# first we'll shoot all the <!-- comments -->
#########################################################
$data =~ s{ <! # comments begin with a `<!'
# followed by 0 or more comments;
(.*?) # this is actually to eat up comments in non
# random places
( # not suppose to have any white space here
# just a quick start;
-- # each comment starts with a `--'
.*? # and includes all text up to and including
-- # the *next* occurrence of `--'
\s* # and may have trailing while space
# (albeit not leading white space XXX)
)+ # repetire ad libitum XXX should be * not +
(.*?) # trailing non comment text
> # up to a `>'
}{
if ($1 || $3) { # this silliness for embedded comments in tags
"<!$1 $3>";
}
}gesx; # mutate into nada, nothing, and niente
#########################################################
# stray tags
#########################################################
$data =~ s/<!--//g;
$data =~ s/-->//g;
#########################################################
#multiple returns
#########################################################
$data =~ s/ {1,255}/ /sg;
$data =~ s/\s{2,255}/\n/g;
#########################################################
#Get rid of binary data
#########################################################
$data =~ s/[^A-Za-z0-9\"\'\n,\.\?\!\@\#\$\%\^\&\*\(\)\-\_\=\+\]\[\{\}\]]/ /sg;
return;
}
sub GetFiles{
local($cdir)=@_;
local($i);
local($a);
local(@files);
chdir($cdir);
$a = `pwd`;chomp $a;
opendir(DIR,".");
@files = readdir(DIR);
close DIR;
foreach $i (@files){
next if ($i =~ /^\./);
#get excluded/skipped files and filter
($ext) = $i =~ /.*\.(\w*)$/;
next if ($efext{$ext});
$relpath = "$a/$i";
#remove root
$relpath =~ s/^$rootpath\///;
#print "CD: $cdir - RP: $relpath Root: $rootpath<br>";
($status,$wl) = &FindStatus($relpath);
if($wl eq 'searched'){
#print "G: $a/$i<br>";;
if(-d "$i"){&GetFiles("$i")};
if(-T "$i"){$ftsearch{"$a/$i"}=1};
if($i =~ /\.doc$/i){$ftsearch{"$a/$i"}=1};
if($i =~ /\.mdb$/i){$ftsearch{"$a/$i"}=1};
if($i =~ /\.pdf$/i){$ftsearch{"$a/$i"}=1};
if($i =~ /\.ppt$/i){$ftsearch{"$a/$i"}=1};
if($i =~ /\.xls$/i){$ftsearch{"$a/$i"}=1};
}
}
chdir('..');
}
sub ShowSearchForm{
($in{'style'})&&($style=$in{'style'});
($style eq '1')&&(&PageOut("t_searchform.htm"));
($style eq '2')&&(&PageOut("t_searchform1.htm"));
($style eq '3')&&(&PageOut("t_searchform2.htm"));
(!$style)&&(&PageOut("t_searchform.htm"));
exit;
}
sub AddSkip{
&LoadVars;
($in{'cdir'})&&($cdir .='/');
$fts = "$in{'cdir'}$in{'f'}";
$fts =~ s/\/\//\//;
delete $ignore{$in{'f'}};
if(!$skip{$fts}){
$skip{$fts} = 1;
}
else{
delete $skip{$fts};
}
&WriteBackVars;
&Manage;
exit;
}
sub AddIgnore{
&LoadVars;
($in{'cdir'})&&($cdir .='/');
$fts = "$in{'cdir'}$in{'f'}";
$fts =~ s/\/\//\//;
delete $skip{$fts};
if(!$ignore{$in{'f'}}){
$ignore{$in{'f'}} = 1;
}
else{
delete $ignore{$in{'f'}};
}
&WriteBackVars;
&Manage;
exit;
}
sub WriteBackVars{
#write all back to file
open(DB,">g_skip.cgi");
foreach $i (keys %skip){
print DB "$i\n";
}
close DB;
#write all back to file
open(DB,">g_ignore.cgi");
foreach $i (keys %ignore){
print DB "$i\n";
}
close DB;
}
sub AddGlobalIgnore{
open(DB,">g_file_ext_ignore.cgi");
print DB "$in{'efileext'}\n";
close DB;
open(DB,">g_dir_ignore.cgi");
print DB "$in{'edirname'}\n";
close DB;
&Manage;
exit;
}
sub GetGlobalIgnore{
open(DB,"g_file_ext_ignore.cgi");
$in{'efileext'} = <DB>;
chomp $in{'efileext'};
close DB;
open(DB,"g_dir_ignore.cgi");
$in{'edirname'} = <DB>;
chomp $in{'edirname'};
close DB;
@tmp = split(/\s*,\s*/,$in{'efileext'});
foreach $i (@tmp){
$efext{$i} = 1;
if($i =~ /^\*/){
$i =~ s/\*//;
push(@efextrear,$i);
}
if($i =~ /\*$/){
$i =~ s/\*//;
push(@efextfront,$i);
}
}
@tmp = split(/\s*,\s*/,$in{'edirname'});
foreach $i (@tmp){
$edir{$i} = 1;
if($i =~ /^\*/){
$i =~ s/\*//;
push(@edirrear,$i);
}
if($i =~ /\*$/){
$i =~ s/\*//;
push(@edirfront,$i);
}
}
}
sub GoUp{
#take off last directory
$in{'cdir'} =~ s/[^\/]*\/$//;
&Manage;
exit;
}
sub Manage{
&GetGlobalIgnore;
&LoadVars;
##remove any excess '//'
$in{'cdir'} =~ s/\/\//\//;
$a = `pwd`;chomp $a;
##go to root
chdir("$rootpath");
#if in subdir .. go to subdir
($in{'nd'})&&($in{'cdir'} = "$in{'cdir'}$in{'nd'}/");
($in{'cdir'})&&(chdir("$in{'cdir'}"));
##
#$in{'currentdir'} = "$rootpath/$in{'cdir'}";
##remove any excess '//'
$in{'currentdir'} =~ s/\/\//\//;
@allurl = split(/\//,$in{'cdir'});
foreach $x (@allurl){