[Affelio-cvs 1070] CVS update: affelio

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 2月 23日 (木) 21:41:36 JST


Index: affelio/CHANGES
diff -u affelio/CHANGES:1.28 affelio/CHANGES:1.29
--- affelio/CHANGES:1.28	Tue Nov  8 16:01:44 2005
+++ affelio/CHANGES	Thu Feb 23 21:41:36 2006
@@ -1,3 +1,23 @@
+2006-0222
+	Debug
+		In a message of "Arrived AFLink request", requester's
+		AffelioURL is surrounded by () without any space 
+		characters. That made IE to misunderstand the URL
+		as if the URL contained ")" characters at the end.
+	
+
+2006-0220
+	Debug
+		media="screen" has been removed from .css files.
+
+	Structure: "platform" option
+		In affeli.cfg, "platform" attribute can be set in 
+		[site_config] section. We will use here for ActivePerl
+		mode in the future. 
+
+	Structure: "AFE2" mode
+		Several changes are ported back from AFE2 branch.
+
 1.1 (Nov 5, 2005)
 	New Feature: Access Log of selected people
 		Now users can view access log only from friends etc.
Index: affelio/admin.cgi
diff -u affelio/admin.cgi:1.33 affelio/admin.cgi:1.34
--- affelio/admin.cgi:1.33	Sun Dec 18 12:32:51 2005
+++ affelio/admin.cgi	Thu Feb 23 21:41:36 2006
@@ -16,23 +16,12 @@
 # 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.cgi,v 1.33 2005/12/18 03:32:51 slash5234 Exp $
-
+# $Id: admin.cgi,v 1.34 2006/02/23 12:41:36 slash5234 Exp $
 use strict;
-use lib("./extlib");
-use Error qw(:try);
-use lib("./lib");
-use Affelio::App::Admin;
-use Affelio::misc::CGIError;
+use lib("lib");
+use lib("extlib");
+use Affelio::App::Env;
 
-try{
-    my $admin = new Affelio::App::Admin(ConfigDir => "./config/");
-    $admin->run();
-}catch Error with{
-    my $e = shift;
-    print "Content-type: text/html; charset=UTF-8\n";
-    print "Pragma: no-cache", "\n\n";
-    print "<HTML>";
-    print "<HEAD><TITLE>Error</TITLE></HEAD>";
-    print "$e<BR><BR><HR><PRE>" . $e->stacktrace;
-};
+use Affelio::App::Admin;
+my $admin = new Affelio::App::Admin(ConfigDir => "./config/");
+$admin->run();
Index: affelio/incoming.cgi
diff -u affelio/incoming.cgi:1.18 affelio/incoming.cgi:1.19
--- affelio/incoming.cgi:1.18	Sat Jan 28 18:06:00 2006
+++ affelio/incoming.cgi	Thu Feb 23 21:41:36 2006
@@ -16,235 +16,13 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: incoming.cgi,v 1.18 2006/01/28 09:06:00 slash5234 Exp $
-
+# $Id: incoming.cgi,v 1.19 2006/02/23 12:41:36 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=> "Incoming");
 
