Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Banlog Stats Details »»
Banlog Stats
Version: 1.00, by jredrum jredrum is offline
Developer Last Online: Dec 2009 Show Printable Version Email this Page

Category: Add-On Releases - Version: 3.7.2 Rating:
Released: 08-13-2008 Last Update: Never Installs: 18
Template Edits
 
No support by the author.

What it does? - Adds a simple banlog to show who has been banned, for what reason, and how long until that ban is up.

Demo - http://www.theboredspot.com/banlog.php



Instructions:
First, create a file called 'banlog.php' in your forum root. Copy/paste this in that file

PHP Code:
<?php 

// ######################## SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

define('THIS_SCRIPT''banlist');  

// #################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array(); 

// get special data templates from the datastore 
$specialtemplates = array(); 

// pre-cache templates used by all actions 
$globaltemplates = array(  
        
'my_banlist' 
); 

// pre-cache templates used by specific actions 
$actiontemplates = array(); 

// ########################## REQUIRE BACK-END ############################ 
require_once('./global.php'); 

// #################### HARD CODE JAVASCRIPT PATHS ######################## 
$headinclude str_replace('clientscript'$vbulletin->options['bburl'] . '/clientscript'$headinclude); 

// ######################################################################## 
// ######################### START MAIN SCRIPT ############################ 
// ######################################################################## 

$navbits = array();  

$navbits[$parent] = 'The Ban Log'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 

