Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2011-04-17 19:21:34

Nero
Member
Registered: 2011-04-17
Posts: 1

Mod Reputation-System

Hello, has all I present the mod Reputation-System it is the same mod that for the version 1.2 but for the version 1.4.
I have him adapt with the team of FluxBB.fr Mod in French smile

http://fluxbb.org/resources/mods/reputa … ses/2.2.6/

Last edited by Nero (2011-04-18 06:41:45)

Offline

#2 2011-04-17 21:08:19

jejeje
Member
Registered: 2011-03-18
Posts: 288
Website

Re: Mod Reputation-System

just would like to say thanks for this i've downloaded it form fluxbb.fr (couldn't wait) But i hav eimportant remarks first change your install_mod to this one

<?php
/***********************************************************************/

// Some info about your mod.
$mod_title      = 'Reputation System';
$mod_version    = '2.2.6';
$release_date   = '2009-08-01';
$author         = 'hcs';
$author_email   = 'hcs@mail.ru';


// One or more versions of PunBB that this mod works on. The version names must match exactly!
$fluxbb_versions    = array('1.4.5');

// Set this to false if you haven't implemented the restore function (see below)
$mod_restore    = false;


// This following function will be called when the user presses the "Install" button.
function install()
{
    global $db, $db_type, $pun_config;
    
    switch ($db_type)
    {
        case 'mysql':
        case 'mysqli':

        $result = $db->query('ALTER TABLE '.$db->prefix.'users ADD COLUMN rep_minus INT(11) UNSIGNED DEFAULT 0') or error('Unable to add column reputation_minus into table '.$db->prefix.'users.',  __FILE__, __LINE__, $db->error());

        $result = $db->query('ALTER TABLE '.$db->prefix.'users ADD COLUMN rep_plus INT(11) UNSIGNED DEFAULT 0') or error('Unable to add column  rep_plus into table '.$db->prefix.'users.',  __FILE__, __LINE__, $db->error());
    
        $db->query('ALTER TABLE '.$db->prefix.'users ADD COLUMN reputation_enable SMALLINT DEFAULT 1') or             error('Unable to add column reputation_enable into table '.$db->prefix.'users.',  __FILE__, __LINE__, $db->error());

        $db->query('CREATE TABLE '.$db->prefix.'reputation (id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, user_id INT(10) UNSIGNED NOT NULL DEFAULT 0,    from_user_id INT(10) UNSIGNED NOT NULL DEFAULT 0, time INT(10) UNSIGNED NOT NULL DEFAULT 0,    post_id INT(10) UNSIGNED NOT NULL DEFAULT 0, reason TEXT NOT NULL, rep_plus TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, rep_minus TINYINT(1) UNSIGNED NOT NULL  DEFAULT 0, topics_id INT(10) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id) )TYPE=MyISAM;') or error('Unable to create table '.$db->prefix.'reputation.',  __FILE__, __LINE__, $db->error());

        $db->query('ALTER TABLE '.$db->prefix.'reputation ADD INDEX rep_post_id_idx(post_id);') or error('Unable to create INDEX rep_post_id_idx in '.$db->prefix.'reputation.',  __FILE__, __LINE__, $db->error());

        $db->query('ALTER TABLE '.$db->prefix.'reputation ADD INDEX rep_multi_user_id_idx(topics_id, from_user_id);') or     error('Unable to create INDEX rep_multi_user_id_idx '.$db->prefix.'reputation.',  __FILE__, __LINE__, $db->error());
        
         $db->query('ALTER TABLE '.$db->prefix.'users ADD COLUMN reputation_enable_adm TINYINT(1) UNSIGNED DEFAULT 1') or error('Unable to add column reputation_enable_adm into table '.$db->prefix.'users.',  __FILE__, __LINE__, $db->error());

         $db->query('ALTER TABLE '.$db->prefix.'groups ADD COLUMN g_rep_minus_min INT(10) UNSIGNED DEFAULT 0') or error('Unable to add column g_rep_minus_min into table '.$db->prefix.'groups.',  __FILE__, __LINE__, $db->error());
        
        $db->query('ALTER TABLE '.$db->prefix.'groups ADD COLUMN g_rep_plus_min INT(10) UNSIGNED DEFAULT 0') or error('Unable to add column g_rep_plus_min into table '.$db->prefix.'groups.',  __FILE__, __LINE__, $db->error());
                
        $db->query('ALTER TABLE '.$db->prefix.'groups ADD COLUMN g_rep_enable SMALLINT DEFAULT 1') or     error('Unable to add column g_rep_enable into table '.$db->prefix.'groups.',  __FILE__, __LINE__, $db->error());
                     
        ///Try to add config value
        $config = array(
        'o_reputation_enabled'            => '1',
        'o_reputation_timeout'            => '300',
        );
        while (list($conf_name, $conf_value) = @each($config)){
            $db->query('INSERT INTO '.$db->prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)");
                $xxx = $db->error();
                if ($xxx['error_no'] != '1062' && $xxx['error_no'] != '0') {
                        error('Unable to insert config value into table '.$db->prefix.'config. ',  __FILE__, __LINE__, $db->error());
                }
        }        
            break;

    }
    
    
    $d = dir(PUN_ROOT.'cache');
    while (($entry = $d->read()) !== false)
    {
        if (substr($entry, strlen($entry)-4) == '.php')
            @unlink(PUN_ROOT.'cache/'.$entry);
    }


    $db->close();
}