-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::misc::CGIError;
-use Affelio::misc::Debug      qw(debug_print);
-use Affelio::misc::Time qw(get_timestamp get_expire_stamp);
-use Affelio::misc::MyCrypt qw(msg_decrypt url_decode);
-use Affelio::misc::NetMisc;
-use Affelio::misc::WebInput;
-
-debug_print("incoming.cgi: start.");
-my $q = new CGI;
-
-############################################################################
-#Load Affelio, CGI
-############################################################################
-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(); 
-
-############################################################################
-#Load session
-############################################################################
-my $session = $af->getSM()->get_session();
-
-############################################################################
-#Get args
-############################################################################
-my $forward_id = $q->url_param("forward_id");
-my $referrer = $q->param("referrer");
-debug_print("incoming.cgi: forward_id      =$forward_id");
-
-my $dest_URL = $wi->PTN_URL($q->url_param("dest_url"));
-debug_print("incoming.cgi: dest_URL      =$dest_URL");
-
-############################################################################
-#Load Friend manager and get passAB
-############################################################################
-my $passAB;
-try{
-   $passAB = $af->getFM->get_attribute_by_afid($referrer, "password");
-   
-   $af->getFM->set_attribute_by_afid($referrer, 
-				     "last_incoming",
-				     Affelio::misc::Time::get_timestamp());
-   $af->getFM->incr_attribute_by_afid($referrer, 
-				      "count_incoming");
-
-}catch Error with{
-    my $e = shift;
-    error($q, "Error from FriendManager.\n" . $e);
-};
-debug_print("incoming.cgi: passAB=$passAB\n");
-if(!defined($passAB) || $passAB eq ""){
-    error($q, "Affelio: Invalid forwarding. Shared key not found!");
-}
-
-$referrer,
-
-
-
-############################################################################
-#Decrypt the forward_id message;
-############################################################################
-my ($FID_timestamp, $FID_expire, $FID_remoteip, $FID_visitorAFID, $FID_visitor_nickname, $FID_visitor_type)
-    =split('\*', msg_decrypt( url_decode($forward_id), $passAB ) ); 
-
-$FID_visitorAFID = url_decode($FID_visitorAFID);
-$FID_visitor_nickname = url_decode($FID_visitor_nickname);
-
-debug_print("incoming.cgi: timestamp      =$FID_timestamp");
-debug_print("incoming.cgi: expire         =$FID_expire");
-debug_print("incoming.cgi: remote_ip      =$FID_remoteip");
-debug_print("incoming.cgi: visitor_afid      =$FID_visitorAFID");
-debug_print("incoming.cgi: visitor_nickname  =$FID_visitor_nickname");
-debug_print("incoming.cgi: visitor_type(original)      =$FID_visitor_type");
-
-if((my $i=index($FID_visitor_type, "self"))==0){
-    $FID_visitor_type = "f1";
-}elsif((my $i=index($FID_visitor_type, "f1"))==0){
-    $FID_visitor_type = "f2";
-}else{
-    $FID_visitor_type = "pb";
-}
-debug_print("incoming.cgi: visitor_type(decreased)     =$FID_visitor_type");
-
-
-############################################################################
-#Error detection
-############################################################################
-my $errormsg="";
-if(($FID_timestamp eq "") || ($FID_remoteip eq "") || 
-   ($FID_visitorAFID eq "") || ($FID_expire eq "") ||
-   ($FID_visitor_type eq "") ){
-    $errormsg .= "Forward_Id data is invalid! \n";
-}else{
-    if($FID_remoteip ne $q->remote_addr){
-	$errormsg .= "Your remote IP address does not match! \n";
-    }
-    if($FID_expire < get_timestamp() ){
-	$errormsg .= "This forward_id is too late to start. \n";
-    }
-}
-if($errormsg){
-    #error $errormsg;
-    debug_print("incoming.cgi: ERROR! : $errormsg");
-    debug_print("incoming.cgi: Just go to my Affelio without any cookie."); 
-    if($dest_URL ne ""){
-	print $q->redirect( -url => $dest_URL);
-    }else{
-	print $q->redirect( -url => $af->{site__web_root});
-    }
-}
-
-############################################################################
-#Check current session
-############################################################################
-#If a cookie is set already, check it and reuse it if we can.
-my $ck_visitor_type="pb";
-my $ck_visitor_nickname="anonymous";
-my $ck_visitor_afid="";
-if($session){
-    debug_print("incoming.cgi: Found a pre-existing session!");
-    $ck_visitor_type = $session->param("type");
-    $ck_visitor_nickname = $session->param("user_nickname");
-    $ck_visitor_afid = $session->param("user_afid");
-}
-debug_print("incoming.cgi: cookie visitor_type  = $ck_visitor_type");
-debug_print("incoming.cgi: cookie visitor_nickname  = $ck_visitor_nickname");
-debug_print("incoming.cgi: cookie visitor_afid  = $ck_visitor_afid");
-
-if($session &&
-   ( (($ck_visitor_type eq "self") && ( $FID_visitor_type ne "self") ) 
-
-     || ( ($ck_visitor_type eq "f1") && (( $FID_visitor_type eq "f1") || ( $FID_visitor_type eq "f2") || ( $FID_visitor_type eq "pb") ) )
-
-     || ( ($ck_visitor_type eq "f2") && (( $FID_visitor_type eq "f2") || ( $FID_visitor_type eq "pb")))
-     )
-   ){
-    #########################
-    # OK. 
-    # This visitor is already authenticated as a closer visitor.
-    # Use existing session.
-    #########################
-    debug_print("incoming.cgi: OK. You already have a cookie, and");
-    debug_print("incoming.cgi: the existing session has the same or"); 
-    debug_print("incoming.cgi: higher right!");
-    debug_print("incoming.cgi: end. Forwarding to my homepage.");
-    if($dest_URL ne ""){
-	print $q->redirect( -url => $dest_URL);
-    }else{
-	print $q->redirect( -url => $af->{site__web_root});
-    }
-
-}else{
-    #########################
-    # Startup a new session
-    #########################
-    debug_print("incoming.cgi: You don't have a cookie, or you have");
-    debug_print("incoming.cgi: a cookie with lower rights.");
-    debug_print("incoming.cgi: ");
-    debug_print("incoming.cgi: Let's start up a session with a cooike.");
-
-    #lookup our friend table with FID_visitorAFID
-    my $tmp1;
-    try{
-	$tmp1 = $af->getFM->get_attribute_by_afid($FID_visitorAFID, "password");
-    }catch Error with{
-	my $e = shift;
-	error($q, "Error from FriendManager.\n" . $e);
-    };
-    if($tmp1 ne ""){	$FID_visitor_type="f1";    }
-
-    #Start up a sesion
-    my $ss = new CGI::Session(undef,
-			      undef, 
-			      {Directory=> $af->{site__session_dir}});
-    #Set values into session
-    $ss->param("user_afid", $FID_visitorAFID);
-    $ss->param("user_nickname", $FID_visitor_nickname);
-    $ss->param("type", $FID_visitor_type);
-    #current time
-    #expire time
-    $ss->expire('+1h');
-
-    debug_print("incoming.cgi: startup_session finished.\n");    
-
-    #Retrieve a sesion_id
-    my $session_id = $ss->id();
-    debug_print("incoming.cgi: session_id = [$session_id]\n");
-
-    #Prepare a cookie with the session_id
-    my $cookie = $q->cookie ( -name => "affelio-$af->{user__nickname}",
-			      -value => $session_id,
-			      -path => URL2path($af->{site__web_root}));
-
-    debug_print("incoming.cgi: new cookie [$session_id]\n");
-    debug_print("incoming.cgi: new cookie [" . URL2domain($af->{site__web_root}) .  "]\n");
-    debug_print("incoming.cgi: new cookie [" . URL2path($af->{site__web_root}) .  "]\n");
-    debug_print("incoming.cgi: New session has been established.");
-    debug_print("incoming.cgi: user_type:    " . $ss->param("type") );
-    debug_print("incoming.cgi: user_afid:    " . $ss->param("user_afid") );
-    debug_print("incoming.cgi: user_nickname:" . $ss->param("user_nickname") );
-
-    debug_print("incoming.cgi: end. Forwarding to my homepage.");
-    if($dest_URL ne ""){
-	print $q->redirect( -url => $dest_URL, 
-			    -cookie => $cookie);
-    }else{
-	print $q->redirect( -url => $af->{site__web_root},
-			    -cookie => $cookie);
-    }
-
-
-}
-
-exit(1);
Index: affelio/index.cgi
diff -u affelio/index.cgi:1.33 affelio/index.cgi:1.34
--- affelio/index.cgi:1.33	Sat Jan 28 17:47:21 2006
+++ affelio/index.cgi	Thu Feb 23 21:41:36 2006
@@ -16,298 +16,13 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: index.cgi,v 1.33 2006/01/28 08:47:21 slash5234 Exp $
-
+# $Id: index.cgi,v 1.34 2006/02/23 12:41:36 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=> "Index");
 
