Tadashi Okoshi
slash****@users*****
2005年 6月 29日 (水) 19:40:17 JST
Index: affelio/lib/Affelio/App/Admin/AccessLog.pm diff -u /dev/null affelio/lib/Affelio/App/Admin/AccessLog.pm:1.1 --- /dev/null Wed Jun 29 19:40:17 2005 +++ affelio/lib/Affelio/App/Admin/AccessLog.pm Wed Jun 29 19:40:16 2005 @@ -0,0 +1,86 @@ +# Affelio: Open social networking software +# Copyright 2004-2005 Fish Grove +# For more information, please refer following web site. +# http://affelio.jp/ (Japan) +# http://affelio.jp/ (USA and other area) +# +# $Id: AccessLog.pm,v 1.1 2005/06/29 10:40:16 slash5234 Exp $ + +package Affelio::App::Admin::AccessLog; +{ + 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::Admin::AccessLog::ISA = "Exporter"; + @Affelio::App::Admin::AccessLog::EXPORT = qw (show); + + + ####################################################################### + #show + ####################################################################### + sub show{ + my $af= shift; + my $q=shift; + my $output_ref = shift; + my $wi = new Affelio::misc::WebInput; + + debug_print("AccessLog::show start."); + + my @access_log=(); + $output_ref->{"access_log"} = \@access_log; + + ############################### + #start and end time + ############################### + my $start_time = get_today(); + my $cur_time = get_timestamp(); + + ############################### + #Today's date + ############################### + my $t_year = substr ($start_time, 0, 4); + my $t_mon = substr ($start_time, 4, 2); + my $t_mday = substr ($start_time, 6, 2); + $output_ref->{"log_date"} = "$t_year/$t_mon/$t_mday"; + + ############################### + #Access to AccessLog Manager + ############################### + my $result = $af->{alm}->get_log($start_time, $cur_time); + + ############################### + #Parse result + ############################### + while( my ($time, $nickname, $afid, $type) = $result->fetchrow_array ){ + my $true_name; + if($afid =~ /http/){ + $true_name = '<A HREF="' . $afid . '">' . $nickname . '</A>'; + }else{ + $true_name = $afid; + } + + my $true_type; + if($type eq "pb") {$true_type='<AF_M text="_VISITOR_TYPE_PB">';} + if($type eq "f2") {$true_type='<AF_M text="_VISITOR_TYPE_F2">';} + if($type eq "f1") {$true_type='<AF_M text="_VISITOR_TYPE_F1">';} + if($type eq "self") {$true_type='<AF_M text="_VISITOR_TYPE_SELF">';} + push(@access_log, {time=> timestamp2string($time), + nickname => $true_name, + type => $true_type}); + } + + debug_print("AccessLog::show end."); + } + + +} +1;