$querygroups = array();
foreach (
$vbulletin->usergroupcache AS $usergroupid => $usergroup)
{
    if (!(
$usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup']))
    {
        
$querygroups["$usergroupid"] = $usergroup['title'];
    }
}
if (!empty(
$querygroups))
{
    
// now query users from the specified groups
    
$getusers $db->query_read("
        SELECT user.userid, user.username, user.usergroupid AS busergroupid,
        userban.usergroupid AS ousergroupid,
        IF(userban.displaygroupid = 0, userban.usergroupid, userban.displaygroupid) AS odisplaygroupid,
        bandate, liftdate, reason,
        adminuser.userid AS adminid, adminuser.username AS adminname
        FROM " 
TABLE_PREFIX "user AS user
        LEFT JOIN " 
TABLE_PREFIX "userban AS userban ON(userban.userid = user.userid)
        LEFT JOIN " 
TABLE_PREFIX "user AS adminuser ON(adminuser.userid = userban.adminid)
        WHERE user.usergroupid IN(" 
implode(','array_keys($querygroups)) . ")
        ORDER BY userban.liftdate ASC, user.username
    "
);
    if (
$db->num_rows($getusers))
    {
        
$users = array();
        while (
$user $db->fetch_array($getusers))
        {
            
$temporary iif($user['liftdate'], 10);
            
$users["$temporary"][] = $user;
        }
    }
    
$db->free_result($getusers);
    
    
// show temporarily banned users
    
if (!empty($users[1]))
    {
        foreach (
$users[1] AS $user)
        {
            if (
$user['liftdate'] == 0)
            {
                
$user['banperiod'] = $vbphrase['permanent'];
                
$user['banlift'] = $vbphrase['never'];
                
$user['banremaining'] = $vbphrase['forever'];
            }
            else
            {
                
$user['banlift'] = vbdate($vbulletin->options['dateformat'] . ', ~' $vbulletin->options['timeformat'], $user['liftdate']);
                
$user['banperiod'] = ceil(($user['liftdate'] - $user['bandate']) / 86400);
                if (
$user['banperiod'] == 1)
                {
                    
$user['banperiod'] .= $vbphrase[day]";
                }
                else
                {
                    
$user['banperiod'] .= $vbphrase[days]";
                }
    
                
$remain $user['liftdate'] - TIMENOW;
                
$remain_days floor($remain 86400);
                
$remain_hours ceil(($remain - ($remain_days 86400)) / 3600);
                if (
$remain_hours == 24)
                {
                    
$remain_days += 1;
                    
$remain_hours 0;
                }
    
                if (
$remain_days 0)
                {
                    
$user['banremaining'] = "<i>$vbphrase[will_be_lifted_soon]</i>";
                }
                else
                {
                    if (
$remain_days == 1)
                    {
                        
$day_word $vbphrase['day'];
                    }
                    else
                    {
                        
$day_word $vbphrase['days'];
                    }
                    if (
$remain_hours == 1)
                    {
                        
$hour_word $vbphrase['hour'];
                    }
                    else
                    {
                        
$hour_word $vbphrase['hours'];
                    }
                    
$user['banremaining'] = "$remain_days $day_word$remain_hours $hour_word";
                }
            }
            
$lista .= "<tr>
                <td valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['username']."</div>
                </td>
                <td align=\"center\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['adminname']."</div>
                </td>
                <td align=\"right\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.vbdate($vbulletin->options['dateformat'], $user['bandate'])."</div>
                </td>
                <td align=\"center\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['banperiod']."</div>
                </td>
                <td align=\"right\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['banlift']."</div>
                </td>
                <td align=\"center\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['banremaining']."</div>
                </td>
                <td align=\"right\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['reason']."</div>
                </td>
            </tr>"
;
        }
    }
    
    
// show permanently banned users
    
if (!empty($users[0]))
    {
        foreach (
$users[0] AS $user)
        {
            if (
$user['liftdate'] == 0)
            {
                
$user['banperiod'] = "Permanent";
                
$user['banlift'] = "Never";
                
$user['banremaining'] = "Forever";
            }
            else
            {
                
$user['banlift'] = vbdate($vbulletin->options['dateformat'] . ', ~' $vbulletin->options['timeformat'], $user['liftdate']);
                
$user['banperiod'] = ceil(($user['liftdate'] - $user['bandate']) / 86400);
                if (
$user['banperiod'] == 1)
                {
                    
$user['banperiod'] .= $vbphrase[day]";
                }
                else
                {
                    
$user['banperiod'] .= $vbphrase[days]";
                }
    
                
$remain $user['liftdate'] - TIMENOW;
                
$remain_days floor($remain 86400);
                
$remain_hours ceil(($remain - ($remain_days 86400)) / 3600);
                if (
$remain_hours == 24)
                {
                    
$remain_days += 1;
                    
$remain_hours 0;
                }
    
                if (
$remain_days 0)
                {
                    
$user['banremaining'] = "<i>$vbphrase[will_be_lifted_soon]</i>";
                }
                else
                {
                    if (
$remain_days == 1)
                    {
                        
$day_word $vbphrase['day'];
                    }
                    else
                    {
                        
$day_word $vbphrase['days'];
                    }
                    if (
$remain_hours == 1)
                    {
                        
$hour_word $vbphrase['hour'];
                    }
                    else
                    {
                        
$hour_word $vbphrase['hours'];
                    }
                    
$user['banremaining'] = "$remain_days $day_word$remain_hours $hour_word";
                }
            }
            
$listb .= "<tr>
                <td valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['username']."</div>
                </td>
                <td align=\"center\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['adminname']."</div>
                </td>
                <td align=\"right\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.vbdate($vbulletin->options['dateformat'], $user['bandate'])."</div>
                </td>
                <td align=\"center\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['banperiod']."</div>
                </td>
                <td align=\"center\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['banlift']."</div>
                </td>
                <td align=\"center\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['banremaining']."</div>
                </td>
                <td align=\"right\" valign=\"top\" class=\"alt1\">
                <div class=\"smallfont\">"
.$user['reason']."</div>
                </td>
            </tr>"
;
        }
    }
}

eval(
'print_output("' fetch_template('my_banlist') . '");'); 

?>
Next, create a new template for each style you have called 'my_banlist'

Copy/paste this code:

Code:
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>Banlog - $vboptions[bbtitle]</title>
</head>
<body>

$header
$navbar

<table class="tborder" align="center" border="0" cellpadding="3" cellspacing="2" width="100%">
    <tr>
        <td colspan="7" class="tcat">
        <strong>Banned Users: Temporary Bans</strong>
        </td>
    </tr>
    <tr>
        <td align="center" class="alt1">
        <strong>User Name</strong>
        </td><br />
        <td align="center" class="alt1">
        <strong>Banned By</strong>
        </td>
        <td align="center" class="alt1">
        <strong>Banned On</strong>
        </td>
        <td align="center" class="alt1">
        <strong>Ban Period</strong>
        </td>
        <td align="center" class="alt1">
        <strong>Ban Will Be Lifted On</strong>
        </td>
                <td align="center" class="alt1">
        <strong>Ban Time Remaining</strong>
        </td>
                <td align="center" class="alt1">
        <strong>Ban Reason</strong>
        </td>
    </tr>

<if condition="$lista == ''">

</table><br />

        <div align="center"><strong>No one is currently banned...  Hmmmm...  Must be a good day!</strong></div>

<else />

        $lista

</table><br />

</if>



<table class="tborder" align="center" border="0" cellpadding="3" cellspacing="2" width="100%">
    <tr>
        <td colspan="7" class="tcat">
        <strong>Banned Users: Permanent Bans</strong>
        </td>
    </tr>
    <tr>
        <td align="center" class="alt1">
        <strong>User Name</strong>
        </td><br />
        <td align="center" class="alt1">
        <strong>Banned By</strong>
        </td>
        <td align="center" class="alt1">
        <strong>Banned On</strong>
        </td>
        <td align="center" class="alt1">
        <strong>Ban Period</strong>
        </td>
        <td align="center" class="alt1">
        <strong>Ban Will Be Lifted On</strong>
        </td>
                <td align="center" class="alt1">
        <strong>Ban Time Remaining</strong>
        </td>
                <td align="center" class="alt1">
        <strong>Ban Reason</strong>
        </td>
    </tr>


<if condition="$listb == ''">

</table><br />

        <div align="center"><strong>No one is currently banned...  Hmmmm...  Must be a good day!</strong></div>

<else />

        $listb

</table><br />

</if>

$footer
</body>
</html>

That's it.

This should work for any version, though I have only tested it on 3.7

This mod is not supported.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 08-15-2008, 11:52 AM
logicuk logicuk is offline
 
Join Date: Jan 2008
Posts: 327
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice idea but please make as a plugin
Reply With Quote
  #13  
Old 08-15-2008, 12:48 PM
lostguy lostguy is offline
 
Join Date: Mar 2008
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Rat1972 View Post
Why does he need a XML? That is for lazy people.
Only thing what you have to do, is those two steps and it's finished.....
Well VB have provided us options for Product and Plugin sections thats what it use for ! We not lazy just that we do worry our own board and database .

Stupid people always make the first move but i do appreciated people like you for a TESTER .

lg
Reply With Quote
  #14  
Old 08-15-2008, 01:10 PM
jredrum jredrum is offline
 
Join Date: Apr 2008
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not doing any more on this. It's a simple thing to addon. If you don't want to do it, then don't.
Reply With Quote
  #15  
Old 08-15-2008, 02:55 PM
KURTZ KURTZ is offline
 
Join Date: Nov 2006
Location: Italy
Posts: 2,257
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

just a question: but only admins are logged into this log?
Reply With Quote
  #16  
Old 08-15-2008, 03:32 PM
jredrum jredrum is offline
 
Join Date: Apr 2008
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KURTZ View Post
just a question: but only admins are logged into this log?
Any mod that has banning ability will show as the person who banned a particular user.
Reply With Quote
  #17  
Old 08-15-2008, 04:31 PM
john102774 john102774 is offline
 
Join Date: Aug 2008
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KURTZ View Post
really useful ...

edit: there is an alignment trouble ... check the attachment ... (fixed into my banlog.php attached)

also can you provide a new release with a redirect to the user profile that is banned?
This works. Thanks!
Reply With Quote
  #18  
Old 08-16-2008, 07:51 AM
nexus_dublin nexus_dublin is offline
 
Join Date: Dec 2006
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks mate, very nice and very easy! Thumbs up! :up::up::up:

Small note - I went one extra step and removed the three columns from the permanent bans table (banperiod, banlift and banremaining) as they are really redundant in that context.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.11443 seconds
  • Memory Usage 2,387KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete