Tetra-WebBBS Debugger 6.10

Contents of /home/zoetecnocampoco/public_html/cgi-bin/bbs/lib/webbbs_misc.pl

    1- #<<<
    2- #######################################
    3- #    ---  Tetra-WebBBS  --- 
    4- # By:             tetrabb.com
    5- # Version:        6.10
    6- # Last modified:  2009-11-01
    7- # Copyright (c)   2006-2009
    8- # Website:        http://tetrabb.com
    9- # For more details see license.txt
   10- #
   11- # Core script:    webbbs_misc.pl
   12- # Authors:        Rainer Libowski
   13- #                 Tarty
   14- # Derived from code by Darryl Burgdorf
   15- #######################################
   16- #>>>
   17- 
   18- sub WebBBS {
   19- }
   20- 
   21- sub startup_misc {
   22- &Parse_Form;
   23- &Initialize_Data;
   24- return;
   25- }
   26- 
   27- sub startup_md_delete {
   28- if ( $FORM{'mode'} eq 'delete' ) {
   29- &MessageDBM_close();
   30- &MessageDBMWrite;
   31- &Delete;
   32- }
   33- elsif ( $FORM{'mode'} eq 'edit' ) {
   34- &UserEditForm;
   35- }
   36- } ## end sub startup_md_delete
   37- 
   38- sub UnWebify {
   39- $texttoconvert = $_[0];
   40- $texttoconvert =~ s/<P>/\n\n/g;
   41- $texttoconvert =~ s/<[^>]*\s+ALT\s*=\s*"(([^>"])*)"[^>]*>/$1/ig;
   42- $texttoconvert =~ s/<([^>]|\n)*>//g;
   43- $texttoconvert =~ s/\"\;/"/g;
   44- $texttoconvert =~ s/\<\;/</g;
   45- $texttoconvert =~ s/\>\;/>/g;
   46- $texttoconvert =~ s/\&\;/\&/g;
   47- $texttoconvert =~ s/\n(\n)+/\n\n/g;
   48- $texttoconvert =~ s/^\n*//g;
   49- $texttoconvert =~ s/\n+$/\n/g;
   50- return $texttoconvert;
   51- } ## end sub UnWebify
   52- 
   53- sub Delete {
   54- require 'webbbs_share.pl';
   55- $PassCheck = 0;
   56- unless ( $FORM{'newpassword'} ) {
   57- &Error( "9600", "9601" ) unless ($AdminRun);
   58- }
   59- $newpassword = crypt( $FORM{'newpassword'}, "aa" );
   60- if ( $FORM{'msgnum'} ) {
   61- $message = int( $FORM{'msgnum'} );
   62- }
   63- 
   64- $subdir = "bbs" . int( $message / 1000 );
   65- unless ( -e "$dir/$subdir/$message" ) { &Error( "9600", "9601" ); }
   66- $oldpassword = "";
   67- open( FILE, "$dir/$subdir/$message" );
   68- @message = <FILE>;
   69- close(FILE);
   70- 
   71- foreach $line (@message) {
   72- if ( $line =~ /^POSTER>(.*)/i ) {
   73- $deleteposter = $1;
   74- }
   75- elsif ( $line =~ /^PASSWORD>(.*)/i ) {
   76- $oldpassword = $1;
   77- last;
   78- }
   79- }
   80- undef @message;
   81- if ( ($oldpassword) && ( $newpassword eq $oldpassword ) ) {
   82- $PassCheck = 1;
   83- }
   84- if ( !($PassCheck) && ( $deleteposter eq $Cookies{'name'} ) ) {
   85- $oldpassword  = "";
   86- @message      = ();
   87- $ProfileCheck = $Cookies{'name'};
   88- $ProfileCheck =~ s/[^\w\.\-\']/\+/g;
   89- $ProfileCheck =~ tr/A-Z/a-z/;
   90- if ( -e "$UserProfileDir/$ProfileCheck.txt" ) {
   91- open( FILE, "$UserProfileDir/$ProfileCheck.txt" );
   92- @message = <FILE>;
   93- close(FILE);
   94- foreach $line (@message) {
   95- if ( $line =~ /^PASSWORD>(.*)/i ) {
   96- $oldpassword = $1;
   97- last;
   98- }
   99- }
  100- undef @message;
  101- }
  102- if ( ($oldpassword) && ( $newpassword eq $oldpassword ) ) {
  103- $PassCheck = 1;
  104- }
  105- }
  106- unless ( $PassCheck == 1 ) {
  107- if ($AdminRun) { $DeleteByAdmin = 1; }
  108- else {
  109- unless ( -e $password_file ) {
  110- &Error( "9600", "9601" );
  111- }
  112- my $result = $read5x->check_admin_password( 'password' => $FORM{'newpassword'} );
  113- if ( !$result ) {
  114- &Error( "9600", "9601" );
  115- }
  116- $DeleteByAdmin = 1;
  117- }
  118- }
  119- my $msgdata = $read5x->read_message("$dir/$subdir/$message");
  120- my ($image_location);
  121- ( undef, $image_location ) = &find_pics_location( $msgdata->{'image_url'}, 'UserPics' );
  122- 
  123- if ($PRO::VERSION) {
  124- &PRO::cb_message_delete_2( 'tbb'      => $main::tbb,
  125-                            'msg_num'  => $message,
  126-                            'board_id' => $main::tbb->{'conf'}->{'board_id'},
  127- );
  128- }
  129- 
  130- if ($DeleteByAdmin) {
  131- unlink "$dir/$subdir/$message";
  132- delete( $MessageList{$message} );
  133- unlink $image_location;
  134- rmdir "$dir/$subdir";
  135- }
  136- else {
  137- open( MESSAGE, "$dir/$subdir/$message" );
  138- @message = <MESSAGE>;
  139- close(MESSAGE);
  140- foreach $line (@message) {
  141- if ( $line =~ /^NEXT>(.*)/ ) {
  142- $nextmessages = $1;
  143- last;
  144- }
  145- }
  146- unlink $image_location;
  147- if ( int($nextmessages) < 1 ) {
  148- unlink "$dir/$subdir/$message";
  149- delete( $MessageList{$message} );
  150- rmdir "$dir/$subdir";
  151- }
  152- else {
  153- open( MESSAGE, ">$dir/$subdir/$message" );
  154- foreach $line (@message) {
  155- if ( $line =~ /^SUBJECT>/ ) {
  156- print MESSAGE "SUBJECT>$text{'0250'}\n";
  157- }
  158- elsif (    ( $line =~ /^POSTER>/ )
  159-         || ( $line =~ /^DATE>/ )
  160-         || ( $line =~ /^IP_ADDRESS>/ )
  161-         || ( $line =~ /^<!--/ )
  162-         || ( $line =~ /^PREVIOUS>/ )
  163-         || ( $line =~ /^NEXT>/ ) )
  164- {
  165- print MESSAGE "$line";
  166- }
  167- }
  168- print MESSAGE "\n";
  169- close(MESSAGE);
  170- undef @message;
  171- ( $deldate, $delsub, $delposter, $delprev, $delnext, $delcount, $deladmin, $delip ) = split( /\|/, $MessageList{$message} );
  172- delete( $MessageList{$message} );
  173- $delsub = $text{'0250'};
  174- foreach $key ( $deldate, $delsub, $delposter, $delprev, $delnext, $delcount, $deladmin, $delip ) {
  175- $MessageList{$message} .= "$key|";
  176- }
  177- }
  178- }
  179- if ($DisplayViews) {
  180- &LockOpen( COUNTLOCK, "$dir/countlist.lock" );
  181- unless ($NoCountLock) {
  182- &CountDBMWrite;
  183- }
  184- if ( $CountList{$message} ) { delete( $CountList{$message} ); }
  185- }
  186- 
  187- if ( !$main::tbb->{'conf'}->{'search'}->{'enable'} ) {
  188- open( SEARCH, "$dir/searchterms.idx" );
  189- &LockOpen( NEWSEARCH, "$dir/newsearchterms.idx" );
  190- while (<SEARCH>) {
  191- if (/^(\d+) /) {
  192- $message = $1;
  193- $subdir  = "bbs" . int( $message / 1000 );
  194- if ( -e "$dir/$subdir/$message" ) {
  195- print NEWSEARCH "$_";
  196- }
  197- }
  198- }
  199- close(SEARCH);
  200- if ( $ENV{'OS'} =~ /win/i ) {
  201- &LockClose( NEWSEARCH, "$dir/newsearchterms.idx" );
  202- }
  203- else {
  204- &LockOpen( SEARCH, "$dir/searchterms.idx" );
  205- }
  206- rename( "$dir/newsearchterms.idx", "$dir/searchterms.idx" );
  207- unless ( $ENV{'OS'} =~ /win/i ) {
  208- &LockClose( NEWSEARCH, "$dir/newsearchterms.idx" );
  209- &LockClose( SEARCH,    "$dir/searchterms.idx" );
  210- }
  211- }
  212- 
  213- if ($PRO::VERSION) {
  214- &PRO::cb_message_delete_3( 'tbb'         => $main::tbb,
  215-                            'board_id'    => $main::tbb->{'conf'}->{'board_id'},
  216-                            'tied_db_ref' => \%MessageList,
  217- );
  218- }
  219- 
  220- &Header( $text{'0212'}, $MessageHeaderFile, "refresh" );
  221- &Header2("refresh");
  222- print "<h3>$text{'0212'}</h3>\n";
  223- print $cust{'glob_header_e'} . "\n</div>\n";
  224- print "<div id='glob_msg'>\n";
  225- print "<p>$text{'0200'}</p>\n";
  226- print "</div>\n";
  227- &Footer( $MessageFooterFile, "return", "refresh" );
  228- } ## end sub Delete
  229- 
  230- sub Subscribe {
  231- &Header( $text{'4000'}, $MessageHeaderFile );
  232- &Header2;
  233- print "<h3>";
  234- print "$text{'4000'}</h3>\n";
  235- print $cust{'glob_header_e'} . "\n</div>\n";
  236- print "<div id='misc_subscribe'>\n", $cust{'misc_subscribe_s'};
  237- print "<p>$text{'4001'} ";
  238- if   ( $email_list == 1 ) { print "$text{'4002'} "; }
  239- else                      { print "$text{'4003'} "; }
  240- print "$text{'4004'}</p>\n";
  241- print "<FORM METHOD=POST ACTION='$DestinationURL$BBSquery";
  242- print 'md' . $QS2 . "addresslist'$BBStarget>\n";
  243- print "<p>$text{'4005'}: ";
  244- print "<INPUT TYPE='TEXT' NAME='email' SIZE='30'";
  245- 
  246- if ( $Cookies{'email'} ) {
  247- print " VALUE='$Cookies{'email'}'";
  248- }
  249- print "> <INPUT TYPE='SUBMIT' class='button' VALUE='$text{'4008'}'>";
  250- print "<br>\n<label><INPUT TYPE='RADIO' NAME='action' ";
  251- print "VALUE='add' CHECKED> $text{'4006'}</label> ";
  252- print "<label><INPUT TYPE='RADIO' NAME='action' ";
  253- print "VALUE='delete'> $text{'4007'}</label>";
  254- print "</p>\n</FORM>\n";
  255- print $cust{'misc_subscribe_e'}, "\n</div>\n";
  256- &Footer( $MessageFooterFile, "credits", 'nonavbar' );
  257- } ## end sub Subscribe
  258- 
  259- sub SetCookieData {
  260- &GetCookie($boardname);
  261- unless ( $FORM{'ListType'} ) {
  262- $FORM{'ListType'} = $Cookies{'listtype'};
  263- }
  264- unless ( $FORM{'ListTime'} ) {
  265- $FORM{'ListTime'} = $Cookies{'listtime'};
  266- }
  267- unless ( $FORM{'password'} ) {
  268- $FORM{'password'} = $Cookies{'password'};
  269- }
  270- if ( !$name )  { $name  = $Cookies{'name'}; }
  271- if ( !$email ) { $email = $Cookies{'email'}; }
  272- } ## end sub SetCookieData
  273- 
  274- sub Search {
  275- @sortedmessages = ( sort { $a <=> $b } keys %MessageList );
  276- 
  277- &Header( "$boardname - $text{'6000'}", $MessageHeaderFile );
  278- &Header2;
  279- if ( ($printboardname) || ( $tbb->{'pro'} ) ) {
  280- print "<h2>$boardname</h2>\n";
  281- }
  282- print "<h3>$text{'6001'}</h3>\n", $cust{'glob_header_e'}, "\n</div>\n", "<div id='misc_search'>\n", $cust{'misc_search_s'}, "<p>$text{'6002'}</p>\n", "<FORM METHOD='POST' ACTION='$DestinationURL$BBSquery", 'md' . $QS2 . "index'$BBStargetidx>\n", "<div>\n";
  283- if ( $FORM{'ListTime'} =~ /(\d+) ([\w\(\)]+)/ ) {
  284- $FORM{'ListTimeA'} = $1;
  285- $FORM{'ListTimeB'} = $2;
  286- }
  287- else {
  288- $FORM{'ListTimeA'} = 2;
  289- $FORM{'ListTimeB'} = "$text{'0062'}";
  290- }
  291- print "<p><span class='em'>$text{'6003'}:</span>";
  292- unless ($ArchiveOnly) {
  293- print "<br>\n<label><INPUT TYPE='RADIO' NAME='ListSize' ", "VALUE='Recent'> $text{'6004'}</label> \n", "<INPUT TYPE='TEXT' NAME='ListTimeA' SIZE='2' ", "VALUE=$FORM{'ListTimeA'}> \n", "<SELECT NAME='ListTimeB'><OPTION";
  294- if ( $FORM{'ListTimeB'} eq "$text{'0060'}" ) {
  295- print " SELECTED";
  296- }
  297- print ">$text{'0060'}<OPTION";
  298- if ( $FORM{'ListTimeB'} eq "$text{'0061'}" ) {
  299- print " SELECTED";
  300- }
  301- print ">$text{'0061'}<OPTION";
  302- if ( $FORM{'ListTimeB'} eq "$text{'0062'}" ) {
  303- print " SELECTED";
  304- }
  305- print ">$text{'0062'}<OPTION";
  306- if ( $FORM{'ListTimeB'} eq "$text{'0063'}" ) {
  307- print " SELECTED";
  308- }
  309- print ">$text{'0063'}<OPTION";
  310- if ( $FORM{'ListTimeB'} eq "$text{'0064'}" ) {
  311- print " SELECTED";
  312- }
  313- print ">$text{'0064'}</SELECT>", "<br>\n<label><INPUT TYPE='RADIO' NAME='ListSize' VALUE='Range' CHECKED>";
  314- }
  315- else {
  316- print "<br>\n<label><INPUT TYPE='HIDDEN' NAME='ListSize' VALUE='Range'>";
  317- }
  318- print " $text{'6005'}</label> \n";
  319- ( $mday, $mon, $year ) = ( localtime( int( $MessageList{ $sortedmessages[0] } ) + ( $HourOffset * 3600 ) ) )[ 3, 4, 5 ];
  320- print "<INPUT TYPE='TEXT' NAME='StartDateA' SIZE='2' VALUE='$mday'> \n", "<SELECT NAME='StartDateB'>\n";
  321- foreach $key ( 0 .. 11 ) {
  322- print "<OPTION VALUE='$key'";
  323- if ( $key == $mon ) { print " SELECTED"; }
  324- print ">$months[$key]\n";
  325- }
  326- print "</SELECT> \n", "<INPUT TYPE='TEXT' NAME='StartDateC' SIZE='4' VALUE='", $year + 1900, "'>", " $text{'6006'} ";
  327- ( $mday, $mon, $year ) = ( localtime( int( $MessageList{ $sortedmessages[ @sortedmessages - 1 ] } ) + ( $HourOffset * 3600 ) ) )[ 3, 4, 5 ];
  328- print "<INPUT TYPE='TEXT' NAME='EndDateA' SIZE='2' VALUE='$mday'> \n", "<SELECT NAME='EndDateB'>\n";
  329- foreach $key ( 0 .. 11 ) {
  330- print "<OPTION VALUE='$key'";
  331- if ( $key == $mon ) { print " SELECTED"; }
  332- print ">$months[$key]\n";
  333- }
  334- print "</SELECT> \n", "<INPUT TYPE='TEXT' NAME='EndDateC' SIZE='4' VALUE='", $year + 1900, "'></p>\n";
  335- print "<p><span class='small'>$text{'6007'}: ";
  336- ( $mday, $mon, $year ) = ( localtime( int( $MessageList{ $sortedmessages[0] } ) + ( $HourOffset * 3600 ) ) )[ 3, 4, 5 ];
  337- print "$mday $months[$mon] ", $year + 1900, "<br>\n$text{'6008'}: ";
  338- ( $mday, $mon, $year ) = ( localtime( int( $MessageList{ $sortedmessages[ @sortedmessages - 1 ] } ) + ( $HourOffset * 3600 ) ) )[ 3, 4, 5 ];
  339- print "$mday $months[$mon] ", $year + 1900;
  340- print "</span></p>\n", "<p><span class='em'>$text{'6009'}:</span><br>\n", "<label><INPUT TYPE='RADIO' NAME='KeySearch' ", "VALUE='All'> $text{'6010'}</label><br>\n", "<label><INPUT TYPE='RADIO' NAME='KeySearch' ", "VALUE='Yes' CHECKED> $text{'6011'}</label> \n", "<SELECT NAME='Boolean'><OPTION SELECTED>$text{'0050'}", "<OPTION>$text{'0051'}</SELECT> <label>$text{'6012'}:<br>\n", "<INPUT TYPE='TEXT' NAME='Keywords' SIZE='50' maxlength='$MaxSearchLength' VALUE='s'></label><br>\n",
  341-     "<label><INPUT TYPE='RADIO' NAME='KeySearch' ", "VALUE='Author'> $text{'6013'}</label> \n", "<INPUT TYPE='TEXT' NAME='Author' SIZE='25' maxlength='$MaxSearchLength'>";
  342- if ($AdminRun) {
  343- print "<br>\n<label><INPUT TYPE='RADIO' NAME='KeySearch' ", "VALUE='Domain'> $text{'6013'} $text{'6015'}:</label> \n", "<INPUT TYPE='TEXT' NAME='Domain' SIZE=10>";
  344- }
  345- print "</p>\n", "<p><INPUT TYPE='SUBMIT' class='button' VALUE='$text{'6014'}'></p>\n", "</div>\n</FORM>\n";
  346- print $cust{'misc_search_e'}, "\n</div>\n";
  347- &Footer( $MessageFooterFile, "credits", 'nonavbar' );
  348- } ## end sub Search
  349- 
  350- sub Reconfigure {
  351- &Header( "$boardname - $text{'6500'}", $MessageHeaderFile );
  352- &Header2;
  353- print "<h3>$text{'6501'}</h3>\n";
  354- print $cust{'glob_header_e'} . "\n</div>\n";
  355- print "<div id='misc_setpref'>\n", $cust{'misc_setpref_s'};
  356- print "<p>$text{'6502'} ";
  357- if   ($UseCookies) { print "$text{'6503'}"; }
  358- else               { print "$text{'6504'}"; }
  359- print "</p>\n";
  360- print "<FORM METHOD='POST' ACTION='$DestinationURL$BBSquery" . 'md' . $QS2 . 'index' . "'$BBStargettop>\n";
  361- print "<div id='d1'>\n";
  362- print "<INPUT TYPE='HIDDEN' NAME='KeySearch' ";
  363- print "VALUE='No'>\n";
  364- unless ($ArchiveOnly) {
  365- if ( $FORM{'ListTime'} =~ /(\d+) ([\w\(\)]+)/ ) {
  366- $FORM{'ListTimeA'} = $1;
  367- $FORM{'ListTimeB'} = $2;
  368- }
  369- else {
  370- $FORM{'ListTimeA'} = 2;
  371- $FORM{'ListTimeB'} = "$text{'0062'}";
  372- }
  373- if ($UseCookies) {
  374- print "<p>$text{'6505'}:";
  375- print "<br>\n<label><INPUT TYPE='RADIO' NAME='ListSize' VALUE='Recent'";
  376- unless ( $FORM{'ListTime'} eq "New Only" ) {
  377- print " CHECKED";
  378- }
  379- print "> $text{'6506'}</label> ";
  380- }
  381- else {
  382- print "<p>$text{'6507'} ";
  383- }
  384- print "<INPUT TYPE='TEXT' NAME='ListTimeA' SIZE='2' ";
  385- print "VALUE='$FORM{'ListTimeA'}'> ";
  386- print "<SELECT NAME='ListTimeB'><OPTION";
  387- if ( $FORM{'ListTimeB'} eq "$text{'0060'}" ) {
  388- print " SELECTED";
  389- }
  390- print ">$text{'0060'}<OPTION";
  391- if ( $FORM{'ListTimeB'} eq "$text{'0061'}" ) {
  392- print " SELECTED";
  393- }
  394- print ">$text{'0061'}<OPTION";
  395- if ( $FORM{'ListTimeB'} eq "$text{'0062'}" ) {
  396- print " SELECTED";
  397- }
  398- print ">$text{'0062'}<OPTION";
  399- if ( $FORM{'ListTimeB'} eq "$text{'0063'}" ) {
  400- print " SELECTED";
  401- }
  402- print ">$text{'0063'}<OPTION";
  403- if ( $FORM{'ListTimeB'} eq "$text{'0064'}" ) {
  404- print " SELECTED";
  405- }
  406- print ">$text{'0064'}</SELECT>";
  407- if ($UseCookies) {
  408- print "<br>\n<label><INPUT TYPE='RADIO' NAME=ListSize VALUE=New";
  409- if ( $FORM{'ListTime'} eq "New Only" ) {
  410- print " CHECKED";
  411- }
  412- print "> $text{'6508'}</label>";
  413- }
  414- print "</p>\n";
  415- }
  416- print "<p>$text{'6509'}: <SELECT NAME='ListType'>";
  417- print "<OPTION VALUE='Chronologically'";
  418- if (    ( ( $FORM{'ListType'} =~ /Chronologically/ ) || ( $FORM{'ListType'} =~ /Guestbook/ ) )
  419-      && ( $FORM{'ListType'} !~ /Threaded/ )
  420-      && ( $FORM{'ListType'} !~ /Compressed/ ) )
  421- {
  422- print " SELECTED";
  423- }
  424- print ">$text{'6601'}";
  425- print "<OPTION VALUE='Alphabetically'";
  426- if ( $FORM{'ListType'} =~ /Alphabetically/ ) {
  427- print " SELECTED";
  428- }
  429- print ">$text{'6603'}";
  430- print "<OPTION VALUE='By Threads'";
  431- if ( $FORM{'ListType'} =~ /Thread/ ) {
  432- print " SELECTED";
  433- }
  434- print ">$text{'6602'}";
  435- unless ($AdminRun) {
  436- print "<OPTION VALUE='Compressed'";
  437- if ( $FORM{'ListType'} =~ /Compressed/ ) {
  438- print " SELECTED";
  439- }
  440- print ">$text{'6609'}";
  441- print "</SELECT>\n";
  442- print "<a href='#$text{'6509'}' title='$text{'6900'}'>?</a>";
  443- print "<br>\n$text{'6510'}: ";
  444- print "<SELECT NAME='ListDisplay'>";
  445- print "<OPTION VALUE='Single'";
  446- unless ( $FORM{'ListType'} =~ /Guestbook/ ) {
  447- print " SELECTED";
  448- }
  449- print ">$text{'6607'}<OPTION VALUE='Guestbook'";
  450- if ( $FORM{'ListType'} =~ /Guestbook/ ) {
  451- print " SELECTED";
  452- }
  453- print ">$text{'6608'}";
  454- }
  455- print "</SELECT>\n";
  456- print "<a href='#$text{'6510'}' title='$text{'6900'}'>?</a>";
  457- print "<br>\n$text{'6511'}: ";
  458- print "<SELECT NAME='ListSort'><OPTION";
  459- print " VALUE='Standard'";
  460- if (    ( $FORM{'ListType'} !~ /Reversed/ )
  461-      && ( $FORM{'ListType'} !~ /Mixed/ )
  462-      && ( $FORM{'ListType'} !~ /UBB/ ) )
  463- {
  464- print " SELECTED";
  465- }
  466- print ">$text{'6610'}<OPTION VALUE='Reversed'";
  467- if ( $FORM{'ListType'} =~ /Reversed/ ) {
  468- print " SELECTED";
  469- }
  470- print ">$text{'6611'}<OPTION VALUE='Mixed'";
  471- if ( $FORM{'ListType'} =~ /Mixed/ ) {
  472- print " SELECTED";
  473- }
  474- print ">$text{'6612'}<OPTION VALUE='UBB'";
  475- if ( $FORM{'ListType'} =~ /UBB/ ) {
  476- print " SELECTED";
  477- }
  478- print ">$text{'6613'}";
  479- print "</SELECT>\n";
  480- print "<a href='#$text{'6511'}' title='$text{'6900'}'>?</a></p>\n";
  481- print "</div>\n";
  482- if ($UseCookies) {
  483- print "<div id='d3'>\n";
  484- print "<table $tablespec><tr>\n";
  485- print "<th colspan='2'>$text{'6700'}";
  486- print "</th></tr><tr>\n";
  487- print "<td align='right'>";
  488- print "$text{'1510'}</td>";
  489- print "<td>";
  490- 
  491- if ( !($AdminRun) && $LockRemoteUser && $ENV{'REMOTE_USER'} ) {
  492- print "<INPUT TYPE='HIDDEN' NAME='name' ";
  493- print " VALUE='$ENV{'REMOTE_USER'}'>";
  494- print "<span class='strong'>$ENV{'REMOTE_USER'}</span>";
  495- }
  496- else {
  497- print "<INPUT TYPE='TEXT' NAME='name' ";
  498- print "SIZE=$InputLength MAXLENGTH=$MaxInputLength";
  499- if ( $Cookies{'name'} ) {
  500- print " VALUE='$Cookies{'name'}'";
  501- }
  502- print ">";
  503- }
  504- print "</td></tr><tr>\n";
  505- print "<td align='right'>";
  506- print "$text{'1511'}";
  507- print "</td><td>";
  508- if ( !($AdminRun) && $email && $RequireEmail && $RequireProfile ) {
  509- if ( $DisplayEmail && !($BlindEmail) ) {
  510- print "<span class='strong'>$email</span>";
  511- }
  512- else { print "<span class='strong'>Private!</span>"; }
  513- }
  514- else {
  515- print "<INPUT TYPE='TEXT' NAME='email' ";
  516- print "SIZE=$InputLength MAXLENGTH=100";
  517- if ( $Cookies{'email'} ) {
  518- print " VALUE='$Cookies{'email'}'";
  519- }
  520- print ">";
  521- }
  522- print "</td>\n";
  523- if ($SaveLinkInfo) {
  524- if ($AllowURLs) {
  525- print "</tr><tr><td align='right'>";
  526- print "$text{'1515'}</td>";
  527- print "<td><INPUT TYPE='TEXT' ";
  528- print "NAME='url' SIZE=$InputLength MAXLENGTH=250";
  529- if ( $Cookies{'linkurl'} ) {
  530- print " VALUE='$Cookies{'linkurl'}'";
  531- }
  532- else {
  533- print " VALUE='http://'";
  534- }
  535- print "></td></tr><tr>\n";
  536- print "<td align='right'>";
  537- print "$text{'1516'}</td>";
  538- print "<td><INPUT TYPE='TEXT' ";
  539- print "NAME='url_title' SIZE=$InputLength MAXLENGTH=$MaxInputLength";
  540- if ( $Cookies{'linkname'} ) {
  541- print " VALUE='$Cookies{'linkname'}'";
  542- }
  543- print "></td>\n";
  544- }
  545- if ($AllowPics) {
  546- print "</tr><tr><td align='right'>";
  547- print "$text{'1517'}</td>";
  548- print "<td><INPUT TYPE='TEXT' ";
  549- print "NAME='imageurl' SIZE=$InputLength MAXLENGTH=250";
  550- if ( $Cookies{'imageurl'} ) {
  551- print " VALUE='$Cookies{'imageurl'}'";
  552- }
  553- else {
  554- print " VALUE='http://'";
  555- }
  556- print "></td>\n";
  557- }
  558- }
  559- if ( $AllowUserDeletion || $AllowUserEditHours || $AllowProfiles ) {
  560- print "</tr><tr><td align='right'>";
  561- print "$text{'0205'}</td>";
  562- print "<td><INPUT TYPE='PASSWORD' NAME='password'";
  563- if ( $FORM{'password'} ) {
  564- print " VALUE='$FORM{'password'}'";
  565- }
  566- print " SIZE=$InputLength></td></tr><tr>\n";
  567- print "<td align='right'>";
  568- print "$text{'6720'}</td>";
  569- print "<td>";
  570- print "<label><INPUT TYPE='RADIO' NAME='CookiePW' ";
  571- print "VALUE='Yes'";
  572- if ( $FORM{'password'} ) { print " CHECKED"; }
  573- print "> $text{'1519'}</label> ";
  574- print "<label><INPUT TYPE='RADIO' NAME='CookiePW' ";
  575- print "VALUE='No'";
  576- unless ( $FORM{'password'} ) { print " CHECKED"; }
  577- print "> $text{'1520'}</label>";
  578- print "</td>\n";
  579- }
  580- print "</tr></table>\n";
  581- print "</div>\n";
  582- }
  583- print "<div id='d4'>\n";
  584- print "<INPUT TYPE='SUBMIT' class='button' NAME='ResetConfig' ";
  585- print "VALUE='$text{'5001'}'></div>\n</FORM>\n";
  586- print "<div id='d5'>\n$text{'5000'}</div>\n";
  587- print $cust{'misc_setpref_e'}, "</div>\n";
  588- &Footer( $MessageFooterFile, "credits", 'nonavbar' );
  589- } ## end sub Reconfigure
  590- 
  591- sub UpdateAddressList {
  592- unless ($email) {
  593- &Error( "9300", "9301" );
  594- }
  595- unless ( -w "$dir" ) { &Error( "9410", "9411" ); }
  596- &LockOpen( LIST, "$dir/addresses.txt" );
  597- @list      = <LIST>;
  598- $listcheck = 0;
  599- seek( LIST, 0, 0 );
  600- foreach $address (@list) {
  601- if ( $address =~ /$email/i ) {
  602- if ( $FORM{'action'} eq "delete" ) {
  603- &Error( "9850", "9851" );
  604- $listcheck = 1;
  605- }
  606- else {
  607- &Error( "9700", "9701" );
  608- print LIST "$address";
  609- $listcheck = 1;
  610- }
  611- }
  612- else {
  613- print LIST "$address";
  614- }
  615- }
  616- undef @list;
  617- if ( $listcheck < 1 ) {
  618- if ( $FORM{'action'} eq "delete" ) {
  619- &Error( "9750", "9751" );
  620- }
  621- else {
  622- &Error( "9800", "9801" );
  623- print LIST "$email\n";
  624- }
  625- }
  626- truncate( LIST, tell(LIST) );
  627- &LockClose( LIST, "$dir/addresses.txt" );
  628- &Footer( $MessageFooterFile, "return", 'nonavbar' );
  629- } ## end sub UpdateAddressList
  630- 
  631- sub UserEditForm {
  632- my $PassCheck = 0;
  633- my $msg_num   = int( $FORM{'msgnum'} );
  634- my $msg_file  = $dir . "/bbs" . int( $msg_num / 1000 ) . "/$msg_num";
  635- if ( !-s $msg_file ) {
  636- &Error( "9100", "9101" );
  637- }
  638- $msg_content = $read5x->read_message($msg_file);
  639- 
  640- my $time_now = time();
  641- my $edit_allowed = ( $msg_content->{'date'} + ( $AllowUserEditHours * 3600 ) ) - $time_now;
  642- if ( $edit_allowed <= 0 ) {
  643- &Error( "9522", "" );
  644- }
  645- 
  646- $PassCheck = $read5x->check_message_password( 'oldpassword' => $msg_content->{'oldpassword'},
  647-                                               'password'    => $FORM{'newpassword'}, );
  648- if (    ( !$PassCheck )
  649-      && ( $msg_content->{'poster_name'} eq $Cookies{'name'} ) )
  650- {
  651- $PassCheck = $read5x->check_profile_password( 'password'   => $FORM{'newpassword'},
  652-                                               'username'   => $msg_content->{'poster_name'},
  653-                                               'profiledir' => $data_basedir . '/_profiles',
  654- );
  655- }
  656- if ( !$PassCheck ) {
  657- &Error( "9600", "9601" );
  658- }
  659- 
  660- if ($PRO::VERSION) {
  661- &PRO::cb_message_form_1_useredit( 'tbb' => $main::tbb, );
  662- }
  663- 
  664- if (%SmileyCode) {
  665- foreach $key ( keys %SmileyCode ) {
  666- $key2 = $SmileyCode{$key};
  667- $key2                     =~ s/([\[\]\(\)\\\*\+\?\\\|])/\\$1/g;
  668- $msg_content->{'text'}    =~ s/$key2/$key/g;
  669- $msg_content->{'subject'} =~ s/$key2/$key/g;
  670- }
  671- }
  672- 
  673- my @pres = ();
  674- while ( $msg_content->{'text'} =~ m/<pre>(.+?)<\/pre>/sig ) {
  675- push( @pres, $1 );
  676- }
  677- for (@pres) {
  678- my $code    = $_;
  679- my $newcode = $code;
  680- $newcode =~ s/\n/<FeEd>/sig;
  681- $_ = $newcode;
  682- $msg_content->{'text'} =~ s/\Q$code\E/$newcode/sg;
  683- }
  684- 
  685- $msg_content->{'text'} =~ s/\n//g;
  686- 
  687- for (@pres) {
  688- my $code    = $_;
  689- my $newcode = $code;
  690- $newcode               =~ s/<FeEd>/\n/sg;
  691- $msg_content->{'text'} =~ s/\Q$code\E/\n$newcode\n/sg;
  692- }
  693- $msg_content->{'text'} =~ s/<pre>/\n<PRE>/sig;
  694- 
  695- if (%FormatCode) {
  696- require 'webbbs_share.pl';
  697- $msg_content->{'text'} = decode_BB_code( $msg_content->{'text'}, \%FormatCode );
  698- }
  699- if ($AutoHotlink) {
  700- $msg_content->{'text'} =~ s/<\/?a.*?>//gi;
  701- }
  702- 
  703- $msg_content->{'text'} =~ s/<P>/\n\n/g;
  704- $msg_content->{'text'} =~ s/<BR>/\n/g;
  705- $msg_content->{'text'} =~ s/^\n*//g;
  706- $msg_content->{'text'} =~ s/\n*$//g;
  707- $msg_content->{'text'} =~ s/\& /\&\; /g;
  708- $msg_content->{'text'} =~ s/"/\"\;/g;
  709- $msg_content->{'text'} =~ s/</\<\;/g;
  710- $msg_content->{'text'} =~ s/>/\>\;/g;
  711- if ($NM_Telltale) {
  712- $msg_content->{'subject'} =~ s/ $Cleaned_NM_Telltale//g;
  713- }
  714- if ($Link_Telltale) {
  715- $msg_content->{'subject'} =~ s/ $Cleaned_Link_Telltale//g;
  716- }
  717- if ($Pic_Telltale) {
  718- $msg_content->{'subject'} =~ s/ $Cleaned_Pic_Telltale//g;
  719- }
  720- $msg_content->{'subject'} =~ s/"/\"\;/g;
  721- $messagenumber = 0;
  722- $UserEditRun   = 1;
  723- $edit_msg      = $msg_num;
  724- require 'webbbs_form.pl';
  725- &PostForm;
  726- } ## end sub UserEditForm
  727- 
  728- 1;