Tadashi Okoshi
slash****@users*****
2006年 3月 7日 (火) 23:39:09 JST
Index: affelio/lib/Affelio/App/Public/Incoming.pm
diff -u affelio/lib/Affelio/App/Public/Incoming.pm:1.1 affelio/lib/Affelio/App/Public/Incoming.pm:removed
--- affelio/lib/Affelio/App/Public/Incoming.pm:1.1 Thu Feb 23 21:41:37 2006
+++ affelio/lib/Affelio/App/Public/Incoming.pm Tue Mar 7 23:39:09 2006
@@ -1,248 +0,0 @@
-# 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: Incoming.pm,v 1.1 2006/02/23 12:41:37 slash5234 Exp $
-
-package Affelio::App::Public::Incoming;
-{
- use strict;
-
- use lib("../../../../extlib/");
- use lib("../../../");
- use Affelio;
- use Affelio::misc::CGIError;
- use Affelio::misc::Debug qw(debug_print);
- use Affelio::misc::Encoding qw(db_encode db_decode);
- use Affelio::misc::Time;
- use Affelio::misc::WebInput;
-
- use Exporter;
- @Affelio::App::Public::Incoming::ISA = "Exporter";
- @Affelio::App::Public::Incoming::EXPORT = qw (run);
-
- #######################################################################
- #run
- #######################################################################
- sub run{
-use CGI qw(-unique_headers);
-use CGI::Session; #qw(-ip_match);
-use Error qw(:try);
-
-use Affelio;
-use Affelio::App::Env;
-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__user_afid});
- }
-}
-
-############################################################################
-#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__user_afid});
- }
-
-}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
- $af->getSM->startup_session(user_afid => $FID_visitorAFID,
- user_nickname => $FID_visitor_nickname,
- type => $FID_visitor_type);
-
- debug_print("incoming.cgi: startup_session finished.\n");
-
- #Prepare a cookie with the session_id
- my $cookie = $af->getSM->issue_cookie();
-
- 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__user_afid},
- -cookie => $cookie);
- }
-}
-
-exit(1);
-
-
- }
-}
-1;
Index: affelio/lib/Affelio/App/Public/Index.pm
diff -u affelio/lib/Affelio/App/Public/Index.pm:1.1 affelio/lib/Affelio/App/Public/Index.pm:removed
--- affelio/lib/Affelio/App/Public/Index.pm:1.1 Thu Feb 23 21:41:37 2006
+++ affelio/lib/Affelio/App/Public/Index.pm Tue Mar 7 23:39:09 2006
@@ -1,329 +0,0 @@
-# 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: Index.pm,v 1.1 2006/02/23 12:41:37 slash5234 Exp $
-
-package Affelio::App::Public::Index;
-{
- use strict;
-
- use lib("../../../../extlib/");
- use lib("../../../");
- use Affelio;
- use Affelio::misc::CGIError;
- use Affelio::misc::Debug qw(debug_print);
- use Affelio::misc::Encoding qw(db_encode db_decode);
- use Affelio::misc::Time;
- use Affelio::misc::WebInput;
-
- use Exporter;
- @Affelio::App::Public::Index::ISA = "Exporter";
- @Affelio::App::Public::Index::EXPORT = qw (run);
-
- #######################################################################
- #run
- #######################################################################
- sub run{
- use CGI qw(-unique_headers);
- use CGI::Session; #qw(-ip_match);
- use HTML::Template;
- use Error qw(:try);
- use Fcntl;
-
- 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__tmpldyn_dir}/" . $mode . ".tmpl";
- $INJ_FILE = "$af->{site__tmpldyn_dir}/" . $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__user_afid"} = $af->{site__user_afid};
- $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();
-
- }#method
-
-}
-1;
Index: affelio/lib/Affelio/App/Public/Outgoing.pm
diff -u affelio/lib/Affelio/App/Public/Outgoing.pm:1.1 affelio/lib/Affelio/App/Public/Outgoing.pm:removed
--- affelio/lib/Affelio/App/Public/Outgoing.pm:1.1 Thu Feb 23 21:41:37 2006
+++ affelio/lib/Affelio/App/Public/Outgoing.pm Tue Mar 7 23:39:09 2006
@@ -1,229 +0,0 @@
-# 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: Outgoing.pm,v 1.1 2006/02/23 12:41:37 slash5234 Exp $
-
-package Affelio::App::Public::Outgoing;
-{
- use strict;
-
- use lib("../../../../extlib/");
- use lib("../../../");
- use Affelio;
- use Affelio::misc::CGIError;
- use Affelio::misc::Debug qw(debug_print);
- use Affelio::misc::Encoding qw(db_encode db_decode);
- use Affelio::misc::Time;
- use Affelio::misc::WebInput;
-
- use Exporter;
- @Affelio::App::Public::Outgoing::ISA = "Exporter";
- @Affelio::App::Public::Outgoing::EXPORT = qw (run);
-
- #######################################################################
- #run
- #######################################################################
- sub run{
- use CGI qw(-unique_headers);
- use CGI::Session; #qw(-ip_match);
- use Error qw(:try);
-
- use Affelio;
- use Affelio::App::Env;
- 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__user_afid}"
- . "&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);
-
- }else{
- if($forwarding_to eq ""){
- $forwarding_to = $af->{site__user_afid};
- }
- print $q->redirect($forwarding_to);
- }
-
- }
-}
-1;