1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
##################################
# PROFILE ########################
sub show_profile
{
my ($uname) = @_;
my $loggedin = ($USER != -1);
my $profile = get_user_profile($uname);
my $files = get_user_files($uname);
my $threads = get_threads_by_user($uname);
my $keywords = get_keywords();
my $image = get_profile_image($uname, $AVATAR_PROFILE_PREFIX);
print qq!<table border=0 cellpadding=0 cellspacing=0 width="100%">!;
print qq!<tr>!;
print qq!<td style="width: 300px; padding: 5px; vertical-align: top;">\n!;
print qq!<img src="$image"><br>! if ($image != -1);
print qq(<table border=0 cellpadding=0 cellspacing=0>);
profile_row("name", $$profile{realname});
my $email = $$profile{email};
$email =~ s/\@/ <i>at<\/i> /i;
profile_row("email", $email) if ($loggedin);
profile_row("aim", $$profile{aim}) if ($$profile{aim} && $loggedin);
profile_row("phone", $$profile{phone}) if ($$profile{phone} && $loggedin);
profile_row("location", $$profile{location}) if ($$profile{location});
my %tzs = ( -5 => eastern, -6 => central, -8 => pacific, 0 => englandish);
profile_row("timezone", $tzs{$profile->{timezone}}) if (exists $tzs{$profile->{timezone}});
if ((time - $$profile{lastseen}) < 60)
{ profile_row("last seen", "<b>active now</b>"); }
else
{ profile_row("last seen", verbosedate($$profile{lastseen})); }
if (($USER->{username} ne $uname) && $loggedin)
{
profile_row("· · · ·",
qq[<a href="$BUCKY/message/$uname">send $uname a message</a>]);
}
print "</table>";
if ($files != -1)
{
user_image_gallery({ files => $files, vertical => 1, count => 8 });
}
print qq(</td>);
print qq(<td style="padding: 10px; vertical-align: top; text-align: center;">\n);
if ($threads != -1)
{
print qq!<table border=0 cellpadding=0 cellspacing=0 class="threadmain" width="100%">!;
print qq(<tr><td colspan=255><big> threads by $uname</big></td></tr>);
print qq(<tr><td colspan=255><hr noshade color="$BUCKY_COLOR_HR" style="padding: 0px; margin: 2px;"></td></tr>);
thread_box({ threads => $threads, kw => 'USER', dosum => 0, dohead => 0 });
if ($files != -1)
{
print qq(<tr><td colspan=255><big> </big></td></tr>);
print qq(<tr><td colspan=255><big> files by $uname</big></td></tr>);
print qq(<tr><td colspan=255><hr noshade color="$BUCKY_COLOR_HR" style="padding: 0px; margin: 2px;"></td></tr>);
file_list($files, 0, 1, 0);
}
print "</table>\n";
print "<p>\n\n";
}
print qq(</td></tr>);
print qq(</table>);
footer();
}
sub profile_row
{
my ($k, $v) = @_;
print "<tr><td align=right valign=top nobreak><small>$k · </small></td><td align=left valign=top>$v</td></tr>";
}
# moves files around
sub update_profile_image
{
my ($username) = @_;
$filename = $input->{userpic};
return if (! -e $temp_path."/".$filename);
if ($filename =~ /temp_$/)
{ system($RM_PATH, $temp_path."/".$filename); return; }
if (-e $data_path."/profile/".$username.".jpg")
{
print "moving old profile pic...<br>";
system($MV_PATH, "$data_path/profile/$username.jpg", $data_path."/profile/".$username."-old.jpg");
}
$messages .= "updating profile pic for $username to $filename...<br>";
system($MV_PATH, "$temp_path/$filename", "$data_path/profile/$username.jpg");
update_profile_thumb($username);
return 1;
}
# creates avatars
sub update_profile_thumb
{
my ($username) = @_;
if (!-e "$data_path/profile/$username.jpg")
{
$messages .= "/profile/$username.jpg does not exist!" if $DEBUG;
return -1;
}
my $profile_image =
{
filename => "$username.jpg",
thread => "profile"
};
make_image_thumb({file => $profile_image, maxwidth => $AVATAR_PROFILE_WIDTH, maxheight => $AVATAR_PROFILE_HEIGHT, key => $AVATAR_PROFILE_PREFIX});
make_square_thumb($profile_image, $AVATAR_BIG_WIDTH, $AVATAR_BIG_PREFIX);
make_square_thumb($profile_image, $AVATAR_MED_WIDTH, $AVATAR_MED_PREFIX);
}
1;
|