diff options
Diffstat (limited to 'bucky2/cgi-bin')
| l--------- | bucky2/cgi-bin/api/auto.db | 1 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/api/autocomplete | 44 | ||||
| l--------- | bucky2/cgi-bin/api/gross.db | 1 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/api/index | 40 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/api/search | 40 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/api/thread | 61 | ||||
| -rw-r--r-- | bucky2/cgi-bin/auto.db.1 | bin | 0 -> 5234688 bytes | |||
| -rw-r--r-- | bucky2/cgi-bin/gross.db | bin | 0 -> 6230016 bytes | |||
| -rw-r--r-- | bucky2/cgi-bin/gross.db.1 | bin | 0 -> 6230016 bytes | |||
| -rw-r--r-- | bucky2/cgi-bin/gross.db.old | bin | 0 -> 1912832 bytes | |||
| -rwxr-xr-x | bucky2/cgi-bin/history | 44 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/images | 44 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/poetaster | 105 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/search | 184 | ||||
| -rwxr-xr-x | bucky2/cgi-bin/svn | 7 |
15 files changed, 571 insertions, 0 deletions
diff --git a/bucky2/cgi-bin/api/auto.db b/bucky2/cgi-bin/api/auto.db new file mode 120000 index 0000000..7a5d5c2 --- /dev/null +++ b/bucky2/cgi-bin/api/auto.db @@ -0,0 +1 @@ +../auto.db
\ No newline at end of file diff --git a/bucky2/cgi-bin/api/autocomplete b/bucky2/cgi-bin/api/autocomplete new file mode 100755 index 0000000..ac42f06 --- /dev/null +++ b/bucky2/cgi-bin/api/autocomplete @@ -0,0 +1,44 @@ +#!/usr/bin/perl + +use lib "../../lib"; +use Bucky; +use Bucky::Session; +use Bucky::Search; +my $bucky = new Bucky; +my $session = new Bucky::Session; +my $q = $session->param('q'); + +print "Content-type: text/plain\n\n"; + +if (length $q) + { + my $search = new Bucky::Search; + my $guess = $search->autocomplete($q); + my $results = $search->search_light($guess->{'full'}, 0, 40); + # my $terms = $results->{terms}; + + print $guess->{'tail'} || "_"; + print "\n"; + foreach my $result (@{$results->{'results'}}) + { + my $thread = $results->{'threads'}->{ $result->{'thread'} }; + my $comment = $results->{'comments'}->{ $result->{'comment'} }; + my $file = $results->{'files'}->{ $result->{'file'} }; + my $z_thread = $thread->{'id'}; + my $z_title = $thread->{'title'}; + my $z_file = $file->{'id'}; + my $z_subtitle = $file->{'filename'}; + $z_subtitle =~ s/[^a-zA-Z0-9 ()\.]/ /g; + $z_subtitle =~ s/_/ /g; + $z_subtitle =~ s/\s+/ /g; + $z_subtitle =~ s/^\s//; + $z_subtitle =~ s/\s$//; + print join "\t", $z_thread, $z_title, $z_subtitle, $z_file; + print "\n"; + } + } +else + { + print "\n"; + } +1; diff --git a/bucky2/cgi-bin/api/gross.db b/bucky2/cgi-bin/api/gross.db new file mode 120000 index 0000000..00a14d0 --- /dev/null +++ b/bucky2/cgi-bin/api/gross.db @@ -0,0 +1 @@ +../gross.db
\ No newline at end of file diff --git a/bucky2/cgi-bin/api/index b/bucky2/cgi-bin/api/index new file mode 100755 index 0000000..306e01e --- /dev/null +++ b/bucky2/cgi-bin/api/index @@ -0,0 +1,40 @@ +#!/usr/bin/perl + +use lib "../../lib"; +use Bucky; +use Bucky::Session; +my $bucky = new Bucky; +# my $session = new Bucky::Session; + +print "Content-type: text/plain\n\n"; + +# get most recent 80 threads +# for each thread, get most recent mp3 +# if no mp3, skip the thread + +my $threads = $bucky->db->select("thread", "order by lastmodified desc limit 80"); + +foreach my $t (@$threads) + { + my $z_thread = $t->{id}; + my $files = $bucky->db->select("file", "thread='$z_thread' and filename like '%mp3' order by date limit 1"); + my $file = {id=>undef,filename=>undef}; + if ($files) + { + $file = $files->[0]; + } + + my $z_title = $bucky->trim( $t->{title} ); + my $z_file = $file->{'id'}; + my $z_subtitle = $file->{'filename'}; + $z_subtitle =~ s/[^a-zA-Z0-9 ()\.]/ /g; + $z_subtitle =~ s/_/ /g; + $z_subtitle =~ s/\s+/ /g; + $z_subtitle =~ s/^\s//; + $z_subtitle =~ s/\s$//; + print join "\t", $z_thread, $z_title, $z_subtitle, $z_file; + print "\n"; + } + +1; + diff --git a/bucky2/cgi-bin/api/search b/bucky2/cgi-bin/api/search new file mode 100755 index 0000000..2bebda8 --- /dev/null +++ b/bucky2/cgi-bin/api/search @@ -0,0 +1,40 @@ +#!/usr/bin/perl + +use lib "../../lib"; +use Bucky; +use Bucky::Session; +use Bucky::Search; +my $bucky = new Bucky; +my $session = new Bucky::Session; +my $q = $session->param('q'); + +print "Content-type: text/plain\n\n"; + +if (length $q) + { + my $search = new Bucky::Search; + my $results = $search->search_light($q, 0, 40); + foreach my $result (@{$results->{'results'}}) + { + my $thread = $results->{'threads'}->{ $result->{'thread'} }; + my $comment = $results->{'comments'}->{ $result->{'comment'} }; + my $file = $results->{'files'}->{ $result->{'file'} }; + my $z_thread = $thread->{'id'}; + my $z_title = $search->bold_terms( $thread->{'title'}, $terms); + my $z_file = $file->{'id'}; + my $z_subtitle = $file->{'filename'}; + $z_subtitle =~ s/[^a-zA-Z0-9 ()\.]/ /g; + $z_subtitle =~ s/_/ /g; + $z_subtitle =~ s/\s+/ /g; + $z_subtitle =~ s/^\s//; + $z_subtitle =~ s/\s$//; + print join "\t", $z_thread, $z_title, $z_subtitle, $z_file; + print "\n"; + } + $search->log_query($query, $total); + } +else + { + print "\n"; + } +1; diff --git a/bucky2/cgi-bin/api/thread b/bucky2/cgi-bin/api/thread new file mode 100755 index 0000000..3c7def9 --- /dev/null +++ b/bucky2/cgi-bin/api/thread @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +use lib "../../lib"; +use Bucky; +use Bucky::Session; +my $bucky = new Bucky; +my $session = new Bucky::Session; +my $id = $session->param('id'); + +print "Content-type: text/plain\n\n"; +if (length $id && $id !~ /\D/) + { + my $thread = $bucky->db->select("thread", "id='$id'"); + my $files = $bucky->db->select("file", "thread='$id' order by filename asc"); + my $comment = $bucky->db->select("comment", "thread='$id' order by id asc"); + exit unless ref($thread) == "ARRAY"; + my $t = shift @$thread; + + my $flagged = $t->{'flagged'}; + + my @result = (); + + my $i = 0; + my $count = 0; + foreach my $file (@$files) + { + if (! $flagged && $file->{'filename'} =~ /(jpg|jpeg|gif|png)/i) + { + $flagged = $file->{'id'}; + } + $file->{'filename'} =~ /\.(...)$/i; + $file->{'type'} = lc $1 || next; + $file->{'title'} = $file->{'filename'}; + $file->{'title'} =~ s/\.(...)$//; + $file->{'title'} =~ s/_/ /g; + $file->{'title'} =~ s/-/ /g; + $file->{'title'} =~ s/\s+/ /g; + $file->{'title'} =~ s/^\s//; + $file->{'title'} =~ s/\s$//; + push @result, join("\t", @$file{qw[id type filename title date size]}); + } + if (ref($comment) == "ARRAY" && scalar(@$comment)) + { + my $c = shift @$comment; + my $words = $c->{'comment'}; + $words =~ s/\n/<br\/>/g; + $words =~ s/\r//g; + push @result, $c->{id}."\tcomment\t".$c->{username}."\t".$c->{date}."\t".$words; + } + $t->{'flagged'} ||= $flagged; + + print join "\t", @$t{qw[id title flagged createdate username keyword]}; + print "\n"; + print join "\n", @result; + print "\n"; + } +else + { + print "\n"; + } +1; diff --git a/bucky2/cgi-bin/auto.db.1 b/bucky2/cgi-bin/auto.db.1 Binary files differnew file mode 100644 index 0000000..53b26c1 --- /dev/null +++ b/bucky2/cgi-bin/auto.db.1 diff --git a/bucky2/cgi-bin/gross.db b/bucky2/cgi-bin/gross.db Binary files differnew file mode 100644 index 0000000..b5a1629 --- /dev/null +++ b/bucky2/cgi-bin/gross.db diff --git a/bucky2/cgi-bin/gross.db.1 b/bucky2/cgi-bin/gross.db.1 Binary files differnew file mode 100644 index 0000000..074684d --- /dev/null +++ b/bucky2/cgi-bin/gross.db.1 diff --git a/bucky2/cgi-bin/gross.db.old b/bucky2/cgi-bin/gross.db.old Binary files differnew file mode 100644 index 0000000..7182cba --- /dev/null +++ b/bucky2/cgi-bin/gross.db.old diff --git a/bucky2/cgi-bin/history b/bucky2/cgi-bin/history new file mode 100755 index 0000000..129d727 --- /dev/null +++ b/bucky2/cgi-bin/history @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use lib "../lib"; +use Bucky; +my $bucky = new Bucky; + +print "Content-type: text/html\n\n"; +my $files = $bucky->db->select("file", "group by thread"); + +my $i = 0; +my $count = 0; +print "<font size=-1><table>"; +foreach my $file (@$files) + { + my $z_thread = $file->{'thread'}; + my $z_img; + if ($file->{'filename'} =~ /(jpg|png|gif)/i) + { + my $ext = $1; + my $username = $file->{'username'}; + my $filename = $file->{'filename'}; + my $lc_filename = lc($file->{'filename'}); + my $label_filename = $filename; + $label_filename =~ s/\.$ext//g; + $label_filename =~ s/\W+/ /g; + $label_filename =~ s/_+/ /g; + $z_img .= "<a href='/bucky/data/$z_thread/$filename' target=_new>"; + $z_img .= "<img src=\"/bucky/data/$z_thread/.thumb/t.$lc_filename\" width=200 hspace=10 vspace=10>"; + $z_img .= "</a>"; + $z_img .= "<br>".$label_filename; + } + next unless $z_img; + if ($i == 0) + { print "<tr>"; } + print "<td>"; + print $z_img; + print "</td>"; + $i++; + $count++; + if ($i == 5) + { print "</tr>\n"; $i = 0; } + } + print "</table>"; + print $count." images found\n"; +1; diff --git a/bucky2/cgi-bin/images b/bucky2/cgi-bin/images new file mode 100755 index 0000000..129d727 --- /dev/null +++ b/bucky2/cgi-bin/images @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use lib "../lib"; +use Bucky; +my $bucky = new Bucky; + +print "Content-type: text/html\n\n"; +my $files = $bucky->db->select("file", "group by thread"); + +my $i = 0; +my $count = 0; +print "<font size=-1><table>"; +foreach my $file (@$files) + { + my $z_thread = $file->{'thread'}; + my $z_img; + if ($file->{'filename'} =~ /(jpg|png|gif)/i) + { + my $ext = $1; + my $username = $file->{'username'}; + my $filename = $file->{'filename'}; + my $lc_filename = lc($file->{'filename'}); + my $label_filename = $filename; + $label_filename =~ s/\.$ext//g; + $label_filename =~ s/\W+/ /g; + $label_filename =~ s/_+/ /g; + $z_img .= "<a href='/bucky/data/$z_thread/$filename' target=_new>"; + $z_img .= "<img src=\"/bucky/data/$z_thread/.thumb/t.$lc_filename\" width=200 hspace=10 vspace=10>"; + $z_img .= "</a>"; + $z_img .= "<br>".$label_filename; + } + next unless $z_img; + if ($i == 0) + { print "<tr>"; } + print "<td>"; + print $z_img; + print "</td>"; + $i++; + $count++; + if ($i == 5) + { print "</tr>\n"; $i = 0; } + } + print "</table>"; + print $count." images found\n"; +1; diff --git a/bucky2/cgi-bin/poetaster b/bucky2/cgi-bin/poetaster new file mode 100755 index 0000000..29bbe3b --- /dev/null +++ b/bucky2/cgi-bin/poetaster @@ -0,0 +1,105 @@ +#!/usr/bin/perl +use lib "../lib"; +use Rest; +use Bucky::Session; +use Poetaster; + +my $session = new Bucky::Session; +my $q = $session->param('q'); +my $id = $session->param('id'); + +if ($id) + { + print header(); + print cache_get($id); + print form(); + print footer(); + } +elsif ($q) + { + print header(); + print poetast($q); + print form(); + print footer(); + } +else + { + print header(); + print form(); + print footer(); + } + +sub poetast + { + my ($q) = @_; + my $data; + if ($q =~ /^http/) + { + $data = Rest->new->rest_get_raw($q); + } + else + { + $data = $q; + } + $data =~ s/<(\/)?(b|i|strong|em)>/[$1$2]/g; + $data =~ s/<[^>]+>//g; + $data =~ s/\[/</g; + $data =~ s/\]/>/g; + $data =~ s/[\r\n]+/ /g; + $data =~ s/\s+/ /g; + $data =~ s/\. \. \. /... /g; + my $self = new Poetaster; + my $poem = $self->poem($data); + print "<pre>$poem</pre>"; + print sprintf("%0.1f kb", (length($poem)/1024)); + print "<br>"; + return; + } +sub poetast_cache_set + { + my ($data) = @_; + my $id; + return $id; + } +sub poetast_cache_get + { + my ($id) = @_; + my $data; + return $data; + } +sub header + { + my ($title) = @_; + if ($title) { $title = "Poetaster: $title" } + else { $title = "Poetaster"; } + return <<__HEADER__; +Content-type: text/html +Pragma: no-cache + +<html> +<head> +<title>Poetaster</title> +<link href="/css/poetaster.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="container"> +__HEADER__ + } +sub form + { + return <<__FORM__; +Enter text or a URL: +<form method="post"> +<textarea name="q"></textarea><br> +<input type="submit" value="Poetaste!"> +</form> +__FORM__ + } +sub footer + { + return <<__FOOTER__; +</div> +</body> +</html> +__FOOTER__ + } diff --git a/bucky2/cgi-bin/search b/bucky2/cgi-bin/search new file mode 100755 index 0000000..15a89a6 --- /dev/null +++ b/bucky2/cgi-bin/search @@ -0,0 +1,184 @@ +#!/usr/bin/perl +use lib "../lib"; +use Bucky; +use Data::Dumper; + +my $session = new Bucky::Session; + +my $query = $session->param("q"); + +print <<__BODY__; +Content-type: text/html +Pragma: no-cache + +<html> + <head> + <title>bucky [SEARCH: $query]</title> + <link rel="stylesheet" href="/css/bogart.css" type="text/css"> + <link rel="shortcut icon" href="/favicon.ico"> + <style type="text/css"> + <!-- + body { background-color: #EEEEEE; } + --> + </style> + </head> + +<body> + +<center> +<table cellpadding=0 cellspacing=0 border=0> + <tr> + <td align="center" style="border: 0px;"> + +<div style="width: 900px; text-align: left; border: 0px; margin-bottom: 120px;"> +<table cellpadding=0 cellspacing=0 border=0 style="padding: 0px margin: 0px;" width=100%> +<tr><td align=left valign=bottom style="padding: 0px 4px 0px 4px;"><span class="bigtitle">bucky's backwards binoculars</span></td></tr> +</table><table width=100% cellpadding=0 cellspacing=0 border=0 style="padding: 0px margin: 0px;"> +<tr><td colspan=2 align="center"> +<hr noshade color="#201010" style="padding: 0px; margin: 2px;"> +</td></tr> +<tr> +<td align=left nowrap style="padding: 0px 4px 0px 4px;"><small> + +<span class="lite"><a href="/cgi-bin/bucky/index">home</a></span> | <a href="/cgi-bin/bucky/post">post</a> | +<a href="/cgi-bin/bucky/import">ftp</a> | +<a href="/cgi-bin/bucky/inbox">inbox</a> | +<a href="/cgi-bin/bucky/message">message</a> | +<a href="/cgi-bin/bucky/profile?c=form">profile</a> | + +<a href="/cgi-bin/bucky/logout">logout</a> +</small></td> +<td align=right nowrap style="padding: 0px 4px 0px 4px;"><small> + +</small></td></tr> +<tr><td colspan=2 align="center"> +<hr noshade color="#201010" style="padding: 0px; margin: 2px;"> +</td></tr> +</table> +__BODY__ + +print <<__SEARCH_FORM__; +<center> +<table cellspacing=0 cellpadding=0 border=0 width=900> +<tr> +<td style="width: 149px;"> </td> +<td style="padding: 10px;" align="center"> +<form action="/cgi-bin/bucky/2/search" method="get" enctype="multipart/form-data"> +<table cellpadding=0 cellspacing=0 border=0> +<tr><td style="text-align: center; vertical-align: middle;"> +<input name="q" value="$query" maxlength=1024 style="font-size: 13px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif; + color: #140A0A; border: 1px #140A0A solid; padding: 1px; margin: 0px 0px 0px 0px; width: 300px;"> +</td> +<td style="text-align: center; vertical-align: middle;"> +<input type="submit" value="SEARCH" class="clicky" style="margin: 0px 0px 0px 0px;"> +</td></tr></table> +</form> +</td> +<td style="width: 149px;"> </td> +</tr> + +__SEARCH_FORM__ + +if ($query) +{ +my $start = $session->param("start"); +my $limit = $session->param("limit"); + +my $search = new Bucky::Search; +my $results = $search->search($query, $start, $limit); + +my $terms = $results->{'terms'}; +my $r = 0; + +my $z_last_start = $results->{'start'} - $results->{'limit'} + 1; +my $z_start = $results->{'start'}; +my $z_limit = $results->{'limit'}; +my $z_upto = $z_last_start + $z_limit - 1; +my $z_total = $results->{'total'}; +my $z_next; + +if ($results->{'total'} == 0) + { + my $z_next = "<center><big><big><big>No Results!</big></big></big></center>"; + print "<tr><td> <td style=\"border-top: 1px solid #b6aeab; padding: 10px;\" align=\"center\">$z_next </td>"; + } +else + { + $z_next = "<big>displaying $z_last_start-$z_upto of $z_total results ..."; + if ($z_start < $z_total) + { + $z_next .= " <big><a href=\"/cgi-bin/bucky/2/search?q=$query&start=$z_start&limit=$z_limit\">next page >></a><big></big>"; + } + } +print "<tr><td> </td><td style=\"border-bottom: 1px solid #b6aeab; padding: 10px;\" align=\"center\">$z_next </td><td></td>" if $z_next; +foreach my $result (@{$results->{'results'}}) + { + $r = $r ? 0 : 1; + my $thread = $results->{'threads'}->{ $result->{'thread'} }; + my $comment = $results->{'comments'}->{ $result->{'comment'} }; + my $file = $results->{'files'}->{ $result->{'file'} }; + + my $z_thread = $thread->{'id'}; + my $z_username = $thread->{'username'}; + my $z_title = $search->bold_terms( $thread->{'title'}, $terms); + my $z_comment = $search->bold_snippet( $comment->{'comment'}, $terms); + my $z_filename = $file->{'filename'}; + my $z_file = $search->bold_terms( $z_filename, $terms); + my $z_date = scalar localtime $thread->{'createdate'}; + my $z_strength = $result->{'strength'} . "x" . $result->{'count'}; + my $z_bigs = $result->{'count'} > ( scalar(@$terms) - 3 ) + ? "<big><big>" : "<big>"; + my $z_unbigs = $result->{'count'} > ( scalar(@$terms) - 3 ) + ? "</big></big>" : "</big>"; + my $z_img; + if ($file && $file->{'filename'} =~ /jpg/i) + { + my $filename = lc($file->{'filename'}); + $z_img = "<img src=\"/bucky/data/$z_thread/.thumb/t.$filename\">" if $filename; + } + elsif ($thread->{'flagged'}) + { + my $file = $results->{'files'}->{ $thread->{'flagged'} }; + my $filename = lc($file->{'filename'}); + $z_img = "<img src=\"/bucky/data/$z_thread/.thumb/t.$filename\">" if $filename; + } + my $z_color = "c"; + $z_color .= $r; + my $z_filelink = "<a href=\"/bucky/data/$z_thread/$z_filename\">$z_file</a>" if $z_file; + + print <<__RESULT__; +<tr> +<td align="right" valign="top" style="padding: 5px;"> +$z_img +</td> +<td align="left" valign="top" class="$z_color" style="padding: 5px; border-style: solid; border-color: #b6aeab; border-width: 0px 1px 1px 1px;"> +$z_bigs<a href="/cgi-bin/bucky/details/$z_thread"><u>$z_title</u></a>$z_unbigs<br> +<small>$z_strength</small> posted by <a href="/cgi-bin/bucky/profile/$z_username">$z_username</a> | $z_date<br> +<blockquote><big>$z_filelink $z_comment</big></blockquote> +</td> +</tr> + +__RESULT__ +# print Dumper($result); + } +print "<tr><td> </td><td style=\"padding: 10px;\" align=\"center\">$z_next </td><td></td>" if $z_next; +} + +print <<__FOOTER__; +</td></tr></table> +</td></tr></table> + +</div> + + </td> + + </tr> +</table> +</center> + +</body> +</html> + + +__FOOTER__ +1; diff --git a/bucky2/cgi-bin/svn b/bucky2/cgi-bin/svn new file mode 100755 index 0000000..dcc409d --- /dev/null +++ b/bucky2/cgi-bin/svn @@ -0,0 +1,7 @@ +#!/usr/bin/perl +use lib "../lib"; +use Bucky::SVN; +my $svn = new Bucky::SVN; + +$svn->query_incoming; + |
