############################################################################## # Name: Hit Hack 1.07e for UBB 6.30 # # Count the click's for the thread # # von: Easy # # Date: 03-29-2001 # # History : 1.04 if the thread is deletet, the counter xxxxx.hit would # # be deletet too. # # 1.05 the cache page-forum is cleared if the counter increment# # 1.06 delete about the cp the file xxxxx.hit would be deleted # # too # # 1.07 doublecounting by reply # # # # if you see any error's mailto webmaster@sternenfahrervoncatan.de # ############################################################################## ################# # Start Hacking # ################# ######################### #ubb_get_topic.cgi open # ######################### ######### #find : # ######### # is the page available? ################### #BELOW that ADD:: # ################### $userlastaddr = &OpenFileAsString("$vars_config{NonCGIPath}/$exact_path/$_[1].wer"); if ($userlastaddr ne $ENV{'REMOTE_ADDR'}) { &WriteFileAsString("$vars_config{NonCGIPath}/$exact_path/$_[1].hit", &OpenFileAsString("$vars_config{NonCGIPath}/$exact_path/$_[1].hit") + 1); } else { &Unlink("$vars_config{NonCGIPath}/$exact_path/$_[1].wer"); } ##################### #ubb_forum.cgi open # ##################### ######### #find : # ######### &ServeFromCache("ubb_files/forum_page/$exact_path/forum$in{f}-$user_topic_view$extension.cgi"); ################### # Replace with: # ################### &WriteFileAsString("$vars_config{NonCGIPath}/$exact_path/0.hit", &OpenFileAsString("$vars_config{NonCGIPath}/$exact_path/0.hit") + 1); #&ServeFromCache("ubb_files/forum_page/$exact_path/forum$in{f}-$user_topic_view$extension.cgi"); my $filename = "$vars_config{NonCGIPath}/cache-$cache_cookie/ubb_files/forum_page/$exact_path/forum$in{f}-$user_topic_view$extension.cgi"; if ( (-e $filename) && (-s $filename) && ($in{start_point} eq '') && ($vars_misc{use_cache} ne "no") ) { # print file $_ = &OpenFileAsString($filename); $_ = &ProcessVIEWS($_); print; exit(0); } else { &ServeFromCache("ubb_files/forum_page/$exact_path/forum$in{f}-$user_topic_view$extension.cgi"); } ######### #find : # ######### print &FilterPNTF($ThisHTML); ################### #ABOVE that ADD:: # ################### $ThisHTML = &ProcessVIEWS($ThisHTML); ########################### #ubb_topic_maint.cgi open # ########################### ######### #find : # ######### # delete topic file &Unlink("$vars_config{NonCGIPath}/$exact_path/$in{t}.cgi"); ################### #BELOW that ADD:: # ################### &Unlink("$vars_config{NonCGIPath}/$exact_path/$in{t}.hit"); #################### #cp_prune.cgi open # #################### ######################### #find : !prune by Date # ######################### # delete topic file &Unlink("$vars_config{NonCGIPath}/$exact_path/$_.cgi"); ################### #BELOW that ADD:: # ################### &Unlink("$vars_config{NonCGIPath}/$exact_path/$_.hit"); ############################## #search again !prune by user!# ############################## #if this is the first post, blow away the thread &Unlink("$vars_config{NonCGIPath}/$exact_path/$thread.cgi") or die "$! deleting $thread!"; ################### #BELOW that ADD:: # ################### &Unlink("$vars_config{NonCGIPath}/$exact_path/$thread.hit"); ######################### #ubb_new_reply.cgi open # ######################### ######## #find :# ######## # no problem, so proceed ################### #BELOW that ADD:: # ################### &WriteFileAsString("$vars_config{NonCGIPath}/$exact_path/$in{t}.wer", $ENV{'REMOTE_ADDR'}); #################################### #open file ubb_forum_summary.cgi # #################################### ######## # find # ######## &ServeFromCache("ubb_files/summary/summary.html"); ################### #Replace with # ################### #&ServeFromCache("ubb_files/summary/summary.html"); my $filename = "$vars_config{NonCGIPath}/cache-$cache_cookie/ubb_files/summary/summary.html"; if ((-e $filename) && (-s $filename) && ($vars_misc{use_cache} ne "no")) { my $file = &OpenFileAsString($filename); $file = &ProcessVIEWS($file); print &FilterPNTF($file); exit(0); } else { &ServeFromCache("ubb_files/summary/summary.html"); } #endif ######## # find # ######## &ServeFromCache("ubb_files/summary/summary-$in{category}.html"); ################### #Replace with # ################### #&ServeFromCache("ubb_files/summary/summary-$in{category}.html"); my $filename = "$vars_config{NonCGIPath}/cache-$cache_cookie/ubb_files/summary/summary-$in{category}.html"; if ((-e $filename) && (-s $filename) && ($vars_misc{use_cache} ne "no")) { my $file = &OpenFileAsString($filename); $file = &ProcessVIEWS($file); print &FilterPNTF($file); exit(0); } else { &ServeFromCache("ubb_files/summary/summary-$in{category}.html"); } #endif ######## # find # ######## print &FilterPNTF($ThisHTML); ################### #ABOVE that ADD:: # ################### $ThisHTML = &ProcessVIEWS($ThisHTML); ######################### # open file ubb_lib.cgi # ######################### ######## # find # ######## # do not remove: 1; ################### #ABOVE that ADD:: # ################### sub ProcessVIEWS { foreach my $line(split(/\r?\n/, $_[0])) { if ($line =~ /<\?PHP echo Hits\(\'([0-9]+)\'\, \'([0-9]+)?\'\) \?\>/) { my $f = $1; my $t = $2; my $v_counter; @this_forum = &GetForumRecord($f); $exact_path = "Forum$f"; if ($this_forum[6] =~ m/private/) { $exact_path .= "/private-$this_forum[7]"; } $v_counter = &FileExists("$vars_config{NonCGIPath}/$exact_path/$t.hit") ? &OpenFileAsVar("$vars_config{NonCGIPath}/$exact_path/$t.hit") : "0"; $_[0] =~ s/\<\?PHP echo Hits\(\'$f\'\, \'$t\'\) \?\>/$v_counter/; } } return $_[0] } ######## # find # ######## } elsif($func eq "Forum") { #################### # BELOW that ADD:: # #################### $colspans++; ########################### #open file ubb_search.cgi # ########################### ######## # find # ######## $ThisHTML = &OpenFileAsVar("$vars_config{NonCGIPath}/cache-$cache_cookie/ubb_files/misc/ubb_daily_topics.cgi"); ################### #BELOW that ADD:: # ################### $ThisHTML = &ProcessVIEWS($ThisHTML); ######## # find # ######## # get bottom of page from public_common.pl $ThisHTML .= $Footer; print "$ThisHTML"; ################ # replace with # ################ # get bottom of page from public_common.pl $ThisHTML .= $Footer; # print "$ThisHTML"; ######## # find # ######## exit(0); } # end get_daily sr #################### # ABOVE that ADD:: # #################### $ThisHTML = &ProcessVIEWS($ThisHTML); print $ThisHTML; ############################## #vars_wordlets_mods.cgi open # ############################## ######### #find : # ######### %vars_wordlets_mods = ( ################### #BELOW that ADD:: # ################### 'count_on_click' => 'Hits', 'count_on_click_lowercase' => 'hits', ############################ #public_forum_page.pl open # ############################ ######### #find : # ######### $vars_wordlets{total_replies_header} ################### #BELOW that ADD:: # ################### $vars_wordlets_mods{count_on_click} ######### #find : # ######### $total_replies ~; ################### #BELOW that ADD:: # ################### if ($alt_color eq "$vars_style{AltColumnColor1}") { $alt_color = "$vars_style{AltColumnColor2}"; } else { $alt_color = "$vars_style{AltColumnColor1}"; } $this_html .= qq~ ~; #################################### #open file public_daily_topics.pl # #################################### ######## # find # ######## $the_body .= qq~ $forum_name $stat_file[4] $vars_wordlets{by} $last_post[10]     ($vars_wordlets{post} \# $post_number)
$last_post[6]
~; } # if topic exists } ################ # replace with # ################ $the_body .= qq~ $forum_name $stat_file[4] $vars_wordlets{by} $last_post[10]     ($vars_wordlets{post} \# $post_number)     ( $vars_wordlets_mods{count_on_click_lowercase})
$last_post[6]
~; } # if topic exists } #################################### #open file public_forum_summary.pl # #################################### ######## # find # ######## $LatestTime ################ # replace with # ################ $LatestTime ( $vars_wordlets_mods{count_on_click_lowercase}) ######## # find # ######## $ForumDesc ################ # replace with # ################ $ForumDesc ( $vars_wordlets_mods{count_on_click_lowercase}) ############################ # open file ultimatebb.php # ############################ ######################### # find (FIRST from top) # ######################### if (!$privateforums && preg_match("/Admin/i", $profile[4])) { $privateforum = getprivate($f); if ($privateforum) { $privatepath = "/private-$privateforum"; } // end if } // end if ################### #BELOW that ADD:: # ################### if (file_exists ("$NonCGIPath/Forum$f$privatepath/$t.hit")) { $count = file("$NonCGIPath/Forum$f$privatepath/$t.hit"); } $count[0]++; $number = fopen("$NonCGIPath/Forum$f$privatepath/$t.hit", "w"); flock($number, 2); fwrite($number, $count[0]); flock($number, 3); fclose($number); chmod("$NonCGIPath/Forum$f$privatepath/$t.hit", 0777); ######## # find # ######## if (!$hardset && !$userid && !$DaysPrune) $DaysPrune = $DaysPruneDefault; if ($start_point > 0) $start = "_$start_point"; ################### #BELOW that ADD:: # ################### if (file_exists ("$NonCGIPath/Forum$f$privatepath/0.hit")) { $count = file("$NonCGIPath/Forum$f$privatepath/0.hit"); } $count[0]++; $number = fopen("$NonCGIPath/Forum$f$privatepath/0.hit", "w"); flock($number, 2); fwrite($number, $count[0]); flock($number, 3); fclose($number); chmod("$NonCGIPath/Forum$f$privatepath/0.hit", 0777); ######## # find # ######## // ============================================================================ function pntf_append () { ################### #ABOVE that ADD:: # ################### // ============================================================================ function Hits($forum, $topic) { global $NonCGIPath; global $VariablesPath; if (file_exists ("$VariablesPath/vars_forums.cgi")) { $number = fopen("$VariablesPath/vars_forums.cgi", "r"); $string = split("\n", fread($number, filesize("$VariablesPath/vars_forums.cgi"))); fclose($number); $forumsfile = preg_grep("|^|", $string); while($blah = each($forumsfile)) { $check = split ('\|\^\|', $blah[1]); if ($check[8] == $forum) { $got_it = split ('\|\^\|', $blah[1]); } } } $exact_path = "Forum$forum"; $privateforum = getprivate($forum); if ($privateforum) { $exact_path .= "/private-$privateforum"; } if (file_exists ("$NonCGIPath/$exact_path/$topic.hit")) { $string = file("$NonCGIPath/$exact_path/$topic.hit"); return $string[0]; } else { return 0; } } ############## #that's all # ##############