############################################################################### # Profile.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 2.1 # # Released: November 8, 2005 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2005 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # # Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com # # Your source for web hosting, web design, and domains. # ############################################################################### $profileplver = 'YaBB 2.1 $Revision: 1.15 $'; if ($action eq 'detailedversion') { return 1; } LoadLanguage("Profile"); if (!$parseflash) { LoadLanguage("Display"); } if (-e "$vardir/gmodsettings.txt") { require "$vardir/gmodsettings.txt"; } # If someone registers with a '+' in their name It causes problems. # Get's turned into a in the query string Change it back here. # Users who register with spaces get them replaced with _ # So no problem there. $INFO{'username'} =~ tr/ /+/; sub ProfileCheck { my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } if ($iamguest) { &fatal_error($profile_txt{'1'}); } if ($user =~ m~/~) { &fatal_error($profile_txt{'224'}); } if ($user =~ m~\\~) { &fatal_error($profile_txt{'225'}); } if ($user ne $username && !$iamadmin && !$iamgmod) { &fatal_error($profile_txt{'80'}); } if ($iamgmod && ${$uid.$user}{'position'} eq "Administrator") { &fatal_error($profile_txt{'80'}); } if ($iamgmod && $user ne $username && !$allow_gmod_profile) { &fatal_error($profile_txt{'80'}); } if ($user eq "admin" && $username ne "admin") { &fatal_error($profile_txt{'80'}); } if (!-e ("$memberdir/$user.vars")) { &fatal_error("$profile_txt{'453'}"); } $yymain .= qq~
$profile_txt{'901'}
~; $yytitle = "$profile_txt{'900'}"; &template; } sub ProfileCheck2 { my $user = $INFO{'username'}; my $new_pass = $FORM{'passwrd'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } if ($iamguest) { &fatal_error($profile_txt{'1'}); } if ($user =~ m~/~) { &fatal_error($profile_txt{'224'}); } if ($user =~ m~\\~) { &fatal_error($profile_txt{'225'}); } if (!-e ("$memberdir/$user.vars")) { &fatal_error("$profile_txt{'453'}"); } if ($user ne $username && !$iamadmin && !$iamgmod) { &fatal_error($profile_txt{'80'}); } if ($iamgmod && $user ne $username && !$allow_gmod_profile) { &fatal_error($profile_txt{'80'}); } if ($user eq "admin" && $username ne "admin") { &fatal_error($profile_txt{'80'}); } if ($user eq $username) { if (&encode_password($new_pass) ne ${$uid.$user}{'password'}) { &fatal_error("$profile_txt{'822'}"); } } if (($iamadmin || ($iamgmod && $allow_gmod_profile))) { if (&encode_password($new_pass) ne ${$uid.$username}{'password'}) { &fatal_error("$profile_txt{'897'}"); } } # Get a semi-secure SID - only profile changes, so not full sessions # People would complain that they had to update their session otherwise $sid = reverse(substr(int(time), 6, 4)); $yySetLocation = qq~$scripturl?action=profile;username=$user;sid=$sid~; &redirectexit; } sub PrepareProfile { my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } if ($iamguest) { &fatal_error($profile_txt{'1'}); } if ($iamgmod && (${$uid.$user}{'position'} eq "Administrator" || ${$uid.$user}{'position'} eq "Administrator")) { &fatal_error($profile_txt{'80'}); } if ($user =~ m~/~) { &fatal_error($profile_txt{'224'}); } if ($user =~ m~\\~) { &fatal_error($profile_txt{'225'}); } if ($user ne $username && !$iamadmin && !$iamgmod) { &fatal_error($profile_txt{'80'}); } if ($iamgmod && $user ne $username && !$allow_gmod_profile) { &fatal_error($profile_txt{'80'}); } if ($user eq "admin" && $username ne "admin") { &fatal_error($profile_txt{'80'}); } if (!-e ("$memberdir/$user.vars")) { &fatal_error("$profile_txt{'453'}"); } if ($allowpics) { opendir(DIR, "$facesdir") || fatal_error("$profile_txt{'230'} ($facesdir)!
$profile_txt{'681'}", 1); closedir(DIR); } $dr = ${$uid.$user}{'regdate'} ? ${$uid.$user}{'regdate'} : $forumstart; $dr =~ m~(\d{2})\/(\d{2})\/(\d{2,4}).*?(\d{2})\:(\d{2})\:(\d{2})~is; $dr_month = $1; $dr_day = $2; $dr_year = $3; $dr_hour = $4; $dr_minute = $5; $dr_secund = $6; if (${$uid.$user}{'gender'} eq 'Male') { $GenderMale = ' selected="selected" '; } if (${$uid.$user}{'gender'} eq 'Female') { $GenderFemale = ' selected="selected" '; } &FromHTML(${$uid.$user}{'signature'}); $signature = ${$uid.$user}{'signature'}; &ToChars($signature); $signature =~ s/\&\&/\n/g; $signature =~ s//>/g; &CalcAge($user, "parse"); ${$uid.$user}{'aim'} =~ tr/+/ /; ${$uid.$user}{'yim'} =~ tr/+/ /; if (${$uid.$user}{'timeselect'} == 7) { $tsl7 = ' selected="selected" '; } elsif (${$uid.$user}{'timeselect'} == 6) { $tsl6 = ' selected="selected" '; } elsif (${$uid.$user}{'timeselect'} == 5) { $tsl5 = ' selected="selected" '; } elsif (${$uid.$user}{'timeselect'} == 4) { $tsl4 = ' selected="selected" '; } elsif (${$uid.$user}{'timeselect'} == 3) { $tsl3 = ' selected="selected" '; } elsif (${$uid.$user}{'timeselect'} == 2) { $tsl2 = ' selected="selected" '; } elsif (${$uid.$user}{'timeselect'} == 1) { $tsl1 = ' selected="selected" '; } elsif (${$uid.$user}{'timeselect'} == 0) { $tsl0 = ' selected="selected" '; } elsif ($timeselected == 7) { $tsl7 = ' selected="selected" '; } elsif ($timeselected == 6) { $tsl6 = ' selected="selected" '; } elsif ($timeselected == 5) { $tsl5 = ' selected="selected" '; } elsif ($timeselected == 4) { $tsl4 = ' selected="selected" '; } elsif ($timeselected == 3) { $tsl3 = ' selected="selected" '; } elsif ($timeselected == 2) { $tsl2 = ' selected="selected" '; } elsif ($timeselected == 1) { $tsl1 = ' selected="selected" '; } else { $tsl0 = ' selected="selected" '; } $pddd = ((${$uid.$user}{'timeoffset'} * 10) + 120); $pdel{$pddd} = ' selected="selected"'; $dayormonthm = qq~$profile_txt{'564'}~; $dayormonthd = qq~$profile_txt{'565'}~; if ($tsl2 || $tsl3 || $tsl6) { $dayormonth = $dayormonthd . $dayormonthm; } else { $dayormonth = $dayormonthm . $dayormonthd; } $proftime = &timeformat((time + (3600 * $timeoffset) - (${$uid.$user}{'timeoffset'} * 3600)), 1); @menucolors = qw(catbg catbg catbg catbg catbg); } sub ProfileMenu { my $user = $INFO{'username'}; $yymain .= qq~ ~; if ($iamadmin) { $yymain .= qq~ ~; } if ($iamgmod && $allow_gmod_profile && $gmod_access2{"profileAdmin"} eq "on") { $yymain .= qq~ ~; } $yymain .= qq~
$profile_txt{79} $profile_txt{819} $profile_txt{818} $profile_imtxt{56} $profile_txt{323}$profile_txt{820}$profile_txt{820}

~; } sub ModifyProfile { &SidCheck; &PrepareProfile; my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } $menucolors[0] = "titlebg"; &ProfileMenu; if ($iamadmin) { $confdel_text = "$profile_txt{'775'} $profile_txt{'777'} $INFO{'username'} $profile_txt{'778'}"; if ($user eq $username) { $passtext = qq~$profile_txt{'821'}~; } else { $passtext = qq~$profile_txt{'2'} $profile_txt{'36'}~; } } else { $confdel_text = "$profile_txt{'775'} $profile_txt{'776'} $profile_txt{'778'}"; $passtext = qq~$profile_txt{'821'}~; } $passtext .= qq~
$profile_txt{'895'}~; $yymain .= qq~
~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_editprofile($user, "edit"); if ($sessions == 1 && $sessionvalid == 1 && ($iamadmin || $iamgmod || $iammod) && $username eq $user) { &LoadLanguage("Sessions"); my $decanswer = &descramble(${$uid.$user}{'sesanswer'}, $user); $questsel = qq~\n~; $yymain .= qq~ ~; } $yymain .= qq~
$profile_txt{79} ($INFO{'username'})
$profile_txt{'698'}
$profile_txt{81}:
$profile_txt{'896'}
$profile_txt{82}:
$profile_txt{'896'}
$profile_txt{68}:
$profile_txt{231}:
$profile_txt{'563'}: $dayormonth$profile_txt{'566'}
$profile_txt{'227'}:
$img_txt{'34a'}
$session_txt{'9'}
$session_txt{'9a'}
$questsel
~; $yytitle = $profile_txt{'79'}; &template; exit; } sub ModifyProfileContacts { &SidCheck; &PrepareProfile; my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } $menucolors[1] = "titlebg"; &ProfileMenu; $yymain .= qq~
~; if ($allow_hide_email) { my $checked = ''; if (${$uid.$user}{'hidemail'} eq 'checked') { $checked = 'checked="checked"'; } $yymain .= qq~~; } $yymain .= qq~~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_editprofile($user,"contact") . qq~
$profile_txt{79} ($INFO{'username'}) » $profile_txt{819}
$profile_txt{'69'}:
$profile_txt{'679'}
$profile_txt{'721'}
$profile_txt{'513'}:
$profile_txt{'600'}
$profile_txt{'603'}:
$profile_txt{'601'}
$profile_txt{'604'}:
$profile_txt{'602'}
$profile_txt{'823'}:
$profile_txt{'824'}
$profile_txt{'825'}:
$profile_txt{'826'}
$profile_txt{'83'}:
$profile_txt{'598'}
$profile_txt{'84'}:
$profile_txt{'599'}
~; $yytitle = "$profile_txt{'79'} $profile_txt{'819'}"; &template; exit; } sub ModifyProfileOptions { &SidCheck; &PrepareProfile; my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } $menucolors[2] = "titlebg"; &ProfileMenu; &ToChars(${$uid.$user}{'usertext'}); $yymain .= qq~
~; if ($allowpics) { opendir(DIR, "$facesdir") || fatal_error("$profile_txt{'230'} ($facesdir)!
$profile_txt{'681'}", 1); @contents = readdir(DIR); closedir(DIR); $images = ""; foreach $line (sort @contents) { ($name, $extension) = split(/\./, $line); $checked = ""; if ($line eq ${$uid.$user}{'userpic'}) { $checked = ' selected="selected"'; } if (${$uid.$user}{'userpic'} =~ m~\Ahttp://~ && $line eq 'blank.gif') { $checked = ' selected="selected" '; } if ($extension =~ /gif/i || $extension =~ /jpg/i || $extension =~ /jpeg/i || $extension =~ /png/i) { if ($line eq 'blank.gif') { $images = qq~ \n$images~; } else { $images .= qq~ \n~; } } } if (${$uid.$user}{'userpic'} =~ m~\Ahttp://~) { $pic = 'blank.gif'; $checked = ' checked="checked" '; $tmp = ${$uid.$user}{'userpic'}; } else { $pic = ${$uid.$user}{'userpic'}; $tmp = 'http://'; } if(${$uid.$user}{'dsttimeoffset'}) { $dsttimechecked = qq~ checked="checked"~; } $yymain .= qq~ ~; } $yymain .= qq~ ~; &CheckNewTemplates; unless ($templatesloaded == 1) { require "$vardir/template.cfg"; } while (($curtemplate, $value) = each(%templateset)) { $selected = ""; if ($curtemplate eq ${$uid.$user}{'template'}) { $selected = qq~ selected="selected"~; $akttemplate = $curtemplate; } $drawndirs .= qq~\n~; } $yymain .= qq~~; opendir(dir, $langdir); my @lfilesanddirs = readdir(dir); close(dir); foreach $fld (@lfilesanddirs) { if (-d "$langdir/$fld" && $fld =~ m^\A[0-9a-zA-Z_\#\%\-\:\+\?\$\&\~\,\@/]+\Z^ && -e "$langdir/$fld/Main.lng") { if (${$uid.$user}{'language'} eq $fld) { $drawnldirs .= qq~~; } else { $drawnldirs .= qq~~; } } } $yymain .= qq~~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_editprofile($user,"options") . qq~
$profile_txt{'79'} ($INFO{'username'}) » $profile_txt{818}
$profile_txt{'229'}:
$profile_txt{'474'}
  
$profile_txt{'475'}  
$profile_txt{'228'}:
$profile_txt{'85'}:
$profile_txt{'606'}

$profile_txt{'664'}

$profile_txt{'486'}:
$profile_txt{'479'}
$profile_txt{'486a'}:
$profile_txt{'479a'}
$profile_txt{'371'}:
$profile_txt{'519'}

$profile_txt{'741'}: $proftime
$profile_txt{'519a'}
$profile_txt{'814'}
$profile_txt{'817'}
~; $yytitle = "$profile_txt{'79'} $profile_txt{'818'}"; &template; exit; } sub ModifyProfileIM { &SidCheck; &PrepareProfile; my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } $menucolors[3] = "titlebg"; &ProfileMenu; ${$uid.$user}{'im_ignorelist'} =~ s/[\n\r]//g; ${$uid.$user}{'im_ignorelist'} =~ s/\|/\n/g; ${$uid.$user}{'im_notify'} =~ s/[\n\r]//g; if (${$uid.$user}{'im_notify'}) { $sel0 = ''; $sel1 = ' selected="selected"'; } else { $sel0 = ' selected="selected"'; $sel1 = ''; } $yymain .= qq~
~; if ($enable_notification) { $yymain .= qq~~; } else { $yymain .= qq~~; } chomp(${$uid.$user}{'im_popup'}); chomp(${$uid.$user}{'im_imspop'}); if (${$uid.$user}{'im_popup'} eq "on") { $enable_userimpopup = 'checked="checked"'; } if (${$uid.$user}{'im_imspop'} eq "on") { $popup_userim = 'checked="checked"'; } $yymain .= qq~~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_editprofile($user,"im") . qq~
$profile_txt{79} ($INFO{'username'}) » $profile_imtxt{38}
$profile_txt{'325'}:
$profile_txt{'326'}
$profile_txt{'327'}:
$profile_imtxt{'53'}
$profile_imtxt{'05'}
~; $yytitle = "$profile_txt{'323'}: $profile_txt{'144'}"; &template; exit; } sub ModifyProfileAdmin { &SidCheck; &is_admin_or_gmod; &PrepareProfile; my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } $menucolors[4] = "titlebg"; &ProfileMenu; ($MemStatAdmin, $MemStarNumAdmin, $MemStarPicAdmin, $MemTypeColAdmin) = split(/\|/, $Group{"Administrator"}); ($MemStatGMod, $MemStarNumGMod, $MemStarPicGMod, $MemTypeColGMod) = split(/\|/, $Group{"Global Moderator"}); ($MemStatMod, $MemStarNumMod, $MemStarPicMod, $MemTypeColMod) = split(/\|/, $Group{"Moderator"}); if (${$uid.$user}{'position'} eq 'Administrator') { $tt = $MemStatAdmin; } elsif (${$uid.$user}{'position'} eq 'Global Moderator') { $tt = $MemStatGMod; } elsif (${$uid.$user}{'position'}) { $ttgrp = ${$uid.$user}{'position'}; ($tt, undef) = split(/\|/, $NoPost{$ttgrp}, 2); } else { $tt = ${$uid.$user}{'position'}; } $tta = ""; if (%NoPost) { $tta = &DrawGroups(${$uid.$user}{'addgroups'}, ${$uid.$user}{'position'}); $selsize = $k; if ($selsize > 6) { $selsize = 6; } } $userlastlogin = &timeformat(${$uid.$user}{'lastonline'}); $userlastpost = &timeformat(${$uid.$user}{'lastpost'}); $userlastim = &timeformat(${$uid.$user}{'lastim'}); if ($userlastlogin eq "") { $userlastlogin = "$profile_txt{'470'}"; } if ($userlastpost eq "") { $userlastpost = "$profile_txt{'470'}"; } if ($userlastim eq "") { $userlastim = "$profile_txt{'470'}"; } if (${$uid.$user}{'postcount'} > 100000) { ${$uid.$user}{'postcount'} = "$profile_txt{'683'}"; } $yymain .= qq~
~; if ($tta ne "") { $yymain .= qq~ ~; } if($dr_month > 12) { $dr_month = 12; } if($dr_month < 1) { $dr_month = 1; } if($dr_day > 31) { $dr_day = 31; } if($dr_day < 1) { $dr_day = 1; } if(length($dr_year) > 2) { $dr_year = substr($dr_year , length($dr_year) - 2, 2); } if($dr_year < 90 && $dr_year > 20) { $dr_year = 90; } if($dr_year > 20 && $dr_year < 90) { $dr_year = 20; } if($dr_hour > 23) { $dr_hour = 23; } if($dr_minute > 59) { $dr_minute = 59; } if($dr_secund > 59) { $dr_secund = 59; } $sel_day = qq~ \n~; $sel_month = qq~ \n~; $sel_year = qq~ \n~; $time_sel = ${$uid.$username}{'timeselect'}; if($time_sel == 1 || $time_sel == 4 || $time_sel == 5) { $all_date = qq~$sel_month $sel_day $sel_year~; } else { $all_date = qq~$sel_day $sel_month $sel_year~; } $sel_hour = qq~ \n~; $sel_minute = qq~ \n~; $sel_secund = qq~~; $all_time = qq~$sel_hour $sel_minute $sel_secund~; $yymain .= qq~ ~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_editprofile($user,"admin") . qq~
$profile_txt{79} ($INFO{'username'}) » $profile_txt{820}
$profile_txt{'21'}:
$profile_txt{'87'}:
$profile_txt{'87a'}:
$profile_txt{'87b'}
$profile_txt{'233'}: $all_date $maintxt{'107'} $all_time
$profile_amv_txt{'9'}: $userlastlogin
$profile_amv_txt{'10'}: $userlastpost
$profile_amv_txt{'11'}:

