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
  #2  
Old 08-14-2008, 06:17 PM
GaiLoan GaiLoan is offline
 
Join Date: Dec 2007
Location: California,US
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks and install
Reply With Quote
  #3  
Old 08-14-2008, 06:51 PM
ssslippy ssslippy is offline
 
Join Date: Jan 2006
Posts: 877
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This should really be a product. Very nicely laid out though.
Reply With Quote
  #4  
Old 08-14-2008, 11:59 PM
jredrum jredrum is offline
 
Join Date: Apr 2008
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ssslippy View Post
This should really be a product. Very nicely laid out though.
Thanks, wasn't sure where it should be. lol
Reply With Quote
  #5  
Old 08-15-2008, 02:14 AM
lostguy lostguy is offline
 
Join Date: Mar 2008
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what a mess here ! ...U need have XML for us to install dude . Alot risk doing this change with our php . Try prepare it well before share.

I do like your IDEA but still more to do with this one

lg
Reply With Quote
  #6  
Old 08-15-2008, 04:07 AM
Rat1972 Rat1972 is offline
 
Join Date: Jun 2005
Posts: 146
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lostguy View Post
what a mess here ! ...U need have XML for us to install dude . Alot risk doing this change with our php . Try prepare it well before share.

I do like your IDEA but still more to do with this one

lg
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.....
Reply With Quote
  #7  
Old 08-15-2008, 04:20 AM
GoTTi GoTTi is offline
 
Join Date: Jun 2002
Posts: 1,346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice i have been looking for this for a long time. should make it a plugin though and make it maybe viewable by usergroups with specific permissions only...
Reply With Quote
  #8  
Old 08-15-2008, 04:21 AM
GoTTi GoTTi is offline
 
Join Date: Jun 2002
Posts: 1,346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

need to make the whos online show that a user is viewing banlog or something...how do i do that again?
Reply With Quote
  #9  
Old 08-15-2008, 05:10 AM
Hornstar Hornstar is offline
 
Join Date: Jun 2005
Location: Australia
Posts: 2,469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice idea, not sure ill use it tho. but thanks for sharing.
Reply With Quote
  #10  
Old 08-15-2008, 10:52 AM
KURTZ KURTZ is offline
 
Join Date: Nov 2006
Location: Italy
Posts: 2,257
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
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 01:59 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.07424 seconds
  • Memory Usage 2,403KB
  • Queries Executed 23 (?)
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
  • (2)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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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