-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::NetMisc;
-use Affelio::misc::Time;
-use Affelio::misc::WebInput;
-
-debug_print("index.cgi: start.");
-my $q = new CGI;
-
-############################################################################
-#Load Affelio
-############################################################################
-my $wi = new Affelio::misc::WebInput(); 
-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);
-};
-
-############################################################################
-#Check session w/ cookie
-############################################################################
-my $session = $af->getSM()->get_session();
-
-############################################################################
-my $visitor_type="pb";
-my $visitor_nickname="anonymous";
-my $visitor_afid="";
-
-if($session){
-    $visitor_type 
-	= $wi->PTN_visitor_type($session->param("type"));
-    $visitor_nickname 
-	= $wi->PTN_nickname($session->param("user_nickname"));
-
-    $visitor_afid 
-	= $wi->PTN_URL($session->param("user_afid"));
-}
-if($visitor_type eq ""){
-    $visitor_type="pb";
-    $visitor_nickname="anonymous";
-}
-debug_print("index.cgi: visitor_type=      $visitor_type");
-debug_print("index.cgi: visitor_nickname=  $visitor_nickname");
-debug_print("index.cgi: visitor_afid=      $visitor_afid");
-
-
-############################################################################
-#Main
-############################################################################
-my %output_data = ();
-my $TMPL_FILE ="";
-my $INJ_FILE ="";
-
-$af->load_ApplicationManager();
-
-######################################################
-#Template file
-######################################################
-my $mode = $wi->PTN_mode($q->url_param("mode"));
-if(($af->{userpref__toppage_app_installname} eq "Affelio")
-   || ($mode ne "") ){
-    #top page is Affelio module.
-    debug_print("index.cgi CGI mode = [$mode]");
-    if($mode eq "") {
-	$mode="index";
-    }
-    $TMPL_FILE = "$af->{site__fs_root}/templates_dyn/"  . $mode . ".tmpl";
-    $INJ_FILE = "$af->{site__fs_root}/templates_dyn/"  . $mode . ".inj";
-
-}else{
-
-    #top page is NOT Affelio module but one of applications.
-    my $abs_next_URL = $af->{site__web_root} . "/" . 
-	$af->{userpref__toppage_app_path};
-
-    print "Location: $abs_next_URL", "\n\n";    
-    exit(1);
-}
-
-######################################################
-#Data prep (1)
-######################################################
-
-#################
-#Site info
-#################
-$output_data{"site__web_root"} = $af->{site__web_root};
-$output_data{"site__skin_dir"} = $af->{site__web_root} . "/skins/" . $af->{userpref__skin};
-$output_data{"site__locale"} = $af->{site__locale};
-
-try{
-    $af->get_module_list(\%output_data, $visitor_afid, $visitor_type);
-    if($visitor_type eq "self"){
-	$af->get_guest_owner_list(\%output_data);
-    }
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio init error.\n" . $e);
-};
-
-#################
-#Client info
-#################
-$output_data{'client_afid'}= $visitor_afid;
-#
-my $relation;
-if($visitor_type eq "self"){
-    $relation = $af->{lh}->maketext("_VISITOR_TYPE_SELF");
-}elsif($visitor_type eq "f1"){
-    $relation = $af->{lh}->maketext("_VISITOR_TYPE_F1");
-}elsif($visitor_type eq "f2"){
-    $relation = $af->{lh}->maketext("_VISITOR_TYPE_F2");
-}else{
-    $relation = $af->{lh}->maketext("_VISITOR_TYPE_PB");
-}
-$output_data{'client_relationship'}= $relation;
-
-$output_data{'client_type'}= $visitor_type;
-$output_data{'client_nickname'}= $visitor_nickname;
-$output_data{'client_type_' . $visitor_type}= "true";
-
-#################
-#Default profile info
-#################
-$output_data{'profile_nickname'} = $af->{user__nickname};
-$output_data{"profile_intromesg1"} = $af->{user__intromesg1};
-$output_data{'profile_myimage_path'} = 
-    "./bin/get_content.cgi?module=core&content=/profile/profile_face.jpg";
-
-if(($visitor_type eq "f1") ||  ($visitor_type eq "f2")){
-    $output_data{'send_mesg_URL'} = 
-	$visitor_afid . "/admin.cgi?mode=messages&action=compose&to_url="
-	. $af->{site__web_root};
-}else{
-    $output_data{'send_mesg_URL'} = "";
-}
-
-$output_data{'make_friend_URL'} 
-= $visitor_afid . "/admin.cgi?mode=makefriend&dest_url="
-    . $af->{site__web_root};
-
-######################################################
-#Data prep from Models 
-######################################################
-sysopen(INJ, $INJ_FILE, O_RDONLY);
-my $injection_flg = <INJ>;
-close INJ;
-
-#Inject Profile Data
-use Affelio::App::ShowProfile;
-try{
-    Affelio::App::ShowProfile::show_profile($af,
-					    \%output_data, 
-					    $visitor_type,
-					    $visitor_afid);
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio: model execution  error.\n" . $e);
-};
-
-##############################
-#Friendlist
-use Affelio::App::FriendRoutines;
-##############################
-my $flist_sort = $wi->PTN_mode($q->param("flist_sort"));
-if ($flist_sort eq ""){ $flist_sort = "access_latest";}
-
-my @friendlist_5_IF;
-if($injection_flg =~ /block\_friendlist\_5\_IF\,/){
-    try{
-	@friendlist_5_IF = get_friends_list($af,$visitor_afid, $visitor_type,5, $flist_sort, "iframe");
-    }catch Error with{
-	my $e = shift;
-	error($q, "Affelio: model execution  error.\n" . $e);
-    };
-    $output_data{"friendlist_5_IF"} = \@friendlist_5_IF;
-}
-##############################
-my @friendlist_5;
-if($injection_flg =~ /block\_friendlist\_5\,/){
-    try{
-	@friendlist_5 = get_friends_list($af, $visitor_afid, $visitor_type, 5, $flist_sort, "");
-    }catch Error with{
-	my $e = shift;
-	error($q, "Affelio: model execution  error.\n" . $e);
-    };
-    $output_data{"friendlist_5"} = \@friendlist_5;
-}
-##############################
-my @friendlist_all;
-if($injection_flg =~ /block\_friendlist\_all\,/){
-    try{
-	@friendlist_all = get_friends_list($af, $visitor_afid, $visitor_type, -1,$flist_sort, "");
-    }catch Error with{
-	my $e = shift;
-	error($q, "Affelio: model execution  error.\n" . $e);
-    };
-    $output_data{"friendlist_all"} = \@friendlist_all;
-}
-##############################
-my @friendlist_all_IF;
-if($injection_flg =~ /block\_friendlist\_all_IF\,/){
-    try{
-	@friendlist_all_IF=get_friends_list($af,$visitor_afid,$visitor_type,-1, $flist_sort, "iframe");
-    }catch Error with{
-	my $e = shift;
-	error($q, "Affelio: model execution  error.\n" . $e);
-    };
-    $output_data{"friendlist_all_IF"} = \@friendlist_all_IF;
-}
-##############################
-my @newsbox;
-if($injection_flg =~ /block\_newsbox\,/){
-    try{
-	require Affelio::App::MyNewsRoutines;
-	@newsbox = Affelio::App::MyNewsRoutines::show_news($af,$visitor_afid,$visitor_type);
-    }catch Error with{
-	my $e = shift;
-	error($q, "Affelio: model execution  error.\n" . $e);
-    };
-    $output_data{"newsbox"} = \@newsbox;
-}
-##############################
-try{
-    $output_data{"friend__F1count"} = $af->getFM->get_F1_count();
-    $output_data{"friend__F2count"} = $af->getFM->get_F2_count();
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio: error from FriendManager\n" . $e);
-};
-
-###########################################################################
-#Inject data into template 
-###########################################################################
-my $tmpl;
-try{
-    $tmpl = new HTML::Template( filename => $TMPL_FILE,
-			       die_on_bad_params => 0);
-    $tmpl->param(%output_data);
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio: error in HTML::Template init.\n" . $e);
-};
-
-
-
-###########################################################################
-#Output
-###########################################################################
-print "Content-type: text/html; charset=UTF-8\n";
-print "Pragma: no-cache", "\n\n"; 
-print $af->translate_templateL10N($tmpl->output);
-
-
-###########################################################################
-#AccessLog
-###########################################################################
-if($visitor_type ne "self"){
-    my $afid;
-    if($visitor_afid eq ""){
-	$afid = $q->remote_host;
-    }else{
-	$afid = $visitor_afid;
-    }
-
-    try{
-	$af->getALM->save_log($afid, $visitor_nickname, $visitor_type);
-    }catch Error with{
-	my $e = shift;
-	error($q, "Affelio: error in AccessLogging\n" . $e);
-    };
-}
-
-###########################################################################
-#NewsAggregator
-###########################################################################
-$a = $af->getNghrNews->get_one();
Index: affelio/outgoing.cgi
diff -u affelio/outgoing.cgi:1.14 affelio/outgoing.cgi:1.15
--- affelio/outgoing.cgi:1.14	Sat Jan 28 17:47:21 2006
+++ affelio/outgoing.cgi	Thu Feb 23 21:41:36 2006
@@ -15,192 +15,14 @@
 # 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: outgoing.cgi,v 1.14 2006/01/28 08:47:21 slash5234 Exp $
