$YaBBChatplver = '1.98 for YaBB Gold SP1'; # This version for forums using Add More Smilies v2.x ######################################### # Main script for Chatroom sub yabbchat { require "$vardir/ChatSettings.txt"; # load cookie # foreach (split(/; /,$ENV{'HTTP_COOKIE'})) { $_ =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; ($cookie,$value) = split(/=/); $yyCookies{$cookie} = $value; } if( $yyCookies{$cookiepassword} ) { $password = $yyCookies{$cookiepassword}; $username = $yyCookies{$cookieusername} || 'Guest'; } else { if ($enable_guestposting eq '0') { &error($chadmtxt{'8'}); exit; } $username = 'Guest'; } # get displayname # if ($username ne 'Guest'){ fopen(FILE, "$memberdir/$username.dat"); @settings = ; fclose(FILE); $username =~ s/\n//g; $userdisplayname = $settings[1]; $userdisplayname =~ s/\n//g; $position = $settings[7]; $position =~ s/\n//g; $usertimeoffset = $settings[18]; } else { $userdisplayname = 'Guest'; $position = 'Guest'; $usertimeoffset = '0'; } chomp $chatgroup; @chatgrouplist = split(",",$chatgroup); $chatgroupflag = 0; foreach $chatgroupitem (@chatgrouplist) { if ($position eq $chatgroupitem) { $chatgroupflag = 1; } } if (($chatopen eq '0') && ( $chatgroupflag != 1 ) && ($position ne "Administrator")) { &error($txt{'1'}); exit; } # set levels # $userlevel =1; chomp $level1; @levellist = split(",",$level1); $levelflag = 0; foreach $levelitem (@levellist) { if ($position eq $levelitem) { $levelflag = 1; } } if ($levelflag == 1) { $userlevel = 1; } chomp $level2; @levellist = split(",",$level2); $levelflag = 0; foreach $levelitem (@levellist) { if ($position eq $levelitem) { $levelflag = 1; } } if ($levelflag == 1) { $userlevel = 2; } chomp $level3; @levellist = split(",",$level3); $levelflag = 0; foreach $levelitem (@levellist) { if ($position eq $levelitem) { $levelflag = 1; } } if ($levelflag == 1) { $userlevel = 3; } if ( $position eq 'Administrator' ) { $userlevel = 3; } # set variables # $cgiurl = "$boardurl/YaBB.$yyext?action=chatnow"; $logouturl = "$imagesdir/close.htm"; $kickouturl = "$imagesdir/close.htm"; $onlinefile = "$vardir/online.txt"; $messfile = "$vardir/says.txt"; $wordcolorfile = "$vardir/ecolor.txt"; # $addsaysfile = "$vardir/eaddsays.txt"; my $faderpath2 = $faderpath; $faderpath2 =~ m/(.+)(\/.+$)/; $chatfaderpath = $1 . qq~/ubbc_for_chat_1_98.js~; $txt{'img1'} = " $chadmtxt{'60'}"; $txt{'img2'} = " $chadmtxt{'31'}"; $txt{'img3'} = " $chadmtxt{'55'}"; $txt{'img4'} = " $chadmtxt{'56'}"; $txt{'img5'} = " $chadmtxt{'57'}"; $txt{'img6'} = " $chadmtxt{'58'}"; $txt{'img7'} = " $chadmtxt{'37'}"; # $txt{'img8'} = " Forum"; $saysback = $color{'chatsaysback'}; $saysword = $color{'chatsaysword'}; $loginword = $color{'chatloginword'}; $logoutword = $color{'chatlogoutword'}; $onlineback = $color{'chatonlineback'}; $onlineword = $color{'chatonlineword'}; $typeback = $color{'chattypeback'}; $typeword = $color{'chattypeword'}; $typefrmback= $color{'chattypefrmback'}; $funcback = $color{'chatfuncback'}; $funcword = $color{'chatfuncword'}; $fastback = $color{'chatfastback'}; $sysmess = $color{'chatsysmess'}; $link = $color{'chatlink'}; $reload = $chatreload; $picsize = 3; $kicktime = $chatkicktime; $allow_mess = $chat_allow_mess; $show_time = $chattimeshow; $show_top = $chattopshow; $use_pics = $chatpicshow; $level_towho = 1; $level_cls = 2; $level_kick = 3; $title = "$mbname $chadmtxt{'0'}"; print "Content-type: text/html;CHARSET=$yycharset\n"; print "Pragma:no-cache\n\n"; $kicked = 0; $kickoutway ="level1"; $exist="no"; $|=1; # &get_data; &set_var; if ($job eq "login") { &write_online("online"); &write_mess("login") if ($exist eq "no"); &return_whole; } elsif ($job eq "logout") { &write_online("outline"); &write_mess("logout") if ($exist ne "no"); &return_logout; } elsif ($job eq "setfunc") { &return_func; } elsif ($job eq "settype") { &write_online("online"); &return_type; } elsif ($job eq "look") { &write_online("online"); &return_mess; } elsif ($job eq "setup") { &return_up; } elsif ($job eq "tell") { &return_tell; } elsif ($job eq "says") { &write_online("online"); if ($kicked!=1) { &write_mess("says"); } &return_mess; } elsif ($job eq "online") { &write_online("online"); &return_online("online"); } elsif ($job eq "setkick") { if ($userlevel>=$level_kick) { &write_online("online"); &return_online("kickout"); } else { &error("No User Right"); } } elsif ($job eq "kickout") { if ($userlevel>=$level_kick) { if ($kickoutuser) { &write_online("kickout"); } &return_mess; } else { &error("No User Right"); } } elsif ($job eq "typecls") { &return_cls; &write_mess("setcls"); &return_mess; } exit; } # end of main script #################### ######################################### # Writes new chat messages to says.txt file sub write_mess { $write_mess_subject=$_[0]; fopen(MESS,"$messfile") || die $!; @mess = ; fclose(MESS); fopen(MESS,">$messfile") || die $!; $total_mess1=0; $total_mess2=0; $sizeofmessarray = @mess; if ($sizeofmessarray >= $allow_mess) { $deadzone = shift @mess; } foreach $message (@mess) { ($mark,$chkusername,$chkuserdisplayname,$chkuserlevel,$chktowhoway,$chktowhoname,$chkwordcolor,$chksays,$chktime,$markend,$last) = split(/°¸/, $message); if ($markend eq "end") { if ($mark eq "says") { if ($chktowhoway eq "private") { if (($total_mess2<$allow_mess) && ($total_mess1<$allow_mess)) {print MESS "$message";} $total_mess2++;} else { if ($total_mess1<$allow_mess) {print MESS "$message";} $total_mess1++;} } elsif (($mark eq "login") || ($mark eq "logout") || ($mark eq "setcls")) { if ($total_mess1<$allow_mess) {print MESS "$message";} $total_mess1++;} } } if ($write_mess_subject eq "login") { print MESS "login°¸$username°¸$userdisplayname°¸$userlevel°¸°¸°¸°¸°¸$normal_time°¸end°¸\n"; $total_mess1++;} elsif ($write_mess_subject eq "logout") { print MESS "logout°¸$username°¸$userdisplayname°¸$userlevel°¸°¸°¸°¸°¸$normal_time°¸end°¸\n"; $total_mess1++;} elsif ($write_mess_subject eq "setcls") { print MESS "setcls°¸$username°¸$userdisplayname°¸$userlevel°¸°¸°¸°¸°¸$normal_time°¸end°¸\n"; $total_mess1++;} elsif ($write_mess_subject eq "says") { $says =~ s/\/me\s+(.*)/\[color=red\]\*$userdisplayname $1\[\/color\]/ig; ##### start shortcuts addon if( $chatshortcutslist ) { @chatshortcuts = split( /\°/, $chatshortcutslist ); foreach $chatshortcut (@chatshortcuts) { chomp $chatshortcut; ( $chatshortcut1, $chatshortcut2 ) = split( /\|/, $chatshortcut ); if ( $says =~ /\/$chatshortcut1/ ) { $says = qq~$chatshortcut2~; } } if ( $says =~ /\/$chadmtxt{'87'}/ ) { $says = qq~*chatbreak*$chadmtxt{'88'}*chatbreak*~; foreach $chatshortcut (@chatshortcuts) { chomp $chatshortcut; ( $chatshortcut1, $chatshortcut2 ) = split( /\|/, $chatshortcut ); $says .= qq~\/$chatshortcut1=$chatshortcut2*chatbreak*~; } } } ##### end shortcuts addon ##### start help addon if ( $says =~ /\/$chadmtxt{'53'}/ ) { my $helpfile2 = $helpfile; $helpfile2 =~ m/(.+)(\/.+$)/; my $chathelpfile = $1 . qq~/YaBBChatHelp.html~; $says = qq~[url=$chathelpfile]$chadmtxt{'59'} [\/url]~; } ##### end help addon ##### start admin center link addon if ( $says =~ /\/$chadmtxt{'40'}/ ) { if ( $position eq "Administrator" ) { $towhoway = "private"; $chktowhoway = "private"; $chktowhoname = $username; $towho = $username; $chkusername = $username; $says = qq~[url=$cgi\&action=chatset1]$chadmtxt{'6'} [\/url]~; } else { $says = qq~ :) ~; } } ##### end admin center link addon print MESS "says°¸$username°¸$userdisplayname°¸$userlevel°¸$towhoway°¸$towho°¸$wordcolor°¸$says°¸$normal_time°¸end°¸\n"; if (($towhoway eq "private") && ($towho ne "toall")) {$total_mess2++;} else {$total_mess1++;} } fclose(MESS); } ######################################### # Writes who is chatting to online.txt file sub write_online { $write_online_subject = $_[0]; fopen(ONLINE,"$onlinefile") || die $!; @online = ; fclose(ONLINE); @online = sort @online; $lastcheck = ""; $done = 0; fopen(ONLINE,">$onlinefile") || die $!; foreach $online_line (@online) { ($mark,$chkusername,$chkuserip,$chkuserdisplayname,$chkuserlevel,$chktime,$chksec,$chkkickout,$chkkickoutway,$markend,$last)=split(/°¸/,$online_line); if (($mark eq "online") && ($markend eq "end")) { if ($lastcheck ne "$chkusername") { if (($write_online_subject eq "online") && ($chkusername eq $username)) { print ONLINE "online°¸$username°¸$user_ip°¸$userdisplayname°¸$userlevel°¸$normal_time°¸$now_sec°¸$chkkickout°¸$chkkickoutway°¸end°¸\n"; if ($chkkickout eq "kickouted") { $kicked =1; $kickoutway=$chkkickoutway; } $done=1; } elsif (($write_online_subject eq "outline") && ($chkusername eq $username) && ($chkkickout ne "kickouted")) { print ONLINE ""; $exist="yes"; } elsif (($write_online_subject eq "kickout") && ($kickoutuser eq "$chkusername")) { print ONLINE "online°¸$kickoutuser°¸°¸°¸°¸$normal_time°¸$now_sec°¸kickouted°¸$kickoutway°¸end°¸\n"; $done=1; } else { if ((($chksec<$cut1_sec) || ($chksec>$cut2_sec)) && ($chkkickout ne "kickouted")) { print ONLINE ""; } elsif ((($chksec<$cut3_sec) || ($chksec>$cut4_sec)) && ($chkkickout eq "kickouted")) { print ONLINE ""; } else { print ONLINE "$online_line"; } } } $lastcheck = "$chkusername"; } } if (($write_online_subject eq "online") && ($done==0)) { print ONLINE "online°¸$username°¸$user_ip°¸$userdisplayname°¸$userlevel°¸$normal_time°¸$now_sec°¸°¸°¸end°¸\n"; } elsif (($write_online_subject eq "kickout") && ($done==0)) { print ONLINE "online°¸$kickoutuser°¸°¸°¸°¸$normal_time°¸$now_sec°¸kickouted°¸$kickoutway°¸end°¸\n"; } fclose(ONLINE); } ######################################### # Reads says.txt and displays chat messages in main frame of Chatroom window sub return_mess { require "$sourcedir/YaBBC.pl"; fopen(MESS,"$messfile") || die $!; @mess = ; fclose(MESS); if ($kicked==1) { print "$title\n"; print "\n"; print "\n"; print "\n"; } else { print "Chatting Screen\n"; print "\n"; print "\n"; print "\n"; print qq~ ~; print "\n"; print "\n"; print "\n"; print "\n"; foreach $message (@mess) { $message =~ s~\[([^\]]{0,30})\n([^\]]{0,30})\]~\[$1$2\]~g; $message =~ s~\[/([^\]]{0,30})\n([^\]]{0,30})\]~\[/$1$2\]~g; $message =~ s~(\w+://[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)~$1$2~g; $message =~ s/\&/\&/g; $message =~ s/"/\"/g; $message =~ s/ / \ /g; $message =~ s//\>/g; &LoadCensorList; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $message =~ s~\Q$tmpa\E~$tmpb~gi; } &DoUBBC; ($mark,$chkusername,$chkuserdisplayname,$chkuserlevel,$chktowhoway,$chktowhoname,$chkwordcolor,$chksays,$chktime,$markend,$last) = split(/°¸/, $message); # if ($markend ne "end") { &error("$message malformed"); exit;} $chksays =~ s~\*chatbreak\*~
~ig; $linebreak="
"; if ($usertimeoffset ne '0') { ($hour,$minute,$second)=split(/\:/,$chktime); $offhour=$hour + $usertimeoffset; if ($offhour >= 24) { $offhour=$offhour-24; } if ($offhour < 10) { $offhour="0$offhour"; } $chktime="$offhour\:$minute\:$second"; } if ($mark eq "says") { if ($chktowhoname eq "toall") { if ($show_time eq "1") {print "$chktime ";} print "$chkuserdisplayname: $chksays$linebreak\n";} elsif (($chktowhoname ne "toall") && ($chktowhoway eq "public")) { if ($show_time eq "1") {print "$chktime ";} print "$chkuserdisplayname $txt{'311'} $chktowhoname: $chksays$linebreak\n";} elsif (($chktowhoname ne "toall") && ($chktowhoway eq "private") && (($username eq $chkusername) || ($userdisplayname eq $chktowhoname))) { if ($show_time eq "1") {print "$chktime ";} # $chkaddsays =~ s/says//g; print "$chkuserdisplayname $chadmtxt{'49'} $chktowhoname: $chksays$linebreak\n";} } elsif ($mark eq "setcls") { if ($show_time eq "1") {print "$chktime ";} print "$chadmtxt{'48'}: $chkuserdisplayname $chadmtxt{'52'}$linebreak\n";} elsif ($mark eq "login") { if ($show_time eq "1") {print "$chktime ";} print "$chadmtxt{'48'}: $chkuserdisplayname $chadmtxt{'50'}$linebreak\n";} elsif ($mark eq "logout") { if ($show_time eq "1") {print "$chktime ";} print "$chadmtxt{'48'}: $chkuserdisplayname $chadmtxt{'51'}$linebreak\n";} } print "
\n"; } } ######################################### # Display form across bottom of Chatroom window (text box, colors, emotions, public/private) sub return_type { fopen(ONLINE,"$onlinefile") || die $!; @online = ; fclose(ONLINE); @online = sort @online; fopen(WORDCOLOR,"$wordcolorfile") || die $!; @wordcolor = ; fclose(WORDCOLOR); # fopen(ADDSAYS,"$addsaysfile") || die $!; # @addsays = ; # fclose(ADDSAYS); print "\n"; print "Typing Area\n"; print "\n"; print "\n"; print qq~ ~; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print qq~
\n~; ### smilie print qq~ ~; ### end smilie ### smilie start print qq~
~; # # ~; #### more smilies if ($chatshowadded eq 2 || $chatshowsmdir eq 2){ print qq~ ~; } print qq~ ~; print qq~
~; print qq~$chadmtxt{'47'}~; print qq~$chadmtxt{'44'}:~; print qq~$chadmtxt{'42'}:\n"; # print "$chadmtxt{'38'}:\n"; #### begin test area # $chatsmilieline = 1; if ( $chatsmilieline == 1) { print qq~
~; } #### end test area if (($chatshowadded == 3 && $chatshowsmdir ne 2) || ($chatshowsmdir eq 3 && $chatshowadded ne 2)){ print qq~ $smiltxt{'1'} ~; } #### end smilie print "\n"; print qq~
\n ~; } ######################################### # Display info at top of Chatroom window sub return_up { if ($userlevel >= $level_towho){$levelname="User";} if ($userlevel >= $level_kick){$levelname="Admin";} print "Data\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "[ $chadmtxt{'30'} $nyear, $nmon, $nday ] "; print "[ $chadmtxt{'29'} $nhour : $nmin ] \n"; print "[ $chadmtxt{'26'} $user_ip ] \n"; print "[ $chadmtxt{'27'} $userlevel ] [ $chadmtxt{'28'} $levelname ]\n"; print "
\n"; print "\n"; } ######################################### # Reads online.txt file and displays who is currently chatting sub return_online { $return_online_subject = $_[0]; fopen(ONLINE,"$onlinefile") || die $!; @online = ; fclose(ONLINE); ### add sound # Initialize variables and get current number of users currently on chat my $soundflag = 'dontplay'; my $leftflag = 0; my %soundusers; my $onlinecount = @online; # Open chatcount file and put users and last usercount for each user in hash $chatcountfile = qq~$vardir/ChatCount.txt~; fopen(FILE, $chatcountfile); while ($strline=) { chop($strline); @line = split(/\|/,$strline); my($index) = $line[0]; $soundusers{$index} = $line[1]; } fclose(FILE); ### end sound @online = sort @online; #this chunk is called when we want to display the list of people online in top right hand frame if ($return_online_subject eq "online") { print "Users Online\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; } # This chunk is called when we want to show the "kickout" page elsif ($return_online_subject eq "kickout") { print "Kick Program\n"; print "\n"; print "

