********************************************************************************* * MOD NAME: Hit Hack * ********************************************************************************* * DESCRIPTION: Shows hits in forum summary/page * * DEMO: http://www.lkworld.com * * * ********************************************************************************* * CREATED BY: LK * * ORIGINALLY BY: e@sy * * DATE: 12/01/03 * * VERSION: version 6.6 * * CREDITS: qasic (PHP) and cal (JavaScript), * * Allen, hanjo & Weird Al (updates) * * * ********************************************************************************* ********************************************************************************* * REQUIREMENTS: Full License, Mod Wordlets * * COMPATABILITY: works with v6.6x * ********************************************************************************* * FILES ADDED: ubb_hits.cgi * * FILES MODIFIED: ubb_get_topic.cgi, ubb_forum.cgi, ubb_forum_summary.cgi, * * vars_wordlets_mods.cgi, ultimatebb.php, public_forum_page.pl, * * public_forum_summary.pl, ubb_topic_maint.cgi, cp2_content.cgi,* * ubb_edit_post.cgi, ubb_lib.cgi * ********************************************************************************* * DISCLAIMER: By using this modification, the user implicitly agrees * * that they are willingly modifying any and all files at * * their own risk. Should any errors occur either as a * * direct or indirect result of said modifications the user * * agrees not to hold Infopop Corporation or any of the * individuals listed accountable. * * * * * * IN OTHER WORDS: PLEASE MAKE BACKUP COPIES OF EVERY FILE YOU PLAN TO * * MODIFY PRIOR TO MODIFICATION!! * * * * * * FOR MORE TIPS AND TRICKS FOR USE WITH THE ULTIMATE BULLETIN BOARD * * PLEASE VISIT US AT: * * * * http://www.ubbdev.com/ * * * ********************************************************************************* ********************************************************************************* ###################################################### ######################## NOTE ######################## ###################################################### # Do not upload hitsave.cgi file to your cgi-bin # # directory unless you used Hit Hack v1.07e. Method: # # http://www.url.com/cgi-bin/hitsave.cgi?f=FORUM_NUM # # After using it on every forum, DELETE that file. # ###################################################### ************************** * Open ubb_get_topic.cgi * ************************** Find: (~50) ===== my $fn = "$thiscachefile.cgi"; Add below: ========== &RequireVars("$vars_config{NonCGIPath}/$exact_path/hits.cgi"); $hits{$in{t}} ++; &WriteHashToFile("$vars_config{NonCGIPath}/$exact_path/hits.cgi", "hits", \%hits); ********************** * Open ubb_forum.cgi * ********************** Find: (~145) ===== if(($in{start_point}) && ($in{start_point} =~ m/^\d{1,}$/)) { $extension = "_$in{start_point}"; } Add below: ========== if (&FileExists("$vars_config{NonCGIPath}/$exact_path/hits.cgi")) { &RequireVars("$vars_config{NonCGIPath}/$exact_path/hits.cgi"); } $hits{forum} ++; &WriteHashToFile("$vars_config{NonCGIPath}/$exact_path/hits.cgi", "hits", \%hits); Find: (~546) ===== $ThisHTML .= &topic_row; } Replace with: ========== $ThisHTML .= &topic_row; $topicnums .= "$one|"; } ****************************** * Open ubb_forum_summary.cgi * ****************************** Find: (~208) ===== } # end if categoryview eq yes Add below: ========== $forumnums .= "$x|"; Find: (~230) ===== $msg_icon = $data[5]; $last_post_number = $data[6]; Add below: ========== $topicnums .= "$last_post_number|"; **************************** * Open ubb_topic_maint.cgi * **************************** Find: (~79) ===== # delete topic file &Unlink("$vars_config{NonCGIPath}/$exact_path/$in{t}.cgi"); Add below: ========== if (&FileExists("$vars_config{NonCGIPath}/$exact_path/hits.cgi")) { &RequireVars("$vars_config{NonCGIPath}/$exact_path/hits.cgi"); delete($hits{$in{t}}); &WriteHashToFile("$vars_config{NonCGIPath}/$exact_path/hits.cgi", "hits", \%hits); } Find: (~327) ===== # delete old topic &Unlink("$vars_config{NonCGIPath}/$exact_path/$in{t}.cgi"); Add below: ========== if (&FileExists("$vars_config{NonCGIPath}/$exact_path/hits.cgi")) { &RequireVars("$vars_config{NonCGIPath}/$exact_path/hits.cgi"); delete($hits{$in{t}}); &WriteHashToFile("$vars_config{NonCGIPath}/$exact_path/hits.cgi", "hits", \%hits); } ********************* * Open cp2_content.cgi * ********************* Find: (~7) ===== use strict; #use warnings; Add below: ========== use vars qw( %hits ); Find: (~1077) ===== # delete topic file &Unlink("$vars_config{NonCGIPath}/$exact_path/$topic.cgi"); Add below: ========== if (&FileExists("$vars_config{NonCGIPath}/$exact_path/hits.cgi")) { &RequireVars("$vars_config{NonCGIPath}/$exact_path/hits.cgi"); delete($hits{$_}); &WriteHashToFile("$vars_config{NonCGIPath}/$exact_path/hits.cgi", "hits", \%hits); } ************************** * Open ubb_edit_post.cgi * ************************** Find: (~313) ===== # delete topic file &Unlink("$vars_config{NonCGIPath}/$exact_path/$in{t}.cgi"); Add below: ========== if (&FileExists("$vars_config{NonCGIPath}/$exact_path/hits.cgi")) { &RequireVars("$vars_config{NonCGIPath}/$exact_path/hits.cgi"); delete($hits{$in{t}}); &WriteHashToFile("$vars_config{NonCGIPath}/$exact_path/hits.cgi", "hits", \%hits); } ******************** * Open ubb_lib.cgi * ******************** Find: (~1694) ===== } elsif ($func eq "Forum") { Add below: ========== $colspans++; ******************************* * Open vars_wordlets_mods.cgi * ******************************* Find: (1) ===== %vars_wordlets_mods = ( Add below: ========== q!count_on_click! => q!Hits!, q!count_on_click_lowercase! => q!hits!, *********************** * Open ultimatebb.php * *********************** Find: (~290) ===== ubboutput ($fto, "$CGIURL/ultimatebb.cgi?ubb=get_topic;f=$f;t=$t$pg"); Replace with: ============= ubboutput ($fto, "$CGIURL/ultimatebb.cgi?ubb=get_topic;f=$f;t=$t$pg", $t, "$f$privatepath"); Find: (~345) ===== if ($hardset) { ubboutput ("$NonCGIPath/cache-$cache_pw/ubb_files/forum_page/Forum$f$privatepath/forum$f-$hardset$start.cgi", "$CGIURL/ultimatebb.cgi?ubb=forum;f=$f;hardset=$hardset;start_point=$start_point"); } else { ubboutput ("$NonCGIPath/cache-$cache_pw/ubb_files/forum_page/Forum$f$privatepath/forum$f-$DaysPrune.cgi", "$CGIURL/ultimatebb.cgi?ubb=forum;f=$f;DaysPrune=$DaysPrune"); } Replace with: ============= if ($hardset) { ubboutput ("$NonCGIPath/cache-$cache_pw/ubb_files/forum_page/Forum$f$privatepath/forum$f-$hardset$start.cgi", "$CGIURL/ultimatebb.cgi?ubb=forum;f=$f;hardset=$hardset;start_point=$start_point", "forum", "$f$privatepath"); } else { ubboutput ("$NonCGIPath/cache-$cache_pw/ubb_files/forum_page/Forum$f$privatepath/forum$f-$DaysPrune.cgi", "$CGIURL/ultimatebb.cgi?ubb=forum;f=$f;DaysPrune=$DaysPrune", "forum", "$f$privatepath"); } Find: (~562) ============ function ubboutput ($tpath, $redirect) { Replace with: ============= function ubboutput ($tpath, $redirect, $hit1, $hit2) { Find: (~572) ============ if (!$fx) { silly_redirection ("Location: $redirect", "redirect"); exit; } Add below: ========== if ($hit1 && $hit2) { Hits($hit1, $hit2); } Find: (~860) ============ return $this; } // end func Add below: ========== // ============================================================================ function Hits($place, $forum) { global $NonCGIPath; $cfile = "$NonCGIPath/Forum$forum/hits.cgi"; if(file_exists($cfile)) { $handle = fopen($cfile, "r+"); if($handle) { if(flock($handle, 2)) { $file = fread($handle, filesize($cfile)); } else { ubberror("Oops, I can't get a flock on the hits file."); } // end if } else { ubberror("I can't seem to open the existing hits file (
$cfile)
$cfile)