diff --git a/trunk/daemon.pl b/trunk/daemon.pl index a7ef58c..6dfba9c 100755 --- a/trunk/daemon.pl +++ b/trunk/daemon.pl @@ -173,7 +173,7 @@ while(1) } #write status 1 to uploaded table - $dbh->do(qq{update uploaded set status = ? where id = ?}, undef, 1, $id) or interrupt $dbh->errstr; + $dbh->do(qq{delete from uploaded where id = ?}, undef, $id) or interrupt $dbh->errstr; } } } diff --git a/trunk/locale/en-us.xml b/trunk/locale/en-us.xml index d94a414..37768f2 100755 --- a/trunk/locale/en-us.xml +++ b/trunk/locale/en-us.xml @@ -30,7 +30,7 @@ latest additions most downloads - best rated + most views Error 202c - Access forbidden by government. diff --git a/trunk/register.pl b/trunk/register.pl index cadcbe7..b533eca 100644 --- a/trunk/register.pl +++ b/trunk/register.pl @@ -16,6 +16,11 @@ if($username) { $page->{'message'}->{'type'} = "error"; $page->{'message'}->{'text'} = "error_already_registered"; + + #print xml http header along with session cookie + print $session->header(-type=>'text/xml', -charset=>'UTF-8'); + + print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); } #if username and password are passed put them into the database elsif($query->param('user') and $query->param('pass') and $query->param('pass_repeat')) @@ -31,16 +36,19 @@ elsif($query->param('user') and $query->param('pass') and $query->param('pass_re #disconnect db $dbh->disconnect() or die $dbh->errstr; - - #print a little confirmation - $page->{'message'}->{'type'} = "information"; - $page->{'message'}->{'text'} = "information_registered"; + + print $query->redirect("index.pl?information=information_registered"); } else { $page->{'registerform'} = ['']; $page->{'message'}->{'type'} = "error"; $page->{'message'}->{'text'} = "error_passwords_do_not_match"; + + #print xml http header along with session cookie + print $session->header(-type=>'text/xml', -charset=>'UTF-8'); + + print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); } } elsif(not $query->param('user') and ($query->param('pass') or $query->param('pass_repeat'))) @@ -48,25 +56,40 @@ elsif(not $query->param('user') and ($query->param('pass') or $query->param('pas $page->{'registerform'} = ['']; $page->{'message'}->{'type'} = "error"; $page->{'message'}->{'text'} = "error_insert_username"; + + #print xml http header along with session cookie + print $session->header(-type=>'text/xml', -charset=>'UTF-8'); + + print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); } elsif(not $query->param('pass') and ($query->param('user') or $query->param('pass_repeat'))) { $page->{'registerform'} = ['']; $page->{'message'}->{'type'} = "error"; $page->{'message'}->{'text'} = "error_insert_password"; + + #print xml http header along with session cookie + print $session->header(-type=>'text/xml', -charset=>'UTF-8'); + + print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); } elsif(not $query->param('pass_repeat') and ($query->param('user') or $query->param('pass'))) { $page->{'registerform'} = ['']; $page->{'message'}->{'type'} = "error"; $page->{'message'}->{'text'} = "error_repeat_password"; + + #print xml http header along with session cookie + print $session->header(-type=>'text/xml', -charset=>'UTF-8'); + + print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); } else { $page->{'registerform'} = ['']; + + #print xml http header along with session cookie + print $session->header(-type=>'text/xml', -charset=>'UTF-8'); + + print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); } - -#print xml http header along with session cookie -print $session->header(-type=>'text/xml', -charset=>'UTF-8'); - -print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); diff --git a/trunk/site/main.xml b/trunk/site/main.xml index f55e074..8abbf06 100755 --- a/trunk/site/main.xml +++ b/trunk/site/main.xml @@ -27,6 +27,8 @@ /upload.pl uploader.pl search.pl?query=&orderby=timestamp&sort=desc + search.pl?query=&orderby=downloadcount&sort=desc + search.pl?query=&orderby=viewcount&sort=desc diff --git a/trunk/tagcloud.pl b/trunk/tagcloud.pl new file mode 100755 index 0000000..a8e2141 --- /dev/null +++ b/trunk/tagcloud.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +use DBI; +use Data::Dumper::Simple; + +$database = 'yolanda'; +$dbhost = 'localhost'; +$dbuser = 'root'; +$dbpass = ''; + +$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass); + +$sth = $dbh->prepare("select subject from videos"); +$sth->execute(); +while(($subject) = $sth->fetchrow_array()) +{ + @subject = split(',', $subject); + foreach my $val (@subject) + { + $val =~ s/^\s*(.*?)\s*$/$1/; + %hash->{$val}++; + } +} +$sth->finish(); + +@sorted = sort {$hash{$b} cmp $hash{$a}} keys %hash; + +$dbh->do("delete from tagcloud"); +$sth = $dbh->prepare("insert into tagcloud (text, count) values (?, ?)"); +for($i=0;$i<20 and $i<=$#sorted;$i++) +{ + $sth->execute( $sorted[$i], %hash->{$sorted[$i]} ); +} diff --git a/trunk/xsl/xhtml.xsl b/trunk/xsl/xhtml.xsl index 6e3a4be..186cbed 100755 --- a/trunk/xsl/xhtml.xsl +++ b/trunk/xsl/xhtml.xsl @@ -17,11 +17,11 @@ omit-xml-declaration="no" /> - - + + - + @@ -240,9 +240,19 @@ - + + + + + + - + + + + + + @@ -300,19 +310,14 @@ - + +