############################################################################### # Profile.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 3.0 Beta # # Packaged: October 05, 2010 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2010 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### $profileplver = 'YaBB 3.0 Beta $Revision: 388 $'; if ($action eq 'detailedversion') { return 1; } &LoadLanguage('Profile'); if ($iamgmod && -e "$vardir/gmodsettings.txt") { require "$vardir/gmodsettings.txt"; } use utf8; # this file contains UTF-8 characters # make sure this person has access to this profile sub PrepareProfile { if ($iamguest) { &fatal_error('no_access'); } # 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/ /+/; $user = $INFO{'username'}; if ($do_scramble_id) { &decloak($user); } if ($user =~ m~/~) { &fatal_error('no_user_slash'); } if ($user =~ m~\\~) { &fatal_error('no_user_backslash'); } unless (&LoadUser($user)) { &fatal_error('no_profile_exists'); } if (($user ne $username && !$iamadmin && (!$iamgmod || !$allow_gmod_profile)) || ($user eq 'admin' && $username ne 'admin') || ($iamgmod && ${$uid.$user}{'position'} eq 'Administrator')) { &fatal_error('not_allowed_profile_change'); } @menucolors = qw(catbg catbg catbg catbg catbg catbg); } # Check that profile-editing session is still valid sub SidCheck { my $cur_sid = &decloak($INFO{'sid'}); my $sid_check = substr($date, 5, 5); if ($sid_check <= 600 && $cur_sid >= 99400) { $sid_check += 100000; } $sid_expires = $cur_sid + 600 - $sid_check; &ProfileCheck($_[0]) if $sid_expires < 0 || $cur_sid > $sid_check; } sub ProfileCheck { &PrepareProfile; my $sid_descript = $mycenter_profile_txt{siddescript}; if ($_[0]) { $sid_descript = $mycenter_profile_txt{timeoutdescript}; $redirsid = $_[0]; $yyjavascript .= qq~\nalert("$profile_txt{'897'}");~ if $redirsid =~ s/2$//; } else { $redirsid = $INFO{'page'} || 'profile'; } $yymain .= qq~
  $profile_txt{'901'}  
