Back to vBulletin 3.0 Add-Ons

Prevent Users With Low Post Counts Posting/PM'ing URLS
Mod Version: 1.00, by NTLDR

This modification is in the archives.
vB Version: 3.0.0 Rating: (1 vote - 4.00 average) Installs: 62
Released: 11 Jan 2004 Last Update: Never Downloads: 7
Not Supported  

Title: Prevent members with low post count posting/pm'ing urls.
Author: NTLDR
Version: 1.0.1
vB Compatibility: vB3 Gamma, RC1, RC2

Description: I created this hack a while ago for use on my board to prevent people signing up and just posting a URL. This hack will prevent users with less than X posts from PM'ing or posting URLs.

File edits:

In includes/functions_newpost.php find:

PHP Code:
        eval('$errors[] = "' fetch_phrase('toomanyimages'PHRASETYPEID_ERROR) . '";');
    } 
Add after:

PHP Code:
$errors array_merge($errorsverify_message_urls($post['message'])); 
Find:

PHP Code:
    return sizeof($errors);

Add after (making sure you change REPLACE_NUMBER_OF_POSTS_HERE to the number of posts a user must have before being able to post/pm URLS):

PHP Code:
function verify_message_urls($pagetext) {

    global 
$vboptions$vbphrase$bbuserinfo;

    
$errors = array();

    if (
$bbuserinfo['posts'] < REPLACE_NUMBER_OF_POSTS_HERE) {
        if (
THIS_SCRIPT == 'newthread' || THIS_SCRIPT == 'newreply' || THIS_SCRIPT == 'editpost') {
            
$typephrase $vbphrase['post'];
        } elseif (
THIS_SCRIPT == 'private') {
            
$typephrase $vbphrase['private_message'];
        } else {
            
$typephrase $vbphrase['message'];
        }

        if (
preg_match('/\[url/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }

        
$pagetext strip_bbcode($pagetext);

        if (!
$errored && preg_match('/h(\s*)t(\s*)t(\s*)p/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }

        if (!
$errored && preg_match('/w(\s*)w(\s*)w/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }

        if (!
$errored && preg_match('/(\w*)(\s*)(\.|dot)(\s*)(c(\s*)o(\s*)m|c(\s*)o(\s*)(\.|dot)(\s*)u(\s*)k|n(\s*)e(\s*)t|o(\s*)r(\s*)g)/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }
    }

    return 
$errors;

If you want this to apply to posts only you don't need to do the following edit which is for PM's:

In private.php find:

PHP Code:
        // process errors if there are any
        
if (!empty($errors)) 
Add BEFORE:

PHP Code:
$errors array_merge($errorsverify_message_urls($pm['message'])); 
Phrases to add:

In Front-End Error Messages add:
Varname: x_contains_urls
Text:
Code:
Your $typephrase contains one or more URLs, please remove them before submitting your message again.

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2024