-
-use strict;
-
-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::misc::CGIError;
-use Affelio::misc::Debug;
-use Affelio::misc::Time;
-use Affelio::misc::MyCrypt;
-use Affelio::misc::NetMisc;
-use Affelio::misc::WebInput;
-
-debug_print("outgoing.cgi: start.\n");
-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 $session = $af->getSM()->get_session();
-
-my $visitor_type="pb";
-my $visitor_nickname="anonymous";
-my $visitor_afid="";
-
-if($session){
-    $visitor_type = $session->param("type");
-    $visitor_nickname = $session->param("user_nickname");
-    $visitor_afid = $session->param("user_afid");
-}
-debug_print("outgoing.cgi: visitor_type=      $visitor_type");
-debug_print("outgoing.cgi: visitor_nickname=  $visitor_nickname");
-debug_print("outgoing.cgi: visitor_afid=      $visitor_afid");
-
-############################################################################
-#Main
-############################################################################
-
-#########################################
-# Retrieve user's IP current address
-my $user_addr = $q->remote_addr;
-my $user_addr_is_private = check_private_IP_addr($user_addr);
-debug_print("outgoing.cgi: user's IP= $user_addr\n");
-debug_print("outgoing.cgi: user's IP privateflag= $user_addr_is_private\n");
-
-#########################################
-# Retrieve destination URL
-my $dest_URL = $wi->PTN_URL($q->param("dest_url"));
-$dest_URL =~ s|/$||;
-my $dest_URL2 = $wi->PTN_URL($q->param("dest_url2"));
-debug_print("outgoing.cgi: dest_URL=$dest_URL");
-
-#########################################
-# retrieve passAB
-my $passAB="";
-try{
-    $passAB = $af->getFM->get_attribute_by_afid($dest_URL, "password");
-
-    $af->getFM->set_attribute_by_afid($dest_URL,
-				      "last_outgoing",
-				      Affelio::misc::Time::get_timestamp());
-
-    $af->getFM->incr_attribute_by_afid($dest_URL,
-				       "count_outgoing");
-
-}catch Error with{
-    my $e = shift;
-    error($q, "Error from FriendManager.\n" . $e);
-};
-debug_print("outgoing.cgi: passAB=$passAB\n");
-if(!defined($passAB) || $passAB eq ""){
-    print $q->redirect($dest_URL);
-    exit(1);
-}
-
-
-
-#########################################
-# Put this forwarding information into my DB
-# so that we can logout this session in the future.
-# XXX
-
-#########################################
-#Output HTTP reply (Location header).
-#
-# Location-header:
-#  http://siteB.com/bin/incoming.cgi?session=(1)&referrer=(2)
 #
