[Affelio-cvs 1127] CVS update: affelio/bin

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 3月 7日 (火) 23:39:08 JST


Index: affelio/bin/get_content.cgi
diff -u affelio/bin/get_content.cgi:1.33 affelio/bin/get_content.cgi:1.34
--- affelio/bin/get_content.cgi:1.33	Thu Feb 23 21:41:36 2006
+++ affelio/bin/get_content.cgi	Tue Mar  7 23:39:08 2006
@@ -15,261 +15,27 @@
 # 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: get_content.cgi,v 1.33 2006/02/23 12:41:36 slash5234 Exp $
-
+#
+# $Id: get_content.cgi,v 1.34 2006/03/07 14:39:08 slash5234 Exp $
 use strict;
-
-$| = 1;
-
-use lib("../extlib");
-use CGI qw(-unique_headers);
-use CGI::Session; #qw(-ip_match);
-use Error qw(:try);
-
 use lib("../lib");
-use Affelio;
-use Affelio::App::Env;
-use Affelio::App::FriendRoutines qw(get_summed_permission_list);
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug qw(debug_print);
-use Affelio::misc::MyCrypt qw(url_decode msg_decrypt);
-use Affelio::misc::Time qw(get_timestamp);
-use Affelio::misc::NetMisc qw(get_remote_host);
-use Affelio::misc::WebInput;
-
-#Load Affelio and CGI
-my $q = new CGI;
-my $cfg_dir = "../config/";
-my $af = new Affelio(ConfigDir => $cfg_dir,
-		     CGI => $q);
-my $wi = new Affelio::misc::WebInput(); 
-
-#Retrieve args
-my $module = $wi->PTN_word($q->param("module"));
-if($module eq "" || !defined($module)){
-    error($q,"Input parameters are not defined.(module)");
-}
-
-my $content = $wi->PTN_getcontent_content($q->param("content"));
-if($content eq "" || !defined($content)){
-    error($q,"Input parameters are not defined.(content)");
-}
-
-my $ck_visitor_type=0;
-my $ck_visitor_type_str="pb"; 
-my $ck_visitor_afid = "";
-
-############################################################################
-#Load session from cookie
-############################################################################
-my $session = $af->getSM()->get_session();
-
-if(!$session){
-    debug_print("get_content: session not found.");
-    $ck_visitor_type=0;
-    $ck_visitor_type_str="pb"; 
-    $ck_visitor_afid = "";
-}else{
-    my $type = $session->param("type");
-
-    if($type eq "self"){
-	debug_print("get_content: session found. [self]");
-	$ck_visitor_type=3; 
-	$ck_visitor_type_str="self"; 
-	$ck_visitor_afid = $session->param("user_afid");
-    }elsif($type eq "f1"){
-	debug_print("get_content: session found. [f1]");
-	$ck_visitor_type=2; 
-	$ck_visitor_type_str="f1"; 
-	$ck_visitor_afid = $session->param("user_afid");
-    }elsif($type eq "f2"){
-	debug_print("get_content: session found. [f2]");
-	$ck_visitor_type=1; 
-	$ck_visitor_type_str="f2"; 
-	$ck_visitor_afid = $session->param("user_afid");
-    }
-}
-
-
-#CFID check
-my $CFID_timestamp;
-my $CFID_expire;
-my $CFID_remotehost;
-my $CFID_visitor_afid;
-my $CFID_visitor_type=0;
-my $CFID_visitor_type_str="pb";
-
-if( ($ck_visitor_type <= 2) 
-    && ( $q->param("referrer") ne "")
-    && ( $q->param("cfid") ne "" )       
-    ){
-
-    my $referrer = $wi->PTN_URL($q->param("referrer"));
-    if($referrer =~ /(.*)\/$/){
-	$referrer = $1;
-    }
-
-    my $passAB = $af->getFM->get_attribute_by_afid($referrer, "password");
-    if($passAB eq "" || !defined($passAB)){
-	error($q,"Parameters are not defined. (1): Your peer does not have shared password with you...");
-    }
-
-    my $cfid = msg_decrypt( url_decode($q->param("cfid") ) , $passAB) ;
-    if($cfid eq "" || !defined($cfid)){
-	error($q,"Parameters are not defined. (2): Invalid encryption: After decryption, we could not valid your encrypted message...");
-    }
-
-    #######################################################################
-    #Check cfid
-    ($CFID_timestamp, $CFID_expire, $CFID_remotehost, $CFID_visitor_afid, $CFID_visitor_type_str) = split('\*', $cfid);
-
-    #check timestamp
-    #check expire
-    #check remotehost
-    #check visitor_afid
-    debug_print("get_content: Information extracted from CFID");
-    debug_print("get_content: \ttimestamp    =$CFID_timestamp\n");
-    debug_print("get_content: \texpire       =$CFID_expire\n");
-    debug_print("get_content: \tremote_host  =$CFID_remotehost\n");
-    debug_print("get_content: \tvisitor_afid =$CFID_visitor_afid\n");
-    debug_print("get_content: \tvisitor_type(original) =$CFID_visitor_type_str\n");
-
-    #check visitor_type_str
-    if($CFID_visitor_type_str eq "self") { 
-	$CFID_visitor_type_str = "f1";
-	$CFID_visitor_type =2;
-    }elsif($CFID_visitor_type_str eq "f1") { 
-	$CFID_visitor_type_str = "f2";
-	$CFID_visitor_type =1;
-    }else{
-	$CFID_visitor_type_str = "pb";
-	$CFID_visitor_type =0;
-    }
-    debug_print("get_content: \tvisitor_type(decreased) =$CFID_visitor_type_str\n");
-
-}
-
-
-############################################################################
-#Well, after all, who is it?
-############################################################################
-my $visitor_type=0;              #3=self 2=f1 1=f2 0=pb
-my $visitor_type_str="pb";
-my $visitor_afid="";
-
-if($ck_visitor_type == 3){
-
-    $visitor_type = $ck_visitor_type;
-    $visitor_type_str = $ck_visitor_type_str;
-    $visitor_afid = $ck_visitor_afid;
-
-}elsif($ck_visitor_type > $CFID_visitor_type){
-
-    $visitor_type = $ck_visitor_type;
-    $visitor_type_str = $ck_visitor_type_str;
-    $visitor_afid = $ck_visitor_afid;
+use lib("../extlib");
 
+my $exec_type = "";
+if ($ENV{'REDIRECT_AF_EXEC_TYPE'}) {
+    $exec_type = $ENV{'REDIRECT_AF_EXEC_TYPE'};
+    eval{
+        use lib("$ENV{'FARM_FS_TOP'}/$ENV{'REDIRECT_AF_EXEC_TYPE'}Farm/lib/");
+    };
 }else{
-
-    $visitor_type = $CFID_visitor_type;
-    $visitor_type_str = $CFID_visitor_type_str;
-    $visitor_afid = $CFID_visitor_afid;
+    $exec_type = "Standalone";
 }
 
-#######################################
-#Is this visitor a friend of this site?
-
-if($visitor_type < 3){
-    my $tmp1 = $af->getFM->get_attribute_by_afid($visitor_afid, "password");
-
-    if($tmp1 ne ""){
-	$visitor_type = 2;  
-	$visitor_type_str="f1"; 
-	$visitor_afid = $CFID_visitor_afid;
-    }
-}
-
-debug_print("get_content: Finally...");
-debug_print("get_content: \tvisitor_type = [$visitor_type] [$visitor_type_str]");
-debug_print("get_content: \tvisitor_type = [$visitor_afid]");
-debug_print("get_content: \tmodule    = [$module]\n");
-debug_print("get_content: \tcontent   = [$content]\n");
-
-
-############################################################################
-#Output content
-############################################################################
-if($module eq "core"){
 
-    if($content =~ /^\/profile\/profile\_face([0-9a-zA-Z\_]*)\.jpg$/){
+my $env_cls = "Affelio::App::" . $exec_type . "::Env";
+my $pub_cls = "Affelio::App::" . $exec_type . "::Public";
+eval "use $env_cls;";
+eval "use $pub_cls;";
 
-	debug_print("get_content: image!");
-
-	#Get summarized permission list for the given user
-	my @list 
-	    =  get_summed_permission_list($af, 
-					  $visitor_afid, 
-					  $visitor_type_str);
-
-	debug_print("get_content: Got summarized permission...");
-	debug_print("get_content: \t[@list]");
-
-	my $permission = $list[5] ;
-	debug_print("get_content: Pic perm: $permission");
-
-	my $real_filename = $content;
-	$real_filename =~ s|/profile/||;
-
-	my $actual_file="";
-	if( $permission ==1)
-	{
-	    $actual_file = "$af->{site__user_dir}/$real_filename";
-	}else{
-	    $actual_file = "$af->{site__fs_root}/skins/$af->{userpref__skin}/0_face.jpg";
-	}
-	open(IMG, "< $actual_file");
-	print "Content-type: image/jpeg\n";
-	print "Pragma: no-cache\n\n"; 
-	binmode (IMG);
-	binmode (STDOUT);
-	print <IMG>;
-	close IMG;
-    }
-
-    if($content eq "/profile/mystatus"){
-
-	debug_print("get_content: mystatus!");
-	my $mystatus="&nbsp;";
-	if( $visitor_type >= 2){
-	    $mystatus = $af->{user__currentstatus};
-	}
-	print "Content-type:application/x-javascript\n\n";
-	print "document.write(\"$mystatus\");";
-	print "\n\n";
-	exit(1);
-    }
-
-    if($content eq "/profile/mystatus_iframe"){
-
-	debug_print("get_content: mystatus!");
-	my $mystatus="&nbsp;";
-	if( $visitor_type >= 2){
-	    $mystatus = $af->{user__currentstatus};
-	}
-	print "Content-type: text/html; charset=UTF-8\n";
-	print "Pragma: no-cache\n\n"; 
-
-	# " ni kiwo tsukero!!!! escape! escape! " --> \"
-        print "<HTML><body TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0><div style=\"margin:0px; padding:0px; font-family:sans-serif; font-size:xx-small;\">$mystatus</div></body></HTML>";
-	debug_print("get_content: mystatus!");
-	exit(1);
-    }
-
-    print "Content-type: text/html; charset=UTF-8\n";
-    print "Pragma: no-cache\n\n"; 
-    print "<HTML></HTML>";
-    exit(1);
-
-}
-exit(1);
+my $pub = new $pub_cls;
+$pub->run(App=> "Bin::get_content");
Index: affelio/bin/loginexec.cgi
diff -u affelio/bin/loginexec.cgi:1.17 affelio/bin/loginexec.cgi:1.18
--- affelio/bin/loginexec.cgi:1.17	Thu Feb 23 21:41:36 2006
+++ affelio/bin/loginexec.cgi	Tue Mar  7 23:39:08 2006
@@ -16,319 +16,26 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: loginexec.cgi,v 1.17 2006/02/23 12:41:36 slash5234 Exp $
-
+# $Id: loginexec.cgi,v 1.18 2006/03/07 14:39:08 slash5234 Exp $
 use strict;
-
-use lib("../extlib");
-use CGI qw(-unique_headers);
-use CGI::Session;
-use HTML::Template;
-use Error qw(:try);
-
 use lib("../lib");
-use Affelio;
-use Affelio::App::Env;
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug;
-use Affelio::misc::Time;
-use Affelio::misc::NetMisc;
-use Affelio::misc::MyCrypt;
-use Affelio::misc::WebInput;
-use Affelio::SNS::Handshaker_c;
-
-my $q = new CGI;
-
-debug_print("loginexec.cgi: **start.");
-
-############################################################################
-#Load Affelio
-############################################################################
-my $cfg_dir = "../config/";
-my $af;
-try{
-    $af = new Affelio(ConfigDir => $cfg_dir,
-		      CGI => $q);
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio load error.\n" . $e);
-};
-my $wi = new Affelio::misc::WebInput;
-
-############################################################################
-#Prep (1) input args
-############################################################################
-#mode
-my $mode = $wi->PTN_mode($q->url_param("mode"));
-
-#username or affelio_url
-my $affelio_url = $wi->PTN_through($q->param("affelio_url"));
-my $username = $wi->PTN_word($q->param("username"));
-
-#password
-my $password = $wi->PTN_through($q->param("password"));
-
-#forward_URL
-#  After authentication, browser must be forwarded to $forward_URL
-#  Usually, $forward_URL is the user's AFLink person's page.
-my $forward_URL = $wi->PTN_URL($q->url_param("forward_URL"));
-#aftergo_URL
-#  After browser is forwarded to $forward_URL (after auth.), 
-#  $aftergo_URL is one more further URL that the browser needs 
-#  to be fowarded to.
-my $aftergo_URL = $wi->PTN_URL($q->url_param("aftergo_URL"));
-
-#type from FORM
-my $submit_type = $wi->PTN_mode($q->param("submittype"));
-
-############################################################################
-#Prep (2) misc
-############################################################################
-#farm_users_root
-#  This Affelio's 1-step parent URL.
-#  e.g.  this Affelio    : http://my.affelio.jp/user/foo
-#  e.g.  farm_users_root : http://my.affelio.jp/user/
-my $farm_users_root = $af->{site__user_afid};
-$farm_users_root =~ s|/$||;
-$farm_users_root =~ s|/([A-Za-z0-9\-\_]+)$|/|;
-
-#output data
-my $issued_cookie="";
-my $next_url;
-
-debug_print("\t\tmode       = $mode");
-debug_print("\t\taffelio_url= $affelio_url");
-debug_print("\t\tusername   = $username");
-debug_print("\t\tpassword   = $password");
-debug_print("\t\tforward    = $forward_URL");
-debug_print("\t\taftergo    = $aftergo_URL");
-debug_print("\t\tfarm_users_root   = $farm_users_root");    
-
-############################################################################
-#Already logined?
-############################################################################
-if($af->getSM->get_userclass() eq "self"){
-    #Yes, the user is already logged in as the owner.
-
-}else{
-    #No, this user has to be authenticated.
-
-    if($mode eq ""){
-	###################################################################
-	#Protocol V1
-	###################################################################
-	if(  (verify_password($password, $af->{site__password}) > 0) 
-	     && ($username eq $af->{site__username}) ){
-	    debug_print("loginexec.cgi: AUTH OK.\n");
-	    #login OK
-	}else{
-	    #login failed.
-	    debug_print("loginexec.cgi: AUTH NG.\n");
-	    
-	    my $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/loginfailed.tmpl";
-	    my $tmpl = new HTML::Template( filename => $TMPL_FILE);
-	    $tmpl->param("forward_URL" => $af->{site__user_afid});
-	    $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
-	    print "Content-type: text/html; charset=UTF-8\n\n";
-	    print $af->translate_templateL10N($tmpl->output);
-	    
-	    debug_print("loginexec.cgi: exit(1).\n");    
-	    exit(1);
-	}    
-    
-    }elsif($mode eq "s0"){
-	####################################################################
-	#Phase V2: Phase S0
-	####################################################################
-	if($affelio_url eq $af->{site__username}){
-	    ##################################
-	    #input URL = site owner's nickname
-	    ##################################
-	    show_checkpassword_screen(mode => "login_as_owner");
-	    exit(1);
-
-	}else{
-	    ##################################
-	    #Else
-	    ##################################
-	    $affelio_url =~ /^([A-Za-z0-9\-\_]*)$/;
-	    if ($1 eq $affelio_url){
-		$affelio_url = $farm_users_root . $affelio_url;
-	    }
-
-	    if($affelio_url !~ /^(http:\/\/)/){
-		$affelio_url = "http://" . $affelio_url;
-	    }
-	    if($affelio_url =~ /(.*)\/$/){
-		$affelio_url = $1;
-	    }
-	    debug_print("loginexec.cgi($mode): formated Affelio URL= [$affelio_url]");
-
-	    if($affelio_url eq $af->{site__user_afid}){
-		show_checkpassword_screen(mode => "login_as_owner");
-		exit(1);
-	    }
-
-	    ##################################
-	    #Determine aftergo_URL
-	    ##################################
-	    #aftergo_URL is a URL to which the user will be forwarded after auth.
-	    if($aftergo_URL eq ""){
-		$aftergo_URL= $ENV{HTTP_REFERER};
-	    }
-
-	    ##################################
-	    #Determine forward_URL
-	    ##################################
-	    if($forward_URL eq ""){
-		$forward_URL= $af->{site__user_afid};
-	    }
-	    
-	    ##################################
-	    #Go to "s1" phase...
-	    ##################################
-	    my $next_URL
-		= "$affelio_url/bin/loginexec.cgi?mode=s1&forward_URL=$forward_URL&aftergo_URL=$aftergo_URL";
-	    debug_print("\t\tnext_URL= $next_URL");
-	    debug_print("loginexec.cgi($mode): end.");
-	    print $q->redirect( -url => $next_URL);
-	    exit(1);
-	}
-
-    }elsif($mode eq "s1"){
-	####################################################################
-	#Phase V2: Phase S1
-	# (password input phase)
-	####################################################################
-	show_checkpassword_screen(mode => "back_from_friend");
-	debug_print("loginexec.cgi($mode): end.");
-	exit(1);
-	
-    }elsif($mode eq "s2"){ 
-	####################################################################
-	#Phase V2: Phase S2
-	# (auth check phase)
-	####################################################################
-	debug_print("loginexec.cgi($mode): submit_type= $submit_type");
-	if($submit_type eq "Cancel"){
-	    if($aftergo_URL eq ""){
-		print $q->redirect( -url => $af->{site__user_afid});
-		exit;
-	    }else{
-		print $q->redirect( -url => $aftergo_URL);
-		exit;
-	    } 
-
-	}
-
-	if(  (verify_password($password, $af->{site__password}) > 0) ){
-	    debug_print("loginexec.cgi: AUTH Ok.\n");
-	}else{
-	    #login failed.
-	    debug_print("loginexec.cgi: AUTH NG.\n");
-
-	    my $loginfailed=
-		$af->translate_templateL10N('<AF_M text="Login failed.">');
-
-	    if($affelio_url eq $af->{site__username}){
-		sleep(3);
-		show_checkpassword_screen(mode => "login_as_owner",
-					  error => $loginfailed);
-	    }else{
-		sleep(3);
-		show_checkpassword_screen(mode => "back_from_friend",
-					  error => $loginfailed);
-	    }
-	    
-	    debug_print("loginexec.cgi: exit(1).\n");    
-	    exit(1);
-	}    
-    }
-    
-    #######################################################################
-    #Startup new session
-    #######################################################################
-    $af->getSM->startup_session(user_afid => $af->{site__user_afid},
-				user_nickname => $af->{user__nickname},
-				type => "self");
-    $af->getSM->get_session->expire("+3d");
-    $af->getSM->get_session->flush();
-
-    debug_print("loginexec.cgi: startup_session finished.\n");    
-
-    #Prepare a cookie with the session_id
-    $issued_cookie = $af->getSM->issue_cookie();
-}
-
-############################################################################
-#Check if forward_URL is my friend
-############################################################################
-if($forward_URL ne ""){
-    if($forward_URL =~ /(.*)\/$/){
-	$forward_URL = $1;
-    }
-    debug_print("loginexec.cgi: ForwardURL= $forward_URL");
+use lib("../extlib");
 
-    my $passAB="";
-    try{
-	$passAB = $af->getFM->get_attribute_by_afid($forward_URL, "password");
-    }catch Error with{
-	my $e = shift;
-	error($q, "Error from FriendManager.\n" . $e);
+my $exec_type = "";
+if ($ENV{'REDIRECT_AF_EXEC_TYPE'}) {
+    $exec_type = $ENV{'REDIRECT_AF_EXEC_TYPE'};
+    eval{
+        use lib("$ENV{'FARM_FS_TOP'}/$ENV{'REDIRECT_AF_EXEC_TYPE'}Farm/lib/");
     };
-
-    if($passAB eq ""){
-	show_askmakefriend_screen();
-	exit;
-    }else{
-	$next_url= "$af->{site__user_afid}/outgoing.cgi?dest_url=$forward_URL&dest_url2=$aftergo_URL"; 
-    }
-}else{
-    $next_url= "$af->{site__user_afid}/admin.cgi";
-}
-
-if($issued_cookie){
-    print $q->redirect( -url => $next_url, -cookie => $issued_cookie);
 }else{
-    print $q->redirect( -url => $next_url);
+    $exec_type = "Standalone";
 }
 
-exit(1);
-
-
 
-############################################################################
-# sub show_askmakefriend_screen
-############################################################################
-sub show_askmakefriend_screen{
-    my $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/ask_makefriend.tmpl";
-    my $tmpl = new HTML::Template( filename => $TMPL_FILE,
-				   die_on_bad_params => 0);
-    $tmpl->param("owner_nickname" => $af->{user__nickname});
-    $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
-    $tmpl->param("admin_path" => "$af->{site__user_afid}/admin.cgi?mode=makefriend&dest_url=$forward_URL");
-    $tmpl->param("dest_affelio_URL" => $forward_URL);
+my $env_cls = "Affelio::App::" . $exec_type . "::Env";
+my $pub_cls = "Affelio::App::" . $exec_type . "::Public";
+eval "use $env_cls;";
+eval "use $pub_cls;";
 
-    print "Content-type: text/html; charset=UTF-8\n\n";
-    print $af->translate_templateL10N($tmpl->output);
-}
-
-############################################################################
-# sub show_checkpassword_screen
-############################################################################
-sub show_checkpassword_screen{
-    my %args = @_;
-
-    my $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/login_s1.tmpl";
-    my $tmpl = new HTML::Template( filename => $TMPL_FILE,
-				   die_on_bad_params => 0);
-    $tmpl->param("owner_nickname" => $af->{user__nickname});
-    $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
-    $tmpl->param("cgi_path" => "$af->{site__user_afid}/bin/loginexec.cgi?mode=s2&forward_URL=$forward_URL&aftergo_URL=$aftergo_URL");
-    $tmpl->param($args{mode} => "true");
-    $tmpl->param(error => $args{error});
-
-    print "Content-type: text/html; charset=UTF-8\n\n";
-    print $af->translate_templateL10N($tmpl->output);
-}
-############################################################################
+my $pub = new $pub_cls;
+$pub->run(App=> "Bin::loginexec");
Index: affelio/bin/logoutexec.cgi
diff -u affelio/bin/logoutexec.cgi:1.8 affelio/bin/logoutexec.cgi:1.9
--- affelio/bin/logoutexec.cgi:1.8	Thu Feb 23 21:41:36 2006
+++ affelio/bin/logoutexec.cgi	Tue Mar  7 23:39:08 2006
@@ -16,60 +16,26 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: logoutexec.cgi,v 1.8 2006/02/23 12:41:36 slash5234 Exp $
-
+# $Id: logoutexec.cgi,v 1.9 2006/03/07 14:39:08 slash5234 Exp $
 use strict;
-
-use lib("../extlib");
-use CGI qw(-unique_headers);
-use CGI::Session; #qw(-ip_match);
-use HTML::Template;
-use Error qw(:try);
-
 use lib("../lib");
-use Affelio;
-use Affelio::App::Env;
-use Affelio::SNS::Handshaker_c;
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug;
-use Affelio::misc::NetMisc;
-use Affelio::misc::MyCrypt;
-use Affelio::misc::Time;
-
-debug_print("logoutexec.cgi: start.");
-
-my $q = new CGI;
-############################################################################
-#Load Affelio
-############################################################################
-my $cfg_dir = "../config/";
-my $af;
-try{
-    $af = new Affelio(ConfigDir => $cfg_dir,
-		      CGI => $q);
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio load error.\n" . $e);
-};
-my $wi = new Affelio::misc::WebInput;
-
-############################################################################
-#Check session w/ cookie
-############################################################################
-my $sid = $q->cookie("affelio-$af->{user__nickname}");
-my $session = $af->getSM->get_session();
-
-if($session){
-    #Output expired cookie and redirect the user to index.
-    $session->delete();
-    $session->flush();
-    undef($session);
+use lib("../extlib");
 
-    #Output expired cookie and redirect the user to index.
+my $exec_type = "";
+if ($ENV{'REDIRECT_AF_EXEC_TYPE'}) {
+    $exec_type = $ENV{'REDIRECT_AF_EXEC_TYPE'};
+    eval{
+        use lib("$ENV{'FARM_FS_TOP'}/$ENV{'REDIRECT_AF_EXEC_TYPE'}Farm/lib/");
+    };
+}else{
+    $exec_type = "Standalone";
 }
 
-print $q->redirect( -url => $af->{site__user_afid});
 
-debug_print("logoutexec.cgi: end.");
-exit(1);
+my $env_cls = "Affelio::App::" . $exec_type . "::Env";
+my $pub_cls = "Affelio::App::" . $exec_type . "::Public";
+eval "use $env_cls;";
+eval "use $pub_cls;";
 
+my $pub = new $pub_cls;
+$pub->run(App=> "Bin::logoutexec");
Index: affelio/bin/recv_mail_ack.cgi
diff -u affelio/bin/recv_mail_ack.cgi:1.13 affelio/bin/recv_mail_ack.cgi:1.14
--- affelio/bin/recv_mail_ack.cgi:1.13	Thu Feb 23 21:41:36 2006
+++ affelio/bin/recv_mail_ack.cgi	Tue Mar  7 23:39:08 2006
@@ -16,13 +16,26 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: recv_mail_ack.cgi,v 1.13 2006/02/23 12:41:36 slash5234 Exp $
+# $Id: recv_mail_ack.cgi,v 1.14 2006/03/07 14:39:08 slash5234 Exp $
 use strict;
 use lib("../lib");
 use lib("../extlib");
-use Affelio::App::Env;
 
-use Affelio::App::Public;
-my $public = new Affelio::App::Public();
-$public->run(App=> "Bin::recv_mail_ack");
+my $exec_type = "";
+if ($ENV{'REDIRECT_AF_EXEC_TYPE'}) {
+    $exec_type = $ENV{'REDIRECT_AF_EXEC_TYPE'};
+    eval{
+        use lib("$ENV{'FARM_FS_TOP'}/$ENV{'REDIRECT_AF_EXEC_TYPE'}Farm/lib/");
+    };
+}else{
+    $exec_type = "Standalone";
+}
 
+
+my $env_cls = "Affelio::App::" . $exec_type . "::Env";
+my $pub_cls = "Affelio::App::" . $exec_type . "::Public";
+eval "use $env_cls;";
+eval "use $pub_cls;";
+
+my $pub = new $pub_cls;
+$pub->run(App=> "Bin::recv_mail_ack");
Index: affelio/bin/xml-rpc-serv.cgi
diff -u affelio/bin/xml-rpc-serv.cgi:1.3 affelio/bin/xml-rpc-serv.cgi:1.4
--- affelio/bin/xml-rpc-serv.cgi:1.3	Thu Feb 23 21:41:36 2006
+++ affelio/bin/xml-rpc-serv.cgi	Tue Mar  7 23:39:08 2006
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
- 
+
 # Copyright (C) 2005 FishGrove Inc.
 #
 # This program is free software; you can redistribute it and/or
@@ -15,43 +15,27 @@
 # 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: xml-rpc-serv.cgi,v 1.3 2006/02/23 12:41:36 slash5234 Exp $
-
+#
+# $Id: xml-rpc-serv.cgi,v 1.4 2006/03/07 14:39:08 slash5234 Exp $
 use strict;
-use lib("lib");
-use lib("extlib");
 use lib("../lib");
 use lib("../extlib");
 
-my($AF_DIR);
-
-BEGIN {
-    $AF_DIR='../';
-    unshift @INC, $AF_DIR . 'lib/';
-    unshift @INC, $AF_DIR . 'extlib/';
+my $exec_type = "";
+if ($ENV{'REDIRECT_AF_EXEC_TYPE'}) {
+    $exec_type = $ENV{'REDIRECT_AF_EXEC_TYPE'};
+    eval{
+        use lib("$ENV{'FARM_FS_TOP'}/$ENV{'REDIRECT_AF_EXEC_TYPE'}Farm/lib/");
+    };
+}else{
+    $exec_type = "Standalone";
 }
-my $script_dir = $ENV{'SCRIPT_NAME'};
-$script_dir =~ s|^(.*)/([A-Za-z0-9\_\-\.]+)$|$1/|;
-#Affelio's lib dir
-#eval "use lib($script_dir/lib);";
-#Affelio's extlib dir
-#eval "use lib(\"$script_dir/extlib\");";
 
-use Affelio::App::Env;
-
-use XMLRPC::Transport::HTTP;
-use Affelio::SNS::Handshaker_s;
-
-$Affelio::SNS::Handshaker_s::AF_DIR = $AF_DIR;
-
-########################################################################
-{
-    local $SIG{__WARN__} = sub { };
-    my $server = XMLRPC::Transport::HTTP::CGI->new;
-    $server->dispatch_to('affelio');
-    $server->handle;
-}
 
-########################################################################
+my $env_cls = "Affelio::App::" . $exec_type . "::Env";
+my $pub_cls = "Affelio::App::" . $exec_type . "::Public";
+eval "use $env_cls;";
+eval "use $pub_cls;";
 
+my $pub = new $pub_cls;
+$pub->run(App=> "Bin::xml_rpc_serv");


Affelio-cvs メーリングリストの案内
Back to archive index