yolanda/trunk/settings.pl
josch 6c172e1057 enabled xhtml comments
git-svn-id: http://yolanda.mister-muffin.de/svn@321 7eef14d0-6ed0-489d-bf55-20463b2d70db
2008-04-27 10:39:21 +00:00

48 lines
1.3 KiB
Perl

require "functions.pl";
#initialize session data
CGI::Session->name($config->{"page_cookie_name"});
$query = new CGI;
$session = new CGI::Session;
my @userinfo = get_userinfo_from_sid($session->id);
my $doc = XML::LibXML::Document->new( "1.0", "UTF-8" );
my $page = get_page_array(@userinfo);
if($userinfo->{'username'})
{
if($query->param('submit'))
{
$dbh->do(qq{update users set pagesize = ? where id = ?}, undef, $query->param('pagesize'), $userinfo->{'id'} ) or die $dbh->errstr;
@userinfo = get_userinfo_from_sid($session->id);
$page = get_page_array(@userinfo);
my $message = XML::LibXML::Element->new( "message" );
$message->setAttribute("type", "information");
$message->setAttribute("text", "information_settings_changed");
$page->appendChild($message);
}
}
if($userinfo->{'username'})
{
my $settings = XML::LibXML::Element->new( "settings" );
$settings->setAttribute("pagesize", $userinfo->{'pagesize'});
$page->appendChild($settings);
}
else
{
my $message = XML::LibXML::Element->new( "message" );
$message->setAttribute("type", "error");
$message->setAttribute("text", "error_202c");
$page->appendChild($message);
}
$doc->setDocumentElement($page);
output_page($doc);