Код: Выделить всё
##############################################################
## MOD Title: Comments For Advanced Karma Mod (Advanced)
## MOD Author: Nome < nome@bk.ru > 162783614
## MOD Description: This mod will allow you to give anonymous
## karma points when using original Comments
## Mod, and you'll also see which post the point
## was given for.
##
## MOD Version: 1.0.0
##
## Installation Level: Very Easy
## Installation Time: 3 Minutes
## Files To Edit: 4
## karma.php
## language/{$language}/lang_main.php
## templates/{$template}/karma_comments_body.tpl
## templates/{$template}/comments_popup.tpl
##############################################################
## Author Notes: You must have Advanced Karma Mod & Comments
## For Advanced Karma Mod installed before
## applying this mod!
##
##############################################################
## 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
##############################################################
#
#-----[ SQL ]-------------------------------------------
#
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -2, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 1, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0);
ALTER TABLE `phpbb_users_comments` ADD `post_id` MEDIUMINT(8) DEFAULT "0" NOT NULL;
#
#-----[ OPEN ]------------------------------------------
#
karma.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT c.giver_id, c.comment, c.action, c.comment_time, u.username
FROM " . USERS_COMMENTS_TABLE . " AS c, " . USERS_TABLE . " AS u
WHERE c.user_id = " . $HTTP_GET_VARS['u'] . " AND
c.giver_id = u.user_id
ORDER BY c.comment_time DESC";
#
#-----[ REPLACE WITH ]----------------------------------
#
$sql = "SELECT c.giver_id, c.comment, c.action, c.comment_time, c.post_id, u.username
FROM " . USERS_COMMENTS_TABLE . " AS c, " . USERS_TABLE . " AS u
WHERE c.user_id = " . $HTTP_GET_VARS['u'] . " AND
c.giver_id = u.user_id
ORDER BY c.comment_time DESC";
#
#-----[ FIND ]------------------------------------------
#
'TIME' => create_date($board_config['default_dateformat'], $row['comment_time'], $board_config['board_timezone']),
#
#-----[ AFTER, ADD ]------------------------------------
#
'U_FOR_POST' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $row['post_id'] ."#" . $row['post_id']),
#
#-----[ FIND ]------------------------------------------
#
'L_CLOSE_WINDOW' => $lang['Close_window'],
#
#-----[ AFTER, ADD ]------------------------------------
#
'L_FOR_POST' => $lang['For_Post'],
'I_FOR_POST' => $images['icon_latest_reply'],
#
#-----[ FIND ]------------------------------------------
#
if( ( $board_config['akm_blank'] == 0 ) && ( empty($HTTP_POST_VARS['comment']) ) && ( isset($HTTP_POST_VARS['post']) ) ) $error = true;
#
#-----[ AFTER, ADD ]------------------------------------
#
if( $HTTP_POST_VARS['anonymous_post'] ) unset($error);
#
#-----[ FIND ]------------------------------------------
#
'ERROR' => $error,
#
#-----[ AFTER, ADD ]------------------------------------
#
'POST_ANONYMOUS' =>$lang['Post_Anonymous'],
#
#-----[ FIND ]------------------------------------------
#
$comment = trim(addslashes(substr($HTTP_POST_VARS['comment'], 0, 255)));
#
#-----[ REPLACE WITH ]----------------------------------
#
$giver_id = ($HTTP_POST_VARS['anonymous_post']) ? '-2' : $userdata['user_id'];
$comment = ($HTTP_POST_VARS['anonymous_post']) ? '' : trim(addslashes(substr($HTTP_POST_VARS['comment'], 0, 255)));
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . USERS_COMMENTS_TABLE . " (user_id, giver_id, comment, action, comment_time)
VALUES ($user, " . $userdata['user_id'] . ", '" . $comment . "', $action, " . time() . ")";
#
#-----[ REPLACE WITH ]----------------------------------
#
$sql = "INSERT INTO " . USERS_COMMENTS_TABLE . " (user_id, giver_id, comment, action, comment_time, post_id)
VALUES ($user, " . $giver_id . ", '" . $comment . "', $action, " . time() . ", " . $post_id . ")";
#**************************************************************************
#
# 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['AKM_Error'] = 'You can not change karma without leaving comments!';
#
#-----[ AFTER, ADD ]------------------------------------
#
$lang['Post_Anonymous'] = 'Give the point anonymously (no comments allowed!)';
$lang['For_Post'] = 'For which post has the point been given';
#*********************************************************************
#
# NOTE: You will have to apply these changes to all existing templates
# I use SubSilver as an example
#
#*********************************************************************
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/karma_comments_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td colspan="2"><span class="gen">
<b>{L_COMMENT}</b><br /><textarea name="comment" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" MAXLENGTH="255"></textarea>
</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------
#
<tr>
<td colspan="2"><span class="gen"><input type="checkbox" name="anonymous_post">{POST_ANONYMOUS}</span></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/comments_popup.tpl
#
#-----[ FIND ]------------------------------------------
#
<th class="thHead" height="25"><b>{L_TIME}</b></th>
#
#-----[ AFTER, ADD ]------------------------------------
#
<th class="thHead" height="25"></th>
#
#-----[ FIND ]------------------------------------------
#
<td class="row2" nowrap><span class="gen">{comments.TIME}</span></td>
#
#-----[ AFTER, ADD ]------------------------------------
#
<td class="row1" nowrap><span class="gen"><a href="{comments.U_FOR_POST}" target="_blank"><img src="{I_FOR_POST}" alt="{L_FOR_POST}" title="{L_FOR_POST}" border="0" width="18" height="9"></a></span></td>
#
#-----[ FIND ]------------------------------------------
#
<td colspan="4" valign="top" class="row1" align="center"><span class="genmed"><a href="javascript:window.close();" class="genmed">{L_CLOSE_WINDOW}</a></span></td>
#
#-----[ REPLACE WITH ]----------------------------------
#
<td colspan="5" valign="top" class="row1" align="center"><span class="genmed"><a href="javascript:window.close();" class="genmed">{L_CLOSE_WINDOW}</a></span></td>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
, все никак не дойдут руки до того чтобы сделать ограничение по числу оставляемых комментов