\n"; print "
\n"; print "
$chadmtxt{'31'}
\n"; print qq~\n~; } $lastcheck = ""; foreach $online_line (@online) { ($mark,$chkusername,$chkuserip,$chkuserdisplayname,$chkuserlevel,$chktime,$chksec,$chkkickout,$chkkickoutway,$markend,$last)=split(/°¸/,$online_line); if (($mark eq "online") && ($markend eq "end")) { if (($lastcheck ne "$chkusername") && (!(($return_online_subject eq "online") && ($userlevel<$level_kick) && ($chkkickout eq "kickouted")))) { if (($return_online_subject eq "kickout") && ($userlevel>=$level_kick)) { print ""; print ""; if ($chkkickout eq "kickouted") { if ($chkkickoutway eq "level3"){$chkkickoutway="$chadmtxt{'33'}";} print ""; } else { print ""; } print "\n"; } else { if ($chkkickoutway ne "kickouted"){ $user++; if ($chkusername eq 'Guest'){ $whosonlineline = 'Guest'; } else { $whosonlineline= "$chkuserdisplayname"; } print "\n"; } } } $lastcheck = "$chkusername"; } } if ($job eq "online"){ print "\n"; ### add sound # test last usercount for current user against current count and set soundflag if ( $soundusers{$username} < $onlinecount ) { $soundflag = 'play'; } # print sound if ( $soundflag eq 'play' && $chatpopup == 1 ) { print qq~~; } # set new usercount to current user count $soundusers{$username} = $onlinecount; # write hash back to chatcount file fopen(FILE, ">$chatcountfile"); while ( ($index2,$soundcount) = each(%soundusers) ) { print FILE qq~$index2|$soundcount\n~; } fclose(FILE); ### end sound print "
$chadmtxt{'80'}$txt{'68'}$chadmtxt{'81'}$chadmtxt{'82'}
"; if ($chkuserlevel<$level_kick) { print qq~~; } else { print "$txt{'470'}"; } print "$chkusername$chkuserip$chkkickoutway$txt{'470'}
$whosonlineline"; if ($userlevel>=$level_kick) { if ($chkuserlevel<$userlevel) {print "\ ($chkuserlevel)";} if ($chkuserlevel>=$userlevel) {print "\ ($chkuserlevel)";} if ($chkkickout eq "kickouted") {print "*";} } print "
$chadmtxt{'62'} $user $chadmtxt{'63'}
\n"; print "
\n"; } if (($return_online_subject eq "kickout") && ($userlevel>=$level_kick)) { print "\n"; print "
\n"; print qq~$chadmtxt{'32'}~; print qq~~; print "

