Reputation MOD 0.1.1
: 21 czerwca 2009, 12:11
Zainstalowałem mod Reputacji wszystko ładnie pięknie działa i w PA. I wyświetla te kwadraciki (ikonki) przy Użytkowniku na stronie pisania posta ale jest jeden problem. Jak chcę dodać komuś pkt,. Reputacji to klikam w zielony kwadracik. Wpisuję Komentarz i klikam Wyślij. Pojawia mi się takie info:
A tu jest mój plik: reputation.php
Co robić?
Kod: Zaznacz cały
Fatal error: Call to undefined function ansi() in /home/grandiap/public_html/grandia/reputation.php on line 175Kod: Zaznacz cały
<?php
/**
*
* @author idiotnesia info@forumkomputer.web.id - http://www.forumkomputer.web.id
*
* @package phpBB3
* @version 0.1.1
* @copyright (c) 2008 forumkomputer.web.id
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/reputation_mod');
// Define initial vars
$mode = request_var('mode', 'positive');
$post_id = request_var('p', 0);
$submit = (isset($_POST['submit'])) ? true : false;
$cancel = (isset($_POST['cancel'])) ? true : false;
$message = request_var('message', '', true);
$point = request_var('point', 1);
$error = '';
if ($cancel)
{
$redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id;
redirect($redirect);
}
if (!$config['rp_enable'])
{
trigger_error($user->lang['RP_DISABLED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id . '">', '</a>'));
}
if (!$user->data['is_registered'])
{
login_box();
}
if (!$auth->acl_get('u_rp_give'))
{
trigger_error($user->lang['RP_USER_DISABLED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id . '">', '</a>'));
}
$sql = 'SELECT poster_id
FROM ' . POSTS_TABLE . "
WHERE post_id = $post_id";
$result = $db->sql_query($sql);
$rep_to = $db->sql_fetchfield('poster_id');
$db->sql_freeresult($result);
if (!$rep_to)
{
$user->setup('posting');
trigger_error('NO_POST');
}
$sql = 'SELECT rep_post_id
FROM ' . REPUTATIONS_TABLE . '
WHERE rep_from = ' . $user->data['user_id'] . '
AND rep_post_id = ' . $post_id;
$result = $db->sql_query($sql);
$rep_post_id = $db->sql_fetchfield('rep_post_id');
$db->sql_freeresult($result);
if ($rep_post_id)
{
trigger_error($user->lang['RP_SAME_POST'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id . '">', '</a>'));
}
if ($rep_to == $user->data['user_id'])
{
trigger_error($user->lang['RP_SELF'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id . '">', '</a>'));
}
$sql = 'SELECT user_hide_reputation
FROM ' . USERS_TABLE . "
WHERE user_id = $rep_to";
$result = $db->sql_query($sql);
$user_hide = $db->sql_fetchfield('user_hide_reputation');
$db->sql_freeresult($result);
if ($user_hide)
{
trigger_error('RP_USER_SELF_DISABLED');
}
$now = time();
$limit = $config['rp_user_spread'];
$sql = 'SELECT *
FROM ' . REPUTATIONS_TABLE . '
WHERE rep_from = ' . $user->data['user_id'] . '
ORDER BY rep_id DESC';
$result = $db->sql_query_limit($sql, $limit);
while ($row = $db->sql_fetchrow($result))
{
if ($config['rp_user_spread'] && !$auth->acl_get('u_rp_ignore') && ($row['rep_to'] == $rep_to))
{
trigger_error($user->lang['RP_USER_SPREAD_FIRST'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id . '">', '</a>'));
}
if ($config['rp_time_limitation'] && !$auth->acl_get('u_rp_ignore') && (($now - $row['rep_time']) < ($config['rp_time_limitation'] * 3600)))
{
trigger_error($user->lang['RP_TIMES_LIMIT'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id) . '#p' . $post_id . '">', '</a>'));
}
}
$db->sql_freeresult($result);
if ($config['rp_min_posts'] && ($user->data['user_posts'] < $config['rp_min_posts']))
{
$user_power = 0;
}
else
{
$user_power = 1;
if ($config['rp_total_posts'])
{
$user_power += intval($user->data['user_posts'] / $config['rp_total_posts']);
}
if ($config['rp_membership_days'])
{
$user_power += intval(intval(($now - $user->data['user_regdate']) / 86400) / $config['rp_membership_days']);
}
if ($config['rp_max_power'] && ($user_power > $config['rp_max_power']))
{
$user_power = $config['rp_max_power'];
}
}
$sql = 'SELECT group_reputation_power
FROM ' . GROUPS_TABLE . '
WHERE group_id = ' . $user->data['group_id'];
$result = $db->sql_query($sql);
$group_power = (int) $db->sql_fetchfield('group_reputation_power');
$db->sql_freeresult($result);
if ($group_power)
{
$user_power = $group_power;
}
$add_point = $user_power * $point;
if ($config['rp_comment_max_chars'] && (strlen($message) > $config['rp_comment_max_chars']))
{
$error = sprintf($user->lang['RP_TOO_LONG_COMMENT'], strlen($message), $config['rp_comment_max_chars']);
}
$form_name = 'reputation';
add_form_key($form_name);
if ($submit && !$error)
{
if (!check_form_key($form_name))
{
trigger_error($user->lang['FORM_INVALID']);
}
$text = utf8 ($message);
$uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
$allow_bbcode = $allow_urls = $allow_smilies = true;
generate_text_for_storage($text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
$sql_ary = array(
'rep_from' => $user->data['user_id'],
'rep_to' => $rep_to,
'rep_post_id' => $post_id,
'rep_point' => $add_point,
'rep_time' => $now,
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
'enable_bbcode' => $allow_bbcode,
'enable_urls' => $allow_urls,
'enable_smilies' => $allow_smilies,
'rep_comment' => $text
);
$db->sql_query('INSERT INTO ' . REPUTATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_reputation = user_reputation + ' . $add_point . '
WHERE user_id = ' . $rep_to;
$db->sql_query($sql);
$redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $post_id . '#p' . $post_id);
meta_refresh(3, $redirect);
trigger_error($user->lang['RP_SENT'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
trigger_error($message);
}
$template->assign_vars(array(
'POSITIVE' => ($mode == 'positive' && $point == 1) ? true : false,
'ERROR' => ($error) ? $error : '',
'COMMENT' => $message,
'U_POST_ACTION' => append_sid("{$phpbb_root_path}reputation.$phpEx", 'p=' . $post_id),)
);
page_header($user->lang['RP_TITLE']);
$template->set_filenames(array(
'body' => 'reputation_body.html')
);
page_footer();
?>