vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Miscellaneous Hacks - Rules and User Agreement Hack (https://vborg.vbsupport.ru/showthread.php?t=97699)

Firestar.chkn 12-17-2005 04:21 PM

Quote:

Originally Posted by Pocketbike Planet
Great hack! But...

I can't find a setting to have this displayed for all forums when posting a new thread or reply. I don't want to have to make a new rule set for each individual forum (we don't have any sub forums). I tried to set it for the main category but of course this did not work.

Any suggestions?

Just add the rule to the main category and add the checkbox "include in child forums" and it will add it for all forums.

Awesome hack, btw. I love it, and will be using it all the time :) Installs :)

kommuni 12-18-2005 12:24 PM

Quote:

Originally Posted by Firestar.chkn
Just add the rule to the main category and add the checkbox "include in child forums" and it will add it for all forums.

Awesome hack, btw. I love it, and will be using it all the time :) Installs :)

Quote:

Just add the rule to the main category and add the checkbox "include in child forums" and it will add it for all forums.
I have about 8 Categories on top level... i don't see any category "above"?!

Would be great if this option could be added. My users should agree to new rules when logging into the forums next time - regardless where they login... This doesn't seem to be possible so far.

Thanks!

redlabour 12-18-2005 03:02 PM

Quote:

Originally Posted by kommuni
I have about 8 Categories on top level... i don't see any category "above"?!

Would be great if this option could be added. My users should agree to new rules when logging into the forums next time - regardless where they login... This doesn't seem to be possible so far.

Thanks!

Same at me !

vibe 12-18-2005 07:08 PM

When I click on agree and submit, browser takes me to this URL

Code:

http://www.agalico.com/php/php.exe?f=65...

Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

Can anyone help me figure it out why? I'v been trying to troubleshoot this problem forever, still having find out why.

Thanks.

redlabour 12-23-2005 06:48 AM

Quote:

Originally Posted by kommuni
I have about 8 Categories on top level... i don't see any category "above"?!

Would be great if this option could be added. My users should agree to new rules when logging into the forums next time - regardless where they login... This doesn't seem to be possible so far.

Thanks!

Anybody supporting this Hack ?

steven s 12-26-2005 11:34 PM

I want people to read an agreement before
linking to /newthread.php?do=hpde
Is this possible?
Edit: nevermind. I figured it out.

kommuni 01-03-2006 07:11 AM

Hi together,

as there doesn't seem to be anymore support for this hack, i helped myself and found a solution for that previously named problem.

I'll post it here and you may use it at your own risk!

With this modification, you're able to setup rules for every page. With such a global rule everyone first has to agree to this rule before beeing able to read any of your forums (or even gallery, arcade, any hack that uses vb-templateparser).

the only thing you need to modify is the template_parser plugin from the rules & agreementhack. Just xchange the complete code with this:

PHP Code:

$hackagree = array();

    
$vbulletin->input->clean_array_gpc('p', array('hackagree' => TYPE_ARRAY_INT'forumid' => TYPE_INT'oldurl' => TYPE_STR'do' => TYPE_STR));
    
