Tadashi Okoshi
slash****@users*****
2006年 3月 7日 (火) 23:39:09 JST
Index: affelio/lib/Affelio/App/Standalone/Admin.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/Admin.pm:1.1
--- /dev/null Tue Mar 7 23:39:09 2006
+++ affelio/lib/Affelio/App/Standalone/Admin.pm Tue Mar 7 23:39:09 2006
@@ -0,0 +1,265 @@
+# 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: Admin.pm,v 1.1 2006/03/07 14:39:09 slash5234 Exp $
+
+package Affelio::App::Standalone::Admin;
+{
+ 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 = @_;
+
+ debug_print("StandAlone::Admin::new: start.");
+
+ my $cfg_dir = $param{ConfigDir};
+ my $cgi = new CGI;
+ my $wi = new Affelio::misc::WebInput();
+ my $af;
+
+ ###########################
+ #Load Affelio
+ ###########################
+ $af = new Affelio(ConfigDir => $cfg_dir,
+ CGI => $cgi);
+ debug_print("StandAlone::Admin::new: AF loaded.");
+
+ my $self = {cfg_dir => $cfg_dir,
+ cgi => $cgi,
+ af => $af,
+ wi => $wi};
+ bless $self, $class;
+
+ $a = new Affelio::Managing::NewsAggregator($af);
+ $a->get_one();
+
+ debug_print("StandAlone::Admin::new: end.");
+ return $self;
+ }
+
+ ######################################################################
+ #run
+ ######################################################################
+ sub run{
+
+ my $self = shift;
+ my $af = $self->{af};
+ my $cgi = $self->{cgi};
+ my $cfg_path = $self->{cfg_path};
+ my $wi = $self->{wi};
+
+ my $HTTP_forward_flag = 0;
+ my $forward_URL = "";
+
+ my %handlers = ("config_affelio", "ConfigAffelio",
+ "config_apps", "ConfigApps",
+ "accesslog", "AccessLog",
+ "makefriend", "MakeAffelioLink",
+ "make_affeliolink", "MakeAffelioLink",
+ "messages", "Messaging",
+ "edit_skins", "EditSkins",
+ "edit_templates", "EditTemplates",
+ "friendsgraph", "FriendsGraph",
+ "editprofile", "EditProfile",
+ "group_member_table", "GroupMemberTable",
+ "manage_friends", "ManageFriend",
+ "manage_groups", "ManageGroup",
+ "access_control", "AccessControl",
+ "access_control_apps", "ManageApplication",
+ "send_invitation", "SendInvitation",
+ "top", "Top");
+
+ ###########################
+ #Check session
+ ###########################
+ check_session($self,$cgi);
+
+ ###########################
+ #Going to the owner mode
+ ###########################
+ $af->set_owner_mode();
+
+ ##############################################################
+ #prep vars
+ ##############################################################
+ my %output_data = ("tmpl_path", "$af->{site__tmpl_web_path}/owner_side/",
+ "style_path", $af->{site__web_root} . "/skins/" . $af->{userpref__skin},
+ "site__web_root", "$af->{site__user_afid}",
+ "site__locale", $af->{site__locale},
+ "my_nickname", $af->{user__nickname});
+
+ use Affelio::App::Standalone::Admin::Messaging;
+ $output_data{new_messages}
+ =Affelio::App::Standalone::Admin::Messaging::get_new($af);
+
+
+ ##############################################################
+ #Model invocation
+ ##############################################################
+ my $admin_mode = $wi->PTN_mode($cgi->url_param("mode"));
+ if ($admin_mode eq "") {$admin_mode="top";}
+ debug_print("StandAlone::Admin::run: mode=$admin_mode");
+
+ my $classname = "Affelio::App::Standalone::Admin::" . $handlers{$admin_mode};
+ debug_print("StandAlone::Admin::run: handler= $classname");
+ eval "use $classname";
+ if($@){
+ throw Affelio::exception::SystemException("Could not load handler [$admin_mode]");
+ }
+ debug_print("StandAlone::Admin::run: handler function loaded.");
+
+ my $ret="";
+ try{
+ debug_print("StandAlone::Admin::run: handler function..... ");
+ handler($cgi, $af, \%output_data);
+ debug_print("StandAlone::Admin::run: handler function done.");
+ }catch Error with{
+ my $e = shift;
+ $output_data{"err_msg"} .= $e->stacktrace;
+ };
+
+ ##############################################################
+ #Output View
+ ##############################################################
+ if( $HTTP_forward_flag == 1 ){
+ print "Location: $forward_URL", "\n\n";
+
+ }else{
+ my $tmpl = new HTML::Template(filename => $output_data{tmpl_file},
+ die_on_bad_params => 0);
+ $tmpl->param(%output_data);
+
+ print "Content-type: text/html; charset=UTF-8\n";
+ print "Pragma: no-cache", "\n\n";
+ print get_HTML_header($self);
+ print $af->translate_templateL10N($tmpl->output);
+ print get_HTML_footer($self);
+ }
+
+ }
+
+ ######################################################################
+ #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("StandAlone::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__tmpl_dir}/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__tmpl_web_path}/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("StandAlone::Admin::check_session: Session as the admin is OK.");
+ }
+
+ ######################################################################
+ #Get_HTML_header
+ ######################################################################
+ sub get_HTML_header{
+ my $self = shift;
+ my $af = $self->{af};
+ my $app__page_title = shift;
+
+ #Set template file name
+ my $TMPL_FILE = "$af->{site__tmpldyn_dir}/_header.tmpl";
+ #Set data for template
+ my %output_data = ();
+ $output_data{'app__css_path'} = "$af->{site__tmpl_web_path}/owner_side";
+ $output_data{'app__page_title'} = "Affelio Owner's page";
+ $output_data{"site__skin_dir"} = $af->{site__web_root} . "/skins/" . $af->{userpref__skin};
+ $output_data{'site__web_root'} = $af->{site__web_root};
+ $output_data{'site__locale'} = $af->{site__locale};
+
+ $af->get_module_list(\%output_data, $af->{site__user_afid},"self");
+ $af->get_guest_owner_list(\%output_data);
+
+ #Initiate Template
+ my $tmpl = new HTML::Template( filename => $TMPL_FILE,
+ die_on_bad_params => 0);
+ $tmpl->param(%output_data);
+
+ my $final_out = $af->translate_templateL10N($tmpl->output)
+ . '<div class="afMain">' . "\n";
+
+ return($final_out);
+
+ }
+
+ ######################################################################
+ #get_HTML_footer
+ ######################################################################
+ sub get_HTML_footer{
+ my $self = shift;
+ my $af = $self->{af};
+ #Set template file name
+ 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-->"
+ . $af->translate_templateL10N($tmpl->output);
+
+ return($final_out);
+ }
+
+}
+1;
+
+
Index: affelio/lib/Affelio/App/Standalone/Env.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/Env.pm:1.1
--- /dev/null Tue Mar 7 23:39:09 2006
+++ affelio/lib/Affelio/App/Standalone/Env.pm Tue Mar 7 23:39:09 2006
@@ -0,0 +1,20 @@
+package Affelio::App::Standalone::Env;
+{
+ use strict;
+ use Exporter;
+ use lib("../../../../extlib/");
+ use lib("../../../../lib/");
+ @Affelio::App::Standalone::Env::ISA = "Exporter";
+ @Affelio::App::Standalone::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/Standalone/FriendRoutines.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/FriendRoutines.pm:1.1
--- /dev/null Tue Mar 7 23:39:09 2006
+++ affelio/lib/Affelio/App/Standalone/FriendRoutines.pm Tue Mar 7 23:39:09 2006
@@ -0,0 +1,327 @@
+# 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: FriendRoutines.pm,v 1.1 2006/03/07 14:39:09 slash5234 Exp $
+
+package Affelio::App::Standalone::FriendRoutines;
+{
+ use strict;
+
+ use lib("../../../../extlib/");
+ use lib("../../../../lib");
+ use Affelio::misc::CGIError;
+ use Affelio::misc::Debug qw(debug_print);
+ use Affelio::misc::MyCrypt qw( msg_encrypt url_encode);
+ use Affelio::misc::Time qw(get_timestamp get_expire_stamp);
+ use Affelio::misc::NetMisc qw(get_remote_host);
+
+ use Exporter;
+ @Affelio::App::Standalone::FriendRoutines::ISA = "Exporter";
+ @Affelio::App::Standalone::FriendRoutines::EXPORT = qw (get_friends_list_IF get_friends_list generate_getcontentURL get_summed_permission_list);
+
+ #####################################################################
+ #get_summed_permission_list
+ #####################################################################
+ sub get_summed_permission_list{
+ my $af = shift; #arg(1) AF
+ my $visitor_id = shift; #arg(2) visitor_ID
+ my $visitor_mode = shift; #arg(3) visitor_mode
+ my @ret_list=();
+
+ debug_print("StandAlone::get_summed_permission_list: start.");
+ debug_print("StandAlone::get_summed_permission_list: visitor_id = $visitor_id");
+ debug_print("StandAlone::get_summed_permission_list: visitor_mode= $visitor_mode");
+
+ if($visitor_mode eq "f2" || $visitor_mode eq "pb"){
+ ####################
+ # f2 or PB
+ ####################
+
+ my $SQL_ret = $af->getPERM->get_permission("f", $visitor_mode);
+ @ret_list = $SQL_ret->fetchrow_array;
+ # Now...
+ # $ret_list[0] = Permission ID
+ # $ret_list[1] = "f"
+ # $ret_list[2] = "f2"
+ # $ret_list[3] = perm for nickname ...aid=1
+ # $ret_list[4] = perm for 1st element ...aid=2
+
+ shift(@ret_list);
+ shift(@ret_list);
+ shift(@ret_list);
+ # $ret_list[0] = perm for nickname ...aid=0
+ # $ret_list[1] = perm for 1st element ...aid=1
+
+ }elsif($visitor_mode eq "self"){
+
+ ####################
+ # self
+ ####################
+
+ #In case of "self" .... everything is 1.
+ my $attributes = $af->getPM->get_attribute_table();
+
+ my @row=();
+ while(@row = $attributes->fetchrow_array){
+ push(@ret_list, 1)
+ }
+
+ }else{
+ ####################
+ # f1
+ ####################
+ #We will make
+ # perm(f1) OR Vx(perm(G))
+
+ #Get permssion for F1
+ my $SQL_ret1 = $af->getPERM->get_permission("f", $visitor_mode);
+ @ret_list = $SQL_ret1->fetchrow_array;
+
+ #Get the visitor's UID
+ my ($t_uid, $t_afid, $t_nickname, $t_time,
+ $t_pass, $t_intro, $t_pid, $t_lastupdated, $t_f2list)
+ = $af->getFM->get_friend_by_afid($visitor_id);
+
+ #Get the visitor's groups
+ my $SQL_result = $af->getGM->get_groups_by_uid($t_uid);
+
+ #For each group...
+ my @g_data=();
+ while(@g_data = $SQL_result->fetchrow_array) {
+ my $gid = $g_data[0];
+ my $SQL_ret2 = $af->getPERM->get_permission("g", $gid);
+ my @list1 = $SQL_ret2->fetchrow_array;
+
+ #For each value...
+ my $i=0;
+ for($i=0; $i <= $#list1; $i++){
+
+ $ret_list[$i] = $ret_list[$i] | $list1[$i]
+ }
+ }
+
+ # Now...
+ # $ret_list[0] = Permission ID
+ # $ret_list[1] = "f"
+ # $ret_list[2] = "f2"
+ # $ret_list[3] = perm for nickname ...aid=1
+ # $ret_list[4] = perm for 1st element ...aid=2
+
+ shift(@ret_list);
+ shift(@ret_list);
+ shift(@ret_list);
+ # Now...
+ # $ret_list[0] = perm for nickname ...aid=0
+ # $ret_list[1] = perm for 1st element ...aid=1
+ }
+
+
+ return(@ret_list);
+ }
+
+
+
+ #####################################################################
+ #get_friends_list
+ #####################################################################
+ sub get_friends_list{
+ my $af = shift; #arg(1) AF
+ my $visitor_id = shift; #arg(2) visitor_ID
+ my $visitor_type = shift; #arg(3) visitor_ID
+ my $max_friend_num = shift; #arg(4) max num
+ my $sort = shift; #arg(5) sort
+ my $mode = shift; #arg(6) mode
+ my @ret_list;
+
+ if ($visitor_id eq ""){
+ $visitor_id = "anonymous";
+ }
+
+ debug_print("StandAlone::FriendRoutines: visitor_id=$visitor_id");
+ debug_print("StandAlone::FriendRoutines: visitor_type=$visitor_type");
+
+ ######################################
+ #Get all friends' table from FriendManager
+ ######################################
+ my $do_sort="";
+ my $do_order="asc";
+
+ debug_print("StandAlone::FriendRoutines: sort = [$sort]\n");
+ if($sort eq "link_old"){
+ $do_sort = "timestamp";
+ $do_order = "asc";
+ }
+ if($sort eq "link_new"){
+ $do_sort = "timestamp";
+ $do_order = "desc";
+ }
+ if($sort eq "access_latest"){
+ $do_sort = "last_access";
+ $do_order = "desc";
+ }
+ if($sort eq "access_freq"){
+ $do_sort = "count_access";
+ $do_order = "desc";
+ }
+ if($sort eq "incoming"){
+ $do_sort = "count_incoming";
+ $do_order = "desc";
+ }
+ if($sort eq "outgoing"){
+ $do_sort = "count_outgoing";
+ $do_order = "desc";
+ }
+
+ my $sth = $af->getFM->get_all_friend_list(sort => $do_sort,
+ order => $do_order);
+
+ ######################################
+ #Build up a return array
+ ######################################
+ my @person=();
+ my $count = $max_friend_num;
+
+ while((@person = $sth->fetchrow_array)
+ && (($count > 0) || ($count == -1))
+ ) {
+ debug_print("StandAlone::FriendRoutines: friend=(@person)");
+ #$person[0] uid
+ #$person[1] af_id
+ #$person[2] nickname
+ #$person[3] timestamp
+ #$person[4] password
+ #$person[5] intro
+ #$person[6] option_pid
+ #$person[7] lastupdated
+ #$person[8] f2list
+
+ my $image_URL = generate_getcontentURL($af,
+ $visitor_id,
+ $visitor_type,
+ $person[1],
+ $person[4],
+ "core",
+ "/profile/profile_face.jpg");
+ debug_print("StandAlone::FriendRoutines: image_URL= $image_URL\n");
+
+ my $mystatus_URL = "";
+
+ if($mode eq "iframe"){
+ $mystatus_URL = generate_getcontentURL($af,
+ $visitor_id,
+ $visitor_type,
+ $person[1],
+ $person[4],
+ "core",
+ "/profile/mystatus_iframe");
+ }else{
+ $mystatus_URL = generate_getcontentURL($af,
+ $visitor_id,
+ $visitor_type,
+ $person[1],
+ $person[4],
+ "core",
+ "/profile/mystatus");
+ }
+ debug_print("StandAlone::FriendRoutines: mystatus_URL= $mystatus_URL\n");
+
+ #Generate Hyperlink target URL
+ my $dest_URL = $af->{site__user_afid} . "/outgoing.cgi?dest_url=" . $person[1];
+
+ my $editurl="";
+ if($visitor_type eq "self"){
+ $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__user_afid} . "/admin.cgi?mode=messages&action=compose&reply_to=" . $person[1];
+ }
+
+ push(@ret_list, {nickname => $person[2],
+ URL => $dest_URL,
+ image_URL => $image_URL,
+ editurl => $editurl,
+ mailurl => $mailurl,
+ intro => $person[5],
+ mystatus_URL => $mystatus_URL
+ }
+ );
+
+ if($max_friend_num > 0){
+ $count--;
+ }
+ }#while
+
+ return(@ret_list);
+
+ }
+
+
+
+
+
+
+
+
+ ######################################################################
+ #generate_contentURL
+ # returns image_URL
+ # arg(1) af
+ # arg(2) visitor's ID
+ # arg(3) visitor's type
+ # arg(4) friend's AF_ID
+ # arg(5) friend's password
+ # arg(6) destination module "core" "app1" "app2" etc..
+ # arg(7) content name
+ ######################################################################
+ sub generate_getcontentURL{
+ my $af = shift;
+ my $visitor_afid = shift;
+ my $visitor_type = shift;
+ my $f_af_id = shift;
+ my $f_password = shift;
+ my $module =shift;
+ my $content =shift;
+
+ #1.PassAB(timestamp,
+ # expire,
+ # browser's IP,
+ # AF_ID, Who is accessing?
+ # type)
+
+ my $plaintext =
+ get_timestamp() . "*" .
+ get_expire_stamp(0,0,15) . "*" .
+ get_remote_host(%ENV) . "*" .
+ $visitor_afid . '*' .
+ $visitor_type . '*';
+
+ debug_print("StandAlone::generate_getcontentURL: [$plaintext]\n");
+
+ my $getcontentURL = $f_af_id
+ . "/bin/get_content.cgi?module=$module&content=$content&cfid="
+ . url_encode( msg_encrypt($plaintext, $f_password))
+ . "&referrer=" . $af->{site__user_afid};
+
+ return($getcontentURL);
+
+ }#func
+
+
+
+
+}#package
+1;
Index: affelio/lib/Affelio/App/Standalone/MyNewsRoutines.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/MyNewsRoutines.pm:1.1
--- /dev/null Tue Mar 7 23:39:09 2006
+++ affelio/lib/Affelio/App/Standalone/MyNewsRoutines.pm Tue Mar 7 23:39:09 2006
@@ -0,0 +1,83 @@
+# 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: MyNewsRoutines.pm,v 1.1 2006/03/07 14:39:09 slash5234 Exp $
+
+package Affelio::App::Standalone::MyNewsRoutines;
+{
+ use strict;
+
+ use lib("../../../../extlib/");
+ use lib("../../../../lib");
+ use Affelio::misc::CGIError;
+ use Affelio::misc::Debug qw(debug_print);
+ use Affelio::misc::Time;
+
+ use Exporter;
+ @Affelio::App::Standalone::MyNewsRoutines::ISA = "Exporter";
+ @Affelio::App::Standalone::MyNewsRoutines::EXPORT = qw(show_news);
+
+ #####################################################################
+ #show_news
+ #####################################################################
+ sub show_news{
+ my $af = shift; #arg(1) AF
+ my $visitor_afid = shift; #arg(2) visitor_ID
+ my $visitor_type = shift; #arg(3) visitor_type
+ #
+ my @ret_list=();
+
+
+ my @app_list=();
+ my $this_app_ref;
+ my $tmp_name;
+ while ( ($tmp_name, $this_app_ref) = each( %{$af->getAM->{apps}} ) ){
+ my %this_app = %$this_app_ref;
+
+ my $perm_to_tab=0;
+ $perm_to_tab
+ = $af->getAM->get_summed_app_perm($visitor_afid,
+ $visitor_type,
+ $this_app{'install_name'},
+ "DF_access");
+ if($perm_to_tab ==1 ){
+ push(@app_list, $this_app{'install_title'});
+ }
+ debug_print("StandAlone::S::get_news: [$tmp_name]");
+ }
+ #while
+ debug_print("StandAlone::S::get_news: app_list = @app_list");
+
+ #################################
+ #get what's new contents
+ #################################
+ my $news = $af->getMyNews()->retrieve_news(app_list => \@app_list,
+ laterthan => 0);
+
+ my @row=();
+ my $count=0;
+ while((@row = $news->fetchrow_array) && ($count < 10)){
+ push(@ret_list, {date => timestamp2stringB($row[1]),
+ app => $row[2],
+ title => $row[3],
+ url => $row[6]});
+ $count++;
+ }
+
+ return @ret_list;
+ }
+}
+1;
Index: affelio/lib/Affelio/App/Standalone/Public.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/Public.pm:1.1
--- /dev/null Tue Mar 7 23:39:09 2006
+++ affelio/lib/Affelio/App/Standalone/Public.pm Tue Mar 7 23:39:09 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/03/07 14:39:09 slash5234 Exp $
+
+package Affelio::App::Standalone::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::Standalone::Public::$param{App};");
+ eval("Affelio::App::Standalone::Public::$param{App}::run();");
+ }
+}
+1;
+
+
Index: affelio/lib/Affelio/App/Standalone/ShowProfile.pm
diff -u /dev/null affelio/lib/Affelio/App/Standalone/ShowProfile.pm:1.1
--- /dev/null Tue Mar 7 23:39:09 2006
+++ affelio/lib/Affelio/App/Standalone/ShowProfile.pm Tue Mar 7 23:39:09 2006
@@ -0,0 +1,85 @@
+# 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: ShowProfile.pm,v 1.1 2006/03/07 14:39:09 slash5234 Exp $
+
+package Affelio::App::Standalone::ShowProfile;
+{
+ use strict;
+
+ use lib("../../../../extlib/");
+ use lib("../../../../lib");
+ use Affelio;
+ use Affelio::misc::CGIError;
+ use Affelio::misc::Debug qw(debug_print);
+ use Affelio::misc::Time; qw( get_timestamp);
+ use Affelio::misc::NetMisc; qw( get_remote_host);
+ use Affelio::misc::MyCrypt qw( msg_encrypt url_encode);
+ use Affelio::App::Standalone::FriendRoutines;
+
+ use Exporter;
+ @Affelio::App::Standalone::ShowProfile::ISA = "Exporter";
+ @Affelio::App::Standalone::ShowProfile::EXPORT = qw (show_profile);
+
+
+ #######################################################################
+ #show_profile
+ #######################################################################
+ sub show_profile{
+ my $af = shift;
+ my $output_data_ref = shift;
+ my $viewers_mode = shift;
+ my $viewers_id = shift;
+
+ debug_print("StandAlone::ShowProfile::show_profile: start view_mode=[$viewers_mode], viewer_id=[$viewers_id]");
+
+ #Get summarized permission list for the given user
+ my @list
+ = get_summed_permission_list($af, $viewers_id, $viewers_mode);
+ debug_print("StandAlone::ShowProfile::show_profile: Got summarized permission...");
+ debug_print("StandAlone::ShowProfile::show_profile: \t[@list]");
+
+ #@list containts...
+ # $list[0] = perm for nickname ...aid=0
+ # $list[1] = perm for 1st element ...aid=1
+ # $list[2] = ...
+
+ my $attributes = $af->getPM->get_attribute_table();
+
+ my @row=();
+ while(@row = $attributes->fetchrow_array){
+
+ debug_print("StandAlone::ShowProfile: aid[$row[0]] attr[$row[1]] show? =$list[$row[0]]");
+
+ if($list[$row[0]] eq "1"){
+ $$output_data_ref{"flg_$row[1]"}
+ = "true";
+
+ $$output_data_ref{"profile_$row[1]"}
+ = $af->{'user__' . $row[1]};
+ }
+ }
+
+ $$output_data_ref{"profile_intromesg1"} =~ s/\n\n/<P>/g;
+ $$output_data_ref{"profile_intromesg1"} =~ s/\n/<BR>/g;
+
+ $$output_data_ref{"profile_intromesg2"} =~ s/\n\n/<P>/g;
+ $$output_data_ref{"profile_intromesg2"} =~ s/\n/<BR>/g;
+
+ }
+
+}
+1;