-#1.PassAB(timestamp, 
-#         expire,  
-#         browser's IP, 
-#         AF_ID,             Who is accessing?
-#         nickname,          Who is accessing?
-#         type)
-#
-#2.URL(A)               Where is this forwarding from?
-
-my $plain_msg = "";
-if($visitor_type eq "self"){
-    $plain_msg = get_timestamp()    . "*" . 
-	get_expire_stamp(1,0,0)     . "*" . 
-	$q->remote_addr             . "*" . 
-	url_encode($visitor_afid)       . "*" . 
-	url_encode($visitor_nickname)   . "*" . 
-	"self" .'*';
-}elsif($visitor_type eq "f1"){
-    $plain_msg = get_timestamp()    . "*" . 
-	get_expire_stamp(1,0,0)     . "*" . 
-	$q->remote_addr             . "*" . 
-	url_encode($visitor_afid)       . "*" . 
-	url_encode($visitor_nickname)   . "*" . 
-	"f1" . '*';
-}elsif($visitor_type eq "f2"){
-    $plain_msg = get_timestamp()    . "*" . 
-	get_expire_stamp(1,0,0)     . "*" . 
-	$q->remote_addr             . "*" . 
-	url_encode($visitor_afid)       . "*" . 
-	url_encode($visitor_nickname)   . "*" . 
-	"f2" . '*';
-}else{
-    $plain_msg = get_timestamp()    . "*" . 
-	get_expire_stamp(1,0,0)     . "*" . 
-	$q->remote_addr             . "*" . 
-	url_encode($visitor_afid)         . "*" . 
-	url_encode($visitor_nickname)     . "*" . 
-	"pb" . '*';
-}
-debug_print("outgoing.cgi: plain_msg= $plain_msg\n");
-
-#Encrypt
-my $cipher_msg = url_encode( msg_encrypt( $plain_msg, $passAB ) );
-debug_print("outgoing.cgi: cipher_msg= $cipher_msg\n");
-
-#Build up URL
-my $forwarding_to = "$dest_URL/incoming.cgi?"
-    . "forward_id=$cipher_msg" 
-    . "&" 
-    . "referrer=$af->{site__web_root}"
-    . "&dest_url=$dest_URL2";
-debug_print("outgoing.cgi: forwarding_to= $forwarding_to\n");
-
-############################################################################
-#Output
-############################################################################
-if($user_addr_is_private){
-    #This access is from some private IP address.
-    #It means the user may have some problem in 
-    #session forwarding when the user is forwarded
-    #to the destination Affelio. So warn the user.
-
-    my $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/" 
-	."owner_side/outgoing_warn.tmpl";
-
-    require HTML::Template;
-    my $tmpl = new HTML::Template( filename => $TMPL_FILE,
-				   die_on_bad_params => 0);    
-
-    my $warning_message = "<AF_M text='_SYS_WARN_OUTGOING_PRIV_IP' param='$user_addr'><P><A HREF=\"$forwarding_to\">Destination Affelio</A>: <AF_M text='_SYS_WARN_OUTGOING_PRIV_IP2'>";
-    $tmpl->param(message => $warning_message);
-    $tmpl->param(forwarding_to => $forwarding_to);
-    $tmpl->param(tmpl_path => "$af->{site__web_root}/templates/$af->{site__template}/owner_side/");
-    print "Content-type: text/html; charset=UTF-8\n";
-    print "Pragma: no-cache", "\n\n"; 
-    print $af->translate_templateL10N($tmpl->output);
+# $Id: outgoing.cgi,v 1.15 2006/02/23 12:41:36 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=> "Outgoing");
 
-}else{
-    print $q->redirect($forwarding_to);
-}


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