[vhffs-dev] [1031] Fixed utf-8 support in alert{,_submit}.pl |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1031
Author: gradator
Date: 2007-10-25 22:41:29 +0000 (Thu, 25 Oct 2007)
Log Message:
-----------
Fixed utf-8 support in alert{,_submit}.pl
Modified Paths:
--------------
trunk/vhffs-panel/alert.pl
trunk/vhffs-panel/alert_submit.pl
Modified: trunk/vhffs-panel/alert.pl
===================================================================
--- trunk/vhffs-panel/alert.pl 2007-10-25 21:31:34 UTC (rev 1030)
+++ trunk/vhffs-panel/alert.pl 2007-10-25 22:41:29 UTC (rev 1031)
@@ -29,7 +29,7 @@
# 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 HTML::Template;
@@ -37,16 +37,10 @@
use Locale::gettext;
use CGI;
use CGI::Session;
-use strict;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
use Vhffs::Main;
use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Stats;
-use Vhffs::Constants;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -54,22 +48,15 @@
exit 0 unless $session;
my $vhffs = $panel->{'vhffs'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-#my $group = $panel->{'group'};
-my $projectname = $session->param("project");
my $cgi = $panel->{'cgi'};
-my $servername = $cgi->param("name");
-my $template;
-my $templatedir = $vhffs->get_config->get_templatedir;
+my $templatedir = $panel->{'templatedir'};
-$template = new HTML::Template( filename => $templatedir."/panel/misc/alert.tmpl" );
+my $template = new HTML::Template( filename => $templatedir.'/panel/misc/alert.tmpl' );
-$template->param( TITLE => gettext("Warn the admin team") );
-$template->param( EXPLAIN => gettext("Here, you can report a bug to the admin team") );
+$template->param( TITLE => gettext('Warn the admin team') );
+$template->param( EXPLAIN => gettext('Here, you can report a bug to the admin team') );
+$template->param( YOUR_MESSAGE_TEXT => gettext('Your message') );
+$template->param( SEND => gettext('Send') );
-$template->param( YOUR_MESSAGE_TEXT => gettext("Your message") );
-$template->param( SEND => gettext("Send") );
-
$panel->build( $template );
$panel->display;
Modified: trunk/vhffs-panel/alert_submit.pl
===================================================================
--- trunk/vhffs-panel/alert_submit.pl 2007-10-25 21:31:34 UTC (rev 1030)
+++ trunk/vhffs-panel/alert_submit.pl 2007-10-25 22:41:29 UTC (rev 1031)
@@ -29,7 +29,7 @@
# 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 HTML::Template;
@@ -37,16 +37,13 @@
use Locale::gettext;
use CGI;
use CGI::Session;
-use strict;
+use Encode;
use lib '%VHFFS_LIB_DIR%';
use Vhffs::User;
-use Vhffs::Group;
use Vhffs::Main;
use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Stats;
-use Vhffs::Constants;
+use Vhffs::Functions;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -54,35 +51,25 @@
exit 0 unless $session;
my $vhffs = $panel->{'vhffs'};
-my $maintemplate = $panel->{'template'};
my $user = $panel->{'user'};
-#my $group = $panel->{'group'};
-my $projectname = $session->param("project");
my $cgi = $panel->{'cgi'};
-my $servername = $cgi->param("name");
-my $template;
-my $templatedir = $vhffs->get_config->get_templatedir;
+my $templatedir = $panel->{'templatedir'};
+my $template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
-$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-
-
-if( defined $cgi->param("MESSAGE") )
+if( defined $cgi->param('MESSAGE') )
{
my $to = $vhffs->get_config->get_alert_mail;
my $from = $user->get_mail;
- my $subject = gettext("Alert on Vhffs platform");
- my $message = gettext("Message sent by the following account") .": ". $user->get_username ."\n".$cgi->param("MESSAGE");
+ my $subject = gettext('Alert on Vhffs platform');
+ my $message = gettext('Message sent by the following account').': '.$user->get_username."\n".Encode::decode_utf8( $cgi->param('MESSAGE') );
- use Vhffs::Functions;
-
Vhffs::Functions::send_mail( $from , $to , undef , $subject , $message );
-
- $template->param( MESSAGE => gettext("Message sent successfully") );
+ $template->param( MESSAGE => gettext('Message sent successfully') );
}
else
{
- $template->param( MESSAGE => gettext("Cannot send message, CGI error...") );
+ $template->param( MESSAGE => gettext('Cannot send message, CGI error...') );
}
$panel->build( $template );