--- db/prgsrc/db.cgi 2001/12/08 23:00:44 1.46 +++ db/prgsrc/db.cgi 2001/12/10 20:37:23 1.47 @@ -11,6 +11,7 @@ use locale; my $printqueries=0; my %forbidden=(); my $debug=0; #added by R7 +if (param('debug')) {$debug=1; $printqueries=1} my %fieldname= (0,'Question', 1, 'Answer', 2, 'Comments', 3, 'Authors', 4, 'Sources'); my %rusfieldname=('Question','÷ÏÐÒÏÓ', 'Answer', 'ïÔ×ÅÔ', 'Comments', 'ëÏÍÍÅÎÔÁÒÉÉ', 'Authors', 'á×ÔÏÒ', @@ -151,7 +152,8 @@ sub printform my $submit=submit(-value=>'ðÏÉÓË'); my $inputstring=textfield(-name=>'sstr', -default=>param('sstr')||'', - -size=>50); + -size=>30, + -maxlength=>30); my @df=keys %searchin; @df=('Question', 'Answer') unless @df; my $fields=checkbox_group('searchin',['Question','Answer','Comments','Authors','Sources'], [@df], @@ -537,7 +539,7 @@ print "@Questions" if $printqueries; Ðð Òò Óó Ôô Õõ Ææ Èè Ãã Þþ Ûû Ýý Øø Ùù Üü Àà Ññ/; sub NoCase { - my ($sstr) = shift; + my ($sstr) = shift; my ($res); if (($res) = grep(/$sstr/, @letters)) { @@ -958,31 +960,31 @@ sub PrintQuestion { if ($Question{'Authors'}) { my $q=$Question{'Authors'}; - my $sth=$dbh->prepare("select Authors.Id,Name, Surname, Nicks from Authors, A2Q - where Authors.Id=Author And Question=$Id"); - $sth->execute; - my ($AuthorId,$Name, $Surname,$other,$Nicks); - - while ((($AuthorId,$Name, $Surname,$Nicks)=$sth->fetchrow),$AuthorId) - { - my ($firstletter)=$Name=~m/^./g; - $Name=~s/\./\\\./g; - my $sha="(?:$Name\\s+$Surname)|(?:$Surname\\s+$Name)|(?:$firstletter\\.\\s*$Surname)|(?:$Surname\\s+$firstletter\\.)|(?:$Surname)|(?:$Name)"; - if ($Nicks) - { - $Nicks=~s/^\|//; - foreach (split /\|/, $Nicks) - { - s/\s+/ /g; - s/\s+$//; - s/ /\\s+/g; - s/\./\\\./g; - if (s/>$//) {$sha="$sha|(?:$_)"} - else {$sha="(?:$_)|$sha"} - } - } - $q=~s/($sha)/a({href=>url."?qofauthor=$AuthorId"},$1)/ei; - } +# my $sth=$dbh->prepare("select Authors.Id,Name, Surname, Nicks from Authors, A2Q +# where Authors.Id=Author And Question=$Id"); +# $sth->execute; +# my ($AuthorId,$Name, $Surname,$other,$Nicks); + +# while ((($AuthorId,$Name, $Surname,$Nicks)=$sth->fetchrow),$AuthorId) +# { +# my ($firstletter)=$Name=~m/^./g; +# $Name=~s/\./\\\./g; +# my $sha="(?:$Name\\s+$Surname)|(?:$Surname\\s+$Name)|(?:$firstletter\\.\\s*$Surname)|(?:$Surname\\s+$firstletter\\.)|(?:$Surname)|(?:$Name)"; +# if ($Nicks) +# { +# $Nicks=~s/^\|//; +# foreach (split /\|/, $Nicks) +# { +# s/\s+/ /g; +# s/\s+$//; +# s/ /\\s+/g; +# s/\./\\\./g; +# if (s/>$//) {$sha="$sha|(?:$_)"} +# else {$sha="(?:$_)|$sha"} +# } +# } +# $q=~s/($sha)/a({href=>url."?qofauthor=$AuthorId"},$1)/ei; +# } $output .= &PrintField("á×ÔÏÒ(Ù)", $q, $text);