Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
Prevent Users With Low Post Counts Posting/PM'ing URLS Details »»
Prevent Users With Low Post Counts Posting/PM'ing URLS
Version: 1.00, by NTLDR (Coder) NTLDR is offline
Developer Last Online: Oct 2004 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 01-10-2004 Last Update: Never Installs: 62
 
No support by the author.

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.

Show Your Support

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

Comments
  #2  
Old 01-11-2004, 06:26 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can we get a text install file for this? And, good work there.
Reply With Quote
  #3  
Old 01-11-2004, 06:47 PM
FleaBag's Avatar
FleaBag FleaBag is offline
 
Join Date: Dec 2001
Posts: 1,674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Another one let out of the bag. Good work. This will hopefully stop my rivals advertising their sites to my members lol.
Reply With Quote
  #4  
Old 01-11-2004, 08:32 PM
Koutaru's Avatar
Koutaru Koutaru is offline
 
Join Date: Feb 2003
Location: IL
Posts: 589
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice hack this one will really help prevent spamming no?
Reply With Quote
  #5  
Old 01-11-2004, 08:37 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

instead of
PHP Code:
$url_errors verify_message_urls($post['message']); 
    foreach(
$url_errors AS $url_error) { 
        
$errors[] = $url_error
    } 
i'd use
PHP Code:
$errors array_merge($errorsverify_message_urls($post['message'])); 
but rather than that, nice one Lee
Reply With Quote
  #6  
Old 01-11-2004, 09:08 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had that origionally but it didn't seem to work, although I think that was due to me using $post['pagetext'] which doesn't exisit :P

Thanks for the comments Stefan I've updated the first post with this change.
Reply With Quote
  #7  
Old 01-11-2004, 09:14 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is a good recommended setting for this?
Reply With Quote
  #8  
Old 01-11-2004, 09:16 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've had this running on my site for 2 years now. But I use a much shorter piece of code to achieve a similar result.
Reply With Quote
  #9  
Old 01-15-2004, 05:51 PM
bigdaddy04 bigdaddy04 is offline
 
Join Date: Jan 2004
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great hack!
Is there a similar one to 2.3.x versions?

Erwin, wanna share with us?
Reply With Quote
  #10  
Old 01-15-2004, 05:53 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Erwin released and alternative version for vB2.
Reply With Quote
Reply

Thread Tools

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 06:45 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.04414 seconds
  • Memory Usage 2,318KB
  • 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
  • (8)bbcode_php
  • (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
  • (2)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