[vhffs-dev] [1112] Fixed encoding in RSS, fixed last users SQL query.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1112
Author:   gradator
Date:     2007-12-13 22:55:04 +0000 (Thu, 13 Dec 2007)

Log Message:
-----------
Fixed encoding in RSS, fixed last users SQL query.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/User.pm
    trunk/vhffs-public/rss/lastgroups.pl
    trunk/vhffs-public/rss/lastusers.pl


Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm	2007-12-13 21:14:10 UTC (rev 1111)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm	2007-12-13 22:55:04 UTC (rev 1112)
@@ -88,8 +88,8 @@
 
 	return if ( !defined $main );
 
-	my $sql = 'SELECT uid, username, firstname, lastname FROM vhffs_users ORDER BY date_creation DESC LIMIT 10';
-    return fetch_users_and_groups($main, $sql);
+	my $sql = 'SELECT u.uid, u.username, u.firstname, u.lastname FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id=u.object_id WHERE o.state=? ORDER BY o.date_creation DESC LIMIT 10';
+    return fetch_users_and_groups($main, $sql, Vhffs::Constants::ACTIVATED);
 }
 
 sub search {

Modified: trunk/vhffs-public/rss/lastgroups.pl
===================================================================
--- trunk/vhffs-public/rss/lastgroups.pl	2007-12-13 21:14:10 UTC (rev 1111)
+++ trunk/vhffs-public/rss/lastgroups.pl	2007-12-13 22:55:04 UTC (rev 1112)
@@ -41,7 +41,7 @@
 my $vhffs = init Vhffs::Main;
 
 my $url;
-$url = "" unless defined ( $url = $vhffs->get_config->get_panel->{'url_public'} );
+$url = '' unless defined ( $url = $vhffs->get_config->get_panel->{'url_public'} );
 
 
 if( $vhffs->get_config->get_panel->{'rss_groups'} eq 'yes' && $vhffs->get_config->get_panel->{'use_public'} eq 'yes' ) {
@@ -53,26 +53,26 @@
 	if( defined  $vhffs->get_config->get_host_name ) {
 		$title = 'Last groups on '.$vhffs->get_config->get_host_name;
 	} else {
-		$title = "VHFFS last groups";
+		$title = 'VHFFS last groups';
 	}
 
 	$rss->channel(
 	  title        => $title,
 	  link         => "$url/lastgroups.pl",
-	  description  => "Best hosting platform",
+	  description  => 'Best hosting platform',
 	  dc => {
 	    date       => '2000-08-23T07:00+00:00',
         subject    => 'Last groups on '.$vhffs->get_config->get_host_name,
-	    subject    => "danstoncul",
+	    subject    => 'danstoncul',
 	    creator    => 'vhffs@xxxxxxxxx',
 	    publisher  => 'vhffs@xxxxxxxxx',
 	    rights     => 'Copyright 2004, Vhffs Dream Team',
-	    language   => 'fr-FR',
+	    language   => 'en_US',
 	  },
 	  syn => {
-	    updatePeriod     => "hourly",
-	    updateFrequency  => "1",
-	    updateBase       => "1901-01-01T00:00+00:00",
+	    updatePeriod     => 'hourly',
+	    updateFrequency  => '1',
+	    updateBase       => '1901-01-01T00:00+00:00',
 	  },
 	  taxo => [
 	    'http://dmoz.org/Computers/Internet',
@@ -80,24 +80,29 @@
 	  ]
 	);
 	
-    foreach(@{$groups}) {
+	foreach(@{$groups}) {
 		$rss->add_item(
-	   		title       => $_->{realname},
-		    link        => $url.'/group.pl?name='.$_->{groupname},
-	   		description => "Vhffs Group",
-		);
-	
+			title       => $_->{realname},
+			link        => $url.'/group.pl?name='.$_->{groupname},
+			description => 'Vhffs Group',
+		);	
 	}
+
 	$rss->{output} = '2.0';
+
+	binmode STDOUT , ':utf8';
 	print "Content-Type: text/xml; charset=utf-8\n\n" . $rss->as_string;
+
 } else {
         use POSIX qw(locale_h);
         use locale;
         use Locale::gettext;
         use HTML::Template;
         my $templatedir = $vhffs->get_config->get_templatedir;
-        my $template = new HTML::Template( filename => $templatedir."/public/simplemsg.tmpl" );
-        my $message = gettext( "RSS infos are not published");
+        my $template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
+        my $message = gettext( 'RSS infos are not published' );
         $template->param( MESSAGE => $message );
+
+	binmode STDOUT , ':utf8';
         print "Content-Type: text/html; charset=utf-8\n\n" . $template->output;
 }

Modified: trunk/vhffs-public/rss/lastusers.pl
===================================================================
--- trunk/vhffs-public/rss/lastusers.pl	2007-12-13 21:14:10 UTC (rev 1111)
+++ trunk/vhffs-public/rss/lastusers.pl	2007-12-13 22:55:04 UTC (rev 1112)
@@ -41,7 +41,7 @@
 
 my $vhffs = init Vhffs::Main;
 my $url;
-$url = "" unless defined ( $url = $vhffs->get_config->get_panel->{'url_public'} );
+$url = '' unless defined ( $url = $vhffs->get_config->get_panel->{'url_public'} );
 
 if( $vhffs->get_config->get_panel->{'rss_users'} eq 'yes' && $vhffs->get_config->get_panel->{'use_public'} eq 'yes' )
 {
@@ -50,26 +50,26 @@
     if( defined  $vhffs->get_config->get_host_name ) {
         $title = 'Last users on '.$vhffs->get_config->get_host_name;
     } else {
-        $title = "VHFFS last users";
+        $title = 'VHFFS last users';
     }
 
 
 	$rss->channel(
 	  title        => $title,
 	  link         => "$url/lastusers.pl",
-	  description  => "Best hosting platform",
+	  description  => 'Best hosting platform',
 	  dc => {
 	    date       => '2000-08-23T07:00+00:00',
-	    subject    => "danstoncul",
+	    subject    => 'danstoncul',
 	    creator    => 'vhffs@xxxxxxxxx',
 	    publisher  => 'vhffs@xxxxxxxxx',
 	    rights     => 'Copyright 2004, Vhffs Dream Team',
-	    language   => 'fr-FR',
+	    language   => 'en_US',
 	  },
 	  syn => {
-	    updatePeriod     => "hourly",
-	    updateFrequency  => "1",
-	    updateBase       => "1901-01-01T00:00+00:00",
+	    updatePeriod     => 'hourly',
+	    updateFrequency  => '1',
+	    updateBase       => '1901-01-01T00:00+00:00',
 	  },
 	  taxo => [
 	    'http://dmoz.org/Computers/Internet',
@@ -87,17 +87,21 @@
         );
     }
 	$rss->{output} = '2.0';
+
+	binmode STDOUT , ':utf8';
 	print "Content-Type: text/xml; charset=utf-8\n\n" . $rss->as_string;
 }
 else
 {
-		use POSIX qw(locale_h);
-		use locale;
-		use Locale::gettext;
-		use HTML::Template;
-		my $templatedir = $vhffs->get_config->get_templatedir;
-        my $template = new HTML::Template( filename => $templatedir."/public/simplemsg.tmpl" );
-        my $message = gettext( "RSS infos are not published");
+	use POSIX qw(locale_h);
+	use locale;
+	use Locale::gettext;
+	use HTML::Template;
+	my $templatedir = $vhffs->get_config->get_templatedir;
+        my $template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
+        my $message = gettext( 'RSS infos are not published' );
         $template->param( MESSAGE => $message );
-		print "Content-Type: text/html; charset=utf-8\n\n" . $template->output;
+
+	binmode STDOUT , ':utf8';
+	print "Content-Type: text/html; charset=utf-8\n\n" . $template->output;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/