*** blosxom-xmlrpc.cgi.orig Thu Mar 10 13:27:52 2005 --- blosxom-xmlrpc.cgi Wed Jul 05 10:52:05 2006 *************** *** 99,106 **** --- 99,108 ---- use strict; use File::Find; use File::stat; + use File::Copy; use POSIX qw(strftime); use XMLRPC::Transport::HTTP; + use HTML::Entities; use CGI::Carp qw(fatalsToBrowser); use CGI; *************** *** 213,220 **** my $path_info = $ENV{'PATH_INFO'} || ''; ! if ( $path_info =~ /rpc2/i ) { ! XMLRPC::Transport::HTTP::CGI->dispatch_to( 'metaWeblog', 'blogger' ) ->handle; } elsif ( $path_info =~ /atom/i ) { # Do ATOM stuff here --- 214,222 ---- my $path_info = $ENV{'PATH_INFO'} || ''; ! BXR::debug( 2, "request", $path_info ); ! if ( $path_info =~ /RPC2/i ) { ! XMLRPC::Transport::HTTP::CGI->dispatch_to( 'metaWeblog', 'blogger', 'mt' ) ->handle; } elsif ( $path_info =~ /atom/i ) { # Do ATOM stuff here *************** *** 331,339 **** sub SetHtmlBegin { # set var with following html/css code (note: \n and extra white space will be included, don't use tabs!). # needs $PageTile, $Meta (optional) on entry, Printed as html header, mainly a color malleable style sheet. ! $_[0] = qq( ! $PageTitle $Meta --- 333,341 ---- sub SetHtmlBegin { # set var with following html/css code (note: \n and extra white space will be included, don't use tabs!). # needs $PageTile, $Meta (optional) on entry, Printed as html header, mainly a color malleable style sheet. ! $_[0] = qq( ! $PageTitle $Meta *************** *** 407,413 **** sub Error { # report fatal errors from Render (or other) and exit. ! print qq(Content-Type: text/html; charset=ISO-8859-1) if (shift); #print cgi header $PageTitle = 'Fatal Error'; $BlogText = qq($_[0] $_[1]); --- 409,415 ---- sub Error { # report fatal errors from Render (or other) and exit. ! print qq(Content-Type: text/html; charset=utf-8) if (shift); #print cgi header $PageTitle = 'Fatal Error'; $BlogText = qq($_[0] $_[1]); *************** *** 506,512 **** ? $cookie{'password'} = $c->param('password') : 0; unless ( BXR::auth( $cookie{'username'}, $cookie{'password'} ) ) { ! print $c->header(); $PageTitle = "Please Enter Password"; unless ( RenderExternalFlavour($BXR::weblogin) ) { SetHtmlVars(); --- 508,514 ---- ? $cookie{'password'} = $c->param('password') : 0; unless ( BXR::auth( $cookie{'username'}, $cookie{'password'} ) ) { ! print $c->header(-charset=>'utf-8'); $PageTitle = "Please Enter Password"; unless ( RenderExternalFlavour($BXR::weblogin) ) { SetHtmlVars(); *************** *** 528,534 **** -value => \%cookie, -expires => $expire ); ! print $c->header( -cookie => $cookie ); return 1; } } --- 530,536 ---- -value => \%cookie, -expires => $expire ); ! print $c->header( -cookie => $cookie, -charset => 'utf-8' ); return 1; } } *************** *** 1205,1212 **** unless ( -e $filename ) { open POST, ">$filename" or die "Can't Open File $filename: $!"; ! print POST "$struct->{'title'}\n"; ! print POST "$struct->{'description'}\n"; close POST; my $files = chmod $BXR::file_permission, $filename; } --- 1207,1214 ---- unless ( -e $filename ) { open POST, ">$filename" or die "Can't Open File $filename: $!"; ! print POST HTML::Entities::decode_entities($struct->{'title'})."\n"; ! print POST HTML::Entities::decode_entities($struct->{'description'})."\n"; close POST; my $files = chmod $BXR::file_permission, $filename; } *************** *** 1349,1354 **** --- 1351,1357 ---- return \@retList; } + sub getCategoryList { return getCategories(@_) } sub getCategories { BXR::debug( 1, "metaWeblog.getCategories", @_ ); shift if UNIVERSAL::isa( $_[0] => __PACKAGE__ ); *************** *** 1570,1575 **** --- 1573,1618 ---- my $filename = BXR::getFilenameFromPostId($postid); my $rc = blosxom::deletePost($filename); + } + + package mt; + sub getPostCategories { + BXR::debug( 1, "mt.getPostCategories", @_ ); + } + sub setPostCategories { + BXR::debug( 1, "mt.setPostCategories", @_ ); + shift if UNIVERSAL::isa( $_[0] => __PACKAGE__ ); + my $postid = shift; + my $username = shift; + my $password = shift; + my $catetory = shift; + my $filename = BXR::getFilenameFromPostId($postid); + my $movepath = BXR::getFilenameFromPostId(@$catetory[0]->{categoryId}); + File::Copy::move $filename, $movepath or die $!; + } + sub publishPost { + BXR::debug( 1, "mt.publishPost", @_ ); + } + sub getCategoryList { + BXR::debug( 1, "mt.getCategoryList", @_ ); + shift if UNIVERSAL::isa( $_[0] => __PACKAGE__ ); + my $blogid = shift; + my $username = shift; + my $password = shift; + + BXR::auth( $username, $password ); + + my $cats = blosxom::getCategories(); + my @return; + foreach ( keys %{$cats} ) { + $_ = BXR::getCategoryFromFilename($_); + push @return, { + categoryName => $_, + categoryId => $_ + }; + } + @return = sort {$a->{categoryName} cmp $b->{categoryName}} @return; + return \@return; } =head1 NAME