$ruleids implode(","$vbulletin->GPC['hackagree']);

    
$scripturl1 iif ($_SERVER['SCRIPT_URI'], $_SERVER['SCRIPT_URI'], "http://" $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']);
    
$urluri $scripturl1 iif($_SERVER['QUERY_STRING'], "?" $_SERVER['QUERY_STRING']);
                    
if (
$ruleids)
{
        
//Lets see if this user has agreed or not (Update agreed ruleid)
        
update_rules($ruleids$vbulletin->GPC['forumid']);
}
else
{     

    if (
$vbulletin->GPC['hackagree']<>1)
    {
            
// Check for all list of RULE to be apply for this page...
        
$ruletext check_newrules($vbulletin->GPC['forumid']);

         if (
$ruletext)
        {
           
$navbits = array();
           
$parentlist array_reverse(explode(','substr($foruminfo['parentlist'], 0, -3)));
           foreach (
$parentlist AS $forumID)
          {
           
$forumTitle $forumcache["$forumID"]['title'];
           
$navbits["forumdisplay.php?$session[sessionurl]f=$forumID"] = $forumTitle;
          }

        
// parse headinclude, header & footer
        
$admincpdir =& $vbulletin->config['Misc']['admincpdir'];
        
$modcpdir =& $vbulletin->config['Misc']['modcpdir'];

       
$navbits[''] = $vbphrase['ruleshack_rules_and_agreement'];
       
$navbits construct_navbits($navbits);
        if (empty(
$navbar))
       eval(
'$navbar = "' fetch_template('navbar') . '";');
        if (empty(
$headinclude))
        eval(
'$headinclude = "' fetch_template('headinclude') . '";');
        if (empty(
$header))
        eval(
'$header = "' fetch_template('header') . '";');
                
        if (
defined('VBA_PORTAL'))
        {
            require_once(
DIR '/includes/vba_cmps_include_bottom.php');
        }        
        if (empty(
$footer))
        eval(
'$footer = "' fetch_template('footer') . '";');


            if (
$_REQUEST['do'] == 'postreply')
             {
                 
$rule = array();
                 
$rule['postreply']        = 1;
                 
$rule['wysiwyg']        = $_REQUEST['wysiwyg'];
                 
$rule['quickreply']        = $_REQUEST['quickreply'];
                 
$rule['message']        = addslashes($_REQUEST['message']);
                 
$rule['fromquickreply']    = $_REQUEST['fromquickreply'];
                 
$rule['t']                = $_REQUEST['t'];
                 
$rule['p']                = $_REQUEST['p'];
                 
$rule['parseurl']        = $_REQUEST['parseurl'];                 
             }
             
       eval(
'print_output("' fetch_template('ruleshack_rules') . '");');
        exit;
        }    
    }
}

//     function "check_rulesneed" to find any rules exist for this page....
     
function check_rulesneeded()
      {
           global 
$vbulletin$urluri$scripturl1;                               
                           
          
$ruleneed $vbulletin->db->query_first("SELECT * FROM " TABLE_PREFIX "ruleshack 
            WHERE (fileurl LIKE '" 
$urluri "' AND exactmatch = 1 ) 
            OR (fileurl LIKE '" 
$scripturl1 "%' AND exactmatch = 0 )
            OR (fileurl LIKE 'all' AND exactmatch = 0) AND active = 1 ORDER BY ruleid"
);
           
          if (!
$ruleneed)
           return 
false;
          else
           return 
true;           
      }

//     function "check_newrules" to find all the rules to be agreed by this user
    
function check_newrules($fid 0)
    {
    global 
$vbulletin$foruminfo$vbphrase$stylevar$urluri$scripturl1;
 
        if ((!
$fid) and (!check_rulesneeded()))
         return 
false;

    
//Lets check what rule(s) this user should get
    
        
$vbulletin->userinfo['agreedrule'] = iif($vbulletin->userinfo['agreedrule'], $vbulletin->userinfo['agreedrule'], '0');

        
$parents iif($vbulletin->forumcache[$vbulletin->GPC['forumid']]['parentlist'], $vbulletin->forumcache[$vbulletin->GPC['forumid']]['parentlist'], '0');

        
$parentids = array();            
        
$parentids iif($parentsexplode(','str_replace(' '''$parents)), 0);
        
                 if ((
$_COOKIE[COOKIE_PREFIX 'rules']) and ($vbulletin->userinfo['userid']==0))
                foreach(
$_COOKIE[COOKIE_PREFIX 'rules'] AS $key => $value)
                 {
                
$allrules .= " :: " $key;
                
$vbulletin->userinfo['agreedrule'] .= iif($vbulletin->userinfo['agreedrule']!='',",","") . $value;
                 }

        
$sql "SELECT * from " TABLE_PREFIX "ruleshack 
            WHERE 
            (
            (forumid = 
$fid)
            OR 
            (fileurl LIKE '" 
$urluri "' AND exactmatch = 1 ) 
            OR 
            (fileurl LIKE '" 
$scripturl1 "%' AND exactmatch = 0 )
            OR 
            (fileurl LIKE 'all' AND exactmatch = 0 )
            OR 
            (forumid IN (
$parents))
            ) 
            AND 
            (ruleid not in (" 
$vbulletin->userinfo['agreedrule'] . ")) 
            AND 
            active = 1 
            ORDER BY ruleid"
;
    
        
$rule $vbulletin->db->query($sql);
                                        
 
$i 1;
while (
$rules $vbulletin->db->fetch_array($rule))
    {
         
        
$flag        0;
        
$condflag    0;
        
$groupflag    0;
        
$memberflag 0;
        
    
// Lets start our rules

    // Rule #1 : USER is from Selected Usergroup(s)
          
if ($rules['groupids'])
        {
            
$gids    = array();            
            
$gids    explode(','str_replace(' '''$rules['groupids']));
             if (
in_array($vbulletin->userinfo['usergroupid'], $gids))
              {
                 
$flag 1;
                
$groupflag 1;
              }                       
        }
    
    
// Rule #2 : USRE is from Selected Membergroup(s)
        
if ($rules['memberids'])
         {
            
$mids    = array();
            
$mgids    explode(','str_replace(' '''$vbulletin->userinfo['membergroupids']));
            
$mids    explode(','str_replace(' '''$rules['memberids']));
        
            foreach (
$mgids as $ids
             {             
             if (
in_array($ids$mids))
              {
                 
$flag      1;
                
$memberflag 1;
              }
             }    
         }    
         
                if ( (
$groupflag==1) or ($memberflag==1) )
                  
$condflag 1;
                else
                  
$condflag 0;        
                
    
// Rule #4 : USER is from Selected Userid(s)
          
if ($rules['userids'])
        {
            
$uids    = array();            
            
$uids    explode(','str_replace(' '''$rules['userids']));
             if (
in_array($vbulletin->userinfo['userid'], $uids))
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }
        
    
// Rule #5 : USER is from Selected Username(s)
          
if ($rules['usernames'])
        {
            
$unames    = array();
            
$unames    explode(','str_replace(' '''$rules['usernames']));
             if (
in_array($vbulletin->userinfo['username'], $unames))
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }
    
// All the Condition from Rule #6 - Rule #13 for VB Users....
if ($vbulletin->userinfo['userid'] > )
 {
    
// Rule #6 : User has More than X post(s)
          
if ($rules['postmore'])
        {
            if (
$vbulletin->userinfo['posts'] > $rules['postmore']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }

    
// Rule #7 : User has Less than X post(s)
          
if ($rules['postless'])
        {
            if (
$vbulletin->userinfo['posts'] < $rules['postless']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }

    
// Rule #8 : Join date is After xxx Date
          
if ($rules['joindateafter'])
        {
            if (
$vbulletin->userinfo['joindate'] > $rules['joindateafter']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }

    
// Rule #9 : Join date is Before xxx Date
          
if ($rules['joindatebefore'])
        {
            if (
$vbulletin->userinfo['joindate'] < $rules['joindatebefore']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }

    
// Rule #10 : Last visit is After xxx Date
          
if ($rules['lastactiveafter'])
        {
            if (
$vbulletin->userinfo['lastvisit'] > $rules['lastactiveafter']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }

    
// Rule #11 : Last visit is Before xxx Date
          
if ($rules['lastactivebefore'])
        {
            if (
$vbulletin->userinfo['lastvisit'] < $rules['lastactivebefore']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }

    
// Rule #12 : Last post is After xxx Date
          
if ($rules['lastpostafter'])
        {
            if (
$vbulletin->userinfo['lastpost'] > $rules['lastpostafter']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }

    
// Rule #13 : Last post is Before xxx Date
          
if ($rules['lastpostbefore'])
        {
            if (
$vbulletin->userinfo['lastpost'] < $rules['lastpostbefore']) 
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }
 }
// All the Condition from Rule #6 - Rule #13 for VB Users....

    // Rule #14 : Rule apply for Child forum....
            
if (($parentids) and ($fid != $rules['forumid']))
            {    
             if ((
in_array($rules['forumid'], $parentids)==1) and ($rules['childforum']==1))
              {
                 
$flag      1;
                
$condflag 1;
               }
               else {
                
$condflag 0;
              }     
            }
                        
    
// Rules from URL     
                
$flag 0;
            if (
$condflag == 1)
             {                          
                     if (
$rules['fileurl'])
                      {
                    
$urlpos strrpos($urluri$rules['fileurl']);                                                                       
                     
// Rule #14 : Show Rules on URL match.....
                         
if (($rules['fileurl'] == $urluri) and ($rules['exactmatch']==1))
                         {
                              
$flag 1;
                              
$condflag 1;                  
                         } else {
                              
$condflag 0;
                         }
                              
                    
// Rule #15 : Show Rules on URL match.....
                         
if (($urlpos) and ($rules['exactmatch']==0))
                         {
                              
$flag 1;
                              
$condflag 1;                  
                         } else {
                              
$condflag 0;
                         }
              
// Rule #14 + 15 : Show Rules regardless to URL.....
                
if(($rules['fileurl']=='all') and ($rules['exactmatch']==0)) 
                {
                    
$flag 1;
                    
$condflag 1;
                } else {
                    
$condflag 0;
                }


                      }
             
    
// Rule #16 : First Thread ever in this Forum by this User
          
if (($rules['firstnewthread']) and ($fid!=0) and ($_REQUEST['do'] == 'newthread'))
        {
        
$result $vbulletin->db->query_first("SELECT * from " TABLE_PREFIX "thread 
            WHERE forumid = 
$fid and postuserid = " $vbulletin->userinfo['userid'] . " ");
            if (!
$result)
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                
$condflag 0;
             }
        }
             
                          
    
// Rule #17 : Show Rules on New Thread....
          
if ($rules['newthread'])
        {        
            if (
$_REQUEST['do'] == 'newthread')
              {
                 
$flag      1;
                
$condflag 1;
              }else {
               
$condflag 0;
              }
        } else {
            
$condflag 0;
        }
                                     
    
// Rule #18 : Show Rules on New Post....
          
if ($rules['newreply'])
        {        
            if (
$_REQUEST['do'] == 'newreply' or $_REQUEST['do'] == 'postreply'
              {
                 
$flag      1;
                
$condflag 1;
              }else
                
$condflag 0;
        } else {
            
$condflag 0;
        }
    
    
// Rule #19 : Show Rules on View Forum....
          
if ($rules['viewforum'])
        {        
            if ((
$fid) and ($_REQUEST['do'] != 'newreply' and $_REQUEST['do'] != 'newthread' and $_REQUEST['do'] != 'postreply'))
              {
                 
$flag      1;
                
$condflag 1;
              }else {
                  
$condflag 0;              
              }
        }
            } else {
            
$condflag 0;
            }
                
    
// Rules End ... Thank you

        
if ($rules['conditions'])
            if (
$condflag == 0)
              
$flag 0;
                         
        if (
$flag == 1)
        {
            
$ruletitle    $rules['ruletitle'];
            
$ruleid        $rules['ruleid'];
          if (
$rules['allowbbcode'])
            {
            require_once(
DIR '/includes/class_bbcode.php');
            
$bbcode_parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());
            
$ruletextbit    $bbcode_parser->parse($rules['ruletext']);
            }
            else
            {
            
$ruletextbit    $rules['ruletext'];
            }
        eval(
'$ruletext .= "' fetch_template('ruleshack_rulesbit') . '";');
        
$i++;
        }
    }        
        return 
$ruletext;
 }    
    
    function 
update_rules($rid ''$f 0)
    {
        global 
$vbulletin ;

        
// You gotta agree on this
        
        
if ($rid)
        {            
            
$vbulletin->db->query("UPDATE " TABLE_PREFIX "user SET agreedrule = '" 
            
iif($vbulletin->userinfo['agreedrule'], $vbulletin->userinfo['agreedrule'] . ",""") . $rid "' 
            WHERE userid = " 
$vbulletin->userinfo['userid']);            

                
vbsetcookie("rules["$rid ."]",$rid);
                
                    if (
$_REQUEST['do'] != 'postreply')
                
exec_header_redirect($vbulletin->GPC['oldurl']);
        }
        
        return 
1;
    }
    
function 
fetch_user_agreed_rules()
 {
    global 
$vbulletin$threadinfo$userinfo;
        
        if (
$_REQUEST['find'] == 'lastposter' AND $userinfo)
         {
             
$uid $userinfo['userid'];
         }        
    
$uid iif($_REQUEST['u'], $_REQUEST['u'], $uid);
    if (
$uid 0)
     { 
            
$Ruser fetch_userinfo($uid);        
        
$ruleids iif($Ruser['agreedrule'], $Ruser['agreedrule'], 0);
        
$result     $vbulletin->db->query("SELECT * from " TABLE_PREFIX "ruleshack 
                WHERE ruleid in (
$ruleids) AND ruleurl <> ''");

        while (
$ruleinfo $vbulletin->db->fetch_array($result))
         {
            
$agreedrules .= "<tr><td><a href='" $ruleinfo['ruleurl'] . "'>" $ruleinfo['ruletitle'] . "</a></td></tr>";
         }
     }
        return 
$agreedrules;
 } 

Then setup a rule with URL "all" (just type in these three letters in the url field) and set exact match to no.

That's all.

It's kind of a 'dirty' solution but it's working and should not have any negative consequences. I've setup some new forumrules for my 15k+ board and it's working very well.

Best,
Frank

bcrooms 01-04-2006 01:35 AM

How can I change the text in this hack......I want the checkbox to have a Mission Statement of my own writing in it. Where do I change that?

-B

uae 01-05-2006 08:41 AM

Quote:

Originally Posted by kommuni
Hi together,
Then setup a rule with URL "all" (just type in these three letters in the url field) and set exact match to no.

That's all.

It's kind of a 'dirty' solution but it's working and should not have any negative consequences. I've setup some new forumrules for my 15k+ board and it's working very well.

Best,
Frank

Sorry guys, but I have been busy with the vB Pager hack and did not have the time to add any new featurs to the rules hack.

kommuni, again, I haven't tried your changes yet, but I'll do that as soon as I get the time.


bcrooms, I'm sorry, but I did not get it, are you talking about this text "I have read, and agree to abide by the ....."

if so, then you need to edit phrase "ruleshack_agree_abide_by_rules"
and if you were talking about a whole new rules, then you will need to create a new rule and add whatever text...all that can be done from your ADMINCP, just look @ the screen shots!

kommuni 01-05-2006 09:01 AM

Quote:

Sorry guys, but I have been busy with the vB Pager
so where is it? :)


All times are GMT. The time now is 04:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01782 seconds
  • Memory Usage 2,026KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete