[vhffs-dev] [1929] FastCGI'fied public part of the panel |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1929
Author: gradator
Date: 2012-01-24 00:53:49 +0100 (Tue, 24 Jan 2012)
Log Message:
-----------
FastCGI'fied public part of the panel
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Panel/Group.pm
trunk/vhffs-api/src/Vhffs/Panel/Public.pm
trunk/vhffs-public/Makefile.am
trunk/vhffs-public/index.pl
trunk/vhffs-public/templates/content/all-groups.tt
trunk/vhffs-public/templates/content/group-details.tt
trunk/vhffs-public/templates/content/groupsearch-form.tt
trunk/vhffs-public/templates/content/usersearch-form.tt
trunk/vhffs-public/templates/parts/group-general.tt
trunk/vhffs-public/templates/parts/left-menu.tt
trunk/vhffs-public/templates/parts/tags-cloud.tt
trunk/vhffs-public/templates/parts/user-general.tt
Removed Paths:
-------------
trunk/vhffs-public/allgroups.pl
trunk/vhffs-public/avatar.pl
trunk/vhffs-public/extern/
trunk/vhffs-public/group.pl
trunk/vhffs-public/groupsearch.pl
trunk/vhffs-public/groupsearch_form.pl
trunk/vhffs-public/lastusers.pl
trunk/vhffs-public/tagsearch.pl
trunk/vhffs-public/user.pl
trunk/vhffs-public/usersearch.pl
trunk/vhffs-public/usersearch_form.pl
Modified: trunk/vhffs-api/src/Vhffs/Panel/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2012-01-23 23:53:49 UTC (rev 1929)
@@ -81,7 +81,7 @@
my $main = shift;
my @groups;
- my $sql = 'SELECT g.gid, g.groupname, g.realname, o.description, owner.username AS owner_name FROM vhffs_groups g LEFT OUTER JOIN vhffs_users u ON u.username=g.groupname INNER JOIN vhffs_object o ON o.object_id=g.object_id INNER JOIN vhffs_users owner ON owner.uid = o.owner_uid WHERE o.state=? AND u.username IS NULL ORDER BY o.date_creation DESC LIMIT 10';
+ my $sql = 'SELECT g.gid, g.groupname, g.realname, o.description, owner.username AS owner_name, o.object_id FROM vhffs_groups g LEFT OUTER JOIN vhffs_users u ON u.username=g.groupname INNER JOIN vhffs_object o ON o.object_id=g.object_id INNER JOIN vhffs_users owner ON owner.uid = o.owner_uid WHERE o.state=? AND u.username IS NULL ORDER BY o.date_creation DESC LIMIT 10';
return fetch_groups_and_users($main, $sql, Vhffs::Constants::ACTIVATED);
}
@@ -149,7 +149,7 @@
my $limit = ' LIMIT 10';
$limit .= ' OFFSET '.($start * 10) if(defined $start);
- my $select = 'SELECT g.gid, g.groupname, g.realname, o.description, owner.username AS owner_name'.$sql.' ORDER BY groupname '.$limit;
+ my $select = 'SELECT g.gid, g.groupname, g.realname, o.description, owner.username AS owner_name, o.object_id'.$sql.' ORDER BY groupname '.$limit;
my $groups = fetch_groups_and_users($main, $select, @params);
my $dbh = $main->get_db_object();
@@ -217,7 +217,7 @@
my ($main, $letter, $starting, $count) = @_;
my @params;
- my $select_clause = 'SELECT g.gid, g.groupname, g.realname, o.description, owner.username as owner_name';
+ my $select_clause = 'SELECT g.gid, g.groupname, g.realname, o.description, owner.username as owner_name, o.object_id';
my $sql = ' FROM vhffs_groups g '.
'LEFT OUTER JOIN vhffs_users u ON u.username=g.groupname '.
'INNER JOIN vhffs_object o ON o.object_id=g.object_id '.
Modified: trunk/vhffs-api/src/Vhffs/Panel/Public.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Public.pm 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-api/src/Vhffs/Panel/Public.pm 2012-01-23 23:53:49 UTC (rev 1929)
@@ -41,15 +41,26 @@
use POSIX qw(locale_h);
use Template;
+use Encode;
use lib '%VHFFS_LIB_DIR%';
use Vhffs::Tag;
use Vhffs::Functions;
+require Vhffs::User;
+require Vhffs::Group;
+require Vhffs::Tag;
+require Vhffs::Panel::Commons;
+require Vhffs::Panel::User;
+require Vhffs::Panel::Group;
+require Vhffs::Panel::Tag;
sub new {
my $class = shift;
my $panel = $class->SUPER::new(@_);
- return undef unless $panel->check_public();
+ unless( $panel->check_public() ) {
+ $panel->render('misc/closed.tt', undef);
+ return undef;
+ }
return $panel;
}
@@ -72,7 +83,519 @@
$vars->{random_tags} = Vhffs::Tag::get_random_tags($self->{vhffs});
}
- $self->SUPER::render($file, $vars, 'public.tt', 'public');
+ $self->SUPER::render($file, $vars, 'public.tt', 'public');
}
+sub lastgroups {
+ my $panel = shift;
+
+ my $hostname = $panel->{vhffs}->get_config->get_host_name;
+
+ my $vars = {
+ lg_title => sprintf( gettext('Latest projects on %s') , $hostname ),
+ groups => Vhffs::Panel::Group::get_last_groups( $panel->{vhffs} )
+ };
+
+ $panel->render('content/last-groups.tt', $vars);
+}
+
+sub lastusers {
+ my $panel = shift;
+
+ my $users = Vhffs::Panel::User::get_last_users($panel->{vhffs});
+
+ $panel->render('content/last-users.tt', {
+ users => $users
+ });
+}
+
+sub groupsearch {
+ my $panel = shift;
+ my $cgi = $panel->{cgi};
+
+ my @included_tags_ids = map { int($_); } $cgi->param('included_tags');
+ my @excluded_tags_ids = map { int($_); } $cgi->param('excluded_tags');
+
+ my $discard_excluded = $cgi->param('discard_ex');
+ @excluded_tags_ids = grep { $_ != $discard_excluded } @excluded_tags_ids if(defined $discard_excluded);
+
+ my $discard_included = $cgi->param('discard_inc');
+ @included_tags_ids = grep { $_ != $discard_included } @included_tags_ids if(defined $discard_included);
+
+ if( defined $cgi->param('groupname') and defined $cgi->param('description') ) {
+ my $groupname = Encode::decode_utf8($cgi->param('groupname'));
+ $groupname = '' unless(defined $groupname); # Direct tag click brings us here without without groupname ...
+ my $description = Encode::decode_utf8($cgi->param('description'));
+ $description = '' unless(defined $description); # ... and without description
+
+ # current page
+ my $page = defined($cgi->param('page')) ? int($cgi->param('page')) : 1;
+
+ my ($groups, $count) = Vhffs::Panel::Group::public_search($panel->{vhffs}, $groupname, $description, \@included_tags_ids, \@excluded_tags_ids, $page - 1);
+
+ if(scalar(@$groups) == 0) {
+ $panel->render('common/error.tt', {
+ message => gettext('No group found')
+ });
+ exit(0);
+ }
+
+ my $pager = Vhffs::Panel::Commons::get_pager($page, $count, 10, 5, $panel->{url}, { groupname => $groupname, description => $description, included_tags => \@included_tags_ids, excluded_tags => \@excluded_tags_ids});
+
+ my $vars = {
+ groups => $groups,
+ gs_title => gettext( 'Search results' ),
+ gs_pager => $pager
+ };
+
+ $panel->render('content/groupsearch-results.tt', $vars);
+ return;
+ }
+
+ my $query_string = '';
+
+ $query_string .= 'included_tags='.(join('&included_tags=', @included_tags_ids)) if(scalar(@included_tags_ids));
+ $query_string .= '&' if(scalar(@included_tags_ids) && scalar(@excluded_tags_ids));
+ $query_string .= 'excluded_tags='.(join('&excluded_tags=', @excluded_tags_ids)) if(scalar(@excluded_tags_ids));
+
+ my $vars = {
+ included_tags => Vhffs::Panel::Tag::get_by_tag_ids($panel->{vhffs}, @included_tags_ids),
+ excluded_tags => Vhffs::Panel::Tag::get_by_tag_ids($panel->{vhffs}, @excluded_tags_ids),
+ other_tags => Vhffs::Panel::Tag::get_all_excluding($panel->{vhffs}, @included_tags_ids, @excluded_tags_ids),
+ query_string => $query_string
+ };
+
+ $panel->render('content/groupsearch-form.tt', $vars);
+}
+
+sub group {
+ my $panel = shift;
+ my $vhffs = $panel->{vhffs};
+ my $cgi = $panel->{cgi};
+
+ my $config = $vhffs->get_config();
+
+ my $groupname = $cgi->param('name');
+ unless(defined $groupname) {
+ $panel->render('common/error.tt', {
+ message => gettext('CGI Error')
+ });
+ exit(0);
+ }
+
+ my $group = Vhffs::Group::get_by_groupname($panel->{vhffs}, $groupname);
+
+ unless(defined $group) {
+ $panel->render('common/error.tt', {
+ message => gettext('Group not found')
+ });
+ exit(0);
+ }
+
+ my $tag_categories = $group->get_tags(Vhffs::Constants::TAG_VISIBILITY_PUBLIC);
+
+ my $vars = {
+ group => $group,
+ tag_categories => $tag_categories
+ };
+
+ # Services filling... Really boring
+ if( $config->get_service_availability('web') == 1 ) {
+ use Vhffs::Panel::Web;
+ $vars->{websites} = Vhffs::Panel::Web::get_websites_per_group($vhffs, $group->get_gid);
+ }
+
+ if( $vhffs->get_config->get_service_availability('cvs') == 1 ) {
+ use Vhffs::Panel::Cvs;
+ $vars->{cvs} = {
+ cvs_web_url => $config->get_service('cvs')->{'cvsweb_url'},
+ repositories => Vhffs::Panel::Cvs::get_repos_per_group($vhffs, $group->get_gid )
+ };
+ }
+
+ if( $vhffs->get_config->get_service_availability('svn') == 1 ) {
+ use Vhffs::Panel::Svn;
+ $vars->{svn} = {
+ svn_web_url => $config->get_service('svn')->{'svnweb_url'},
+ repositories => Vhffs::Panel::Svn::get_repos_per_group($vhffs, $group->get_gid )
+ };
+ }
+
+ if( $vhffs->get_config->get_service_availability('git') == 1 ) {
+ use Vhffs::Panel::Git;
+ $vars->{git} = {
+ git_web_url => $config->get_service('git')->{'gitweb_url'},
+ repositories => Vhffs::Panel::Git::get_repos_per_group($vhffs, $group->get_gid )
+ };
+ }
+
+ if( $vhffs->get_config->get_service_availability('mercurial') == 1 ) {
+ use Vhffs::Panel::Mercurial;
+ $vars->{mercurial} = {
+ mercurial_web_url => $config->get_service('mercurial')->{'mercurialweb_url'},
+ repositories => Vhffs::Panel::Mercurial::get_repos_per_group($vhffs, $group->get_gid )
+ };
+ }
+
+
+ if( $vhffs->get_config->get_service_availability('mailinglist') == 1 ) {
+ use Vhffs::Panel::MailingList;;
+ $vars->{ml} = {
+ archives_url => $config->get_service('mailinglist')->{'url_archives'},
+ lists => Vhffs::Panel::MailingList::get_lists_per_group($vhffs, $group->get_gid )
+ };
+ }
+
+ $panel->render('content/group-details.tt', $vars);
+}
+
+sub allgroups {
+ my $panel = shift;
+ my $vhffs = $panel->{vhffs};
+ my $cgi = $panel->{cgi};
+
+ my $letter = $cgi->param('letter');
+ my $used_letters = Vhffs::Panel::Group::get_used_letters($vhffs);
+ $letter = $used_letters->[0]{letter} unless(defined $letter || !defined $used_letters->[0]{letter});
+ undef $letter if defined $letter and $letter eq 'all';
+
+ my $page = $cgi->param('page');
+ $page = 1 unless defined $page and int($page) > 0;
+ my $per_page_count = 10;
+
+ my $result = Vhffs::Panel::Group::get_groups_starting_with( $vhffs , $letter, ($page - 1) * $per_page_count, $per_page_count);
+ my $pager = Vhffs::Panel::Commons::get_pager($page, $result->{total_count}, $per_page_count, 5, $panel->{url}, {
+ 'letter' => defined($letter) ? $letter : 'all'
+ });
+
+ my $vars = {
+ pager => $pager,
+ groups => $result->{data},
+ letters => $used_letters
+ };
+
+ $panel->render('content/all-groups.tt', $vars);
+}
+
+sub usersearch {
+ my $panel = shift;
+ my $cgi = $panel->{cgi};
+
+ if( defined $cgi->param('username') ) {
+ my $username = Encode::decode_utf8($cgi->param('username'));
+ my $page = defined($cgi->param('page')) ? int($cgi->param('page')) : 1;
+
+ if($username =~ /^\s*$/) {
+ $panel->render('common/error.tt', {
+ message => gettext('You have to enter an username')
+ });
+ return;
+ }
+
+ my ($users, $total) = Vhffs::Panel::User::public_search($panel->{vhffs}, $username, ($page - 1));
+
+ if($total == 0) {
+ $panel->render('common/error.tt', {
+ message => gettext('No user found')
+ });
+ return;
+ }
+
+ my $pager = Vhffs::Panel::Commons::get_pager($page, $total, 10, 5, $panel->{url}, { username => $username });
+
+ $panel->render('content/usersearch-results.tt', {
+ users => $users,
+ u_pager => $pager
+ });
+ return;
+ }
+
+ $panel->render('content/usersearch-form.tt');
+}
+
+sub user {
+ my $panel = shift;
+ my $vhffs = $panel->{vhffs};
+ my $cgi = $panel->{cgi};
+
+ my $config = $vhffs->get_config();
+
+ my $username = $cgi->param('name');
+ unless(defined $username) {
+ $panel->render('common/error.tt', {
+ message => gettext('CGI Error')
+ });
+ return;
+ }
+
+ my $user = Vhffs::User::get_by_username($panel->{vhffs}, $username);
+ unless(defined $user) {
+ $panel->render('common/error.tt', {
+ message => gettext('User not found')
+ });
+ return;
+ }
+
+ my @groups;
+ foreach my $grouphash (@{$user->get_groups}) {
+ push @groups, $grouphash->{groupname};
+ }
+ $user->{groups} = \@groups;
+
+ my $vars = {
+ user => $user,
+ };
+
+ $panel->render('content/user-details.tt', $vars);
+}
+
+sub tags {
+ my $panel = shift;
+ my $cgi = $panel->{cgi};
+
+ my $search = Encode::decode_utf8($cgi->param('search'));
+ unless( defined $search ) {
+ $panel->render('common/error.tt', {
+ message => gettext('CGI Error!')
+ });
+ return;
+ }
+
+ # TODO Handle complicated search patterns
+ my ($category, $tag) = split /::/, $search;
+ unless(defined $tag) {
+ $tag = $category;
+ $category = undef;
+ }
+
+ # current page
+ my $page = defined($cgi->param('page')) ? int($cgi->param('page')) : 1;
+
+ my ($groups, $count) = Vhffs::Panel::Tag::get_groups($panel->{vhffs}, $category, $tag, $page - 1);
+
+ if(scalar(@$groups) == 0) {
+ $panel->render('common/error.tt', {
+ message => gettext('No group found')
+ });
+ return;
+ }
+
+ my $url = $panel->{url};
+# $url =~ s!tags/.*!tagsearch.pl!;
+
+ require URI::Escape;
+ my $pager = Vhffs::Panel::Commons::get_pager($page, $count, 10, 5, $url, { search => URI::Escape::uri_escape($search)});
+
+ my $vars = {
+ groups => $groups,
+ gs_title => gettext( 'Search results' ),
+ gs_pager => $pager
+ };
+
+ $panel->render('content/groupsearch-results.tt', $vars);
+}
+
+sub externstats {
+ my $panel = shift;
+ my $vhffs = $panel->{vhffs};
+
+ require Vhffs::Stats;
+ my $stats = new Vhffs::Stats( $vhffs );
+ return unless defined $stats;
+
+ my $output = '';
+
+ $output .= '<?xml version="1.0" encoding="UTF-8"?>'."\n";
+ $output .= '<stats>'."\n";
+
+ $output .= '<users>'."\n";
+ $output .= ' <total>'.$stats->get_user_total.'</total>'."\n";
+ $output .= '</users>'."\n";
+
+ $output .= '<groups>'."\n";
+ $output .= ' <total>'.$stats->get_groups_total.'</total>'."\n";
+ $output .= ' <activated>'.$stats->get_groups_activated.'</activated>'."\n";
+ $output .= '</groups>'."\n";
+
+ $output .= '<service name="web">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_web_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_web_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="mysql">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_mysql_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_mysql_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="pgsql">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_pgsql_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_pgsql_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="cvs">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_cvs_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_cvs_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="svn">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_svn_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_svn_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="git">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_git_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_git_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="mercurial">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_mercurial_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_mercurial_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="bazaar">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_bazaar_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_bazaar_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="mail">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_mail_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_mail_activated.'</activated>'."\n";
+ $output .= ' <boxes>'.$stats->get_mail_total_boxes.'</boxes>'."\n";
+ $output .= ' <forwards>'.$stats->get_mail_total_forwards.'</forwards>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="mailinglist">'."\n";
+ $output .= ' <total>'.$stats->get_lists_total.'</total>'."\n";
+ $output .= ' <activated>'.$stats->get_lists_activated.'</activated>'."\n";
+ $output .= ' <subscriptions>'.$stats->get_lists_totalsubs.'</subscriptions>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '<service name="dns">'."\n";
+ $output .= ' <awaitingmoderation>'.$stats->get_dns_in_moderation.'</awaitingmoderation>'."\n";
+ $output .= ' <activated>'.$stats->get_dns_activated.'</activated>'."\n";
+ $output .= '</service>'."\n";
+
+ $output .= '</stats>'."\n";
+
+ print Encode::encode_utf8( 'Content-Type: text/xml; charset=utf-8'."\n\n".$output );
+}
+
+sub externnewusersrss {
+ my $panel = shift;
+ my $vhffs = $panel->{vhffs};
+
+ my $url = ( $vhffs->get_config->get_panel->{'url_public'} or '' );
+
+ unless( $vhffs->get_config->get_panel->{'rss_users'} eq 'yes' and $vhffs->get_config->get_panel->{'use_public'} eq 'yes' ) {
+ $panel->render('misc/message.tt', {
+ message=> gettext( 'RSS infos are not published' )
+ });
+ return;
+ }
+
+ require XML::RSS;
+ my $rss = new XML::RSS( version => '1.0' );
+ my $title;
+ if( defined $vhffs->get_config->get_host_name ) {
+ $title = 'Last users on '.$vhffs->get_config->get_host_name;
+ } else {
+ $title = 'VHFFS last users';
+ }
+
+ $rss->channel(
+ title => $title,
+ link => $url.'?do=lastusers',
+ description => 'Best hosting platform',
+ dc => {
+ date => '2000-08-23T07:00+00:00',
+ subject => 'danstoncul',
+ creator => 'vhffs@xxxxxxxxx',
+ publisher => 'vhffs@xxxxxxxxx',
+ rights => 'Copyright 2004, Vhffs Dream Team',
+ language => 'en_US',
+ },
+ syn => {
+ updatePeriod => 'hourly',
+ updateFrequency => '1',
+ updateBase => '1901-01-01T00:00+00:00',
+ },
+ taxo => [
+ 'http://dmoz.org/Computers/Internet',
+ 'http://dmoz.org/Computers/PC'
+ ]
+ );
+
+ my $users = Vhffs::Panel::User::get_last_users( $vhffs );
+
+ foreach(@{$users}) {
+ $rss->add_item(
+ title => $_->{username},
+ link => $url.'?do=user&name='.$_->{username},
+ description => 'VHFFS User'
+ );
+ }
+ $rss->{output} = '2.0';
+ print Encode::encode_utf8( 'Content-Type: text/xml; charset=utf-8'."\n\n".$rss->as_string );
+}
+
+sub externnewgroupsrss {
+ my $panel = shift;
+ my $vhffs = $panel->{vhffs};
+
+ my $url = ( $vhffs->get_config->get_panel->{'url_public'} or '' );
+
+ unless( $vhffs->get_config->get_panel->{'rss_groups'} eq 'yes' and $vhffs->get_config->get_panel->{'use_public'} eq 'yes' ) {
+ $panel->render('misc/message.tt', {
+ message=> gettext( 'RSS infos are not published' )
+ });
+ return;
+ }
+
+ require XML::RSS;
+ my $rss = new XML::RSS( version => '1.0' );
+ my $title;
+ if( defined $vhffs->get_config->get_host_name ) {
+ $title = 'Last groups on '.$vhffs->get_config->get_host_name;
+ } else {
+ $title = 'VHFFS last groups';
+ }
+
+ $rss->channel(
+ title => $title,
+ link => $url.'?do=lastgroups',
+ description => 'Best hosting platform',
+ dc => {
+ date => '2000-08-23T07:00+00:00',
+ subject => 'Last groups on '.$vhffs->get_config->get_host_name,
+ subject => 'danstoncul',
+ creator => 'vhffs@xxxxxxxxx',
+ publisher => 'vhffs@xxxxxxxxx',
+ rights => 'Copyright 2004, Vhffs Dream Team',
+ language => 'en_US',
+ },
+ syn => {
+ updatePeriod => 'hourly',
+ updateFrequency => '1',
+ updateBase => '1901-01-01T00:00+00:00',
+ },
+ taxo => [
+ 'http://dmoz.org/Computers/Internet',
+ 'http://dmoz.org/Computers/PC'
+ ]
+ );
+
+ my $groups = Vhffs::Panel::Group::get_last_groups( $vhffs );
+
+ foreach(@{$groups}) {
+ $rss->add_item(
+ title => $_->{realname},
+ link => $url.'?do=group&name='.$_->{groupname},
+ description => 'Vhffs Group',
+ );
+ }
+
+ $rss->{output} = '2.0';
+ print Encode::encode_utf8( 'Content-Type: text/xml; charset=utf-8'."\n\n".$rss->as_string );
+}
+
1;
Modified: trunk/vhffs-public/Makefile.am
===================================================================
--- trunk/vhffs-public/Makefile.am 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/Makefile.am 2012-01-23 23:53:49 UTC (rev 1929)
@@ -2,21 +2,7 @@
SUBDIRS = templates
publicdir = @PUBLICDIR@
-nobase_dist_public_SCRIPTS = \
- allgroups.pl \
- avatar.pl \
- group.pl \
- groupsearch.pl \
- groupsearch_form.pl \
- index.pl \
- lastusers.pl \
- tagsearch.pl \
- user.pl \
- usersearch.pl \
- usersearch_form.pl \
- extern/newgroupsrss.pl \
- extern/newusersrss.pl \
- extern/stats.pl
+nobase_dist_public_SCRIPTS = index.pl
# Define the substitution we need to point perl script at correct location
do_sed = $(SED) --in-place \
Deleted: trunk/vhffs-public/allgroups.pl
===================================================================
--- trunk/vhffs-public/allgroups.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/allgroups.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,68 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Panel::Commons;
-use Vhffs::Panel::Group;
-use Vhffs::Panel::Public;
-
-my $panel = new Vhffs::Panel::Public();
-my $vhffs = $panel->{vhffs};
-my $cgi = $panel->{cgi};
-
-my $letter = $cgi->param('letter');
-my $used_letters = Vhffs::Panel::Group::get_used_letters($vhffs);
-$letter = $used_letters->[0]{letter} unless(defined $letter || !defined $used_letters->[0]{letter});
-undef $letter if( defined $letter && $letter eq 'all');
-
-my $page = $cgi->param('page');
-$page = 1 unless(defined $page && int($page) > 0);
-my $per_page_count = 10;
-
-my $result = Vhffs::Panel::Group::get_groups_starting_with( $vhffs , $letter, ($page - 1) * $per_page_count, $per_page_count);
-my $pager = Vhffs::Panel::Commons::get_pager($page, $result->{total_count}, $per_page_count, 5, $panel->{url}, {
- 'letter' => defined($letter) ? $letter : 'all'
-});
-
-my $vars = {
- pager => $pager,
- groups => $result->{data},
- letters => $used_letters
-};
-
-$panel->render('content/all-groups.tt', $vars);
Deleted: trunk/vhffs-public/avatar.pl
===================================================================
--- trunk/vhffs-public/avatar.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/avatar.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,130 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-use CGI;
-use GD;
-use GD::Text::Wrap;
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Object;
-use Vhffs::Panel::Avatar;
-use Vhffs::Functions;
-
-#Get some basics informations with CGI
-my $cgi;
-my $oid;
-my $code;
-my $vhffs;
-my $gd;
-my $wp;
-my $black;
-my $white;
-my $blue;
-my $path;
-my $buf;
-my $object;
-
-$cgi = new CGI;
-$cgi->charset('utf-8');
-$vhffs = init Vhffs::Main;
-$oid = $cgi->param( "oid" );
-
-$object = Vhffs::Object::get_by_oid( $vhffs , $oid );
-
-$path = Vhffs::Panel::Avatar::exists_avatar( $vhffs , $object );
-
-if( ! ( defined $oid ) )
-{
- print $cgi->header( -type=>"text/html", -charset=>"utf-8" );
- print "oid error";
- exit 1;
-}
-
-$gd = GD::Image->new(70,100);
-$white = $gd->colorAllocate(255,255,255);
-$black = $gd->colorAllocate( 0, 0, 0);
-$blue = $gd->colorAllocate(127,127,255);
-
-#print "No colours: $black ", $gd->colorsTotal, "\n";
-
-
-# Assume the user has set FONT_PATH or TTF_FONT_PATH
-#$wp->font_path('/usr/share/fonts/ttfonts');
-print $cgi->header( -type=>"image/png" );
-
-binmode STDOUT;
-
-# TODO user pregenerated images
-
-unless( Vhffs::Functions::strtobool( $vhffs->get_config->get_panel->{'users_avatars'} ) or Vhffs::Functions::strtobool( $vhffs->get_config->get_panel->{'groups_avatars'} ) )
-{
- $wp = GD::Text::Wrap->new($gd,
- width => 70,
- line_space => 0,
- color => $black,
- text => "This platform does not support avatar",
- );
- $wp->set_font(gdLargeFont, 14);
- $wp->set(align => 'center');
- $wp->draw(0,5);
- $wp->set(para_space => 10, preserve_nl => 0);
- print STDOUT $gd->png();
-}
-else
-{
- if( defined $path )
- {
- open FORIG , "$path";
- while( read( FORIG , $buf , 1024 ) )
- {
- print STDOUT $buf;
- }
- close( FORIG );
- }
- else
- {
- $wp = GD::Text::Wrap->new($gd,
- width => 70,
- line_space => 0,
- color => $black,
- text => "No avatar",
- );
- $wp->set_font(gdLargeFont, 14);
- $wp->set(align => 'center');
- $wp->draw(0,5);
- $wp->set(para_space => 10, preserve_nl => 0);
- print STDOUT $gd->png();
- }
-}
-
-close STDOUT;
Deleted: trunk/vhffs-public/group.pl
===================================================================
--- trunk/vhffs-public/group.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/group.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,121 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Group;
-use Vhffs::Panel::Public;
-use Vhffs::Tag;
-
-my $panel = new Vhffs::Panel::Public();
-my $cgi = $panel->{cgi};
-my $vhffs = $panel->{vhffs};
-my $config = $vhffs->get_config();
-
-my $groupname = $cgi->param('name');
-
-unless(defined $groupname) {
- $panel->render('common/error.tt', {
- message => gettext('CGI Error')
- });
- exit(0);
-}
-
-my $group = Vhffs::Group::get_by_groupname($panel->{vhffs}, $groupname);
-
-unless(defined $group) {
- $panel->render('common/error.tt', {
- message => gettext('Group not found')
- });
- exit(0);
-}
-
-my $tag_categories = $group->get_tags(Vhffs::Constants::TAG_VISIBILITY_PUBLIC);
-
-my $vars = {
- group => $group,
- tag_categories => $tag_categories
-};
-
-# Services filling... Really boring
-if( $config->get_service_availability('web') == 1 ) {
- use Vhffs::Panel::Web;
- $vars->{websites} = Vhffs::Panel::Web::get_websites_per_group($vhffs, $group->get_gid);
-}
-
-if( $vhffs->get_config->get_service_availability('cvs') == 1 ) {
- use Vhffs::Panel::Cvs;
- $vars->{cvs} = {
- cvs_web_url => $config->get_service('cvs')->{'cvsweb_url'},
- repositories => Vhffs::Panel::Cvs::get_repos_per_group($vhffs, $group->get_gid )
- };
-}
-
-if( $vhffs->get_config->get_service_availability('svn') == 1 ) {
- use Vhffs::Panel::Svn;
- $vars->{svn} = {
- svn_web_url => $config->get_service('svn')->{'svnweb_url'},
- repositories => Vhffs::Panel::Svn::get_repos_per_group($vhffs, $group->get_gid )
- };
-}
-
-if( $vhffs->get_config->get_service_availability('git') == 1 ) {
- use Vhffs::Panel::Git;
- $vars->{git} = {
- git_web_url => $config->get_service('git')->{'gitweb_url'},
- repositories => Vhffs::Panel::Git::get_repos_per_group($vhffs, $group->get_gid )
- };
-}
-
-if( $vhffs->get_config->get_service_availability('mercurial') == 1 ) {
- use Vhffs::Panel::Mercurial;
- $vars->{mercurial} = {
- mercurial_web_url => $config->get_service('mercurial')->{'mercurialweb_url'},
- repositories => Vhffs::Panel::Mercurial::get_repos_per_group($vhffs, $group->get_gid )
- };
-}
-
-
-if( $vhffs->get_config->get_service_availability('mailinglist') == 1 ) {
- use Vhffs::Panel::MailingList;;
- $vars->{ml} = {
- archives_url => $config->get_service('mailinglist')->{'url_archives'},
- lists => Vhffs::Panel::MailingList::get_lists_per_group($vhffs, $group->get_gid )
- };
-}
-
-$panel->render('content/group-details.tt', $vars);
Deleted: trunk/vhffs-public/groupsearch.pl
===================================================================
--- trunk/vhffs-public/groupsearch.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/groupsearch.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,91 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# Public search page for groups.
-# Parameters:
-# either
-# - included_tags: ID of the tags that should be matched
-# by results (logical OR)
-# - excluded_tags: ID of the tags that shouldn't be matched
-# by results (logical AND)
-# - groupname: (partial) name of the group
-# - description: (partial) description of the group
-# - start (optional): start page of the search
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-
-use Vhffs::Panel::Group;
-use Vhffs::Panel::Public;
-use Vhffs::Panel::Commons;
-
-my $panel = new Vhffs::Panel::Public();
-
-my $cgi = $panel->{cgi};
-
-# Tags in "matches" section
-my @included_tags_ids = map{ int($_); } $cgi->param('included_tags');
-# Tags in "does not match" section
-my @excluded_tags_ids = map{ int($_); } $cgi->param('excluded_tags');
-
-my $groupname = Encode::decode_utf8($cgi->param('groupname'));
-$groupname = '' unless(defined $groupname); # Direct tag click brings us here without without groupname ...
-my $description = Encode::decode_utf8($cgi->param('description'));
-$description = '' unless(defined $description); # ... and without description
-
-
-# current page
-my $page = defined($cgi->param('page')) ? int($cgi->param('page')) : 1;
-
-my ($groups, $count) = Vhffs::Panel::Group::public_search($panel->{vhffs}, $groupname, $description, \@included_tags_ids, \@excluded_tags_ids, $page - 1);
-
-if(scalar(@$groups) == 0) {
- $panel->render('common/error.tt', {
- message => gettext('No group found')
- });
- exit(0);
-}
-
-my $pager = Vhffs::Panel::Commons::get_pager($page, $count, 10, 5, $panel->{url}, { groupname => $groupname, description => $description, included_tags => \@included_tags_ids, excluded_tags => \@excluded_tags_ids});
-
-my $vars = {
- groups => $groups,
- gs_title => gettext( 'Search results' ),
- gs_pager => $pager
-};
-
-$panel->render('content/groupsearch-results.tt', $vars);
Deleted: trunk/vhffs-public/groupsearch_form.pl
===================================================================
--- trunk/vhffs-public/groupsearch_form.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/groupsearch_form.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,73 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-
-use Vhffs::Panel::Public;
-use Vhffs::Panel::Tag;
-
-my $panel = new Vhffs::Panel::Public();
-
-my $cgi = $panel->{cgi};
-
-my @included_tag_ids = map { int($_); } $cgi->param('included_tags');
-my @excluded_tag_ids = map { int($_); } $cgi->param('excluded_tags');
-
-
-
-my $discard_excluded = $cgi->param('discard_ex');
-@excluded_tag_ids = grep { $_ != $discard_excluded } @excluded_tag_ids if(defined $discard_excluded);
-
-my $discard_included = $cgi->param('discard_inc');
-@included_tag_ids = grep { $_ != $discard_included } @included_tag_ids if(defined $discard_included);
-
-
-my $query_string = '';
-
-$query_string .= 'included_tags='.(join('&included_tags=', @included_tag_ids)) if(scalar(@included_tag_ids));
-$query_string .= '&' if(scalar(@included_tag_ids) && scalar(@excluded_tag_ids));
-$query_string .= 'excluded_tags='.(join('&excluded_tags=', @excluded_tag_ids)) if(scalar(@excluded_tag_ids));
-
-my $vars = {
- included_tags => Vhffs::Panel::Tag::get_by_tag_ids($panel->{vhffs}, @included_tag_ids),
- excluded_tags => Vhffs::Panel::Tag::get_by_tag_ids($panel->{vhffs}, @excluded_tag_ids),
- other_tags => Vhffs::Panel::Tag::get_all_excluding($panel->{vhffs}, @included_tag_ids, @excluded_tag_ids),
- query_string => $query_string
-};
-
-$panel->render('content/groupsearch-form.tt', $vars);
Modified: trunk/vhffs-public/index.pl
===================================================================
--- trunk/vhffs-public/index.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/index.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,4 +1,4 @@
-#!%PERL%
+#!%PERL% -w
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
@@ -29,24 +29,62 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+
+require 5.004;
+use utf8;
+use POSIX;
use strict;
-use utf8;
-
-use POSIX qw(locale_h);
use locale;
use Locale::gettext;
-
+#use CGI::Fast qw(:standard);
+use CGI();
+use CGI::Fast();
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Panel::Group;
+use Vhffs::Main;
use Vhffs::Panel::Public;
-my $panel = new Vhffs::Panel::Public();
+# -- prefork
+CGI->compile();
-my $hostname = $panel->{vhffs}->get_config->get_host_name;
+my $vhffs = init Vhffs::Main( { backend => 'no' } );
+exit 1 unless defined $vhffs;
-my $vars = {
- lg_title => sprintf( gettext("Last groups on %s") , $hostname ),
- groups => Vhffs::Panel::Group::get_last_groups( $panel->{vhffs} )
-};
+$vhffs->connect;
-$panel->render('content/last-groups.tt', $vars);
+# -- requests loop
+while (my $cgi = new CGI::Fast) {
+
+ my $panel = new Vhffs::Panel::Public( $vhffs, $cgi );
+ next unless defined $panel;
+
+ my $do = ( $cgi->url_param('do') or 'lastgroups' );
+
+ if( $do eq 'lastgroups' ) {
+ Vhffs::Panel::Public::lastgroups( $panel );
+ } elsif( $do eq 'groupsearch' ) {
+ Vhffs::Panel::Public::groupsearch( $panel );
+ } elsif( $do eq 'group' ) {
+ Vhffs::Panel::Public::group( $panel );
+ } elsif( $do eq 'allgroups' ) {
+ Vhffs::Panel::Public::allgroups( $panel );
+ } elsif( $do eq 'lastusers' ) {
+ Vhffs::Panel::Public::lastusers( $panel );
+ } elsif( $do eq 'usersearch' ) {
+ Vhffs::Panel::Public::usersearch( $panel );
+ } elsif( $do eq 'user' ) {
+ Vhffs::Panel::Public::user( $panel );
+ } elsif( $do eq 'avatar' ) {
+ require Vhffs::Panel::Avatar;
+ Vhffs::Panel::Avatar::get( $panel );
+ } elsif( $do eq 'tags' ) {
+ Vhffs::Panel::Public::tags( $panel );
+ } elsif( $do eq 'externnewusersrss' ) {
+ Vhffs::Panel::Public::externnewusersrss( $panel );
+ } elsif( $do eq 'externnewgroupsrss' ) {
+ Vhffs::Panel::Public::externnewgroupsrss( $panel );
+ } elsif( $do eq 'externstats' ) {
+ Vhffs::Panel::Public::externstats( $panel );
+ }
+}
+
+exit 0;
Deleted: trunk/vhffs-public/lastusers.pl
===================================================================
--- trunk/vhffs-public/lastusers.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/lastusers.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,50 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-
-use Vhffs::Panel::Public;
-use Vhffs::Panel::User;
-
-my $panel = new Vhffs::Panel::Public();
-
-my $users = Vhffs::Panel::User::get_last_users($panel->{vhffs});
-
-$panel->render('content/last-users.tt', {
- users => $users
-});
Deleted: trunk/vhffs-public/tagsearch.pl
===================================================================
--- trunk/vhffs-public/tagsearch.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/tagsearch.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,84 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# Tags navigation (/tags/Pouet)
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-use URI::Escape qw(uri_escape);
-
-use lib '%VHFFS_LIB_DIR%';
-
-use Vhffs::Panel::Tag;
-use Vhffs::Panel::Public;
-use Vhffs::Panel::Commons;
-
-my $panel = new Vhffs::Panel::Public();
-
-my $cgi = $panel->{cgi};
-
-
-my $search = Encode::decode_utf8($cgi->param('search'));
-# TODO Handle complicated search patterns
-my ($category, $tag) = split /::/, $search;
-unless(defined $tag) {
- $tag = $category;
- $category = undef;
-}
-
-# current page
-my $page = defined($cgi->param('page')) ? int($cgi->param('page')) : 1;
-
-my ($groups, $count) = Vhffs::Panel::Tag::get_groups($panel->{vhffs}, $category, $tag, $page - 1);
-
-if(scalar(@$groups) == 0) {
- $panel->render('common/error.tt', {
- message => gettext('No group found')
- });
- exit(0);
-}
-
-my $url = $panel->{url};
-$url =~ s!tags/.*!tagsearch.pl!;
-
-my $pager = Vhffs::Panel::Commons::get_pager($page, $count, 10, 5, $url, { search => uri_escape($search)});
-
-my $vars = {
- groups => $groups,
- gs_title => gettext( 'Search results' ),
- gs_pager => $pager
-};
-
-$panel->render('content/groupsearch-results.tt', $vars);
Modified: trunk/vhffs-public/templates/content/all-groups.tt
===================================================================
--- trunk/vhffs-public/templates/content/all-groups.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/content/all-groups.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -3,10 +3,10 @@
[% INCLUDE common/pager.tt pager=pager%]
<div class="pages-tabs">
-[<a href="/allgroups.pl?letter=all" class="ajax">[% 'All' | i18n%]</a>]
+[<a href="?do=allgroups&letter=all" class="ajax">[% 'All' | i18n%]</a>]
[% title_str = '%s (%d groups)' | i18n %]
[% FOREACH l = letters %]
-[<a class="ajax" href="/allgroups.pl?letter=[% l.letter %]" title="[% title_str | pretty_print(l.letter, l.count) %]">[% l.letter %]</a>]
+[<a class="ajax" href="?do=allgroups&letter=[% l.letter %]" title="[% title_str | pretty_print(l.letter, l.count) %]">[% l.letter %]</a>]
[% END %]
</div>
Modified: trunk/vhffs-public/templates/content/group-details.tt
===================================================================
--- trunk/vhffs-public/templates/content/group-details.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/content/group-details.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -3,13 +3,13 @@
<h1 class="groupname">[% group.realname | html | format(title_str) %]</h1>
<h2>[% 'General information' | i18n %]</h2>
[% IF groups_avatar %]
-<img class="group-avatar" src="/avatar.pl?oid=[% group.object_id %]"/>
+<img class="group-avatar" src="?do=avatar&oid=[% group.object_id %]"/>
[% END %]
<ul>
<li>[% 'Groupname' | i18n %]: [% group.groupname | html %]</li>
<li>[% 'Users' | i18n %]:
[% FOREACH u = group.get_users() %]
-<a href="/user.pl?name=[% u.username %]" class="ajax">[% u.username %]</a>[% UNLESS loop.last() %], [% END %]
+<a href="?do=user&name=[% u.username %]" class="ajax">[% u.username %]</a>[% UNLESS loop.last() %], [% END %]
[% END %]
</li>
@@ -22,7 +22,7 @@
[% FOREACH cat = tag_categories %]
<li>[% cat.label %]:
[% FOREACH t = cat.tags %]
- <a class="ajax" href="/tags/[% cat.label | uri %]::[% t.label | uri %]">[% t.label %]</a>[% ',' UNLESS loop.last %]
+ <a class="ajax" href="?do=tags&search=[% cat.label | uri %]::[% t.label | uri %]">[% t.label %]</a>[% ',' UNLESS loop.last %]
[% END %]
</li>
[% END %]
Modified: trunk/vhffs-public/templates/content/groupsearch-form.tt
===================================================================
--- trunk/vhffs-public/templates/content/groupsearch-form.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/content/groupsearch-form.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,5 +1,5 @@
<h1>[% 'Project search' | i18n%]</h1>
-<form action="groupsearch.pl" method="post" id="AdvancedSearchGroupForm">
+<form action="?do=groupsearch" method="post" id="AdvancedSearchGroupForm">
<h2>[% 'Tags' | i18n %]</h2>
<p>[% 'Matches' | i18n %]:
<span id="searchTagInclude">
Modified: trunk/vhffs-public/templates/content/usersearch-form.tt
===================================================================
--- trunk/vhffs-public/templates/content/usersearch-form.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/content/usersearch-form.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,5 +1,5 @@
<h1>[% 'User search' | i18n%]</h1>
-<form action="usersearch.pl" method="post" id="SearchUserForm">
+<form action="?do=usersearch" method="post" id="SearchUserForm">
<p><label class="own-line" for="username">[% 'Username' | i18n %]:</label>
<input type="text" maxlength="50" id="username" name="username"/></p>
<p class="submit"><input type="submit" value="[% 'OK' | i18n %]" name="searchSubmit" id="SearchUserFormSubmit"/></p>
Modified: trunk/vhffs-public/templates/parts/group-general.tt
===================================================================
--- trunk/vhffs-public/templates/parts/group-general.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/parts/group-general.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,16 +1,16 @@
<h2 class="groupname">[% g.realname | html%]</h2>
<div class="group-info">
[% IF groups_avatar %]
-<img class="group-avatar" src="/avatar.pl?oid=[% g.object_id %]" alt="[% g.groupname %]"/>
+<img class="group-avatar" src="?do=avatar&oid=[% g.object_id %]" alt="[% g.groupname %]"/>
[% END %]
-<p><a href="/group.pl?name=[% g.groupname %]" class="groupname ajax">[% g.groupname %]</a> (<span class="owner">[% g.owner_name %]</span>)</p>
+<p><a href="?do=group&name=[% g.groupname %]" class="groupname ajax">[% g.groupname %]</a> (<span class="owner">[% g.owner_name %]</span>)</p>
<div class="description">
[% g.description | html | html_para %]
</div>
<div class="tags">
[% FOREACH t = g.tags %]
- <a href="/tags/[% t.category_label | uri %]::[% t.tag_label | uri %]" class="ajax">[% t.category_label | html %]::[% t.tag_label | html %]</a>[% ', ' UNLESS loop.last() %]
+ <a href="?do=tags&search=[% t.category_label | uri %]::[% t.tag_label | uri %]" class="ajax">[% t.category_label | html %]::[% t.tag_label | html %]</a>[% ', ' UNLESS loop.last() %]
[% END %]
</div>
-<p class="more-group"><a href="/group.pl?name=[% g.groupname %]" class="ajax">[% 'More info...' | i18n %]</a></p>
+<p class="more-group"><a href="?do=group&name=[% g.groupname %]" class="ajax">[% 'More info...' | i18n %]</a></p>
</div>
Modified: trunk/vhffs-public/templates/parts/left-menu.tt
===================================================================
--- trunk/vhffs-public/templates/parts/left-menu.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/parts/left-menu.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -2,12 +2,12 @@
<h1>[% 'Public' | i18n %]</h1>
<h2>[% 'Projects' | i18n %]</h2>
<div class="menu">
- <a href="/groupsearch_form.pl" class="ajax">[% 'Search' | i18n %]</a>
- <a href="/" class="ajax">[% 'Last projects' | i18n %]</a>
- <a href="/allgroups.pl" class="ajax">[% 'All' | i18n %]</a>
+ <a href="?do=groupsearch" class="ajax">[% 'Search' | i18n %]</a>
+ <a href="?do=lastgroups" class="ajax">[% 'Last projects' | i18n %]</a>
+ <a href="?do=allgroups" class="ajax">[% 'All' | i18n %]</a>
</div>
<h2>[% 'Users' | i18n %]</h2>
<div class="menu">
- <a href="/usersearch_form.pl" class="ajax">[% 'Search' | i18n %]</a>
- <a href="/lastusers.pl" class="ajax">[% 'Last users' | i18n %]</a>
+ <a href="?do=usersearch" class="ajax">[% 'Search' | i18n %]</a>
+ <a href="?do=lastusers" class="ajax">[% 'Last users' | i18n %]</a>
</div>
Modified: trunk/vhffs-public/templates/parts/tags-cloud.tt
===================================================================
--- trunk/vhffs-public/templates/parts/tags-cloud.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/parts/tags-cloud.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -2,22 +2,22 @@
<div class="menu tags-menu">
<p>
[% FOREACH t = popular_tags %]
- <a href="/tags/[% t.category_label | uri %]::[% t.tag_label | uri %]" class="tag[%t.weight%] ajax">
+ <a href="?do=tags&search=[% t.category_label | uri %]::[% t.tag_label | uri %]" class="tag[%t.weight%] ajax">
[<span title="[% t.category_description | html %]">[% t.category_label | html %]</span>::<span title="[% t.tag_description | html %]">[% t.tag_label | html %]</span>]
</a>
[% END %]
</p>
- <p class="more-tags"><a href="/groupsearch_form.pl" class="ajax">[% 'More...' | i18n%]</a></p>
+ <p class="more-tags"><a href="?do=groupsearch" class="ajax">[% 'More...' | i18n%]</a></p>
</div>
<h1>[% 'Random tags' | i18n %]</h1>
<div class="menu tags-menu">
<p>
[% FOREACH t = random_tags %]
- <a href="/tags/[% t.category_label | uri %]::[% t.tag_label %]" class="tag[%t.weight%] ajax">
+ <a href="?do=tags&search=[% t.category_label | uri %]::[% t.tag_label %]" class="tag[%t.weight%] ajax">
[<span title="[% t.category_description | html %]">[% t.category_label | html %]</span>::<span title="[% t.tag_description | html %]">[% t.tag_label | html %]</span>]
</a>
[% END %]
</p>
- <p class="more-tags"><a href="/groupsearch_form.pl" class="ajax">[% 'More...' | i18n%]</a></p>
+ <p class="more-tags"><a href="?do=groupsearch" class="ajax">[% 'More...' | i18n%]</a></p>
</div>
Modified: trunk/vhffs-public/templates/parts/user-general.tt
===================================================================
--- trunk/vhffs-public/templates/parts/user-general.tt 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/templates/parts/user-general.tt 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,14 +1,14 @@
<h2 class="username">[% u.username | html%]</h2>
<div class="user-info">
[% IF users_avatar %]
-<img class="user-avatar" src="/avatar.pl?oid=[% u.object_id %]"/>
+<img class="user-avatar" src="?do=avatar&oid=[% u.object_id %]"/>
[% END %]
<ul>
<li>[% 'First name' | i18n %]: [% u.firstname | html %]</li>
<li>[% 'Last name' | i18n %]: [% u.lastname | html %]</li>
<li>[% 'Groups' | i18n %]:
[% FOREACH ug = u.groups %]
-<a href="/group.pl?name=[% ug | html %]" class="ajax">[% ug | html %]</a>[% ', ' UNLESS loop.last() %]
+<a href="?do=group&name=[% ug | html %]" class="ajax">[% ug | html %]</a>[% ', ' UNLESS loop.last() %]
[% END %]
</li>
</ul>
Deleted: trunk/vhffs-public/user.pl
===================================================================
--- trunk/vhffs-public/user.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/user.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,76 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Panel::Public;
-
-my $panel = new Vhffs::Panel::Public();
-my $cgi = $panel->{cgi};
-my $vhffs = $panel->{vhffs};
-my $config = $vhffs->get_config();
-
-my $username = $cgi->param('name');
-
-unless(defined $username) {
- $panel->render('common/error.tt', {
- message => gettext('CGI Error')
- });
- exit(0);
-}
-
-my $user = Vhffs::User::get_by_username($panel->{vhffs}, $username);
-
-unless(defined $user) {
- $panel->render('common/error.tt', {
- message => gettext('User not found')
- });
- exit(0);
-}
-
-my @groups;
-foreach my $grouphash (@{$user->get_groups}) {
- push @groups, $grouphash->{groupname};
-}
-$user->{groups} = \@groups;
-
-my $vars = {
- user => $user,
-};
-
-$panel->render('content/user-details.tt', $vars);
Deleted: trunk/vhffs-public/usersearch.pl
===================================================================
--- trunk/vhffs-public/usersearch.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/usersearch.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,71 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-
-use Vhffs::Panel::Public;
-use Vhffs::Panel::User;
-
-my $panel = new Vhffs::Panel::Public();
-my $cgi = $panel->{cgi};
-
-my $username = Encode::decode_utf8($cgi->param('username'));
-my $page = defined($cgi->param('page')) ? int($cgi->param('page')) : 1;
-
-if($username =~ /^\s*$/) {
- $panel->render('common/error.tt', {
- message => gettext('You have to enter an username')
- });
- exit(0);
-}
-
-my ($users, $total) = Vhffs::Panel::User::public_search($panel->{vhffs}, $username, ($page - 1));
-
-if($total == 0) {
- $panel->render('common/error.tt', {
- message => gettext('No user found')
- });
- exit(0);
-}
-
-my $pager = Vhffs::Panel::Commons::get_pager($page, $total, 10, 5, $panel->{url}, { username => $username });
-
-$panel->render('content/usersearch-results.tt', {
- users => $users,
- u_pager => $pager
-});
Deleted: trunk/vhffs-public/usersearch_form.pl
===================================================================
--- trunk/vhffs-public/usersearch_form.pl 2012-01-23 21:01:52 UTC (rev 1928)
+++ trunk/vhffs-public/usersearch_form.pl 2012-01-23 23:53:49 UTC (rev 1929)
@@ -1,45 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use POSIX qw(locale_h);
-use locale;
-use Locale::gettext;
-
-use lib '%VHFFS_LIB_DIR%';
-
-use Vhffs::Panel::Public;
-
-my $panel = new Vhffs::Panel::Public();
-
-$panel->render('content/usersearch-form.tt');