// This following function will be called when the user presses the "Restore" button (only if $mod_uninstall is true (see above))
function restore()
{
    global $db, $db_type, $pun_config;
}

/***********************************************************************/

// DO NOT EDIT ANYTHING BELOW THIS LINE!


// Circumvent maintenance mode
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

// We want the complete error message if the script fails
if (!defined('PUN_DEBUG'))
    define('PUN_DEBUG', 1);

// Make sure we are running a PunBB version that this mod works with
if(!in_array($pun_config['o_cur_version'], $fluxbb_versions))
    exit('You are running a version of PunBB ('.$pun_config['o_cur_version'].') that this mod does not support. This mod supports PunBB versions: '.implode(', ', $fluxbb_versions));

$style = (isset($cur_user)) ? $cur_user['style'] : $pun_config['o_default_style'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $mod_title ?> installation</title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_config['o_default_style'].'.css' ?>" />
</head>
<body>

<div id="punwrap">
<div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">

<?php

if (isset($_POST['form_sent']))
{
    if (isset($_POST['install']))
    {
        // Run the install function (defined above)
        install();

?>
<div class="block">
    <h2><span>Installation successful</span></h2>
    <div class="box">
        <div class="inbox">
            <p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p>
        </div>
    </div>
</div>
<?php

    }
    else
    {
        // Run the restore function (defined above)
        restore();

?>
<div class="block">
    <h2><span>Restore successful</span></h2>
    <div class="box">
        <div class="inbox">
            <p>Your database has been successfully restored.</p>
        </div>
    </div>
</div>
<?php

    }
}
else
{

?>
<div class="blockform">
    <h2><span>Mod installation</span></h2>
    <div class="box">
        <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?foo=bar">
            <div><input type="hidden" name="form_sent" value="1" /></div>
            <div class="inform">
                <p>This script will update your database to work with the following modification:</p>
                <p><strong>Mod title:</strong> <?php echo pun_htmlspecialchars($mod_title).' '.$mod_version ?></p>
                <p><strong>Author:</strong> <?php echo pun_htmlspecialchars($author) ?> (<a href="mailto:<?php echo pun_htmlspecialchars($author_email) ?>"><?php echo pun_htmlspecialchars($author_email) ?></a>)</p>
                <p><strong>Disclaimer:</strong> Mods are not officially supported by PunBB. Mods generally can't be uninstalled without running SQL queries manually against the database. Make backups of all data you deem necessary before installing.</p>
<?php if ($mod_restore): ?>                <p>If you've previously installed this mod and would like to uninstall it, you can click the restore button below to restore the database.</p>
<?php endif; ?>            </div>
            <p><input type="submit" name="install" value="Install" /><?php if ($mod_restore): ?><input type="submit" name="restore" value="Restore" /><?php endif; ?></p>
        </form>
    </div>
</div>
<?php

}

?>

</div>
</div>

</body>
</html>

Second you need to fix when you try to submit a reputation it cause a fatal error at the title i've fixed it on my board what i did is install a manual title this is not accepted to be released to all users so you need to fix it too smile , can't remember if theres any other issues but it works for now big_smile (ill add any, if found later on)
To everyone would like to see an example look at my board .lebgamers.com

Offline

#3 2011-04-17 21:25:59

jejeje
Member
Registered: 2011-03-18
Posts: 288
Website

Re: Mod Reputation-System

yup and one more thing delete this line from reputation.php

if ($pun_user['is_guest']) echo "\t\t\t\t\t".'<tr><td colspan="5" style="text-align:right;">'.base64_decode('PGEgaHJlZj0iaHR0cDovL3B1bmJiLnJ1Ij5SZXB1dGF0aW9uIHN5c3RlbSBmb3IgUHVuQkI8L2E+').'</td></tr>'."\n";

good trick wink

Offline

#4 2011-04-18 10:25:23

adaur
Developer
From: France
Registered: 2010-01-07
Posts: 843
Website

Re: Mod Reputation-System

Now you've tried Nero, I can give you the /include files modified by myself, they're cleaner:

rep_profile.php

<?php 
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit();

require_once PUN_ROOT.'lang/'.$pun_user['language'].'/reputation.php';
if ($pun_config['o_reputation_enabled'] == 1 && $pun_user['reputation_enable_adm'] == 1) :
?>
                <div class="inform">
                    <fieldset>
                        <legend><?php echo $lang_reputation['Manage reputation'] ?></legend>
                        <div class="infldset">
                            <label><?php echo $lang_reputation['Description Manage reputation'] ?><br />
                            <input type="radio" name="reputation_enable" value="1"<?php if ($pun_user['reputation_enable'] == '1') echo ' checked="checked"' ?> />&nbsp;<strong>Oui</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="reputation_enable" value="0"<?php if ($pun_user['reputation_enable'] == '0') echo ' checked="checked"' ?> />&nbsp;<strong>Non</strong>
                        </div>
                    </fieldset>
                </div>
<?php
endif;

rep_viewtopic

<?php 
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

if ($cur_post['poster_id'] != 1 && $pun_user['g_rep_enable'] == 1 && $pun_config['o_reputation_enabled'] == 1 && $cur_post['reputation_enable'] == 1 && $pun_user['reputation_enable_adm'] == 1 && $pun_user['reputation_enable'] == 1) :

    $total_reputation = $cur_post['count_rep_plus']-$cur_post['count_rep_minus'];

    echo '<dd><span>';
    echo '<a href="reputation.php?uid='.$cur_post['poster_id'] . '">'. $lang_reputation['Reputation'] . '</a> : '; 
    
    //If viewer are guest or user who post this message,then we do not show control buttons
    if(!$pun_user['is_guest'] && $pun_user['username'] != $cur_post['username'])
    {
        echo '<a href="./reputation.php?pid='.$cur_post['id'] . '&uid=' .$cur_post['poster_id'] .'&method=1"><img src="./img/warn_add.gif" alt="+" border="0"></a> ';
        echo '<strong>'.$total_reputation.' </strong>';
        echo '<a href="./reputation.php?pid='.$cur_post['id'] . '&uid=' .$cur_post['poster_id'] .'&method=2"><img src="./img/warn_minus.gif" alt="-" border="0"></a>';
    }
    else
        echo '<strong>'.$total_reputation.'</strong>';
        
    echo '</span></dd>';

endif;

FeatherBB - A simple and lightweight new generation forum system
Based on FluxBB, written in PHP, using Slim Framework for a proper OOP-MVC architecture.

Offline

#5 2013-08-05 20:15:42

takasur
New member
From: WWW
Registered: 2013-08-05
Posts: 3

Re: Mod Reputation-System

not working with version 1.5.3 :S

Offline

#6 2013-08-06 12:28:50

adaur
Developer
From: France
Registered: 2010-01-07
Posts: 843
Website

Re: Mod Reputation-System

What's not working? I can't remember of any modification that would prevent the mod to work properly.


FeatherBB - A simple and lightweight new generation forum system
Based on FluxBB, written in PHP, using Slim Framework for a proper OOP-MVC architecture.

Offline

#7 2014-01-25 12:19:04

chris98
Member
From: England, United Kingdom
Registered: 2013-05-31
Posts: 1,292
Website

Re: Mod Reputation-System

Em, nothing appears in viewtopic.php?

Also, in this display tab in a user's profile, I have the option of making reputation available or not - does this disable reputation for this user or does it simply stop them from seeing any across the board?

Offline

#8 2020-06-15 04:52:54

irbees2008
Member
From: KZ. Shakhtinsk
Registered: 2020-06-14
Posts: 10

Re: Mod Reputation-System

how to make this mod work on 1.5.version of the forum. Moved from forum version 1.2 to 1.5


жизнь бьет ключом,... иногда и гайкой ))

Offline

Board footer

Powered by FluxBB