1############################################################################### 2# Profile.pm # 3# $Date: 12.02.14 $ # 4############################################################################### 5# YaBB: Yet another Bulletin Board # 6# Open-Source Community Software for Webmasters # 7# Version: YaBB 2.6.11 # 8# Packaged: December 2, 2014 # 9# Distributed by: http://www.yabbforum.com # 10# =========================================================================== # 11# Copyright (c) 2000-2014 YaBB (www.yabbforum.com) - All Rights Reserved. # 12# Software by: The YaBB Development Team # 13# with assistance from the YaBB community. # 14############################################################################### 15# use strict; 16# use warnings; 17no warnings qw(uninitialized once redefine); 18use English qw(-no_match_vars); 19use CGI::Carp qw(fatalsToBrowser); 20our $VERSION = '2.6.11'; 21 22$profilepmver = 'YaBB 2.6.11 $Revision: 1611 $'; 23if ( $action eq 'detailedversion' ) { return 1; } 24 25LoadLanguage('Profile'); 26LoadLanguage('Register'); 27require Sources::AddModerators; 28get_micon(); 29get_template('MyProfile'); 30get_gmod(); 31 32$pm_lev = PMlev(); 33 34# make sure this person has access to this profile 35sub PrepareProfile { 36 if ($iamguest) { fatal_error('no_access'); } 37 38 # If someone registers with a '+' in their name It causes problems. 39 # Get's turned into a <space> in the query string Change it back here. 40 # Users who register with spaces get them replaced with _ 41 # So no problem there. 42 $INFO{'username'} =~ tr/ /+/; 43 44 $user = $INFO{'username'}; 45 if ($do_scramble_id) { decloak($user); } 46 if ( $user =~ m{/}sm ) { fatal_error('no_user_slash'); } 47 if ( $user =~ m{\\}sm ) { fatal_error('no_user_backslash'); } 48 49 if ( !LoadUser($user) ) { fatal_error('no_profile_exists'); } 50 51 if ( 52 ( 53 $user ne $username 54 && !$iamadmin 55 && ( !$iamgmod || !$allow_gmod_profile ) 56 ) 57 || ( $user eq 'admin' && $username ne 'admin' ) 58 || ( $iamgmod && ${ $uid . $user }{'position'} eq 'Administrator' ) 59 ) 60 { 61 fatal_error('not_allowed_profile_change'); 62 } 63 64 @menucolors = qw(catbg catbg catbg catbg catbg catbg); 65 return; 66} 67 68# Check that profile-editing session is still valid 69sub SidCheck { 70 my @x = @_; 71 my $cur_sid = decloak( $INFO{'sid'} ); 72 my $sid_check = substr $date, 5, 5; 73 if ( $sid_check <= 600 && $cur_sid >= 99_400 ) { $sid_check += 100_000; } 74 75 $sid_expires = $cur_sid + 600 - $sid_check; 76 77 if ( $sid_expires < 0 || $cur_sid > $sid_check ) { ProfileCheck( $x[0] ); } 78 if ( $sid_expires < 60 ) { 79 $expsectxt = 80 ( $sid_expires == 1 ) 81 ? $profile_txt{'sid_expires_3'} 82 : $profile_txt{'sid_expires_2'}; 83 $expiretxt = qq~$profile_txt{'sid_expires_1'} $sid_expires $expsectxt~; 84 } 85 else { 86 $expiremin = int( $sid_expires / 60 ); 87 $expiresec = $sid_expires % 60; 88 $expmintxt = 89 ( $expiremin == 1 ) 90 ? $profile_txt{'sid_expires_4'} 91 : $profile_txt{'sid_expires_5'}; 92 $expsectxt = 93 ( $expiresec == 1 ) 94 ? $profile_txt{'sid_expires_3'} 95 : $profile_txt{'sid_expires_2'}; 96 $expiretxt = 97qq~$profile_txt{'sid_expires_1'} $expiremin $expmintxt $expiresec $expsectxt~; 98 } 99 return; 100} 101 102sub ProfileCheck { 103 my @x = @_; 104 PrepareProfile(); 105 106 my $sid_descript = $mycenter_profile_txt{'siddescript'}; 107 if ( $x[0] ) { 108 $sid_descript = $mycenter_profile_txt{'timeoutdescript'}; 109 $redirsid = $x[0]; 110 if ( $redirsid =~ s/2$//xsm ) { 111 $yyjavascript .= qq~\nalert("$profile_txt{'897'}");~; 112 } 113 } 114 else { 115 $redirsid = $INFO{'page'} || 'profile'; 116 } 117 118 $yymain .= $myprofile_a; 119 $yymain =~ s/{yabb sid_descript}/$sid_descript/sm; 120 $yymain =~ 121s/{yabb prof_act}/$scripturl?action=profileCheck2;username=$useraccount{$user}/sm; 122 $yymain =~ s/{yabb redirsid}/$redirsid/sm; 123 124 $yynavigation = qq~› $profile_txt{'900'}~; 125 $yytitle = $profile_txt{'900'}; 126 template(); 127 return; 128} 129 130sub ProfileCheck2 { 131 PrepareProfile(); 132 133 my $password = encode_password( $FORM{'passwrd'} || $INFO{'passwrd'} ); 134 if ( $user eq $username && $password ne ${ $uid . $username }{'password'} ) 135 { 136 fatal_error('current_password_wrong'); 137 } 138 if ( ( $iamadmin || ( $iamgmod && $allow_gmod_profile ) ) 139 && $password ne ${ $uid . $username }{'password'} ) 140 { 141 fatal_error('no_admin_password'); 142 } 143 144 # Update the sessionID too 145 ${ $uid . $username }{'session'} = encode_password($user_ip); 146 UserAccount( $username, 'update' ); 147 148 # update only this cookie since we don't know when the others will expire 149 $yySetCookies3 = write_cookie( 150 -name => "$cookiesession_name", 151 -value => "${$uid.$username}{'session'}", 152 -path => q{/}, 153 -expires => 'Sunday, 17-Jan-2038 00:00:00 GMT' 154 ); 155 156 # Get a semi-secure SID - only for profile changes 157 # cloak the sid -> no point giving anyone the means. 158 $yySetLocation = 159 "$scripturl?action=" 160 . ( $FORM{'redir'} || $INFO{'redir'} || 'profile' ) 161 . ";username=$useraccount{$user};sid=" 162 . cloak( reverse substr $date, 5, 5 ) 163 . ( $INFO{'newpassword'} ? ';newpassword=1' : q{} ); 164 redirectexit(); 165 return; 166} 167 168sub ProfileMenu { 169 return if $view; 170 171 if ($buddyListEnabled) { 172 $bdlist = $myprofie_bdlist; 173 $bdlist =~ s/{yabb menucolor3}/$menucolors[3]/sm; 174 $bdlist =~ s/{yabb bduser}/$useraccount{$user}/sm; 175 } 176 177 if ( $pm_lev == 1 ) { 178 $pmlevel = $myprofile_pmlevel; 179 $pmlevel =~ s/{yabb menucolor4}/$menucolors[4]/sm; 180 $pmlevel =~ s/{yabb pmuser}/$useraccount{$user}/sm; 181 } 182 if ( 183 $iamadmin 184 || ( $iamgmod 185 && $allow_gmod_profile 186 && $gmod_access2{'profileAdmin'} eq 'on' ) 187 ) 188 { 189 $showadmin = $myprofile_showadmin; 190 $showadmin =~ s/{yabb menucolor5}/$menucolors[5]/sm; 191 $showadmin =~ s/{yabb aduser}/$useraccount{$user}/sm; 192 } 193 $yymain .= $myprofile_menu; 194 $yymain =~ s/{yabb menu_user}/$useraccount{$user}/gsm; 195 $yymain =~ s/{yabb sid}/$INFO{'sid'}/gsm; 196 $yymain =~ s/{yabb menucolor0}/$menucolors[0]/sm; 197 $yymain =~ s/{yabb menucolor1}/$menucolors[1]/sm; 198 $yymain =~ s/{yabb menucolor2}/$menucolors[2]/sm; 199 $yymain =~ s/{yabb bdlist}/$bdlist/sm; 200 $yymain =~ s/{yabb pmlevel}/$pmlevel/sm; 201 $yymain =~ s/{yabb showadmin}/$showadmin/sm; 202 return $yymain; 203} 204 205sub ModifyProfile { 206 SidCheck($action); 207 PrepareProfile(); 208 209 $menucolors[0] = 'selected-bg'; 210 ProfileMenu(); 211 212 if ($iamadmin) { 213 $confdel_text = 214 qq~$profile_txt{'775'} $profile_txt{'777'} $user $profile_txt{'778'}~; 215 if ( $user eq $username ) { 216 $passtext = $profile_txt{'821'}; 217 } 218 else { 219 $passtext = qq~$profile_txt{'2'} $profile_txt{'36'}~; 220 } 221 } 222 else { 223 $confdel_text = 224 qq~$profile_txt{'775'} $profile_txt{'776'} $profile_txt{'778'}~; 225 $passtext = $profile_txt{'821'}; 226 } 227 228 $passtext .= qq~<br /><span class="small norm">$profile_txt{'895'}</span>~; 229 230 my $scriptAction = q~profile2~; 231 if ($view) { 232 $scriptAction = q~myprofile2~; 233 $yytitle = $profile_txt{'editmyprofile'}; 234 $profiletitle = qq~$profile_txt{'editmyprofile'} ($user)~; 235 $yynavigation = 236qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $profiletitle~; 237 } 238 else { 239 $yytitle = $profile_txt{'79'}; 240 $profiletitle = qq~$profile_txt{'79'} ($user)~; 241 $yynavigation = qq~› $profiletitle~; 242 } 243 244 if ( ${ $uid . $user }{'gender'} eq 'Male' ) { 245 $GenderMale = ' selected="selected" '; 246 } 247 if ( ${ $uid . $user }{'gender'} eq 'Female' ) { 248 $GenderFemale = ' selected="selected" '; 249 } 250 CalcAge( $user, 'parse' ); 251 252 my ( $editAgeTxt, $editAgeCount, $disableBdayFields, $editGenderTxt, 253 $editGenderCount, $disableGenderField, $genderField, $bdayFields ); 254 $editGenderLimit ||= 0; 255 if ( $editGenderLimit > 0 256 && !$iamadmin 257 && ( !$iamgmod || !$allow_gmod_profile ) ) 258 { 259 if ( $editGenderLimit == 1 && ${ $uid . $user }{'gender'} eq q{} ) { 260 $editGenderTxt = qq~$profile_txt{'gender_edit_1'}~; 261 } 262 elsif ( ${ $uid . $user }{'disablegender'} >= $editGenderLimit ) { 263 $editGenderTxt = qq~$profile_txt{'gender_edit_3'}~; 264 $disableGenderField = q~ disabled="disabled"~; 265 $genderField = qq~ 266<input type="hidden" name="gender" value="${ $uid . $user }{'gender'}" />~; 267 } 268 elsif (${ $uid . $user }{'disablegender'} eq q{} 269 && ${ $uid . $user }{'gender'} eq q{} ) 270 { 271 if ( $editGenderCount == 1 ) { 272 $editGenderTxt = 273qq~ $profile_txt{'gender_edit_2'} $editGenderLimit $profile_txt{'dob_edit_5'}~; 274 } 275 else { 276 $editGenderTxt = 277qq~ $profile_txt{'gender_edit_2'} $editGenderLimit $profile_txt{'dob_edit_6'}~; 278 } 279 } 280 elsif ( ${ $uid . $user }{'disablegender'} < $editGenderLimit ) { 281 $editGenderCount = 282 $editGenderLimit - ${ $uid . $user }{'disablegender'}; 283 if ( $editGenderCount == 1 ) { 284 $editGenderTxt = 285qq~ $profile_txt{'gender_edit_2'} $editGenderCount $profile_txt{'dob_edit_3'}~; 286 } 287 else { 288 $editGenderTxt = 289qq~ $profile_txt{'gender_edit_2'} $editGenderCount $profile_txt{'dob_edit_4'}~; 290 } 291 } 292 $editGenderTxt = qq~<br /><span class="small">$editGenderTxt</span>~; 293 } 294 295 $editAgeLimit ||= 0; 296 if ( $editAgeLimit > 0 && !$iamadmin && ( !$iamgmod || !$allow_gmod_profile ) ) 297 { 298 if ( $editAgeLimit == 1 && ${ $uid . $user }{'disableage'} eq q{} ) { 299 $editAgeTxt = qq~$profile_txt{'dob_edit_1'}~; 300 } 301 elsif ( ${ $uid . $user }{'disableage'} >= $editAgeLimit && ${ $uid . $user }{'bday'} ne q{}) { 302 $editAgeTxt = qq~$profile_txt{'dob_edit_7'}~; 303 $disableBdayFields = q~ disabled="disabled"~; 304 $bdayFields = qq~ 305<input type="hidden" name="bday1" value="$umonth" /> 306<input type="hidden" name="bday2" value="$uday" /> 307<input type="hidden" name="bday3" value="$uyear" />~; 308 } 309 elsif (${ $uid . $user }{'disableage'} eq q{} 310 && ${ $uid . $user }{'bday'} eq q{} ) 311 { 312 if ( $editAgeCount == 1 ) { 313 $editAgeTxt .= 314qq~ $profile_txt{'dob_edit_2'} $editAgeLimit $profile_txt{'dob_edit_5'}~; 315 } 316 else { 317 $editAgeTxt .= 318qq~ $profile_txt{'dob_edit_2'} $editAgeLimit $profile_txt{'dob_edit_6'}~; 319 } 320 } 321 elsif ( ${ $uid . $user }{'disableage'} < $editAgeLimit ) { 322 $editAgeCount = $editAgeLimit - ${ $uid . $user }{'disableage'}; 323 if ( $editAgeCount == 1 ) { 324 $editAgeTxt .= 325qq~ $profile_txt{'dob_edit_2'} $editAgeCount $profile_txt{'dob_edit_3'}~; 326 } 327 else { 328 $editAgeTxt .= 329qq~ $profile_txt{'dob_edit_2'} $editAgeCount $profile_txt{'dob_edit_4'}~; 330 } 331 } 332 $editAgeTxt = qq~<br /><span class="small">$editAgeTxt</span>~; 333 } 334 335 my $timeorder; 336 my @selist = ( 2, 3, 6, 8 ); 337 if ( ${ $uid . $user }{'timeselect'} ) { 338 for my $i (@selist) { 339 if ( ${ $uid . $user }{'timeselect'} == $i ) { $timeorder = 1; } 340 } 341 } 342 else { 343 for my $i (@selist) { 344 if ( $timeselected == $i ) { $timeorder = 1; } 345 } 346 } 347 348 $selectyear = q{}; 349 $seluyear = 350qq~$profile_txt{'566'}<select name="bday3"$disableBdayFields><option value="">--</option>\n~; 351 for my $e ( 1905 .. ( $year - 3 ) ) { 352 $seluyear .= 353 qq~<option value="$e" ${isselected($uyear == $e)}>$e</option>\n~; 354 } 355 $seluyear .= q~</select> ~; 356 357 $selectmnth = q{}; 358 $dayormonthm = 359qq~<label for="bday1">$profile_txt{'564'}</label><select name="bday1" id="bday1"$disableBdayFields><option value="">--</option>\n~; 360 for my $bb ( 1 .. 12 ) { 361 if ( $bb < 10 ) { $c = "0$bb"; } 362 else { $c = $bb; } 363 $dayormonthm .= 364 qq~<option value="$c" ${isselected($umonth == $bb)}>$c</option>\n~; 365 } 366 $dayormonthm .= q~</select> ~; 367 368 $selectday = q{}; 369 $dayormonthd = 370qq~<label for="bday2">$profile_txt{'565'}</label><select name="bday2" id="bday2"$disableBdayFields><option value="">--</option>\n~; 371 for my $aa ( 1 .. 31 ) { 372 if ( $aa < 10 ) { $d = "0$aa"; } 373 else { $d = $aa; } 374 $dayormonthd .= 375 qq~<option value="$d" ${isselected($uday == $aa)}>$d</option>\n~; 376 } 377 $dayormonthd .= q~</select> ~; 378 379 if ($timeorder) { $dayormonth = $dayormonthd . $dayormonthm; } 380 else { $dayormonth = $dayormonthm . $dayormonthd; } 381 $dayormonth =~ s/for="bday\d"/for="birthday"/oxsm; 382 $dayormonth =~ s/id="bday\d"/id="birthday"/oxsm; 383 384 $my_newpass = ( $INFO{'newpassword'} ? $profile_txt{'80'} : q{} ); 385 $my_passchk = password_check(); 386 $my_name_not = q{}; 387 if ($name_cannot_be_userid) { 388 $my_name_not = qq~ 389 <span class="small">$profile_txt{'8'}</span></label>~; 390 } 391 if ( $showage == 1 ) { 392 my $checked = q{}; 393 if ( ${ $uid . $user }{'hideage'} ) { $checked = ' checked="checked"'; } 394 $my_showageshow = $myprofile_showage; 395 $my_showageshow =~ s/{yabb agechecked}/$checked/sm; 396 } 397 398 if ($extendedprofiles) { 399 require Sources::ExtendedProfiles; 400 my $show_ext_prof = ext_editprofile( $user, 'edit' ); 401 $my_show_ext_prof = $show_ext_prof; 402 } 403 404 if ( $birthday_on_reg > 1 ) { 405 $myrequirebd = qq~ <span class="small">$profile_txt{'563b'}</span>~; 406 } 407 $showProfile .= qq~ 408<form action="$scripturl?action=$scriptAction;username=$useraccount{$INFO{'username'}};sid=$INFO{'sid'}" method="post" name="creator" accept-charset="$yymycharset"> 409$myprofile_edit~; 410 $showProfile =~ s/{yabb profiletitle}/$profiletitle/sm; 411 $showProfile =~ s/{yabb my_newpass}/$my_newpass/sm; 412 $showProfile =~ s/{yabb my_passchk}/$my_passchk/sm; 413 $showProfile =~ s/{yabb my_name_not}/$my_name_not/sm; 414 $showProfile =~ s/{yabb user}/${$uid.$user}{'realname'}/gsm; 415 $showProfile =~ s/{yabb editGenderTxt}/$editGenderTxt/sm; 416 $showProfile =~ s/{yabb disableGenderField}/$disableGenderField/sm; 417 $showProfile =~ s/{yabb GenderMale}/$GenderMale/sm; 418 $showProfile =~ s/{yabb GenderFemale}/$GenderFemale/sm; 419 $showProfile =~ s/{yabb genderField}/$genderField/sm; 420 $showProfile =~ s/{yabb editAgeTxt}/$editAgeTxt/sm; 421 $showProfile =~ s/{yabb require_bd}/$myrequirebd/sm; 422 $showProfile =~ s/{yabb bdaysel}/$dayormonth$seluyear$bdayFields/sm; 423 $showProfile =~ s/{yabb showageshow}/$my_showageshow/sm; 424 $showProfile =~ s/{yabb user_location}/${$uid.$user}{'location'}/sm; 425 $showProfile =~ s/{yabb my_show_ext_prof}/$my_show_ext_prof/sm; 426## Mod Hook showProfile1 ## 427 428 if ( $sessions == 1 429 && $sessionvalid == 1 430 && ($staff) 431 && $username eq $user ) 432 { 433 LoadLanguage('Sessions'); 434 my $decanswer = ${ $uid . $user }{'sesanswer'}; 435 $questsel = qq~<select name="sesquest" id="sesquest" size="1">\n~; 436 while ( ( $key, $val ) = each %sesquest_txt ) { 437 if ( ${ $uid . $user }{'sesquest'} eq $key 438 && ${ $uid . $user }{'sesquest'} ne q{} ) 439 { 440 $sessel = q~ selected="selected"~; 441 } 442 elsif ( $key eq 'password' && ${ $uid . $user }{'sesquest'} eq q{} ) 443 { 444 $sessel = q~ selected="selected"~; 445 } 446 else { 447 $sessel = q{}; 448 } 449 $questsel .= qq~<option value="$key"$sessel>$val</option>\n~; 450 } 451 $questsel .= qq~</select>\n~; 452 $showProfile .= $myprofile_session; 453 $showProfile =~ s/{yabb questsel}/$questsel/sm; 454 $showProfile =~ s/{yabb decanswer}/$decanswer/sm; 455 $showProfile =~ s/{yabb sesstext9}/$session_txt{'9'}/sm; 456 $showProfile =~ s/{yabb sesstext9a}/$session_txt{'9a'}/sm; 457 } 458 if ( $self_del_user == 1 ) { 459 if ( ( $iamadmin && ( $username ne $user ) ) 460 || ( $username ne 'admin' ) ) 461 { 462 $show_confdel = 463qq~ <input type="submit" name="moda" value="$profile_txt{'89'}" onclick="return confirm('$confdel_text')" class="button" />~; 464 } 465 } 466 else { 467 if ( $iamadmin && $username ne $user ) { 468 $show_confdel = 469qq~ <input type="submit" name="moda" value="$profile_txt{'89'}" onclick="return confirm('$confdel_text')" class="button" />~; 470 } 471 } 472 $showProfile .= $myprofile_bottom; 473 $showProfile =~ s/{yabb show_confdel}/$show_confdel/sm; 474 $showProfile =~ s/{yabb sid_expires}/$expiretxt/sm; 475 476 if ( !$view ) { 477 $yymain .= $showProfile; 478 template(); 479 } 480 return; 481} 482 483sub ModifyProfileContacts { 484 SidCheck($action); 485 PrepareProfile(); 486 487 $menucolors[1] = 'selected-bg'; 488 ProfileMenu(); 489 490 my $scriptAction = q~profileContacts2~; 491 if ($view) { 492 $scriptAction = q~myprofileContacts2~; 493 $yytitle = 494 qq~$profile_txt{'editmyprofile'} › $profile_txt{'819'}~; 495 $profiletitle = 496qq~$profile_txt{'editmyprofile'} ($user) › $profile_txt{'819'}~; 497 $yynavigation = 498qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $profiletitle~; 499 } 500 else { 501 $yytitle = qq~$profile_txt{'79'} › $profile_txt{'819'}~; 502 $profiletitle = 503 qq~$profile_txt{'79'} ($user) › $profile_txt{'819'}~; 504 $yynavigation = qq~› $profiletitle~; 505 } 506 507 ${ $uid . $user }{'aim'} =~ tr/+/ /; 508 ${ $uid . $user }{'yim'} =~ tr/+/ /; 509 if ($allow_hide_email) { 510 my $checked = q{}; 511 if ( ${ $uid . $user }{'hidemail'} ) { 512 $checked = ' checked="checked"'; 513 } 514 $my_hidemail = $myprofile_hidemail; 515 $my_hidemail =~ s/{yabb checked}/$checked/sm; 516 } 517 518 if ( !$minlinkweb ) { $minlinkweb = 0; } 519 if ( ${ $uid . $user }{'postcount'} >= $minlinkweb 520 || ${ $uid . $user }{'position'} eq 'Administrator' 521 || ${ $uid . $user }{'position'} eq 'Global Moderator' ) 522 { 523 $my_minlinkweb = $myprofile_minlinkweb; 524 $my_minlinkweb =~ s/{yabb my_webtitle}/${$uid.$user}{'webtitle'}/sm; 525 $my_minlinkweb =~ s/{yabb my_weburl}/${$uid.$user}{'weburl'}/sm; 526 } 527 if ( 528 $pm_lev == 1 529 && ( 530 $enable_MCaway > 2 531 || ( 532 $enable_MCaway 533 && ( ${ $uid . $user }{'position'} eq 'Administrator' 534 || ${ $uid . $user }{'position'} eq 'Global Moderator' 535 || ${ $uid . $user }{'position'} eq 'Mid Moderator' 536 || is_moderator($user) ) 537 ) 538 ) 539 ) 540 { 541 my $offChecked = q~ selected="selected"~; 542 my $awayChecked = q{}; 543 544 if ( ${ $uid . $user }{'offlinestatus'} eq 'away' ) { 545 $offChecked = q{}; 546 $awayChecked = q~ selected="selected"~; 547 } 548 549 my $awayreply = ${ $uid . $user }{'awayreply'}; 550 $awayreply =~ s/<br \/>/\n/gsm; 551 $my_away = $myprofile_away; 552 $my_away .= 553qq~ <textarea name="awayreply" id="awayreply" rows="4" cols="50">$awayreply</textarea><br />~; 554 $my_away .= $myprofile_away_b; 555 $my_away =~ s/{yabb offChecked}/$offChecked/sm; 556 $my_away =~ s/{yabb awayChecked}/$awayChecked/sm; 557 $my_away =~ s/{yabb MaxAwayLen}/$MaxAwayLen/gsm; 558 } 559 if ( 560 ( 561 ${ $uid . $user }{'position'} eq 'Administrator' 562 || ${ $uid . $user }{'position'} eq 'Global Moderator' 563 ) 564 && $enable_MCstatusStealth 565 ) 566 { 567 my $stealthChecked = q{}; 568 if ( ${ $uid . $user }{'stealth'} ) { 569 $stealthChecked = ' checked="checked"'; 570 } 571 $my_stealth = $myprofile_stealth; 572 $my_stealth =~ s/{yabb stealthChecked}/$stealthChecked/sm; 573 } 574 575 if ($extendedprofiles) { 576 require Sources::ExtendedProfiles; 577 $my_extended .= ext_editprofile( $user, 'contact' ); 578 } 579 580 $showProfile .= qq~ 581<form action="$scripturl?action=$scriptAction;username=$useraccount{$INFO{'username'}};sid=$INFO{'sid'}" method="post" name="creator" accept-charset="$yymycharset"> 582$myprofile_contact 583~; 584 $showProfile =~ s/{yabb profiletitle}/$profiletitle/sm; 585 $showProfile =~ s/{yabb user_email}/${$uid.$user}{'email'}/sm; 586 $showProfile =~ s/{yabb my_hidemail}/$my_hidemail/sm; 587 $showProfile =~ s/{yabb my_icq}/${$uid.$user}{'icq'}/sm; 588 $showProfile =~ s/{yabb my_aim}/${$uid.$user}{'aim'}/sm; 589 $showProfile =~ s/{yabb my_yim}/${$uid.$user}{'yim'}/sm; 590 $showProfile =~ s/{yabb my_gtalk}/${$uid.$user}{'gtalk'}/sm; 591 $showProfile =~ s/{yabb my_skype}/${$uid.$user}{'skype'}/sm; 592 $showProfile =~ s/{yabb my_myspace}/${$uid.$user}{'myspace'}/sm; 593 $showProfile =~ s/{yabb my_facebook}/${$uid.$user}{'facebook'}/sm; 594 $showProfile =~ s/{yabb my_twitter}/${$uid.$user}{'twitter'}/sm; 595 $showProfile =~ s/{yabb my_youtube}/${$uid.$user}{'youtube'}/sm; 596 $showProfile =~ s/{yabb my_minlinkweb}/$my_minlinkweb/sm; 597 $showProfile =~ s/{yabb my_away}/$my_away/sm; 598 $showProfile =~ s/{yabb my_stealth}/$my_stealth/sm; 599 $showProfile =~ s/{yabb my_extended}/$my_extended/sm; 600 $showProfile =~ s/{yabb sid_expires}/$expiretxt/sm; 601 602 if ( !$view ) { 603 $yymain .= $showProfile; 604 template(); 605 } 606 return; 607} 608 609sub ModifyProfileOptions { 610 SidCheck($action); 611 PrepareProfile(); 612 613 $menucolors[2] = 'selected-bg'; 614 ProfileMenu(); 615 616 my $scriptAction = q~profileOptions2~; 617 if ($view) { 618 $scriptAction = q~myprofileOptions2~; 619 $yytitle = 620 qq~$profile_txt{'editmyprofile'} › $profile_txt{'818'}~; 621 $profiletitle = 622qq~$profile_txt{'editmyprofile'} ($user) › $profile_txt{'818'}~; 623 $yynavigation = 624qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $profiletitle~; 625 } 626 else { 627 $yytitle = qq~$profile_txt{'79'} › $profile_txt{'818'}~; 628 $profiletitle = 629 qq~$profile_txt{'79'} ($user) › $profile_txt{'818'}~; 630 $yynavigation = qq~› $profiletitle~; 631 } 632 633 if ( $allowpics && $upload_useravatar && $upload_avatargroup ) { 634 $upload_useravatar = 0; 635 foreach my $av_gr ( split /, /sm, $upload_avatargroup ) { 636 if ( $av_gr eq ${ $uid . $user }{'position'} ) { 637 $upload_useravatar = 1; 638 last; 639 } 640 foreach ( split /,/xsm, ${ $uid . $user }{'addgroups'} ) { 641 if ( $av_gr eq $_ ) { $upload_useravatar = 1; last; } 642 } 643 } 644 } 645 646 $my_allow_avatars = ( 647 ( $allowpics && $upload_useravatar ) 648 ? q~ enctype="multipart/form-data"~ 649 : q{} 650 ); 651 652 if ($allowpics) { 653 opendir( DIR, $facesdir ) 654 or fatal_error( 'cannot_open_dir', 655 "($facesdir)!<br />$profile_txt{'681'}", 1 ); 656 @contents = readdir DIR; 657 closedir DIR; 658 $images = q{}; 659 foreach my $line ( sort @contents ) { 660 ( $name, $extension ) = split /\./xsm, $line; 661 $checked = q{}; 662 if ( $line eq ${ $uid . $user }{'userpic'} ) { 663 $checked = ' selected="selected"'; 664 } 665 if ( ${ $uid . $user }{'userpic'} =~ m{\Ahttps?://}sm 666 && $line eq $my_blank_avatar ) 667 { 668 $checked = ' selected="selected" '; 669 } 670 if ( $extension =~ /gif/ism 671 || $extension =~ /jpg/ism 672 || $extension =~ /jpeg/ism 673 || $extension =~ /png/ism ) 674 { 675 if ( $line eq $my_blank_avatar ) { 676 $images = 677qq~ <option value="$line"$checked>$profile_txt{'422'}</option>\n$images~; 678 } 679 else { 680 $images .= 681qq~ <option value="$line"$checked>$name</option>\n~; 682 } 683 } 684 } 685 my ( $pic, $s, $alt ); 686 my $tmp = $facesurl; 687 if ( $tmp =~ /^(http(s?):\/\/)/xsm ) { 688 ( $tmp, $s ) = ( $1, $2 ); 689 } 690 if ( ${ $uid . $user }{'userpic'} =~ m{\Ahttps?://}sm ) { 691 $pic = ${ $uid . $user }{'userpic'}; 692 $checked = ' checked="checked" '; 693 $tmp = ${ $uid . $user }{'userpic'}; 694 if ($upload_useravatar) { $alt = $profile_txt{'473'}; } 695 } 696 else { 697 $pic = "$facesurl/${$uid.$user}{'userpic'}"; 698 } 699 700 $avatar_limit ||= 0; 701 $my_up_avatar_a = ( 702 $upload_useravatar 703 ? qq~<br /> 704 $profile_txt{'476'} $avatar_limit KB~ 705 : q{} 706 ); 707 $my_up_avatar_b = ( 708 $upload_useravatar 709 ? q~<br /> 710 <br /> 711 <input type="file" name="file_avatar" size="50" />~ 712 : q{} 713 ); 714 715 $my_show_avatar = $myprofile_show_avatar_a; 716 $my_show_avatar =~ s/{yabb my_up_avatar_a}/$my_up_avatar_a/sm; 717 $my_show_avatar =~ s/{yabb my_up_avatar_b}/$my_up_avatar_b/sm; 718 $my_show_avatar =~ s/{yabb av_pic}/$pic/sm; 719 $my_show_avatar =~ s/{yabb av_alt}/$alt/sm; 720 $my_show_avatar =~ s/{yabb av_s}/$s/gsm; 721 $my_show_avatar =~ s/{yabb av_tmp}/$tmp/sm; 722 $my_show_avatar =~ s/{yabb images}/$images/sm; 723 $my_show_avatar =~ s/{yabb checked}/$checked/sm; 724 } 725 726 $signature = ${ $uid . $user }{'signature'}; 727 $signature =~ s/<br.*?>/\n/gsm; 728 729 if ( $addmemgroup_enabled > 1 && %NoPost ) { 730 my ( $addmemgroup, $selsize ) = 731 DrawGroups( ${ $uid . $user }{'addgroups'}, 732 ${ $uid . $user }{'position'}, 0 ); 733 734 if ( $addmemgroup ) { 735 $my_addmemgroup = $myprofile_addmemgroup; 736 $my_addmemgroup =~ s/{yabb selsize}/$selsize/sm; 737 $my_addmemgroup =~ s/{yabb addmemgroup}/$addmemgroup/sm; 738 } 739 } 740 741 if ( $NewNotificationAlert 742 || $enable_notifications == 1 743 || $enable_notifications == 3 ) 744 { 745 if ($NewNotificationAlert) { 746 $my_notify_a = q~ 747 <input type="checkbox" value="1" name="onlinealert" id="onlinealert"~ 748 . ( 749 ${ $uid . $user }{'onlinealert'} ? ' checked="checked"' : q{} ) 750 . qq~ /> <label for="onlinealert">$profile_txt{'onlinealertexplain'}</label>~; 751 } 752 if ( $enable_notifications == 1 || $enable_notifications == 3 ) { 753 if ($NewNotificationAlert) { 754 $my_notify_b = q~<br /> 755 <br />~; 756 } 757 758 $my_notify_b .= qq~ 759 <label for="notify_N">$profile_txt{'326'}</label>? <select name="notify_N" id="notify_N"> 760 <option value="0"~ 761 . ( 762 ( 763 !${ $uid . $user }{'notify_me'} 764 || ${ $uid . $user }{'notify_me'} == 2 765 ) ? ' selected="selected"' : q{} 766 ) 767 . qq~>$profile_txt{'164'}</option> 768 <option value="1"~ 769 . ( 770 ( 771 ${ $uid . $user }{'notify_me'} == 1 772 || ${ $uid . $user }{'notify_me'} == 3 773 ) ? ' selected="selected"' : q{} 774 ) 775 . qq~>$profile_txt{'163'}</option> 776 </select>~; 777 } 778 $my_notify = $myprofile_notify; 779 $my_notify =~ s/{yabb my_notify_a}/$my_notify_a/sm; 780 $my_notify =~ s/{yabb my_notify_b}/$my_notify_b/sm; 781 } 782 783 if ($ttsureverse) { 784 if ( !exists( ${ $uid . $user }{'reversetopic'} ) ) { 785 ${ $uid . $user }{'reversetopic'} = $ttsreverse; 786 } 787 $my_reversi = 788 ${ $uid . $user }{'reversetopic'} ? q~ checked="checked"~ : q{}; 789 $my_reverse = $myprofile_reverse; 790 $my_reverse =~ s/{yabb my_reversi}/$my_reversi/sm; 791 } 792 793 my $rts = ${ $uid . $user }{'return_to'}; 794 for my $rt ( 1 .. 3 ) { 795 $return_to_select .= 796 $rts == $rt 797 ? qq~<option value="$rt" selected="selected">$return_to_txt{$rt}</option>~ 798 : qq~<option value="$rt">$return_to_txt{$rt}</option>~; 799 } 800 my $return_to = $myprofile_return_to; 801 $return_to =~ s/{yabb return_to_select}/$return_to_select/sm; 802 803 my $tmptcnt = 0; 804 foreach my $curtemplate ( 805 sort { $templateset{$a} cmp $templateset{$b} } 806 keys %templateset 807 ) 808 { 809 $drawndirs .= 810qq~<option value="$curtemplate"${isselected($curtemplate eq ${ $uid . $user }{'template'})}>$curtemplate</option>\n~; 811 $tmptcnt++; 812 } 813 814 my $my_template = q{}; 815 if ( $tmptcnt > 1 ) { 816 $my_template = $myprofile_template; 817 $my_template =~ s/{yabb drawndirs}/$drawndirs/sm; 818 } 819 820 opendir DIR, $langdir; 821 my @lfilesanddirs = readdir DIR; 822 closedir DIR; 823 my $lngcnt = 0; 824 foreach my $fld ( sort { lc($a) cmp lc $b } @lfilesanddirs ) { 825 if ( -e "$langdir/$fld/Main.lng" ) { 826 my $displang = $fld; 827 $displang =~ s/(.+?)\_(.+?)$/$1 ($2)/gism; 828 $drawnldirs .= 829qq~<option value="$fld" ${isselected(${ $uid . $user }{'language'} eq $fld)}>$displang</option>~; 830 $lngcnt++; 831 } 832 } 833 834 my $my_show_lang = q{}; 835 if ( $lngcnt > 1 ) { 836 $my_show_lang = $myprofile_show_lang; 837 $my_show_lang =~ s/{yabb drawnldirs}/$drawnldirs/sm; 838 } 839 840 if ( $user_hide_avatars && $showuserpic && $allowpics ) 841 { # checkbox to hide avatars in threads 842 $my_show_avatar_opts = $myprofile_show_avatars; 843 $my_hide_avatar = 844 ${ $uid . $user }{'hide_avatars'} ? ' checked="checked"' : q{}; 845 $my_show_avatar_opts =~ s/{yabb user_showavatar}/$my_hide_avatar/sm; 846 } 847 else { $my_show_avatar_opts = q{}; } 848 849 if ( $user_hide_user_text && $showusertext ) 850 { # checkbox to hide user-text in threads 851 $my_show_avatar_opts .= $myprofile_hide_user_text; 852 $my_hide_user_text = 853 ${ $uid . $user }{'hide_user_text'} ? ' checked="checked"' : q{}; 854 $my_show_avatar_opts =~ s/{yabb hide_user_text}/$my_hide_user_text/sm; 855 } 856 857 if ($user_hide_img) { # checkbox to hide images in threads 858 $my_show_avatar_opts .= $myprofile_hide_img; 859 $my_hide_img = 860 ${ $uid . $user }{'hide_img'} ? ' checked="checked"' : q{}; 861 $my_show_avatar_opts =~ s/{yabb hide_img}/$my_hide_img/sm; 862 } 863 864 $allowattach ||= 0; 865 if ( $user_hide_attach_img && $allowattach > 0 ) 866 { # checkbox to hide attached images in threads 867 $my_show_avatar_opts .= $myprofile_hide_attach_img; 868 $my_hide_attach_img = 869 ${ $uid . $user }{'hide_attach_img'} ? ' checked="checked"' : q{}; 870 $my_show_avatar_opts =~ s/{yabb hide_attach_img}/$my_hide_attach_img/sm; 871 } 872 873 if ($user_hide_signat) { # checkbox to hide signatures in threads 874 $my_show_avatar_opts .= $myprofile_hide_signat; 875 $my_hide_signat = 876 ${ $uid . $user }{'hide_signat'} ? ' checked="checked"' : q{}; 877 $my_show_avatar_opts =~ s/{yabb hide_signat}/$my_hide_signat/sm; 878 } 879 880 if ( $user_hide_smilies_row && !$removenormalsmilies ) 881 { # checkbox to hide the row of smilies below the the post-message-inputbox 882 $my_show_avatar_opts .= $myprofile_hide_smilies_row; 883 $my_hide_smilies_row = 884 ${ $uid . $user }{'hide_smilies_row'} ? ' checked="checked"' : q{}; 885 $my_show_avatar_opts =~ 886 s/{yabb hide_smilies_row}/$my_hide_smilies_row/sm; 887 } 888 889 if ($extendedprofiles) { 890 require Sources::ExtendedProfiles; 891 $my_extprofile = ext_editprofile( $user, 'options' ); 892 } 893 894 my $cnnn = 0; 895 for my $i ( 1 .. 5 ) { 896 if ( ${ $uid . $user }{'numberformat'} == $i ) { 897 $unfsl[$i] = ' selected="selected" '; 898 $cnnn++; 899 } 900 else { $unfsl[$i] = q{}; } 901 } 902 for my $i ( 1 .. 5 ) { 903 if ( $forumnumberformat == $i && $cnnn == 0 ) { 904 $unfsl[$i] = ' selected="selected" '; 905 } 906 } 907 908 my $cntm = 0; 909 for my $j ( 1 .. 8 ) { 910 if ( ${ $uid . $user }{'timeselect'} == $j ) { 911 $tsl[$j] = ' selected="selected" '; 912 $cntm++; 913 } 914 else { $tsl[$j] = q{}; } 915 } 916 for my $j ( 1 .. 8 ) { 917 if ( $timeselected == $j && $cntm == 0 ) { 918 $tsl[$j] = ' selected="selected" '; 919 } 920 } 921 922 $my_num_option = qq~<option value="1"$unfsl[1]>10987.65</option> 923 <option value="2"$unfsl[2]>10987,65</option> 924 <option value="3"$unfsl[3]>10,987.65</option> 925 <option value="4"$unfsl[4]>10.987,65</option> 926 <option value="5"$unfsl[5]>10 987,65</option>~; 927 928 $my_time_option = qq~<option value="1"$tsl[1]>$profile_txt{'480'}</option> 929 <option value="5"$tsl[5]>$profile_txt{'484'}</option> 930 <option value="4"$tsl[4]>$profile_txt{'483'}</option> 931 <option value="8"$tsl[8]>$profile_txt{'483a'}</option> 932 <option value="2"$tsl[2]>$profile_txt{'481'}</option> 933 <option value="3"$tsl[3]>$profile_txt{'482'}</option> 934 <option value="6"$tsl[6]>$profile_txt{'485'}</option>~; 935 $my_timeformat = timeformat( $date, 1 ); 936 937 if ($enabletz) { 938 eval { 939 require DateTime; 940 require DateTime::TimeZone; 941 }; 942 my $user_tz_select = q{}; 943 $default_tz ||= 'UTC'; 944 if ( !$EVAL_ERROR ) { 945 require DateTime; 946 require DateTime::TimeZone; 947 LoadLanguage('Countries'); 948 $mytz = ${ $uid . $user }{'user_tz'} || $default_tz; 949 my @mycntry = sort { $countrytime_txt{$a} cmp $countrytime_txt{$b} } keys %countrytime_txt; 950 my $myselect = q{}; 951 if ( $mytz eq 'UTC' ) { 952 $myselect = ' selected="selected"'; 953 } 954 $user_tz_select = q~<br /><select name="user_tz" id="user_tz">~; 955 $user_tz_select .= qq~<option value="UTC"$myselect>UTC</option>~; 956 for my $i (@mycntry) { 957 { 958 if ( $i eq $mytz ) { 959 $myselect = ' selected="selected"'; 960 } 961 else { $myselect = q{}; } 962 $user_tz_select .= 963qq~<option value="$i"$myselect>$countrytime_txt{$i}</option>~; 964 } 965 } 966 $user_tz_select .= q~</select>~; 967 } 968 else { 969 $mytz = ${ $uid . $user }{'user_tz'} || $default_tz; 970 $localopt = q{}; 971 if ( $mytz eq 'local' ) { 972 $myselectb = ' selected="selected"'; 973 } 974 elsif ( $mytz eq 'UTC' ) { 975 $myselecta = ' selected="selected"'; 976 } 977 if ( $default_tz eq 'local' ) { 978 $localopt = 979qq~\n<option value="local"$myselectb>$profile_txt{'372a'}</option>~; 980 } 981 $user_tz_select = q~<br /><select name="user_tz" id="user_tz">~; 982 $user_tz_select .= qq~<option value="UTC"$myselecta>UTC</option>~; 983 $user_tz_select .= $localopt; 984 $user_tz_select .= q~</select>~; 985 } 986 $my_tz = $my_tz_select; 987 $my_tz =~ s/{yabb my_user_tz}/$user_tz_select/sm; 988 989 } 990 else { $my_tz = q{}; } 991 992 $my_dynamic = 993 ${ $uid . $user }{'dynamic_clock'} ? ' checked="checked"' : q{}; 994 995 $my_time = $myprofile_time; 996 $my_time =~ s/{yabb my_num_option}/$my_num_option/sm; 997 $my_time =~ s/{yabb my_time_option}/$my_time_option/sm; 998 $my_time =~ s/{yabb timeformat}/${$uid.$user}{'timeformat'}/sm; 999 $my_time =~ s/{yabb my_timeformat}/$my_timeformat/sm; 1000 $my_time =~ s/{yabb my_tz_select}/$my_tz/sm; 1001 $my_time =~ s/{yabb my_dynamic}/$my_dynamic/sm; 1002 1003 $showProfile .= qq~ 1004<form action="$scripturl?action=$scriptAction;username=$useraccount{$INFO{'username'}};sid=$INFO{'sid'}" method="post" name="creator"$my_allow_avatars>~; 1005 $showProfile .= $myprofile_options; 1006 $showProfile .= 1007qq~ <textarea name="signature" id="signature" rows="4" cols="30" class="width_100">$signature</textarea><br />~; 1008 $showProfile .= $myprofile_options_b; 1009 1010 $showProfile =~ s/{yabb usertext}/${$uid.$user}{'usertext'}/sm; 1011 $showProfile =~ s/{yabb profiletitle}/$profiletitle/sm; 1012 $showProfile =~ s/{yabb my_show_avatar}/$my_show_avatar/sm; 1013 $showProfile =~ s/{yabb MaxSigLen}/$MaxSigLen/gsm; 1014 $showProfile =~ s/{yabb my_addmemgroup}/$my_addmemgroup/sm; 1015 $showProfile =~ s/{yabb my_time}/$my_time/sm; 1016 $showProfile =~ s/{yabb my_notify}/$my_notify/sm; 1017 $showProfile =~ s/{yabb my_reverse}/$my_reverse/sm; 1018 $showProfile =~ s/{yabb my_return_to}/$return_to/sm; 1019 $showProfile =~ s/{yabb my_template}/$my_template/sm; 1020 $showProfile =~ s/{yabb my_show_lang}/$my_show_lang/sm; 1021 $showProfile =~ s/{yabb my_show_avatar_opts}/$my_show_avatar_opts/sm; 1022 $showProfile =~ s/{yabb my_extprofile}/$my_extprofile/sm; 1023 $showProfile =~ s/{yabb sid_expires}/$expiretxt/sm; 1024 1025## Mod Hook showProfile_options ## 1026 1027 if ( !$view ) { 1028 $yymain .= $showProfile; 1029 template(); 1030 } 1031 return; 1032} 1033 1034sub ModifyProfileBuddy { 1035 SidCheck($action); 1036 PrepareProfile(); 1037 1038 $menucolors[3] = 'selected-bg'; 1039 ProfileMenu(); 1040 1041 my $scriptAction = q~profileBuddy2~; 1042 if ($view) { 1043 $scriptAction = q~myprofileBuddy2~; 1044 $yytitle = 1045qq~$profile_txt{'editmyprofile'} › $profile_buddy_list{'buddylist'}~; 1046 $profiletitle = 1047qq~$profile_txt{'editmyprofile'} ($user) › $profile_buddy_list{'buddylist'}~; 1048 $yynavigation = 1049qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $profiletitle~; 1050 } 1051 else { 1052 $yytitle = 1053 qq~$profile_txt{'79'} › $profile_buddy_list{'buddylist'}~; 1054 $profiletitle = 1055qq~$profile_txt{'79'} ($user) › $profile_buddy_list{'buddylist'}~; 1056 $yynavigation = qq~› $profiletitle~; 1057 } 1058 1059 if ( !$yyjavascript ) { $yyjavascript = q{}; } 1060 $yyjavascript .= qq~ 1061 function imWin() { 1062 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'); 1063 } 1064 // removes a user from the list 1065 function removeUser(oElement) { 1066 var oList = oElement.options; 1067 var indexToRemove = oList.selectedIndex; 1068 if (oList.length > 1 || (oList.length == 1 && oList[0].value != '0')) { 1069 //alert('element [' + oElement.options[indexToRemove].value + ']'); 1070 if (confirm("$profile_buddy_list{'removealert'}")) { 1071 oElement.remove(indexToRemove); 1072 } 1073 } 1074 } 1075 function selectblNames() { 1076 var oList = document.getElementById('buddylist'); 1077 for (var i = 0; i < oList.options.length; i++) { 1078 oList.options[i].selected = true; 1079 } 1080 } 1081 ~; 1082 1083 my $buildBuddyList = q{}; 1084 if ( ${ $uid . $user }{'buddylist'} ) { 1085 my @buddies = split /\|/xsm, ${ $uid . $user }{'buddylist'}; 1086 chomp @buddies; 1087 foreach my $buddy (@buddies) { 1088 LoadUser($buddy); 1089 if ( ${ $uid . $buddy }{'realname'} ) { 1090 $buildBuddyList .= 1091qq~<option value="$buddy">${$uid.$buddy}{'realname'}</option>~; 1092 } 1093 } 1094 } 1095 1096 $showProfile .= qq~ 1097<form action="$scripturl?action=$scriptAction;username=$useraccount{$INFO{'username'}};sid=$INFO{'sid'}" method="post" name="creator" onsubmit="javascript: selectblNames();">~; 1098 $showProfile .= $myprofile_buddy; 1099 1100 $showProfile =~ s/{yabb profiletitle}/$profiletitle/sm; 1101 $showProfile =~ s/{yabb buildBuddyList}/$buildBuddyList/sm; 1102 $showProfile =~ s/{yabb sid_expires}/$expiretxt/sm; 1103 1104 if ( !$view ) { 1105 $yymain .= $showProfile; 1106 template(); 1107 } 1108 return; 1109} 1110 1111sub ModifyProfileIM { 1112 SidCheck($action); 1113 PrepareProfile(); 1114 1115 $menucolors[4] = 'selected-bg'; 1116 ProfileMenu(); 1117 1118 $yyjavascript .= qq~ 1119 function imWin() { 1120 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'); 1121 } 1122 // removes a user from the list 1123 function removeUser(oElement) { 1124 var oList = oElement.options; 1125 var indexToRemove = oList.selectedIndex; 1126 if (oList.length > 1 || (oList.length == 1 && oList[0].value != '0')) { 1127 //alert('element [' + oElement.options[indexToRemove].value + ']'); 1128 if (confirm("$profile_buddy_list{'removealert'}")) { 1129 oElement.remove(indexToRemove); 1130 } 1131 } 1132 } 1133 function selectINames() { 1134 var oList = document.getElementById('ignore'); 1135 for (var i = 0; i < oList.options.length; i++) { 1136 oList.options[i].selected = true; 1137 } 1138 } 1139 ~; 1140 1141 my $scriptAction = q~profileIM2~; 1142 if ($view) { 1143 $scriptAction = q~myprofileIM2~; 1144 $yytitle = 1145 qq~$profile_txt{'editmyprofile'} › $profile_imtxt{'38'}~; 1146 $profiletitle = 1147qq~$profile_txt{'editmyprofile'} ($user) › $profile_imtxt{'38'}~; 1148 $yynavigation = 1149qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $profiletitle~; 1150 } 1151 else { 1152 $yytitle = qq~$profile_txt{79} › $profile_imtxt{'38'}~; 1153 $profiletitle = 1154 qq~$profile_txt{79} ($user) › $profile_imtxt{'38'}~; 1155 $yynavigation = qq~› $profiletitle~; 1156 } 1157 my $ignoreallChecked = q{}; 1158 if ( ${ $uid . $user }{'im_ignorelist'} eq q{*} ) { 1159 $ignoreallChecked = ' checked="checked"'; 1160 } 1161 if ( ${ $uid . $user }{'im_ignorelist'} 1162 && ${ $uid . $user }{'im_ignorelist'} ne q{*} ) 1163 { 1164 my @ignoreList = split /\|/xsm, ${ $uid . $user }{'im_ignorelist'}; 1165 chomp @ignoreList; 1166 foreach my $ignoreName (@ignoreList) { 1167 LoadUser($ignoreName); 1168 my $ignoreUser; 1169 if ( ${ $uid . $ignoreName }{'realname'} ) { 1170 $ignoreUser = ${ $uid . $ignoreName }{'realname'}; 1171 } 1172 else { $ignoreUser = $ignoreName; } 1173 $ignoreName = cloak($ignoreName); 1174 $my_ignore .= 1175qq~\n <option value="$ignoreName">$ignoreUser</option>~; 1176 } 1177 } 1178 1179 if ( $enable_notifications > 1 ) { 1180 $my_PM_notifyme = 1181 ${ $uid . $user }{'notify_me'} < 2 ? ' selected="selected"' : q{}; 1182 $my_PM_notifyme_2 = 1183 ${ $uid . $user }{'notify_me'} > 1 ? ' selected="selected"' : q{}; 1184 1185 $my_PMnotify = $myprofile_PMnotify; 1186 $my_PMnotify =~ s/{yabb my_PM_notifyme}/$my_PM_notifyme/sm; 1187 $my_PMnotify =~ s/{yabb my_PM_notifyme_2}/$my_PM_notifyme_2/sm; 1188 } 1189 1190 if ( ${ $uid . $user }{'im_popup'} ) { 1191 $enable_userimpopup = ' checked="checked"'; 1192 } 1193 if ( ${ $uid . $user }{'im_imspop'} ) { 1194 $popup_userim = 'checked="checked"'; 1195 } 1196 my $pmviewMessChecked; 1197 if ( ${ $uid . $user }{'pmviewMess'} ) { 1198 $pmviewMessChecked = ' checked="checked"'; 1199 } 1200 if ($extendedprofiles) { 1201 require Sources::ExtendedProfiles; 1202 $my_extprofile .= ext_editprofile( $user, 'im' ); 1203 } 1204 1205 $showProfile .= qq~ 1206<form action="$scripturl?action=$scriptAction;username=$useraccount{$INFO{'username'}};sid=$INFO{'sid'}" method="post" name="creator" onsubmit="javascript:selectINames();" >~; 1207 $showProfile .= $myprofile_PMpref; 1208 1209 $showProfile =~ s/{yabb profiletitle}/$profiletitle/sm; 1210 $showProfile =~ s/{yabb my_ignore}/$my_ignore/sm; 1211 $showProfile =~ s/{yabb enable_userimpopup}/$enable_userimpopup/sm; 1212 $showProfile =~ s/{yabb popup_userim}/$popup_userim/sm; 1213 $showProfile =~ s/{yabb pmviewMessChecked}/$pmviewMessChecked/sm; 1214 $showProfile =~ s/{yabb my_extprofile}/$my_extprofile/sm; 1215 $showProfile =~ s/{yabb sid_expires}/$expiretxt/sm; 1216 $showProfile =~ s/{yabb my_PMnotify}/$my_PMnotify/sm; 1217 1218 if ( !$view ) { 1219 $yymain .= $showProfile; 1220 template(); 1221 } 1222 return; 1223} 1224 1225sub ModifyProfileAdmin { 1226 is_admin_or_gmod(); 1227 SidCheck($action); 1228 PrepareProfile(); 1229 1230 $menucolors[5] = 'selected-bg'; 1231 ProfileMenu(); 1232 1233 my @grps = sort keys %Group; 1234 my @memstat = (); 1235 $mygrp = 0; 1236 for ( @grps ) { 1237 if ( ${ $uid . $user }{'position'} eq $_ ) { 1238 @memstat = split /\|/xsm, $Group{$_}; 1239 $tt = $memstat[0]; 1240 $mygrp = 1; 1241 } 1242 } 1243 if ( $mygrp != 1) { 1244 if ( ${ $uid . $user }{'position'} ) { 1245 $ttgrp = ${ $uid . $user }{'position'}; 1246 ( $tt, undef ) = split /\|/xsm, $NoPost{$ttgrp}, 2; 1247 } 1248 else { $tt = ${ $uid . $user }{'position'}; } 1249 } 1250 1251 $regreason = ${ $uid . $user }{'regreason'}; 1252 $regreason =~ s/<br \/>/\n/gsm; 1253 1254 my ( $tta, $selsize ); 1255 if (%NoPost) { 1256 ( $tta, $selsize ) = 1257 DrawGroups( ${ $uid . $user }{'addgroups'}, q{}, 1 ); 1258 } 1259 1260 $userlastlogin = timeformat( ${ $uid . $user }{'lastonline'} ); 1261 $userlastpost = timeformat( ${ $uid . $user }{'lastpost'} ); 1262 $userlastim = timeformat( ${ $uid . $user }{'lastim'} ); 1263 if ( $userlastlogin eq q{} ) { $userlastlogin = $profile_txt{'470'}; } 1264 if ( $userlastpost eq q{} ) { $userlastpost = $profile_txt{'470'}; } 1265 if ( $userlastim eq q{} ) { $userlastim = $profile_txt{'470'}; } 1266 1267 my $scriptAction = q~profileAdmin2~; 1268 if ($view) { 1269 $scriptAction = q~myprofileAdmin2~; 1270 $yytitle = 1271 qq~$profile_txt{'editmyprofile'} › $profile_txt{'820'}~; 1272 $profiletitle = 1273qq~$profile_txt{'editmyprofile'} ($user) › $profile_txt{'820'}~; 1274 $yynavigation = 1275qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $profiletitle~; 1276 } 1277 else { 1278 $yytitle = qq~$profile_txt{'79'} › $profile_txt{'820'}~; 1279 $profiletitle = 1280 qq~$profile_txt{'79'} ($user) › $profile_txt{'820'}~; 1281 $yynavigation = qq~› $profiletitle~; 1282 } 1283 if ( $iamadmin ) { 1284 for ( @grps ) { 1285 @memstat = split /\|/xsm, $Group{$_}; 1286 $my_group .= 1287qq~\n <option value="$_">$memstat[0]</option>~; 1288 } 1289 } 1290 1291 my $z = 0; 1292 for (@nopostorder) { 1293 @memstat = split /\|/xsm, 1294 $NoPost{$_}, 5; 1295 $my_group .= qq~<option value="$_">$memstat[0]</option>~; 1296 $z++; 1297 } 1298 1299 if ( $tta ne q{} ) { 1300 $my_tta = $myprofile_tta; 1301 $my_tta =~ s/{yabb selsize}/$selsize/sm; 1302 $my_tta =~ s/{yabb tta}/$tta/sm; 1303 } 1304 1305 ( 1306 $dr_secund, $dr_minute, $dr_hour, $dr_day, $dr_month, 1307 $dr_year, undef, undef, undef 1308 ) 1309 = gmtime( 1310 ${ $uid . $user }{'regtime'} 1311 ? ${ $uid . $user }{'regtime'} 1312 : $forumstart 1313 ); 1314 $dr_month++; 1315 1316 if ( $dr_month > 12 ) { $dr_month = 12; } ## month cannot be above 12! 1317 if ( $dr_month < 1 ) { $dr_month = 1; } ## neither can it be less than 1 1318 if ( $dr_day > 31 ) { $dr_day = 31; } ## day of month over 31 1319 if ( $dr_day < 1 ) { $dr_day = 1; } 1320 if ( length($dr_year) > 2 ) { 1321 $dr_year = substr $dr_year, length($dr_year) - 2, 2; 1322 } 1323 if ( $dr_year < 90 && $dr_year > 50 ) { 1324 $dr_year = 90; 1325 } ## a year over 50 is taken to be 1990 1326 if ( $dr_year > 20 && $dr_year < 51 ) { 1327 $dr_year = 20; 1328 } ## a year 50 or lower is taken to be 2020 1329 if ( $dr_hour > 23 ) { $dr_hour = 23; } 1330 if ( $dr_minute > 59 ) { $dr_minute = 59; } 1331 if ( $dr_secund > 59 ) { $dr_secund = 59; } 1332 1333 $sel_day = qq~ 1334 <select name="dr_day">\n~; 1335 for my $i ( 1 .. 31 ) { 1336 $day_val = sprintf '%02d', $i; 1337 if ( $dr_day == $i ) { 1338 $sel_day .= 1339qq~ <option value="$day_val" selected="selected">$i</option>\n~; 1340 } 1341 else { 1342 $sel_day .= 1343 qq~ <option value="$day_val">$i</option>\n~; 1344 } 1345 } 1346 $sel_day .= qq~ </select>\n~; 1347 1348 $sel_month = qq~ 1349 <select name="dr_month">\n~; 1350 for my $i ( 0 .. 11 ) { 1351 $z = $i + 1; 1352 $month_val = sprintf '%02d', $z; 1353 if ( $dr_month == $z ) { 1354 $sel_month .= 1355qq~ <option value="$month_val" selected="selected">$months[$i]</option>\n~; 1356 } 1357 else { 1358 $sel_month .= 1359qq~ <option value="$month_val">$months[$i]</option>\n~; 1360 } 1361 } 1362 $sel_month .= qq~ </select>\n~; 1363 1364 $sel_year = qq~ 1365 <select name="dr_year">\n~; 1366 for my $i ( 1990 .. $year ) { 1367 my $year_val = substr $i, 2, 2; 1368 if ( $dr_year == $year_val ) { 1369 $sel_year .= 1370qq~ <option value="$year_val" selected="selected">$i</option>\n~; 1371 } 1372 else { 1373 $sel_year .= 1374 qq~ <option value="$year_val">$i</option>\n~; 1375 } 1376 } 1377 $sel_year .= q~ </select>~; 1378 1379 $time_sel = ${ $uid . $username }{'timeselect'}; 1380 if ( $time_sel == 1 || $time_sel == 4 || $time_sel == 5 ) { 1381 $all_date = qq~$sel_month $sel_day $sel_year~; 1382 } 1383 else { $all_date = qq~$sel_day $sel_month $sel_year~; } 1384 $all_date =~ s/<select name/<select id="dr_day_month" name/osm; 1385 1386 $sel_hour = qq~ 1387 <select name="dr_hour">\n~; 1388 for my $i ( 0 .. 23 ) { 1389 my $hour_val = sprintf '%02d', $i; 1390 if ( $dr_hour == $i ) { 1391 $sel_hour .= 1392qq~ <option value="$hour_val" selected="selected">$hour_val</option>\n~; 1393 } 1394 else { 1395 $sel_hour .= 1396qq~ <option value="$hour_val">$hour_val</option>\n~; 1397 } 1398 } 1399 $sel_hour .= qq~ </select>\n~; 1400 1401 $sel_minute = qq~ 1402 <select name="dr_minute">\n~; 1403 for my $i ( 0 .. 59 ) { 1404 $minute_val = sprintf '%02d', $i; 1405 if ( $dr_minute == $i ) { 1406 $sel_minute .= 1407qq~ <option value="$minute_val" selected="selected">$minute_val</option>\n~; 1408 } 1409 else { 1410 $sel_minute .= 1411qq~ <option value="$minute_val">$minute_val</option>\n~; 1412 } 1413 } 1414 $sel_minute .= q~ </select>~; 1415 1416 if ($extendedprofiles) { 1417 require Sources::ExtendedProfiles; 1418 $my_extprofile .= ext_editprofile( $user, 'admin' ); 1419 } 1420 1421 $myprofile_userinfo = 1422 qq~<input type="hidden" name="username" value="$INFO{'username'}" />~; 1423 $showProfile .= qq~ 1424<form action="$scripturl?action=$scriptAction;username=$useraccount{$user};sid=$INFO{'sid'}" method="post" name="creator">~; 1425 $showProfile .= $myprofile_admin_a; 1426 AddModerators(); 1427 $showProfile .= $myprofile_admin_b; 1428 $showProfile .= 1429qq~<textarea rows="4" cols="50" name="regreason" id="regreason">$regreason</textarea>~; 1430 $showProfile .= $myprofile_admin_bb; 1431 1432 $showProfile =~ s/{yabb profiletitle}/$profiletitle/sm; 1433 $showProfile =~ s/{yabb myprofile_userinfo}/$myprofile_userinfo/sm; 1434 $showProfile =~ s/{yabb postcount}/${$uid.$user}{'postcount'}/sm; 1435 $showProfile =~ s/{yabb position}/${$uid.$user}{'position'}/gsm; 1436 $showProfile =~ s/{yabb tt}/$tt/sm; 1437 $showProfile =~ s/{yabb my_tta}/$my_tta/sm; 1438 $showProfile =~ s/{yabb my_group}/$my_group/sm; 1439 $showProfile =~ s/{yabb all_date}/$all_date/sm; 1440 $showProfile =~ s/{yabb sel_hour}/$sel_hour/sm; 1441 $showProfile =~ s/{yabb sel_minute}/$sel_minute/sm; 1442 $showProfile =~ s/{yabb dr_secund}/$dr_secund/sm; 1443 $showProfile =~ s/{yabb regreason}/$regreason/sm; 1444 $showProfile =~ s/{yabb userlastlogin}/$userlastlogin/sm; 1445 $showProfile =~ s/{yabb userlastpost}/$userlastpost/sm; 1446 $showProfile =~ s/{yabb userlastim}/$userlastim/sm; 1447 $showProfile =~ s/{yabb my_extprofile}/$my_extprofile/sm; 1448 $showProfile =~ s/{yabb sid_expires}/$expiretxt/sm; 1449 1450## Mod Hook showProfile_admin ## 1451 1452 if ( !$view ) { 1453 $yymain .= $showProfile; 1454 template(); 1455 } 1456 return; 1457} 1458 1459sub ModifyProfile2 { 1460 SidCheck($action); 1461 PrepareProfile(); 1462 1463 my ( %member, $key, $value ); 1464 while ( ( $key, $value ) = each %FORM ) { 1465 $value =~ s/\A\s+//sm; 1466 $value =~ s/\s+\Z//sm; 1467 $value =~ s/[\n\r]//gxsm; 1468 $member{$key} = $value; 1469 } 1470 $member{'username'} = $user; 1471 1472 if ( $member{'moda'} eq $profile_txt{'88'} ) { 1473 if ( $sessions == 1 1474 && $sessionvalid == 1 1475 && ( $iamadmin || $iamgmod ) 1476 && $username eq $user ) 1477 { 1478 if ( $member{'sesquest'} eq 'password' ) { 1479 $member{'sesanswer'} = q{}; 1480 } 1481 elsif ( $member{'sesanswer'} eq q{} ) { 1482 fatal_error('no_secret_answer'); 1483 } 1484 } 1485 1486 if ( $member{'passwrd1'} || $member{'passwrd2'} ) { 1487 if ( $member{'passwrd1'} ne $member{'passwrd2'} ) { 1488 fatal_error( 'password_mismatch', "$member{'username'}" ); 1489 } 1490 if ( $member{'passwrd1'} eq q{} ) { 1491 fatal_error( 'no_password', "$member{'username'}" ); 1492 } 1493 if ( $member{'passwrd1'} =~ 1494 /[^\s\w!\@#\$\%\^&\*\(\)\+\|`~\-=\\:;'",\.\/\?\[\]\{\}]/xsm ) 1495 { 1496 fatal_error( 'invalid_character', 1497 "$profile_txt{'36'} $profile_txt{'241'}" ); 1498 } 1499 if ( $member{'username'} eq $member{'passwrd1'} ) { 1500 fatal_error('password_is_userid'); 1501 } 1502 } 1503 1504 if ( ${ $uid . $user }{'gender'} 1505 && $editGenderLimit 1506 && ${ $uid . $user }{'disablegender'} >= $editGenderLimit 1507 && !$iamadmin 1508 && ( !$iamgmod || !$allow_gmod_profile ) ) 1509 { 1510 if ( $member{'gender'} ne ${ $uid . $user }{'gender'} ) { 1511 fatal_error('not_allowed_gender_edit'); 1512 } 1513 } 1514 1515 if ( ${ $uid . $user }{'bday'} 1516 && $editAgeLimit 1517 && ${ $uid . $user }{'disableage'} >= $editAgeLimit 1518 && !$iamadmin 1519 && ( !$iamgmod || !$allow_gmod_profile ) ) 1520 { 1521 ( $user_birth_month, $user_birth_day, $user_birth_year ) = 1522 split /\//xsm, ${ $uid . $user }{'bday'}; 1523 if ( $member{'bday1'} != $user_birth_month 1524 || $member{'bday2'} != $user_birth_day 1525 || $member{'bday3'} != $user_birth_year ) 1526 { 1527 fatal_error('not_allowed_birthdate_change'); 1528 } 1529 } 1530 1531 if ( ( $birthday_on_reg > 1 && !$iamadmin && ( !$iamgmod || !$allow_gmod_profile ) ) && ( $member{'bday1'} eq q{} || $member{'bday2'} eq q{} || $member{'bday3'} eq q{} ) ) 1532 { 1533 fatal_error( 'invalid_birthdate', "($member{'bday1'}/$member{'bday2'}/$member{'bday3'})" ); 1534 } 1535 elsif ( $member{'bday1'} ne q{} || $member{'bday2'} ne q{} || $member{'bday3'} ne q{} ) { 1536 if ( $member{'bday1'} !~ /^[0-9]+$/xsm || $member{'bday2'} !~ /^[0-9]+$/xsm || $member{'bday3'} !~ /^[0-9]+$/xsm || length( $member{'bday3'} ) < 4 ) { 1537 fatal_error( 'invalid_birthdate', 1538 "($member{'bday1'}/$member{'bday2'}/$member{'bday3'})" ); 1539 } 1540 elsif ( $member{'bday1'} < 1 1541 || $member{'bday1'} > 12 1542 || $member{'bday2'} < 1 1543 || $member{'bday2'} > 31 1544 || $member{'bday3'} < 1901 1545 || $member{'bday3'} > $year - 5 ) 1546 { 1547 fatal_error( 'invalid_birthdate', 1548 "($member{'bday1'}/$member{'bday2'}/$member{'bday3'})" ); 1549 } 1550 } 1551 $member{'bday1'} =~ s/[^0-9]//gxsm; 1552 $member{'bday2'} =~ s/[^0-9]//gxsm; 1553 $member{'bday3'} =~ s/[^0-9]//gxsm; 1554 if ( $member{'bday1'} ) { 1555 $member{'bday'} = 1556 "$member{'bday1'}/$member{'bday2'}/$member{'bday3'}"; 1557 } 1558 else { $member{'bday'} = q{}; } 1559 1560 if ( ${ $uid . $user }{'bday'} ne "$member{'bday'}" ) { 1561 $Update_EventCal = 1; 1562 } 1563 1564 if ( 1565 $editGenderLimit 1566 && ( ${ $uid . $user }{'gender'} ne $member{'gender'} 1567 || ${ $uid . $user }{'gender'} eq q{} ) 1568 ) 1569 { 1570 if ( ${ $uid . $user }{'disablegender'} eq q{} ) { 1571 ${ $uid . $user }{'disablegender'} = 1; 1572 } 1573 else { ${ $uid . $user }{'disablegender'}++; } 1574 } 1575 if ( 1576 $editAgeLimit 1577 && ( ${ $uid . $user }{'bday'} ne $member{'bday'} 1578 || ${ $uid . $user }{'bday'} eq q{} ) 1579 ) 1580 { 1581 if ( ${ $uid . $user }{'disableage'} eq q{} ) { 1582 ${ $uid . $user }{'disableage'} = 1; 1583 } 1584 else { ${ $uid . $user }{'disableage'}++; } 1585 } 1586 1587 # EventCal Begin 1588 if ( ${ $uid . $user }{'bday'} ne "$member{'bday'}" 1589 || ${ $uid . $user }{'hideage'} ne "$member{'hideage'}" ) 1590 { 1591 $Update_EventCal = 1; 1592 } 1593 1594 # EventCal End 1595 1596 if ($extendedprofiles) { # run this before you start to save something! 1597 require Sources::ExtendedProfiles; 1598 my $error = ext_validate_submition( $username, $user ); 1599 if ( $error ne q{} ) { 1600 fatal_error( 'extended_profiles_validation', $error ); 1601 } 1602 ext_saveprofile($user); 1603 } 1604 1605 if ( ${ $uid . $user }{'realname'} ne $member{'name'} ) { 1606 $member{'name'} =~ s/\t+/\ /gsm; 1607 } 1608 if ( $member{'name'} eq q{} ) { fatal_error('no_name'); } 1609 if ( $name_cannot_be_userid 1610 && lc $member{'name'} eq lc $member{'username'} ) 1611 { 1612 fatal_error('name_is_userid'); 1613 } 1614 1615 LoadCensorList(); 1616 if ( Censor( $member{'name'} ) ne $member{'name'} ) { 1617 fatal_error( 'name_censored', CheckCensor("$member{'name'}") ); 1618 } 1619 1620 if ( ${ $uid . $user }{'password'} eq 1621 encode_password( $member{'name'} ) ) 1622 { 1623 fatal_error('password_is_userid'); 1624 } 1625 1626 FromChars( $member{'name'} ); 1627 $convertstr = $member{'name'}; 1628 $convertcut = 30; 1629 CountChars(); 1630 $member{'name'} = $convertstr; 1631 if ($cliped) { fatal_error('name_too_long'); } 1632 if ( 1633 $member{'name'} =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/sm ) 1634 { 1635 fatal_error( 'invalid_character', 1636 "$profile_txt{'68'} $profile_txt{'241re'}" ); 1637 } 1638 1639 ToHTML( $member{'name'} ); 1640 if ( $user ne 'admin' ) { 1641 1642 # Check to see if name is reserved 1643 fopen( FILE, "$vardir/reservecfg.txt" ) 1644 or fatal_error( 'cannot_open', "$vardir/reservecfg.txt", 1 ); 1645 my @reservecfg = <FILE>; 1646 fclose(FILE); 1647 chomp @reservecfg; 1648 my $matchword = $reservecfg[0] eq 'checked'; 1649 my $matchcase = $reservecfg[1] eq 'checked'; 1650 my $matchname = $reservecfg[3] eq 'checked'; 1651 my $namecheck = 1652 $matchcase eq 'checked' 1653 ? $member{'name'} 1654 : lc $member{'name'}; 1655 1656 fopen( FILE, "$vardir/reserve.txt" ) 1657 or fatal_error( 'cannot_open', "$vardir/reserve.txt", 1 ); 1658 my @reserve = <FILE>; 1659 fclose(FILE); 1660 foreach my $reserved (@reserve) { 1661 chomp $reserved; 1662 my $reservecheck = $matchcase ? $reserved : lc $reserved; 1663 if ($matchname) { 1664 if ($matchword) { 1665 if ( $namecheck eq $reservecheck ) { 1666 fatal_error( 'id_reserved', "$reserved" ); 1667 } 1668 } 1669 else { 1670 if ( $namecheck =~ $reservecheck ) { 1671 fatal_error( 'id_reserved', "$reserved" ); 1672 } 1673 } 1674 } 1675 } 1676 } 1677 1678 if ( 1679 ( 1680 lc MemberIndex( 'check_exist', $member{'name'}, 1 ) eq 1681 lc $member{'name'} 1682 ) 1683 && ( lc $member{'name'} ne lc ${ $uid . $user }{'realname'} ) 1684 && ( lc $member{'name'} ne lc $member{'username'} ) 1685 ) 1686 { 1687 fatal_error( 'name_taken', "($member{'name'})" ); 1688 } 1689 1690 # rewrite attachments.txt with new username 1691 fopen( ATM, "<$vardir/attachments.txt", 1 ) 1692 or fatal_error( 'cannot_open', "$vardir/attachments.txt" ); 1693 my @attachments = <ATM>; 1694 fclose(ATM); 1695 1696 for my $i ( 0 .. ( @attachments - 1 ) ) { 1697 $attachments[$i] =~ 1698s/^(\d+\|\d+\|.*?)\|(.*?)\|/ ($2 eq ${$uid.$user}{'realname'} ? "$1|$member{'name'}|" : "$1|$2|") /esm; 1699 } 1700 fopen( ATM, ">$vardir/attachments.txt", 1 ) 1701 or fatal_error( 'cannot_open', "$vardir/attachments.txt" ); 1702 print {ATM} @attachments or croak "$croak{'print'} ATM"; 1703 fclose(ATM); 1704 1705 #Since we have not encountered a fatal error, time to rewrite our memberlist. 1706 ManageMemberinfo( 'update', $user, $member{'name'} ); 1707 1708 ToHTML( $member{'gender'} ); 1709 FromChars( $member{'location'} ); 1710 ToHTML( $member{'location'} ); 1711 ToChars( $member{'location'} ); 1712 ToHTML( $member{'bday'} ); 1713 FromChars( $member{'sesquest'} ); 1714 ToHTML( $member{'sesquest'} ); 1715 ToChars( $member{'sesquest'} ); 1716 1717 # Time to print the changes to the username.vars file 1718 if ( $member{'passwrd1'} ) { 1719 ${ $uid . $user }{'password'} = 1720 encode_password( $member{'passwrd1'} ); 1721 } 1722 ${ $uid . $user }{'realname'} = $member{'name'}; 1723 ${ $uid . $user }{'gender'} = $member{'gender'}; 1724 ${ $uid . $user }{'location'} = $member{'location'}; 1725 ${ $uid . $user }{'bday'} = $member{'bday'}; 1726 ${ $uid . $user }{'hideage'} = $member{'hideage'}; 1727 ${ $uid . $user }{'sesquest'} = $member{'sesquest'}; 1728 1729 ${ $uid . $user }{'sesanswer'} = $member{'sesanswer'}; 1730 1731 # EventCal Begin 1732 if ( $Update_EventCal == 1 ) { 1733 fopen( FILE, "$vardir/eventcalbday.db" ); 1734 my @birthmembers = <FILE>; 1735 fclose(FILE); 1736 fopen( FILE, ">$vardir/eventcalbday.db" ); 1737 my $cn = 0; 1738 foreach my $x (@birthmembers) { 1739 chomp $x; 1740 my ( $user_year, $user_month, $user_day, $user_xy, $user_hide ) 1741 = split /\|/xsm, $x; 1742 if ( $user_xy eq $user ) { 1743 my ( $user_montha, $user_daya, $user_yeara ) = 1744 split /\//xsm, $member{'bday'}; 1745 if ( $user_montha < 10 && length($user_montha) == 1 ) { 1746 $user_montha = "0$user_montha"; 1747 } 1748 if ( $user_daya < 10 && length($user_daya) == 1 ) { 1749 $user_daya = "0$user_daya"; 1750 } 1751 if ( $member{'hideage'} ) { $nuser_hide = 1; } 1752 else { $nuser_hide = q{}; } 1753 print {FILE} 1754qq~$user_yeara|$user_montha|$user_daya|$user_xy|$nuser_hide\n~ 1755 or croak "$croak{'print'} birthday"; 1756 $cn++; 1757 } 1758 else { 1759 print {FILE} qq~$x\n~ or croak "$croak{'print'} birthday"; 1760 } 1761 } 1762 fclose(FILE); 1763 if ( $cn == 0 ) { 1764 fopen( FILE, ">>$vardir/eventcalbday.db" ); 1765 ( $user_montha, $user_daya, $user_yeara ) = split /\//xsm, 1766 $member{'bday'}; 1767 if ( $user_montha < 10 && length($user_montha) == 1 ) { 1768 $user_montha = "0$user_montha"; 1769 } 1770 if ( $user_daya < 10 && length($user_daya) == 1 ) { 1771 $user_daya = "0$user_daya"; 1772 } 1773 if ( $member{'hideage'} ) { $nuser_hide = 1; } 1774 else { $user_hide = q{}; } 1775 print {FILE} 1776 qq~$user_yeara|$user_montha|$user_daya|$user|$nuser_hide\n~ 1777 or croak "$croak{'print'} birthday"; 1778 fclose(FILE); 1779 } 1780 } 1781 1782 # EventCal End 1783 UserAccount( $user, 'update' ); 1784 1785 if ( $member{'passwrd1'} && $username eq $user ) { 1786 UpdateCookie( 1787 'write', $user, 1788 ${ $uid . $user }{'password'}, 1789 ${ $uid . $user }{'session'}, 1790 q{/}, q{} 1791 ); 1792 } 1793 1794 my $scriptAction = $view ? 'myprofileContacts' : 'profileContacts'; 1795 $yySetLocation = 1796qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; 1797 1798 } 1799 elsif ( $member{'moda'} eq $profile_txt{'89'} ) { 1800 if ( $member{'username'} eq 'admin' ) { 1801 fatal_error('cannot_kill_admin'); 1802 } 1803 1804 # For security, remove username from mod position 1805 KillModerator( $member{'username'} ); 1806 1807 $noteuser = $iamadmin ? $member{'username'} : $user; 1808 1809 unlink "$memberdir/$noteuser.dat"; 1810 unlink "$memberdir/$noteuser.vars"; 1811 unlink "$memberdir/$noteuser.ims"; 1812 unlink "$memberdir/$noteuser.msg"; 1813 unlink "$memberdir/$noteuser.log"; 1814 unlink "$memberdir/$noteuser.rlog"; 1815 unlink "$memberdir/$noteuser.outbox"; 1816 unlink "$memberdir/$noteuser.imstore"; 1817 unlink "$memberdir/$noteuser.imdraft"; 1818 1819 if ( ${ $uid . $user }{'userpic'} 1820 && ${ $uid . $user }{'userpic'} =~ 1821 /$facesurl\/UserAvatars\/(.+)/xsm ) 1822 { 1823 unlink "$facesdir/UserAvatars/$1"; 1824 } 1825 1826 fopen( PMATTACH, "<$vardir/pm.attachments" ) 1827 or fatal_error( 'cannot_open', "$vardir/pm.attachments", 1 ); 1828 @pmattach = <PMATTACH>; 1829 fclose(PMATTACH); 1830 1831 foreach my $pm_attach (@pmattach) { 1832 ( undef, undef, undef, $attach_file, undef, $attach_user ) = 1833 split /\|/xsm, $pm_attach; 1834 chomp $attach_user; 1835 if ( $noteuser eq $attach_user ) { 1836 unlink "$pmuploaddir/$attach_file"; 1837 } 1838 } 1839 1840 MemberIndex( 'remove', $noteuser ); 1841 1842 # EventCalbday Begin 1843 fopen( FILE, "$vardir/eventcalbday.db" ); 1844 my @birthmembers = <FILE>; 1845 fclose(FILE); 1846 fopen( FILE, ">$vardir/eventcalbday.db" ); 1847 foreach my $x (@birthmembers) { 1848 chomp $x; 1849 my ( undef, undef, undef, $user_xy, undef ) = 1850 split /\|/xsm, $x; 1851 if ( $user_xy ne $user ) { 1852 print {FILE} qq~$x\n~ or croak "$croak{'print'} birthday"; 1853 } 1854 else { 1855 print {FILE} q{} or croak "$croak{'print'} no-birthday"; 1856 } 1857 } 1858 fclose(FILE); 1859 1860 # EventCalbday End 1861 1862 if ( !$iamadmin ) { 1863 UpdateCookie('delete'); 1864 $username = 'Guest'; 1865 $iamguest = 1; 1866 $iamadmin = q{}; 1867 $iamgmod = q{}; 1868 $iamfmod = q{}; 1869 $password = q{}; 1870 $yyim = q{}; 1871 local $ENV{'HTTP_COOKIE'} = q{}; 1872 $yyuname = q{}; 1873 } 1874 $yySetLocation = $scripturl; 1875 1876 } 1877 else { 1878 fatal_error('not_allowed'); 1879 } 1880 redirectexit(); 1881 return; 1882} 1883 1884sub ModifyProfileContacts2 { 1885 SidCheck($action); 1886 PrepareProfile(); 1887 1888 my ( %member, $key, $value, $newpassemail, $tempname ); 1889 while ( ( $key, $value ) = each %FORM ) { 1890 $value =~ s/\A\s+//xsm; 1891 $value =~ s/\s+\Z//xsm; 1892 $value =~ s/\r//gxsm; 1893 if ( $key ne 'awayreply' ) { $value =~ s/\n//gxsm; } 1894 $member{$key} = $value; 1895 } 1896 $member{'username'} = $user; 1897 1898 if ( $member{'moda'} ne $profile_txt{'88'} ) { fatal_error('not_allowed'); } 1899 1900 if ( $emailnewpass 1901 && lc $member{'email'} ne lc ${ $uid . $user }{'email'} 1902 && !$iamadmin ) 1903 { 1904 srand; 1905 $member{'passwrd1'} = int rand 100; 1906 $member{'passwrd1'} =~ tr/0123456789/ymifxupbck/; 1907 $_ = int rand 77; 1908 $_ =~ tr/0123456789/q8dv7w4jm3/; 1909 $member{'passwrd1'} .= $_; 1910 $_ = int rand 89; 1911 $_ =~ tr/0123456789/y6uivpkcxw/; 1912 $member{'passwrd1'} .= $_; 1913 $_ = int rand 188; 1914 $_ =~ tr/0123456789/poiuytrewq/; 1915 $member{'passwrd1'} .= $_; 1916 $_ = int rand 65; 1917 $_ =~ tr/0123456789/lkjhgfdaut/; 1918 $member{'passwrd1'} .= $_; 1919 ${ $uid . $user }{'password'} = encode_password( $member{'passwrd1'} ); 1920 $newpassemail = 1; 1921 } 1922 1923 if ( $member{'email'} eq q{} ) { fatal_error('no_email'); } 1924 if ( $member{'email'} !~ /^[\w\-\.\+]+\@[\w\-\.\+]+\.\w{2,4}$/xsm ) { 1925 fatal_error( 'invalid_character', 1926 "$profile_txt{'69'} $profile_txt{'241e'}" ); 1927 } 1928 if ( 1929 ( $member{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/xsm ) 1930 || ( $member{'email'} !~ 1931 /^.+@\[?(\w|[-.])+\.[a-zA-Z]{2,4}|[0-9]{1,4}\]?$/xsm ) 1932 ) 1933 { 1934 fatal_error('invalid_email'); 1935 } 1936 LoadCensorList(); 1937 if ( Censor( $member{'email'} ) ne $member{'email'} ) { 1938 fatal_error( 'censor2', CheckCensor("$member{'email'}") ); 1939 } 1940 1941 $member{'icq'} =~ s/[^0-9]//gxsm; 1942 $member{'aim'} =~ s/ /\+/gsm; 1943 $member{'yim'} =~ s/ /\+/gsm; 1944 1945 ToHTML( $member{'email'} ); 1946 ToHTML( $member{'icq'} ); 1947 ToHTML( $member{'aim'} ); 1948 ToHTML( $member{'yim'} ); 1949 ToHTML( $member{'gtalk'} ); 1950 ToHTML( $member{'skype'} ); 1951 ToHTML( $member{'myspace'} ); 1952 ToHTML( $member{'facebook'} ); 1953 ToHTML( $member{'twitter'} ); 1954 ToHTML( $member{'youtube'} ); 1955 ToHTML( $member{'weburl'} ); 1956 FromChars( $member{'webtitle'} ); 1957 ToHTML( $member{'webtitle'} ); 1958 ToChars( $member{'webtitle'} ); 1959 ToHTML( $member{'offlinestatus'} ); 1960 FromChars( $member{'awaysubj'} ); 1961 ToHTML( $member{'awaysubj'} ); 1962 ToChars( $member{'awaysubj'} ); 1963 1964 FromChars( $member{'awayreply'} ); 1965 ToHTML( $member{'awayreply'} ); 1966 $member{'awayreply'} =~ s/\n/<br \/>/gsm; 1967 $convertstr = $member{'awayreply'}; 1968 $convertcut = $MaxAwayLen; 1969 CountChars(); 1970 $member{'awayreply'} = $convertstr; 1971 ToChars( $member{'awayreply'} ); 1972 1973 if ($extendedprofiles) { # run this before you start to save something! 1974 require Sources::ExtendedProfiles; 1975 my $error = ext_validate_submition( $username, $user ); 1976 if ( $error ne q{} ) { 1977 fatal_error( 'extended_profiles_validation', $error ); 1978 } 1979 ext_saveprofile($user); 1980 } 1981 1982 # Check to see if email is already taken 1983 if ( lc ${ $uid . $user }{'email'} ne lc $member{'email'} ) { 1984 $testemail = lc $member{'email'}; 1985 my $is_existing = MemberIndex( 'check_exist', $testemail, 2 ); 1986 if ( lc $is_existing eq $testemail ) { 1987 fatal_error( 'email_taken', "($member{'email'})" ); 1988 } 1989 } 1990 1991# Since we haven't encountered a fatal error, time to rewrite our memberlist a little. 1992 ManageMemberinfo( 'update', $user, q{}, $member{'email'} ); 1993## if enabled but not set, default offline status to 'offline' 1994 if ( $enable_MCaway && $member{'offlinestatus'} eq q{} ) { 1995 $member{'offlinestatus'} = 'offline'; 1996 } 1997 1998 # if user is switching 'away' to 'off/on', clean out the away-sent list 1999 if ( $FORM{'offlinestatus'} eq 'offline' ) { 2000 ${ $uid . $user }{'awayreplysent'} = q{}; 2001 } 2002 2003 # Time to print the changes to the username.vars file 2004 ${ $uid . $user }{'email'} = $member{'email'}; 2005 ${ $uid . $user }{'hidemail'} = $member{'hideemail'} ? 1 : 0; 2006 ${ $uid . $user }{'icq'} = $member{'icq'}; 2007 ${ $uid . $user }{'aim'} = $member{'aim'}; 2008 ${ $uid . $user }{'yim'} = $member{'yim'}; 2009 ${ $uid . $user }{'gtalk'} = $member{'gtalk'}; 2010 ${ $uid . $user }{'skype'} = $member{'skype'}; 2011 ${ $uid . $user }{'myspace'} = $member{'myspace'}; 2012 ${ $uid . $user }{'facebook'} = $member{'facebook'}; 2013 ${ $uid . $user }{'twitter'} = $member{'twitter'}; 2014 ${ $uid . $user }{'youtube'} = $member{'youtube'}; 2015 ${ $uid . $user }{'webtitle'} = $member{'webtitle'}; 2016 ${ $uid . $user }{'weburl'} = ( 2017 ( $member{'weburl'} && $member{'weburl'} !~ m{\Ahttps?://}sm ) 2018 ? 'http://' 2019 : q{} 2020 ) . $member{'weburl'}; 2021 ${ $uid . $user }{'offlinestatus'} = $member{'offlinestatus'}; 2022 ${ $uid . $user }{'awaysubj'} = $member{'awaysubj'}; 2023 ${ $uid . $user }{'awayreply'} = $member{'awayreply'}; 2024 ${ $uid . $user }{'stealth'} = 2025 ( ${ $uid . $user }{'position'} eq 'Administrator' 2026 || ${ $uid . $user }{'position'} eq 'Global Moderator' ) 2027 ? $member{'stealth'} 2028 : q{}; 2029 2030 UserAccount( $user, 'update' ); 2031 2032 if ( $emailnewpass && $newpassemail == 1 ) { 2033 RemoveUserOnline($user); # Remove user from online log 2034 2035 if ( $username eq $user ) { 2036 UpdateCookie('delete'); 2037 $username = 'Guest'; 2038 $iamguest = 1; 2039 $iamadmin = q{}; 2040 $iamgmod = q{}; 2041 $iamfmod = q{}; 2042 $password = q{}; 2043 $yyim = q{}; 2044 local $ENV{'HTTP_COOKIE'} = q{}; 2045 $yyuname = q{}; 2046 } 2047 FormatUserName( $member{'username'} ); 2048 require Sources::Mailer; 2049 my $scriptAction = $view ? 'myprofile' : 'profile'; 2050 sendmail( 2051 $member{'email'}, 2052 qq~$profile_txt{'700'} $mbname~, 2053"$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'}" 2054 ); 2055 require Sources::LogInOut; 2056 $sharedLogin_title = "$profile_txt{'34'}: $user"; 2057 $sharedLogin_text = $profile_txt{'638'}; 2058 $shared_login = sharedLogin(); 2059 $yymain .= $shared_login; 2060 $yytitle = $profile_txt{'245'}; 2061 template(); 2062 } 2063 2064 my $scriptAction = $view ? 'myprofileOptions' : 'profileOptions'; 2065 $yySetLocation = 2066qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; 2067 redirectexit(); 2068 return; 2069} 2070 2071sub ModifyProfileOptions2 { 2072 SidCheck($action); 2073 PrepareProfile(); 2074 2075 my ( %member, $key, $value, $tempname ); 2076 while ( ( $key, $value ) = each %FORM ) { 2077 $value =~ s/\A\s+//xsm; 2078 $value =~ s/\s+\Z//xsm; 2079 $value =~ s/\r//gxsm; 2080 if ( $key ne 'signature' ) { $value =~ s/\n//gxsm; } 2081 $member{$key} = $value; 2082 } 2083 $member{'username'} = $user; 2084 2085 if ( $member{'moda'} ne $profile_txt{'88'} ) { fatal_error('not_allowed'); } 2086 2087 if ( !$minlinksig ) { $minlinksig = 0; } 2088 if ( ${ $uid . $user }{'postcount'} < $minlinksig 2089 && !$iamadmin 2090 && !$iamgmod ) 2091 { 2092 if ( $member{'signature'} =~ m{http:\/\/}xsm 2093 || $member{'signature'} =~ m{https:\/\/}xsm 2094 || $member{'signature'} =~ m{ftp:\/\/}xsm 2095 || $member{'signature'} =~ m{www.}xsm 2096 || $member{'signature'} =~ m{ftp.}xsm =~ m{\[url}xsm 2097 || $member{'signature'} =~ m{\[link}xsm 2098 || $member{'signature'} =~ m{\[img}xsm 2099 || $member{'signature'} =~ m{\[ftp}xsm ) 2100 { 2101 fatal_error('no_siglinks_allowed'); 2102 } 2103 } 2104 FromChars( $member{'usertext'} ); 2105 $convertstr = $member{'usertext'}; 2106 $convertcut = 51; 2107 CountChars(); 2108 $member{'usertext'} = $convertstr; 2109 ToHTML( $member{'usertext'} ); 2110 ToChars( $member{'usertext'} ); 2111 2112 if ($allowpics) { 2113 opendir DIR, 2114 $facesdir 2115 or fatal_error( 'cannot_open_dir', 2116 "($facesdir)!<br \/>$profile_txt{'681'}", 1 ); 2117 closedir DIR; 2118 } 2119 2120 if ( $allowpics && $upload_useravatar && $upload_avatargroup ) { 2121 $upload_useravatar = 0; 2122 foreach my $av_gr ( split /, /sm, $upload_avatargroup ) { 2123 if ( $av_gr eq ${ $uid . $user }{'position'} ) { 2124 $upload_useravatar = 1; 2125 last; 2126 } 2127 foreach ( split /,/xsm, ${ $uid . $user }{'addgroups'} ) { 2128 if ( $av_gr eq $_ ) { $upload_useravatar = 1; last; } 2129 } 2130 } 2131 } 2132 2133 if ($CGI_query) { $file = $CGI_query->upload('file_avatar'); } 2134 if ( $allowpics && $upload_useravatar && $file ) { 2135 if ( $file !~ /\.(gif|png|jpe?g)$/ixsm ) { 2136 LoadLanguage('FA'); 2137 fatal_error( 'file_not_uploaded', 2138 "$file $fatxt{'20'} gif png jpeg jpg" ); 2139 } 2140 else { $ext = $1; } 2141 my $fixfile = ${ $uid . $user }{'realname'}; 2142 if ( $fixfile =~ /[^0-9A-Za-z\+\-\.:_]/xsm ) 2143 { # replace all inappropriate characters 2144 # Transliteration 2145 my @ISO_8859_1 = 2146 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); 2147 my $x = 0; 2148 foreach ( 2149 qw(� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �) 2150 ) 2151 { 2152 $fixfile =~ s/$_/$ISO_8859_1[$x]/igxsm; 2153 $x++; 2154 } 2155 2156 # END Transliteration. Thanks to "Velocity" for this contribution. 2157 $fixfile =~ s/[^0-9A-Za-z\+\-\.:_]/_/gxsm; 2158 } 2159 $fixfile .= ".$ext"; 2160 2161 require Sources::SpamCheck; 2162 my $spamdetected = spamcheck("$fixfile"); 2163 if ( !$staff ) { 2164 if ( $spamdetected == 1 ) { 2165 ${ $uid . $username }{'spamcount'}++; 2166 ${ $uid . $username }{'spamtime'} = $date; 2167 UserAccount( $username, 'update' ); 2168 $spam_hits_left_count = 2169 $post_speed_count - ${ $uid . $username }{'spamcount'}; 2170 fatal_error('tsc_alert'); 2171 } 2172 } 2173 2174 my ( $size, $buffer, $filesize, $file_buffer ); 2175 while ( $size = read $file, $buffer, 512 ) { 2176 $filesize += $size; 2177 $file_buffer .= $buffer; 2178 } 2179 $avatar_limit ||= 0; 2180 if ( $avatar_limit > 0 && $filesize > ( 1024 * $avatar_limit ) ) { 2181 LoadLanguage('FA'); 2182 fatal_error( 'file_not_uploaded', 2183 "$fatxt{'21'} $file (" 2184 . int( $filesize / 1024 ) 2185 . " KB) $fatxt{'21b'} " 2186 . $avatar_limit ); 2187 } 2188 $avatar_dirlimit ||= 0; 2189 if ( $avatar_dirlimit > 0 ) { 2190 my $dirsize = dirsize("$facesdir/UserAvatars"); 2191 if ( $filesize > ( ( 1024 * $avatar_dirlimit ) - $dirsize ) ) { 2192 LoadLanguage('FA'); 2193 fatal_error( 2194 'file_not_uploaded', 2195 "$fatxt{'22'} $file (" 2196 . ( 2197 int( $filesize / 1024 ) - 2198 $avatar_dirlimit + 2199 int( $dirsize / 1024 ) 2200 ) 2201 . " KB) $fatxt{'22b'}" 2202 ); 2203 } 2204 } 2205 2206 if ( ${ $uid . $user }{'userpic'} =~ /$facesurl\/UserAvatars\/(.+)/xsm ) 2207 { 2208 unlink "$facesdir/UserAvatars/$1"; 2209 } 2210 $fixfile = check_existence( "$facesdir/UserAvatars", $fixfile ); 2211 2212 # create a new file on the server using the formatted ( new instance ) filename 2213 if ( fopen( NEWFILE, ">$facesdir/UserAvatars/$fixfile" ) ) { 2214 binmode NEWFILE; 2215 2216 # needed for operating systems (OS) Windows, ignored by Linux 2217 print {NEWFILE} $file_buffer 2218 or croak "$croak{'print'} NEWFILE"; # write new file on HD 2219 fclose(NEWFILE); 2220 2221 } 2222 else 2223 { # return the server's error message if the new file could not be created 2224 fatal_error( 'file_not_open', "$facesdir/UserAvatars" ); 2225 } 2226 2227 # check if file has actually been uploaded, by checking the file has a size 2228 if ( !-s "$facesdir/UserAvatars/$fixfile" ) { 2229 fatal_error( 'file_not_uploaded', $fixfile ); 2230 } 2231 2232 my $illegal; 2233 if ( $fixfile =~ /gif$/ixsm ) { 2234 my $header; 2235 fopen( ATTFILE, "$facesdir/UserAvatars/$fixfile" ); 2236 read ATTFILE, $header, 10; 2237 my ( $giftest, undef, undef, undef, undef, undef ) = 2238 unpack 'a3a3C4', $header; 2239 fclose(ATTFILE); 2240 if ( $giftest ne 'GIF' ) { $illegal = $giftest; } 2241 } 2242 fopen( ATTFILE, "$facesdir/UserAvatars/$fixfile" ); 2243 while ( read ATTFILE, $buffer, 1024 ) { 2244 if ( $buffer =~ /<(html|script|body)/igsm ) { $illegal = $1; last; } 2245 } 2246 fclose(ATTFILE); 2247 if ($illegal) { # delete the file as it contains illegal code 2248 unlink "$facesdir/UserAvatars/$fixfile"; 2249 ToHTML($illegal); 2250 fatal_error( 'file_not_uploaded', 2251 "$fixfile <= illegal code ($illegal) inside image file!" ); 2252 } 2253 2254 $member{'userpic'} = "$facesurl/UserAvatars/$fixfile"; 2255 2256 } 2257 elsif ( 2258 $member{'userpicpersonalcheck'} 2259 && ( $member{'userpicpersonal'} =~ /\.gif\Z/ixsm 2260 || $member{'userpicpersonal'} =~ /\.jpe?g\Z/ixsm 2261 || $member{'userpicpersonal'} =~ /\.png\Z/ixsm ) 2262 ) 2263 { 2264 $member{'userpic'} = $member{'userpicpersonal'}; 2265 } 2266 if ( $member{'userpic'} eq q{} || !$allowpics ) { 2267 $member{'userpic'} = $my_blank_avatar; 2268 } 2269 if ( $member{'userpic'} !~ 2270 m{\A[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z}xsm ) 2271 { 2272 fatal_error( 'invalid_character', "$profile_txt{'592'}" ); 2273 } 2274 if ( $member{'userpic'} ne ${ $uid . $user }{'userpic'} 2275 && ${ $uid . $user }{'userpic'} =~ /$facesurl\/UserAvatars\/(.+)/xsm ) 2276 { 2277 unlink "$facesdir/UserAvatars/$1"; 2278 } 2279 2280 if ( $member{'usertemplate'} ne q{} 2281 && !$templateset{ $member{'usertemplate'} } ) 2282 { 2283 fatal_error('invalid_template'); 2284 } 2285 if ( $member{'usertemplate'} eq q{} ) { 2286 $member{'usertemplate'} = $template; 2287 } 2288 if ( $member{'userlanguage'} ne q{} 2289 && !-e "$langdir/$member{'userlanguage'}/Main.lng" ) 2290 { 2291 fatal_error('invalid_language'); 2292 } 2293 if ( $member{'userlanguage'} eq q{} ) { 2294 $member{'userlanguage'} = $language; 2295 } 2296 2297 if ($extendedprofiles) { # run this before you start to save something! 2298 require Sources::ExtendedProfiles; 2299 my $error = ext_validate_submition( $username, $user ); 2300 if ( $error ne q{} ) { 2301 fatal_error( 'extended_profiles_validation', $error ); 2302 } 2303 ext_saveprofile($user); 2304 } 2305 2306 # update notifications if users language is changed 2307 if ( ${ $uid . $user }{'language'} ne "$member{'userlanguage'}" ) { 2308 require Sources::Notify; 2309 updateLanguage( $user, $member{'userlanguage'} ); 2310 } 2311 2312 if ( $addmemgroup_enabled > 1 ) { 2313 my %groups; 2314 map { $groups{$_} = 2; } split /,/xsm, ${ $uid . $user }{'addgroups'}; 2315 map { $groups{$_} = 1; } split /, /sm, $member{'joinmemgroup'}; 2316 my @nopostmember; 2317 for ( keys %NoPost ) { 2318 next if ${ $uid . $user }{'position'} eq $_; 2319 if ( $groups{$_} == 1 && ( split /\|/xsm, $NoPost{$_} )[10] ) { 2320 push @nopostmember, $_; 2321 } 2322 elsif ( $groups{$_} == 2 && !( split /\|/xsm, $NoPost{$_} )[10] ) { 2323 push @nopostmember, $_; 2324 } 2325 } 2326 $member{'joinmemgroup'} = join q{,}, @nopostmember; 2327 if ( $member{'joinmemgroup'} eq '###blank###' ) { 2328 $member{'joinmemgroup'} = q{}; 2329 } 2330 if ( $member{'joinmemgroup'} ne ${ $uid . $user }{'addgroups'} ) { 2331 ManageMemberinfo( 'update', $user, q{}, q{}, q{}, q{}, 2332 $member{'joinmemgroup'} ); 2333 } 2334 if ( $member{'joinmemgroup'} eq '###blank###' ) { 2335 $member{'joinmemgroup'} = q{}; 2336 } 2337 ${ $uid . $user }{'addgroups'} = $member{'joinmemgroup'}; 2338 } 2339 2340 FromChars( $member{'signature'} ); 2341 ToHTML( $member{'signature'} ); 2342 $member{'signature'} =~ s/\n/<br \/>/gsm; 2343 $convertstr = $member{'signature'}; 2344 $convertcut = $MaxSigLen; 2345 CountChars(); 2346 $member{'signature'} = $convertstr; 2347 ToChars( $member{'signature'} ); 2348 2349 ToHTML( $member{'userpic'} ); 2350 ToHTML( $member{'usertemplate'} ); 2351 ToHTML( $member{'userlanguage'} ); 2352 ToHTML( $member{'timeformat'} ); 2353 2354 # Time to print the changes to the username.vars file 2355 ${ $uid . $user }{'usertext'} = $member{'usertext'}; 2356 ${ $uid . $user }{'userpic'} = $member{'userpic'}; 2357 ${ $uid . $user }{'signature'} = $member{'signature'}; 2358 ${ $uid . $user }{'timeoffset'} = 2359 "$member{'usertimesign'}$member{'usertimehour'}.$member{'usertimemin'}"; 2360 ${ $uid . $user }{'onlinealert'} = $member{'onlinealert'} ? 1 : 0; 2361 ${ $uid . $user }{'notify_me'} = 2362 $member{'notify_N'} 2363 ? ( 2364 ( 2365 !${ $uid . $user }{'notify_me'} 2366 || ${ $uid . $user }{'notify_me'} == 1 2367 ) ? 1 : 3 2368 ) 2369 : ( 2370 ( 2371 ${ $uid . $user }{'notify_me'} == 2 2372 || ${ $uid . $user }{'notify_me'} == 3 2373 ) ? 2 : 0 2374 ); 2375 ${ $uid . $user }{'reversetopic'} = $member{'reversetopic'} ? 1 : 0; 2376 ${ $uid . $user }{'user_tz'} = $member{'user_tz'}; 2377 ${ $uid . $user }{'dynamic_clock'} = $member{'dynamic_clock'} ? 1 : 0; 2378 ${ $uid . $user }{'timeselect'} = int $member{'usertimeselect'}; 2379 ${ $uid . $user }{'template'} = $member{'usertemplate'}; 2380 ${ $uid . $user }{'language'} = $member{'userlanguage'}; 2381 ${ $uid . $user }{'hide_avatars'} = 2382 ( $member{'hide_avatars'} && $user_hide_avatars ) ? 1 : 0; 2383 ${ $uid . $user }{'hide_user_text'} = 2384 ( $member{'hide_user_text'} && $user_hide_user_text ) ? 1 : 0; 2385 ${ $uid . $user }{'hide_img'} = 2386 ( $member{'hide_img'} && $user_hide_img ) ? 1 : 0; 2387 ${ $uid . $user }{'hide_attach_img'} = 2388 ( $member{'hide_attach_img'} && $user_hide_attach_img ) ? 1 : 0; 2389 ${ $uid . $user }{'hide_signat'} = 2390 ( $member{'hide_signat'} && $user_hide_signat ) ? 1 : 0; 2391 ${ $uid . $user }{'hide_smilies_row'} = 2392 ( $member{'hide_smilies_row'} && $user_hide_smilies_row ) ? 1 : 0; 2393 ${ $uid . $user }{'numberformat'} = int $member{'usernumberformat'}; 2394 ${ $uid . $user }{'return_to'} = $member{'return_to'}; 2395 2396 UserAccount( $user, 'update' ); 2397 2398 my $scriptAction; 2399 if ( 2400 $iamadmin 2401 || ( $iamgmod 2402 && $allow_gmod_profile 2403 && $gmod_access2{'profileAdmin'} eq 'on' ) 2404 ) 2405 { 2406 $scriptAction = q~profileAdmin~; 2407 } 2408 else { 2409 $scriptAction = q~viewprofile~; 2410 } 2411 if ( $pm_lev == 1 ) { 2412 $scriptAction = q~profileIM~; 2413 } 2414 if ($buddyListEnabled) { 2415 $scriptAction = q~profileBuddy~; 2416 } 2417 if ($view) { $scriptAction = qq~my$scriptAction~; } 2418 $yySetLocation = 2419qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; 2420 redirectexit(); 2421 return; 2422} 2423 2424sub ModifyProfileBuddy2 { 2425 SidCheck($action); 2426 PrepareProfile(); 2427 2428 my ( %member, $key, $value, $tempname ); 2429 while ( ( $key, $value ) = each %FORM ) { 2430 $value =~ s/\A\s+//xsm; 2431 $value =~ s/\s+\Z//xsm; 2432 $value =~ s/[\n\r]//gxsm; 2433 $member{$key} = $value; 2434 } 2435 $member{'username'} = $user; 2436 2437 if ( $member{'moda'} ne $profile_txt{'88'} ) { fatal_error('not_allowed'); } 2438 2439 if ( $member{'buddylist'} ) { 2440 my @buddies = split /\,/xsm, $member{'buddylist'}; 2441 chomp @buddies; 2442 $member{'buddylist'} = q{}; 2443 foreach my $cloakedBuddy (@buddies) { 2444 $cloakedBuddy =~ s/^ //sm; 2445 $cloakedBuddy = decloak($cloakedBuddy); 2446 ToHTML($cloakedBuddy); 2447 $member{'buddylist'} = qq~$member{'buddylist'}\|$cloakedBuddy~; 2448 } 2449 $member{'buddylist'} =~ s/^\|//sm; 2450 } 2451 ${ $uid . $user }{'buddylist'} = $member{'buddylist'}; 2452 UserAccount( $user, 'update' ); 2453 2454 my $scriptAction; 2455 if ( 2456 $iamadmin 2457 || ( $iamgmod 2458 && $allow_gmod_profile 2459 && $gmod_access2{'profileAdmin'} eq 'on' ) 2460 ) 2461 { 2462 $scriptAction = q~profileAdmin~; 2463 } 2464 else { 2465 $scriptAction = q~viewprofile~; 2466 } 2467 if ( $pm_lev == 1 ) { 2468 $scriptAction = q~profileIM~; 2469 } 2470 if ($view) { $scriptAction = qq~my$scriptAction~; } 2471 $yySetLocation = 2472qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; 2473 redirectexit(); 2474 return; 2475} 2476 2477sub ModifyProfileIM2 { 2478 SidCheck($action); 2479 PrepareProfile(); 2480 2481 my ( %member, $key, $value, $ignorelist ); 2482 while ( ( $key, $value ) = each %FORM ) { 2483 $value =~ s/\A\s+//xsm; 2484 $value =~ s/\s+\Z//xsm; 2485 if ( $key ne 'ignore' ) { $value =~ s/[\n\r]//gxsm; } 2486 $member{$key} = $value; 2487 } 2488 $member{'username'} = $user; 2489 2490 if ( $member{'moda'} ne $profile_txt{'88'} ) { fatal_error('not_allowed'); } 2491 2492 if ( !$member{'ignoreall'} ) { 2493 my @ignoreList = split /\,/xsm, $member{'ignore'}; 2494 chomp @ignoreList; 2495 foreach my $cloakedIgnore (@ignoreList) { 2496 $cloakedIgnore =~ s/\A //sm; 2497 $cloakedIgnore =~ s/ \Z//sm; 2498 $cloakedIgnore = decloak($cloakedIgnore); 2499 ToHTML($cloakedIgnore); 2500 $ignorelist .= qq~\|$cloakedIgnore~; 2501 } 2502 $ignorelist =~ s/\A\|//xsm; 2503 } 2504 else { 2505 $ignorelist = q{*}; 2506 } 2507 2508 # Time to print the changes to the username.vars file 2509 ${ $uid . $user }{'im_ignorelist'} = $ignorelist; 2510 ${ $uid . $user }{'notify_me'} = 2511 $member{'notify_PM'} 2512 ? ( 2513 ( 2514 !${ $uid . $user }{'notify_me'} 2515 || ${ $uid . $user }{'notify_me'} == 2 2516 ) ? 2 : 3 2517 ) 2518 : ( 2519 ( 2520 ${ $uid . $user }{'notify_me'} == 1 2521 || ${ $uid . $user }{'notify_me'} == 3 2522 ) ? 1 : 0 2523 ); 2524 ${ $uid . $user }{'im_popup'} = $member{'userpopup'} ? 1 : 0; 2525 ${ $uid . $user }{'im_imspop'} = $member{'popupims'} ? 1 : 0; 2526 ${ $uid . $user }{'pmviewMess'} = $member{'pmviewMess'} ? 1 : 0; 2527 2528 if ($extendedprofiles) { # run this before you start to save something! 2529 require Sources::ExtendedProfiles; 2530 my $error = ext_validate_submition( $username, $user ); 2531 if ( $error ne q{} ) { 2532 fatal_error( 'extended_profiles_validation', $error ); 2533 } 2534 ext_saveprofile($user); 2535 } 2536 UserAccount( $user, 'update' ); 2537 2538 my $scriptAction = q~viewprofile~; 2539 if ( 2540 $iamadmin 2541 || ( $iamgmod 2542 && $allow_gmod_profile 2543 && $gmod_access2{'profileAdmin'} eq 'on' ) 2544 ) 2545 { 2546 $scriptAction = q~profileAdmin~; 2547 } 2548 if ($view) { $scriptAction = qq~my$scriptAction~; } 2549 $yySetLocation = 2550qq~$scripturl?action=$scriptAction;username=$useraccount{$member{'username'}};sid=$INFO{'sid'}~; 2551 redirectexit(); 2552 return; 2553} 2554 2555sub ModifyProfileAdmin2 { 2556 is_admin_or_gmod(); 2557 2558 SidCheck($action); 2559 PrepareProfile(); 2560 2561 my ( %member, $key, $value ); 2562 while ( ( $key, $value ) = each %FORM ) { 2563 $value =~ s/\A\s+//sm; 2564 $value =~ s/\s+\Z//sm; 2565 if ( $key ne 'regreason' ) { $value =~ s/[\n\r]//gxsm; } 2566 $member{$key} = $value; 2567 } 2568 $member{'username'} = $user; 2569 2570 if ( $member{'moda'} ne $profile_txt{'88'} ) { 2571 fatal_error('cannot_kill_admin'); 2572 } 2573 2574 if ( 2575 !$iamadmin 2576 && ( $member{'settings7'} eq 'Administrator' 2577 || $member{'settings7'} eq 'Global Moderator' ) 2578 ) 2579 { 2580 $member{'settings7'} = ${ $uid . $user }{'position'}; 2581 } 2582 2583 if ( $member{'settings6'} eq q{} ) { $member{'settings6'} = 0; } 2584 if ( $member{'settings6'} !~ /\A[0-9]+\Z/xsm ) { 2585 fatal_error('invalid_postcount'); 2586 } 2587 if ( $member{'username'} eq 'admin' 2588 && $member{'settings7'} ne 'Administrator' ) 2589 { 2590 fatal_error('cannot_regroup_admin'); 2591 } 2592 2593 $dr_month = $member{'dr_month'}; 2594 $dr_day = $member{'dr_day'}; 2595 $dr_year = $member{'dr_year'}; 2596 $dr_hour = $member{'dr_hour'}; 2597 $dr_minute = $member{'dr_minute'}; 2598 $dr_secund = $member{'dr_secund'}; 2599 2600 if ( $dr_month == 4 || $dr_month == 6 || $dr_month == 9 || $dr_month == 11 ) 2601 { 2602 $max_days = 30; 2603 } 2604 elsif ( $dr_month == 2 && $dr_year % 4 == 0 ) { 2605 $max_days = 29; 2606 } 2607 elsif ( $dr_month == 2 && $dr_year % 4 != 0 ) { 2608 $max_days = 28; 2609 } 2610 else { 2611 $max_days = 31; 2612 } 2613 if ( $dr_day > $max_days ) { $dr_day = $max_days; } 2614 2615 $member{'dr'} = 2616qq~$dr_month/$dr_day/$dr_year $maintxt{'107'} $dr_hour:$dr_minute:$dr_secund~; 2617 2618 if ( $member{'settings6'} != ${ $uid . $user }{'postcount'} 2619 || $member{'settings7'} ne ${ $uid . $user }{'position'} ) 2620 { 2621 if ( $member{'settings7'} ) { 2622 $grp_after = qq~$member{'settings7'}~; 2623 } 2624 else { 2625 for my $postamount ( reverse sort { $a <=> $b } keys %Post ) { 2626 if ( $member{'settings6'} >= $postamount ) { 2627 ( $title, undef ) = split /\|/xsm, $Post{$postamount}, 2; 2628 $grp_after = $title; 2629 last; 2630 } 2631 } 2632 } 2633 ManageMemberinfo( 'update', $user, q{}, q{}, $grp_after, 2634 $member{'settings6'} ); 2635 } 2636 2637 my %groups; 2638 map { $groups{$_} = 1; } split /, /sm, $member{'addgroup'}; 2639 my @nopostmember; 2640 for ( keys %NoPost ) { 2641 next if $member{'settings7'} eq $_; 2642 if ( $groups{$_} ) { push @nopostmember, $_; } 2643 } 2644 $member{'addgroup'} = join q{,}, @nopostmember; 2645 if ( $member{'addgroup'} eq q{} ) { $member{'addgroup'} = '###blank###'; } 2646 if ( $member{'addgroup'} ne ${ $uid . $user }{'addgroups'} ) { 2647 ManageMemberinfo( 'update', $user, q{}, q{}, q{}, q{}, 2648 $member{'addgroup'} ); 2649 } 2650 if ( $member{'addgroup'} eq '###blank###' ) { $member{'addgroup'} = q{}; } 2651 ${ $uid . $user }{'addgroups'} = $member{'addgroup'}; 2652 2653 if ( $member{'dr'} ne ${ $uid . $user }{'regdate'} ) { 2654 $newreg = stringtotime( $member{'dr'} ); 2655 $newreg = sprintf '%010d', $newreg; 2656 ManageMemberlist( 'update', $user, $newreg ); 2657 ${ $uid . $user }{'regtime'} = $newreg; 2658 } 2659 2660 if ( !$iamadmin ) { $member{'dr'} = ${ $uid . $user }{'regdate'}; } 2661 FromChars( $member{'regreason'} ); 2662 ToHTML( $member{'regreason'} ); 2663 ToChars( $member{'regreason'} ); 2664 $member{'regreason'} =~ s/[\n\r]{1,2}/<br \/>/gsm; 2665 ${ $uid . $user }{'regreason'} = $member{'regreason'}; 2666 ${ $uid . $user }{'postcount'} = $member{'settings6'}; 2667 ${ $uid . $user }{'position'} = $member{'settings7'}; 2668 ${ $uid . $user }{'regdate'} = $member{'dr'}; 2669 if ( ${ $uid . $user }{'position'} ne 'Administrator' 2670 && ${ $uid . $user }{'position'} ne 'Global Moderator' ) 2671 { 2672 ${ $uid . $user }{'stealth'} = q{}; 2673 } 2674 2675 if ($extendedprofiles) { # run this before you start to save something! 2676 require Sources::ExtendedProfiles; 2677 my $error = ext_validate_submition( $username, $user ); 2678 if ( $error ne q{} ) { 2679 fatal_error( 'extended_profiles_validation', $error ); 2680 } 2681 ext_saveprofile($user); 2682 } 2683 UserAccount( $user, 'update' ); 2684 2685 AddModerators2( $user, $member{'addmod'} ); 2686 my $scriptAction = $view ? 'myviewprofile' : 'viewprofile'; 2687 $yySetLocation = 2688 qq~$scripturl?action=$scriptAction;username=$useraccount{$user}~; 2689 redirectexit(); 2690 return; 2691} 2692 2693sub ViewProfile { 2694 if ($iamguest) { fatal_error('members_only'); } 2695 2696 # If someone registers with a '+' in their name It causes problems. 2697 # Get's turned into a <space> in the query string Change it back here. 2698 # Users who register with spaces get them replaced with _ 2699 # So no problem there. 2700 $INFO{'username'} =~ tr/ /+/; 2701 2702 $user = $INFO{'username'}; 2703 if ($do_scramble_id) { decloak($user); } 2704 if ( $user =~ m{/}xsm ) { fatal_error('no_user_slash'); } 2705 if ( $user =~ m{\\}xsm ) { fatal_error('no_user_backslash'); } 2706 2707 if ( !LoadUser($user) ) { fatal_error('no_profile_exists'); } 2708 if ( $user eq $username ) { LoadMiniUser($user); } 2709 2710 my ( $modify, $gender ); 2711 my ( 2712 $pic_row, $buddybutton, $row_addgrp, $row_gender, 2713 $row_age, $row_location, $row_icq, $row_aim, 2714 $row_yim, $row_gtalk, $row_skype, $row_myspace, 2715 $row_facebook, $row_twitter, $row_youtube, $row_email, 2716 $row_website, $row_signature, $showusertext 2717 ); 2718 my ($row_zodiac); 2719 2720 # Convert forum start date to string, if there is no date set, 2721 # Defaults to 1st Jan, 2005 2722 $forumstart = $forumstart ? stringtotime($forumstart) : '1104537600'; 2723 2724 $memsettingsd[9] = ${ $uid . $user }{'aim'}; 2725 $memsettingsd[9] =~ tr/+/ /; 2726 $memsettingsd[10] = ${ $uid . $user }{'yim'}; 2727 $memsettingsd[10] =~ tr/+/ /; 2728 2729 if ( ${ $uid . $user }{'regtime'} ) { 2730 $dr = timeformat( ${ $uid . $user }{'regtime'},0,0,0,1 ); 2731 } 2732 else { 2733 $dr = $profile_txt{'470'}; 2734 } 2735 2736 CalcAge( $user, 'calc' ); # How old is he/she? 2737 CalcAge( $user, 'isbday' ); # is it the bday? 2738 if ($isbday) { 2739 $isbday = qq~<img src="$imagesdir/$my_bdaycake" />~; 2740 } 2741 2742 ## only show the 'modify' button if not using 'my center' or admin/gmod viewing 2743 $modify = 2744 ( 2745 !$view 2746 && ( $user ne 'admin' || $username eq 'admin' ) 2747 && ( 2748 $iamadmin 2749 || ( $iamgmod 2750 && $allow_gmod_profile 2751 && ${ $uid . $user }{'position'} ne 'Administrator' ) 2752 ) 2753 ) 2754 ? qq~<a href="$scripturl?action=profileCheck;username=$useraccount{$user}">$img{'modify'}</a>~ 2755 : ' '; 2756 2757 if ($allowpics) { 2758 my $no_userpic; 2759 if ( ${ $uid . $user }{'userpic'} eq $my_blank_avatar ) { 2760 $no_userpic = $default_avatar ? $default_userpic : $nn_avatar; 2761 $pic = 2762qq~<img src="$imagesdir/$no_userpic" id="avatar_img_resize" alt="" style="display:none" />~; 2763 } 2764 elsif ( ${ $uid . $user }{'userpic'} =~ /^https?:\/\//xsm ) { 2765 $pic = 2766qq~<img src="${$uid.$user}{'userpic'}" id="avatar_img_resize" alt="" style="display:none" />~; 2767 } 2768 else { 2769 $pic = 2770qq~<img src="$facesurl/${$uid.$user}{'userpic'}" id="avatar_img_resize" alt="" style="display:none" />~; 2771 } 2772 $pic_row = qq~<div class="picrow"> 2773 $pic 2774 </div>~; 2775 } 2776 2777 if ( $buddyListEnabled && $user ne $username ) { 2778 loadMyBuddy(); 2779 $buddybutton = '<br />' 2780 . ( 2781 $mybuddie{$user} 2782 ? qq~<img src="$micon_bg{'buddylist'}" alt="$display_txt{'isbuddy'}" /> $display_txt{'isbuddy'}~ 2783 : qq~<a href="$scripturl?action=addbuddy;name=$useraccount{$user}">$img{'addbuddy'}</a>~ 2784 ); 2785 } 2786 2787 # Hide empty profile fields from display 2788 if ( $addmembergroup{$user} ) { 2789 $showaddgr = $addmembergroup{$user}; 2790 $showaddgr =~ s/<br \/>/\, /gsm; 2791 $showaddgr =~ s/\A, //sm; 2792 $showaddgr =~ s/, \Z//sm; 2793 $row_addgrp .= qq~$showaddgr<br />~; 2794 } 2795 if ( ${ $uid . $user }{'gender'} ) { 2796 if ( ${ $uid . $user }{'gender'} eq 'Male' ) { 2797 $gender = $profile_txt{'238'}; 2798 } 2799 elsif ( ${ $uid . $user }{'gender'} eq 'Female' ) { 2800 $gender = $profile_txt{'239'}; 2801 } 2802 $row_gender = qq~ 2803 <div class="contactleft"> 2804 <b>$profile_txt{'231'}: </b> 2805 </div> 2806 <div class="contactright"> 2807 $gender 2808 </div>~; 2809 } 2810 if ($age) { 2811 if ( $showage == 1 && ${ $uid . $user }{'hideage'} && !$iamadmin ) { 2812 $age = qq~$profile_txt{'722'} ~; 2813 } 2814 else { $age = qq~$age ~; } 2815 $row_age = qq~ 2816 <div class="contactleft"> 2817 <b>$profile_txt{'420'}:</b> 2818 </div> 2819 <div class="contactright"> 2820 $age$isbday 2821 </div>~; 2822 if ($showzodiac) { 2823 require Sources::EventCalBirthdays; 2824 my ($user_bdmon, $user_bdday, undef ) = split /\//xsm, ${ $uid . $user }{'bday'} ; 2825 $memberzodiac = starsign($user_bdday, $user_bdmon, 'text' ); 2826 $row_zodiac = qq~ 2827 <div class="contactleft"> 2828 <b>$zodiac_txt{'sign'}:</b> 2829 </div> 2830 <div class="contactright"> 2831 $memberzodiac 2832 </div>~; 2833 } 2834 } 2835 if ( ${ $uid . $user }{'location'} ) { 2836 $row_location = qq~ 2837 <div class="contactleft"> 2838 <b>$profile_txt{'227'}: </b> 2839 </div> 2840 <div class="contactright"> 2841 ${$uid.$user}{'location'} 2842 </div>~; 2843 } 2844 if ( ${ $uid . $user }{'icq'} && ${ $uid . $user }{'icq'} !~ m{\D}xsm ) { 2845 $row_icq .= qq~ 2846 <div class="contactleft"> 2847 <b>$profile_txt{'513'}:</b> 2848 </div> 2849 <div class="contactright"> 2850 <a href="http://web.icq.com/${$uid.$user}{'icq'}" title="${$uid.$user}{'icq'}" target="_blank"> 2851 <img src="http://web.icq.com/whitepages/online?icq=${$uid.$user}{'icq'}&img=5" alt="${$uid.$user}{'icq'}" /> ${$uid.$user}{'icq'}</a> 2852 </div>~; 2853 } 2854 if ( ${ $uid . $user }{'aim'} ) { 2855 $row_aim = qq~ 2856 <div class="contactleft"> 2857 <b>$profile_txt{'603'}: </b> 2858 </div> 2859 <div class="contactright"> 2860 <a href="aim:goim?screenname=${$uid.$user}{'aim'}&message=Hi,+are+you+there?"> 2861 <img src="$imagesdir/$my_aim" alt="${$uid.$user}{'aim'}" /> $memsettingsd[9]</a> 2862 </div>~; 2863 } 2864 if ( ${ $uid . $user }{'yim'} ) { 2865 $row_yim = qq~ 2866 <div class="contactleft"> 2867 <b>$profile_txt{'604'}: </b> 2868 </div> 2869 <div class="contactright"> 2870 <img src="http://opi.yahoo.com/online?u=${$uid.$user}{'yim'}&m=g&t=0" alt="${$uid.$user}{'yim'}" /> 2871 <a href="http://edit.yahoo.com/config/send_webmesg?.target=${$uid.$user}{'yim'}" target="_blank"> $memsettingsd[10]</a> 2872 </div>~; 2873 } 2874 if ( ${ $uid . $user }{'gtalk'} ) { 2875 $row_gtalk = qq~ 2876 <div class="contactleft"> 2877 <b>$profile_txt{'825'}: </b> 2878 </div> 2879 <div class="contactright"> 2880 <img src="$gtalk" alt="" /> 2881 <a href="#" onclick="window.open('$scripturl?action=setgtalk;gtalkname=$user','','height=80,width=340,menubar=0,toolbar=0,scrollbars=0,resizable=1'); return false">$profile_txt{'825'} ${$uid.$user}{'realname'}</a> 2882 </div>~; 2883 } 2884 if ( ${ $uid . $user }{'skype'} ) { 2885 $row_skype = qq~ 2886 <div class="contactleft"> 2887 <b>$profile_txt{'827'}: </b> 2888 </div> 2889 <div class="contactright"> 2890 <img src="$imagesdir/$my_skype" alt="" /> 2891 <a href="javascript:void(window.open('callto://${$uid.$user}{'skype'}','skype','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'))">$profile_txt{'827'} ${$uid.$user}{'realname'}</a> 2892 </div>~; 2893 } 2894 if ( ${ $uid . $user }{'myspace'} ) { 2895 $row_myspace = qq~ 2896 <div class="contactleft"> 2897 <b>$profile_txt{'570'}: </b> 2898 </div> 2899 <div class="contactright"> 2900 <img src="$imagesdir/$my_myspace" alt="" /> 2901 <a href="http://www.myspace.com/${$uid.$user}{'myspace'}" target="_blank">$profile_txt{'570'} ${$uid.$user}{'realname'}</a> 2902 </div>~; 2903 } 2904 if ( ${ $uid . $user }{'facebook'} ) { 2905 $row_facebook = qq~ 2906 <div class="contactleft"> 2907 <b>$profile_txt{'573'}: </b> 2908 </div> 2909 <div class="contactright"> 2910 <img src="$imagesdir/$my_facebook" alt="" /> 2911 <a href="http://www.facebook.com/~ 2912 . ( 2913 ${ $uid . $user }{'facebook'} !~ /\D/xsm ? 'profile.php?id=' : q{} ) 2914 . qq~${$uid.$user}{'facebook'}" target="_blank"> ${$uid.$user}{'facebook'}</a> 2915 </div>~; 2916 } 2917 if ( ${ $uid . $user }{'twitter'} ) { 2918 $row_twitter = qq~ 2919 <div class="contactleft"> 2920 <b>$profile_txt{'576'}: </b> 2921 </div> 2922 <div class="contactright"> 2923 <img src="$imagesdir/$my_twitter" alt="" /> 2924 <a href="http://twitter.com/${$uid.$user}{'twitter'}" target="_blank">$profile_txt{'576'} ${$uid.$user}{'realname'}</a> 2925 </div>~; 2926 } 2927 if ( ${ $uid . $user }{'youtube'} ) { 2928 $row_youtube = qq~ 2929 <div class="contactleft"> 2930 <b>$profile_txt{'579'}: </b> 2931 </div> 2932 <div class="contactright"> 2933 <img src="$imagesdir/$my_youtube" alt="" /> 2934 <a href="http://www.youtube.com/${$uid.$user}{'youtube'}" target="_blank">$profile_txt{'579'} ${$uid.$user}{'realname'}</a> 2935 </div>~; 2936 } 2937 if ( !${ $uid . $user }{'hidemail'} 2938 || $iamadmin 2939 || !$allow_hide_email 2940 || $view ) 2941 { 2942 my $rowEmail = q{}; 2943 if ($view) { 2944 if ( !${ $uid . $user }{'hidemail'} ) { 2945 $rowEmail = $profile_txt{'showingemail'}; 2946 } 2947 else { 2948 my ( $admtitle, undef ) = 2949 split /\|/xsm, $Group{'Administrator'}, 2; 2950 $rowEmail = 2951qq~$profile_txt{'notshowingemail'} $admtitle$profile_txt{'notshowingemailend'}~; 2952 } 2953 } 2954 else { 2955 $rowEmail = enc_eMail( 2956 "$profile_txt{'889'} ${$uid.$user}{'realname'}", 2957 ${ $uid . $user }{'email'}, 2958 q{}, q{}, 1 2959 ); 2960 } 2961 2962 $row_email = qq~ 2963 <div class="contactleft"> 2964 <b>$profile_txt{'69'}: </b> 2965 </div> 2966 <div class="contactright"> 2967 $rowEmail 2968 </div>~; 2969 } 2970 if ( !$minlinkweb ) { $minlinkweb = 0; } 2971 if ( 2972 ${ $uid . $user }{'weburl'} 2973 && ${ $uid . $user }{'webtitle'} 2974 && ( ${ $uid . $user }{'postcount'} >= $minlinkweb 2975 || ${ $uid . $user }{'position'} eq 'Administrator' 2976 || ${ $uid . $user }{'position'} eq 'Global Moderator' ) 2977 ) 2978 { 2979 $row_website = qq~ 2980 <div class="contactleft"> 2981 <b>$profile_txt{'96'}: </b> 2982 </div> 2983 <div class="contactright"> 2984 <a href="${$uid.$user}{'weburl'}" target="_blank">${$uid.$user}{'webtitle'}</a> 2985 </div>~; 2986 } 2987 if ( ${ $uid . $user }{'signature'} ) { 2988 2989 # do some ubbc on the signature to display in the view profile area 2990 $message = ${ $uid . $user }{'signature'}; 2991 $displayname = ${ $uid . $user }{'realname'}; 2992 2993 if ($enable_ubbc) { 2994 enable_yabbc(); 2995 DoUBBC(1); 2996 } 2997 2998 ToChars($message); 2999 3000 # Censor the signature. 3001 LoadCensorList(); 3002 $message = Censor($message); 3003 3004 $row_signature = $myrow_sig; 3005 $row_signature =~ s/{yabb message}/$message/sm; 3006 } 3007 3008 # End empty field checking 3009 3010 # Just maths below... 3011 $post_count = ${ $uid . $user }{'postcount'}; 3012 if ( !$post_count ) { $post_count = 0 } 3013 3014 $string_regdate = stringtotime( ${ $uid . $user }{'regdate'} ); 3015 $string_curdate = $date; 3016 3017 if ( $string_curdate < $forumstart ) { $string_curdate = $forumstart } 3018 3019 $member_for_days = int( ( $string_curdate - $string_regdate ) / 86400 ); 3020 3021 if ( $member_for_days < 1 ) { $tmpmember_for_days = 1; } 3022 else { $tmpmember_for_days = $member_for_days; } 3023 $post_per_day = sprintf '%.2f', ( $post_count / $tmpmember_for_days ); 3024 $member_for_days = NumberFormat($member_for_days); 3025 $post_per_day = NumberFormat($post_per_day); 3026 $post_count = NumberFormat($post_count); 3027 3028 # End statistics. 3029 if ( ${ $uid . $user }{'usertext'} ) { 3030 3031 # Censor the usertext and wrap it 3032 LoadCensorList(); 3033 $showusertext = 3034 WrapChars( Censor( ${ $uid . $user }{'usertext'} ), 20 ); 3035 } 3036 3037 if ( !$view ) { 3038 $yynavigation = qq~› $profile_txt{'92'}~; 3039 if ( $iamadmin || $iamgmod ) { 3040 $my_not_view_b .= qq~ 3041 <img src="$imagesdir/$my_profile" alt="" /> <b>$profile_txt{'35'}: $INFO{'username'}</b>~; 3042 } 3043 else { 3044 $my_not_view_b .= qq~ 3045 <img src="$imagesdir/$my_profile" alt="" /> <b>$profile_txt{'68'}: ${$uid.$INFO{'username'}}{'realname'}</b>~; 3046 } 3047 $my_not_view = $myshow_b; 3048 $my_not_view =~ s/{yabb my_not_view_b}/$my_not_view_b/sm; 3049 } 3050 $my_online = userOnLineStatus($user); 3051 3052 my $userismod; 3053 if ( ${ $uid . $user }{'position'} ne 'Administrator' 3054 && ${ $uid . $user }{'position'} ne 'Global Moderator' 3055 && ${ $uid . $user }{'position'} ne 'Mid Moderator' ) 3056 { 3057 $userismod = is_moderator($user); 3058 } 3059 if ($userismod) { 3060 @memstats = split /\|/xsm, $Group{'Moderator'}; 3061 my $starnum = $memstats[1]; 3062 my $memberstartemp = q{}; 3063 if ( $memstats[2] !~ /\//xsm ) { $memstats[2] = "$imagesdir/$memstats[2]"; } 3064 while ( $starnum-- > 0 ) { 3065 $memberstartemp .= qq~<img src="$memstats[2]" alt="*" />~; 3066 } 3067 $memberstar = $memberstartemp ? "$memberstartemp<br />" : q{}; 3068 3069 *get_subboards = sub { 3070 my @x = @_; 3071 $indent += 2; 3072 foreach my $board (@x) { 3073 my $dash; 3074 if ( $indent > 2 ) { $dash = q{-}; } 3075 3076 ( $boardname, $boardperms, $boardview ) = 3077 split /\|/xsm, $board{$board}; 3078 if ( ${ $uid . $board }{'ann'} == 1 3079 || ${ $uid . $board }{'rbin'} == 1 ) 3080 { 3081 next; 3082 } 3083 $moderators = ${ $uid . $board }{'mods'}; 3084 my @BoardModerators = split /, ?/sm, $moderators; 3085 for my $thisMod (@BoardModerators) { 3086 if ( $thisMod eq $user ) { 3087 ( $boardname, $boardperms, $boardview ) = 3088 split /\|/xsm, $board{"$board"}; 3089 ToChars($boardname); 3090 if ( !${ $uid . $board }{'canpost'} 3091 && $subboard{$board} ) 3092 { 3093 $my_brd = 'boardselect'; 3094 } 3095 else { $my_brd = 'board'; } 3096 $my_mod_star .= 3097 qq~<a href="$scripturl?$my_brd=$board" class="a">~ 3098 . ( ' ' x $indent ) 3099 . ( $dash x ( $indent / 2 ) ) 3100 . qq~$boardname</a><br />\n~; 3101 } 3102 } 3103 if ( $subboard{$board} ) { 3104 get_subboards( split /\|/xsm, $subboard{$board} ); 3105 } 3106 } 3107 $indent -= 2; 3108 }; 3109 3110 for my $catid (@categoryorder) { 3111 (@bdlist) = split /\,/xsm, $cat{$catid}; 3112 my $indent = -2; 3113 get_subboards(@bdlist); 3114 } 3115 3116 $my_star = $myshow_star; 3117 $my_star =~ s/{yabb title}/$memstats[0]/sm; 3118 $my_star =~ s/{yabb memberstar}/$memberstar/sm; 3119 $my_star =~ s/{yabb my_mod_star}/$my_mod_star/sm; 3120 } 3121 if ( $row_gender || $row_age || $row_location ) { 3122 $my_gender = $myshow_gender; 3123 $my_gender =~ s/{yabb row_gender}/$row_gender/sm; 3124 $my_gender =~ s/{yabb row_age}/$row_age/sm; 3125 $my_gender =~ s/{yabb row_zodiac}/$row_zodiac/sm; 3126 $my_gender =~ s/{yabb row_location}/$row_location/sm; 3127 } 3128 if ($extendedprofiles) { 3129 require Sources::ExtendedProfiles; 3130 $my_extprofile .= ext_viewprofile($user); 3131 } 3132 3133 CheckUserPM_Level($user); 3134 if ( 3135 !$view 3136 && $user ne $username 3137 && ( 3138 $PM_level == 1 3139 || ( $PM_level == 2 3140 && $UserPM_Level{$user} > 1 3141 && ($staff) ) 3142 || ( $PM_level == 3 3143 && $UserPM_Level{$user} == 3 3144 && ( $iamadmin || $iamgmod ) ) 3145 || ( $PM_level == 4 3146 && $UserPM_Level{$user} == 4 3147 && ( $iamadmin || $iamgmod || $iamfmod ) ) 3148 ) 3149 ) 3150 { 3151 $my_userlevel = qq~ 3152 <div class="contactleft"> 3153 <b>$profile_txt{'144'}: </b> 3154 </div> 3155 <div class="contactright"> 3156 <a href="$scripturl?action=imsend;to=$useraccount{$user}">$profile_txt{'688'} ${$uid.$user}{'realname'}</a> 3157 </div>~; 3158 } 3159 $userlastlogin = timeformat( ${ $uid . $user }{'lastonline'} ); 3160 $userlastpost = timeformat( ${ $uid . $user }{'lastpost'} ); 3161 $userlastim = timeformat( ${ $uid . $user }{'lastim'} ); 3162 if ( $userlastlogin eq q{} ) { $userlastlogin = "$profile_txt{'470'}"; } 3163 if ( $userlastpost eq q{} ) { $userlastpost = "$profile_txt{'470'}"; } 3164 if ( $userlastim eq q{} ) { $userlastim = "$profile_txt{'470'}"; } 3165 my ( $lastonline, $lastpost, $lastPM ); 3166 ## MF-B code fix for lpd 3167 if ( ${ $uid . $user }{'postcount'} > 0 ) { 3168 $userlastpost = usersrecentposts(1); 3169 } 3170 #### 3171 if ( !$view ) { 3172 $lastonline = qq~$profile_amv_txt{'9'}~; 3173 $lastpost = qq~$profile_amv_txt{'10'}~; 3174 $lastPM = qq~$profile_amv_txt{'11'}~; 3175 3176 } 3177 else { 3178 $lastonline = qq~$profile_amv_txt{'mylastonline'}~; 3179 $lastpost = qq~$profile_amv_txt{'mylastpost'}~; 3180 $lastPM = qq~$profile_amv_txt{'mylastpm'}~; 3181 } 3182 if ( $pm_lev == 1 ) { 3183 $my_lastPM = qq~ 3184 <div class="contactleft"><b>$lastPM: </b></div> 3185 <div class="contactright">$userlastim</div>~; 3186 } 3187 if ( ( $iamadmin || $iamgmod || $iamfmod ) 3188 && !$view 3189 && $user ne $username 3190 && $user ne 'admin' ) 3191 { 3192 $is_banned = check_banlist( "${$uid.$user}{'email'}", q{}, "$user" ); 3193 $ban_user_email = ${ $uid . $user }{'email'}; 3194 $ban_user_email =~ s/([^A-Za-z0-9])/sprintf('%%%02X', ord($1))/segm; 3195 require Sources::Security; 3196 if ( $is_banned =~ /E/sm ) { 3197 $ban_email_link = 3198qq~<span class="small">[ <a href="$scripturl?action=ipban_update;ban_email=$ban_user_email;username=$useraccount{$user};unban=1" onclick="return confirm('$profile_txt{'904a'}${$uid.$user}{'email'}');">$profile_txt{'904'}</a> ]</span>~; 3199 } 3200 elsif ( ${ $uid . $user }{'position'} ne 'Administrator' ) { 3201 $ban_email_link = qq~<span class="small">[ $profile_txt{'907'}: ~; 3202 my $bansep = $#timeban; 3203 my $levsep = q~ | ~; 3204 for my $i (@timeban) { 3205 if ( !$bansep-- ) { $levsep = q{}; } 3206 $ban_email_link .= 3207qq~<a href="$scripturl?action=ipban_update;ban_email=$ban_user_email;username=$useraccount{$user};lev=$i" onclick="return confirm('$profile_txt{'907a'}${$uid.$user}{'email'}');">$profile_txt{$i}</a>$levsep~; 3208 } 3209 $ban_email_link .= q~ ]</span>~; 3210 } 3211 else { 3212 $ban_email_link = q{}; 3213 } 3214 $ban_user_name = $useraccount{$user}; 3215 3216 if ( $is_banned =~ /U/sm ) { 3217 $ban_user_link = 3218qq~<span class="small">[ <a href="$scripturl?action=ipban_update;ban_memname=$ban_user_name;username=$useraccount{$user};unban=1" onclick="return confirm('$profile_txt{'903a'}$user');">$profile_txt{'903'}</a> ]</span>~; 3219 } 3220 elsif ( ${ $uid . $user }{'position'} ne 'Administrator' ) { 3221 $ban_user_link = qq~<span class="small">[ $profile_txt{'906'}: ~; 3222 my $bansep = $#timeban; 3223 my $levsep = q~ | ~; 3224 for my $i (@timeban) { 3225 if ( !$bansep-- ) { $levsep = q{}; } 3226 $ban_user_link .= 3227qq~<a href="$scripturl?action=ipban_update;ban_memname=$ban_user_name;username=$useraccount{$user};lev=$i" onclick="return confirm('$profile_txt{'906a'}$user');">$profile_txt{$i}</a>$levsep~; 3228 } 3229 $ban_user_link .= q~ ]</span>~; 3230 } 3231 else { 3232 $ban_user_link = q{}; 3233 } 3234 3235 # Shows the banning stuff for IP's 3236 @banlink = (); 3237 $ip_ban_options = q{}; 3238 if ( ${ $uid . $user }{'lastips'} ) { 3239 @ip_ban = split /\|/xsm, ${ $uid . $user }{'lastips'}; 3240 for my $ip ( 0 .. ( @ip_ban - 1 ) ) { 3241 if ( check_banlist( q{}, "$ip_ban[$ip]", q{} ) ) { 3242 $banlink[$ip] = 3243qq~<span class="small">[ <a href="$scripturl?action=ipban_update;ban=$ip_ban[$ip];username=$useraccount{$user};unban=1" onclick="return confirm('$profile_txt{'905a'}$ip_ban[$ip]');">$profile_txt{'905'}</a> ]</span>~; 3244 } 3245 elsif ( ${ $uid . $user }{'position'} ne 'Administrator' ) { 3246 $banlink[$ip] = 3247 qq~<span class="small">[ $profile_txt{'908'}: ~; 3248 my $bansep = $#timeban; 3249 my $levsep = q~ | ~; 3250 for my $i (@timeban) { 3251 if ( !$bansep-- ) { $levsep = q{}; } 3252 $banlink[$ip] .= 3253qq~<a href="$scripturl?action=ipban_update;ban=$ip_ban[$ip];username=$useraccount{$user};lev=$i" onclick="return confirm('$profile_txt{'908a'}$ip_ban[$ip]');">$profile_txt{$i}</a>$levsep~; 3254 } 3255 $banlink[$ip] .= q~ ]</span>~; 3256 } 3257 else { 3258 $banlink[$ip] .= q{}; 3259 } 3260 } 3261 for my $i ( 0 .. ( @ip_ban - 1 ) ) { 3262 if ( $ip_ban[$i] ) { 3263 my $lookupIP = 3264 ($ipLookup) 3265 ? qq~<a href="$scripturl?action=iplookup;ip=$ip_ban[$i]">$ip_ban[$i]</a>~ 3266 : qq~$ip_ban[$i]~; 3267 $ip_ban_options .= qq~$lookupIP<br />$banlink[$i]<br />~; 3268 } 3269 } 3270 } 3271 3272 $my_banning = $myshow_banning; 3273 $my_banning =~ s/{yabb ban_user}/$user/sm; 3274 $my_banning =~ s/{yabb ban_user_link}/$ban_user_link/sm; 3275 $my_banning =~ s/{yabb ban_email}/${$uid.$user}{'email'}/sm; 3276 $my_banning =~ s/{yabb ban_email_link}/$ban_email_link/sm; 3277 $my_banning =~ s/{yabb ip_ban_options}/$ip_ban_options/sm; 3278 } 3279 if ( ${ $uid . $user }{'position'} eq 'Administrator' && !$iamadmin ) { 3280 $my_banning = q{}; 3281 } 3282 3283 if ( $iamadmin 3284 && !$view 3285 && $user ne $username 3286 && ${ $uid . $user }{'position'} ne 'Administrator' ) 3287 { 3288 $my_reminder = $myshow_reminder; 3289 $my_reminder =~ s/{yabb my_realname}/${$uid.$user}{'realname'}/sm; 3290 } 3291 3292 if ( ${ $uid . $user }{'postcount'} > 0 3293 && $maxrecentdisplay > 0 3294 && !$view ) 3295 { 3296 my ( $x, $y ) = ( int( $maxrecentdisplay / 5 ), 0 ); 3297 if ($x) { 3298 for my $i ( 1 .. 5 ) { 3299 $y = $i * $x; 3300 $my_recent_display .= qq~ 3301 <option value="$y">$y</option>~; 3302 } 3303 } 3304 if ( $maxrecentdisplay > $y ) { 3305 $my_recent_display .= qq~ 3306 <option value="$maxrecentdisplay">$maxrecentdisplay</option>~; 3307 } 3308 3309 $my_recent = $myshow_recent; 3310 $my_recent =~ s/{yabb user}/$useraccount{$user}/sm; 3311 $my_recent =~ s/{yabb my_recent_display}/$my_recent_display/sm; 3312 $my_recent =~ s/{yabb my_realname}/${$uid.$user}{'realname'}/sm; 3313 } 3314 3315 $showProfile .= $myshow_profile; 3316 $showProfile =~ s/{yabb pic_row}/$pic_row/sm; 3317 $showProfile =~ s/{yabb realname}/${$uid.$user}{'realname'}/sm; 3318 $showProfile =~ s/{yabb col_title_user}/$col_title{$user}/sm; 3319 $showProfile =~ s/{yabb row_addgrp}/$row_addgrp/sm; 3320 $showProfile =~ s/{yabb memberstar_user}/$memberstar{$user}/sm; 3321 $showProfile =~ s/{yabb my_online}/$my_online/sm; 3322 $showProfile =~ s/{yabb showusertext}/$showusertext/sm; 3323 $showProfile =~ s/{yabb buddybutton}/$buddybutton/sm; 3324 $showProfile =~ s/{yabb modify}/$modify/sm; 3325 $showProfile =~ s/{yabb my_star}/$my_star/sm; 3326 $showProfile =~ s/{yabb post_count}/$post_count/sm; 3327 $showProfile =~ s/{yabb post_per_day}/$post_per_day/sm; 3328 $showProfile =~ s/{yabb dr}/$dr/sm; 3329 $showProfile =~ s/{yabb member_for_days}/$member_for_days/sm; 3330 $showProfile =~ s/{yabb my_gender}/$my_gender/sm; 3331 $showProfile =~ s/{yabb my_extprofile}/$my_extprofile/sm; 3332 $showProfile =~ s/{yabb my_userlevel}/$my_userlevel/sm; 3333 $showProfile =~ s/{yabb row_email}/$row_email/sm; 3334 $showProfile =~ s/{yabb row_website}/$row_website/sm; 3335 $showProfile =~ s/{yabb row_aim}/$row_aim/sm; 3336 $showProfile =~ s/{yabb row_skype}/$row_skype/sm; 3337 $showProfile =~ s/{yabb row_yim}/$row_yim/sm; 3338 $showProfile =~ s/{yabb row_gtalk}/$row_gtalk/sm; 3339 $showProfile =~ s/{yabb row_myspace}/$row_myspace/sm; 3340 $showProfile =~ s/{yabb row_facebook}/$row_facebook/sm; 3341 $showProfile =~ s/{yabb row_twitter}/$row_twitter/sm; 3342 $showProfile =~ s/{yabb row_youtube}/$row_youtube/sm; 3343 $showProfile =~ s/{yabb row_icq}/$row_icq/sm; 3344 $showProfile =~ s/{yabb row_signature}/$row_signature/sm; 3345 $showProfile =~ s/{yabb lastonline}/$lastonline/sm; 3346 $showProfile =~ s/{yabb userlastlogin}/$userlastlogin/sm; 3347 $showProfile =~ s/{yabb lastpost}/$lastpost/sm; 3348 $showProfile =~ s/{yabb userlastpost}/$userlastpost/sm; 3349 $showProfile =~ s/{yabb my_lastPM}/$my_lastPM/sm; 3350 $showProfile =~ s/{yabb my_banning}/$my_banning/sm; 3351 $showProfile =~ s/{yabb my_reminder}/$my_reminder/sm; 3352 $showProfile =~ s/{yabb my_recent}/$my_recent/sm; 3353## Mod Hook showProfile2 ## 3354 3355 $yytitle = $profile_txt{'92u'}; 3356 $yytitle =~ s/USER/${$uid.$user}{'realname'}/gsm; 3357 if ( !$view ) { 3358 $yymain .= $showProfile; 3359 template(); 3360 } 3361 return; 3362} 3363 3364sub usersrecentposts { 3365 my @x = @_; 3366 if ($iamguest) { fatal_error('members_only'); } 3367 if ( $INFO{'username'} =~ /\//xsm ) { fatal_error('no_user_slash'); } 3368 if ( $INFO{'username'} =~ /\\/xsm ) { 3369 fatal_error('no_user_backslash'); 3370 } 3371 if ( !-e ("$memberdir/$INFO{'username'}.vars") ) { 3372 fatal_error('no_profile_exists'); 3373 } 3374 if ( $action =~ /^(?:my)?usersrecentposts$/xsm ) { spam_protection(); } 3375 3376 my $curuser = $INFO{'username'}; 3377 LoadUser($curuser); 3378 3379 my $display = $FORM{'viewscount'} ? $FORM{'viewscount'} : $x[0]; 3380 if ( !$display ) { $display = 5; } 3381 elsif ( $display =~ /\D/xsm ) { fatal_error('only_numbers_allowed'); } 3382 if ( $display > $maxrecentdisplay ) { $display = $maxrecentdisplay; } 3383 3384 my ( 3385 %data, $numfound, %threadfound, %boardtxt, 3386 %recentthreadfound, $recentfound, $save_recent, $boardperms, 3387 %boardcat, %catinfos, $curboard, $c, 3388 @messages, $tnum, $tsub, $tname, 3389 $temail, $tdate, $treplies, $tusername, 3390 $ticon, $tstate, $mname, $memail, 3391 $mdate, $musername, $micon, $mattach, 3392 $mip, $mns, $counter, $board, 3393 $notify, $catid 3394 ); 3395 3396 Recent_Load($curuser); 3397 my @recent = 3398 reverse sort { ${ $recent{$a} }[1] <=> ${ $recent{$b} }[1] } 3399 grep { ${ $recent{$_} }[1] > 0 } keys %recent; 3400 my $recentcount = keys %recent; 3401 my @data; 3402 $#data = $display - 1; 3403 @data = map { 0 } @data; 3404 3405 get_forum_master(); 3406 foreach my $catid (@categoryorder) { 3407 foreach ( split /\,/xsm, $cat{$catid} ) { 3408 $boardcat{$_} = $catid; 3409 @{ $catinfos{$_} } = split /\|/xsm, $catinfo{$catid}, 3; 3410 } 3411 } 3412 3413 RECENTCHECK: foreach my $thread (@recent) { 3414 MessageTotals( 'load', $thread ); 3415 if ( ${$thread}{'board'} eq q{} ) { 3416 $save_recent = 1; 3417 delete $recent{$thread}; 3418 $recentcount--; 3419 next RECENTCHECK; 3420 } 3421 $curboard = ${$thread}{'board'}; 3422 3423 if ( !$boardtxt{$curboard} ) { 3424 ( $boardname{$curboard}, $boardperms, undef ) = split /\|/xsm, 3425 $board{$curboard}; 3426 3427 if ( 3428 !$iamadmin 3429 && ( !CatAccess( ${ $catinfos{$curboard} }[1] ) 3430 || AccessCheck( $curboard, q{}, $boardperms ) ne 'granted' ) 3431 ) 3432 { 3433 $recentcount--; 3434 next RECENTCHECK; 3435 } 3436 3437 fopen( FILE, "$boardsdir/$curboard.txt" ); 3438 @{ $boardtxt{$curboard} } = <FILE>; 3439 fclose(FILE); 3440 3441 if ( !@{ $boardtxt{$curboard} } ) { 3442 $save_recent = 1; 3443 delete $recent{$thread}; 3444 $recentcount--; 3445 next RECENTCHECK; 3446 } 3447 } 3448 elsif ($numfound) { 3449 if ( exists $recentthreadfound{$thread} ) { 3450 $recentfound += $recentthreadfound{$thread}; 3451 } 3452 last 3453 if $recentfound >= $display 3454 && $data[-1] > ${ $recent{$thread} }[1]; 3455 next; 3456 } 3457 3458 for my $i ( 0 .. ( @{ $boardtxt{$curboard} } - 1 ) ) { 3459 ( 3460 $tnum, $tsub, $tname, $temail, $tdate, 3461 $treplies, $tusername, $ticon, $tstate 3462 ) = split /\|/xsm, ${ $boardtxt{$curboard} }[$i]; 3463 3464 if ( ( $display == 1 && $thread == $tnum ) 3465 || ( $display > 1 && exists $recent{$tnum} ) ) 3466 { 3467 if ( $tstate =~ /h/sm && !$iamadmin && !$iamgmod ) { 3468 $recentcount--; 3469 } 3470 else { 3471 fopen( FILE, "$datadir/$tnum.txt" ); 3472 @messages = <FILE>; 3473 fclose(FILE); 3474 3475 my $usercheck = 0; 3476 3477 for my $c ( reverse 0 .. $#messages ) { 3478 ( 3479 $msub, $mname, $memail, $mdate, 3480 $musername, $micon, $mattach, $mip, 3481 $message, $mns 3482 ) = split /\|/xsm, $messages[$c]; 3483 3484 if ( $curuser eq $musername ) { 3485 my @i = ( @data, $mdate ); 3486 @data = reverse sort { $a <=> $b } @i; 3487 if ( pop(@data) < $mdate ) { 3488 chomp $mns; 3489 $data{$mdate} = [ 3490 $curboard, $tnum, $c, 3491 $tname, $msub, $mname, 3492 $memail, $mdate, $musername, 3493 $micon, $mattach, $mip, 3494 $message, $mns, $tstate, 3495 $tusername 3496 ]; 3497 if ( !$usercheck ) { 3498 $numfound++; 3499 $threadfound{$tnum} = 1; 3500 } 3501 if ( exists $recent{$tnum} ) { 3502 $recentthreadfound{$tnum}++; 3503 if ( $thread == $tnum ) { 3504 $recentfound++; 3505 } 3506 } 3507 if ( ${ $recent{$tnum} }[1] < $mdate ) { 3508 $save_recent = 1; 3509 ${ $recent{$tnum} }[1] = $mdate; 3510 } 3511 } 3512 $usercheck = 1; 3513 } 3514 } 3515 if ( !$usercheck ) { 3516 $save_recent = 1; 3517 delete $recent{$tnum}; 3518 $recentcount--; 3519 } 3520 } 3521 } 3522 } 3523 } 3524 3525 if ( $recentfound < $display && $numfound < $recentcount ) { 3526 CATEGORYCHECK: foreach my $catid (@categoryorder) { 3527 if ( !CatAccess( ( split /\|/xsm, $catinfo{$catid}, 3 )[1] ) ) { 3528 next CATEGORYCHECK; 3529 } 3530 3531 BOARDCHECK: 3532 foreach my $curboard ( split /\,/xsm, $cat{$catid} ) { 3533 if ( !$boardtxt{$curboard} ) { 3534 ( $boardname{$curboard}, $boardperms, undef ) = 3535 split /\|/xsm, $board{$curboard}; 3536 3537 if ( !$iamadmin 3538 && AccessCheck( $curboard, q{}, $boardperms ) ne 3539 'granted' ) 3540 { 3541 next BOARDCHECK; 3542 } 3543 3544 my $bdmods = ${ $uid . $curboard }{'mods'}; 3545 $bdmods =~ s/\, /\,/gsm; 3546 $bdmods =~ s/\ /\,/gsm; 3547 my %moderators = (); 3548 my $pswiammod = 0; 3549 foreach my $curuser ( split /\,/xsm, $bdmods ) { 3550 if ( $username eq $curuser ) { $pswiammod = 1; } 3551 } 3552 my $bdmodgroups = ${ $uid . $curboard }{'modgroups'}; 3553 $bdmodgroups =~ s/\, /\,/gsm; 3554 my %moderatorgroups = (); 3555 foreach my $curgroup ( split /\,/xsm, $bdmodgroups ) { 3556 if ( ${ $uid . $username }{'position'} eq $curgroup ) { 3557 $pswiammod = 1; 3558 } 3559 foreach my $memberaddgroups ( split /\, /sm, 3560 ${ $uid . $username }{'addgroups'} ) 3561 { 3562 chomp $memberaddgroups; 3563 if ( $memberaddgroups eq $curgroup ) { 3564 $pswiammod = 1; 3565 last; 3566 } 3567 } 3568 } 3569 my $cookiename = "$cookiepassword$curboard$username"; 3570 my $crypass = ${ $uid . $curboard }{'brdpassw'}; 3571 if ( !$staff 3572 && !$pswiammod 3573 && $yyCookies{$cookiename} ne $crypass ) 3574 { 3575 next; 3576 } 3577 fopen( FILE, "$boardsdir/$curboard.txt" ) 3578 || next BOARDCHECK; 3579 @{ $boardtxt{$curboard} } = <FILE>; 3580 fclose(FILE); 3581 } 3582 3583 for my $i ( 0 .. ( @{ $boardtxt{$curboard} } - 1 ) ) { 3584 ( 3585 $tnum, $tsub, $tname, 3586 $temail, $tdate, $treplies, 3587 $tusername, $ticon, $tstate 3588 ) = split /\|/xsm, ${ $boardtxt{$curboard} }[$i]; 3589 3590 if ( exists( $recent{$tnum} ) 3591 && !exists $threadfound{$tnum} ) 3592 { 3593 if ( $tstate !~ /h/sm || $iamadmin || $iamgmod ) { 3594 fopen( FILE, "$datadir/$tnum.txt" ); 3595 @messages = <FILE>; 3596 fclose(FILE); 3597 3598 my $usercheck = 0; 3599 3600 for my $c ( reverse 0 .. $#messages ) { 3601 ( 3602 $msub, $mname, $memail, $mdate, 3603 $musername, $micon, $mattach, $mip, 3604 $message, $mns 3605 ) = split /\|/xsm, $messages[$c]; 3606 3607 if ( $curuser eq $musername ) { 3608 my @i = @data; 3609 push @i, $mdate; 3610 @data = reverse sort { $a <=> $b } @i; 3611 if ( pop(@data) != $mdate ) { 3612 chomp $mns; 3613 $data{$mdate} = [ 3614 $curboard, $tnum, 3615 $c, $tname, 3616 $msub, $mname, 3617 $memail, $mdate, 3618 $musername, $micon, 3619 $mattach, $mip, 3620 $message, $mns, 3621 $tstate, $tusername 3622 ]; 3623 if ( ${ $recent{$tnum} }[1] < $mdate ) { 3624 $save_recent = 1; 3625 ${ $recent{$tnum} }[1] = $mdate; 3626 } 3627 } 3628 $usercheck = 1; 3629 } 3630 } 3631 3632 if ( !$usercheck ) { 3633 $save_recent = 1; 3634 delete $recent{$tnum}; 3635 } 3636 } 3637 } 3638 } 3639 } 3640 } 3641 } 3642 3643 undef %boardtxt; 3644 3645 if ($save_recent) { Recent_Save($curuser); } 3646 3647 if ( $display == 1 ) { 3648 return if !$data[0]; 3649 ( 3650 $board, $tnum, $c, $tname, 3651 $msub, $mname, $memail, $mdate, 3652 $musername, $micon, $mattach, $mip, 3653 $message, $mns, $tstate, $tusername 3654 ) = @{ $data{ $data[0] } }; 3655 ToChars($msub); 3656 ( $msub, undef ) = Split_Splice_Move( $msub, 0 ); 3657 return ( timeformat($mdate) 3658 . qq~<br />$profile_txt{'view'} › <a href="$scripturl?num=$tnum/$c#$c">$msub</a>~ 3659 ); 3660 } 3661 3662 LoadCensorList(); 3663 3664 for my $i ( 0 .. ( @data - 1 ) ) { 3665 next if !$data[$i]; 3666 3667 ( 3668 $board, $tnum, $c, $tname, 3669 $msub, $mname, $memail, $mdate, 3670 $musername, $micon, $mattach, $mip, 3671 $message, $mns, $tstate, $tusername 3672 ) = @{ $data{ $data[$i] } }; 3673 ( $msub, undef ) = Split_Splice_Move( $msub, 0 ); 3674 wrap(); 3675 $displayname = $mname; 3676 ( $message, undef ) = Split_Splice_Move( $message, $tnum ); 3677 if ($enable_ubbc) { 3678 $ns = $mns; 3679 enable_yabbc(); 3680 DoUBBC(); 3681 } 3682 wrap2(); 3683 ToChars($msub); 3684 ToChars($message); 3685 $msub = Censor($msub); 3686 $message = Censor($message); 3687 ToChars( ${ $catinfos{$board} }[0] ); 3688 ToChars( $boardname{$board} ); 3689 3690 $counter++; 3691 3692 if ( $tusername !~ m{Guest}sm ) { 3693 if ( -e ("$memberdir/$tusername.vars") ) { 3694 LoadUser($tusername); 3695 $mytname = 3696qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$tusername}" rel="nofollow">$format_unbold{$tusername}</a>~; 3697 } 3698 else { $mytname = qq~$tname - $maintxt{'470a'}~; } 3699 } 3700 else { 3701 $mytname = "$tname ($maintxt{'28'})"; 3702 } 3703 3704 $mname = 3705qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$curuser}" rel="nofollow">$format_unbold{$curuser}</a>~; 3706 3707 $mdate = timeformat($mdate); 3708 3709 get_template('MyPosts'); 3710 $mypostborder = q{}; 3711 if ( $action eq 'myusersrecentposts' ) { 3712 $mypostborder = ' class="mypostborder"'; 3713 } 3714 3715 $showProfile .= $myshow_recent_a; 3716 3717 $showProfile =~ s/{yabb counter}/$counter/sm; 3718 $showProfile =~ s/{yabb brdcat}/$boardcat{$board}/sm; 3719 $showProfile =~ s/{yabb brd}/$boardcat{$board}/sm; 3720 $showProfile =~ s/{yabb catinfobrd}/${$catinfos{$board}}[0]/sm; 3721 $showProfile =~ s/{yabb brdbrd}/$boardname{$board}/sm; 3722 $showProfile =~ s/{yabb tnum}/$tnum\/$c#$c/sm; 3723 $showProfile =~ s/{yabb msub}/$msub/sm; 3724 $showProfile =~ s/{yabb mdate}/$mdate/sm; 3725 $showProfile =~ s/{yabb tname}/$mytname/sm; 3726 $showProfile =~ s/{yabb poster}/$mname/sm; 3727 $showProfile =~ s/{yabb mypostborder}/$mypostborder/sm; 3728 3729 if ( $tstate != 1 ) { 3730 if ( ${ $uid . $username }{'thread_notifications'} =~ 3731 /\b$tnum\b/xsm ) 3732 { 3733 $notify = 3734qq~$menusep<a href="$scripturl?action=notify3;num=$tnum/$c;oldnotify=1">$img{'del_notify'}</a>~; 3735 } 3736 else { 3737 $notify = 3738qq~$menusep<a href="$scripturl?action=notify2;num=$tnum/$c;oldnotify=1">$img{'add_notify'}</a>~; 3739 } 3740 $showProfile .= 3741qq~<a href="$scripturl?board=$board;action=post;num=$tnum/$c#$c;title=PostReply">$img{'reply'}</a>$menusep<a href="$scripturl?board=$board;action=post;num=$tnum;quote=$c;title=PostReply">$img{'recentquote'}</a>$notify ~; 3742 } 3743 3744 $showProfile .= $myshow_recent_b; 3745 $showProfile =~ s/{yabb recentmsg}/$message/sm; 3746 } 3747 3748 if ( !$counter ) { 3749 $showProfile .= qq~<b>$profile_txt{'755'}</b>~; 3750 } 3751 elsif ( !$view ) { 3752 $showProfile .= 3753qq~<p><a href="$scripturl?action=viewprofile;username=$useraccount{$curuser}"><b>$profile_txt{'92u'}</b></a></p>~; 3754 $showProfile =~ s/USER/${$uid.$curuser}{'realname'}/gsm; 3755 } 3756 3757 $yytitle = "$profile_txt{'458'} ${$uid.$curuser}{'realname'}"; 3758 if ( !$view ) { 3759 $yynavigation = qq~› $maintxt{'213'}~; 3760 $yymain .= $showProfile; 3761 template(); 3762 } 3763 return; 3764} 3765 3766sub DrawGroups { 3767 my ( $availgroups, $position, $show_additional ) = @_; 3768 my ( %groups, $groupsel ); 3769 map { $groups{$_} = 1; } split /,/xsm, $availgroups; 3770 3771 for my $key (@nopostorder) { 3772 my ( 3773 $name, undef, undef, undef, undef, undef, 3774 undef, undef, undef, undef, $additional 3775 ) = split /\|/xsm, $NoPost{$key}; 3776 next if ( !$show_additional && !$additional ) || $position eq $key; 3777 3778 $groupsel .= 3779 qq~<option value="$key"~ 3780 . ( $groups{$key} ? ' selected="selected"' : q{} ) 3781 . qq~>$name</option>~; 3782 $selsize++; 3783 } 3784 return ( $groupsel, ( $selsize > 6 ? 6 : $selsize ) ); 3785} 3786 3787sub isselected { 3788 my ($inp) = @_; 3789 3790 # Return a ref so we can be used like ${isselected($var)} inside a string 3791 return \' selected="selected"' if $inp; 3792 return \q{}; 3793} 37941; 3795