Tadashi Okoshi
slash****@users*****
2006年 8月 9日 (水) 14:12:16 JST
Index: affelio/lib/Affelio/App/Standalone/Admin.pm
diff -u affelio/lib/Affelio/App/Standalone/Admin.pm:1.3 affelio/lib/Affelio/App/Standalone/Admin.pm:1.4
--- affelio/lib/Affelio/App/Standalone/Admin.pm:1.3 Fri Jun 9 17:34:04 2006
+++ affelio/lib/Affelio/App/Standalone/Admin.pm Wed Aug 9 14:12:16 2006
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: Admin.pm,v 1.3 2006/06/09 08:34:04 slash5234 Exp $
+# $Id: Admin.pm,v 1.4 2006/08/09 05:12:16 slash5234 Exp $
package Affelio::App::Standalone::Admin;
{
@@ -124,7 +124,7 @@
$output_data{site__tmpl_path} =
$af->{site__tmpl_web_path} . "/owner_side/";
$output_data{site__locale} = $af->{site__locale};
- $output_data{site__web_root} = $af->{site__user_afid};
+ $output_data{site__web_root} = $af->{site__web_root};
$output_data{site__user_afid} = $af->{site__user_afid};
###################
##Owner profile
@@ -185,7 +185,9 @@
print "Pragma: no-cache", "\n\n";
print $af->translate_templateL10N($tmpl->output);
}
-
+
+ $af->DESTROY;
+ return();
}
######################################################################
@@ -219,6 +221,7 @@
$tmpl->param("forward_URL" => $cgi->self_url);
print $af->translate_templateL10N($tmpl->output);
+ $af->DESTROY;
exit(1);
}
Index: affelio/lib/Affelio/App/Standalone/AdminAjax.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/AdminAjax.pm:1.1
--- /dev/null Wed Aug 9 14:12:16 2006
+++ affelio/lib/Affelio/App/Standalone/AdminAjax.pm Wed Aug 9 14:12:16 2006
@@ -0,0 +1,199 @@
+# Copyright (C) 2005 FishGrove Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: AdminAjax.pm,v 1.1 2006/08/09 05:12:16 slash5234 Exp $
+
+package Affelio::App::Standalone::AdminAjax;
+{
+ use strict;
+ use lib("../../../../extlib/");
+ use CGI qw(-unique_headers);
+ use CGI::Session; #qw(-ip_match);
+ use Error qw(:try);
+ use Fcntl;
+
+ use lib("../../../../lib/");
+ use Affelio;
+ use Affelio::misc::CGIError;
+ use Affelio::misc::Debug qw( debug_print);
+ use Affelio::misc::Time;
+ use Affelio::misc::NetMisc;
+ use Affelio::misc::WebInput;
+ use Affelio::Managing::NewsAggregator;
+ use Affelio::exception::CommunicationException;
+ use Affelio::exception::SystemException;
+
+ use Affelio::App::Standalone::AdminAjax::GetNews;
+ ######################################################################
+ #Constructor
+ ######################################################################
+ sub new{
+ my $class = shift;
+ my %param = @_;
+
+ debug_print("Standalone::AdminAjax::new: start.");
+
+ my $cfg_dir = $param{ConfigDir};
+ my $cgi = new CGI;
+ my $wi = new Affelio::misc::WebInput();
+ my $af;
+
+ ###########################
+ #Load Affelio
+ ###########################
+ try{
+ $af = new Affelio(ConfigDir => $cfg_dir,
+ CGI => $cgi);
+ }catch Error with{
+ my $e = shift;
+ error($cgi, "Affelio load error.\n" . $e);
+ };
+ debug_print("Standalone::Admin::new: AF loaded.");
+
+ my $self = {cfg_dir => $cfg_dir,
+ cgi => $cgi,
+ af => $af,
+ wi => $wi};
+ bless $self, $class;
+
+ debug_print("Standalone::AdminAjax::new: end.");
+ return $self;
+ }
+
+ ######################################################################
+ #run
+ ######################################################################
+ sub run{
+
+ my $self = shift;
+ my $af = $self->{af};
+ my $cgi = $self->{cgi};
+ my $cfg_path = $self->{cfg_path};
+ my $wi = $self->{wi};
+
+ my %handlers = ("get_news", "GetNews");
+
+ ###########################
+ #Check session
+ ###########################
+ check_session($self,$cgi);
+
+ ###########################
+ #Going to the owner mode
+ ###########################
+ $af->set_owner_mode();
+
+ ##############################################################
+ #prep vars
+ ##############################################################
+ my %output_data;
+ ###################
+ ##Site
+ $output_data{site__skin_path} =
+ $af->{site__web_root} . "/skins/" . $af->{userpref__skin};
+ $output_data{site__tmpl_path} =
+ $af->{site__tmpl_web_path} . "/owner_side/";
+ $output_data{site__locale} = $af->{site__locale};
+ $output_data{site__web_root} = $af->{site__web_root};
+ $output_data{site__user_afid} = $af->{site__user_afid};
+ ###################
+ ##Owner profile
+ $output_data{my_nickname} = $af->{user__nickname};
+ ###################
+ ##For compatibility...
+ $output_data{site__skin_dir} =
+ $af->{site__web_root} . "/skins/" . $af->{userpref__skin};
+ $output_data{style_path} =
+ $af->{site__web_root} . "/skins/" . $af->{userpref__skin};
+ $output_data{tmpl_path} = $af->{site__tmpl_web_path} . "/owner_side/";
+
+ $af->get_module_list(\%output_data, $af->{site__user_afid},"self");
+ $af->get_guest_owner_list(\%output_data);
+
+ use Affelio::App::Standalone::Admin::Messaging;
+ $output_data{new_messages}
+ =Affelio::App::Standalone::Admin::Messaging::get_new($af);
+
+
+ ##############################################################
+ #Model invocation
+ ##############################################################
+ my $admin_mode = $wi->PTN_mode($cgi->url_param("mode"));
+ if ($admin_mode eq "") {$admin_mode="get_news";}
+ debug_print("Standalone::AdminAjax::run: mode=$admin_mode");
+
+ my $classname = "Affelio::App::Standalone::AdminAjax::" . $handlers{$admin_mode};
+ debug_print("Standalone::AdminAjax::run: handler= $classname");
+ eval "use $classname";
+ if($@){
+ throw Affelio::exception::SystemException("Could not load handler [$admin_mode] [$@]");
+ }
+ debug_print("Standalone::AdminAjax::run: handler function loaded.");
+
+ my $ret="";
+ try{
+ debug_print("Standalone::AdminAjax::run: handler function..... ");
+ handler($cgi, $af, \%output_data);
+ debug_print("Standalone::AdminAjax::run: handler function done.");
+ }catch Error with{
+ my $e = shift;
+ $output_data{"err_msg"} .= $e->stacktrace;
+ };
+
+ ##############################################################
+ #Output View
+ ##############################################################
+ debug_print("***** $output_data{tmpl_file}");
+
+ print "Content-type: text/html; charset=UTF-8\n";
+ print "Pragma: no-cache", "\n\n";
+ print $output_data{"NeighborNews"};
+
+ $af->DESTROY;
+ return();
+ }
+
+ ######################################################################
+ #Check session w/ cookie
+ ######################################################################
+ sub check_session{
+ my $self = shift;
+ my $cgi = shift;
+ my $af = $self->{af};
+
+ my $session = $af->getSM->get_session();
+
+ if( (!$session) || ($session->param("type") ne "self") ){
+ # Is the session alive?
+ # Is the user the admin of this site?
+ # if not....
+ debug_print("Standalone::Admin::check_session: login is needed.");
+
+ print "Content-type: text/html; charset=UTF-8\n";
+ print "Pragma: no-cache", "\n\n";
+
+ print "You haven't been authenticated.";
+ $af->DESTROY;
+ return();
+ }
+
+ debug_print("Standalone::Admin::check_session: Session as the admin is OK.");
+ }
+
+}
+1;
+
+
Index: affelio/lib/Affelio/App/Standalone/FriendRoutines.pm
diff -u affelio/lib/Affelio/App/Standalone/FriendRoutines.pm:1.3 affelio/lib/Affelio/App/Standalone/FriendRoutines.pm:1.4
--- affelio/lib/Affelio/App/Standalone/FriendRoutines.pm:1.3 Thu Jun 29 03:12:48 2006
+++ affelio/lib/Affelio/App/Standalone/FriendRoutines.pm Wed Aug 9 14:12:16 2006
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: FriendRoutines.pm,v 1.3 2006/06/28 18:12:48 slash5234 Exp $
+# $Id: FriendRoutines.pm,v 1.4 2006/08/09 05:12:16 slash5234 Exp $
package Affelio::App::Standalone::FriendRoutines;
{
@@ -140,11 +140,11 @@
sub get_friends_list{
my $af = shift; #arg(1) AF
my $visitor_id = shift; #arg(2) visitor_ID
- my $visitor_type = shift; #arg(3) visitor_ID
+ my $visitor_type = shift; #arg(3) visitor type
my $max_friend_num = shift; #arg(4) max num
my $sort = shift; #arg(5) sort
my $mode = shift; #arg(6) mode
- my $type = shift; #arg(6) type
+ my $type = shift; #arg(7) type
my @ret_list;
if ($visitor_id eq ""){