\n"; print "\n"; } print "\n"; } ######################################### # Display menu in lower righthand corner of Chatroom sub return_func { print "func\n"; print "\n"; print "\n"; print "\n"; ### # print qq~$txt{'img8'}
\n~; # print "$txt{'img1'}
\n"; print "$txt{'img1'}
\n"; ### print "$txt{'img2'}
\n"; print "$txt{'img7'}
\n"; print "$txt{'img3'}
\n"; if ($userlevel>=$level_cls){ print "$txt{'img4'}
\n"; } if ($userlevel>=$level_kick){ print "$txt{'img5'}
\n"; } print "$txt{'img6'}
\n"; print "
\n"; } ######################################### # Setup various frames within Chatroom window sub return_whole { print "$title\n"; print "\n"; print "\n"; print "\n"; if ($show_top eq '1') { $rows="20,*,100";} else { $rows="*,100";} print "\n"; if ($show_top eq '1') { print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } ######################################### # Display info screen at startup and if "info" clicked sub return_tell { print "$title\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
"; print "

$mbname $chadmtxt{'11'}

\n"; print "
"; print qq~$chatinfo\n~; print "
$chadmtxt{'36'}
"; print "\n"; } ######################################### # Call close.htm to close out chatroom windows sub return_logout { print "$title\n"; print "\n"; print "\n"; print "\n"; } ######################################### # Get returned data from Chatroom forms #sub get_data { # @querys = split(/\&/, $ENV{'QUERY_STRING'}); # foreach $query (@querys) { # ($name, $value) = split(/=/, $query); # $INFO{$name} = $value; # } # if ("Administrator" eq $settings[7]) { # $userlevel = 3; # # } #} ######################################### # Assign returned data to proper variables, check for errors sub set_var { if ($INFO{'job'}) { $job = "$INFO{'job'}"; &chkempty($job,"$chadmtxt{'76'}"); } else { &error("$chadmtxt{'76'} $chadmtxt{'77'} $yyCookies{$cookieusername}"); } if ($FORM{'towhoway'}) { $towhoway = "$FORM{'towhoway'}"; $towhoway =~ s/\n//g; } if ($FORM{'towho'}) { $towho = "$FORM{'towho'}"; $towho =~ s/\n//g; } if ($FORM{'wordcolor'}) { $wordcolor = "$FORM{'wordcolor'}"; $wordcolor =~ s/\n//g; } if ($FORM{'says'}) { $says = "$FORM{'says'}"; $says =~ s/\n//g; $says =~ s/°¸//g; &chkempty($says,"$chadmtxt{'78'}"); } else { if ($job eq "says") { &error("$chadmtxt{'78'}"); } } # if ($FORM{'addsays'}) { # $addsays = "$FORM{'addsays'}"; # $addsays =~ s/\n//g; # $addsays =~ s/°¸//g; # } if ($FORM{'kickoutuser'}) { $kickoutuser = "$FORM{'kickoutuser'}"; $kickoutuser =~ s/\n//g; } if ($FORM{'kickoutway'}) { $kickoutway = "$FORM{'kickoutway'}"; $kickoutway =~ s/\n//g; } if ($FORM{'logouturl'}) { $logouturl = "$FORM{'logouturl'}"; $logouturl =~ s/\n//g; } ($nsec,$nmin,$nhour,$nday,$nmon,$nyear,$wday,$yday,$isdst) = localtime(time + (3600*$timeoffset)); $nyear = $nyear - 100 + 2000; if ($nsec<10) {$nsec="0$nsec";} if ($nmin<10) {$nmin="0$nmin";} if ($nhour<10) {$nhour="0$nhour";} $nmon=$nmon+1; if ($nmon<10) {$nmon="0$nmon";} if ($nday<10) {$nday="0$nday";} $normal_time ="$nhour\:$nmin\:$nsec"; $now_sec =$nsec + ($nmin*60) + ($nhour*60*60) + ($nday*24*60*60); $cut1_sec =$now_sec-($reload*4.2); $cut2_sec =$now_sec+($reload*4.2); $cut3_sec =$now_sec-($kicktime); $cut4_sec =$now_sec+($kicktime); $reload_double=$reload*2; $userinfo =""; } ######################################### # Check to see if chatroom text box was empty when pressed sub chkempty { $chkval = $_[0]; $chkerr = $_[1]; $chkval =~ s/ //g; $chkval =~ s/
//g; $chkval =~ s/\n//g; if ($chkval eq "") { &error($chkerr); } } ######################################### # Wipe Chat sub return_cls { fopen(MAIN,">$messfile"); print MAIN ""; fclose(MAIN); } ######################################### # Error handling sub error { $error_subject = $_[0]; print "Content-type: text/html;CHARSET=$yycharset\n"; print "Pragma:no-cache\n\n"; print "ERROR\n"; print "\n"; print ""; print "

