-Bu mod ile forumunuzda üyeleriniz
Birbirlerine karma verebilir iyi veya kötü --
Birbirlerine karma verebilir iyi veya kötü --
Kod:
##############################################################
## MOD Title: Advanced Karma Mod
## MOD Author: Nome < [email protected] > 162783614
## MOD Original Author: countach44 < [email protected] >
## MOD Description: This will add the ability to give users karma points
## Stacks karma points in two different groups
## so that users both have + and - shown
## An hour based waiting option
## Admin and mods can add karma points any time they like (option)
## MOD Version: 1.3.0
##
## Installation Level: easy
## Installation Time: 10 Minutes
## Files To Edit: 6
## viewtopic.php
## includes/usercp_viewprofile.php
## templates/subSilver/template.cfg
## templates/subSilver/profile_view_body.tpl
## templates/subSilver/viewtopic_body.tpl
## language/lang_english/lang_main.php
## language/lang_german/lang_main.php
## Included Files: 4
## karma.php
## db_update.php
## templates/subSilver/images/icon_applaud.gif
## templates/subSilver/images/icon_smite.gif
##############################################################
## Author Notes: Thanks to countach44 for starting the mode
## I've made a few changes to his file, so that the
## MOD looks more attractive. At least to me ;)
##
## Special thanks to Dan for pointing out some bugs
## and suggesting a new feature.
##
## Special thanks to Siava for cleaning up my sqls
##
## Deutsche Version von psprofi <[email protected]> http://die-homepage.de.gg
##############################################################
## History
## - 1.3.0 - Fixed sql syntax
## - 1.2.2 - Added install/db_update.php (thx to http://www.phpbbhacks.com/forums/db_generator.php)
## - 1.2.1 - Fixed a bug with too powerful moders ;)
## - 1.2.0 - Fixed a major bug
## - 1.1.0 - Fixed a shop mod compability bug. Thx to E T < [email protected] >
## - 1.0.4 - Mod released
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ ALTER ]------------------------------------------
# Or upload and run the file install/db_update.php
ALTER TABLE `phpbb_users` ADD `karma_plus` MEDIUMINT DEFAULT '0' NOT NULL ;
ALTER TABLE `phpbb_users` ADD `karma_minus` MEDIUMINT DEFAULT '0' NOT NULL ;
ALTER TABLE `phpbb_users` ADD `karma_time` BIGINT DEFAULT '0' NOT NULL ;
#
# NOTE: 'phpbb_' is our $table_prefix
#
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),
#
#-----[ AFTER, ADD ]------------------------------------
#
'KARMA_PLUS' => $profiledata['karma_plus'],
'KARMA_MINUS' => $profiledata['karma_minus'],
#
#-----[ FIND ]------------------------------------------
#
'L_EMAIL' => $lang['Email'],
#
#-----[ AFTER, ADD ]------------------------------------
#
'L_KARMA' => $lang['Karma'],
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
#
#-----[ IN-LINE, FIND ]---------------------------------
#
, pt.bbcode_uid
#
#-----[ IN-LINE AFTER, ADD ]----------------------------
#
, u.karma_plus, u.karma_minus
#
#-----[ FIND ]------------------------------------------
#
//
// Again this will be handled by the templating
// code at some point
#
#-----[ BEFORE, ADD ]------------------------------------
# It's the only way I could get it working, not very neat though :(
# but thx to Siava it has become much better
//
// Advanced Karma Mod
//
$karma_plus = $postrow[$i]['karma_plus'];
$karma_minus = $postrow[$i]['karma_minus'];
$applaud_img = '';
$applaud_alt = '';
$applaud_url = '';
$smite_img = '';
$smite_alt = '';
$smite_url = '';
$poster_karma = '';
if ( ( $userdata['session_logged_in'] ) && ( $userdata['user_id'] != $poster_id ) && ( $poster_id != ANONYMOUS ) )
{
$applaud_alt = $lang['Applaud'];
$applaud_url = append_sid("karma.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&' . POST_POST_URL .'=' . $postrow[$i]['post_id'] . '&x=applaud');
$applaud_img = '<img src="' . $images['icon_applaud'] . '" width="11" height="11" alt="' . $applaud_alt . '" title="' . $applaud_alt . '" border="0" />';
$smite_alt = $lang['Smite'];
$smite_url = append_sid("karma.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&' . POST_POST_URL .'=' . $postrow[$i]['post_id'] . '&x=smite');
$smite_img = '<img src="' . $images['icon_smite'] . '" width="11" height="11" alt="' . $smite_alt . '" title="' . $smite_alt . '" border="0" />';
}
if ($poster_id != ANONYMOUS)
{
$poster_karma = $lang['Karma'] . ': +' . $karma_plus . '/-' . $karma_minus;
}
//
// Advanced Karma Mod
//
#
#-----[ FIND ]------------------------------------------
#
'POSTER_JOINED' => $poster_joined,
#
#-----[ AFTER, ADD ]------------------------------------
#
'POSTER_KARMA' => $poster_karma,
#
#-----[ FIND ]------------------------------------------
#
'MINI_POST_IMG' => $mini_post_img,
#
#-----[ AFTER, ADD ]------------------------------------
#
'APPLAUD_IMG' => $applaud_img,
'SMITE_IMG' => $smite_img,
#
#-----[ FIND ]------------------------------------------
#
'L_MINI_POST_ALT' => $mini_post_alt,
#
#-----[ AFTER, ADD ]------------------------------------
#
'L_APPLAUD_ALT' => $applaud_alt,
'L_SMITE_ALT' => $smite_alt,
#
#-----[ FIND ]------------------------------------------
#
'U_MINI_POST' => $mini_post_url,
#
#-----[ AFTER, ADD ]------------------------------------
#
'U_APPLAUD' => $applaud_url,
'U_SMITE' => $smite_url,
#*********************************************************************
#
# NOTE: You will have to apply these changes to all existing templates
# I use SubSilver as an example
#
#*********************************************************************
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------
#
$images['icon_minipost'] = "$current_template_images/icon_minipost.gif";
#
#-----[ AFTER, ADD ]------------------------------------
#
$images['icon_applaud'] = "$current_template_images/icon_applaud.gif";
$images['icon_smite'] = "$current_template_images/icon_smite.gif";
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_EMAIL_ADDRESS}:</span></td>
<td class="row1" valign="middle" width="100%"><b><span class="gen">{EMAIL_IMG}</span></b></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_KARMA}:</span></td>
<td class="row1" valign="middle" width="100%"><span class="gen">+{KARMA_PLUS}/-{KARMA_MINUS}</span></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
{postrow.POSTER_POSTS}<br />
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------------
#
{postrow.POSTER_KARMA} <a href="{postrow.U_APPLAUD}">{postrow.APPLAUD_IMG}</a><a href="{postrow.U_SMITE}">{postrow.SMITE_IMG}</a><br />
#**************************************************************************
#
# NOTE: You will have to apply these changes to all existing language packs
# I use lang_english as an example
#
#**************************************************************************
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['A_critical_error'] = 'A Critical Error Occurred';
#
#-----[ AFTER, ADD ]------------------------------------
#
//
// Advanced Karma Mod
//
$lang['Karma'] = 'Karma';
$lang['Applaud'] = 'Applaud';
$lang['Smite'] = 'Smelt';
$lang['Return_To_Topic'] = 'Return to topic';
$lang['Too_Soon'] = 'You can\'t change karma yet. Not enough time has passed';
$lang['No_Self_Karma'] = 'You can\'t change your karma';
$lang['Not_Enough_Posts_For_Karma'] = 'You must have a certain number of messages added before giving karma points!';
#
#-----[ OPEN ]------------------------------------------
#
language/lang_german/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['A_critical_error'] = 'Ein kritischer Fehler ist aufgetreten.';
#
#-----[ AFTER, ADD ]------------------------------------
#
// Advanced Karma Mod
$lang['Karma'] = 'Karma';
$lang['Applaud'] = 'Positiv';
$lang['Smite'] = 'Negativ';
$lang['Return_To_Topic'] = 'Zurück zum Thema';
$lang['Too_Soon'] = 'Du kannst keine weiteren Karma-Punkte vergeben. Es ist noch nicht genug Zeit vergangen.';
$lang['No_Self_Karma'] = 'Du kannst Dein Karma nicht ändern';
$lang['Not_Enough_Posts_For_Karma'] = 'Du musst eine bestimmte Anzahl von Beiträgen geschrieben haben, um Karma-Punkte vergeben zu können!';
#**************************************************************************
#
# NOTE: There are someoptional settings you might want to customize
#
#**************************************************************************
#
#
#-----> OPEN <------------------------------------------
#
#karma.php
#
#-----> FIND <------------------------------------------
# Around line 30
#$hours_past = 1;
#
#-----> CHANGE <------------------------------------------
#
#1 to number of hours to pass before giving karma poins
#0 = no time limit ;)
#
#
#-----> FIND <------------------------------------------
# Around line 32
#$allow_up = 1;
#
#
#-----> CHANGE <------------------------------------------
#
#This setting allows the admins and mods to give karma points any time they like
#if you set it to 0 they will not be able to do so
#if you set it to 1 they will
#
#-----> FIND <------------------------------------------
# Around line 34
#$min_posts = 0;
#
#
#-----> CHANGE <------------------------------------------
#
#This option prevents people from giving karma points until they've posted
#some messages
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
