%
use strict;
use Data::Dumper;
my $msg = '';
my $user = $Session->{user};
if ((not ref $user)||(not $user->{id})) {
$user = $api->login_user ({'username' => 'demo2',
'password' => 'demo', 'login' => 1});
$Session->{user} = $user;
}
my ($results) = $api->getMatchedUserProfile('userid' => $user->{id}, 'toid' => $query->{'userid'} );
my $result = $results->{'results'};
my $def = $results->{'definitions'};
my $array = $results->{'array'};
#print Dumper($result);
my $im = $query->{'userid'};
my $thisuser = $api->getUserData($im);
# email, createdat, name, username, lastlogintime
my $demo = $api->isDemo($user->{'id'});
if ( (not $demo)&&(not $user->{id}) ) {
$Response->Redirect("/login.asp?goto=/viewuser.asp?userid=$im");
}
my $msg;
if ($form->{'send'}) {
my $cansm = $api->canSendMore($user->{'id'}); # napi max. 3
if ($cansm) {
my $res = $api->send_user_message('userid' => $user->{'id'}, 'toid' => $query->{'userid'},
'subject' => $form->{'subject'}, 'text' => $form->{'text'});
if ($res) {
$msg = $res;
} else {
$msg = 'successfully_sent';
}
} else {
$msg = 'Limit exceeded: you cannot send more than 3 messages a day.';
}
} elsif ($form->{'addto'} && not $demo) {
my $res = $api->addToFriends('userid' => $user->{'id'}, 'remoteid' => $query->{'userid'});
if ($res) {
$msg = $res;
} else {
$msg = 'successfully_added';
}
}
$Response->{FormFill} = 0;
my $rela = $api->getRelationships($im);
#my $friends = $api->getFriends('userid' => $im);
my $friends = $rela->{mutual};
my $ami = $api->amIFriend($user->{'id'}, $thisuser->{'id'}); # a csavo haverja vagyok
my $ami2 = $api->amIMutualFriend($user->{'id'}, $thisuser->{'id'}); # haverok vagyunk
my $heis = $api->amIFriend($thisuser->{id}, $user->{id}); # rajta van a haverlistamon ("i like them")
my $related = $api->areWeRelated($user->{id}, $thisuser->{id});
%>
<% $title = $thisuser->{'username'}; %>
Profile for <%= $thisuser->{'username'} %>


To discover the similarities of this person and you, create your
own profile! Once you are signed in, you will be able to see the details of
ALL the categories shown below. By opening these levels, you may see over a hundred different characteristics of a person and how these relate to you. The third column displays how closely your (or in this case the DEMO) information matches the person you are viewing. These similarities
will also be used to match you with other people. More...
<% } %>
| Similarity profile: |
| Category |
Detail |
Our similarity |
<% foreach my $a (@$array) { %>
<%
my $myprivacy = $user->{'privacy'};
my $otherprivacy = $thisuser->{'privacy'};
my $perc = 0;
my $level = $a->{'LEVEL'} * 4;
my $id = $a->{'id'};
if ($result->{$id}) {
$perc = $result->{$id}->{'PERCENTAGE'};
$perc = int ($perc);
}
my $class = 'tc';
$class = 'tcbase' if (not $level);
# privacy beallitasa: megjelenhet-e ez az attirbutum?
my $pub = 0; # nem publikus
my $maxprivacy = $myprivacy;
$maxprivacy = $otherprivacy if ($otherprivacy < $myprivacy);
if ( $a->{'privacy'} <= $maxprivacy ) { # ellenorizzuk a privacy-t
$pub = 1;
}
%>
| <%= ' ' x $level %><%= $a->{'name'} %> |
<%
if ( $pub ) { # ellenorizzuk a privacy-t
if ( ($a->{'myvalue'} =~ /^\d+$/) && (not $a->{'type'}) ) {
my $v = int ($a->{'myvalue'} * 0.5);
my $vm = 50-$v;
%>

<% } else { %>
<%= $a->{'myvalue'} %>
<% }
} else {
%>
*private*
<% } %>
|
<% if ($thisuser->{id} != $user->{id}) { %>
<% if ($pub) { %>
<% if ($perc < 0) {
$perc*=-1;
%>

<%= $perc %>%
<% } elsif ($perc) { %>

<%= $perc %>%
<% } %>
<% } else { %>
<% } %>
|
<% } else { %>
<% } %>
|
<% } %>
| Attribute |
Detail |
Our similarity |
<% if (not $demo) { %>
The details shown in this table reflect the layout of the search table. If you want to see other details here, you need to open the search table to those levels.
<% } %>
|
<% if ($friends && (@$friends > 0)) { %>
Friends of <%= $thisuser->{'username'} %>:
<% foreach my $f (@$friends) {
#next if ($f->{id} == $user->{id});
%>
<% if ($f->{id} != $user->{id}) { %>
<%= $f->{'username'} %>
<% } else { %>
<%= $f->{'username'} %>
<% } %>
<% } %>
<% } %>
Send a message to <%= $thisuser->{'username'} %>
<% if ($demo || (not ref $user) || (not $user->{id})) { %>
To contact or find out more about this person, sign up here for free!
<% } elsif ($user->{'regcode'}) { %>
You have not yet verified your e-mail address. You will not be able to send messages to others until your e-mail is verified. Please first activate your
account using the link sent to <%= $user->{'email'} %> after you had registered. In case the mail is not in your inbox, check your bulk e-mail folder.
If you want your user info and email
verification sent again to <%= $user->{'email'} %>, go here. If your e-mail is not <%=
$user->{'email'} %>, go here to change it.
<% } elsif ($thisuser->{'regcode'}) { %>
The email of this member has not been verified. They need to verify before you can send a message.
<% } elsif ((not $heis)&&(not $related)) { %>
Add this user to be able to communicate.
<% } elsif ((not $ami)&&(not $related)) { %>
You are still waiting for <%= $thisuser->{username} %> to add you as a friend, to be able to communicate.
A message has been sent to this person about your request.
You will be notified when this person adds you as a friend.
Make sure that your profile is as complete as possible, because that's what <%= $thisuser->{username} %> will
first see.
<% } else { %>
<%= $msg %>
<% } %>
<% if (not $user->{'regcode'}) { %>
<% # show only if there are IM clients set:
if ($api->isInstant($thisuser)) {
#if ( ($api->amIFriend($user->{'id'}, $thisuser->{'id'})) || ($thisuser->{'showim'}) ) {
if ( $ami2 || ($thisuser->{showim} && $related)) {
%>