Forums Logo
 
Reply to this topicStart new topic
> can_leech set for Ratio Promite Mod
toolmanwill
post Jul 20 2006, 04:47 PM
Post #1


Advanced Member
***

Group: Beta Tester
Posts: 63
Joined: 20-April 06
Member No.: 5



After having a problem when turning off attachment access to low ratio group users, this code had to bee implemented to change the user to seeder only so they could still upload torrents of their own to get their ratio back up to par

Find :
CODE

    /*-------------------------------------------------------------------------*/
    // Check Ratio
    /*-------------------------------------------------------------------------*/
    
    function  ratio_check()
    {
        //-----------------------------------------    
        // Loop through the rule, see if theres a match
        //-----------------------------------------    
        foreach($this->ipsclass->cache['ratio_demote'] as $k=>$v)
        {
            $protected = unserialize( $v['r_group_protect'] );
            $protected[ $v['r_new_group'] ] = $v['r_new_group'];
            if($v['r_ratio_more'] == 1)
            {
                if( !$protected[ $this->member['mgroup'] ] )
                {
                    if( $this->member['downloaded'] >= $v['r_min_down'] && $this->member['uploaded'] >= $v['r_min_upload'] && $this->member['ratio'] > $v['r_ratio'] )
                    {
                      
                            $this->ipsclass->DB->do_update( 'members', array( 'mgroup' => $v['r_new_group'] ), 'id='.$this->member['id'] );
                        return $v['r_new_group'];    
                    }
                }
            }
            elseif( $v['r_ratio_more'] == 2)
            {
                if( !$protected[ $this->member['mgroup'] ] )
                {
                    if( $this->member['downloaded'] >= $v['r_min_down'] &&  $this->member['uploaded'] >= $v['r_min_upload'] && $this->member['ratio'] < $v['r_ratio'] )
                    {
                        
                            $this->ipsclass->DB->do_update( 'members', array( 'mgroup' => $v['r_new_group'] ), 'id='.$this->member['id'] );
                        return $v['r_new_group'];
                    }
                }
            }



Replace with :
CODE

    /*-------------------------------------------------------------------------*/
    // Check Ratio
    /*-------------------------------------------------------------------------*/
    
    function  ratio_check()
    {
        //-----------------------------------------    
        // Loop through the rule, see if theres a match
        //-----------------------------------------    
        foreach($this->ipsclass->cache['ratio_demote'] as $k=>$v)
        {
            $protected = unserialize( $v['r_group_protect'] );
            $protected[ $v['r_new_group'] ] = $v['r_new_group'];
            if($v['r_ratio_more'] == 1)
            {
                if( !$protected[ $this->member['mgroup'] ] )
                {
                    if( $this->member['downloaded'] >= $v['r_min_down'] && $this->member['uploaded'] >= $v['r_min_upload'] && $this->member['ratio'] > $v['r_ratio'] )
                    {
                        $this->ipsclass->DB->query( "UPDATE users SET can_leech='1' WHERE uid='".$this->member['id']."' " );
                            $this->ipsclass->DB->do_update( 'members', array( 'mgroup' => $v['r_new_group'] ), 'id='.$this->member['id'] );
                        return $v['r_new_group'];    
                    }
                }
            }
            elseif( $v['r_ratio_more'] == 2)
            {
                if( !$protected[ $this->member['mgroup'] ] )
                {
                    if( $this->member['downloaded'] >= $v['r_min_down'] &&  $this->member['uploaded'] >= $v['r_min_upload'] && $this->member['ratio'] < $v['r_ratio'] )
                    {
                        $this->ipsclass->DB->query( "UPDATE users SET can_leech='0' WHERE uid='".$this->member['id']."' " );
                            $this->ipsclass->DB->do_update( 'members', array( 'mgroup' => $v['r_new_group'] ), 'id='.$this->member['id'] );
                        return $v['r_new_group'];
                    }
                }
            }
User is offlineProfile CardPM
Report PostGo to the top of the page
+Quote Post
Jaggi
post Jul 20 2006, 09:23 PM
Post #2


Administrator
***

Group: Project Developer
Posts: 350
Joined: 31-March 06
Member No.: 1



looks good.
User is offlineProfile CardPM
Report PostGo to the top of the page
+Quote Post
loststryk
post Jul 20 2006, 09:42 PM
Post #3


Member
**

Group: Members
Posts: 23
Joined: 1-May 06
Member No.: 38



it is good smile.gif


--------------------
User is offlineProfile CardPM
Report PostGo to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
1 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
1 Members: OPPZeroCool

 

Lo-Fi Version 0.1000 sec    0.12    11 queries    GZIP Enabled
Time is now: 10th October 2006 - 12:12 AM