sub deletepost { $filetoopen = "$ikondir" . "forum$inforum/$intopic.thd"; open(FILE, "$filetoopen"); @allthreads = <FILE>; close(FILE); $posttodelete = $inpostno; $posttodelete--; $postcountcheck = 0; $totalposts = @allthreads; &getmember("$inmembername"); &moderator; $cleartoedit = "no"; if ($membername eq "$ibtxt{'0043'}") { &error("Редактирование сообщения&Гостю запрещено редактировать сообщения"); } if (($membercode eq "ad") && ($inpassword eq $password)) { $cleartoedit = "yes"; } if (($inmembmod eq "yes") && ($inpassword eq $password)) { $cleartoedit = "yes"; } unless ($cleartoedit eq "yes") { $cleartoedit = "no"; } if ($cleartoedit eq "no" && $checked eq "yes") { &error("$ibtxt{'1529'}&$ibtxt{'0504'}"); } if ($cleartoedit eq "yes") { if ($posttodelete == 0) { &error("$ibtxt{'1530'}&$ibtxt{'1531'}"); } ### First off, lets delete the post in the thread. foreach $postline (@allthreads) { chomp $postline; unless ($postcountcheck eq $posttodelete) { $processed_data .= "$postline\n"; } $postcountcheck++; } $filetoopen = "$ikondir" . "forum$inforum/$intopic.thd"; open(FILE, ">$filetoopen"); flock(FILE, 2); print FILE $processed_data; close(FILE); undef $processed_data; $filetoopen = "$ikondir" . "forum$inforum/$intopic.thd"; open(FILE, "$filetoopen"); @allthreads = <FILE>; close(FILE); $totalposts = @allthreads; $posttograb = $totalposts; $posttograb--; ($postermembername2, $topictitle2, $postipaddress2, $showemoticons2, $showsignature2 ,$postdate2, $post2) = split(/\|/, @allthreads[$posttograb]); ### Now we have to adjust the post counts. $filetoopen = "$ikondir" . "forum$inforum/list.cgi"; open(FILE, $filetoopen); flock FILE, 1; @alltopics = <FILE>; close(FILE); $count = "0"; foreach $line (@alltopics) { #start foreach @threads ($tempno, $trash) = split(/\|/, $line); if ($intopic eq $tempno) { $linetokeep = $line; $keepcounter = $count; } $count++; } # end foreach ($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate, $sticky) = split(/\|/,$linetokeep); $threadposts = $totalposts - 1; foreach $newline (@alltopics) { #start foreach @threads chomp($newline); ($tempno, $trash) = split(/\|/,$newline); if ($intopic eq $tempno) { chomp($sticky); $processed_data .= "$topicid|$topictitle|$topicdescription|$threadstate|$threadposts|$threadviews|$startedby|$startedpostdate|$postermembername2|$postdate2|$sticky\n"; } else { $processed_data .= "$newline\n"; } } if (($processed_data eq "") || ($processed_data !~ m!\|!)) { &error("Missing Data&Data as corrupted on the server. Please go back and try again"); } $filetomake = "$ikondir" . "forum$inforum/list.cgi"; open(FILE, ">$filetomake"); flock(FILE, 2); print FILE $processed_data; close(FILE); undef $processed_data; ### Get the new last forum poster, and post date. $filetoopen = "$ikondir" . "forum$inforum/list.cgi"; open(FILE, "$filetoopen"); flock FILE, 1; @alltopics = <FILE>; close(FILE); $linetokeep = @alltopics[0]; chomp $linetokeep; ($trash, $trash, $trash, $trash, $trash, $trash, $trash, $trash, $lastforumposter, $lastforumpostdate) = split(/\|/,$linetokeep); chomp $forumlastposter; chomp $forumlastpostdate; ### Adjust the variables in the Forums Summary Page. $filetoopen = "$ikondir" . "data/allforums.cgi"; open(FILE, "$filetoopen"); flock FILE, 1; @allforums = <FILE>; close(FILE); foreach $forum (@allforums) { #start foreach @forums chomp($forum); ($tempno, $trash) = split(/\|/,$forum); if ($inforum eq $tempno) { ($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic) = split(/\|/,$forum); $posts--; $processed_data .= "$forumid|$category|$categoryplace|$forumname|$forumdescription|$forummoderator|$htmlstate|$idmbcodestate|$privateforum|$startnewthreads|$lastforumposter|$lastforumpostdate|$threads|$posts|$forumgraphic\n"; } else { $processed_data .= "$forum\n"; } } if (($processed_data eq "") || ($processed_data !~ m!\|!)) { &error("Missing Data&Data as corrupted on the server. Please go back and try again"); } $filetomake = "$ikondir" . "data/allforums.cgi"; open(FILE, ">$filetomake"); flock(FILE, 2); print FILE $processed_data; close(FILE); undef $processed_data; require "$ikondir" . "data/boardstats.cgi"; $filetomake = "$ikondir" . "data/boardstats.cgi"; $totalposts--; open(FILE, ">$filetomake"); flock(FILE, 2); print FILE "\$lastregisteredmember = \"$lastregisteredmember\"\;\n"; print FILE "\$totalmembers = \"$totalmembers\"\;\n"; print FILE "\$totalthreads = \"$totalthreads\"\;\n"; print FILE "\$totalposts = \"$totalposts\"\;\n"; print FILE "\n1\;"; close (FILE); &mischeader("$ibtxt{'1512'}"); my $nfp = ((int(($postno-1) / $maxthreads))* $maxthreads); $relocurl = "$threadprog?forum=$inforum&topic=$intopic&start=$nfp"; $output .= qq~ <table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center> <tr> <td> <table cellpadding=6 cellspacing=1 border=0 width=100%> <tr> <td bgcolor=$miscbacktwo valign=middle align=center><font face="$font" color=$fontcolormisc size=2><b>$ibtxt{'1541'}</b></font></td></tr> <tr> <td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc size=1> $ibtxt{'1004'}: <ul> <li><a href="$threadprog?forum=$inforum&topic=$intopic">$ibtxt{'1532'}</a> <li><a href="$forumsprog?forum=$inforum">$ibtxt{'0509'}</a> <li><a href="$forumsummaryprog">$ibtxt{'0323'}</a> </ul> </tr> </td> </table></td></tr></table> <meta http-equiv="refresh" content="3; url=$relocurl"> ~; } # end if clear to edit else { &error("$ibtxt{'1530'}&$ibtxt{'1533'}"); } } # end subdelete |