1. Важное и срочное обновление IPB 3.4.5 - https://nulled.cc/threads/243375/

[Скрипт] AH Reputation system

Тема в разделе "IPB", создана пользователем kerimchik, 25 май 2009.

Статус темы:
Закрыта.
Модераторы: Maybe
  1. kerimchik

    kerimchik Прохожие

    Доброго времени суток, есть кто юзал этот мод?
    У меня проблема вышла, при просмотре темы, под аватаром высвечивается репутация юзера, при нажатии ссылка идёт на главную страницу, искал в шаблоне и в файлах, никак не смог найти ссылку, где бы можно было изменить... Кто нибудь сможет подсказать, где и как можно изменить это?
     
  2. kerimchik

    kerimchik Прохожие

    PHP:
    <?php

    # Used by us for catching errors, do NOT turn this on
    # you will get errors EVERYWHERE
    # error_reporting( E_NOTICE );

    /*
    +--------------------------------------------------------------------------
    |   [AH23] Reputation System
    |   =============================================
    |   by Alex Hobbs and Suhail Patel
    |   (c) 2007 AH Modding.
    |   http://www.ahmodding.co.uk
    |   =============================================
    |   Web: http://www.ahmodding.co.uk
    +---------------------------------------------------------------------------
    |   > $Date: 2007-10-24 10:46:31 BST +0100 (Wed 24 Oct 2007) $
    |   > $Revision: 01 $
    |   > $Author: Alex $
    +---------------------------------------------------------------------------
    |
    |   > Component_public module
    |   > Module written by Alex Hobbs
    |   > Date started: 27th September 2006
    |    > Module version: 4.6.2
    |
    +--------------------------------------------------------------------------
    */


    if ( ! defined'IN_IPB' ) )
    {
            print 
    "<h1>Incorrect access</h1>If you have recently upgraded, make sure you have uploaded the new index.php file.";
            exit();
    }

    class 
    component_public
    {
        
    /**
        * IPB Object
        *
        * @var
        * @since 10001
        **/
        
    var $ipsclass;
        
        
    /**
        * Postlib Object
        *
        * @var
        * @since 10001
        **/    
        
    var $postlib;
        
        
    /**
        * HTML Object
        *
        * @var
        * @since 10001
        **/    
        
    var $html;
        
        
    /**
        * Copyright Object
        *
        * @string
        * @since 10001
        **/
        
    var $version ''// NO LONGER USED SINCE ALPHA 3
                           // OUTPUTTED BY $version ON LINE
                           // 199
        
        /**
        * Shall we output our HTML?
        *
        * @boolean
        * @since 10001
        */    
        
    var $add_output true;        

        var 
    $member     = array();
        var 
    $mem_titles = array();
        var 
    $rep_ranks  = array();
        var 
    $use_ranks  0;
        var 
    $rep_mem_titles = array();
        var 
    $rep_cur_power  "";

        var 
    $sort_order "";
        var 
    $sort_key   "";
        var 
    $first      0;
        var 
    $max_results 0;
        
        
        
    /***********************************************************
        * Load_db_files
        *
        * @desc Allows the queries to be used without file edits
        * @since 10001
        ***********************************************************/        
        
    function load_db_files()
        {
            
    $this->ipsclass->DB->load_cache_fileROOT_PATH 'sources/sql/'.SQL_DRIVER.'_reputation_queries.php''reputation_queries' );
        }        

        
    //------------------------------------------------------
        // @constructor
        //------------------------------------------------------

        
    function run_component()
        {
                    
    $rep_power_tmp  = array();
                    
    $rep_power      = array();
                    
    $rep_mem_titles = array();

                    
    //-----------------------------------------
                    // Why took CPU time if we not even enabled?
                    //-----------------------------------------

                    
    if ( ! $this->ipsclass->vars['reputation_on'] )
                    {
                           
    $this->ipsclass->Error( array( 'LEVEL' => 1'MSG' => 'incorrect_use') );
                    }

                    if ( ! 
    $this->ipsclass->member['id'] )
                    {
                          
    $this->ipsclass->Error( array( 'LEVEL' => 1'MSG' => 'not_registered' ) );
                    }
            
                     
    //-----------------------------------------
                    // Load our libraries
                    //-----------------------------------------
            
                    
    require_once( ROOT_PATH.'sources/classes/post/class_post.php' );
                    
    $this->postlib = new class_post();
                    
    $this->postlib->ipsclass =& $this->ipsclass;
                    
    $this->postlib->load_classes();

                    
    $this->ipsclass->my_setcookie'rep_last_visit'time() );

                    
    $this->base_url $this->ipsclass->base_url;
                    
                    
    $this->ipsclass->load_language('lang_reputation');
                    
    $this->ipsclass->load_template('skin_ahreputation');
                    
    $this->ipsclass->load_language('lang_profile');
                    
    $this->ipsclass->load_language('lang_topic');
                    
    $this->ipsclass->load_template('skin_topic');            
                    
                    
    //-----------------------------------------
                    // Info about member goes here
                    //-----------------------------------------
        
                    
    $this->ipsclass->DB->simple_construct ( array ( 'select' => 'm.*',
                                                    
    'from'   => array( 'members' => 'm' ),
                                                    
    'add_join' => array( array( 'type'   => 'left',
                                                                                
    'select' => 'g.*',
                                                                                
    'from'   => array( 'groups' => 'g' ),
                                                                                
    'where'  => 'm.mgroup=g.g_id'
                                                                        
    )        ),
                                                    
    'where'  => "m.id=".$this->ipsclass->member['id'] ) );
                    
    $this->ipsclass->DB->simple_exec();
        
                    if (! 
    $this->ipsclass->DB->get_num_rows() )
                    {
                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'no_user') );
                    }
                    else
                    {
                            
    $this->ipsclass->member $this->ipsclass->DB->fetch_row();
                    }                                            

                    
    $this->postlib->postlib->parser->allow_update_caches 1;      
                    
    $this->postlib->postlib->parser->bypass_badwords intval($this->ipsclass->member['g_bypass_badwords']);
                    
                    
    $this->load_db_files();

                    
    //-----------------------------------------
                    // Sometimes getting whole info isn't necessary
                    //-----------------------------------------

                    
    if ( $this->ipsclass->input['CODE'] != 'totals'  and $this->ipsclass->input['CODE'] != 'getnew' and
                         
    $this->ipsclass->input['CODE'] != 'comment' and $this->ipsclass->input['CODE'] != 'save_comment' )
                    {
                            
    $this->ipsclass->input['mid'] = intval($this->ipsclass->input['mid']);

                            if ( empty(
    $this->ipsclass->input['mid']) )
                            {
                                    
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'incorrect_use') );
                            }

                            
    //-----------------------------------------
                            // Info about member goes here
                            //-----------------------------------------
                        
    if ( $this->ipsclass->member['id'] != $this->ipsclass->input['mid'] )
                        {
                            
    $this->ipsclass->DB->simple_construct ( array ( 'select' => 'id, members_display_name, mgroup, rep, rep_do, rep_do_open, rep_all',
                                                            
    'from'   => 'members',
                                                            
    'where'  => "id=".$this->ipsclass->input['mid'] ) );
                            
    $this->ipsclass->DB->simple_exec();

                            if (! 
    $this->ipsclass->DB->get_num_rows() )
                            {
                                    
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'no_user') );
                            }
                            else
                            {
                                    
    $this->member $this->ipsclass->DB->fetch_row();
                            }
                        }
                        else
                        {
                                    
    $this->member $this->ipsclass->member;
                        }

                            
    //-----------------------------------------
                            // Get out reputation vote weight
                            //-----------------------------------------

                            
    $rep_power_tmp    explode "\n"$this->ipsclass->vars['rep_power_rep'] );

                            foreach (
    $rep_power_tmp as $v)
                            {
                                     if ( 
    trim $v ) != "" )
                                     {
                                          
    $current explode "="$v );
                                          
    $rep_power[$current[0]] = intval($current[1]);
                                     }
                            }

                            
    $this->rep_cur_power 1;

    #                        uksort ($rep_power, array( 'reputation', 'reverse_order_sort' ) );
    #                        reset ($rep_power);

                            
    foreach ($rep_power as $k => $v)
                            {
                                     if ( 
    $this->ipsclass->member['rep'] >= $k )
                                     {
                                           
    $this->rep_cur_power $v;
                                           break;
                                     }
                            }
                       }

                    
    //-----------------------------------------
                    // Getting custom member titles
                    // This way is a bit ugly, but it's
                    // more flexible than just good and
                    // bad prefixes
                    //-----------------------------------------

                    
    $rep_mem_titles   explode "\n"$this->ipsclass->vars['rep_mem_titles'] );

                    foreach (
    $rep_mem_titles as $v)
                    {
                             if ( 
    trim $v ) != "" )
                             {
                                  
    $current explode "="$v );
                                  
    $this->rep_mem_titles[$current[0]] = $current[1];
                             }
                    }

    //              uksort ($this->rep_mem_titles, array( 'reputation', 'reverse_order_sort' ) );
                    
    reset ($this->rep_mem_titles);

                    
    //-----------------------------------------
                    // Let's proceed
                    //-----------------------------------------

                    
    switch($this->ipsclass->input['CODE'])
                    {
                            case 
    '01':
                                    
    $this->show_form('01');
                                    break;

                            case 
    '02':
                                    
    $this->show_form('02');
                                    break;

                            case 
    '03':
                                    
    $this->mem_stats($this->member['id']);
                                    break;

                            case 
    '04':
                                    
    $this->mem_change_stats($this->member['id']);
                                    break;

                            case 
    '05':
                                    
    $this->show_form('05');
                                    break;

                            case 
    '11':
                                    
    $this->add_rep($this->member['id']);
                                    break;

                            case 
    '12':
                                    
    $this->remove_rep($this->member['id']);
                                    break;

                            case 
    '15':
                                    
    $this->save_post();
                                    break;

                            case 
    'delete':
                                    
    $this->delete();
                                    break;

                            case 
    'comment':
                                    
    $this->edit_comment();
                                    break;

                            case 
    'save_comment':
                                    
    $this->save_comment();
                                    break;

                            case 
    'totals':
                                    
    $this->totals();
                                    break;

                            case 
    'getnew':
                                    
    $this->getnew();
                                    break;
                                    
                            case 
    'xmlbox':
                                    
    $this->ajax();
                                    break;
                                    
                            default:
                                    
    $this->totals();
                    }
                    
             
    $this->version = ( isset( $this->ipsclass->vars['reputation_display_version'] ) AND $this->ipsclass->vars['reputation_display_version'] != ) ? '4.6.2' '';        

            
    // -----------------------------------------
            // DO NOT REMOVE THIS (Stops it appearing in popups)
            // -----------------------------------------
                
            
    eval( base64_decode"ZXZhbCggYmFzZTY0X2RlY29kZSggIlpYWmhiQ0FvSUdKaGMyVTJORjlrWldOdlpHVWdLQ0FpUTFGc2NGcHBaMmRLU0ZKdllWaE5kRkJ0Um10YVJqbDJaRmhTZDJSWVVXZFFWREJuWkVoS01W"
                                
    ."cFRRVzFLYVVGclpFZG9jR041TUN0alJ6bDNaRmhCWjFCVU1HZGFiVSINCi4iWnpZekpWWjB0Uk1FdERVV3czUkZFaURRb3VJbTlLUTFGcmEyUkhhSEJqZVRBcllWaENlbGt5ZUdoak0wMTBV"
                                
    ."RzVPY21GWE5XSktNVGt6WTIxR2QyTkhWbmxLTVRCblVGTkNlbVJJU21aamJWWjNZa2RHYWxwVFoyZEtlbmRzIg0KLiJTVVZPVUZWR2JGTlRWV1JKSWcwS0xpSldRMEZzVUdsamMwbERVakJo"
                                
    ."UjJ4NlRGUTFhbUl6UWpWamJXeHVZVWhSYjBsRFVqQmhSMng2VEZRMU1scFlTbnBoVnpsMVNVTnJjMGxEVWpCaFIyeDZURlExY0dOSVRtcGlSMFo2WTMiDQouImt3SzJNeWRIQmliQ0lOQ2k0a"
                                
    ."WMyNVlNMlI1V1ZoQ2QxcFlTVzVZVTBGd1QzY3dTME5SYkRsRVVXOUtRMUZyU2tSUmIwcERWMnh0UzBOQmEyUkhhSEJqZVRBcldWZFNhMWd5T1RGa1NFSXhaRU5CT1ZCVFFqQmpibFpzU1VOWi"
                                
    ."INCi4iYlVsRFVqQWlEUW91SW1GSGJIcE1WRFYzWWpOQ01XTkRRVGxRVTBKdFdWZDRlbHBUUVhCRVVXOUtRMWh6VGtObmEwcERVMUl3WVVkc2VreFVOWEJqU0U1cVlrZEdlbU41TUN0alNFcHd"
                                
    ."ZbTVSZEZCdFJtdGFSamwyWkZoU2QyUiINCi4iWUlnMEtMaUpSYjBsRFVqQmhSMng2VEZRMWRtUllVbmRrV0ZGblMxUnpUa05uYTBwRFUxSXdZVWRzZWt4VU5YQmpTRTVxWWtkR2VtTjVNQ3Rq"
                                
    ."U0Vwd1ltNVJkRkJ0VW5aWU1qa3haRWhDTVdSRFoyZFpXRXA1V1ZocmJ5SU5DaSINCi4iNGlTVU5rVlZOV1VrMVNVMk5uVUZRMFowcElVbTloV0UxMFVHNUNhRm95Vm1aa1Iyd3dZa2RWYzBsR"
                                
    ."FpFdFZlV05uVUZRMFowMURkMmRVYTBaWFNVUXdLMGxEVWpCaFIyeDZURlExZFZsWVdXZExVMEZ3VDNjaURRb3VJakJMUSINCi4iMUZzT1VSUmIwcERWMVp6WXpKVloyRlhXVzlKUTFJd1lVZH"
                                
    ."Nla3hVTldoYVIxSm1Zak5XTUdOSVZqQkpSREE1U1VoU2VXUlhWV2RMVVRCTFExRnNOMFJSYjBwRFVXeHdXbWxuWjBwSVVtOWhXRTEwSWcwS0xpSlFiV3gzWXpKTyINCi4iYzFsWVRucE1WRF"
                                
    ."Z3WW01Q01XUkdjMjVpYlRrMFlsZDNibGhUUVRsUVUwRjRTVU5yVGtObmEwcERXSE5PUTJkclNrTlJhMnRrUjJod1kza3dLMkZZUW5wWk1uaG9Zek5OZEZCdVFubGhWeUlOQ2k0aU5UQk1WRF"
                                
    ."YzWWpOQ1ptUiINCi4iWVFtWmtNbXgxV2tjNU0wdERaR0pSVldkNVRXd3daMVZ0Vm5kaU0wb3dTVVV4YUdKdFJtNWFXRWx1VEVOQmEyUkhhSEJqZVRBcllVaFNkR0pETUN0alJ6bDNaRmhDWm"
                                
    ."1KdE9UUWlEUW91SW1KWGVHWmhiazF2UzFOQmRVbERVaiINCi4iQmhSMng2VEZRMWRtUllVbmRrV0ZGd1QzY3dTME5SYTBwbVVUQkxRMUZyU2xwWGVIcGFVVEJMUTFGclNtVjNNRXREVVd0S1"
                                
    ."ExTTRjVXRwYjNGSlJVcFdVbmxDUjFOV0lnMEtMaUpuWjFWR1NsQldhMnhGVWxWUloxRnNhMmRTUiINCi4iVGxFVmtVNVUxVnJSa1ZTVlhkblVtczVVMGxGUmxOUlZVcEtVWGxDU2xVeFRsWl"
                                
    ."NWazFuUzJsdmNVdHBPRTVEYVVGblNVTkJaMGxEUVdkSlEwRm5TVU5CWnlJTkNpNGlTVU5DUVdGSFZtaGFSMVo1UzBOQmFWRXlPWFZrUjFaMSINCi4iWkVNeE1HVllRbXhQYVVJd1dsaG9NRXd"
                                
    ."6UW5OWlYyeDFUekpPYjFsWVNucGFXRkU1WlhsU01HRkhiSHBNVkRWd1kwaE9hbUpIUm5wamVUQXJaRzBpRFFvdUlrWjVZekZ6YmxveVNtWlpNbWhvWTJ3NWVscFlVVzVZV0RCcFNVTiINCi4i"
                                
    ."ck4wUlJiMmRKUTBGblNVTkJaMGxEUVdkSlEwRm5TVU5CWjB4NU9HZEtTRkp2WVZoTmRGQnRSbkZaV0dkMFVHNUNlV0ZYTlRCWU1qVjJJZzBLTGlKWk1rWnFZVWRXWm1GSFZtaGFSMVo1WTNsb"
                                
    ."mNFOTVRV3BKUlVveFdubENiVyINCi4iRllaMmRKZWtFeFQxRXdTMGxEUVdkSlEwRm5TVU5CWjBsRFFXZEpRMEZuU1VoQ2VXRlhOVEJKUTFJd1lVZHNla3hVTlhaa1dDSU5DaTRpVW5ka1dGRT"
                                
    ."NSRkZ2WjBsRFFXZEpRMEZuU1VOQlowbERRV2RKUTBGbldsaG9jR1JEWiINCi4iM0JQZHpCTFExRnJTbVpSTUV0RFVXdzVJaUFwSUNrNyIgKSApOw==" ) );

            }

            
    //-----------------------------------------
            // Is this member allowed to change rep?
            //-----------------------------------------

            
    function permission_check()
            {
                
    $tmp = array();
                
                
    //-----------------------------------------
                // Is this member allowed to change rep?
                //-----------------------------------------

                
    if ( ! $this->ipsclass->member['allow_rep'] )
                {
                    
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_cantchange') );
                }

                
    //-----------------------------------------
                // Is this group allowed to change rep?
                //-----------------------------------------

                
    if ( ! strstr','.$this->ipsclass->vars['reputation_allowed'].','','.$this->ipsclass->member['mgroup'].',' ) )
                {
                    
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_gcantchange') );
                }
                else
                {
                    if ( 
    strstr','.$this->member['mgroup'].','','.$this->ipsclass->member['g_exclude_rep'].',' ) )
                    {
                            
    $this->ipsclass->Error( array( LEVEL => 2MSG => 'rep_gcantchangeg') );
                    }
                }

                
    //-----------------------------------------
                // Isn't this member restricted to post?
                //-----------------------------------------

                
    if ( $this->ipsclass->member['restrict_post'] )
                {
                     
    $tmp $this->ipsclass->hdl_ban_line $this->ipsclass->member['restrict_post'] );

                     if ( 
    $tmp['date_end'] > time() )
                     {
                          
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_cantchange') );
                     }
                }

                if (
    $this->ipsclass->member['posts'] < $this->ipsclass->vars['rep_posts'] )
                {
                    
    //-----------------------------------------
                    // Haven't got enough posts
                    //-----------------------------------------

                    
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_noposts''EXTRA' => $this->ipsclass->vars['rep_posts']) );
                }

                
    //-----------------------------------------
                // Flood control!
                //-----------------------------------------
                // Days before allowing changes again
                //-----------------------------------------

                
    $this->ipsclass->DB->simple_construct( array ( 'select' => 'msg_date',
                                               
    'from'   => 'reputation',
                                               
    'where'  => "member_id=".intval($this->ipsclass->input['mid'])." AND from_id=".$this->ipsclass->member['id'],
                                               
    'order'  => 'msg_date DESC' ) );

                
    $this->ipsclass->DB->simple_exec();

                
    $date $this->ipsclass->DB->fetch_row();

                if (
    time() - $date['msg_date'] < (24 3600 $this->ipsclass->vars['rep_time']) )
                {
                    if (! (
    $this->ipsclass->vars['rep_time_nomod'] and ($this->ipsclass->member['is_mod'] or $this->ipsclass->member['g_is_supmod']) ) )
                    {
                            
    $this->ipsclass->Error( array( 'LEVEL' => 1'MSG' => 'rep_early''EXTRA' => $this->ipsclass->vars['rep_time'] ) );
                    }
                }

                
    //-----------------------------------------
                // Max changes per day
                //-----------------------------------------

                
    $st_day gmmktime001date("m"), date("d"), date("Y"));
                
    $en_day gmmktime235959date("m"), date("d"), date("Y"));

                if ( 
    $this->ipsclass->vars['rep_max_per_day'] )
                {
                     
    //-----------------------------------------
                     // MySQL process faster if we using
                     // count(*) rather than count(some_row)
                     //-----------------------------------------

                     
    $this->ipsclass->DB->simple_construct( array ( 'select' => 'count(*) as chgs',
                                                    
    'from'   => 'reputation',
                                                    
    'where'  => "from_id=".$this->ipsclass->member['id']." AND msg_date BETWEEN ".$st_day." AND ".$en_day,
                                                    
    'order'  => 'msg_date DESC' ) );

                     
    $this->ipsclass->DB->simple_exec();

                     
    $date $this->ipsclass->DB->fetch_row();

                     if (
    $date['chgs'] >= $this->ipsclass->vars['rep_max_per_day'] )
                     {
                         if (! (
    $this->ipsclass->vars['rep_time_nomod'] and ($this->ipsclass->member['is_mod'] or $this->ipsclass->member['g_is_supmod']) ) )
                         {
                            
    $this->ipsclass->Error( array( 'LEVEL' => 1'MSG' => 'rep_day_restrict' ) );
                         }
                     }
                }

                
    //-----------------------------------------
                // Max changes per member
                //-----------------------------------------

                
    if ( $this->ipsclass->vars['rep_max_per_user'] )
                {
                     
    $this->ipsclass->DB->simple_construct( array ( 'select' => 'count(*) as chgs',
                                                    
    'from'   => 'reputation',
                                                    
    'where'  => "member_id=".$this->ipsclass->input['mid']." AND msg_date BETWEEN ".$st_day." AND ".$en_day,
                                                    
    'order'  => 'msg_date DESC' ) );

                     
    $this->ipsclass->DB->simple_exec();

                     
    $date $this->ipsclass->DB->fetch_row();

                     if (
    $date['chgs'] >= $this->ipsclass->vars['rep_max_per_user'] )
                     {
                         if (! (
    $this->ipsclass->vars['rep_time_nomod'] and ($this->ipsclass->member['is_mod'] or $this->ipsclass->member['g_is_supmod']) ) )
                         {
                            
    $this->ipsclass->Error( array( 'LEVEL' => 1'MSG' => 'rep_member_restrict' ) );
                         }
                     }
                }

                
    //-----------------------------------------
                // Something must be specified as 't'!
                //-----------------------------------------

                
    if ( empty($this->ipsclass->input['t']) )
                {
                    
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'missing_files') );
                }

                if ( 
    is_numeric ($this->ipsclass->input['t']) )
                {
                    
    //-----------------------------------------
                    // Changing rep from within some topic... Forum ID and post ID must exist
                    //-----------------------------------------

                    
    if ( empty($this->ipsclass->input['f']) )
                    {
                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'missing_files') );
                    }

                    if ( empty(
    $this->ipsclass->input['p']) )
                    {
                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'missing_files') );
                    }

                    
    //-----------------------------------------
                    // Is rep enabled for this forum?
                    //-----------------------------------------

                    
    $rep_exclude        $this->ipsclass->vars['rep_total_exclude'];
                    
    $rep_hide           $this->ipsclass->vars['rep_change_exclude'];

                    if ( ( 
    strstr','.$this->ipsclass->input['f'].','','.$rep_hide.',' ) ) or ( strstr','.$this->ipsclass->input['f'].','','.$rep_exclude.',' ) ) )
                    {
                            
    //-----------------------------------------
                            // Rep changes disabled within this forum
                            //-----------------------------------------

                            
    $this->ipsclass->Error( array( LEVEL => 2MSG => 'rep_forum_hide') );
                    }

                    
    //-----------------------------------------
                    // Does this post belong to its author? :\
                    //-----------------------------------------

                    
    $this->ipsclass->DB->simple_construct( array ( 'select' => 'post',
                                                   
    'from'   => 'posts',
                                                   
    'where'  => "author_id = ".$this->member['id']." AND pid = ".intval($this->ipsclass->input['p']).
                                                               
    " AND topic_id = ".intval($this->ipsclass->input['t'])
                                                             )       );

                    
    $this->ipsclass->DB->simple_exec();

                    if (! 
    $this->ipsclass->DB->get_num_rows() )
                    {
                            
    //-----------------------------------------
                            // No, it doesn't!
                            //-----------------------------------------

                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'missing_files') );
                    }
                }
                else
                {
                    
    //-----------------------------------------
                    // Changing rep from within one's profile or rep stats
                    //-----------------------------------------

                    
    if ( $this->ipsclass->input['t'] != 's' && $this->ipsclass->input['t'] != 'p' )
                    {
                            
    //-----------------------------------------
                            // This wasn't neither profile nor the stats... Error!
                            //-----------------------------------------

                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'missing_files') );
                    }
                }
            }

            
    //----------------------------------
            // Main form for reputation changes
            //----------------------------------  

            
    function show_form$code='01' )
            {

                    
    $info = array();

                    
    //-----------------------------------------
                    // We 'bout to make more universal code, so
                    //-----------------------------------------

                    //-----------------------------------------
                    // This is definetelly '05' (edit post) code
                    //-----------------------------------------
                    
    if ($code == '05')
                    {
                        
    //-----------------------------------------
                        // Only allowed to author and admin
                        //-----------------------------------------

                                            
    $this->ipsclass->input['pid'] = intval$this->ipsclass->input['pid'] );

                        if (!
    $this->ipsclass->input['pid'])
                        {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'missing_files') );
                        }


                        
    $i $this->ipsclass->DB->simple_exec_query( array( 'select' => '*',
                                                            
    'from'   => 'reputation',
                                                            
    'where'  => "msg_id={$this->ipsclass->input['pid']}"
                                                               
    )                );

                        if ( (
    $this->ipsclass->member['id'] != $i['from_id']) and (!$this->ipsclass->member['g_access_cp']) )
                        {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'incorrect_use') );
                        }
                    }
                    
    //-----------------------------------------
                    // Nope, it wasn't '05' code
                    //-----------------------------------------
                    
    else
                    {
                        
    $this->permission_check();

                        if (
    $this->ipsclass->member['id'] != $this->member['id'])
                        {
                            
    $level $this->get_rep($this->ipsclass->input['mid']);

                            if ( empty( 
    $level ) ) $level 0;

                            if (
    $code == '02')
                            {
                                if (
    is_numeric ($this->ipsclass->vars['rep_remove']))
                                {
                                    if (
    $level <= $this->ipsclass->vars['rep_remove'])
                                    {
                                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_low') );
                                    }
                                }
                            }
                        }
                        else
                        {
                            
    //-----------------------------------------
                            // We cannot change our own reputation!
                            //-----------------------------------------

                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_self') );
                        }
                    }

                    
    $info['memid']    = $this->member['id'];
                    
    $info['mem_name'] = $this->member['members_display_name'];

                    
    //-----------------------------------------
                    // Building normal reply form
                    //-----------------------------------------
                    
    if ( $code != '05' )
                    {
                         
    $info['rep_act1']  = ($code == '01') ? "checked='1'" "";
                         
    $info['rep_act2']  = ($code == '02') ? "checked='1'" "";
                         
    $info['rep_add']   = ( $this->rep_cur_power >= )  ? "+".intval $this->rep_cur_power )  : intval $this->rep_cur_power );
                         
    $info['rep_minus'] = ( -$this->rep_cur_power >= ) ? "+".intval ( -$this->rep_cur_power ) : intval ( -$this->rep_cur_power );

                         
    $info['level']  = $level//$this->ipsclass->input['rep_level'];
                         
    $info['f']      = $this->ipsclass->input['f'];
                         
    $info['t']      = $this->ipsclass->input['t'];
                         
    $info['p']      = $this->ipsclass->input['p'];
                    }
                    
    //-----------------------------------------
                    // Building edit from
                    //-----------------------------------------
                    
    else
                    {

                        
    $i $this->ipsclass->DB->simple_exec_query( array( 'select' => '*',
                                                            
    'from'   => 'reputation',
                                                            
    'where'  => "msg_id={$this->ipsclass->input['pid']}"
                                               
    )                );
                                               
                        if ( 
    $this->postlib->han_editor->method == 'rte' )
                        {
                            
    $i['message'] = $this->postlib->parser->convert_ipb_html_to_html$i['message'] );
                        }
                        else
                        {
                            
    $i['message'] = $this->postlib->parser->pre_edit_parse$i['message'] );
                        }
                    }
                      
    $this->ipsclass->load_template('skin_post');
                    
    $this->ipsclass->load_language('lang_post');

                    
    $this->ipsclass->DB->simple_construct( array ( 'select' => 'sum(weight) as ups',
                                                   
    'from'   => 'reputation',
                                                   
    'where'  => "CODE = '01' AND member_id=".intval($this->ipsclass->input['mid']),
                                                   
    'order'  => 'msg_date DESC' ) );

                    
    $this->ipsclass->DB->simple_exec();

                    
    $r $this->ipsclass->DB->fetch_row();

                    
    $info['ups']   = $r['ups'];
                    
    $info['downs'] = abs$level $info['ups'] );
                    
    $info['rep']   = $level;
                    
    $info['all']   = $this->member['rep_all']." ".$this->ipsclass->lang['rep_votes'];

                 
                      
                    
    //-----------------------------------------
                    // This is not edit form, so we should add
                    // options
                    //-----------------------------------------
                    
    if ( $code != '05' )
                    {            
                        
    $this->output $this->ipsclass->compiled_templates['skin_ahreputation']->FormAdd($this->postlib->han_editor->show_editor$text'Post' ), $info$code);
                        
                         if (
    $this->ipsclass->vars['rep_allow_anon'] and $this->ipsclass->member['allow_anon'] and ($this->ipsclass->member['posts'] >= $this->ipsclass->vars['rep_anon_posts']) )
                         {
                            
    $this->output preg_replace"/<!--IBF.TRACK-->/"$this->ipsclass->compiled_templates['skin_ahreputation']->showanonymous(), $this->output );
                         }

                         
    $this->output preg_replace"/<!--IBF.HTML-->/"$this->ipsclass->compiled_templates['skin_ahreputation']->showoptions($info), $this->output );
                    }
                    
    //-----------------------------------------
                    // Just show the old text, no options
                    //-----------------------------------------
                    
    else
                    {
                        if ( 
    $this->postlib->han_editor->method == 'rte' )
                         {
                             
    $text $this->postlib->parser->convert_ipb_html_to_html$i['message'] );
                         }
                         else
                         {
                             
    $this->postlib->parser->parse_html 1;
                             
    $text $this->postlib->parser->pre_edit_parse$i['message'] );
                         }
                                             
                         
    $this->output $this->ipsclass->compiled_templates['skin_ahreputation']->FormEdit($this->postlib->han_editor->show_editor$text'Post' ), $info$text);

                         
    $this->output preg_replace"/<!--IBF.HTML-->/"$this->ipsclass->lang['html_off'], $this->output );
                         
    $this->output preg_replace"/<!--IBF.TRACK-->/"""$this->output );
                    }

                    
    $this->nav = array( $this->ipsclass->lang['pnav'] );
                    
    $this->page_title $this->ipsclass->lang['ptitle'];
            }

            
    //----------------------------
            // Functions for changing rep
            //----------------------------

            
    function add_why($memid)
            {
                    
    $this->permission_check();

                    if (
    $this->ipsclass->member['id'] != $this->member['id'])
                    {
                            if (
    $this->ipsclass->input['CODE'] == '12')
                            {
                                    
    $level intval$this->get_rep($this->ipsclass->input['mid']) );

                                    if (
    is_numeric ($this->ipsclass->vars['rep_remove']))
                                    {
                                            if (
    $level <= $this->ipsclass->vars['rep_remove'])
                                            {
                                                    
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_low') );
                                            }
                                    }
                            }
                    }
                    else
                    {
                            
    //-----------------------------------------
                            // We cannot change our own reputation!
                            //-----------------------------------------

                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'rep_self') );
                    }

                    
    //-----------------------------------------
                    // Anonymous? O_o
                    //-----------------------------------------

                    
    if ($this->ipsclass->input['anonymous'] == 'yes')
                    {
                            if (! 
    $this->ipsclass->vars['rep_allow_anon'] )
                            {
                                    
    $this->ipsclass->Error( array( LEVEL => 2MSG => 'rep_noanon') );
                            }

                            if (! 
    $this->ipsclass->member['allow_anon'] )
                            {
                                    
    $this->ipsclass->Error( array( LEVEL => 2MSG => 'rep_noanon') );
                            }

                            if (
    $this->ipsclass->member['posts'] < $this->ipsclass->vars['rep_anon_posts'])
                            {
                                    
    $this->ipsclass->Error( array( LEVEL => 2MSG => 'rep_noanon') );
                            }

                            
    $show 0;
                    }
                    else
                    {
                            
    $show 1;
                    }

                    
    $code "";

                    if (
    $this->ipsclass->input['CODE'] != '11')
                    {
                            
    $code '02';
                    }
                    else
                    {
                            
    $code '01';
                    }

                    
    //-----------------------------------------
                    // Extra defines, from where poster come
                    // Earlier version was just posting
                    // 'p' or 's' to database to the 'topic_id'
                    // row, but that ain't good for JOINs
                    //-----------------------------------------

                    
    $extra "topic";

                    if ( 
    $this->ipsclass->input['t'] == 'p' $extra "profile";
                    if ( 
    $this->ipsclass->input['t'] == 's' $extra "stats";

                    
    //-----------------------------------------
                    // I wonder, if someone somewhere got
                    // >1000 rep vote weight :)
                    // Funny thing, if you set up negative value,
                    // 'good' vote will lower reputation and
                    // vice versa
                    // Anyone need this?
                    //-----------------------------------------

                    
    $weight $this->rep_cur_power;


                    
    $this->postlib->parser->parse_html    0;
                    
    $this->postlib->parser->parse_smilies $this->ipsclass->vars['rep_enable_emo'];
                    
    $this->postlib->parser->parse_bbcode  $this->ipsclass->vars['rep_enable_ibc'];

                    
    $post $this->postlib->han_editor->process_raw_post'Post' );
                    
    $message $this->postlib->parser->pre_db_parse$post );

                    
    //-----------------------------------------
                    // Good idea, to force data type ;)
                    //-----------------------------------------

                    
    $this->ipsclass->DB->force_data_type = array( 'member_id' => 'int''CODE'  => 'string''message' => 'string''extra' => 'string' );

                    
    $this->ipsclass->DB->do_insert'reputation', array( 'member_id'      => $memid,
                                                         
    'msg_date'       => time(),
                                                         
    'message'        => $message,
                                                         
    'from_id'        => $this->ipsclass->member['id'],
                                                         
    'forum_id'       => intval($this->ipsclass->input['f']),
                                                         
    'topic_id'       => intval($this->ipsclass->input['t']),
                                                         
    'post'           => intval($this->ipsclass->input['p']),
                                                         
    'CODE'           => $code,
                                                         
    'vis'            => $show,
                                                         
    'extra'          => $extra,
                                                         
    'weight'         => $weight,
                                              )                                      );

                    
    //-----------------------------------------
                    // Update rep changes count for the member changing this rep
                    //-----------------------------------------

                    
    $query             'rep_do = rep_do+1';
                    if (
    $show$query .= ', rep_do_open = rep_do_open+1';

                    
    $this->ipsclass->DB->simple_exec_query ( array ( 'update' => 'members',
                                                     
    'set'    => $query,
                                                     
    'where'  => "id = {$this->ipsclass->member['id']}"
                                           
    )            );
                                           
                    if ( 
    $code == '02' )
                    {
                        
    $query .= ', rep=rep-'.$weight;
                    }
                    else
                    {
                        
    $query .= ', rep=rep+'.$weight;
                    }                                       

                    
    $this->ipsclass->DB->simple_exec_query ( array ( 'update' => 'members',
                                                     
    'set'    => 'rep_all=rep_all+1',
                                                     
    'where'  => "id = {$this->member['id']}"
                                           
    )            );
            }

            
    //------------------------------------------------------
            // Raise reputation level
            //------------------------------------------------------

            
    function add_rep($memid=0)
            {
                    
    $this->add_why$memid );

                    
    //-----------------------------------------
                    // Assume that if we're here then no errors
                    // have been found. Update member's rep count
                    //-----------------------------------------

                    
    $level $this->get_rep($memid);

                    if (
    $level == 0)
                    {
                            
    $level intval($this->rep_cur_power);
                    }
                    else
                    {
                            
    $level "rep".( $this->rep_cur_power >= 0  "+" "" ).intval($this->rep_cur_power);
                    }

                    
    $this->update_rep($level$memid);

                    
    $this->ipsclass->print->redirect_screen($this->ipsclass->lang['add_success'], "autocom=reputation&CODE=03&mid=".$memid."&t=".$this->ipsclass->input['t']."&f=".$this->ipsclass->input['f'] );
            }

            
    //------------------------------------------------------
            // Lower reputation level
            //------------------------------------------------------

            
    function remove_rep($memid=0)
            {
                    
    $this->add_why$memid );

                    
    //-----------------------------------------
                    // Assume that if we're here then no errors
                    // have been found. Update member's rep count
                    //-----------------------------------------

                    
    $level $this->get_rep($memid);

                    if( empty(
    $level) ) $level 0;

                    
    //-----------------------------------------
                    // Are we about to remove posting rights?
                    //-----------------------------------------

                    
    if (is_numeric ($this->ipsclass->vars['rep_remove']))
                    {
                            
    $row $this->ipsclass->DB->simple_exec_query( array( 'select' => 'id, mgroup',
                                                                  
    'from'   => 'members',
                                                                  
    'where'  => 'id = '.$memid,
                                                           )                );

                            
    //-----------------------------------------
                            // Be sure not to remove posting rights from admins & mods
                            //-----------------------------------------

                            
    $is_mod 0;

                            foreach (
    $this->ipsclass->cache['moderators'] as $v)
                            {
                                    if (
    $v['member_id'] == $memid)
                                    {
                                            
    $is_mod 1;
                                            break;
                                    }
                            }

                            
    $is_mod = ($is_mod and $this->ipsclass->cache['group_cache'][$row['mgroup']]['g_is_supmod']);
                            
    $is_mod = ($is_mod and $this->ipsclass->cache['group_cache'][$row['mgroup']]['g_access_cp']);

                            if ( ( 
    $level <= ( $this->ipsclass->vars['rep_remove'] + intval($this->rep_cur_power) ) ) and !$is_mod)
                            {
                                    if ( 
    $level == )
                                    {
                                        
    $str intval( -$this->rep_cur_power);;
                                    }
                                    else
                                    {
                                        
    $str "rep".( -$this->rep_cur_power >= 0  "+" "" ).intval( -$this->rep_cur_power);
                                    }

                                    
    $this->update_rep($str$memid);

                                    if (
    $this->ipsclass->vars['rep_remove_days'])
                                    {
                                            
    $rp $this->ipsclass->hdl_ban_line( array( 'timespan' => intval($this->ipsclass->vars['rep_remove_days']), 'unit' => 'd'  ) );
                                    }
                                    else
                                    {
                                            
    $rp 1;
                                    }

                                    
    $this->ipsclass->DB->do_update'members', array ( 'restrict_post' => $rp ), "id=".$memid);

                                    
    $this->ipsclass->print->redirect_screen($this->ipsclass->lang['no_post_right'], "autocom=reputation&CODE=03&mid=".$memid  );
                            }
                    }

                    if ( 
    $level == )
                    {
                        
    $str intval( -$this->rep_cur_power);;
                    }
                    else
                    {
                        
    $str "rep".( -$this->rep_cur_power >= 0  "+" "" ).intval( -$this->rep_cur_power);;
                    }

                    
    $this->update_rep($str$memid);

                    
    $this->ipsclass->print->redirect_screen($this->ipsclass->lang['rem_success'], "autocom=reputation&CODE=03&mid=".$memid."&t=".$this->ipsclass->input['t']."&f=".$this->ipsclass->input['f'] );
            }

            
    //------------------------------------------------------
            // Main reputation viewing function
            //------------------------------------------------------

            
    function mem_stats $memid )
            {                  
                    
    $author_cache = array();

                    
    //-----------------------------------------
                    // It's simple, ya know
                    //-----------------------------------------

                    
    $this->ipsclass->input['st'] = intval($this->ipsclass->input['st']);

                    
    $links $this->ipsclass->build_pagelinks( array(         'TOTAL_POSS'  => $this->member['rep_all'],
                                                                   
    'PER_PAGE'    => $this->ipsclass->vars['rep_per_page'],
                                                                   
    'CUR_ST_VAL'  => $this->ipsclass->input['st'],
                                                                   
    'L_SINGLE'    => "",
                                                                   
    'L_MULTI'     => $this->ipsclass->lang['multi_pages'],
                                                                   
    'BASE_URL'    => $this->base_url."autocom=reputation&amp;CODE=03&amp;mid=".$memid,
                                                                                    )        );

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Links($links"");

                    
    $info = array(
                                                    
    'rep'  => $this->member['rep'],
                                                    
    'name' => $this->member['members_display_name'],
                                                    
    'id'   => $this->member['id'],
                                             );

                    
    $this->ipsclass->DB->simple_construct( array( 'select' => 'sum(weight) as ups',
                                                  
    'from'   => 'reputation',
                                                  
    'where'  => "CODE='01' AND member_id=$memid",
                                           )      );

                    
    $this->ipsclass->DB->simple_exec();

                    
    $row $this->ipsclass->DB->fetch_row();

                    
    $info['ups']   = $row['ups'];
                    
    $info['downs'] = abs ($info['rep'] - $info['ups']);
                    
    $info['all']   = $this->member['rep_all']." ".$this->ipsclass->lang['rep_votes'];

                    
    //-----------------------------------------
                    // use_ranks. It still exists.
                    // Maybe I should remove it :)
                    // Ya, I'll do so next time
                    //-----------------------------------------

                    
    if ($this->use_ranks)
                    {
                            foreach(
    $this->rep_ranks as $k => $v)
                            {
                                    if ( ( 
    $row['rep'] >= and $v['AMOUNT'] >= and $row['rep'] >= $v['AMOUNT'] ) or ( $row['rep'] < and $v['AMOUNT'] < and $row['rep'] <= $v['AMOUNT'] ) )
                                    {
                                            
    $info['rep'] = $this->rep_ranks$k ]['TITLE'];
                                            break;
                                    }
                            }
                    }
                    else
                    {
                            if( ! 
    $info['rep'] )
                            {
                                
    $info['rep'] = ( $info['rep_all'] == ) ? $this->ipsclass->lang['rep_none'] : "0 {$this->ipsclass->lang['rep_postfix']}";
                            }
                            else
                            {
                                
    $info['rep'] .= {$this->ipsclass->lang['rep_postfix']}";
                            }
                    }

                    
    $info['name'] = "<a href='{$this->base_url}showuser={$info['id']}'>".$info['name']."</a>";

                    if (
    $this->ipsclass->vars['rep_memstats'] and $this->ipsclass->member['id'] != $this->member['id'] and strstr','.$this->ipsclass->vars['reputation_allowed'].','','.$this->ipsclass->member['mgroup'].',' ) and ( ! strstr','.$this->ipsclass->member['g_exclude_rep'].','','.$this->member['mgroup'].',' ) )  )
                    {
                            
    $stuff = array( 'mid' => $memid't' => 's' );
                            
    $info['change'] = $this->ipsclass->lang['change'] . " " $this->ipsclass->compiled_templates['skin_ahreputation']->rep_options_links$stuff );
                    }
                    else
                    {
                            
    $info['change'] = "";
                    }

                    
    //-----------------------------------------
                    // Header building complete...
                    //-----------------------------------------

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowTitle($info$this->ipsclass->vars['img_url'].'/folder_editor_images/');
                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowHeader();

                    
    //-----------------------------------------
                    // Main list
                    //-----------------------------------------

                    
    $this->ipsclass->DB->cache_add_query'reputation_mem_stats',
                                          array( 
    'mid'   => $memid,
                                                 
    'st'    => intval($this->ipsclass->input['st']),
                                                 
    'limit' => $this->ipsclass->vars['rep_per_page'],
                                                                    ), 
    'reputation_queries'      );

                    
    $sql $this->ipsclass->DB->simple_exec();

                    if (! 
    $this->ipsclass->DB->get_num_rows($sql) ) $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowNone"colspan='5'" );
                    
                    
    $post_count 0;


                while ( 
    $row $this->ipsclass->DB->fetch_row$sql ) )
                {
                                
                        
    //-----------------------------------------
                        // Multi PIDS?
                        //-----------------------------------------
                        
                        
    if ( $this->ipsclass->member['g_is_supmod'] )
                        {
                            
    $row['pid_start_image'] = $this->ipsclass->compiled_templates['skin_ahreputation']->pid_image($row['msg_id']);
                            
    #print $row['pid_start_image'];
                            
                            
    if ( $this->ipsclass->input['selectedreppids'] )
                            {
                                if ( 
    strstr','.$this->ipsclass->input['selectedreppids'].','','.$row['msg_id'].',' ) )
                                {
                                    
    $row['pid_start_image'] = $this->ipsclass->compiled_templates['skin_ahreputation']->pid_image_selected($row['msg_id']);
                                }
                                
                                
    $this->ipsclass->input['selectedreppidcount'] = countexplode","$this->ipsclass->input['selectedreppids'] ) );
                
                            }
                        }                
                            
    $post_count++;

                            
    $info   $this->parse_stat_info($row);

                            
    //-----------------------------------------
                            // Gonna cache'em all.
                            // I think it should be optimized more deeply
                            //-----------------------------------------
                            
                            
    $author $this->parse_stat_author($row);

                             
    //-----------------------------------------
                             // Hate to say that, but do not cache anonymous
                             //-----------------------------------------
        
                             
    if ( $row['vis'] != )
                             {
                                     
    $author_cache$row['from_id'] ] = $author;
                             }

                            
    //-----------------------------------------
                            // Post weight...
                            //-----------------------------------------

                            
    $row['weight']   = $row['CODE'] == '01'        $row['weight'] : -$row['weight'];

                            
    //-----------------------------------------
                            // Some post related crap :)
                            //-----------------------------------------

                            
    $info['post_css']  = $row['CODE'] == '01' 'repgood' 'repbad';
                            
    $info['post_css'] .= $row['vis'] == 'shaded' '';
                            
    $info['post_css'] .= $post_count '1' '2';

                            
    $info['memid'] = $memid;
                            
    $info $row;
                            
                            
    $css    $post_count 'post1' 'post2'
                            
                    
    $mid intval$row['pp_member_id'] );
                    
                    
    //-----------------------------------------
                    // Ah, anonymous. I'm glad what I'm an admin
                    // and I could see them ;)
                    //-----------------------------------------

                    
    if ($row['vis'] != 0)
                    {
                        
    $author['name'] = "<a href='{$this->base_url}autocom=reputation&amp;CODE=view&amp;mid={$mid}' style='text-decoration: none;'>{$row['members_display_name']}</a>" ;
                    }
                    else
                    {
                        
    $author['name_css'] = 'unreg';

                        if (
    $this->ipsclass->member['g_access_cp'])
                        {
                            
    $author['name'] = "<a href='{$this->base_url}autocom=reputation&amp;CODE=view&amp;mid={$mid}' style='text-decoration: none;'>{$row['members_display_name']}</a>, ";
                        }
                        else
                        {
                            
    $author['name'] = "";
                        }

                        if (
    $row['CODE'] == '01' and $this->ipsclass->vars['rep_good_anon'])
                        {
                                
    $author['name'] .= "{$this->ipsclass->vars['rep_good_anon']}";
                        }
                        else if (
    $row['CODE'] == '02' and $this->ipsclass->vars['rep_bad_anon'])
                        {
                                
    $author['name'] .= "{$this->ipsclass->vars['rep_bad_anon']}";
                        }
                        else
                        {
                                
    $author['name'] .= "{$this->ipsclass->lang['is_anon']}";
                        }
                    }
                                    
                     
    $group_name                $this->ipsclass->make_name_formatted$this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_title'], $row['mgroup'] );
                                    
                    
    $author['member_posts']    = $this->ipsclass->compiled_templates['skin_ahreputation']->members_posts$this->ipsclass->do_number_format$row['posts'] ) );
                    
    $author['avatar']          = $this->ipsclass->get_avatar$row['avatar_location'], $this->ipsclass->member['view_avs'], $row['avatar_size'], $row['avatar_type'] );                   
                    
    $author['member_joined']   = $this->ipsclass->compiled_templates'skin_topic' ]->member_joined$this->ipsclass->get_date$row['joined'], 'JOINED' ) );
                    
    $author['member_group']    = $this->ipsclass->compiled_templates'skin_topic' ]->member_group$group_name );
                    
    $author['member_number']   = $this->ipsclass->compiled_templates'skin_topic' ]->member_number$this->ipsclass->do_number_format($row) );
                    
    $author['profile_icon']    = $this->ipsclass->compiled_templates'skin_topic' ]->member_icon_profile$row );
                    
    $author['message_icon']    = $this->ipsclass->compiled_templates'skin_topic' ]->member_icon_msg$row );
                    
    $author['member_location'] = $row['location'] ? $this->ipsclass->compiled_templates'skin_topic' ]->member_location$row['location'] ) : '';
                    
    $author['email_icon']      = ! $row['hide_email'] ? $this->ipsclass->compiled_templates'skin_topic' ]->member_icon_email$row ) : '';
                    
    $author['id'] = $row['from_id'];
                        
                    
    //-----------------------------------------
                    // Thumbie
                    //-----------------------------------------
            
                    
    if ( ! $row['pp_thumb_photo'] )
                    {
                        
    $author['pp_thumb_photo']  = $this->ipsclass->vars['img_url'].'/folder_profile_portal/pp-blank-thumb.png';
                        
    $author['pp_thumb_width']  = 50;
                        
    $author['pp_thumb_height'] = 50;
                    }
                    else
                    {
                        
    $author['pp_thumb_photo'] = $this->ipsclass->vars['upload_url'] . '/' $row['pp_thumb_photo'];
                    }
            
                    
    //-----------------------------------------
                    // Mini
                    //-----------------------------------------
                        
                    
    $_data $this->ipsclass->scale_image( array( 'max_height' => 25'max_width' => 25'cur_width' => $row['pp_thumb_width'], 'cur_height' => $row['pp_thumb_height'] ) );
            
                    
    $author['pp_mini_photo']  = $author['pp_thumb_photo'];
                    
    $author['pp_mini_width']  = $_data['img_width'];
                    
    $author['pp_mini_height'] = $_data['img_height'];
        
                    
    //-----------------------------------------
                    // Rating
                    //-----------------------------------------
        
                    
    $author['_pp_rating_real'] = intval$row['pp_rating_real'] );                    
            
                    
    //-----------------------------------------
                    // Online, offline?
                    //-----------------------------------------
                    
    list( $be_anon$loggedin ) = explode'&'$row['login_anonymous'] );    
                                        
                    
    $time_limit time() - $this->ipsclass->vars['au_cutoff'] * 60;   
                                         
                    if ( ( 
    $row['last_visit'] > $time_limit or $row['last_activity'] > $time_limit ) AND $be_anon != AND $loggedin == )
                    {
                        
    $member['_online'] = 1;
                    }
                    
                    
                    if ( 
    $this->ipsclass->vars['reputation_allow_edit'] AND $this->ipsclass->member['id'] == $row['from_id'] OR $this->ipsclass->member['g_is_supmod'] )
                    {
                        
    $info['edit_button']        = $this->ipsclass->compiled_templates['skin_ahreputation']->button_edit$row['msg_id'], $this->ipsclass->member['id'] );
                    } 
                    
                    if ( 
    $this->ipsclass->vars['reputation_allow_delete'] AND $this->ipsclass->member['id'] == $row['from_id'] OR $this->ipsclass->member['g_is_supmod'] )
                    {
                        
    $info['delete_button']   = $this->ipsclass->compiled_templates['skin_ahreputation']->button_delete$row );
                    }                     
                
                    
    $author['_pp_online_image'] = $this->ipsclass->compiled_templates['skin_topic']->personal_portal_online_image$member );
            
                    
    $author['reputation']      = $this->ipsclass->compiled_templates['skin_ahreputation']->reputation_level$midrtrim($author['rep']) );                        

                    
    $this->output .= preg_replace "/<!--COMMENT-->/"$info['comment'], $this->ipsclass->compiled_templates['skin_ahreputation']->reputation_row$author$info$css ) );

                    unset (
    $author$info);
                    
                }

                    
    //-----------------------------------------
                    // Printing footer, printing pagelinks...
                    //-----------------------------------------

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowFooter($back);
                  
                    if ( 
    $this->ipsclass->member['g_is_supmod'] )
                    {
                         
    $this->output .= "<br />";
                         
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->mod_panel($this->member['id']);
                    }
                                    
                    if ( 
    $memid !== $this->ipsclass->member['id'] )
                    {
                           
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->qr_links();
                       }
                       
                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Links($links"");
                    
                    
    $show "none";
                
                    
    $sqr = isset($this->ipsclass->member['_cache']['qrep_open']) ? $this->ipsclass->member['_cache']['qrep_open'] : 0;
                
                    if ( 
    $sqr == )
                    {
                        
    $show "show";
                    }
                    
                         
    $info2 = array();
                         
    $info2['rep_act1']  = ($code == '01') ? "checked='1'" "";
                         
    $info2['rep_act2']  = ($code == '02') ? "checked='1'" "";
                         
    $info2['rep_add']   = ( $this->rep_cur_power >= )  ? "+".intval $this->rep_cur_power )  : intval $this->rep_cur_power );
                         
    $info2['rep_minus'] = ( -$this->rep_cur_power >= ) ? "+".intval ( -$this->rep_cur_power ) : intval ( -$this->rep_cur_power );

                         
    $info2['level']  = $level//$this->ipsclass->input['rep_level'];
                         
    $info2['f']      = $this->ipsclass->input['f'];
                         
    $info2['t']      = $this->ipsclass->input['t'];
                         
    $info2['p']      = $this->ipsclass->input['p'];
                         
    $info2['memid']    = $this->member['id'];
                         
    $info2['mem_name'] = $this->member['members_display_name'];
                         
                    
    $this->ipsclass->DB->simple_construct( array ( 'select' => 'sum(weight) as ups',
                                                   
    'from'   => 'reputation',
                                                   
    'where'  => "CODE = '01' AND member_id=".intval($this->ipsclass->input['mid']),
                                                   
    'order'  => 'msg_date DESC' ) );

                    
    $this->ipsclass->DB->simple_exec();

                    
    $r $this->ipsclass->DB->fetch_row();

                    
    $info2['ups']   = $r['ups'];
                    
    $info2['downs'] = abs$level $info2['ups'] );
                    
    $info2['rep']   = $level;
                    
    $info2['all']   = $this->member['rep_all']." ".$this->ipsclass->lang['rep_votes'];                     
                    
                    if ( 
    $memid !== $this->ipsclass->member['id'] )
                    {
                        
    $this->output str_replace"<!--IBF.QUICK_REPLY_CLOSED-->"$this->ipsclass->compiled_templates['skin_ahreputation']->quick_reply_box_closed(), $this->output );                    
                        
    $this->output str_replace"<!--IBF.QUICK_REPLY_OPEN-->"  $this->ipsclass->compiled_templates['skin_ahreputation']->quick_reply_box_open$memid$info2 ), $this->output );                
                    }
                
                    
    $this->nav = array( $this->ipsclass->lang['snav'] );
                    
    $this->page_title $this->ipsclass->lang['stitle'];
            }

            
    //------------------------------------------------------
            // Show reputation changes by this member
            //------------------------------------------------------

            
    function mem_change_stats $memid )
            {
                    
    $author_cache = array();

                    if (! 
    $this->ipsclass->member['g_access_cp'])
                    {
                            
    $pfix "AND vis=1";
                            
    $field "rep_do_open";
                    }
                    else
                    {
                            
    $pfix "";
                            
    $field "rep_do";
                    }

                    
    $this->ipsclass->input['st'] = intval($this->ipsclass->input['st']);

                    
    $links $this->ipsclass->build_pagelinks(  array( 'TOTAL_POSS'  => $this->member$field ],
                                                            
    'PER_PAGE'    => $this->ipsclass->vars['rep_per_page'],
                                                            
    'CUR_ST_VAL'  => intval($this->ipsclass->input['st']),
                                                            
    'L_SINGLE'    => "",
                                                            
    'L_MULTI'     => $this->ipsclass->lang['multi_pages'],
                                                            
    'BASE_URL'    => $this->base_url."autocom=reputation&amp;CODE=04&amp;mid=".$memid,
                                                            )
                                                            );

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Links($links"");

                    
    $info = array(
                                     
    'times' => $this->member$field ],
                                     
    'id'    => $this->member['id'],
                                     
    'name'  => $this->member['members_display_name'],
                                 );

                    
    $this->ipsclass->DB->simple_construct( array( 'select' => 'count(*) AS ups',
                                                  
    'from'   => 'reputation',
                                                  
    'where'  => "CODE='01' AND from_id = ".$memid." ".$pfix,
                                                             )                );
                    
    $this->ipsclass->DB->simple_exec();

                    
    $row $this->ipsclass->DB->fetch_row();

                    
    $info['ups']   = $row['ups'];
                    
    $info['downs'] = $info['times'] - $info['ups'];
                    
    $info['name']  = "<a href='{$this->base_url}showuser={$info['id']}'>{$info['name']}</a>";

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowSelfTitle$info );

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowSelfHeader();

                    
    //-----------------------------------------
                    // I told ya what's this is :)
                    //-----------------------------------------

            //-----------------------------------------
            // Multi PIDS?
            //-----------------------------------------
            
            
    if ( $this->ipsclass->member['is_mod'] )
            {
                
    $row['pid_start_image'] = $this->ipsclass->compiled_templates['skin_ahreputation']->pid_image($row['msg_id']);
                
                if ( 
    $this->ipsclass->input['selectedreppids'] )
                {
                    if ( 
    strstr','.$this->ipsclass->input['selectedreppids'].','','.$row['msg_id'].',' ) )
                    {
                        
    $row['pid_start_image'] = $this->ipsclass->compiled_templates['skin_ahreputation']->pid_image_selected($row['msg_id']);
                    }
                    
                    
    $this->ipsclass->input['selectedreppidcount'] = countexplode","$this->ipsclass->input['selectedreppids'] ) );

                }
            }

                    
    $this->ipsclass->DB->cache_add_query'reputation_mem_change_stats',
                                          array( 
    'mid'   => $memid,
                                                 
    'pfix'  => $pfix,
                                                 
    'st'    => intval($this->ipsclass->input['st']),
                                                 
    'limit' => $this->ipsclass->vars['rep_per_page'],
                                                                    ), 
    'reputation_queries'      );
                    
    $req $this->ipsclass->DB->simple_exec();

                    if (! 
    $this->ipsclass->DB->get_num_rows$req ) ) $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowNone();

                    
    $post_count 0;

                    while ( 
    $row $this->ipsclass->DB->fetch_row$req ) )
                    {
                            
    $post_count++;

                            
    $info   $this->parse_stat_info($row);

                            
    //-----------------------------------------
                            // Still caching...
                            //-----------------------------------------

                            
    if ( isset($author_cache$row['member_id'] ]) and $row['vis'] != )
                            {
                                 
    $author $author_cache[$row['member_id']];
                            }
                            else
                            {
                                 
    $author $this->parse_stat_author($row1);
                                 if ( 
    $row['vis'] != )
                                 {
                                      
    $author_cache$row['member_id'] ] = $author;
                                 }
                            }

                            
    //-----------------------------------------
                            // Post weight...
                            //-----------------------------------------

                            
    $row['weight']   = $row['CODE'] == '01'        $row['weight'] : -$row['weight'];
                            
    $author['name'] .= " (".( $row['weight'] >= 0  "+" "").$row['weight'].")";

                            
    $info['post_css']  = $row['CODE'] == '01' 'repgood' 'repbad';
                            
    $info['post_css'] .= $row['vis'] == 0     'shaded' '';
                            
    $info['post_css'] .= $post_count 2      '1' '2';

                            
    $info['memid'] = $memid;

                            
    $this->output .= preg_replace "/<!--COMMENT-->/"$info['comment'], $this->ipsclass->compiled_templates['skin_ahreputation']->ShowRow$author$info ) );

                            unset (
    $author$info);
                    }

                    
    $back "{$this->base_url}showtopic=".intval($this->ipsclass->input['t']);

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowFooter($back);

                    if ( 
    $this->ipsclass->member['g_access_cp'] )
                    {
                         
    $this->output .= "<br />";
                         
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->mod_panel($this->member['id']);
                    }

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Links($links"");

                    
    $this->nav        = array( $this->ipsclass->lang['snav'] );
                    
    $this->page_title $this->ipsclass->lang['stitle'];
            }

            
    //------------------------------------------------------
            // Build reputation post
            //------------------------------------------------------

            
    function parse_stat_info($row)
            {
                    
    $info = array();

                    switch (
    $row['CODE'])
                    {
                            case 
    '01':
                                    
    $info['img'] = $this->ipsclass->vars['img_url']."/r_up.gif";
                                    break;
                            case 
    '02':
                                    
    $info['img'] = $this->ipsclass->vars['img_url']."/r_down.gif";
                                    break;
                    }

                    
    //-----------------------------------------
                    // Yeah, I love dat lil' page icon
                    //-----------------------------------------

                    
    $info['new_post'] = "<img src='style_images/<#IMG_DIR#>/to_post_off.gif' alt='post' border='0' style='padding-bottom:2px;' />";

                    if ( 
    $info['date'] > $this->ipsclass->member['last_visit'] )
                    {
                           
    $info['new_post'] = "<img src='style_images/<#IMG_DIR#>/to_post.gif' alt='post' border='0' style='padding-bottom:2px;' />";
                    }

                    
    $info['date'] = $this->ipsclass->get_date($row['msg_date'], 'LONG');
                    
    $info['message']            = $this->postlib->parser->pre_display_parse$row['message'] );
                    
    $info['message']            = str_replace("<#IMG_DIR#>"$this->ipsclass->skin['_imagedir'], $row['message']);
                    
    $info['message']            = str_replace("<#EMO_DIR#>"$this->ipsclass->skin['_emodir'], $row['message']);

                    
    //-----------------------------------------
                    // Switch - if rep was changed in topic, in profile or right here
                    //-----------------------------------------

                    
    if ($row['topic_id'] == '0' and $row['extra'] == 'profile')
                    {
                            
    $info['url']   = $this->base_url."showuser=".$row['member_id'] ;
                            
    $info['title'] = $this->ipsclass->lang['profile'];
                    }
                    else if (
    $row['topic_id'] == '0' and $row['extra'] == 'stats')
                    {
                            
    $info['url']   = $this->base_url."autocom=reputation&CODE=03&mid=".$row['member_id']."&t=s";
                            
    $info['title'] = $this->ipsclass->lang['stats'];
                    }
                    else
                    {
                            
    $info['title'] = $row['title'];
                            
    $info['url']   = $this->base_url."showtopic=".$row['topic_id']."&view=findpost&p=".$row['post'];

                            if ( 
    trim($info['title']) == "" )
                            {
                                    
    $info['title'] = "<font color='grey'>{$this->ipsclass->lang['no_topic']}</font>";
                                    
    $info['url']   = "#";
                            }
                    }
                    
                    
    $info['msg_id']  = $row['msg_id'];

                    
    //-----------------------------------------
                    // New style comments
                    // Actually I'm too lazy to make new
                    // table for them.
                    // Seems like theIggs was too lazy for that
                    // too (or just more wiser, who knows :)).
                    // So I just keepin' all the data serialized
                    //-----------------------------------------

                    
    $row['comment'] = unserialize(stripslashes($row['comment']));

                    if (
    $row['comment']['content'] != '')
                    {
                            
    $info['comment_date'] = $this->ipsclass->get_date($row['comment']['date'], 'LONG');
                            
    $row['comment']['name_css'] = "normalname";

                            
    $info['comment'] = $this->ipsclass->compiled_templates['skin_ahreputation']->showcomment($row['msg_id'], $row['comment'], $info['comment_date']);
                    }

                    
    //-----------------------------------------
                    // Oh, just got some good point for this:
                    // New table could cause more queries :)
                    //-----------------------------------------

                    //-----------------------------------------
                    // Buttons (not from topics.php ;))
                    //-----------------------------------------

                    //-----------------------------------------
                    // Reply (comment)
                    //-----------------------------------------

                    
    if ($this->ipsclass->member['id'] == $row['member_id'] AND $this->ipsclass->vars['rep_allow_comments'] )
                    {
                        
    $info['reply_button'] = $this->ipsclass->compiled_templates['skin_ahreputation']->button_reply$row['msg_id'] );
                    }
                    else
                    {
                        
    $info['reply_button'] = "";
                    }

                    
    //-----------------------------------------
                    // Edit
                    //-----------------------------------------

                    
    if ( $this->ipsclass->member['g_is_supmod'] or ($row['from_id'] == $this->ipsclass->member['id'] and $this->ipsclass->member['g_edit_posts']) )
                    {
                        
    $info['edit_button'] = $this->ipsclass->compiled_templates['skin_ahreputation']->button_edit$row['msg_id'], $row['member_id'] );

                        if ( (
    $this->ipsclass->member['g_edit_cutoff'] > and $this->ipsclass->member['g_is_supmod'] < 1) and ( $row['msg_date'] <= ( time() - ( intval($this->ipsclass->member['g_edit_cutoff']) * 60 ) ) ) )
                        {
                            
    $info['edit_button'] = "";
                        }
                    }

                    
    //-----------------------------------------
                    // Delete
                    //-----------------------------------------

                    //-----------------------------------------
                    // Multi PIDS?
                    //-----------------------------------------

            
    if ( $this->ipsclass->member['is_mod'] )
            {
                
    $info['pid_start_image'] = $this->ipsclass->compiled_templates['skin_ahreputation']->pid_image($row['msg_id']);
                
                
    $info['delete_button'] = $this->ipsclass->compiled_templates['skin_ahreputation']->button_delete($row);
                
                if ( 
    $this->ipsclass->input['selectedreppids'] )
                {
                    if ( 
    strstr','.$this->ipsclass->input['selectedreppids'].','','.$row['msg_id'].',' ) )
                    {
                        
    $row['pid_start_image'] = $this->ipsclass->compiled_templates['skin_ahreputation']->pid_image_selected($row['msg_id']);
                    }
                    
                    
    $this->ipsclass->input['selectedreppidcount'] = countexplode","$this->ipsclass->input['selectedreppids'] ) );

                }
            }

                    return 
    $info;
            }

            
    //------------------------------------------------------
            // Build reputation post's author info
            //------------------------------------------------------

            
    function parse_stat_author($row$by=0)
            {
                    
    $author                    = array();
                    
                    
    //-----------------------------------------
                    // Grab all data...
                    //-----------------------------------------
            
    #                $author = $this->personal_function_load_member( $row['member_id'] );           

                    //-----------------------------------------
                    // Author info
                    // Getting name of the member that changed rep
                    //-----------------------------------------

                    
    $mid            $by == $row['id'] : $row['id'];
                    
    $author['name'] = $by != $this->ipsclass->lang['whom'].": " '';
                    
    $code           $by == 'CODE=04' 'CODE=03';
                    
    $author['name_css'] = 'normalname';
                    
    $author['name'] = $row['members_display_name']; 
                     
    $group_name     $this->ipsclass->make_name_formatted$this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_title'], $row['mgroup'] );
                                  

                    
    //-----------------------------------------
                    // Ah, anonymous. I'm glad what I'm an admin
                    // and I could see them ;)
                    //-----------------------------------------

                    
    if ($row['vis'] != 0)
                    {
                         
    $author['name'] = "<a href='{$this->base_url}autocom=reputation&{$code}&amp;mid={$mid}'>{$row['members_display_name']}</a>" ;
                    }
                    else
                    {
                        
    $author['name_css'] = 'unreg';

                        if (
    $this->ipsclass->member['g_access_cp'])
                        {
                            
    $author['name'] = "<a href='{$this->base_url}autocom=reputation&{$code}&amp;mid={$mid}'>{$row['members_display_name']}</a>, ";
                        }
                        else
                        {
                            
    $author['name'] = "";
                        }

                        if (
    $row['CODE'] == '01' and $this->ipsclass->vars['rep_good_anon'])
                        {
                                
    $author['name'] .= "{$this->ipsclass->vars['rep_good_anon']}";
                        }
                        else if (
    $row['CODE'] == '02' and $this->ipsclass->vars['rep_bad_anon'])
                        {
                                
    $author['name'] .= "{$this->ipsclass->vars['rep_bad_anon']}";
                        }
                        else
                        {
                                
    $author['name'] .= "{$this->ipsclass->lang['is_anon']}";
                        }
                    }

                    
    //-----------------------------------------
                    // Oh, no, not anonymous again!
                    //-----------------------------------------

                    
    if ($row['vis'] != or $this->ipsclass->member['g_access_cp'])
                    {
                        
    $author['member_posts']    = $this->ipsclass->compiled_templates['skin_ahreputation']->members_posts$this->ipsclass->do_number_format$row['posts'] ) );

                        
    $author['avatar']          = $this->ipsclass->get_avatar$row['avatar_location'], $this->ipsclass->member['view_avs'], $row['avatar_size'], $row['avatar_type'] );
                       
                        
    $author['member_joined']   = $this->ipsclass->compiled_templates'skin_topic' ]->member_joined$this->ipsclass->get_date$row['joined'], 'JOINED' ) );
                        
    $author['member_group']    = $this->ipsclass->compiled_templates'skin_ahreputation' ]->member_group$group_name );
                        
    $author['member_number']   = $this->ipsclass->compiled_templates'skin_ahreputation' ]->member_number$this->ipsclass->do_number_format($row['id']) );
                        
    $author['profile_icon']    = $this->ipsclass->compiled_templates'skin_topic' ]->member_icon_profile$row['id'] );
                        
    $author['message_icon']    = $this->ipsclass->compiled_templates'skin_topic' ]->member_icon_msg$row['id'] );
                        
    $author['member_location'] = $row['location'] ? $this->ipsclass->compiled_templates'skin_topic' ]->member_location$row['location'] ) : '';
                        
    $author['email_icon']      = ! $row['hide_email'] ? $this->ipsclass->compiled_templates'skin_topic' ]->member_icon_email$row['id'] ) : '';
                        
    $author['addresscard']     = $row['id'] ? $this->ipsclass->compiled_templates'skin_topic' ]->member_icon_vcard$row['id'] ) : '';
                                    

                        if ( 
    $mid )
                        {
                            
    $author['addresscard'] = $this->ipsclass->compiled_templates['skin_ahreputation']->member_icon_vcard$mid );
                        }
                        
                        
    $author['id'] = $row['member_id'];
                        
                        
    //-----------------------------------------
                        // Thumbie
                        //-----------------------------------------
            
                        
    if ( ! $row['pp_thumb_photo'] )
                        {
                            
    $author['pp_thumb_photo']  = $this->ipsclass->vars['img_url'].'/folder_profile_portal/pp-blank-thumb.png';
                            
    $author['pp_thumb_width']  = 50;
                            
    $author['pp_thumb_height'] = 50;
                        }
                        else
                        {
                            
    $author['pp_thumb_photo'] = $this->ipsclass->vars['upload_url'] . '/' $row['pp_thumb_photo'];
                        }
            
                        
    //-----------------------------------------
                        // Mini
                        //-----------------------------------------
                        
                        
    $_data $this->ipsclass->scale_image( array( 'max_height' => 25'max_width' => 25'cur_width' => $row['pp_thumb_width'], 'cur_height' => $row['pp_thumb_height'] ) );
            
                        
    $author['pp_mini_photo']  = $author['pp_thumb_photo'];
                        
    $author['pp_mini_width']  = $_data['img_width'];
                        
    $author['pp_mini_height'] = $_data['img_height'];
            
                        
    //-----------------------------------------
                        // Rating
                        //-----------------------------------------
            
                        
    $author['_pp_rating_real'] = intval$row['pp_rating_real'] );                    

                        
    //-----------------------------------------
                        // Online, offline?
                        //-----------------------------------------
                        
    list( $be_anon$loggedin ) = explode'&'$row['login_anonymous'] );    
                                        
                        
    $time_limit time() - $this->ipsclass->vars['au_cutoff'] * 60;   
                                         
                        if ( ( 
    $row['last_visit'] > $time_limit or $row['last_activity'] > $time_limit ) AND $be_anon != AND $loggedin == )
                        {
                            
    $member['_online'] = 1;
                        }
                
                        
    $author['_pp_online_image'] = $this->ipsclass->compiled_templates['skin_topic']->personal_portal_online_image$member );

                        
    $author += $this->build_ranks $row );

                        
    $author['reputation']      = $this->ipsclass->compiled_templates['skin_ahreputation']->reputation_level$midrtrim($author['rep']) );
                    }

                    return 
    $author;
            }

            
    //------------------------------------------------------
            // Build pips and reputation ranks
            //------------------------------------------------------

            
    function build_ranks$row )
            {
                     
    $ret  = array();
                     
    $pips 0;
                     
    $pip  = array();
                     
    $pip['img'] = 0;

                     
    $ret['title'] = $row['m_title'];

                     
    //-----------------------------------------
                     // Normal member titles and pips
                     // Guess where did they come from?
                     //-----------------------------------------

                     
    foreach($this->mem_titles as $k => $v)
                     {
                                if (
    $row['posts'] >= $v['POSTS'])
                                {
                                    if (!
    $row['m_title'])
                                    {
                                         
    $ret['title'] = $this->mem_titles$k ]['TITLE'];
                                    }

                                    
    $pips $this->mem_titles$k ]['PIPS'];

                                    break;
                                }
                     }

                     
    //-----------------------------------------
                     // And this is reputation ranks...
                     //-----------------------------------------

                     
    foreach($this->rep_mem_titles as $k => $v)
                     {
                             if ( ( 
    $row['rep'] >= and $k >= and $row['rep'] >= $k ) or ( $row['rep'] < and $k and $row['rep'] <= $k ) )
                             {
                                   if ( !
    $row['m_title'] )
                                   {
                                        
    $ret['title'] = str_replace "{title}"$ret['title'], $v );
                                   }

                                   break;
                             }
                     }

                     
    //-----------------------------------------
                     // ... and reputation pips
                     //-----------------------------------------

                     
    if ( ( $this->ipsclass->vars['rep_rep_pips'] or $this->ipsclass->vars['rep_show_type'] ) and is_array($this->rep_ranks) )
                     {
                            foreach(
    $this->rep_ranks as $k => $v)
                            {
                                    if ( ( 
    $row['rep'] >= and $v['AMOUNT'] >= and $row['rep'] >= $v['AMOUNT'] ) or ( $row['rep'] < and $v['AMOUNT'] < and $row['rep'] <= $v['AMOUNT'] ) )
                                    {
                                        
    $pip['title'] = $this->rep_ranks$k ]['TITLE'];
                                        
    $pip['img']   = $this->rep_ranks$k ]['PIPS'];
                                        
    $pip['code']  = $this->rep_ranks$k ]['CODE'];

                                        break;
                                    }
                            }
                     }

                     
    //-----------------------------------------
                     // Reputation pips or post pips?
                     //-----------------------------------------

                     
    if ($this->ipsclass->vars['rep_rep_pips'] and is_array($this->rep_ranks))
                     {
                            if ( 
    $pip['img'] )
                            {
                                 if ( 
    is_numeric$pip['img'] ) )
                                 {
                                      
    $star $pip['code'] == '01' "<{R_STAR_GOOD}>" "<{R_STAR_BAD}>";

                                      for (
    $i 1$i <= $pip['img']; ++$i)
                                      {
                                           
    $ret['member_rank_img'] .= $star;
                                      }
                                 }
                                 else
                                 {
                                     
    $ret['member_rank_img'] = $this->ipsclass->compiled_templates['skin_ahreputation']->member_rank_img'style_images/<#IMG_DIR#>/folder_team_icons/'.$pip['img'] );
                                 }
                            }
                     }
                     
    //-----------------------------------------
                     // And why I wrote all of this above
                     // if YOU using post related pips?
                     //-----------------------------------------
                     
    else
                     {
                            if ( 
    $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_icon'] )
                            {
                                 
    $ret['member_rank_img'] = $this->ipsclass->compiled_templates['skin_ahreputation']->member_rank_img($this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_icon']);
                            }
                            else if ( 
    $pips )
                            {
                                 if ( 
    is_numeric$pips ) )
                                 {
                                    for (
    $i 1$i <= $pips; ++$i)
                                    {
                                            
    $ret['member_rank_img'] .= "<{A_STAR}>";
                                    }
                                 }
                                 else
                                 {
                                    
    $ret['member_rank_img'] = $this->ipsclass->compiled_templates['skin_ahreputation']->member_rank_img'style_images/<#IMG_DIR#>/folder_team_icons/'.$pips );
                                 }
                            }
                     }

                     
    //-----------------------------------------
                     // Ah, reputation bar!
                     //-----------------------------------------

                     
    if ( $row['rep'] > $this->ipsclass->vars['rep_max'] )
                     {
                          
    $rep_amount $this->ipsclass->vars['rep_max'];
                     }
                     else if ( 
    $row['rep'] < $this->ipsclass->vars['rep_min'] )
                     {
                          
    $rep_amount $this->ipsclass->vars['rep_min'];
                     }
                     else
                     {
                          
    $rep_amount $row['rep'];
                     }

                     if ( 
    $this->ipsclass->vars['rep_level_type'] == )
                     {
                                 
    $ret['rep_img']  = "<{REP_";
                                 
    $ret['rep_img'] .= $rep_amount "G_" "";
                                 
    $ret['rep_img'] .= $rep_amount "B_" "";
                                 
    $ret['rep_img'] .= abs ceil $rep_amount / ( ( $rep_amount >= $this->ipsclass->vars['rep_max'] : $this->ipsclass->vars['rep_min'] ) / ) ) );
                                 
    $ret['rep_img'] .= "}>";
                     }
                     else if ( 
    $this->ipsclass->vars['rep_level_type'] == )
                     {
                                 
    $ret['rep_img']  = " ( ".abs $rep_amount sprintf"%.0f", ( ($rep_amount / ( $rep_amount >= $this->ipsclass->vars['rep_max'] : $this->ipsclass->vars['rep_min'] )) * 100) ) : )."% ";
                                 
    $ret['rep_img'] .= $rep_amount $this->ipsclass->lang['rep_good'] : "";
                                 
    $ret['rep_img'] .= $rep_amount $this->ipsclass->lang['rep_bad'] : "";
                                 
    $ret['rep_img'] .= " ) ";
                     }

                     if ( 
    $this->ipsclass->vars['rep_memstats'] and $this->ipsclass->vars['reputation_on'] )
                     {
                                 if ( 
    strstr','.$this->ipsclass->vars['reputation_allowed'].','','.$this->ipsclass->member['mgroup'].',' ) and $row['id'] and $this->ipsclass->member['id'] != $row['id'] and $this->ipsclass->member['posts'] >= $this->ipsclass->vars['rep_posts'] )
                                 {
                                         
    $ret['rep_add']   = "<a href='{$this->base_url}autocom=reputation&amp;CODE=01&amp;mid={$row['id']}&amp;t=s' title='+'><{REPUTATION_ADD}></a>";
                                         
    $ret['rep_minus'] = "<a href='{$this->base_url}autocom=reputation&amp;CODE=02&amp;mid={$row['id']}&amp;t=s' title='-'><{REPUTATION_MINUS}></a>";
                                 }
                     }

                     
    //-----------------------------------------
                     // Lets work on reputation ranks
                     //-----------------------------------------

                     
    if ( $this->ipsclass->vars['rep_show_type'] > and is_array($this->rep_ranks) )
                     {
                             if ( 
    $this->ipsclass->vars['rep_show_type'] == )
                             {
                                  
    $ret['rep'] = $pip['title'] != "" $pip['title'] : $this->ipsclass->lang['rep_none'];
                             }
                             else
                             {
                                 if( ! 
    $row['rep'] )
                                 {
                                     
    $row['rep'] = ( $row['rep_all'] == ) ? $this->ipsclass->lang['rep_none'] : "0 {$this->ipsclass->lang['rep_postfix']}";
                                 }
                                 else
                                 {
                                     
    $row['rep'] .= {$this->ipsclass->lang['rep_postfix']}";
                                 }
                                 
    $row['rep']  = trim ($row['rep']);
                                 
    $ret['rep']  = "{$pip['title']} ({$row['rep']})";
                             }
                     }
                     else
                     {
                            if( ! 
    $row['rep'] )
                            {
                                
    $ret['rep'] = ( $row['rep_all'] == ) ? $this->ipsclass->lang['rep_none'] : "0 {$this->ipsclass->lang['rep_postfix']}";
                            }
                            else
                            {
                                
    $ret['rep'] = $row['rep'].{$this->ipsclass->lang['rep_postfix']}";
                            }
                     }

                     return 
    $ret;
            }

            
    //------------------------------------------------------
            // Remove reputation entry, admin only
            //------------------------------------------------------

            
    function delete()
            {
                    if (! 
    $this->ipsclass->member['g_access_cp'])
                    {
                            
    $this->ipsclass->Error( array( LEVEL => 1MSG => 'moderate_no_permission' ) );
                    }

                    if ( 
    $this->ipsclass->input['selectedreppids'] )
                    {
                            
    $pid explode (","$this->ipsclass->input['selectedreppids']);
                    }
                    else
                    {
                            
    $pid $this->ipsclass->input['id'];
                    }

                    
    $this->do_delete $pid );

                    
    $this->ipsclass->print->redirect_screen($this->ipsclass->lang['del_success'], "autocom=reputation&CODE=03&mid=".$this->member['id'] );

                    break;
            }

            
    //------------------------------------------------------
            // Remove selected reputation entries
            //------------------------------------------------------

            
    function do_delete $pid )
            {
                    
    $to_member   = array();
                    
    $from_member = array();

                if ( 
    is_array$pid ) )
                {
                    
    // Better safe than sorry - this should have already been done though
                    
    $pid $this->ipsclass->clean_int_array$pid );
                
                    if ( 
    count($pid) > )
                    {
                        
    $pids " IN(".implode(",",$pid).")";
                    }
                    else
                    {
                            return 
    FALSE;
                    }
                }
                else
                {
                    if ( 
    intval($pid) )
                    {
                        
    $pids   "=$pid";
                    }
                    else
                    {
                        return 
    FALSE;
                    }
                }

                     
    $this->ipsclass->DB->simple_construct( array( 'select' => '*',
                                                  
    'from'   => 'reputation',
                                                  
    'where'  => "msg_id".$pids,
                                           )                );

                    
    $outer $this->ipsclass->DB->simple_exec();

                    
    //------------------------------------------------------
                    // I dunno, if this helps, just tryin' to reduce queries
                    //------------------------------------------------------

                    
    while ( $row $this->ipsclass->DB->fetch_row $outer ) )
                    {
                           if (
    $row['CODE'] == '01')
                           {
                               
    $to_member[$row['member_id']]['rep'] -= $row['weight'];
                               
    $to_member[$row['member_id']]['rep_all'] -= 1;
                           }
                           else
                           {
                               
    $to_member[$row['member_id']]['rep'] += $row['weight'];
                               
    $to_member[$row['member_id']]['rep_all'] -= 1;
                           }

                           
    $from_member[$row['from_id']]['rep_do'] -= 1;
                           if (
    $row['vis']) $from_member[$row['from_id']]['rep_do_open'] -= 1;
                    }

                    
    //------------------------------------------------------
                    // You may ask, why are we changing rep by weight
                    // and rep_do_* and rep_all only by 1?
                    // This is because rep contains total rating
                    // and others just contains how many people did that.
                    //------------------------------------------------------

                    
    foreach ( $to_member as $k => $v )
                    {
                            
    //------------------------------------------------------
                            // Build'em all slowly
                            //------------------------------------------------------

                            
    $query  'rep=rep'. ( $v['rep'] >= "+".intval($v['rep']) : intval($v['rep']) );
                            
    $query .= ', rep_all=rep_all'. ( $v['rep_all'] >= "+".intval($v['rep_all']) : intval($v['rep_all']) );

                            if ( 
    $from_member[$k]['rep_do'] != )
                            {
                                 
    $query .= ', rep_do=rep_do'. ( $from_member[$k]['rep_do'] >= "+".intval($from_member[$k]['rep_do']) : intval($from_member[$k]['rep_do']) );
                                 
    $from_member[$k]['rep_do'] = 0;
                            }

                            if ( 
    $from_member[$k]['rep_do_open'] != )
                            {
                                 
    $query .= ', rep_do_open=rep_do_open'. ( $from_member[$k]['rep_do_open'] >= "+".intval($from_member[$k]['rep_do_open']) : intval($from_member[$k]['rep_do']) );
                                 
    $from_member[$k]['rep_do_open'] = 0;
                            }

                            
    //------------------------------------------------------
                            // Exe.cute 'em
                            //------------------------------------------------------

                            
    $this->ipsclass->DB->simple_exec_query ( array ( 'update' => 'members''set' => $query'where' => 'id='.$k ) );
                    }

                    foreach ( 
    $from_member as $k => $v )
                    {
                            
    $query 'rep_do=rep_do'. ( $v['rep_do'] >= "+".intval($v['rep_do']) : intval($v['rep_do']) );

                            if ( 
    $v['rep_do_open'] != )
                            {
                                 
    $query .= ', rep_do_open=rep_do_open'. ( $v['rep_do_open'] >= "+".intval($v['rep_do_open']) : intval($v['rep_do']) );
                            }

                            
    $this->ipsclass->DB->simple_exec_query ( array ( 'update' => 'members''set' => $query'where' => 'id='.$k ) );
                    }

                    
    $this->ipsclass->DB->simple_exec_query ( array ( 'delete' => 'reputation''where' => 'msg_id'.$pids ) );
            }

            
    //------------------------------------------------------
            // Showing board overall stats
            //------------------------------------------------------

            
    function totals()
            {
                    
    $times 'rep_do';
                    if (!
    $this->ipsclass->member['g_access_cp']) $times .= '_open';

                    
    $sort_key = array( 'name'     => 'sort_by_name',
                                       
    'rep'      => 'sort_by_rep',
                                       
    $times     => 'sort_by_rep_changes',
                                                     );

                    
    $max_results = array( 10  => '10',
                                          
    20  => '20',
                                          
    30  => '30',
                                          
    40  => '40',
                                          
    50  => '50',
                                                      );

                    
    $sort_order = array( 'desc' => 'descending_order',
                                         
    'asc'  => 'ascending_order',
                                                            );

                    if (
    $this->ipsclass->member['g_mem_info'] != 1)
                    {
                            
    $this->ipsclass->Error( array( 'LEVEL' => 1'MSG' => 'no_permission' ) );
                    }

                    if (isset(
    $this->ipsclass->input['max_results']))
                    {
                            
    $this->max_results intval($this->ipsclass->input['max_results']);
                    }
                    else
                    {
                            
    $this->max_results 30;
                    }

                    if (isset(
    $this->ipsclass->input['st']))
                    {
                            
    $this->first       intval($this->ipsclass->input['st']);
                    }
                    else
                    {
                            
    $this->first       0;
                    }

                    if (isset(
    $this->ipsclass->input['sort_key']))
                    {
                            
    $this->sort_key    $this->ipsclass->input['sort_key'];
                    }
                    else
                    {
                            
    $this->sort_key    'rep';
                    }

                    if (isset(
    $this->ipsclass->input['sort_order']))
                    {
                            
    $this->sort_order  $this->ipsclass->input['sort_order'];
                    }
                    else
                    {
                            
    $this->sort_order  'desc';
                    }

                    
    $sort_key_html    "<select name='sort_key' class='forminput'>\n";
                    
    $max_results_html "<select name='max_results' class='forminput'>\n";
                    
    $sort_order_html  "<select name='sort_order' class='forminput'>\n";

                    foreach (
    $sort_order as $k => $v)
                    {
                            
    $sort_order_html .= $k == $this->sort_order "<option value='$k' selected>" $this->ipsclass->lang$sort_order$k ] ] . "\n"
                                                                                                                    
    "<option value='$k'>"          $this->ipsclass->lang$sort_order$k ] ] . "\n";
                    }

                    foreach (
    $sort_key as $k => $v)
                    {
                            
    $sort_key_html .= $k == $this->sort_key "<option value='$k' selected>"     $this->ipsclass->lang$sort_key$k ] ] . "\n"
                                                                                                            
    "<option value='$k'>"              $this->ipsclass->lang$sort_key$k ] ] . "\n";
                    }

                    foreach (
    $max_results as $k => $v)
                    {
                            
    $max_results_html .= $k == $this->max_results "<option value='$k' selected>"$max_results$k ] . "\n"
                                                                                                                      
    "<option value='$k'>"         $max_results$k ] . "\n";
                    }

                    
    $this->ipsclass->lang['sorting_text'] = preg_replace"/<#SORT_KEY#>/"    $sort_key_html."</select>"   $this->ipsclass->lang['sorting_text'] );
                    
    $this->ipsclass->lang['sorting_text'] = preg_replace"/<#SORT_ORDER#>/"  $sort_order_html."</select>" $this->ipsclass->lang['sorting_text'] );
                    
    $this->ipsclass->lang['sorting_text'] = preg_replace"/<#MAX_RESULTS#>/" $max_results_html."</select>"$this->ipsclass->lang['sorting_text'] );

                    
    $error 0;

                    if (! isset(
    $sort_key$this->sort_key ]) )       $error 1;
                    if (! isset(
    $sort_order$this->sort_order ]) )   $error 1;
                    if (! isset(
    $max_results$this->max_results ]) ) $error 1;

                    if (
    $error == )
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 5MSG =>'incorrect_use') );
                    }

                    
    //-----------------------------------------
                    // Getting new since your last visit
                    //-----------------------------------------

                    
    $new_reps $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(DISTINCT(member_id)) AS total_members',
                                                               
    'from'   => 'reputation',
                                                               
    'where'  => "msg_date > ".$this->ipsclass->member['last_visit']
                                                                                      )                  );

                    if (
    $new_reps['total_members'] > 0)
                    {
                            
    $new "<a href='{$this->base_url}autocom=reputation&amp;CODE=getnew'>{$this->ipsclass->lang['new']}</a>";
                    }
                    else
                    {
                            
    $new "";
                    }

                    if (
    $this->ipsclass->vars['rep_mems_limit'] > 0)
                    {
                            
    $max['total_members'] = $this->ipsclass->vars['rep_mems_limit'];

                            if (
    $this->first >= $this->ipsclass->vars['rep_mems_limit']) $this->first 0;

                            if (
    $this->first $this->max_results $this->ipsclass->vars['rep_mems_limit'])
                            {
                                    
    $max_results $this->ipsclass->vars['rep_mems_limit'] - $this->first;
                            }
                            else
                            {
                                    
    $max_results $this->max_results;
                            }
                    }
                    else
                    {

                            
    $max $this->ipsclass->DB->simple_exec_query( array( 'select' => 'COUNT(*) AS total_members',
                                                                  
    'from'   => 'members',
                                                                  
    'where'  => "id > 0"
                                                                                     
    )                );
                            
    $this->ipsclass->DB->free_result();

                            
    $max_results $this->max_results;
                    }

                    
    $links $this->ipsclass->build_pagelinks(  array( 'TOTAL_POSS'   => $max['total_members'],
                                                            
    'PER_PAGE'     => $this->max_results,
                                                            
    'CUR_ST_VAL'   => $this->first,
                                                            
    'L_SINGLE'     => "",
                                                            
    'L_MULTI'      => $this->ipsclass->lang['multi_pages'],
                                                            
    'BASE_URL'     => $this->base_url."autocom=reputation&amp;CODE=totals&max_results={$this->max_results}&sort_order={$this->sort_order}&sort_key={$this->sort_key}"
                                                                              
    )                   );

                    
    $this->output $this->ipsclass->compiled_templates['skin_ahreputation']->Links$links$new );

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->StatsLinks($this->ipsclass->lang['btitle']);

                    
    //------------------------------------------------------
                    // Main list
                    //------------------------------------------------------

                    
    $this->ipsclass->DB->simple_construct( array( 'select' => 'members_display_name, posts, mgroup, id, rep, rep_all, allow_rep, allow_anon, '.$times.' AS times',
                                                  
    'from'   => 'members',
                                                  
    'where'  => "id > 0",
                                                  
    'order'  => $this->sort_key." ".$this->sort_order,
                                                  
    'limit'  => array($this->first,$max_results)
                                                             )                );

                    
    $newq $this->ipsclass->DB->simple_exec();

                    while (
    $row $this->ipsclass->DB->fetch_row($newq) )
                    {
                            unset (
    $member);

                            
    $member['name'] = "<a href='{$this->base_url}showuser={$row['id']}'><b>{$row['members_display_name']}</b></a>" ;

                            if (
    $this->ipsclass->member['g_access_cp'])
                            {
                                    if (! 
    $row['allow_rep'] )
                                    {
                                            
    $member['name'] .= " ".$this->ipsclass->lang['disallow_rep'];
                                    }
                                    else
                                    {
                                            if (
    $this->ipsclass->vars['rep_allow_anon'])
                                            {
                                                    if ( 
    $row['allow_anon'] and $row['posts'] >= $this->ipsclass->vars['rep_anon_posts'] ) $member['name'] .= " ".$this->ipsclass->lang['allow_anon'];
                                                    else 
    $member['name'] .= " ".$this->ipsclass->lang['disallow_anon'];
                                            }
                                    }
                            }

                            
    $member += $this->build_ranks$row );

                            
    $member['group'] = $this->ipsclass->cache['group_cache'][$row['mgroup']]['g_title'];

                            
    $member['rep']  .= " <a href='{$this->base_url}autocom=reputation&CODE=03&mid={$row['id']}'>{$this->ipsclass->lang['details']}</a>";

                            if (empty(
    $row['times']))
                            {
                                
    $member['times'] = $this->ipsclass->lang['no_changes'];
                            }
                            else
                            {
                                
    $member['times'] .= "{$row['times']} {$this->ipsclass->lang['rep_postfix']}".
                                                     
    " <a href='{$this->base_url}autocom=reputation&amp;CODE=04&amp;mid={$row['id']}'>{$this->ipsclass->lang['details']}</a>";
                            }

                            
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowTotalsRow($member);
                    }

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Page_end();

                    
    $back "javascript:history.go(-1)";

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowFooter($back);

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Links$links$new );

                    
    $this->nav        = array( $this->ipsclass->lang['bnav'] );
                    
    $this->page_title $this->ipsclass->lang['btitle'];
            }

            
    //------------------------------------------------------
            // Get new reputation changes
            //------------------------------------------------------

            
    function getnew()
            {
                    
    $sort_key = array( 'name'     => 'sort_by_name',
                                       
    'rep'      => 'sort_by_rep',
                                       
    'times'    => 'sort_by_rep_changes',
                                                     );

                    
    $max_results = array( 10  => '10',
                                          
    20  => '20',
                                          
    30  => '30',
                                          
    40  => '40',
                                          
    50  => '50',
                                                      );

                    
    $sort_order = array( 'desc' => 'descending_order',
                                         
    'asc'  => 'ascending_order',
                                                            );

                    if (
    $this->ipsclass->member['g_mem_info'] != 1)
                    {
                            
    $this->ipsclass->Error( array( 'LEVEL' => 1'MSG' => 'no_permission' ) );
                    }

                    if (isset(
    $this->ipsclass->input['max_results']))
                    {
                            
    $this->max_results intval($this->ipsclass->input['max_results']);
                    }
                    else
                    {
                            
    $this->max_results 30;
                    }

                    if (isset(
    $this->ipsclass->input['st']))
                    {
                            
    $this->first       intval($this->ipsclass->input['st']);
                    }
                    else
                    {
                            
    $this->first 0;
                    }

                    if (isset(
    $this->ipsclass->input['sort_key']))
                    {
                            
    $this->sort_key    $this->ipsclass->input['sort_key'];
                    }
                    else
                    {
                            
    $this->sort_key    'rep';
                    }

                    if (isset(
    $this->ipsclass->input['sort_order']))
                    {
                            
    $this->sort_order  $this->ipsclass->input['sort_order'];
                    }
                    else
                    {
                            
    $this->sort_order  'desc';
                    }

                    
    $sort_key_html    "<select name='sort_key' class='forminput'>\n";
                    
    $max_results_html "<select name='max_results' class='forminput'>\n";
                    
    $sort_order_html  "<select name='sort_order' class='forminput'>\n";

                    foreach (
    $sort_order as $k => $v)
                    {
                            
    $sort_order_html .= $k == $this->sort_order "<option value='$k' selected>" $this->ipsclass->lang$sort_order$k ] ] . "\n"
                                                                                                                    
    "<option value='$k'>"          $this->ipsclass->lang$sort_order$k ] ] . "\n";
                    }

                    foreach (
    $sort_key as $k => $v)
                    {
                            
    $sort_key_html .= $k == $this->sort_key "<option value='$k' selected>"     $this->ipsclass->lang$sort_key$k ] ] . "\n"
                                                                                                            
    "<option value='$k'>"              $this->ipsclass->lang$sort_key$k ] ] . "\n";
                    }

                    foreach (
    $max_results as $k => $v)
                    {
                            
    $max_results_html .= $k == $this->max_results "<option value='$k' selected>"$max_results$k ] . "\n"
                                                                                                                      
    "<option value='$k'>"         $max_results$k ] . "\n";
                    }

                    
    $this->ipsclass->lang['sorting_text'] = preg_replace"/<#SORT_KEY#>/"    $sort_key_html."</select>"   $this->ipsclass->lang['sorting_text'] );
                    
    $this->ipsclass->lang['sorting_text'] = preg_replace"/<#SORT_ORDER#>/"  $sort_order_html."</select>" $this->ipsclass->lang['sorting_text'] );
                    
    $this->ipsclass->lang['sorting_text'] = preg_replace"/<#MAX_RESULTS#>/" $max_results_html."</select>"$this->ipsclass->lang['sorting_text'] );

                    
    $error 0;

                    if (! isset(
    $sort_key$this->sort_key ]) )       $error 1;
                    if (! isset(
    $sort_order$this->sort_order ]) )   $error 1;
                    if (! isset(
    $max_results$this->max_results ]) ) $error 1;

                    if (
    $error == )
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 5MSG =>'incorrect_use') );
                    }

                    
    $new "<a href='{$this->base_url}autocom=reputation&amp;CODE=totals'>{$this->ipsclass->lang['totals']}</a>";
                    
    $links "";

                    
    $this->output $this->ipsclass->compiled_templates['skin_ahreputation']->Links$links$new );

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->StatsLinks($this->ipsclass->lang['ntitle']);

                    
    $this->ipsclass->DB->simple_construct( array( 'select' => 'r.*, m.name, m.posts, m.mgroup, m.rep as rep_amount, m.title as m_title',
                                                  
    'from'   => 'reputation r, ibf_members m',
                                                  
    'where'  => "m.id=r.member_id AND msg_date > ".$this->ipsclass->member['last_visit']."",
                                                  
    'order'  => $this->sort_key." ".$this->sort_order,
                                                  
    'limit'  => array($this->first,$this->max_results)
                                                             )                );

                    
    $this->ipsclass->DB->simple_exec();

                    if (! 
    $this->ipsclass->DB->get_num_rows() )
                    {
                            
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowNone();
                    }
                    else
                    {
                            
    $new_reps = array();

                            while ( 
    $row $this->ipsclass->DB->fetch_row() )
                            {
                                    
    /* if (!empty($row['name']))      */ $new_reps$row['member_id'] ]['name'] = $row['name'];
                                    
    /* if (!empty($row['member_id'])) */ $new_reps$row['member_id'] ]['id']   = $row['member_id'];

                                    if (
    $row['CODE'] == '01')
                                    {
                                            
    $new_reps$row['member_id'] ]['up'] ++ ;
                                    }
                                    else
                                    {
                                            
    $new_reps$row['member_id'] ]['down'] ++ ;
                                    }

                                    
    $new_reps$row['from_id'] ]['times'] ++ ;

                                    
    $new_reps$row['member_id'] ]['mgroup']      = $row['mgroup'];
                                    
    $new_reps$row['member_id'] ]['rep_amount']  = $row['rep_amount'];
                                    
    $new_reps$row['member_id'] ]['posts']       = $row['posts'];
                                    
    $new_reps$row['member_id'] ]['m_title']     = $row['m_title'];
                            }

                            
    ksort($new_reps);

                            foreach (
    $new_reps as $member)
                            {
                                    if (!
    $member['name']) continue;

                                    
    $member['name'] = "<a href='{$this->base_url}showuser={$member['id']}'><b>{$member['name']}</b></a>" ;

                                    if (
    $member['up']) $member['rep'] = "+".$member['up'];

                                    if (
    $member['down'])
                                    {
                                            if (
    $member['up']) $member['rep'] .= " | ";

                                            
    $member['rep'] .= "-".$member['down'];
                                    }

                                    
    $member += $this->build_ranks$member );

                                    
    $member['group'] = $this->ipsclass->cache['group_cache'][$member['mgroup']]['g_title'];

                                    if (empty(
    $member['rep'])) $member['rep'] = $this->ipsclass->lang['no_changes'];
                                    else 
    $member['rep'] .= " ".$this->ipsclass->lang['rep_postfix'].
                                                                               
    " <a href='{$this->base_url}autocom=reputation&CODE=03&mid={$member['id']}'>{$this->ipsclass->lang['details']}</a>";

                                    if (empty(
    $member['times'])) $member['times'] = $this->ipsclass->lang['no_changes'];
                                    else 
    $member['times'] .= " ".$this->ipsclass->lang['rep_postfix'].
                                                                                     
    " <a href='{$this->base_url}autocom=reputation&amp;CODE=04&amp;mid={$member['id']}'>{$this->ipsclass->lang['details']}</a>";

                                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowTotalsRow($member);
                            }
                    }

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Page_end'getnew' );

                    
    $back "javascript:history.go(-1)";

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->ShowFooter($back);

                    
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->Links$links$new );

                    
    $this->nav        = array( $this->ipsclass->lang['nnav'] );
                    
    $this->page_title $this->ipsclass->lang['ntitle'];
            }

            
    //------------------------------------------------------
            // Save reputation post to db (on editing)
            //------------------------------------------------------

            
    function save_post()
            {
                    
    $this->ipsclass->input['pid'] = intval($this->ipsclass->input['pid']);

                    if (!
    $this->ipsclass->input['pid'])
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'missing_files') );
                    }

                    
    $i $this->ipsclass->DB->simple_exec_query ( array ( 'select' => 'member_id, from_id''from' => 'reputation''where' => 'msg_id = '.$this->ipsclass->input['pid'] ) );

                    if ( (
    $this->ipsclass->member['id'] != $i['from_id']) and (!$this->ipsclass->member['g_access_cp']) )
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'incorrect_use') );
                    }

                    
    //------------------------------------------------------
                    // Do not raise an error, just cut... hehe...
                    //------------------------------------------------------

                    
    if ($this->ipsclass->vars['rep_msg_length']) $this->ipsclass->input['Post'] = substr($this->ipsclass->input['Post'], 0$this->ipsclass->vars['rep_msg_length']);

                    
    $this->postlib->parser->parse_html    0;
                    
    $this->postlib->parser->parse_smilies $this->ipsclass->vars['rep_enable_emo'];
                    
    $this->postlib->parser->parse_bbcode  $this->ipsclass->vars['rep_enable_ibc'];

                    
    $post $this->postlib->han_editor->process_raw_post'Post' );
                    
    $message $this->postlib->parser->pre_db_parse$post );

                    if (
    $message != '')
                    {
                        
    $this->ipsclass->DB->do_update'reputation', array ( 'message' => $message ), "msg_id='".$this->ipsclass->input['pid']."'" );
                    }

                    
    $this->ipsclass->print->redirect_screen($this->ipsclass->lang['edit_success'], "autocom=reputation&CODE=03&mid=".$i['member_id'] );
            }

            
    //------------------------------------------------------
            // Add or edit comment
            //------------------------------------------------------

            
    function edit_comment()
            {
                    if (
    $this->ipsclass->vars['rep_allow_comments'] != 1)
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'missing_files') );
                    }

                    
    $this->ipsclass->input['id'] = intval($this->ipsclass->input['id']);

                    if (!
    $this->ipsclass->input['id'])
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'missing_files') );
                    }

                    
    $i $this->ipsclass->DB->simple_exec_query( array( 'select' => 'r.*, m.name as author',
                                                        
    'from'   => 'reputation r, ibf_members m',
                                                        
    'where'  => "msg_id={$this->ipsclass->input['id']} AND r.from_id=m.id"
                                               
    )                );

                    if (
    $this->ipsclass->member['id'] != $i['member_id'])
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'incorrect_use') );
                    }

                    
    $this->ipsclass->load_template('skin_post');
                    
    $this->ipsclass->load_words($this->ipsclass->lang'lang_post'$this->ipsclass->lang_id);

                    
    //------------------------------------------------------
                    // It's serialized, you remember
                    //------------------------------------------------------

                    
    $msg unserialize(stripslashes($i['comment']));
                    
    $i['date']    = $this->ipsclass->get_date($i['msg_date'], 'LONG');

                                    if ( ! 
    $i['vis'] and ! $this->ipsclass->member['g_access_cp'] )
                                    {
                            if (
    $i['CODE'] == '01' and $this->ipsclass->vars['rep_good_anon'])
                            {
                                
    $i['author'] = "{$this->ipsclass->vars['rep_good_anon']}";
                            }
                            else if (
    $i['author'] == '02' and $this->ipsclass->vars['rep_bad_anon'])
                            {
                                
    $i['author'] = "{$this->ipsclass->vars['rep_bad_anon']}";
                            }
                            else
                            {
                                    
    $i['author'] = "{$this->ipsclass->lang['is_anon']}";
                            }
                    }
                        if ( 
    $this->postlib->han_editor->method == 'rte' )
                        {
                            
    $text $this->postlib->parser->convert_ipb_html_to_html$this->ipsclass->my_nl2br$msg['content'] ) );                    }
                        else
                        {
                            
    $this->postlib->parser->parse_html 1;
                            
    $text $this->postlib->parser->pre_edit_parse$this->ipsclass->txt_stripslashes$msg['content'] ) );
                        }
                        
                           
    $this->output .= $this->ipsclass->compiled_templates['skin_ahreputation']->edit_comment$this->postlib->han_editor->show_editor$text'Comment' ), $i );

    //                $this->output = preg_replace( "/<!--IBF.REPLY_JS-->/", $this->ipsclass->compiled_templates['skin_post']->get_javascript(), $this->output );
    //                $this->output = preg_replace( "/<!--IBF.REPLY_BOX-->/", $this->ipsclass->compiled_templates['skin_post']->postbox_buttons($i['comment']), $this->output );

                    
    $this->output preg_replace"/<!--IBF.HTML-->/"$this->ipsclass->lang['html_off'], $this->output );

                    
    $this->nav        = array( $this->ipsclass->lang['do_comment'] );
                    
    $this->page_title $this->ipsclass->lang['do_comment'];
            }

            
    //------------------------------------------------------
            // Save comment to db
            //------------------------------------------------------

            
    function save_comment()
            {
                    if (
    $this->ipsclass->vars['rep_allow_comments'] != 1)
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'missing_files') );
                    }

                    
    $this->ipsclass->input['id'] = intval($this->ipsclass->input['id']);

                    if (!
    $this->ipsclass->input['id'])
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'missing_files') );
                    }

                    
    $i $this->ipsclass->DB->simple_exec_query( array( 'select' => '*',
                                                        
    'from'   => 'reputation',
                                                        
    'where'  => "msg_id={$this->ipsclass->input['id']}"
                                                                            
    )                );

                    if (
    $this->ipsclass->member['id'] != $i['member_id'])
                    {
                            
    $this->ipsclass->Error( array( LEVEL=> 1MSG =>'incorrect_use') );
                    }

                    
    $this->postlib->parser->parse_html    0;
                    
    $this->postlib->parser->parse_smilies $this->ipsclass->vars['rep_enable_emo'];
                    
    $this->postlib->parser->parse_bbcode  $this->ipsclass->vars['rep_enable_ibc'];

                    
    $post $this->postlib->han_editor->process_raw_post'Comment' );
                    
    $message2 $this->postlib->parser->pre_db_parse$post );
                    
    $message3 trim($message2);

                    
    //------------------------------------------------------
                    // I'ma cereal killa, lol
                    //------------------------------------------------------

                    
    if ($post != '')
                    {
                            
    $message['author_id']   = $this->ipsclass->member['id'];
                            
    $message['author_name'] = $this->ipsclass->member['name'];
                            
    $message['content']     = $message3;
                            
    $message['date']        = time();
                            
    $msg                    serialize($message);
                    }

                    
    $this->ipsclass->DB->do_update'reputation', array ( 'comment' => $msg ), "msg_id='".$this->ipsclass->input['id']."'" );

                    
    $this->ipsclass->print->redirect_screen($this->ipsclass->lang['comment_success'], "autocom=reputation&CODE=03&mid=".$i['member_id'] );
            }


            
    // ------------------
            // Utility Functions
            // ------------------

            
    function update_rep($new$memid)
            {
                    
    $this->ipsclass->DB->simple_exec_query( array( 'update' => 'members',
                                                   
    'set'    => "rep=".$new,
                                                   
    'where'  => "id=".$memid
                                          
    )      );

            }

            function 
    get_rep($memid)
            {
                    
    $info $this->ipsclass->DB->simple_exec_query( array( 'select' => 'rep',
                                                           
    'from'   => 'members',
                                                           
    'where'  => "id=$memid"
                                                    
    )                );
                    return 
    $info['rep'];
            }

            
    /*-------------------------------------------------------------------------*/
            // HTML: add smilie box.
            // ------------------
            // Inserts the clickable smilies box
            /*-------------------------------------------------------------------------*/

            
    function html_add_smilie_box($in_html="")
            {
                    
    $show_table 0;
                    
    $count      0;
                    
    $smilies    "<tr align='center'>\n";

                    
    //-----------------------------------------
                    // Get the smilies from the DB
                    //-----------------------------------------

                    
    if ( ! is_array$this->ipsclass->cache['emoticons'] ) )
                    {
                            
    $this->ipsclass->cache['emoticons'] = array();

                            
    $this->ipsclass->DB->simple_construct( array( 'select' => 'typed,image,clickable,emo_set''from' => 'emoticons' ) );
                            
    $this->ipsclass->DB->simple_exec();

                            while ( 
    $r $this->ipsclass->DB->fetch_row() )
                            {
                                    
    $this->ipsclass->cache['emoticons'][] = $r;
                            }
                    }

                    
    usort$this->ipsclass->cache['emoticons'] , array( 'reputation''smilie_alpha_sort' ) );

                    foreach( 
    $this->ipsclass->cache['emoticons'] as $a_id => $elmo )
                    {
                            if ( 
    $elmo['emo_set'] != $this->ipsclass->skin['_emodir'] )
                            {
                                    continue;
                            }

                            if ( ! 
    $elmo['clickable'] )
                            {
                                    continue;
                            }

                            
    $show_table++;
                            
    $count++;

                            
    $smilies .= "<td><a href='javascript:emoticon(\"{$elmo['typed']}\")'><img src=\"".$this->ipsclass->vars['EMOTICONS_URL']."/".$elmo['image']."\" alt=\"".$elmo['typed']."\" border='0' /></a></td>\n";

                            if (
    $count == $this->ipsclass->vars['emo_per_row'])
                            {
                                    
    $smilies .= "</tr>\n\n<tr align='center'>";
                                    
    $count 0;
                            }
                    }

                    if (
    $count != $this->ipsclass->vars['emo_per_row'])
                    {
                            for (
    $i $count $i $this->ipsclass->vars['emo_per_row'] ; ++$i)
                            {
                                    
    $smilies .= "<td>&nbsp;</td>\n";
                            }
                            
    $smilies .= "</tr>";
                    }

    //                $table = $this->ipsclass->compiled_templates['skin_post']->smilie_table();

      //              if ($show_table != 0)
      //            {
      //                      $table   = preg_replace( "/<!--THE SMILIES-->/", $smilies, $table );
      //                      $in_html = preg_replace( "/<!--SMILIE TABLE-->/", $table, $in_html );
      //              }

                    
    return $in_html;
            }

            
    //-----------------------------------------
            // Some custom sorts we need
            //-----------------------------------------

            
    function smilie_alpha_sort($a$b)
            {
                    return 
    strcmp$a['typed'], $b['typed'] );
            }

            function 
    reverse_order_sort($a$b)
            {
                    if (
    $a == $b) return 0;
                    if (
    $a $b <= 0)
                    {
                            return (
    $a $b) ? -1;
                    }
                    else if ( 
    $a >= and $b >= )
                    {
                            return (
    $a $b) ? -1;
                    }
                    else if ( 
    $a and $b )
                    {
                            return (
    $a $b) ? -1;
                    }
            }

            function 
    rep_sort_special($a$b)
            {
                    if (
    $a['AMOUNT'] == $b['AMOUNT']) return 0;
                    if (
    $a['AMOUNT'] * $b['AMOUNT'] <= 0)
                    {
                            return (
    $a['AMOUNT'] > $b['AMOUNT']) ? -1;
                    }
                    else if ( 
    $a['AMOUNT'] >= and $b['AMOUNT'] >= )
                    {
                            return (
    $a['AMOUNT'] > $b['AMOUNT']) ? -1;
                    }
                    else if ( 
    $a['AMOUNT'] < and $b['AMOUNT'] < )
                    {
                            return (
    $a['AMOUNT'] < $b['AMOUNT']) ? -1;
                    }
            }
        
        
    //-------------------------------------------------------
        // v5.x.x feautres *5.0.0 ALPHA 1* - AH Modding
        // NO LONGER USED, COMPLETE REWRITE OF SYSTEM IS PLANNED
        //-------------------------------------------------------
        
        # Topic View #
        
        
    function topicrep()
        {
        }
        
        
    # New XML/AJAX view #
        
    function ajax_add()
        {
        }
        
        function 
    xml_add_build_tabs()
        {
            
    $this->ipsclass->input['tab'] = $this->ipsclass->input['tab'] ? $this->ipsclass->input['tab'] : 'info';
            
            
    $onoff['add']   = 'taboff';
            
    $onoff['member'] = 'taboff';
            
            
    $onoff$this->ipsclass->input['tab'] ] = 'tabon';
            
            return 
    $this->ipsclass->compiled_templates['skin_ahreputation']->xml_tabs$onoff );
        }
        
        function 
    xml_add_member()
        {
            
    $this->output $this->ipsclass->compiled_templates['skin_ahreputation']->xml_add_member();
        }
        
        
    /***********************************************************
        * Copyright
        *
        * @desc Removing this without purchasing copyright removal is
        *        against the terms you agreed to whilst downloading
        * @since 10001
        ***********************************************************/        
        
    function copyright$vid )
        {
            eval( 
    base64_decode"CQkkdmVyc2lvbiA9ICggaXNzZXQoICR0aGlzLT5pcHNjbGFzcy0+dmFyc1snaXBiX2Rpc3BsYXlfdmVyc2lvbiddICkgQU5EICR0aGlzLT5pcHNjbGFzcy0+dmFyc1snaXBiX2Rpc3BsYXlfdmVyc2lvbiddICE9IDAgKSA/ICR0aGlzLT5pcHNjbGFzcy0+dmVyc2lvbiA6ICcnOw0KCQkNCiAgICAgICAgJGNvcHlyaWdodCA9ICI8IS0tIENvcHlyaWdodCBJbmZvcm1hdGlvbiAtLT4NCiAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGFsaWduPSdjZW50ZXInIGNsYXNzPSdjb3B5cmlnaHQnPg0KICAgICAgICAgICAgICAgICAgICAgICAgICBbQUgyMl0gUmVwb3J0IE1hbmFnZXIgdnskdmlkfSAmY29weTsgIi5kYXRlKCJZIikuIiZuYnNwOzxhIGhyZWY9J2h0dHA6Ly93d3cuYWhtb2RkaW5nLmhhYmJvLXdpZGUubmV0Lycgc3R5bGU9J3RleHQtZGVjb3JhdGlvbjpub25lJyB0YXJnZXQ9J19ibGFuayc+IEFIIE1vZGRpbmc8L2E+PGJyIC8+XG4iOw0KICAgICAgICANCiAgICAgICAgaWYgKCBUUklBTF9WRVJTSU9OICkNCiAgICAgICAgew0KICAgICAgICAgICAgJGNvcHlyaWdodCAuPSAiICAgICAgICAgICAgICAgICAgICAgICAgICBQb3dlcmVkIEJ5IDxhIGhyZWY9J2h0dHA6Ly93d3cuaW52aXNpb25ib2FyZC5jb20nIHN0eWxlPSd0ZXh0LWRlY29yYXRpb246bm9uZScgdGFyZ2V0PSdfYmxhbmsnPklQLkJvYXJkIHskdmVyc2lvbn08L2E+DQogICAgICAgICAgICAgICAgICAgICAgICAgICZjb3B5OyAiLmRhdGUoIlkiKS4iICZuYnNwOzxhIGhyZWY9J2h0dHA6Ly93d3cuaW52aXNp"
                            
    ."b25wb3dlci5jb20vJyBzdHlsZT0ndGV4dC1kZWNvcmF0aW9uOm5vbmUnIHRhcmdldD0nX2JsYW5rJz5JUFMsIEluYy48L2E+DQogICAgICAgICAgICAgICAgICAgICAgICAgIDxiciAvPjxzdHJvbmc+R2V0IHlvdXIgZnJlZSB0cmlhbCA8YSBocmVmPSdodHRwOi8vd3d3LmludmlzaW9uYm9hcmQuY29tJyB0YXJnZXQ9J19ibGFuaycgc3R5bGU9J3RleHQtZGVjb3JhdGlvbjp1bmRlcmxpbmU7Y29sb3I6IzAwMCc+aGVyZSE8L2E+PC9zdHJvbmc+XG4iOw0KICAgICAgICB9DQogICAgICAgIGVsc2UNCiAgICAgICAgew0KICAgICAgICAgICAgJGNvcHlyaWdodCAuPSAiICAgICAgICAgICAgICAgICAgICAgICAgICBQb3dlcmVkIEJ5IDxhIGhyZWY9J2h0dHA6Ly93d3cuaW52aXNpb25ib2FyZC5jb20nIHN0eWxlPSd0ZXh0LWRlY29yYXRpb246bm9uZScgdGFyZ2V0PSdfYmxhbmsnPklQLkJvYXJkIHskdmVyc2lvbn08L2E+DQogICAgICAgICAgICAgICAgICAgICAgICAgICZjb3B5OyAiLmRhdGUoIlkiKS4iICZuYnNwOzxhIGhyZWY9J2h0dHA6Ly93d3cuaW52aXNpb25wb3dlci5jb20vJyBzdHlsZT0ndGV4dC1kZWNvcmF0aW9uOm5vbmUnIHRhcmdldD0nX2JsYW5rJz5JUFMsIEluYy48L2E+XG4iOw0KICAgICAgICAgICAgICAgICAgICAgICAgICANCiAgICAgICAgICAgIGlmICggJHRoaXMtPmlwc2NsYXNzLT52YXJzWydpcGJfcmVnX3Nob3cnXSBhbmQgJHRoaXMtPmlwc2NsYXNzLT52YXJzWydpcGJfcmVnX25hbWUnXSApDQogICAgICAgICAgICB7DQogICAgICAgICAgICAgICA"
                            
    ."gJGNvcHlyaWdodCAuPSAiICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2PkxpY2Vuc2VkIHRvOiAiLiAkdGhpcy0+aXBzY2xhc3MtPnZhcnNbJ2lwYl9yZWdfbmFtZSddLiI8L2Rpdj5cbiI7DQogICAgICAgICAgICB9DQogICAgICAgIH0NCiAgICAgICAgDQogICAgICAgICRjb3B5cmlnaHQgLj0gIjwvZGl2PlxuPCEtLSAvIENvcHlyaWdodCAtLT4iOw0KICAgICAgICANCiAgICAgICAgcmV0dXJuICRjb3B5cmlnaHQ7" ) );$copyright str_replace'[AH22] Report Manager v''[AH22] Reputation System '$copyright );return $copyright;
                   
        }
        
         function 
    personal_function_load_member$member_id=)
         {
            
    //-----------------------------------------
            // INIT
            //-----------------------------------------
            
            
    $query '';
            
            
    //-----------------------------------------
            // What do we have?
            //-----------------------------------------
            
            
    if ( is_array$member_id ) )
            {
                
    $query 'm.id IN ('.implode','$member_id ) . ')';
            }
            else
            {
                
    $query 'm.id='.intval($member_id);
            }
            
            
    //-----------------------------------------
            // Load member
            //-----------------------------------------
        
            
    $this->ipsclass->DB->build_query( array( 'select'   => 'm.*',
                                                     
    'from'     => array( 'members' => 'm' ),
                                                     
    'where'    => $query,
                                                     
    'add_join' => array( => array( 'select' => 'me.*',
                                                                                      
    'from'   => array( 'member_extra' => 'me' ),
                                                                                      
    'where'  => 'me.id=m.id',
                                                                                      
    'type'   => 'left' ),
                                                                          
    => array( 'select' => 'pp.*',
                                                                                      
    'from'   => array( 'profile_portal' => 'pp' ),
                                                                                      
    'where'  => 'pp.pp_member_id=m.id',
                                                                                      
    'type'   => 'left' ),
                                                                             
    => array( 'select' => 'g.*',
                                                                                      
    'from'   => array( 'groups' => 'g' ),
                                                                                      
    'where'  => 'g.g_id=m.mgroup',
                                                                                      
    'type'   => 'left' ),
                                                                          
    => array( 'select' => 's.location_1_id, s.location_2_id, s.location_1_type, s.location_2_type, s.running_time, s.location as sesslocation',
                                                                                       
    'from'   => array( 'sessions' => 's' ),
                                                                                      
    'where'  => "s.member_id=m.id",
                                                                                      
    'type'   => 'left' ),
                                                                          
    => array( 'select' => 'pc.*',
                                                                                      
    'from'   => array( 'pfields_content' => 'pc' ),
                                                                                      
    'where'  => 'pc.member_id=m.id',
                                                                                      
    'type'   => 'left' ) ) ) );
            
    $this->ipsclass->DB->exec_query();
            
            if ( 
    is_array$member_id ) )
            {
                while( 
    $row $this->ipsclass->DB->fetch_row() )
                {
                    
    $member$row['id'] ] = $row;
                }
            }
            else
            {
                
    $member $this->ipsclass->DB->fetch_row();
            
                
    $member['pp_setting_count_visitors'] = ( $member['pp_setting_count_visitors'] != ) ? $member['pp_setting_count_visitors'] : 5;
                
    $member['pp_setting_count_comments'] = ( $member['pp_setting_count_comments'] != 0)  ? $member['pp_setting_count_comments'] : 5;
                
    $member['pp_setting_count_friends']  = ( $member['pp_setting_count_friends'] != )  ? $member['pp_setting_count_friends']  : 5;
            }
            
            return 
    $member;
        }        
        
    }

    ?>
    в этом коде что-то не правильно...
    В страничке где смотришь кто поднимал репутацию какому-то юзеру, там есть также репутации того кто голосовал...
    Вообщем там ссылка не правильно идёт, так и не смог найти... http://mydomain.ru/index.php?autocom=reputation&CODE=03&mid=0

    У всех mid=0 где тут ошибка?
     
  3. kerimchik

    kerimchik Прохожие

    {$this->ipsclass->lang['rep_name']}:&nbsp;<a href='{$this->ipsclass->base_url}autocom=reputation&CODE=03&mid={$id}'>{$text}</a>

    Ошибка в этой строке, а именно $id заменял всем mid, m_id, member_id, member['id'] и все такое... чем еще можно заменить чтоб решить проблему?
     
  4. ChibA

    ChibA Постоялец

    Регистр.:
    19 сен 2008
    Сообщения:
    52
    Симпатии:
    17
    Другим модом репы. Этот через задницу написал. Там код невалидный ппц.
    Автор сам удалил его откуда смог.
     
  5. Fox-Net

    Fox-Net Создатель

    Регистр.:
    28 июл 2007
    Сообщения:
    20
    Симпатии:
    4
    есть рабочий мод под 2.3.6?
    поделитесь плиз.
    а то что не ставлю - все не пашет.
     
  6. -USTAS-

    -USTAS- Постоялец

    Регистр.:
    26 май 2010
    Сообщения:
    131
    Симпатии:
    4
    Сейчас занят тем же вопрсом - нашли что-то для себя?
    Поделитесь пожалуйста ссылкой, если да.
    Спасибо!
     
  7. Deag1y

    Deag1y Писатель

    Регистр.:
    22 дек 2009
    Сообщения:
    4
    Симпатии:
    0
    этот мод на какую версию двига ?
     
  8. -USTAS-

    -USTAS- Постоялец

    Регистр.:
    26 май 2010
    Сообщения:
    131
    Симпатии:
    4
    Насколько я помню, этот по моему под 3-ю версию
    Хотя там вроде своя должна идти
     
  9. pavels1111

    pavels1111 Создатель

    Регистр.:
    3 мар 2010
    Сообщения:
    43
    Симпатии:
    2
    У меня тоже напряг с этим модом. Никак не могу добиться, чтобы нормально работала ссылка на страницу, где был получен плюс в репу. IPB 2.3.6
    Может кто-нибудь может скинуть работающий кусок исходника...
     
  10. -USTAS-

    -USTAS- Постоялец

    Регистр.:
    26 май 2010
    Сообщения:
    131
    Симпатии:
    4
    Так эта версия на 2.3.6 не предназначена
    Я прав?
     
Статус темы:
Закрыта.