********************************************************************************* * MOD NAME: Hide Private Forums * ********************************************************************************* * DESCRIPTION: Hides private forums in forum summary from unauthorized users * * DEMO: ---- * * * ********************************************************************************* * CREATED BY: LK * * DATE: 07/11/05 * * VERSION: version 6.7 * * * ********************************************************************************* ********************************************************************************* * REQUIREMENTS: Full License, * * COMPATABILITY: works with v6.7x * ********************************************************************************* * FILES MODIFIED: ubb_lib.cgi, ubb_forum_summary.cgi, public_forum_summary.pl, * * ultimatebb.php * ********************************************************************************* * 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/ * * * ********************************************************************************* ********************************************************************************* *********************** * Open ultimatebb.php * *********************** Find: ===== function pntfGetCacheForForum ($forum, $TBT, $TBB, $colspan) { Add ABOVE: ========== function Privates ($f, $content) { global $profile; // Private forums? if ($profile) { $status = rtrim($profile[4]); $profile[4] = chop($profile[4]); $profile[8] = chop($profile[8]); $permissions = explode("&",$status); if ($permissions[1]) { $privateforums = explode(",",$permissions[1]); } // end if } // end if $privatepath = ""; if ($privateforums) { for($i=0;$i (.+?) ],/s",$test,$matches)) { $match = join("", $matches); if (ereg($userid, $match)) { $privateforum = getprivate($f); if ($privateforum) { $privatepath = "/private-$privateforum"; } // end if } } } if ($privatepath) { echo urldecode($content); } } ******************************** * Open public_forum_summary.pl * ******************************** Find: ===== $Row .= qq~~; Add below: ========== if ($priv1 && $priv2) { $Row = $priv1 . UBBCGI::escape($Row) . $priv2; } ****************************** * Open ubb_forum_summary.cgi * ****************************** Find: ===== local ($last_reply_number, $last_reply_post, $long_last_subject, $last_subject, $msg_icon, $last_post_number, $msg_icon2); Add below: ========== local ($priv1, $priv2); Find: ===== $msg_icon = ''; $msg_icon2 = qq!$vars_wordlets_img{alt_icon} 1 !; Add below: ========== $priv1=""; } else { $priv1 = ''; $priv2 = ''; ******************** * Open ubb_lib.cgi * ******************** Find: ===== $string =~ s/(\Q\E)/&CheckUserPMs()/ise; Add below: ========== my $match = 1; while ($match) { $match = $string =~ s/\Q\E/&Private($1,$2)/ise ? 1 : 0; } Find: ===== sub CheckUserPMs { Add ABOVE: ========== sub check_private_access2 { my (@profile, $Moderator); &RequireVars("$vars_config{VariablesPath}/vars_mods.cgi"); # since forum is private, user must be logged in # $_[0]: forum number # $_[1]: forum password (blank, if none) if (!$username) { return 0; } # user is logged in, so get profile @profile = &verify_id_num($username, $password, $user_number); unless ($profile[8] eq 'Administrator') { if ($profile[8] eq 'Moderator') { my @present = grep(/^$user_number$/, @{ $vars_mods{forums}->{$_[0]} }); unless ($present[0] eq $user_number) { # user is not moderator, so check for explicit permission return &check_explicit2($profile[4], $_[0]); } } else { return &check_explicit2($profile[4], $_[0]); } } else { return 1; } } # end check private access # *NOT* StandardHTML converted sub check_explicit2 { my ($j, $perms, @explicit, $access_rights, $forum_name, %pwhash, $forumpw); # one argument: # $_[0] : user permissions (from profile[4]) # $_[1] : forum number # $_[2] : forum password (blank, if none) ($j, $perms) = split (/&/, $_[0]); @explicit = split (/,/, $perms); foreach (@explicit) { &exochomp($_); if ($_[1] == $_) { return 1; } } #return 0; } # end check_explicit sr sub Private { if (&check_private_access2($_[0])) { return UBBCGI::unescape($_[1]); } } ######### # Done! #