$userlastim

~; $yytitle = "$profile_txt{'79'} $profile_txt{'820'}"; &template; exit; } sub ModifyProfile2 { &SidCheck; $currentdate = timetostring(int(time)); my (%member, $key, $value, $newpassemail, @memberlist, $a, @check_settings, @reserve, $matchword, $matchcase, $matchuser, $matchname, $namecheck, $reserved, $reservecheck, @dirdata, $filename, @entries, $entry, $umail, @members, $tempname); $FORM{'signature'} =~ s~\n~\&\&~g; while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g; $member{$key} = $value; } my $user = $INFO{'username'}; $member{'username'} = $user; if (!${$uid.$user}{'password'}) { &LoadUser($user); } if ($sessions == 1 && $sessionvalid == 1 && ($iamadmin || $iamgmod) && $username eq $user) { &LoadLanguage("Sessions"); if ($member{'sesquest'} ne "password" && $member{'sesanswer'} eq "") { &fatal_error($session_txt{'7'}); } if ($member{'sesquest'} eq "password") { $member{'sesanswer'} = ""; } } # make sure this person has access to this profile if ($user eq "admin" && $username ne "admin") { &fatal_error($profile_txt{'80'}); } if ($user ne $username && !$iamadmin && (!$iamgmod || !$allow_gmod_profile)) { &fatal_error($profile_txt{'80'}); } if (!$iamadmin) { $member{'settings6'} = ${$uid.$user}{'postcount'}; $member{'settings7'} = ${$uid.$user}{'position'}; $member{'addgroup'} = ${$uid.$user}{'addgroups'}; } if ($member{'username'} =~ /\//) { &fatal_error($profile_txt{'224'}); } if ($member{'username'} =~ /\\/) { &fatal_error($profile_txt{'225'}); } my $encryptpassw = ${$uid.$user}{'password'}; my $encryptuname = &encode_password($member{'name'}); if ($member{'passwrd1'} || $member{'passwrd2'}) { &fatal_error("($member{'username'}) $profile_txt{'213'}") if ($member{'passwrd1'} ne $member{'passwrd2'}); &fatal_error("($member{'username'}) $profile_txt{'91'}") if ($member{'passwrd1'} eq ''); &fatal_error("$profile_txt{'240'} $profile_txt{'36'} $profile_txt{'241'}") if ($member{'passwrd1'} !~ /\A[\s0-9A-Za-z!@#$%\^&*\(\)_\+|`~\-=\\:;'",\.\/?\[\]\{\}]+\Z/); &fatal_error("$profile_txt{'7'}") if ($member{'username'} eq $member{'passwrd1'}); $member{'cpasswrd'} = $member{'passwrd1'}; my $passchanged = 1; } if ($member{'name'} eq '') { &fatal_error("$profile_txt{'75'}"); } &LoadCensorList; $censored_word = &CheckCensor("$member{'name'}"); $censored_name = &Censor("$member{'name'}"); if ($censored_name ne $member{'name'}) { &fatal_error("$profile_txt{'890'} $censored_word"); } &FromChars($member{'name'}); $convertstr = $member{'name'}; $convertcut = 30; &CountChars; $member{'name'} = $convertstr; &fatal_error("$profile_txt{'568'}") if ($cliped); &fatal_error("$profile_txt{'240'} $profile_txt{'68'} $profile_txt{'241'}") if ($member{'name'} !~ /^[\s0-9A-Za-z\x80-\xFF\[\]#%+,-|\.:=?@^_]+$/); &fatal_error("$profile_txt{'75'}") if ($member{'name'} eq '|'); if ($member{'bday1'} ne "" || $member{'bday2'} ne "" || $member{'bday3'} ne "") { &fatal_error("$profile_txt{'567'} 1 ($member{'bday1'}/$member{'bday2'}/$member{'bday3'})") if ($member{'bday1'} !~ /^[0-9]+$/ || $member{'bday2'} !~ /^[0-9]+$/ || $member{'bday3'} !~ /^[0-9]+$/ || length($member{'bday3'}) < 4); &fatal_error("$profile_txt{'567'} 2 ($member{'bday1'}/$member{'bday2'}/$member{'bday3'})") if ($member{'bday1'} < 1 || $member{'bday1'} > 12 || $member{'bday2'} < 1 || $member{'bday2'} > 31 || $member{'bday3'} < 1901 || $member{'bday3'} > $year - 5); } if ($member{'moda'} eq $profile_txt{'88'}) { $member{'bday1'} =~ s/[^0-9]//g; $member{'bday2'} =~ s/[^0-9]//g; $member{'bday3'} =~ s/[^0-9]//g; if ($member{'bday1'}) { $member{'bday'} = "$member{'bday1'}/$member{'bday2'}/$member{'bday3'}"; } else { $member{'bday'} = ''; } $tempname = $member{'name'}; &ToHTML($member{'gender'}); &ToHTML($member{'name'}); # Check to see if name is already taken or reserved fopen(FILE, "$vardir/reservecfg.txt") || &fatal_error("$profile_txt{'23'} reservecfg.txt", 1); @reservecfg = ; fclose(FILE); for ($a = 0; $a < @reservecfg; $a++) { chomp $reservecfg[$a]; } $matchword = $reservecfg[0] eq 'checked'; $matchcase = $reservecfg[1] eq 'checked'; $matchuser = $reservecfg[2] eq 'checked'; $matchname = $reservecfg[3] eq 'checked'; $namecheck = $matchcase eq 'checked' ? $member{'name'} : lc $member{'name'}; if($user ne "admin") { if ($encryptpassw eq $encryptuname) { &fatal_error("$profile_txt{'7'}"); } fopen(FILE, "$vardir/reserve.txt") || &fatal_error("$profile_txt{'23'} reserve.txt", 1); @reserve = ; fclose(FILE); foreach $reserved (@reserve) { chomp $reserved; $reservecheck = $matchcase ? $reserved : lc $reserved; if ($matchname) { if ($matchword) { if ($namecheck eq $reservecheck) { &fatal_error("$profile_txt{'244'} $namecheck"); } } else { if ($namecheck =~ $reservecheck) { &fatal_error("$profile_txt{'244'} $namecheck"); } } } } } require "$sourcedir/ExtendedProfiles.pl"; my $error = ext_validate_submition($username,$user); if ($error ne "") { &fatal_error($error); } if (${$uid.$user}{'realname'} ne $member{'name'}) { my $testname = lc $member{'name'}; $is_existing = &MemberIndex("check_exist", "$testname"); if (lc $is_existing eq $testname && lc $is_existing ne lc $user) { &fatal_error("($member{'name'}) $profile_txt{'473'}"); } #Since we haven't encountered a fatal error, time to rewrite our memberlist a little. &ToChars($member{'name'}); &ManageMemberinfo("update", $user, $member{'name'}); } # let's restore the name now &ToHTML($tempname); $member{'name'} = $tempname; &ToChars($member{'name'}); # Free code is the best code, like this code # Time to print the changes to the username.vars file if ($member{'passwrd1'}) { ${$uid.$user}{'password'} = &encode_password($member{'passwrd1'}); } ${$uid.$user}{'realname'} = "$member{'name'}"; ${$uid.$user}{'gender'} = "$member{'gender'}"; ${$uid.$user}{'location'} = "$member{'location'}"; ${$uid.$user}{'bday'} = "$member{'bday'}"; ${$uid.$user}{'sesquest'} = "$member{'sesquest'}"; ${$uid.$user}{'sesanswer'} = &scramble($member{'sesanswer'}, $user); ${$uid.$username}{'session'} = &encode_password($user_ip); if ($error eq "") { &ext_saveprofile($user); } &UserAccount($user, "update"); if ($username eq $user) { my $pword = ${$uid.$user}{'password'}; my $expiration = "Sunday, 17-Jan-2038 00:00:00 GMT"; &UpdateCookie("write", $user, $pword, ${$uid.$user}{'session'}, "/", $expiration); &LoadUser($user); } &WriteLog; $yySetLocation = qq~$scripturl?action=profileContacts;username=$member{'username'};sid=$INFO{'sid'}~; &redirectexit; } elsif ($member{'moda'} eq $profile_txt{'89'}) { &fatal_error("$profile_txt{'751'}") if ($member{'username'} eq 'admin'); # For security, remove username from mod position &KillModerator($member{'username'}); if ($iamadmin) { unlink("$memberdir/$member{'username'}.dat"); unlink("$memberdir/$member{'username'}.vars"); unlink("$memberdir/$member{'username'}.msg"); unlink("$memberdir/$member{'username'}.log"); unlink("$memberdir/$member{'username'}.rlog"); unlink("$memberdir/$member{'username'}.outbox"); unlink("$memberdir/$member{'username'}.storage"); $noteuser = $member{'username'}; } elsif ($member{'username'} eq $user) { unlink("$memberdir/$user.dat"); unlink("$memberdir/$user.vars"); unlink("$memberdir/$user.msg"); unlink("$memberdir/$user.log"); unlink("$memberdir/$user.rlog"); unlink("$memberdir/$user.outbox"); unlink("$memberdir/$user.storage"); $noteuser = $user; } opendir(DIRECTORY, "$datadir"); @dirdata = readdir(DIRECTORY); closedir(DIRECTORY); &getMailFiles; &MemberIndex("remove", $noteuser); if (!$iamadmin) { require "$sourcedir/LogInOut.pl"; &Logout; } $yySetLocation = qq~$scripturl~; &redirectexit; } else { &fatal_error("$polltxt{'13'}"); } exit; } sub ModifyProfileContacts2 { &SidCheck; my (%member, $key, $value, $newpassemail, @memberlist, $a, @check_settings, @reserve, $matchword, $matchcase, $matchuser, $matchname, $namecheck, $reserved, $reservecheck, @dirdata, $filename, @entries, $entry, $umail, @members, $tempname); while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g; $member{$key} = $value; } my $user = $INFO{'username'}; $member{'username'} = $user; if (!${$uid.$user}{'password'}) { &LoadUser($user); } # make sure this person has access to this profile if ($user ne $username && !$iamadmin && (!$iamgmod || !$allow_gmod_profile)) { &fatal_error($profile_txt{'80'}); } if (!$iamadmin) { $member{'settings6'} = ${$uid.$user}{'postcount'}; $member{'settings7'} = ${$uid.$user}{'position'}; $member{'addgroup'} = ${$uid.$user}{'addgroups'}; } if ($emailnewpass && lc $member{'email'} ne lc ${$uid.$user}{'email'} && !$iamadmin) { srand(); $member{'passwrd1'} = int(rand(100)); $member{'passwrd1'} =~ tr/0123456789/ymifxupbck/; $_ = int(rand(77)); $_ =~ tr/0123456789/q8dv7w4jm3/; $member{'passwrd1'} .= $_; $_ = int(rand(89)); $_ =~ tr/0123456789/y6uivpkcxw/; $member{'passwrd1'} .= $_; $_ = int(rand(188)); $_ =~ tr/0123456789/poiuytrewq/; $member{'passwrd1'} .= $_; $_ = int(rand(65)); $_ =~ tr/0123456789/lkjhgfdaut/; $member{'passwrd1'} .= $_; ${$uid.$user}{'password'} = &encode_password($member{'passwrd1'}); $newpassemail = 1; } &fatal_error("$profile_txt{'76'}") if ($member{'email'} eq ''); &fatal_error("$profile_txt{'240'} $profile_txt{'69'} $profile_txt{'241'}") if ($member{'email'} !~ /[\w\-\.\+]+\@[\w\-\.\+]+\.(\w{2,4}$)/); &fatal_error("$profile_txt{'500'}") if (($member{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/) || ($member{'email'} !~ /^.+@\[?(\w|[-.])+\.[a-zA-Z]{2,4}|[0-9]{1,4}\]?$/)); if ($member{'moda'} eq $profile_txt{'88'}) { $member{'icq'} =~ s/[^0-9]//g; $member{'aim'} =~ s/ /\+/g; $member{'yim'} =~ s/ /\+/g; $member{'msn'} =~ s/ /\+/g; # store the name temorarily so we can restore any _'s later $tempname = $member{'name'}; $member{'name'} =~ s/\_/ /g; &ToHTML($member{'aim'}); &ToHTML($member{'yim'}); &ToHTML($member{'msn'}); &ToHTML($member{'gtalk'}); &ToHTML($member{'weburl'}); &ToHTML($member{'webtitle'}); &ToHTML($member{'email'}); &ToHTML($FORM{'hideemail'}); require "$sourcedir/ExtendedProfiles.pl"; my $error = ext_validate_submition($username,$user); if ($error ne "") { &fatal_error($error); } # Check to see if email is already taken if (lc ${$uid.$user}{'email'} ne lc $member{'email'}) { $testemail = lc $member{'email'}; $is_existing = &MemberIndex("check_exist", "$testemail"); if (lc $is_existing eq $testemail) { &fatal_error("$profile_txt{'730'} ($member{'email'}) $profile_txt{'731'}"); } # Since we haven't encountered a fatal error, time to rewrite our memberlist a little. &ManageMemberinfo("update", $user, '', $member{'email'}); } # let's restore the name now &ToHTML($tempname); $member{'name'} = $tempname; # Time to print the changes to the username.vars file ${$uid.$user}{'email'} = $FORM{'email'}; ${$uid.$user}{'hidemail'} = $FORM{'hideemail'}; ${$uid.$user}{'icq'} = $FORM{'icq'}; ${$uid.$user}{'msn'} = $FORM{'msn'}; ${$uid.$user}{'yim'} = $FORM{'yim'}; ${$uid.$user}{'aim'} = $FORM{'aim'}; ${$uid.$user}{'msn'} = $FORM{'msn'}; ${$uid.$user}{'gtalk'} = $FORM{'gtalk'}; ${$uid.$user}{'webtitle'} = $FORM{'webtitle'}; ${$uid.$user}{'weburl'} = $FORM{'weburl'}; if ($error eq "") { &ext_saveprofile($user); } &UserAccount($user, "update"); &WriteLog; if ($emailnewpass && $newpassemail == 1) { # Write log fopen(LOG, "$vardir/log.txt"); @entries = ; fclose(LOG); fopen(LOG, ">$vardir/log.txt", 1); $field = "$user"; foreach $curentry (@entries) { $curentry =~ s/\n//g; ($name, $value) = split(/\|/, $curentry); if ($name ne "$field") { print LOG "$curentry\n"; } } fclose(LOG); if ($username eq $user) { &UpdateCookie("delete"); $username = 'Guest'; $iamguest = '1'; $iamadmin = ''; $iamgmod = ''; $password = ''; @settings = (); @immessages = (); $yyim = ""; $realname = ''; $realemail = ''; $ENV{'HTTP_COOKIE'} = ''; $yyuname = ""; } &FormatUserName($member{'username'}); &sendmail($member{'email'}, qq~$profile_txt{'700'} $mbname~, "$profile_txt{'733'} $member{'passwrd1'} $profile_txt{'734'} $member{'username'}.\n\n$profile_txt{'701'} $scripturl?action=profile;username=$useraccount{$member{'username'}}\n\n$profile_txt{'130'}"); require "$sourcedir/LogInOut.pl"; $sharedLogin_title = "$profile_txt{'34'}: $user"; $sharedLogin_text = "$profile_txt{'638'}"; $shared_login = &sharedLogin; $yymain .= qq~$shared_login~; $yytitle = "$profile_txt{'245'}"; &template; exit; } } else { &fatal_error("$polltxt{'13'}"); } $yySetLocation = qq~$scripturl?action=profileOptions;username=$member{'username'};sid=$INFO{'sid'}~; &redirectexit; exit; } sub ModifyProfileOptions2 { &SidCheck; my @onoff = qw/dsttimeoffset/; my $fi; map { $fi = lc $_; ${$_} = $FORM{$fi} eq 'on' ? 1 : 0; } @onoff; my (%member, $key, $value, $newpassemail, @memberlist, $a, @check_settings, @reserve, $matchword, $matchcase, $matchuser, $matchname, $namecheck, $reserved, $reservecheck, @dirdata, $filename, @entries, $entry, $umail, @members, $tempname); $FORM{'signature'} =~ s~\&\&~\&\;\&\;~g; $FORM{'signature'} =~ s~\n~\&\&~g; while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g; $member{$key} = $value; } my $user = $INFO{'username'}; $member{'username'} = $user; if (!${$uid.$user}{'password'}) { &LoadUser($user); } # make sure this person has access to this profile if ($user ne $username && !$iamadmin && (!$iamgmod || !$allow_gmod_profile)) { &fatal_error($profile_txt{'80'}); } if (!$iamadmin) { $member{'settings6'} = ${$uid.$user}{'postcount'}; $member{'settings7'} = ${$uid.$user}{'position'}; $member{'addgroup'} = ${$uid.$user}{'addgroups'}; } if ($member{'username'} =~ /\//) { &fatal_error($profile_txt{'224'}); } if ($member{'username'} =~ /\\/) { &fatal_error($profile_txt{'225'}); } $INFO{'username'} = $member{'username'}; &FromChars($member{'usertext'}); $convertstr = $member{'usertext'}; $convertcut = 51; &CountChars; $member{'usertext'} = $convertstr; if ($member{'userpicpersonalcheck'} && ($member{'userpicpersonal'} =~ m/\.gif\Z/i || $member{'userpicpersonal'} =~ m/\.jpg\Z/i || $member{'userpicpersonal'} =~ m/\.jpeg\Z/i || $member{'userpicpersonal'} =~ m/\.png\Z/i)) { $member{'userpic'} = $member{'userpicpersonal'}; } if ($member{'userpic'} eq "") { $member{'userpic'} = "blank.gif"; } &fatal_error("$profile_txt{'592'}") if ($member{'userpic'} !~ m^\A[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z^); if (!$allowpics) { $member{'userpic'} = "blank.gif"; } if ($member{'moda'} eq $profile_txt{'88'}) { &FromChars($member{'signature'}); $convertstr = $member{'signature'}; $convertcut = $MaxSigLen; &CountChars; $member{'signature'} = $convertstr; $member{'signature'} =~ s//>/g; # store the name temorarily so we can restore any _'s later $tempname = $member{'name'}; $member{'name'} =~ s/\_/ /g; if ($member{'usertemplate'} !~ m^\A[0-9a-zA-Z_\(\)\´\ \.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z^ && $member{'usertemplate'} ne "") { &fatal_error($profile_txt{'815'}); } if ($member{'usertemplate'} eq "") { $member{'usertemplate'} = "$template"; } if ($member{'userlanguage'} !~ m^\A[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z^ && $member{'userlanguage'} ne "") { &fatal_error($profile_txt{'815'}); } if (!$member{'userlanguage'}) { $member{'userlanguage'} = "$language"; } # update notifications if users language is changed if (${$uid.$user}{'language'} ne "$member{'userlanguage'}") { &getMailFiles; require "$sourcedir/Notify.pl"; &updateLanguage($user, $member{'userlanguage'}); } &ToHTML($member{'usertext'}); if (length $member{'signature'} > 1000) { $member{'signature'} = substr($member{'signature'}, 0, 1000); } &ToHTML($member{'signature'}); $member{'usertimeoffset'} =~ tr/,/./; $member{'usertimeoffset'} =~ s/[^\d*|\.|\-|w*]//g; if (($member{'usertimeoffset'} < -23.5) || ($member{'usertimeoffset'} > 23.5)) { &fatal_error($profile_txt{'487'}); } # let's restore the name now &ToHTML($tempname); $member{'name'} = $tempname; # Time to print the changes to the username.vars file ${$uid.$user}{'usertext'} = "$member{'usertext'}"; ${$uid.$user}{'userpic'} = "$member{'userpic'}"; ${$uid.$user}{'signature'} = "$member{'signature'}"; ${$uid.$user}{'timeoffset'} = "$member{'usertimeoffset'}"; ${$uid.$user}{'dsttimeoffset'} = "$dsttimeoffset"; ${$uid.$user}{'timeselect'} = "$member{'usertimeselect'}"; ${$uid.$user}{'template'} = "$member{'usertemplate'}"; ${$uid.$user}{'language'} = "$member{'userlanguage'}"; ${$uid.$user}{'timeformat'} = "$member{'timeformat'}"; require "$sourcedir/ExtendedProfiles.pl"; my $error = ext_validate_submition($username,$user); if ($error ne "") { &fatal_error($error); } else { &ext_saveprofile($user); } &UserAccount($user, "update"); $yySetLocation = qq~$scripturl?action=profileIM;username=$INFO{'username'};sid=$INFO{'sid'}~; &redirectexit; } else { &fatal_error("$polltxt{'13'}"); } exit; } sub ModifyProfileIM2 { &SidCheck; my ($ignorelist, $notify, $popup, $imprev, $imspop, $enableaim, $awayim); my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } # make sure this person has access to this profile if ($user ne $username && !$iamadmin && (!$iamgmod || !$allow_gmod_profile)) { &fatal_error($profile_txt{'80'}); } $ignorelist = "$FORM{'ignore'}"; $notify = "$FORM{'notify'}"; $popup = "$FORM{'userpopup'}"; $imspop = "$FORM{'popupims'}"; $ignorelist =~ s~\A\n\s*~~; $ignorelist =~ s~\s*\n\Z~~; $ignorelist =~ s~\n\s*\n~\n~g; $ignorelist =~ s~[\n\r]~\|~g; $ignorelist =~ s~\|\|~\|~g; $notify =~ s~[\n\r]~~g; $popup =~ s~[\n\r]~~g; $imspop =~ s~[\n\r]~~g; # Time to print the changes to the username.vars file ${$uid.$user}{'im_ignorelist'} = "$ignorelist"; ${$uid.$user}{'im_notify'} = "$notify"; ${$uid.$user}{'im_popup'} = "$popup"; ${$uid.$user}{'im_imspop'} = "$imspop"; require "$sourcedir/ExtendedProfiles.pl"; my $error = ext_validate_submition($username,$user); if ($error ne "") { &fatal_error($error); } else { &ext_saveprofile($user); } &UserAccount($user, "update"); if (!$iamadmin) { $yySetLocation = qq~$scripturl?action=viewprofile;username=$INFO{'username'};sid=$INFO{'sid'}~; &redirectexit; } else { $yySetLocation = qq~$scripturl?action=profileAdmin;username=$INFO{'username'};sid=$INFO{'sid'}~; &redirectexit; } } sub ModifyProfileAdmin2 { &SidCheck; &is_admin_or_gmod; my (%member, $key, $value, $newpassemail, @memberlist, @check_settings, @reserve, $matchword, $matchcase, $matchuser, $matchname, $namecheck, $reserved, $reservecheck, @dirdata, $filename, @entries, $entry, $umail, @members, $tempname); $FORM{'signature'} =~ s~\n~\&\&~g; while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g; $member{$key} = $value; } my $user = $INFO{'username'}; $member{'username'} = $user; if (!${$uid.$user}{'password'}) { &LoadUser($user); } $member{'addgroup'} =~ s/\, /\,/g; # make sure this person has access to this profile if ($user ne $username && !$iamadmin && (!$iamgmod || !$allow_gmod_profile)) { &fatal_error($profile_txt{'80'}); } if (!$iamadmin && ($member{'settings7'} eq "Administrator" || $member{'settings7'} eq "Global Moderator")) { $member{'settings7'} = ${$uid.$user}{'position'}; } if ($member{'settings6'} !~ /\A[0-9]+\Z/) { &fatal_error("$profile_txt{'749'}"); } &fatal_error("$profile_txt{'680'}") if ($member{'username'} eq "admin" && $member{'settings7'} ne "Administrator"); $dr_month = $member{'dr_month'}; $dr_day = $member{'dr_day'}; $dr_year = $member{'dr_year'}; $dr_hour = $member{'dr_hour'}; $dr_minute = $member{'dr_minute'}; $dr_secund = $member{'dr_secund'}; if($dr_month == 4 || $dr_month == 6 || $dr_month == 9 || $dr_month == 11) { $max_days = 30; } elsif($dr_month == 2 && $dr_year % 4 == 0) { $max_days = 29; } elsif($dr_month == 2 && $dr_year % 4 != 0) { $max_days = 28; } else { $max_days = 31; } if($dr_day > $max_days) { $dr_day = $max_days; } $member{'dr'} = qq~$dr_month/$dr_day/$dr_year $maintxt{'107'} $dr_hour:$dr_minute:$dr_secund~; if ($member{'settings6'} != ${$uid.$user}{'postcount'} || $member{'settings7'} ne ${$uid.$user}{'position'}) { if ($member{'settings7'}) { $grp_after = qq~$member{'settings7'}~; } else { foreach $postamount (sort { $b <=> $a } keys %Post) { if ($member{'settings6'} > $postamount) { ($title, undef) = split(/\|/, $Post{$postamount}, 2); $grp_after = $title; last; } } } &ManageMemberinfo("update", $user, '', '', $grp_after, $member{'settings6'}); } if ($member{'addgroup'} ne ${$uid.$user}{'addgroups'}) { &ManageMemberinfo("update", $user, '', '', '', '', $member{'addgroup'}); } if ($member{'dr'} ne ${$uid.$user}{'regdate'}) { $newreg = &stringtotime($member{'dr'}); $newreg = sprintf("%010d", $newreg); &ManageMemberlist("update", $user, $newreg); ${$uid.$user}{'regtime'} = "$newreg"; } if ($member{'moda'} eq $profile_txt{'88'}) { if (!$iamadmin) { $member{'dr'} = ${$uid.$user}{'regdate'}; } $member{'addgroup'} =~ s/\A\,//; ${$uid.$user}{'postcount'} = "$member{'settings6'}"; ${$uid.$user}{'position'} = "$member{'settings7'}"; ${$uid.$user}{'addgroups'} = "$member{'addgroup'}"; ${$uid.$user}{'regdate'} = "$member{'dr'}"; require "$sourcedir/ExtendedProfiles.pl"; my $error = ext_validate_submition($username,$user); if ($error ne "") { &fatal_error($error); } else { &ext_saveprofile($user); } &UserAccount($user,"update"); &WriteLog; $yySetLocation = qq~$scripturl?action=viewprofile;username=$member{'username'}~; &redirectexit; } else { &fatal_error("$profile_txt{'751'}"); } exit; } sub ViewProfile { # If someone registers with a '+' in their name It causes problems. # Get's turned into a in the query string Change it back here. # Users who register with spaces get them replaced with _ # So no problem there. $INFO{'username'} =~ tr/ /+/; if ($iamguest) { &fatal_error("$profile_txt{'223'}"); } if ($INFO{'username'} =~ /\//) { &fatal_error("$profile_txt{'224'}"); } if ($INFO{'username'} =~ /\\/) { &fatal_error("$profile_txt{'225'}"); } if (!-e ("$memberdir/$INFO{'username'}.vars")) { &fatal_error("$profile_txt{'453'}"); } my ($memberinfo, $modify, $email, $gender, $pic); # Convert forum start date to string, if there is no date set, # Defaults to 1st Jan, 2005 if ($forumstart) { $forumstart = &stringtotime($forumstart); } else { $forumstart = "1104537600"; } my $user = $INFO{'username'}; if (!${$uid.$user}{'password'}) { &LoadUser($user); } if (${$uid.$user}{'weburl'} !~ m~\Ahttp://~) { ${$uid.$user}{'weburl'} = "http://${$uid.$user}{'weburl'}"; } $memsettingsd[9] = ${$uid.$user}{'aim'}; $memsettingsd[9] =~ tr/+/ /; $memsettingsd[10] = ${$uid.$user}{'yim'}; $memsettingsd[10] =~ tr/+/ /; $dr = ""; if (${$uid.$user}{'regtime'} eq "") { $dr = "$profile_txt{'470'}"; } else { $dr = &timeformat(${$uid.$user}{'regtime'}); } &CalcAge($user, "calc"); # How old is he/she? &CalcAge($user, "isbday"); # is it the bday? if ($isbday) { $isbday = ""; } if ($user eq $username || $iamadmin || ($iamgmod && $allow_gmod_profile && ${$uid.$user}{'position'} ne "Administrator")) { $modify = qq~$img{'modify'}~; } if ($user eq "admin" && $username ne "admin") { $modify = ""; } if (${$uid.$user}{'hidemail'} ne "checked" || $iamadmin || !$allow_hide_email) { $email = qq~$profile_txt{'889'} ${$uid.$user}{'realname'}~; } else { $email = qq~$profile_txt{'722'}~; } $gender = ""; if (${$uid.$user}{'gender'} eq "Male") { $gender = qq~$profile_txt{'238'}~; } if (${$uid.$user}{'gender'} eq "Female") { $gender = qq~$profile_txt{'239'}~; } $pic_row = ""; if ($allowpics) { $avstyle = ""; if ($ENV{'HTTP_USER_AGENT'} !~ /MSIE/ || $ENV{'HTTP_USER_AGENT'} =~ /Opera/) { if ($ENV{'HTTP_USER_AGENT'} =~ /Safari/) { $avstyle = qq~ style="max-width: 65px; max-height: 65px;"~; } else { $avstyle = qq~ style="max-width: 65px;"~; } } if (${$uid.$user}{'userpic'} =~ /^\http:\/\//) { $pic = qq~~; } else { $pic = qq~~; } if (${$uid.$user}{'userpic'} eq "blank.gif") { $pic = qq~~; } $pic_row = qq~
$pic
~; } $online = qq~${$uid.$user}{'realname'} $profile_txt{'113'} $profile_txt{'687'}~; fopen(FILE, "$vardir/log.txt"); @entries = ; fclose(FILE); foreach $curentry (@entries) { chomp $curentry; ($name, $value) = split(/\|/, $curentry); if ($name) { &LoadUser($name); if (lc $name eq lc $INFO{'username'}) { $online = qq~${$uid.$user}{'realname'} $profile_txt{'113'} $profile_txt{'686'}~; } } } # Hide empty profile fields from display if ($addmembergroup{$user}) { $showaddgr = $addmembergroup{$user}; $showaddgr =~ s/
/\, /g; $showaddgr =~ s/\A, //; $showaddgr =~ s/, \Z//; $row_addgrp .= qq~
$showaddgr~; } else { $row_addgrp = ""; } if (${$uid.$user}{'gender'}) { if (${$uid.$user}{'gender'} eq "Male") { $gender = qq~$profile_txt{'238'}~; } elsif (${$uid.$user}{'gender'} eq "Female") { $gender = qq~$profile_txt{'239'}~; } $row_gender = qq~
$profile_txt{'231'}:
$gender
~; } else { $row_gender = ""; } if ($age) { $row_age = qq~
$profile_txt{'420'}:
$age   $isbday
~; } else { $row_age = ""; } if (${$uid.$user}{'location'}) { $row_location = qq~
$profile_txt{'227'}:
${$uid.$user}{'location'}
~; } else { $row_location = ""; } if (${$uid.$user}{'icq'} && ${$uid.$user}{'icq'} !~ m/\D/) { $row_icq .= qq~
$profile_txt{'513'}:
~; } else { $row_icq = ""; } if (${$uid.$user}{'aim'}) { $row_aim = qq~
$profile_txt{'603'}:
~; } else { $row_aim = ""; } if (${$uid.$user}{'yim'}) { $row_yim = qq~
$profile_txt{'604'}:
~; } else { $row_yim = ""; } if (${$uid.$user}{'msn'}) { $row_msn = qq~
$profile_txt{'823'}:
~; } else { $row_msn = ""; } if (${$uid.$user}{'gtalk'}) { $row_gtalk = qq~
$profile_txt{'825'}:
~; } else { $row_gtalk = ""; } if (${$uid.$user}{'hidemail'} ne "checked" || $iamadmin || !$allow_hide_email) { $row_email = qq~
$profile_txt{'69'}:
~; } else { $row_email = ""; } if (${$uid.$user}{'weburl'} && ${$uid.$user}{'webtitle'}) { $row_website = qq~
$profile_txt{'96'}:
~; } else { $row_website = ""; } if (${$uid.$user}{'signature'}) { # do some ubbc on the signature to display in the view profile area &FromHTML(${$uid.$user}{'signature'}); ${$uid.$user}{'signature'} =~ s~\&\&~
~g; $message = ${$uid.$user}{'signature'}; $displayname = ${$uid.$user}{'realname'}; if ($enable_ubbc) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &LoadCensorList; # Censor the signature. $message = &Censor($message); &ToChars($message); ${$uid.$user}{'signature'} = $message; # Censor the usertext $message = ${$uid.$user}{'usertext'}; $message = &Censor($message); &ToChars($message); ${$uid.$user}{'usertext'} = $message; $row_signature = qq~   $profile_txt{'85'}
${$uid.$user}{'signature'}
~; } else { $row_signature = ""; } # End empty field checking $wrapcut = 20; $wrapstr = ${$uid.$user}{'usertext'}; &WrapChars; ${$uid.$user}{'usertext'} = $wrapstr; # Just maths below... $post_count = ${$uid.$user}{'postcount'}; if (!$post_count) { $post_count = 0 } $string_regdate = &stringtotime(${$uid.$user}{'regdate'}); $string_curdate = int(time); if ($string_regdate < $forumstart) { $string_regdate = $forumstart } if ($string_curdate < $forumstart) { $string_curdate = $forumstart } $member_for_days = int(($string_curdate - $string_regdate) / 86400); if ($member_for_days < 1) { $tmpmember_for_days = 1; } else { $tmpmember_for_days = $member_for_days; } $post_per_day = sprintf("%.2f", ($post_count / $tmpmember_for_days)); # End statistics. if (${$uid.$user}{'usertext'}) { $showusertext = ${$uid.$user}{'usertext'}; $showusertext =~ s/
/ /g; } else { $showusertext = ""; } $yymain .= qq~ ~; } require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_viewprofile($user); $yymain .= qq~ ~; $userlastlogin = &timeformat(${$uid.$user}{'lastonline'}); $userlastpost = &timeformat(${$uid.$user}{'lastpost'}); $userlastim = &timeformat(${$uid.$user}{'lastim'}); if ($userlastlogin eq "") { $userlastlogin = "$profile_txt{'470'}"; } if ($userlastpost eq "") { $userlastpost = "$profile_txt{'470'}"; } if ($userlastim eq "") { $userlastim = "$profile_txt{'470'}"; } if (${$uid.$user}{'postcount'} > 100000) { ${$uid.$user}{'postcount'} = "$profile_txt{'683'}"; } $yymain .= qq~ $row_signature ~; if ($iamguest) { &fatal_error("$profile_txt{'223'}"); } if ($INFO{'username'} =~ /\//) { &fatal_error("$profile_txt{'224'}"); } if ($INFO{'username'} =~ /\\/) { &fatal_error("$profile_txt{'225'}"); } if (!-e ("$memberdir/$INFO{'username'}.vars")) { &fatal_error("$profile_txt{'453'}"); } &spam_protection; my $curuser = $INFO{'username'}; &FormatUserName($curuser); if ($curuser =~ m~/~) { &fatal_error($profile_txt{'224'}); } if ($curuser =~ m~\\~) { &fatal_error($profile_txt{'225'}); } my $display = $FORM{'viewscount'} || 5; if ($display =~ /\D/) { &fatal_error($profile_txt{'337'}); } # added to avoid flooding by abusing viewcount form inputs if ($display > $maxrecentdisplay) { $display = $maxrecentdisplay; } my (%data, $numfound, $oldestfound, $curcat, %catname, %cataccess, %catboards, $openmemgr, @membergroups, $tmpa, %openmemgr, $curboard, @threads, @boardinfo, $i, $c, @messages, $tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mns, $mtime, $counter, $board, $notify); &LoadCensorList; unless ($recentloaded) { &Recent_Load($curuser); } unless ($mloaded == 1) { require "$boardsdir/forum.master"; } foreach $catid (@categoryorder) { $boardlist = $cat{$catid}; (@bdlist) = split(/\,/, $boardlist); ($catname, $catperms) = split(/\|/, $catinfo{"$catid"}); &ToChars($catname); $cataccess = &CatAccess($catperms); if (!$cataccess) { next; } boardcheck: foreach $curboard (@bdlist) { ($boardname{$curboard}, $boardperms, $boardview) = split(/\|/, $board{"$curboard"}); my $access = &AccessCheck($curboard, '', $boardperms); if (!$iamadmin && $access ne "granted" && $boardview != 1) { next; } $catname{$curboard} = $catname; fopen(FILE, "$boardsdir/$curboard.txt"); @threads = ; fclose(FILE); if (@threads > $display) { $ii = @threads; } else { $ii = $display; } threadcheck: for ($i = 0; $i < $ii; $i++) { chomp $threads[$i]; ($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate) = split(/\|/, $threads[$i]); if (exists($recent{$tnum})) { unless ($tstate =~ /h/) { fopen(FILE, "$datadir/$tnum.txt") || next; @messages = ; fclose(FILE); for ($c = 0; $c < @messages; $c++) { chomp $messages[$c]; ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns) = split(/\|/, $messages[$c]); if ($curuser eq $musername) { $mtime = $mdate; if ($numfound >= $display && $mtime <= $oldestfound) { next boardcheck; } else { $data{$mtime} = [$curboard, $tnum, $c, $msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns]; if ($mtime < $oldestfound) { $oldestfound = $mtime; } ++$numfound; } #end if } #end if } #end for ($c } #end unless($tstate } else { next; } # end if exists } #end threadcheck } #endboardcheck } #end of foreach $catid( @messages = sort { $b <=> $a } keys %data; if (@messages > $display) { $#messages = $display - 1; } $counter = 1; for ($i = 0; $i < @messages; $i++) { ($board, $tnum, $c, $msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $message, $mns) = @{ $data{ $messages[$i] } }; $message = &Censor($message); $msub = &Censor($msub); &wrap; $displayname = $mname; if ($enable_ubbc) { $ns = $mns; if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; &ToChars($msub); &ToChars($message); &ToChars($boardname{$board}); if ($enable_notification) { $notify = qq~$menusep$img{'notify'}~; } $mdate = timeformat($mdate); # Get the class of this thread, based on lock status and number of replies. if ($annboard eq $currentboard && !$iamadmin && !$iamgmod) { $replybutton = ""; } elsif (&AccessCheck($currentboard, 2) eq "granted") { $replybutton = qq~$menusep$img{'reply'} ~; $quotebutton = qq~$menusep$img{'replyquote'}~; } else { $replybutton = ""; } if (!$iamguest) { require "$sourcedir/Favorites.pl"; $notify = $notify; } else { $notify = ""; } $yymain .= qq~
  $profile_txt{'35'}: $INFO{'username'}
$modify
$pic_row $online ${$uid.$user}{'realname'}
$col_title{$user} $row_addgrp
$showusertext
$profile_txt{'21'}:
${$uid.$user}{'postcount'}
$post_per_day
$profile_txt{'893'}
$profile_txt{'233'}:
$dr
$member_for_days $profile_txt{'894'}
~; if ($row_gender || $row_age || $row_location) { $yymain .= qq~ $row_gender $row_age $row_location
  $profile_txt{'819'}
$profile_txt{'144'}:          $profile_txt{'688'} ${$uid.$user}{'realname'}
$row_email $row_website $row_aim $row_msn $row_yim $row_gtalk $row_icq
  $profile_txt{'459'}
$profile_amv_txt{'9'}:
$userlastlogin
$profile_amv_txt{'10'}:
$userlastpost
$profile_amv_txt{'11'}:
$userlastim
  Recent Posts
$counter  $catname{$board} / $boardname{$board} / $msub
 $profile_txt{'30'}: $mdate 
$message
$replybutton $quotebutton $notify  

~; $yymain .= qq~ ~; } $yytitle = "$profile_txt{'458'} $memset[1]" &template; exit; } sub DrawGroups { my ($availgroups) = @_[0]; my ($userpos) = @_[1]; my @groups, $foundit, %found, $groupsel, $groupsel2, $name; %found = (); if ($availgroups eq "") { $availgroups = "xk8yj56ndkal"; } (@groups) = split(/\,/, $availgroups); $groupsel = "\n"; $groupsel2 = ""; $count = 0; foreach $curgroup (@groups) { $foundit = 0; chomp $curgroup; if ($foundit != 1 || $count == $#groups) { $k = 0; foreach my $key (sort { $a <=> $b } keys %NoPost) { ($name, undef) = split(/\|/, $NoPost{$key}, 2); if ($key ne $userpos) { if ($curgroup eq $key) { $foundit = 1; $found{$key} = 1; $groupsel .= qq~\n~; } if ($found{$key} != 1 && $count == $#groups) { $groupsel2 .= qq~\n~; } $k++; } } } $count++; } $groupsel .= $groupsel2; $groupsel .= ""; return $groupsel; } sub SidCheck { # Check that profile-editing session is still valid $sid_check = substr(int(time), 6, 4); $cur_sid = reverse($INFO{'sid'}); if ($cur_sid < 9700) { $cur_sid += 300; } else { $sid_check -= 300; } if ($cur_sid < $sid_check) { &fatal_error("$profile_txt{'898'} $profile_txt{'899'}"); } else { return 1; } } 1;