\n"; print "$chadmtxt{'79'} $error_subject\n"; print "

\n"; } ################ more smilies stuff sub ChatSmiliePut { require "$vardir/ChatSettings.txt"; $headers .= "Content-type: text/html\n"; if( $yySetCookies ) { $headers .= $yySetCookies; } $headers .= "\n"; print $headers; print qq~ $smiltxt{'1'} ~; print qq~ $smiltxt{'21'}

~; if ($chatshowadded eq 3 || ($chatshowadded eq 2 && $chatdetachblock eq 1)){ print qq~ $moresmilieslist ~; } print qq~ $evenmoresmilies ~; exit; } ############## sub ChatSmilieIndex { require "$vardir/ChatSettings.txt"; $i=0; $offset = 0; $smilieslist = ""; $smilie_code_array = ""; if ($chatshowadded eq 3 || ($chatshowadded eq 2 && $chatdetachblock eq 1)){ while($SmilieURL[$i]) { if ($i % 4 == 0 && $i !=0) { $smilieslist .= qq~ \n \n~; $offset++; } if (($i+$offset) % 2 == 0) {$smiliescolor = qq~class="windowbg2" bgcolor="$color{'windowbg2'}"~;} else {$smiliescolor = qq~class="windowbg" bgcolor="$color{'windowbg'}"~;} if ($SmilieURL[$i]=~ /\//i) {$tmpurl = $SmilieURL[$i];} else {$tmpurl = qq~$imagesdir/$SmilieURL[$i]~;} $smilieslist .= qq~
$SmilieDescription[$i]\n~; $smilie_url_array .= qq~"$tmpurl", ~; $tmpcode = $SmilieCode[$i]; $tmpcode =~ s/\"/"+'"'+"/g; &FromHTML($tmpcode); $tmpcode =~ s/$/\$/g; $tmpcode =~ s/@/\@/g; $more_smilie_array .= qq~" $tmpcode", ~; $i++; } } if ($chatshowsmdir eq 3 || ($chatshowsmdir eq 2 && $chatdetachblock eq 1)){ opendir(DIR, "$smiliesdir"); @contents = readdir(DIR); closedir(DIR); foreach $line (sort {uc($a) cmp uc($b)} @contents){ ($name, $extension) = split (/\./, $line); if ($extension =~ /gif/i || $extension =~ /jpg/i || $extension =~ /jpeg/i || $extension =~ /png/i ){ if ($line !~ /banner/i) { if ($i % 4 == 0 && $i !=0) { $smilieslist .= qq~ \n \n~; $offset++; } if (($i+$offset) % 2 == 0) {$smiliescolor = qq~class="windowbg2" bgcolor="$color{'windowbg2'}"~;} else {$smiliescolor = qq~class="windowbg" bgcolor="$color{'windowbg'}"~;} $smilieslist .= qq~
$line\n~; $more_smilie_array .= qq~" [smiley=$line]", ~; $i++; } } } } while ($i % 4 != 0) { if (($i+$offset) % 2 == 0) {$smiliescolor = qq~class="windowbg2" bgcolor="$color{'windowbg2'}"~;} else {$smiliescolor = qq~class="windowbg" bgcolor="$color{'windowbg'}"~;} $smilieslist .= qq~  \n~; $i++; } $smilie_code_array .= qq~""~; $more_smilie_array .= qq~""~; if (-e "$smiliesdir/banner.gif") {$smiliesheader=qq~~;} else {$smiliesheader=qq~$smiltxt{'21'}~;} $headers .= "Content-type: text/html\n"; if( $yySetCookies ) { $headers .= $yySetCookies; } $headers .= "\n"; print $headers; print qq~ $smiltxt{'1'} $smiliesheader $smilieslist
~; exit; } ############## end more smilies stuff 1;