~; $yynavigation = qq~› $profile_txt{'900'}~; $yytitle = $profile_txt{'900'}; &template; } sub ProfileCheck2 { &PrepareProfile; my $password = &encode_password($FORM{'passwrd'} || $INFO{'passwrd'}); if ($user eq $username && $password ne ${$uid.$username}{'password'}) { &fatal_error('current_password_wrong'); } if (($iamadmin || ($iamgmod && $allow_gmod_profile)) && $password ne ${$uid.$username}{'password'}) { &fatal_error('no_admin_password'); } # Update the sessionID too ${$uid.$username}{'session'} = &encode_password($user_ip); &UserAccount($username, "update"); # update only this cookie since we don't know when the others will expire $yySetCookies3 = &write_cookie( -name => $cookiesession_name, -value => ${$uid.$username}{'session'}, -path => "/", -expires => "Sunday, 17-Jan-2038 00:00:00 GMT"); # Get a semi-secure SID - only for profile changes # cloak the sid -> no point giving anyone the means. $yySetLocation = "$scripturl?action=" . ($FORM{'redir'} || $INFO{'redir'} || 'profile') . ";username=$useraccount{$user};sid=" . &cloak(reverse(substr($date, 5, 5))) . ($INFO{'newpassword'} ? ";newpassword=1" : ""); &redirectexit; } sub ProfileMenu { return if $view; $yymain .= qq~ ~; if ($buddyListEnabled){ $yymain .= qq~ ~; } if ($PM_level == 1 || ($PM_level == 2 && $staff) || ($PM_level == 3 && ($iamadmin || $iamgmod))) { $yymain .= qq~ ~; } if ($iamadmin || ($iamgmod && $allow_gmod_profile && $gmod_access2{'profileAdmin'} eq 'on')) { $yymain .= qq~ ~; } $yymain .= qq~
$profile_txt{79} $profile_txt{819} $profile_txt{818}$profile_buddy_list{'buddylist'}$profile_imtxt{56} $profile_txt{323}$profile_txt{820}

~; } sub ModifyProfile { &SidCheck($action); &PrepareProfile; $menucolors[0] = "titlebg"; &ProfileMenu; if ($iamadmin) { $confdel_text = qq~$profile_txt{'775'} $profile_txt{'777'} $user $profile_txt{'778'}~; if ($user eq $username) { $passtext = $profile_txt{'821'}; } else { $passtext = qq~$profile_txt{'2'} $profile_txt{'36'}~; } } else { $confdel_text = qq~$profile_txt{'775'} $profile_txt{'776'} $profile_txt{'778'}~; $passtext = $profile_txt{'821'}; } $passtext .= qq~
$profile_txt{'895'}~; my $scriptAction = qq~profile2~; if ($view) { $scriptAction = qq~myprofile2~; $yytitle = $profile_txt{'editmyprofile'}; $profiletitle = qq~$profile_txt{'editmyprofile'} ($user)~; $yynavigation = qq~› $img_txt{'mycenter'} › $profiletitle~; } else { $yytitle = $profile_txt{'79'}; $profiletitle = qq~$profile_txt{'79'} ($user)~; $yynavigation = qq~› $profiletitle~; } if (${$uid.$user}{'gender'} eq 'Male') { $GenderMale = ' selected="selected" '; } if (${$uid.$user}{'gender'} eq 'Female') { $GenderFemale = ' selected="selected" '; } &CalcAge($user, "parse"); # EventCal Begin $selectyear = ''; $seluyear = qq~$profile_txt{'566'} ~; $selectmnth = ''; $dayormonthm = qq~ ~; $selectday = ''; $dayormonthd = qq~ ~; # EventCal End if (${$uid.$user}{'timeselect'} == 6 || ${$uid.$user}{'timeselect'} == 3 || ${$uid.$user}{'timeselect'} == 2) { $dayormonth = $dayormonthd . $dayormonthm; } else { $dayormonth = $dayormonthm . $dayormonthd; } $dayormonth =~ s/for="bday\d"/for="birthday"/o; $dayormonth =~ s/id="bday\d"/id="birthday"/o; &LoadLanguage('Register'); $showProfile .= qq~
~; if ($extendedprofiles) { require "$sourcedir/ExtendedProfiles.pl"; $showProfile .= &ext_editprofile($user, "edit"); } if ($sessions == 1 && $staff && $username eq $user) { &LoadLanguage('Sessions'); require "$sourcedir/Decoder.pl"; my $decanswer = &descramble(${$uid.$user}{'sesanswer'}, $user); $questsel = qq~\n~; $showProfile .= qq~ ~; } $showProfile .= qq~
$profiletitle
$profile_txt{'698'}~ . ($INFO{'newpassword'} ? $profile_txt{'80'} : "") . qq~
 
 
~; } else { $showProfile .= qq~ $profile_txt{'9'}~; } } $showProfile .= qq~
$dayormonth$seluyear
$questsel
~; if ($user ne "admin" && ($iamadmin || $allow_self_del)) { $showProfile .= qq~       ~; } $showProfile .= qq~
$profile_txt{'sid_expires_1'} $sid_expires $profile_txt{'sid_expires_2'}
~; if (!$view) { $yymain .= $showProfile; &template; } } sub ModifyProfileContacts { &SidCheck($action); &PrepareProfile; $menucolors[1] = "titlebg"; &ProfileMenu; my $scriptAction = qq~profileContacts2~; if ($view) { $scriptAction = qq~myprofileContacts2~; $yytitle = qq~$profile_txt{'editmyprofile'} › $profile_txt{'819'}~; $profiletitle = qq~$profile_txt{'editmyprofile'} ($user) › $profile_txt{'819'}~; $yynavigation = qq~› $img_txt{'mycenter'} › $profiletitle~; } else { $yytitle = qq~$profile_txt{'79'} › $profile_txt{'819'}~; $profiletitle = qq~$profile_txt{'79'} ($user) › $profile_txt{'819'}~; $yynavigation = qq~› $profiletitle~; } ${$uid.$user}{'aim'} =~ tr/+/ /; ${$uid.$user}{'yim'} =~ tr/+/ /; $showProfile .= qq~
~; if ($allow_hide_email) { my $checked = ''; if (${$uid.$user}{'hidemail'}) { $checked = ' checked="checked"'; } $showProfile .= qq~ ~; } $showProfile .= qq~ ~; if (($PM_level == 1 || ($PM_level == 2 && $staff) || ($PM_level == 3 && ($iamadmin || $iamgmod))) && ($enable_MCaway > 2 || ($enable_MCaway && (${$uid.$user}{'position'} eq 'Administrator' || ${$uid.$user}{'position'} eq 'Global Moderator' || &is_moderator($user))))) { my $offChecked = qq~ selected="selected"~; my $awayChecked = ''; if (${$uid.$user}{'offlinestatus'} eq 'away') { $offChecked = ''; $awayChecked = qq~ selected="selected"~; } my $awayreply = ${$uid.$user}{'awayreply'}; $awayreply =~ s~
~\n~g; $showProfile .= qq~ ~; } if ((${$uid.$user}{'position'} eq 'Administrator' || ${$uid.$user}{'position'} eq 'Global Moderator') && $enable_MCstatusStealth) { my $stealthChecked = ''; if (${$uid.$user}{'stealth'}) { $stealthChecked = ' checked="checked"'; } $showProfile .= qq~ ~; } if ($extendedprofiles) { require "$sourcedir/ExtendedProfiles.pl"; $showProfile .= &ext_editprofile($user,"contact"); } $showProfile .= qq~
$profiletitle









$profile_txt{'664a'}

$profile_txt{'sid_expires_1'} $sid_expires $profile_txt{'sid_expires_2'}
~; if (!$view) { $yymain .= $showProfile; &template; } } sub ModifyProfileOptions { &SidCheck($action); &PrepareProfile; $menucolors[2] = "titlebg"; &ProfileMenu; my $scriptAction = qq~profileOptions2~; if ($view) { $scriptAction = qq~myprofileOptions2~; $yytitle = qq~$profile_txt{'editmyprofile'} › $profile_txt{'818'}~; $profiletitle = qq~$profile_txt{'editmyprofile'} ($user) › $profile_txt{'818'}~; $yynavigation = qq~› $img_txt{'mycenter'} › $profiletitle~; } else { $yytitle = qq~$profile_txt{'79'} › $profile_txt{'818'}~; $profiletitle = qq~$profile_txt{'79'} ($user) › $profile_txt{'818'}~; $yynavigation = qq~› $profiletitle~; } if ($allowpics && $upload_useravatar && $upload_avatargroup) { $upload_useravatar = 0; foreach my $av_gr (split(/, /, $upload_avatargroup)) { if ($av_gr eq ${$uid.$user}{'position'}) { $upload_useravatar = 1; last; } foreach (split(/,/, ${$uid.$user}{'addgroups'})) { if ($av_gr eq $_) { $upload_useravatar = 1; last; } } } } $showProfile .= qq~
~; if ($allowpics) { opendir(DIR, "$facesdir") || fatal_error("cannot_open_dir","($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~\Ahttps?://~ && $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~; } } } my ($pic,$tmp,$s,$alt); $tmp = $facesurl; $tmp =~ /^(http(s?):\/\/)/; ($tmp,$s) = ($1,$2); if (${$uid.$user}{'userpic'} =~ m~\Ahttps?://~) { $pic = ${$uid.$user}{'userpic'}; $checked = ' checked="checked" '; $tmp = ${$uid.$user}{'userpic'}; $alt = $profile_txt{'473'} if $upload_useravatar; } else { $pic = "$facesurl/${$uid.$user}{'userpic'}"; } $showProfile .= qq~ ~; } $signature = ${$uid.$user}{'signature'}; $signature =~ s//\n/g; $showProfile .= qq~ ~; if ($addmemgroup_enabled > 1 && %NoPost) { my ($addmemgroup, $selsize) = &DrawGroups(${$uid.$user}{'addgroups'}, ${$uid.$user}{'position'}, 0); $showProfile .= qq~ ~ if $addmemgroup; } if (${$uid.$user}{'numberformat'} == 1) { $unfsl1 = ' selected="selected" '; } elsif (${$uid.$user}{'numberformat'} == 2) { $unfsl2 = ' selected="selected" '; } elsif (${$uid.$user}{'numberformat'} == 3) { $unfsl3 = ' selected="selected" '; } elsif (${$uid.$user}{'numberformat'} == 4) { $unfsl4 = ' selected="selected" '; } elsif (${$uid.$user}{'numberformat'} == 5) { $unfsl5 = ' selected="selected" '; } elsif ($forumnumberformat == 1) { $unfsl1 = ' selected="selected" '; } elsif ($forumnumberformat == 2) { $unfsl2 = ' selected="selected" '; } elsif ($forumnumberformat == 3) { $unfsl3 = ' selected="selected" '; } elsif ($forumnumberformat == 4) { $unfsl4 = ' selected="selected" '; } elsif ($forumnumberformat == 5) { $unfsl5 = ' selected="selected" '; } 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'} == 8) { $tsl8 = ' selected="selected" '; } elsif ($timeselected == 8) { $tsl8 = ' 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" '; } my @usertimeoffset = split(/\./, ${$uid.$user}{'timeoffset'}); $showProfile .= qq~ ~; # This is only for update, when comming from YaBB lower or equal version 2.2.3 # I think it can be deleted around version 2.4.0 without causing mayor issues (deti). if ($enable_notifications eq '') { $enable_notifications = $enable_notification ? 3 : 0; } # End update workaround if ($NewNotificationAlert || $enable_notifications == 1 || $enable_notifications == 3) { $showProfile .= qq~ ~; } if ($ttsureverse) { ${$uid.$user}{'reversetopic'} = $ttsreverse unless exists(${$uid.$user}{'reversetopic'}); $showProfile .= qq~ ~; } foreach my $curtemplate (sort{ $templateset{$a} cmp $templateset{$b} } keys %templateset) { $selected = ''; if ($curtemplate eq ${$uid.$user}{'template'}) { $selected = qq~ selected="selected"~; $akttemplate = $curtemplate; } $drawndirs .= qq~\n~; } $showProfile .= qq~ ~; opendir(DIR, $langdir); my @lfilesanddirs = readdir(DIR); close(DIR); foreach my $fld (sort {lc($a) cmp lc($b)} @lfilesanddirs) { if (-e "$langdir/$fld/Main.lng") { my $displang = $fld; $displang =~ s~(.+?)\_(.+?)$~$1 ($2)~gi; if (${$uid.$user}{'language'} eq $fld) { $drawnldirs .= qq~~; } else { $drawnldirs .= qq~~; } } } $showProfile .= qq~ ~; if ($user_hide_avatars && $showuserpic && $allowpics) { # checkbox to hide avatars in threads $showProfile .= qq~ ~; } if ($user_hide_user_text && $showusertext) { # checkbox to hide user-text in threads $showProfile .= qq~ ~; } if ($user_hide_attach_img && $allowattach) { # checkbox to hide attached images in threads $showProfile .= qq~ ~; } if ($user_hide_signat) { # checkbox to hide signatures in threads $showProfile .= qq~ ~; } if ($user_hide_smilies_row && !$removenormalsmilies) { # checkbox to hide the row of smilies below the the post-message-inputbox $showProfile .= qq~ ~; } if ($extendedprofiles) { require "$sourcedir/ExtendedProfiles.pl"; $showProfile .= &ext_editprofile($user,"options"); } $showProfile .= qq~
$profiletitle

~ . ($upload_useravatar ? qq~
$profile_txt{'476'} $avatar_limit KB~ : "") . qq~
$profile_txt{'477'}
  

 ~ . ($upload_useravatar ? qq~

~ : "") . qq~

$profile_txt{'664'}

$profile_txt{'373'}:
~ . &timeformat($date,1) . qq~

:
~; $showProfile .= qq~ ~ if $NewNotificationAlert; if ($enable_notifications == 1 || $enable_notifications == 3) { $showProfile .= qq~

~ if $NewNotificationAlert; $showProfile .= qq~ ? ~; } $showProfile .= qq~

$profile_txt{'sid_expires_1'} $sid_expires $profile_txt{'sid_expires_2'}
~; if (!$view) { $yymain .= $showProfile; &template; } } sub ModifyProfileBuddy { &SidCheck($action); &PrepareProfile; $menucolors[3] = "titlebg"; &ProfileMenu; my $scriptAction = qq~profileBuddy2~; if ($view) { $scriptAction = qq~myprofileBuddy2~; $yytitle = qq~$profile_txt{'editmyprofile'} › $profile_buddy_list{'buddylist'}~; $profiletitle = qq~$profile_txt{'editmyprofile'} ($user) › $profile_buddy_list{'buddylist'}~; $yynavigation = qq~› $img_txt{'mycenter'} › $profiletitle~; } else { $yytitle = qq~$profile_txt{'79'} › $profile_buddy_list{'buddylist'}~; $profiletitle = qq~$profile_txt{'79'} ($user) › $profile_buddy_list{'buddylist'}~; $yynavigation = qq~› $profiletitle~; } if (!$yyjavascript) { $yyjavascript = ''; } $yyjavascript .= qq~ function imWin() { window.open('$scripturl?action=imlist;sort=mlletter;toid=buddylist','Blist','status=no,height=345,width=464,menubar=no,toolbar=no,top=50,left=50,scrollbars=no'); } // removes a user from the list function removeUser(oElement) { var oList = oElement.options; var indexToRemove = oList.selectedIndex; if (oList.length > 1 || (oList.length == 1 && oList[0].value != '0')) { //alert('element [' + oElement.options[indexToRemove].value + ']'); if (confirm("$profile_buddy_list{'removealert'}")) { oElement.remove(indexToRemove); } } } function selectblNames() { var oList = document.getElementById('buddylist'); for (var i = 0; i < oList.options.length; i++) { oList.options[i].selected = true; } } ~; $showProfile .= qq~
~; my $buildBuddyList = ''; if(${$uid.$user}{'buddylist'}) { my @buddies = split(/\|/, ${$uid.$user}{'buddylist'}); chomp @buddies; foreach my $buddy (@buddies) { &LoadUser($buddy); $buildBuddyList .= qq~~ if ${$uid.$buddy}{'realname'}; } } $showProfile .= qq~ ~; $showProfile .= qq~
$profiletitle
$profile_buddy_list{'buddylist'}
$profile_buddy_list{'explain'}

$profile_buddy_list{'add'}

$profile_txt{'sid_expires_1'} $sid_expires $profile_txt{'sid_expires_2'}
~; if (!$view) { $yymain .= $showProfile; &template; } } sub ModifyProfileIM { &SidCheck($action); &PrepareProfile; $menucolors[4] = "titlebg"; &ProfileMenu; $yyjavascript .= qq~ function imWin() { window.open('$scripturl?action=imlist;sort=mlletter;toid=ignore','Ilist','status=no,height=345,width=464,menubar=no,toolbar=no,top=50,left=50,scrollbars=no'); } // removes a user from the list function removeUser(oElement) { var oList = oElement.options; var indexToRemove = oList.selectedIndex; if (oList.length > 1 || (oList.length == 1 && oList[0].value != '0')) { //alert('element [' + oElement.options[indexToRemove].value + ']'); if (confirm("$profile_buddy_list{'removealert'}")) { oElement.remove(indexToRemove); } } } function selectINames() { var oList = document.getElementById('ignore'); for (var i = 0; i < oList.options.length; i++) { oList.options[i].selected = true; } } ~; my $scriptAction = qq~profileIM2~; if ($view) { $scriptAction = qq~myprofileIM2~; $yytitle = qq~$profile_txt{'editmyprofile'} › $profile_imtxt{'38'}~; $profiletitle = qq~$profile_txt{'editmyprofile'} ($user) › $profile_imtxt{'38'}~; $yynavigation = qq~› $img_txt{'mycenter'} › $profiletitle~; } else { $yytitle = qq~$profile_txt{79} › $profile_imtxt{'38'}~; $profiletitle = qq~$profile_txt{79} ($user) › $profile_imtxt{'38'}~; $yynavigation = qq~› $profiletitle~; } $showProfile .= qq~
~; # This is only for update, when comming from YaBB lower or equal version 2.2.3 # I think it can be deleted around version 2.4.0 without causing mayor issues (deti). if ($enable_notifications eq '') { $enable_notifications = $enable_notification ? 3 : 0; } # End update workaround if ($enable_notifications > 1) { $showProfile .= qq~ ~; } if (${$uid.$user}{'im_popup'}) { $enable_userimpopup = ' checked="checked"'; } if (${$uid.$user}{'im_imspop'}) { $popup_userim = 'checked="checked"'; } $showProfile .= qq~ ~; if($enable_PMcontrols || $enable_PMprev) { my $pmmessprevChecked; if (${$uid.$user}{'pmmessprev'}) { $pmmessprevChecked = ' checked="checked"'; } $showProfile .= qq~ ~; } if($enable_PMcontrols || $enable_PMviewMess) { my $pmviewMessChecked; if (${$uid.$user}{'pmviewMess'}) { $pmviewMessChecked = ' checked="checked"'; } $showProfile .= qq~ ~; } if ($enable_PMcontrols || $enable_PMActprev) { my $pmactprevChecked; if (${$uid.$user}{'pmactprev'}) { $pmactprevChecked = ' checked="checked"'; } $showProfile .= qq~ ~; } if ($extendedprofiles) { require "$sourcedir/ExtendedProfiles.pl"; $showProfile .= &ext_editprofile($user,"im"); } $showProfile .= qq~
$profiletitle
$profile_txt{'325'}:
$profile_txt{'ignoreexplain'}


$profile_txt{'ignorelistadd'}

$profile_txt{'sid_expires_1'} $sid_expires $profile_txt{'sid_expires_2'}
~; if (!$view) { $yymain .= $showProfile; &template; } } sub ModifyProfileAdmin { &is_admin_or_gmod; &SidCheck($action); &PrepareProfile; $menucolors[5] = "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'}; } $regreason = ${$uid.$user}{'regreason'}; $regreason =~ s~
~\n~g; my ($tta, $selsize); if (%NoPost) { ($tta, $selsize) = &DrawGroups(${$uid.$user}{'addgroups'}, '', 1); } $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'}; } my $scriptAction = qq~profileAdmin2~; if ($view) { $scriptAction = qq~myprofileAdmin2~; $yytitle = qq~$profile_txt{'editmyprofile'} › $profile_txt{'820'}~; $profiletitle = qq~$profile_txt{'editmyprofile'} ($user) › $profile_txt{'820'}~; $yynavigation = qq~› $img_txt{'mycenter'} › $profiletitle~; } else { $yytitle = qq~$profile_txt{'79'} › $profile_txt{'820'}~; $profiletitle = qq~$profile_txt{'79'} ($user) › $profile_txt{'820'}~; $yynavigation = qq~› $profiletitle~; } $showProfile .= qq~
~; if ($tta ne "") { $showProfile .= qq~ ~; } ($dr_secund, $dr_minute, $dr_hour, $dr_day, $dr_month, $dr_year, undef, undef, undef) = localtime(${$uid.$user}{'regtime'} ? ${$uid.$user}{'regtime'} : $forumstart); $dr_month++; if ($dr_month > 12) { $dr_month = 12; } ## month cannot be above 12! if ($dr_month < 1) { $dr_month = 1; } ## neither can it be less than 1 if ($dr_day > 31) { $dr_day = 31; } ## day of month over 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 > 50) { $dr_year = 90; } ## a year over 50 is taken to be 1990 if ($dr_year > 20 && $dr_year < 51) { $dr_year = 20; } ## a year 50 or lower is taken to be 2020 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~ ~; $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~; } $all_date =~ s/\n~; $sel_minute = qq~ ~; $showProfile .= qq~ ~; if ($extendedprofiles) { require "$sourcedir/ExtendedProfiles.pl"; $showProfile .= &ext_editprofile($user,"admin"); } $showProfile .= qq~
$profiletitle
$all_date $maintxt{'107'} $sel_hour $sel_minute (server localtime)
$profile_amv_txt{'9'}: $userlastlogin
$profile_amv_txt{'10'}: $userlastpost
$profile_amv_txt{'11'}:

$userlastim


$profile_txt{'sid_expires_1'} $sid_expires $profile_txt{'sid_expires_2'}
~; if (!$view) { $yymain .= $showProfile; &template; } } sub ModifyProfile2 { &SidCheck($action); &PrepareProfile; my (%member, $key, $value); while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g; $member{$key} = $value; } # Make sure we convert any { html encodings to UTF-8 before doing string comparision &FromChars($member{'moda'}); &FromChars($profile_txt{'88'}); &FromChars($profile_txt{'89'}); if ($member{'moda'} eq $profile_txt{'88'}) { if ($sessions == 1 && $staff && $username eq $user) { if ($member{'sesquest'} eq "password") { $member{'sesanswer'} = ''; } elsif ($member{'sesanswer'} eq '') { &fatal_error('no_secret_answer'); } } if ($member{'passwrd1'} || $member{'passwrd2'}) { &fatal_error("no_password") if $member{'passwrd1'} eq ''; &fatal_error("password_mismatch") if $member{'passwrd1'} ne $member{'passwrd2'}; &fatal_error("password_is_userid") if $user eq $member{'passwrd1'}; &fatal_error("invalid_character","$profile_txt{'36'} $profile_txt{'241'}") if $member{'passwrd1'} =~ /[^\s\w!\@#\$\%\^&\*\(\)\+\|`~\-=\\:;'",\.\/\?\[\]\{\}]/; } if ($member{'bday1'} ne "" || $member{'bday2'} ne "" || $member{'bday3'} ne "") { &fatal_error("invalid_birthdate","($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("invalid_birthdate","($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); } $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'} = ''; } # EventCal Begin if (${$uid.$user}{'bday'} ne "$member{'bday'}") { $Update_EventCal = 1; } # EventCal End if ($extendedprofiles) { # run this before you start to save something! require "$sourcedir/ExtendedProfiles.pl"; my $error = &ext_validate_submition($username,$user); if ($error ne "") { &fatal_error("extended_profiles_validation",$error); } &ext_saveprofile($user); } if ((!$cannot_change_displayname || $iamadmin) && ${$uid.$user}{'realname'} ne $member{'name'}) { $member{'name'} =~ s~\t+~\ ~g; if ($member{'name'} eq '') { &fatal_error("no_name"); } if ($name_cannot_be_userid && lc $member{'name'} eq lc $user) { &fatal_error('name_is_userid'); } &LoadCensorList; if (&Censor($member{'name'}) ne $member{'name'}) { &fatal_error("name_censored", &CheckCensor("$member{'name'}")); } if (${$uid.$user}{'password'} eq &encode_password($member{'name'})) { &fatal_error("password_is_userid"); } &FromChars($member{'name'}); $convertstr = $member{'name'}; $convertcut = 30; &CountChars; $member{'name'} = $convertstr; &fatal_error("name_too_long") if $cliped; &fatal_error("invalid_character","$profile_txt{'68'} $profile_txt{'241re'}") if $member{'name'} =~ /[^ \w\x{80}-\x{10FFFF}\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/; &ToHTML($member{'name'}); &ToChars($member{'name'}); if ($user ne "admin") { # Check to see if name is reserved my @reservecfg = &read_DBorFILE(0,'',$vardir,'reservecfg','txt'); chomp(@reservecfg); my $matchword = $reservecfg[0] eq 'checked'; my $matchcase = $reservecfg[1] eq 'checked'; my $matchname = $reservecfg[3] eq 'checked'; my $namecheck = $matchcase eq 'checked' ? $member{'name'} : lc $member{'name'}; foreach my $reserved (&read_DBorFILE(0,'',$vardir,'reserve','txt')) { chomp $reserved; my $reservecheck = $matchcase ? $reserved : lc $reserved; if ($matchname) { if ($matchword) { if ($namecheck eq $reservecheck) { &fatal_error('id_reserved',"$reserved"); } } else { if ($namecheck =~ $reservecheck) { &fatal_error('id_reserved',"$reserved"); } } } } } if ((lc &MemberIndex("check_exist", $member{'name'}, $user) eq lc $member{'name'}) && (lc $member{'name'} ne lc $member{'username'})) { &fatal_error('name_taken',"($member{'name'})"); } # rewrite attachments.txt with new username my @attachments = &read_DBorFILE(0,ATM,$vardir,'attachments','txt'); for (my $i = 0; $i < @attachments; $i++) { $attachments[$i] =~ s/^(\d+\|\d+\|.*?)\|(.*?)\|/ ($2 eq ${$uid.$user}{'realname'} ? "$1|$member{'name'}|" : "$1|$2|") /e; } &write_DBorFILE(0,ATM,$vardir,'attachments','txt',@attachments); #Since we haven't encountered a fatal error, time to rewrite our memberlist. &ManageMemberinfo("update", $user, '', $member{'name'}, '', '', '', '', ($Update_EventCal ? ($member{'bday'} ? $member{'bday'} : '-') : '')); } else { $member{'name'} = ${$uid.$user}{'realname'}; &ManageMemberinfo("update", $user, '', '', '', '', '', '', ($member{'bday'} ? $member{'bday'} : '-')) if $Update_EventCal; } &ToHTML($member{'gender'}); &FromChars($member{'location'}); &ToHTML($member{'location'}); &ToChars($member{'location'}); &ToHTML($member{'bday'}); &FromChars($member{'sesquest'}); &ToHTML($member{'sesquest'}); &ToChars($member{'sesquest'}); # 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'}; require "$sourcedir/Decoder.pl"; ${$uid.$user}{'sesanswer'} = &scramble($member{'sesanswer'}, $user); ${$uid.$username}{'session'} = &encode_password($user_ip); # EventCal Begin if ($Update_EventCal == 1) { my @eventcalbday; &ManageMemberinfo("load"); foreach (keys %memberinf) { my (undef, undef, undef, undef, undef, undef, $membday) = split(/\|/, $memberinf{$_}, 7); if ($membday) { my ($user_month, $user_day, $user_year) = split(/\//, $membday); if ($user_month < 10 && length($user_month) == 1) { $user_month = "0$user_month"; } if ($user_day < 10 && length($user_day) == 1) { $user_day = "0$user_day"; } push(@eventcalbday, qq~$user_year|$user_month|$user_day|$_\n~); } } &write_DBorFILE(0,'',$vardir,'eventcalbday','db',@eventcalbday); undef %memberinf; } # EventCal End &UserAccount($user, "update"); &UpdateCookie("write", $user, ${$uid.$user}{'password'}, ${$uid.$user}{'session'}, "/", "") if $member{'passwrd1'} && $username eq $user; my $scriptAction = $view ? 'myprofileContacts' : 'profileContacts'; $yySetLocation = qq~$scripturl?action=$scriptAction;username=$useraccount{$user};sid=$INFO{'sid'}~; } elsif ($member{'moda'} eq $profile_txt{'89'}) { &fatal_error("cannot_kill_admin", $user) if $user eq 'admin' || !($iamadmin || $allow_self_del); # For security, remove username from mod position &KillModerator($user); &delete_DBorFILE("$memberdir/$user.dat"); # &delete_DBorFILE("$memberdir/$user.vars") does delete also the # other files content if in SQL-Database!!! So no further need for &delete_DBorFILE(...) &delete_DBorFILE("$memberdir/$user.vars"); &delete_DBorFILE("$memberdir/$user.ims"); &delete_DBorFILE("$memberdir/$user.msg"); &delete_DBorFILE("$memberdir/$user.log"); &delete_DBorFILE("$memberdir/$user.rlog"); &delete_DBorFILE("$memberdir/$user.outbox"); &delete_DBorFILE("$memberdir/$user.imstore"); &delete_DBorFILE("$memberdir/$user.imdraft"); &delete_DBorFILE("$facesdir/UserAvatars/$1") if ${$uid.$user}{'userpic'} && ${$uid.$user}{'userpic'} =~ /$facesurl\/UserAvatars\/(.+)/; &MemberIndex("remove", $user); # EventCal Begin my @eventcalbday; &ManageMemberinfo("load"); foreach (keys %memberinf) { my (undef, undef, undef, undef, undef, undef, $membday) = split(/\|/, $memberinf{$_}, 7); if ($membday) { my ($user_month, $user_day, $user_year) = split(/\//, $membday); if ($user_month < 10 && length($user_month) == 1) { $user_month = "0$user_month"; } if ($user_day < 10 && length($user_day) == 1) { $user_day = "0$user_day"; } push(@eventcalbday, qq~$user_year|$user_month|$user_day|$_\n~); } } &write_DBorFILE(0,'',$vardir,'eventcalbday','db',@eventcalbday); undef %memberinf; # EventCal End if (!$iamadmin) { &UpdateCookie("delete"); $username = 'Guest'; $iamguest = 1; $iamadmin = ''; $iamgmod = ''; $password = ''; $yyim = ''; $ENV{'HTTP_COOKIE'} = ''; $yyuname = ''; } $yySetLocation = $scripturl; } else { &fatal_error('not_allowed'); } &redirectexit; } sub ModifyProfileContacts2 { &SidCheck($action); &PrepareProfile; my (%member, $key, $value, $newpassemail, $tempname, $stealth); while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~\r~~g; $value =~ s~\n~~g if $key ne 'awayreply'; $member{$key} = $value; } $member{'username'} = $user; &fatal_error("not_allowed") if $member{'moda'} ne $profile_txt{'88'}; 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("no_email") if $member{'email'} eq ''; &fatal_error("invalid_character","$profile_txt{'69'} $profile_txt{'241e'}") if $member{'email'} !~ /^[\w\-\.\+]+\@[\w\-\.\+]+\.\w{2,4}$/; &fatal_error("invalid_email") if ($member{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/) || ($member{'email'} !~ /^.+@\[?(\w|[-.])+\.[a-zA-Z]{2,4}|[0-9]{1,4}\]?$/); $member{'icq'} =~ s/[^0-9]//g; $member{'aim'} =~ s/ /\+/g; $member{'yim'} =~ s/ /\+/g; $member{'msn'} =~ s/ /\+/g; &ToHTML($member{'email'}); &ToHTML($member{'icq'}); &ToHTML($member{'aim'}); &ToHTML($member{'yim'}); &ToHTML($member{'msn'}); &ToHTML($member{'gtalk'}); &ToHTML($member{'skype'}); &ToHTML($member{'myspace'}); &ToHTML($member{'facebook'}); &ToHTML($member{'weburl'}); &FromChars($member{'webtitle'}); &ToHTML($member{'webtitle'}); &ToChars($member{'webtitle'}); &ToHTML($member{'offlinestatus'}); &FromChars($member{'awaysubj'}); &ToHTML($member{'awaysubj'}); &ToChars($member{'awaysubj'}); &FromChars($member{'awayreply'}); &ToHTML($member{'awayreply'}); $member{'awayreply'} =~ s~\n~
~g; $convertstr = $member{'awayreply'}; $convertcut = $MaxAwayLen; &CountChars; $member{'awayreply'} = $convertstr; &ToChars($member{'awayreply'}); if ($extendedprofiles) { # run this before you start to save something! require "$sourcedir/ExtendedProfiles.pl"; my $error = &ext_validate_submition($username,$user); if ($error ne "") { &fatal_error("extended_profiles_validation",$error); } &ext_saveprofile($user); } # Check to see if email is already taken if (lc ${$uid.$user}{'email'} ne lc $member{'email'}) { $testemail = lc $member{'email'}; my $is_existing = &MemberIndex("check_exist", "$testemail"); if (lc $is_existing eq $testemail) { &fatal_error("email_taken","($member{'email'})"); } # Since we haven't encountered a fatal error, time to rewrite our memberlist a little. &ManageMemberinfo("update", $user, '', '', $member{'email'}); } ## if enabled but not set, default offline status to 'offline' if ($enable_MCaway && $member{'offlinestatus'} eq '') { $member{'offlinestatus'} = 'offline'; } # if user is switching 'away' to 'off/on', clean out the away-sent list if ($FORM{'offlinestatus'} eq 'offline') { ${$uid.$user}{'awayreplysent'} = ''; } # Time to print the changes to the username.vars file ${$uid.$user}{'email'} = $member{'email'}; ${$uid.$user}{'hidemail'} = $member{'hideemail'} ? 1 : 0; ${$uid.$user}{'icq'} = $member{'icq'}; ${$uid.$user}{'aim'} = $member{'aim'}; ${$uid.$user}{'yim'} = $member{'yim'}; ${$uid.$user}{'msn'} = $member{'msn'}; ${$uid.$user}{'gtalk'} = $member{'gtalk'}; ${$uid.$user}{'skype'} = $member{'skype'}; ${$uid.$user}{'myspace'} = $member{'myspace'}; ${$uid.$user}{'facebook'} = $member{'facebook'}; ${$uid.$user}{'webtitle'} = $member{'webtitle'}; ${$uid.$user}{'weburl'} = (($member{'weburl'} && $member{'weburl'} !~ m~\Ahttps?://~) ? "http://" : "") . $member{'weburl'}; ${$uid.$user}{'offlinestatus'} = $member{'offlinestatus'}; ${$uid.$user}{'awaysubj'} = $member{'awaysubj'}; ${$uid.$user}{'awayreply'} = $member{'awayreply'}; ${$uid.$user}{'stealth'} = (${$uid.$user}{'position'} eq 'Administrator' || ${$uid.$user}{'position'} eq 'Global Moderator') ? $member{'stealth'} : ""; &UserAccount($user, "update"); if ($emailnewpass && $newpassemail == 1) { &RemoveUserOnline($user); # Remove user from online log if ($username eq $user) { &UpdateCookie("delete"); $username = 'Guest'; $iamguest = 1; $iamadmin = ''; $iamgmod = ''; $password = ''; $yyim = ''; $ENV{'HTTP_COOKIE'} = ''; $yyuname = ''; } &FormatUserName($member{'username'}); require "$sourcedir/Mailer.pl"; my $scriptAction = $view ? 'myprofile' : 'profile'; &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=$scriptAction;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 .= $shared_login; $yytitle = $profile_txt{'245'}; &template; } my $scriptAction = $view ? 'myprofileOptions' : 'profileOptions'; $yySetLocation = qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; &redirectexit; } sub ModifyProfileOptions2 { &SidCheck($action); &PrepareProfile; my (%member, $key, $value, $tempname); while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~\r~~g; $value =~ s~\n~~g if $key ne 'signature'; $member{$key} = $value; } $member{'username'} = $user; &fatal_error("not_allowed") if $member{'moda'} ne $profile_txt{'88'}; if (!$minlinksig){ $minlinksig = 0 ;} if (${$uid.$user}{'postcount'} < $minlinksig && !$iamadmin && !$iamgmod) { if ($member{'signature'} =~ m~http:\/\/~ || $member{'signature'} =~ m~https:\/\/~ || $member{'signature'} =~ m~ftp:\/\/~ || $member{'signature'} =~ m~www.~ || $member{'signature'} =~ m~ftp.~ =~ m~\[url~ || $member{'signature'} =~ m~\[link~ || $member{'signature'} =~ m~\[img~ || $member{'signature'} =~ m~\[ftp~) { &fatal_error("no_siglinks_allowed"); } } &FromChars($member{'usertext'}); $convertstr = $member{'usertext'}; $convertcut = 51; &CountChars; $member{'usertext'} = $convertstr; &ToHTML($member{'usertext'}); &ToChars($member{'usertext'}); if ($allowpics) { opendir(DIR, "$facesdir") || fatal_error("cannot_open_dir","($facesdir)!
$profile_txt{'681'}", 1); closedir(DIR); } if ($allowpics && $upload_useravatar && $upload_avatargroup) { $upload_useravatar = 0; foreach my $av_gr (split(/, /, $upload_avatargroup)) { if ($av_gr eq ${$uid.$user}{'position'}) { $upload_useravatar = 1; last; } foreach (split(/,/, ${$uid.$user}{'addgroups'})) { if ($av_gr eq $_) { $upload_useravatar = 1; last; } } } } my $file = $CGI_query->upload("file_avatar") if $CGI_query; if ($allowpics && $upload_useravatar && $file) { if ($file !~ /\.(gif|png|jpe?g)$/i) { &LoadLanguage('FA'); &fatal_error('file_not_uploaded',"$file $fatxt{'20'} gif png jpeg jpg"); } my $ext = $1; my $fixfile = ${$uid.$user}{'realname'}; if ($fixfile =~ /[^0-9A-Za-z\+\-\.:_]/) { # replace all inappropriate characters # Transliteration my @ISO_8859_1 = qw(A B V G D E JO ZH Z I J K L M N O P R S T U F H C CH SH SHH _ Y _ JE JU JA a b v g d e jo zh z i j k l m n o p r s t u f h c ch sh shh _ y _ je ju ja); my $x = 0; foreach (qw(À Á Â Ã Ä Å ¨ Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å ¸ æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ)) { $fixfile =~ s/$_/$ISO_8859_1[$x]/ig; $x++; } # END Transliteration. Thanks to "Velocity" for this contribution. $fixfile =~ s/[^0-9A-Za-z\+\-\.:_]/_/g; } $fixfile .= ".$ext"; if (length("$facesdir/UserAvatars/$fixfile") > 255) { &fatal_error('filename_too_long', "$facesdir/UserAvatars/$fixfile"); } # make sure path+filename isn't too long require "$sourcedir/SpamCheck.pl"; my $spamdetected = &spamcheck("$fixfile"); if (!$staff){ if ($spamdetected == 1) { ${$uid.$username}{'spamcount'}++; ${$uid.$username}{'spamtime'} = $date; &UserAccount($username,"update"); $spam_hits_left_count = $post_speed_count - ${$uid.$username}{'spamcount'}; &fatal_error("tsc_alert"); } } my ($size,$buffer,$filesize,$file_buffer); while ($size = read($file, $buffer, 512)) { $filesize += $size; $file_buffer .= $buffer; } if ($avatar_limit && $filesize > (1024 * $avatar_limit)) { &LoadLanguage('FA'); &fatal_error('file_not_uploaded',"$fatxt{'21'} $file (" . int($filesize / 1024) . " KB) $fatxt{'21b'} " . $avatar_limit); } if ($avatar_dirlimit) { my $dirsize = &dirsize("$facesdir/UserAvatars"); if ($filesize > ((1024 * $avatar_dirlimit) - $dirsize)) { &LoadLanguage('FA'); &fatal_error('file_not_uploaded',"$fatxt{'22'} $file (" . (int($filesize / 1024) - $avatar_dirlimit + int($dirsize / 1024)) . " KB) $fatxt{'22b'}"); } } &delete_DBorFILE("$facesdir/UserAvatars/$1") if ${$uid.$user}{'userpic'} =~ /$facesurl\/UserAvatars\/(.+)/; $fixfile = &check_existence("$facesdir/UserAvatars", $fixfile); # create a new file on the server using the formatted ( new instance ) filename if (fopen(NEWFILE, ">$facesdir/UserAvatars/$fixfile")) { binmode NEWFILE; # needed for operating systems (OS) Windows, ignored by Linux print NEWFILE $file_buffer; # write new file on HD fclose(NEWFILE); } else { # return the server's error message if the new file could not be created &fatal_error("file_not_open","$facesdir/UserAvatars"); } # check if file has actually been uploaded, by checking the file has a size unless (-s "$facesdir/UserAvatars/$fixfile") { &fatal_error("file_not_uploaded",$fixfile); } my $illegal; if ($fixfile =~ /gif$/i) { my $header; fopen(ATTFILE, "$facesdir/UserAvatars/$fixfile"); binmode ATTFILE; read(ATTFILE, $header, 10); my $giftest; ($giftest, undef, undef, undef, undef, undef) = unpack("a3a3C4", $header); fclose(ATTFILE); if ($giftest ne "GIF") { $illegal = $giftest; } } fopen(ATTFILE, "$facesdir/UserAvatars/$fixfile"); binmode ATTFILE; while ( read(ATTFILE, $buffer, 1024) ) { if ($buffer =~ /<(html|script|body)/ig) { $illegal = $1; last; } } fclose(ATTFILE); if ($illegal) { # delete the file as it contains illegal code &delete_DBorFILE("$facesdir/UserAvatars/$fixfile"); &ToHTML($illegal); &fatal_error("file_not_uploaded","$fixfile <= illegal code ($illegal) inside image file!"); } $member{'userpic'} = "$facesurl/UserAvatars/$fixfile"; } elsif ($member{'userpicpersonalcheck'} && ($member{'userpicpersonal'} =~ /\.gif\Z/i || $member{'userpicpersonal'} =~ /\.jpe?g\Z/i || $member{'userpicpersonal'} =~ /\.png\Z/i)) { $member{'userpic'} = $member{'userpicpersonal'}; } if ($member{'userpic'} eq "" || !$allowpics) { $member{'userpic'} = "blank.gif"; } &fatal_error("invalid_character","$profile_txt{'592'}") if $member{'userpic'} !~ m^\A[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z^; &delete_DBorFILE("$facesdir/UserAvatars/$1") if $member{'userpic'} ne ${$uid.$user}{'userpic'} && ${$uid.$user}{'userpic'} =~ /$facesurl\/UserAvatars\/(.+)/; if ($member{'usertemplate'} ne '' && !$templateset{$member{'usertemplate'}}) { &fatal_error('invalid_template'); } if ($member{'usertemplate'} eq '') { $member{'usertemplate'} = $template; } if ($member{'userlanguage'} ne '' && !-e "$langdir/$member{'userlanguage'}/Main.lng") { &fatal_error('invalid_language'); } if ($member{'userlanguage'} eq '') { $member{'userlanguage'} = $language; } if ($extendedprofiles) { # run this before you start to save something! require "$sourcedir/ExtendedProfiles.pl"; my $error = &ext_validate_submition($username,$user); if ($error ne "") { &fatal_error("extended_profiles_validation",$error); } &ext_saveprofile($user); } if ($member{'usertimesign'} !~ /^-?$/ || $member{'usertimehour'} !~ /^\d+$/ || $member{'usertimemin'} !~ /^\d+$/) { &fatal_error("invalid_time_offset","$member{'usertimesign'}$member{'usertimehour'}.$member{'usertimemin'}"); } # update notifications if users language is changed if (${$uid.$user}{'language'} ne "$member{'userlanguage'}") { require "$sourcedir/Notify.pl"; &updateLanguage($user, $member{'userlanguage'}); } if ($addmemgroup_enabled > 1) { my %groups; map { $groups{$_} = 2; } split(/,/, ${$uid.$user}{'addgroups'}); map { $groups{$_} = 1; } split(/, /, $member{'joinmemgroup'}); my @nopostmember; foreach (keys %NoPost) { next if ${$uid.$user}{'position'} eq $_; if ($groups{$_} == 1 && (split /\|/, $NoPost{$_})[10]) { push(@nopostmember, $_); } elsif ($groups{$_} == 2 && !(split /\|/, $NoPost{$_})[10]) { push(@nopostmember, $_); } } $member{'joinmemgroup'} = join(',', @nopostmember); if ($member{'joinmemgroup'} eq '') { $member{'joinmemgroup'} = "###blank###"; } if ($member{'joinmemgroup'} ne ${$uid.$user}{'addgroups'}) { &ManageMemberinfo("update", $user, '', '', '', '', '', $member{'joinmemgroup'}); } if ($member{'joinmemgroup'} eq "###blank###") { $member{'joinmemgroup'} = ''; } ${$uid.$user}{'addgroups'} = $member{'joinmemgroup'}; } &FromChars($member{'signature'}); &ToHTML($member{'signature'}); $member{'signature'} =~ s~\n~
~g; $convertstr = $member{'signature'}; $convertcut = $MaxSigLen; &CountChars; $member{'signature'} = $convertstr; &ToChars($member{'signature'}); &ToHTML($member{'userpic'}); &ToHTML($member{'usertemplate'}); &ToHTML($member{'userlanguage'}); &ToHTML($member{'timeformat'}); # 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{'usertimesign'}$member{'usertimehour'}.$member{'usertimemin'}"; ${$uid.$user}{'onlinealert'} = $member{'onlinealert'} ? 1 : 0; ${$uid.$user}{'notify_me'} = $member{'notify_N'} ? ((!${$uid.$user}{'notify_me'} || ${$uid.$user}{'notify_me'} == 1) ? 1 : 3) : ((${$uid.$user}{'notify_me'} == 2 || ${$uid.$user}{'notify_me'} == 3) ? 2 : 0); ${$uid.$user}{'reversetopic'} = $member{'reversetopic'} ? 1 : 0; ${$uid.$user}{'dsttimeoffset'} = $member{'dsttimeoffset'} ? 1 : 0; ${$uid.$user}{'dynamic_clock'} = $member{'dynamic_clock'} ? 1 : 0; ${$uid.$user}{'timeselect'} = int($member{'usertimeselect'}); ${$uid.$user}{'template'} = $member{'usertemplate'}; ${$uid.$user}{'language'} = $member{'userlanguage'}; ${$uid.$user}{'timeformat'} = $member{'timeformat'}; ${$uid.$user}{'numberformat'} = int($member{'usernumberformat'}); ${$uid.$user}{'hide_avatars'} = ($member{'hide_avatars'} && $user_hide_avatars) ? 1 : 0; ${$uid.$user}{'hide_user_text'} = ($member{'hide_user_text'} && $user_hide_user_text) ? 1 : 0; ${$uid.$user}{'hide_attach_img'} = ($member{'hide_attach_img'} && $user_hide_attach_img) ? 1 : 0; ${$uid.$user}{'hide_signat'} = ($member{'hide_signat'} && $user_hide_signat) ? 1 : 0; ${$uid.$user}{'hide_smilies_row'} = ($member{'hide_smilies_row'} && $user_hide_smilies_row) ? 1 : 0; &UserAccount($user, "update"); my $scriptAction; if ($iamadmin || ($iamgmod && $allow_gmod_profile && $gmod_access2{'profileAdmin'} eq 'on')) { $scriptAction = qq~profileAdmin~; } else { $scriptAction = qq~viewprofile~; } if ($PM_level == 1 || ($PM_level == 2 && $staff) || ($PM_level == 3 && ($iamadmin || $iamgmod))) { $scriptAction = qq~profileIM~; } if ($buddyListEnabled) { $scriptAction = qq~profileBuddy~; } if ($view) { $scriptAction = qq~my$scriptAction~; } $yySetLocation = qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; &redirectexit; } sub ModifyProfileBuddy2 { &SidCheck($action); &PrepareProfile; my (%member, $key, $value, $tempname); while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g; $member{$key} = $value; } $member{'username'} = $user; &fatal_error("not_allowed") if $member{'moda'} ne $profile_txt{'88'}; if ($member{'buddylist'}) { my @buddies = split(/\,/, $member{'buddylist'}); chomp(@buddies); $member{'buddylist'} = ''; foreach my $cloakedBuddy (@buddies) { $cloakedBuddy =~ s/^ //; $cloakedBuddy = &decloak($cloakedBuddy); &ToHTML($cloakedBuddy); $member{'buddylist'} = qq~$member{'buddylist'}\|$cloakedBuddy~; } $member{'buddylist'} =~ s/^\|//; } ${$uid.$user}{'buddylist'} = $member{'buddylist'}; &UserAccount($user, "update"); my $scriptAction; if ($iamadmin || ($iamgmod && $allow_gmod_profile && $gmod_access2{'profileAdmin'} eq 'on')) { $scriptAction = qq~profileAdmin~; } else { $scriptAction = qq~viewprofile~; } if ($PM_level == 1 || ($PM_level == 2 && $staff) || ($PM_level == 3 && ($iamadmin || $iamgmod))) { $scriptAction = qq~profileIM~; } if ($view) { $scriptAction = qq~my$scriptAction~; } $yySetLocation = qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; &redirectexit; } sub ModifyProfileIM2 { &SidCheck($action); &PrepareProfile; my (%member, $key, $value, $ignorelist); while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g if $key ne 'ignore'; $member{$key} = $value; } $member{'username'} = $user; &fatal_error("not_allowed") if $member{'moda'} ne $profile_txt{'88'}; if (!$member{'ignoreall'}) { my @ignoreList = split(/\,/, $member{'ignore'}); chomp (@ignoreList); foreach my $cloakedIgnore (@ignoreList) { $cloakedIgnore =~s/\A //; $cloakedIgnore =~s/ \Z//; $cloakedIgnore = &decloak($cloakedIgnore); &ToHTML ($cloakedIgnore); $ignorelist .= qq~\|$cloakedIgnore~; } $ignorelist =~ s~\A\|~~; } else { $ignorelist = '*'; } # Time to print the changes to the username.vars file ${$uid.$user}{'im_ignorelist'} = $ignorelist; ${$uid.$user}{'notify_me'} = $member{'notify_PM'} ? ((!${$uid.$user}{'notify_me'} || ${$uid.$user}{'notify_me'} == 2) ? 2 : 3) : ((${$uid.$user}{'notify_me'} == 1 || ${$uid.$user}{'notify_me'} == 3) ? 1 : 0); ${$uid.$user}{'im_popup'} = $member{'userpopup'} ? 1 : 0; ${$uid.$user}{'im_imspop'} = $member{'popupims'} ? 1 : 0; ${$uid.$user}{'pmactprev'} = $member{'pmactprev'} ? 1 : 0; ${$uid.$user}{'pmmessprev'} = $member{'pmmessprev'} ? 1 : 0; ${$uid.$user}{'pmviewMess'} = $member{'pmviewMess'} ? 1 : 0; if ($extendedprofiles) { # run this before you start to save something! require "$sourcedir/ExtendedProfiles.pl"; my $error = &ext_validate_submition($username,$user); if ($error ne "") { &fatal_error("extended_profiles_validation",$error); } &ext_saveprofile($user); } &UserAccount($user, "update"); my $scriptAction = qq~viewprofile~; if ($iamadmin || ($iamgmod && $allow_gmod_profile && $gmod_access2{'profileAdmin'} eq 'on')) { $scriptAction = qq~profileAdmin~; } if ($view) { $scriptAction = qq~my$scriptAction~; } $yySetLocation = qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; &redirectexit; } sub ModifyProfileAdmin2 { &is_admin_or_gmod; &SidCheck($action); &PrepareProfile; my (%member, $key, $value); while (($key, $value) = each(%FORM)) { $value =~ s~\A\s+~~; $value =~ s~\s+\Z~~; $value =~ s~[\n\r]~~g if $key ne 'regreason'; $member{$key} = $value; } $member{'username'} = $user; &fatal_error("not_allowed") if $member{'moda'} ne $profile_txt{'88'}; if (!$iamadmin && ($member{'settings7'} eq "Administrator" || $member{'settings7'} eq "Global Moderator")) { $member{'settings7'} = ${$uid.$user}{'position'}; } if ($member{'settings6'} eq '') { $member{'settings6'} = 0; } if ($member{'settings6'} !~ /\A[0-9]+\Z/) { &fatal_error('invalid_postcount'); } &fatal_error('cannot_regroup_admin') 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'}); } my %groups; map { $groups{$_} = 1; } split(/, /, $member{'addgroup'}); my @nopostmember; foreach (keys %NoPost) { next if $member{'settings7'} eq $_; push(@nopostmember, $_) if $groups{$_}; } $member{'addgroup'} = join(',', @nopostmember); if ($member{'addgroup'} eq '') { $member{'addgroup'} = "###blank###"; } if ($member{'addgroup'} ne ${$uid.$user}{'addgroups'}) { &ManageMemberinfo("update", $user, '', '', '', '', '', $member{'addgroup'}); } if ($member{'addgroup'} eq "###blank###") { $member{'addgroup'} = ''; } ${$uid.$user}{'addgroups'} = $member{'addgroup'}; if ($member{'dr'} ne ${$uid.$user}{'regdate'}) { $newreg = &stringtotime($member{'dr'}); $newreg = sprintf("%010d", $newreg); &ManageMemberinfo("update", $user, $newreg); ${$uid.$user}{'regtime'} = $newreg; } if (!$iamadmin) { $member{'dr'} = ${$uid.$user}{'regdate'}; } &FromChars($member{'regreason'}); &ToHTML($member{'regreason'}); &ToChars($member{'regreason'}); $member{'regreason'} =~ s~[\n\r]{1,2}~
~g; ${$uid.$user}{'regreason'} = $member{'regreason'}; ${$uid.$user}{'postcount'} = $member{'settings6'}; ${$uid.$user}{'position'} = $member{'settings7'}; ${$uid.$user}{'regdate'} = $member{'dr'}; ${$uid.$user}{'stealth'} = "" if ${$uid.$user}{'position'} ne 'Administrator' && ${$uid.$user}{'position'} ne 'Global Moderator'; if ($extendedprofiles) { # run this before you start to save something! require "$sourcedir/ExtendedProfiles.pl"; my $error = &ext_validate_submition($username,$user); if ($error ne "") { &fatal_error("extended_profiles_validation",$error); } &ext_saveprofile($user); } &UserAccount($user, "update"); my $scriptAction = $view ? 'myviewprofile' : 'viewprofile'; $yySetLocation = qq~$scripturl?action=$scriptAction;username=$useraccount{$user}~; &redirectexit; } sub ViewProfile { if ($iamguest) { &fatal_error('members_only'); } # 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/ /+/; $user = $INFO{'username'}; if ($do_scramble_id) { &decloak($user); } if ($user =~ m~/~) { &fatal_error('no_user_slash'); } if ($user =~ m~\\~) { &fatal_error('no_user_backslash'); } unless (&LoadUser($user)) { &fatal_error('no_profile_exists'); } &LoadMiniUser($user) if $user eq $username; my ($memberinfo, $modify, $email, $gender, $avstyle, $pic); my ($pic_row, $buddybutton, $row_addgrp, $row_gender, $row_age, $row_location, $row_icq, $row_aim, $row_yim, $row_msn, $row_gtalk, $row_skype, $row_myspace, $row_facebook, $row_email, $row_website, $row_signature, $send_PM, $showusertext); # Convert forum start date to string, if there is no date set, # Defaults to 1st Jan, 2005 $forumstart = $forumstart ? &stringtotime($forumstart) : "1104537600"; if (${$uid.$user}{'regtime'}) { $dr = &timeformat(${$uid.$user}{'regtime'}); } else { $dr = $profile_txt{'470'}; } &CalcAge($user, "calc"); # How old is he/she? &CalcAge($user, "isbday"); # is it the bday? if ($isbday) { $isbday = qq~~; } ## only show the 'modify' button if not using 'my center' or admin/gmod viewing $modify = (!$view && ($user ne "admin" || $username eq "admin") && ($iamadmin || ($iamgmod && $allow_gmod_profile && ${$uid.$user}{'position'} ne "Administrator"))) ? qq~$img{'modify'}~ : " "; if ($allowpics) { if (${$uid.$user}{'userpic'} eq "blank.gif") { $pic = qq~~; } elsif (${$uid.$user}{'userpic'} =~ /^https?:\/\//) { $pic = qq~~; } else { $pic = qq~~; } $pic_row = qq~
$pic
~; } if ($buddyListEnabled && $user ne $username) { &loadMyBuddy; $buddybutton = "
" . ($mybuddie{$user} ? qq~$display_txt{'isbuddy'} $display_txt{'isbuddy'}~ : qq~$img{'addbuddy'}~); } # 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~; } if (${$uid.$user}{'gender'}) { if (${$uid.$user}{'gender'} eq 'Male') { $gender = $profile_txt{'238'}; } elsif (${$uid.$user}{'gender'} eq 'Female') { $gender = $profile_txt{'239'}; } $row_gender = qq~
$profile_txt{'231'}:
$gender
~; } if ($age) { $row_age = qq~
$profile_txt{'420'}:
$age   $isbday
~; } if (${$uid.$user}{'location'}) { $row_location = qq~
$profile_txt{'227'}:
${$uid.$user}{'location'}
~; } if (${$uid.$user}{'icq'} && ${$uid.$user}{'icq'} !~ m/\D/) { $row_icq .= qq~
$profile_txt{'513'}:
${$uid.$user}{'icq'} ${$uid.$user}{'icq'}
~; } if (${$uid.$user}{'aim'}) { my $aim_user = ${$uid.$user}{'aim'}; $aim_user =~ tr/\+/ /; $row_aim = qq~
$profile_txt{'603'}:
${$uid.$user}{'aim'} $aim_user
~; } if (${$uid.$user}{'yim'}) { my $yim_user = ${$uid.$user}{'yim'}; $yim_user =~ tr/\+/ /; $row_yim = qq~
$profile_txt{'604'}:
${$uid.$user}{'yim'} $yim_user
~; } if (${$uid.$user}{'msn'}) { $row_msn = qq~
$profile_txt{'823'}:
$profile_txt{'823'} ${$uid.$user}{'realname'}
~; } if (${$uid.$user}{'gtalk'}) { $row_gtalk = qq~
$profile_txt{'825'}:
$profile_txt{'825'} ${$uid.$user}{'realname'}
~; } if (${$uid.$user}{'skype'}) { $row_skype = qq~
$profile_txt{'827'}:
$profile_txt{'827'} ${$uid.$user}{'realname'}
~; } if (${$uid.$user}{'myspace'}) { $row_myspace = qq~
$profile_txt{'570'}:
$profile_txt{'570'} ${$uid.$user}{'realname'}
~; } if (${$uid.$user}{'facebook'}) { $row_facebook = qq~
$profile_txt{'573'}:
${$uid.$user}{'facebook'}
~; } if (!${$uid.$user}{'hidemail'} || $iamadmin || !$allow_hide_email || $view) { my $rowEmail = ''; if ($view) { if (!${$uid.$user}{'hidemail'}) { $rowEmail = $profile_txt{'showingemail'}; } else { my ($admtitle, undef) = split(/\|/, $Group{'Administrator'}, 2); $rowEmail = qq~$profile_txt{'notshowingemail'} $admtitle$profile_txt{'notshowingemailend'}~; } } else { $rowEmail = &enc_eMail("$profile_txt{'889'} ${$uid.$user}{'realname'}",${$uid.$user}{'email'},'',''); } $row_email = qq~
$profile_txt{'69'}:
$rowEmail
~; } if (${$uid.$user}{'weburl'} && ${$uid.$user}{'webtitle'}) { $row_website = qq~
$profile_txt{'96'}:
${$uid.$user}{'webtitle'}
~; } if (${$uid.$user}{'signature'} && (!$hide_signat_for_guests || !$iamguest)) { # do some ubbc on the signature to display in the view profile area $message = ${$uid.$user}{'signature'}; $displayname = ${$uid.$user}{'realname'}; if ($enable_ubbc) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC(1); } &ToChars($message); # Censor the signature. &LoadCensorList; $message = &Censor($message); $row_signature = qq~   $profile_txt{'85'}
$message
~; if ($img_greybox) { $yyinlinestyle .= qq~\n~; $yyjavascript .= qq~ var GB_ROOT_DIR = "$yyhtml_root/greybox/"; // -->