Tadashi Okoshi
slash****@users*****
2006年 2月 23日 (木) 21:41:37 JST
Index: affelio/lib/Affelio/App/Admin.pm
diff -u affelio/lib/Affelio/App/Admin.pm:1.6 affelio/lib/Affelio/App/Admin.pm:1.7
--- affelio/lib/Affelio/App/Admin.pm:1.6 Sat Jan 28 17:47:21 2006
+++ affelio/lib/Affelio/App/Admin.pm Thu Feb 23 21:41:37 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.6 2006/01/28 08:47:21 slash5234 Exp $
+# $Id: Admin.pm,v 1.7 2006/02/23 12:41:37 slash5234 Exp $
package Affelio::App::Admin;
{
@@ -54,7 +54,8 @@
###########################
#Load Affelio
###########################
- $af = new Affelio(ConfigDir => $cfg_dir);
+ $af = new Affelio(ConfigDir => $cfg_dir,
+ CGI => $cgi);
debug_print("Admin::new: AF loaded.");
my $self = {cfg_dir => $cfg_dir,
@@ -71,55 +72,10 @@
}
######################################################################
- #Check session w/ cookie
- ######################################################################
- sub check_session{
- my $self = shift;
- my $cgi = shift;
- my $af = $self->{af};
-
- my $TMPL_FILE="";
-
- my $sid = $cgi->cookie("affelio-$af->{user__nickname}");
- debug_print("Admin::check_session: sid from cookie = $sid");
- my $session="";
- if($sid){
- $session = new CGI::Session(undef,
- $sid,
- {Directory=> $af->{site__session_dir}});
- debug_print("admin:cgi Existing session: [" . $session->id . "]");
- }
-
- if( (!$session) || ($session->param("type") ne "self") ){
- # Is the session alive?
- # Is the user the admin of this site?
- # if not....
- debug_print("Admin::check_session: login is needed.");
-
- print "Content-type: text/html; charset=UTF-8\n";
- print "Pragma: no-cache", "\n\n";
- print get_HTML_header($self);
-
- $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/login.tmpl";
- my $tmpl = new HTML::Template(filename => $TMPL_FILE,
- die_on_bad_params => 0);
- $tmpl->param(reason_msg => "You haven't been authenticated.");
- $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}/owner_side/");
- $tmpl->param("style_path" => $af->{site__web_root} . "/skins/" . $af->{userpref__skin});
- $tmpl->param("forward_URL" => $cgi->self_url);
-
- print $af->translate_templateL10N($tmpl->output);
- print get_HTML_footer($self);
- exit(1);
- }
-
- debug_print("Admin::check_session: Session as the admin is OK.");
- }
-
- ######################################################################
#run
######################################################################
sub run{
+
my $self = shift;
my $af = $self->{af};
my $cgi = $self->{cgi};
@@ -162,7 +118,7 @@
##############################################################
my %output_data = ("tmpl_path", "$af->{site__web_root}/templates/$af->{site__template}/owner_side/",
"style_path", $af->{site__web_root} . "/skins/" . $af->{userpref__skin},
- "site_web_root", "$af->{site__web_root}",
+ "site_web_root", "$af->{site__user_afid}",
"my_nickname", $af->{user__nickname},
"site__locale", $af->{site__locale});
@@ -170,6 +126,7 @@
$output_data{new_messages}
=Affelio::App::Admin::Messaging::get_new($af);
+
##############################################################
#Model invocation
##############################################################
@@ -216,6 +173,44 @@
}
######################################################################
+ #Check session w/ cookie
+ ######################################################################
+ sub check_session{
+ my $self = shift;
+ my $cgi = shift;
+ my $af = $self->{af};
+
+ my $TMPL_FILE="";
+
+ 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("Admin::check_session: login is needed.");
+
+ print "Content-type: text/html; charset=UTF-8\n";
+ print "Pragma: no-cache", "\n\n";
+ print get_HTML_header($self);
+
+ $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/login.tmpl";
+ my $tmpl = new HTML::Template(filename => $TMPL_FILE,
+ die_on_bad_params => 0);
+ $tmpl->param(reason_msg => "You haven't been authenticated.");
+ $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}/owner_side/");
+ $tmpl->param("style_path" => $af->{site__web_root} . "/skins/" . $af->{userpref__skin});
+ $tmpl->param("forward_URL" => $cgi->self_url);
+
+ print $af->translate_templateL10N($tmpl->output);
+ print get_HTML_footer($self);
+ exit(1);
+ }
+
+ debug_print("Admin::check_session: Session as the admin is OK.");
+ }
+
+ ######################################################################
#Get_HTML_header
######################################################################
sub get_HTML_header{
@@ -224,7 +219,7 @@
my $app__page_title = shift;
#Set template file name
- my $TMPL_FILE = "$af->{site__fs_root}/templates_dyn/_header.tmpl";
+ my $TMPL_FILE = "$af->{site__tmpldyn_dir}/_header.tmpl";
#Set data for template
my %output_data = ();
$output_data{'app__css_path'} = $af->{site__web_root}."/templates/default/owner_side";
@@ -233,7 +228,7 @@
$output_data{'site__web_root'} = $af->{site__web_root};
$output_data{'site__locale'} = $af->{site__locale};
- $af->get_module_list(\%output_data, $af->{site__web_root},"self");
+ $af->get_module_list(\%output_data, $af->{site__user_afid},"self");
$af->get_guest_owner_list(\%output_data);
#Initiate Template
@@ -255,7 +250,7 @@
my $self = shift;
my $af = $self->{af};
#Set template file name
- my $TMPL_FILE = "$af->{site__fs_root}/templates_dyn/_footer.tmpl";
+ my $TMPL_FILE = "$af->{site__tmpldyn_dir}/_footer.tmpl";
my $tmpl = new HTML::Template(filename => $TMPL_FILE,
die_on_bad_params => 0);
my $final_out = "</div><!--afPubMain-->"
Index: affelio/lib/Affelio/App/Env.pm
diff -u /dev/null affelio/lib/Affelio/App/Env.pm:1.1
--- /dev/null Thu Feb 23 21:41:37 2006
+++ affelio/lib/Affelio/App/Env.pm Thu Feb 23 21:41:37 2006
@@ -0,0 +1,20 @@
+package Affelio::App::Env;
+{
+ use strict;
+ use Exporter;
+ use lib("../../../extlib/");
+ use lib("../../../lib/");
+ @Affelio::App::Env::ISA = "Exporter";
+ @Affelio::App::Env::EXPORT = qw (boot);
+
+ sub BEGIN{
+ if($ENV{'FARM_MODE'} eq "AFE2"){
+ #FARM's lib dir
+ eval "use lib(\"$ENV{'FARM_FS_TOP'}/lib/\");";
+ }
+
+ use Error qw(:try);
+ use Affelio::misc::CGIError;
+ }
+}
+1;
Index: affelio/lib/Affelio/App/FriendRoutines.pm
diff -u affelio/lib/Affelio/App/FriendRoutines.pm:1.10 affelio/lib/Affelio/App/FriendRoutines.pm:1.11
--- affelio/lib/Affelio/App/FriendRoutines.pm:1.10 Mon Dec 26 01:50:28 2005
+++ affelio/lib/Affelio/App/FriendRoutines.pm Thu Feb 23 21:41:37 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.10 2005/12/25 16:50:28 slash5234 Exp $
+# $Id: FriendRoutines.pm,v 1.11 2006/02/23 12:41:37 slash5234 Exp $
package Affelio::App::FriendRoutines;
{
@@ -239,15 +239,15 @@
debug_print("FriendRoutines: mystatus_URL= $mystatus_URL\n");
#Generate Hyperlink target URL
- my $dest_URL = $af->{site__web_root} . "/outgoing.cgi?dest_url=" . $person[1];
+ my $dest_URL = $af->{site__user_afid} . "/outgoing.cgi?dest_url=" . $person[1];
my $editurl="";
if($visitor_type eq "self"){
- $editurl = $af->{site__web_root} . "/admin.cgi?mode=manage_friends&mode2=show_member&uid=" . $person[0];
+ $editurl = $af->{site__user_afid} . "/admin.cgi?mode=manage_friends&mode2=show_member&uid=" . $person[0];
}
my $mailurl="";
if($visitor_type eq "self"){
- $mailurl = $af->{site__web_root} . "/admin.cgi?mode=messages&action=compose&reply_to=" . $person[1];
+ $mailurl = $af->{site__user_afid} . "/admin.cgi?mode=messages&action=compose&reply_to=" . $person[1];
}
push(@ret_list, {nickname => $person[2],
@@ -314,7 +314,7 @@
my $getcontentURL = $f_af_id
. "/bin/get_content.cgi?module=$module&content=$content&cfid="
. url_encode( msg_encrypt($plaintext, $f_password))
- . "&referrer=" . $af->{site__web_root};
+ . "&referrer=" . $af->{site__user_afid};
return($getcontentURL);
Index: affelio/lib/Affelio/App/Public.pm
diff -u /dev/null affelio/lib/Affelio/App/Public.pm:1.1
--- /dev/null Thu Feb 23 21:41:37 2006
+++ affelio/lib/Affelio/App/Public.pm Thu Feb 23 21:41:37 2006
@@ -0,0 +1,62 @@
+# 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: Public.pm,v 1.1 2006/02/23 12:41:37 slash5234 Exp $
+
+package Affelio::App::Public;
+{
+ use strict;
+ use lib("../../../extlib/");
+ use CGI qw(-unique_headers);
+ use CGI::Session; #qw(-ip_match);
+ use HTML::Template;
+ 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;
+
+ ######################################################################
+ #Constructor
+ ######################################################################
+ sub new{
+ my $class = shift;
+ my %param = @_;
+
+ my $self = {};
+ bless $self, $class;
+ return $self;
+ }
+
+ sub run{
+ my $self = shift;
+ my %param = @_;
+
+ eval("require Affelio::App::Public::$param{App};");
+ eval("Affelio::App::Public::$param{App}::run();");
+ }
+}
+1;
+
+